Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mauro Rovezzi
bliss
Commits
77f07ab9
Commit
77f07ab9
authored
Mar 07, 2019
by
Matias Guijarro
Browse files
test: added test of acq. mode for SamplingCounter
parent
0f570fc5
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test_counters.py
View file @
77f07ab9
...
...
@@ -8,6 +8,7 @@
import
pytest
import
numpy
from
bliss.common.measurement
import
SamplingCounter
,
IntegratingCounter
from
bliss.common.scans
import
loopscan
class
Diode
(
SamplingCounter
):
...
...
@@ -84,6 +85,30 @@ def test_diode_with_controller(beacon):
assert
diode
.
raw_value
*
2
==
diode_value
def
test_sampling_counter_acquisition_device_mode
(
beacon
):
diode
=
beacon
.
get
(
"diode"
)
values
=
[]
def
f
(
x
):
values
.
append
(
x
)
return
x
test_diode
=
Diode
(
diode
,
f
)
# USING DEFAULT MODE
assert
test_diode
.
acquisition_device_mode
is
None
s
=
loopscan
(
1
,
0.1
,
test_diode
)
assert
s
.
acq_chain
.
nodes_list
[
1
].
mode
.
name
==
"SIMPLE_AVERAGE"
assert
s
.
get_data
()[
"test_diode"
]
==
pytest
.
approx
(
sum
(
values
)
/
len
(
values
))
# UPDATING THE MODE
values
=
[]
test_diode
.
acquisition_device_mode
=
"INTEGRATE"
s
=
loopscan
(
1
,
0.1
,
test_diode
)
assert
s
.
acq_chain
.
nodes_list
[
1
].
mode
.
name
==
"INTEGRATE"
assert
s
.
get_data
()[
"test_diode"
]
==
pytest
.
approx
(
sum
(
values
)
*
0.1
/
len
(
values
))
def
test_integ_counter
(
beacon
):
acq_controller
=
AcquisitionController
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment