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
7e94a027
Commit
7e94a027
authored
1 year ago
by
Thomas Kluyver
Browse files
Options
Downloads
Patches
Plain Diff
Add test for detector with some modules missing
parent
e59c9fc3
No related branches found
No related tags found
1 merge request
!885
Revised CalCat API
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_calcat_interface2.py
+29
-10
29 additions, 10 deletions
tests/test_calcat_interface2.py
with
29 additions
and
10 deletions
tests/test_calcat_interface2.py
+
29
−
10
View file @
7e94a027
import
pytest
import
pytest
from
cal_tools.calcat_interface2
import
(
from
cal_tools.calcat_interface2
import
(
CalibrationData
,
AGIPDConditions
,
SingleConstantVersion
,
CalibrationData
,
AGIPDConditions
,
DSSCConditions
,
SingleConstantVersion
,
)
)
...
@@ -22,11 +25,11 @@ def test_AGIPD_CalibrationData_metadata():
...
@@ -22,11 +25,11 @@ def test_AGIPD_CalibrationData_metadata():
cond
,
cond
,
"
MID_DET_AGIPD1M-1
"
,
"
MID_DET_AGIPD1M-1
"
,
event_at
=
"
2022-09-01 13:26:48.00
"
,
event_at
=
"
2022-09-01 13:26:48.00
"
,
calibrations
=
[
'
Offset
'
,
'
SlopesFF
'
],
calibrations
=
[
"
Offset
"
,
"
SlopesFF
"
],
)
)
assert
'
Offset
'
in
agipd_cd
assert
"
Offset
"
in
agipd_cd
assert
set
(
agipd_cd
[
'
Offset
'
].
constants
)
==
{
f
'
AGIPD
{
i
:
02
}
'
for
i
in
range
(
16
)}
assert
set
(
agipd_cd
[
"
Offset
"
].
constants
)
==
{
f
"
AGIPD
{
m
:
02
}
"
for
m
in
range
(
16
)}
assert
isinstance
(
agipd_cd
[
'
Offset
'
].
constants
[
'
AGIPD00
'
],
SingleConstantVersion
)
assert
isinstance
(
agipd_cd
[
"
Offset
"
].
constants
[
"
AGIPD00
"
],
SingleConstantVersion
)
@pytest.mark.requires_gpfs
@pytest.mark.requires_gpfs
...
@@ -47,20 +50,36 @@ def test_AGIPD_CalibrationData_metadata_SPB():
...
@@ -47,20 +50,36 @@ def test_AGIPD_CalibrationData_metadata_SPB():
event_at
=
"
2020-01-07 13:26:48.00
"
,
event_at
=
"
2020-01-07 13:26:48.00
"
,
)
)
assert
"
Offset
"
in
agipd_cd
assert
"
Offset
"
in
agipd_cd
assert
set
(
agipd_cd
[
"
Offset
"
].
constants
)
==
{
f
"
AGIPD
{
i
:
02
}
"
for
i
in
range
(
16
)}
assert
set
(
agipd_cd
[
"
Offset
"
].
constants
)
==
{
f
"
AGIPD
{
m
:
02
}
"
for
m
in
range
(
16
)}
assert
agipd_cd
[
"
Offset
"
].
module_nums
==
list
(
range
(
16
))
assert
agipd_cd
[
"
Offset
"
].
module_nums
==
list
(
range
(
16
))
assert
agipd_cd
[
"
Offset
"
].
qm_names
==
[
assert
agipd_cd
[
"
Offset
"
].
qm_names
==
[
f
"
Q
{
(
i
//
4
)
+
1
}
M
{
(
i
%
4
)
+
1
}
"
for
i
in
range
(
16
)
f
"
Q
{
(
m
//
4
)
+
1
}
M
{
(
m
%
4
)
+
1
}
"
for
m
in
range
(
16
)
]
]
assert
isinstance
(
agipd_cd
[
"
Offset
"
].
constants
[
"
AGIPD00
"
],
SingleConstantVersion
)
assert
isinstance
(
agipd_cd
[
"
Offset
"
].
constants
[
"
AGIPD00
"
],
SingleConstantVersion
)
@pytest.mark.requires_gpfs
def
test_DSSC_modules_missing
():
dssc_cd
=
CalibrationData
.
from_condition
(
DSSCConditions
(
sensor_bias_voltage
=
100
,
memory_cells
=
600
),
"
SQS_DET_DSSC1M-1
"
,
event_at
=
"
2023-11-29 00:00:00
"
,
)
# DSSC was used with only 3 quadrants at this point
modnos
=
list
(
range
(
4
))
+
list
(
range
(
8
,
16
))
assert
dssc_cd
.
aggregator_names
==
[
'
DSSC{m:02}
'
for
m
in
modnos
]
assert
dssc_cd
.
module_nums
==
modnos
assert
dssc_cd
.
qm_names
==
[
f
"
Q
{
(
m
//
4
)
+
1
}
M
{
(
m
%
4
)
+
1
}
"
for
m
in
modnos
]
@pytest.mark.xfail
@pytest.mark.xfail
@pytest.mark.requires_gpfs
@pytest.mark.requires_gpfs
def
test_AGIPD_CalibrationData_report
():
def
test_AGIPD_CalibrationData_report
():
"""
Test CalibrationData with data from report
"""
"""
Test CalibrationData with data from report
"""
# Report ID: https://in.xfel.eu/calibration/reports/3757
# Report ID: https://in.xfel.eu/calibration/reports/3757
agipd_cd
=
CalibrationData
.
from_report
(
3757
)
agipd_cd
=
CalibrationData
.
from_report
(
3757
)
assert
set
(
agipd_cd
)
==
{
'
Offset
'
,
'
Noise
'
,
'
ThresholdsDark
'
,
'
BadPixelsDark
'
}
assert
set
(
agipd_cd
)
==
{
"
Offset
"
,
"
Noise
"
,
"
ThresholdsDark
"
,
"
BadPixelsDark
"
}
assert
agipd_cd
.
aggregator_names
==
[
f
'
AGIPD
{
n
:
02
}
'
for
n
in
range
(
16
)]
assert
agipd_cd
.
aggregator_names
==
[
f
"
AGIPD
{
n
:
02
}
"
for
n
in
range
(
16
)]
assert
isinstance
(
agipd_cd
[
'
Offset
'
].
constants
[
'
AGIPD00
'
],
SingleConstantVersion
)
assert
isinstance
(
agipd_cd
[
"
Offset
"
].
constants
[
"
AGIPD00
"
],
SingleConstantVersion
)
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