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
6d5b3e53
Commit
6d5b3e53
authored
3 years ago
by
Karim Ahmed
Browse files
Options
Downloads
Patches
Plain Diff
remove duplicated test and fix same function names
parent
248ca886
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!646
[AGIPD][TESTs]test_agipdlib AGIPDCtrl and get_bias_voltage for AGIPD1M and AGIPD500K
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_agipdlib.py
+12
-24
12 additions, 24 deletions
tests/test_agipdlib.py
with
12 additions
and
24 deletions
tests/test_agipdlib.py
+
12
−
24
View file @
6d5b3e53
...
...
@@ -8,7 +8,7 @@ SPB_AGIPD_INST_SRC = 'SPB_DET_AGIPD1M-1/DET/0CH0:xtdf'
CTRL_SRC
=
'
SPB_IRU_AGIPD1M1/MDL/FPGA_COMP
'
def
test_get_acq_rate_
run
(
mock_agipd1m_run
):
def
test_get_acq_rate_
ctrl
(
mock_agipd1m_run
):
# Current up to date data with acq_rate stored
# as repetition rate in slow data.
agipd_ctrl
=
AgipdCtrl
(
...
...
@@ -16,20 +16,7 @@ def test_get_acq_rate_run(mock_agipd1m_run):
image_src
=
SPB_AGIPD_INST_SRC
,
ctrl_src
=
CTRL_SRC
)
acq_rate
=
agipd_ctrl
.
get_acq_rate
()
assert
isinstance
(
acq_rate
,
float
)
assert
acq_rate
==
4.5
def
test_get_acq_rate_fast
(
mock_agipd1m_run
):
# Current up to date data with acq_rate stored
# as repetition rate in slow data.
agipd_ctrl
=
AgipdCtrl
(
run_dc
=
RunDirectory
(
mock_agipd1m_run
),
image_src
=
SPB_AGIPD_INST_SRC
,
ctrl_src
=
CTRL_SRC
)
acq_rate
=
agipd_ctrl
.
_get_acq_rate_run
()
acq_rate
=
agipd_ctrl
.
_get_acq_rate_ctrl
()
assert
isinstance
(
acq_rate
,
float
)
assert
acq_rate
==
4.5
...
...
@@ -42,7 +29,7 @@ def test_get_acq_rate_instr(mock_agipd1m_run_old):
run_dc
=
RunDirectory
(
mock_agipd1m_run_old
),
image_src
=
SPB_AGIPD_INST_SRC
,
ctrl_src
=
None
)
acq_rate
=
agipd_ctrl
.
get_acq_rate
()
acq_rate
=
agipd_ctrl
.
_
get_acq_rate
_instr
()
assert
isinstance
(
acq_rate
,
float
)
assert
acq_rate
==
4.5
...
...
@@ -56,7 +43,7 @@ def test_get_acq_rate(mock_agipd1m_run, mock_agipd1m_run_old):
image_src
=
SPB_AGIPD_INST_SRC
,
ctrl_src
=
CTRL_SRC
)
acq_rate
=
agipd_ctrl
.
_
get_acq_rate
_instr
()
acq_rate
=
agipd_ctrl
.
get_acq_rate
()
assert
isinstance
(
acq_rate
,
float
)
assert
acq_rate
==
4.5
...
...
@@ -83,25 +70,25 @@ def test_get_num_cells(mock_agipd1m_run):
assert
mem_cells
==
64
def
test_get_gain_setting_
run
(
mock_agipd1m_run
):
def
test_get_gain_setting_
ctrl
(
mock_agipd1m_run
):
# Reading gain setting from slow data.
agipd_ctrl
=
AgipdCtrl
(
run_dc
=
RunDirectory
(
mock_agipd1m_run
),
image_src
=
SPB_AGIPD_INST_SRC
,
ctrl_src
=
CTRL_SRC
)
gain_setting
=
agipd_ctrl
.
_get_gain_setting_
run
()
gain_setting
=
agipd_ctrl
.
_get_gain_setting_
ctrl
()
assert
isinstance
(
gain_setting
,
int
)
assert
gain_setting
==
0
def
test_get_gain_setting_
run
_old
(
mock_agipd1m_run_old
):
def
test_get_gain_setting_
ctrl
_old
(
mock_agipd1m_run_old
):
# Reading gain setting from setupr and .....
agipd_ctrl
=
AgipdCtrl
(
run_dc
=
RunDirectory
(
mock_agipd1m_run_old
),
image_src
=
SPB_AGIPD_INST_SRC
,
ctrl_src
=
CTRL_SRC
)
gain_setting
=
agipd_ctrl
.
_get_gain_setting_
run
_old
()
gain_setting
=
agipd_ctrl
.
_get_gain_setting_
ctrl
_old
()
assert
isinstance
(
gain_setting
,
int
)
assert
gain_setting
==
0
...
...
@@ -117,7 +104,7 @@ def test_get_gain_setting(mock_agipd1m_run, mock_agipd1m_run_old):
assert
isinstance
(
gain_setting
,
int
)
assert
gain_setting
==
0
# Reading gain setting from setupr and
.....
# Reading gain setting from setupr and
patternTypeIndex
agipd_ctrl
=
AgipdCtrl
(
run_dc
=
RunDirectory
(
mock_agipd1m_run_old
),
image_src
=
SPB_AGIPD_INST_SRC
,
...
...
@@ -132,6 +119,7 @@ def test_get_gain_setting(mock_agipd1m_run, mock_agipd1m_run_old):
image_src
=
SPB_AGIPD_INST_SRC
,
ctrl_src
=
CTRL_SRC
)
# Pass old creation_date before introducing gain_setting in 2020.
gain_setting
=
agipd_ctrl
.
get_gain_setting
(
creation_time
=
datetime
.
strptime
(
"
2019-12-16T08:52:25
"
,
...
...
@@ -167,8 +155,8 @@ def test_get_bias_voltage(
assert
isinstance
(
bias_voltage
,
int
)
assert
bias_voltage
==
300
#
R
ead bias voltage for SPB_DET_AGIPD1M-1 and MID_DET_AGIPD1M-1
# from
slow
data.
#
Fail to r
ead bias voltage for SPB_DET_AGIPD1M-1 and MID_DET_AGIPD1M-1
# from
old
data
and return default value
.
agipd_ctrl
=
AgipdCtrl
(
run_dc
=
RunDirectory
(
mock_agipd1m_run_old
),
image_src
=
SPB_AGIPD_INST_SRC
,
...
...
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