Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pyDCCandDBTools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benedikt
pyDCCandDBTools
Commits
b150cb2c
Commit
b150cb2c
authored
2 years ago
by
Benedikt Seeger
Browse files
Options
Downloads
Patches
Plain Diff
docstring stubs added
parent
a5c349e5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pccDccTools.py
+56
-1
56 additions, 1 deletion
pccDccTools.py
with
56 additions
and
1 deletion
pccDccTools.py
+
56
−
1
View file @
b150cb2c
...
...
@@ -12,7 +12,7 @@ def checkDSiToolsVersionCompatibility(versionToCheck):
if
versionToCheck
==
DSITOOLSVERSION
:
return
True
else
:
raise
RuntimeWarning
(
"
Using Data from Different DSI Tool versions
c
heck for sanity
"
)
raise
RuntimeWarning
(
"
Using Data from Different DSI Tool versions
. C
heck for sanity
"
)
class
dsiJSONEncoder
(
json
.
JSONEncoder
):
def
default
(
self
,
obj
):
...
...
@@ -39,7 +39,16 @@ del revd
class
dsiVector
:
def
__init__
(
self
,
values
,
uncer
,
quantity
,
unit
,
uncerType
=
"
absolute
"
):
'''
:param values:
:param uncer:
:param quantity:
:param unit:
:param uncerType:
'''
self
.
dataType
=
self
.
__class__
.
__name__
self
.
dsiToolsVersion
=
DSITOOLSVERSION
self
.
quantity
=
str
(
quantity
)
...
...
@@ -68,6 +77,11 @@ class dsiVector:
@classmethod
def
fromdict
(
cls
,
dict
):
'''
:param dict:
:return:
'''
if
checkDSiToolsVersionCompatibility
(
dict
[
'
dsiToolsVersion
'
])
==
False
:
raise
ValueError
(
"
Incompatible DSI Tools Versions JSONData/This Software
"
+
str
(
dict
[
'
dsiToolsVersion
'
])
+
'
/
'
+
str
(
DSITOOLSVERSION
))
# change constructor so that np.arrays are created
...
...
@@ -83,10 +97,21 @@ class dsiVector:
@classmethod
def
fromjson
(
cls
,
jsonstr
):
'''
:param jsonstr:
:return:
'''
dict
=
json
.
loads
(
jsonstr
)
return
cls
.
fromdict
(
dict
)
def
InterPolatedValuesTODSIVector
(
self
,
values
,
uncer
):
'''
:param values:
:param uncer:
:return:
'''
# change constructor so that np.arrays are created
if
type
(
values
)
!=
np
.
ndarray
:
values
=
np
.
array
(
values
)
...
...
@@ -110,6 +135,10 @@ class dsiVector:
return
resultDSiVector
def
jsonDumps
(
self
):
'''
:return:
'''
return
json
.
dumps
(
self
.
__dict__
,
cls
=
dsiJSONEncoder
)
...
...
@@ -178,6 +207,12 @@ class dsiVector:
class
dsiMultiVector
:
def
__init__
(
self
,
indexVector
,
valueVectors
,
interpolationTypes
=
None
):
#TODO add interpolation args
'''
:param indexVector:
:param valueVectors:
:param interpolationTypes:
'''
self
.
dataType
=
self
.
__class__
.
__name__
self
.
dsiToolsVersion
=
DSITOOLSVERSION
self
.
index
=
indexVector
...
...
@@ -207,6 +242,11 @@ class dsiMultiVector:
@classmethod
def
fromdict
(
cls
,
dict
):
'''
:param dict:
:return:
'''
if
checkDSiToolsVersionCompatibility
(
dict
[
'
dsiToolsVersion
'
])
==
False
:
raise
ValueError
(
"
Incompatible DSI Tools Versions JSONData/This Software
"
+
str
(
dict
[
'
dsiToolsVersion
'
])
+
'
/
'
+
str
(
DSITOOLSVERSION
))
...
...
@@ -233,6 +273,11 @@ class dsiMultiVector:
@classmethod
def
fromjson
(
cls
,
jsonstr
):
'''
:param jsonstr:
:return:
'''
dict
=
json
.
loads
(
jsonstr
)
return
cls
.
fromdict
(
dict
)
...
...
@@ -263,6 +308,12 @@ class dsiMultiVector:
class
dsiInterpolator
:
def
__init__
(
self
,
indexVector
,
dataVector
,
type
):
'''
:param indexVector:
:param dataVector:
:param type:
'''
self
.
dataType
=
self
.
__class__
.
__name__
self
.
dsitoolsVersion
=
DSITOOLSVERSION
self
.
indexQuantity
=
indexVector
[
'
quantity
'
]
...
...
@@ -283,6 +334,10 @@ class dsiInterpolator:
return
str
(
self
.
dataType
)
+
"
@
"
+
hex
(
id
(
self
))
+
'
'
+
str
(
self
.
type
)
+
'
'
+
str
(
self
.
interpolatorSoftware
)
+
'
'
+
str
(
self
.
interPolatorSoftwareVersion
)
+
'
X>
'
+
str
(
self
.
indexQuantity
)
+
'
Y>
'
+
str
(
self
.
dataQuantity
)
def
toDict
(
self
):
'''
:return:
'''
exclude_keys
=
[
'
interpolators
'
,
'
dataVector
'
,
'
indexVector
'
]
return
{
k
:
self
.
__dict__
[
k
]
for
k
in
set
(
list
(
self
.
__dict__
.
keys
()))
-
set
(
exclude_keys
)}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment