Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor 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
calibration
pycalibration
Commits
3d5b449e
Commit
3d5b449e
authored
2 years ago
by
Karim Ahmed
Browse files
Options
Downloads
Patches
Plain Diff
fix ndarray and fix format_time time format to calcat expected isoformat
parent
a337f9b6
No related branches found
No related tags found
1 merge request
!738
New calcat interface
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cal_tools/calcat_interface.py
+8
-5
8 additions, 5 deletions
src/cal_tools/calcat_interface.py
with
8 additions
and
5 deletions
src/cal_tools/calcat_interface.py
+
8
−
5
View file @
3d5b449e
...
@@ -106,7 +106,7 @@ class CalCatApi(metaclass=ClientWrapper):
...
@@ -106,7 +106,7 @@ class CalCatApi(metaclass=ClientWrapper):
"""
Parse different ways to specify time to CalCat.
"""
"""
Parse different ways to specify time to CalCat.
"""
if
isinstance
(
dt
,
datetime
):
if
isinstance
(
dt
,
datetime
):
return
dt
.
astimezone
(
timezone
.
utc
).
strftime
(
"
%Y%m%dT%H%M%S%Z
"
)
return
dt
.
astimezone
(
timezone
.
utc
).
isoformat
(
)
elif
isinstance
(
dt
,
date
):
elif
isinstance
(
dt
,
date
):
return
cls
.
format_time
(
datetime
.
combine
(
dt
,
time
()))
return
cls
.
format_time
(
datetime
.
combine
(
dt
,
time
()))
...
@@ -528,8 +528,6 @@ class CalibrationData:
...
@@ -528,8 +528,6 @@ class CalibrationData:
self
.
detector
[
"
id
"
],
self
.
pdu_snapshot_at
,
self
.
module_naming
self
.
detector
[
"
id
"
],
self
.
pdu_snapshot_at
,
self
.
module_naming
)
)
@property
@property
def
condition
(
self
):
def
condition
(
self
):
return
self
.
_build_condition
(
self
.
parameters
)
return
self
.
_build_condition
(
self
.
parameters
)
...
@@ -589,7 +587,7 @@ class CalibrationData:
...
@@ -589,7 +587,7 @@ class CalibrationData:
self
,
self
,
module
,
module
,
calibration
,
calibration
,
metadata
,
metadata
=
None
,
):
):
"""
Load CCV data as ndarray.
"""
Load CCV data as ndarray.
...
@@ -602,6 +600,8 @@ class CalibrationData:
...
@@ -602,6 +600,8 @@ class CalibrationData:
Returns:
Returns:
(ndarray): CCV data
(ndarray): CCV data
"""
"""
import
numpy
as
np
if
self
.
caldb_root
is
None
:
if
self
.
caldb_root
is
None
:
raise
RuntimeError
(
"
calibration database store unavailable
"
)
raise
RuntimeError
(
"
calibration database store unavailable
"
)
...
@@ -611,7 +611,10 @@ class CalibrationData:
...
@@ -611,7 +611,10 @@ class CalibrationData:
if
metadata
is
None
:
if
metadata
is
None
:
metadata
=
self
.
metadata
([
calibration
])
metadata
=
self
.
metadata
([
calibration
])
return
self
.
_load_ccv_data
(
metadata
,
module
,
calibration
)
row
=
metadata
[
module
][
calibration
]
with
h5py
.
File
(
self
.
caldb_root
/
row
[
'
path
'
],
'
r
'
)
as
f
:
return
np
.
asarray
(
f
[
row
[
'
dataset
'
]
+
'
/data
'
])
def
_allocate_constant_arrays
(
self
,
metadata
,
const_load_mp
,
const_data
):
def
_allocate_constant_arrays
(
self
,
metadata
,
const_load_mp
,
const_data
):
...
...
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