Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
bliss
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
505
Issues
505
List
Boards
Labels
Service Desk
Milestones
Jira
Jira
Merge Requests
133
Merge Requests
133
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bliss
bliss
Commits
15d5af75
Commit
15d5af75
authored
May 30, 2018
by
bliss administrator
Committed by
Matias Guijarro
May 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common/scans.py: removed global 'get_data' function
parent
ec7ad980
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
19 additions
and
22 deletions
+19
-22
bliss/common/scans.py
bliss/common/scans.py
+0
-3
bliss/scanning/scan.py
bliss/scanning/scan.py
+1
-1
tests/controllers_hw/test_pepu.py
tests/controllers_hw/test_pepu.py
+1
-1
tests/scans/test_continuous_soft_scan.py
tests/scans/test_continuous_soft_scan.py
+1
-1
tests/scans/test_ct2_scans.py
tests/scans/test_ct2_scans.py
+1
-1
tests/scans/test_pepu_scans.py
tests/scans/test_pepu_scans.py
+6
-6
tests/scans/test_step_by_step.py
tests/scans/test_step_by_step.py
+7
-7
tests/scans/test_sweep_scan.py
tests/scans/test_sweep_scan.py
+1
-1
tests/temperature/test_scan.py
tests/temperature/test_scan.py
+1
-1
No files found.
bliss/common/scans.py
View file @
15d5af75
...
@@ -20,13 +20,10 @@ __all__ = [
...
@@ -20,13 +20,10 @@ __all__ = [
'timescan'
,
'timescan'
,
'loopscan'
,
'loopscan'
,
'ct'
,
'ct'
,
'get_data'
,
'DEFAULT_CHAIN'
]
'DEFAULT_CHAIN'
]
import
logging
import
logging
from
bliss.data.scan
import
get_data
from
bliss.common.motor_group
import
Group
from
bliss.common.motor_group
import
Group
from
bliss.common.axis
import
estimate_duration
from
bliss.common.axis
import
estimate_duration
from
bliss.scanning.default
import
DefaultAcquisitionChain
from
bliss.scanning.default
import
DefaultAcquisitionChain
...
...
bliss/scanning/scan.py
View file @
15d5af75
...
@@ -24,6 +24,7 @@ from bliss.common.utils import periodic_exec
...
@@ -24,6 +24,7 @@ from bliss.common.utils import periodic_exec
from
bliss.config.conductor
import
client
from
bliss.config.conductor
import
client
from
bliss.config.settings
import
Parameters
,
_change_to_obj_marshalling
from
bliss.config.settings
import
Parameters
,
_change_to_obj_marshalling
from
bliss.data.node
import
_get_or_create_node
,
_create_node
,
DataNodeContainer
,
is_zerod
from
bliss.data.node
import
_get_or_create_node
,
_create_node
,
DataNodeContainer
,
is_zerod
from
bliss.data.scan
import
get_data
from
bliss.common.session
import
get_current
as
_current_session
from
bliss.common.session
import
get_current
as
_current_session
from
.chain
import
AcquisitionDevice
,
AcquisitionMaster
from
.chain
import
AcquisitionDevice
,
AcquisitionMaster
from
.
import
writer
from
.
import
writer
...
@@ -549,7 +550,6 @@ class Scan(object):
...
@@ -549,7 +550,6 @@ class Scan(object):
It is a 1D array corresponding to the scan points.
It is a 1D array corresponding to the scan points.
Each point is a named structure corresponding to the counter names.
Each point is a named structure corresponding to the counter names.
"""
"""
from
bliss.common.scans
import
get_data
return
get_data
(
self
)
return
get_data
(
self
)
def
get_plot
(
self
,
scan_item
):
def
get_plot
(
self
,
scan_item
):
...
...
tests/controllers_hw/test_pepu.py
View file @
15d5af75
...
@@ -120,6 +120,6 @@ def test_timescan(pepu):
...
@@ -120,6 +120,6 @@ def test_timescan(pepu):
scan
=
scans
.
timescan
(
scan
=
scans
.
timescan
(
0.1
,
pepu
.
counters
.
CALC1
,
pepu
.
counters
.
CALC2
,
0.1
,
pepu
.
counters
.
CALC1
,
pepu
.
counters
.
CALC2
,
npoints
=
3
,
return_scan
=
True
,
save
=
False
)
npoints
=
3
,
return_scan
=
True
,
save
=
False
)
data
=
scan
s
.
get_data
(
scan
)
data
=
scan
.
get_data
(
)
assert
data
[
'CALC1'
].
tolist
()
==
[
1.5
]
*
3
assert
data
[
'CALC1'
].
tolist
()
==
[
1.5
]
*
3
assert
data
[
'CALC2'
].
tolist
()
==
[
-
1.5
]
*
3
assert
data
[
'CALC2'
].
tolist
()
==
[
-
1.5
]
*
3
tests/scans/test_continuous_soft_scan.py
View file @
15d5af75
...
@@ -62,7 +62,7 @@ def test_software_position_trigger_master(beacon):
...
@@ -62,7 +62,7 @@ def test_software_position_trigger_master(beacon):
with
gevent
.
Timeout
(
5
):
with
gevent
.
Timeout
(
5
):
s
.
run
()
s
.
run
()
# Check data
# Check data
data
=
s
cans
.
get_data
(
s
)
data
=
s
.
get_data
(
)
# Typical position error is +0.025 in position unit
# Typical position error is +0.025 in position unit
# That's because of redis + gevent delays (~2.5 ms)
# That's because of redis + gevent delays (~2.5 ms)
expected_triggers
=
[
0.01
,
0.03
,
0.05
,
0.07
,
0.09
]
expected_triggers
=
[
0.01
,
0.03
,
0.05
,
0.07
,
0.09
]
...
...
tests/scans/test_ct2_scans.py
View file @
15d5af75
...
@@ -30,6 +30,6 @@ def ct2(mocker):
...
@@ -30,6 +30,6 @@ def ct2(mocker):
def
test_ct2_scan
(
beacon
,
ct2
):
def
test_ct2_scan
(
beacon
,
ct2
):
s
=
scans
.
ct
(
0.1
,
ct2
,
return_scan
=
True
)
s
=
scans
.
ct
(
0.1
,
ct2
,
return_scan
=
True
)
data
=
s
cans
.
get_data
(
s
)
data
=
s
.
get_data
(
)
assert
data
[
'c1'
]
==
[
1.1
]
assert
data
[
'c1'
]
==
[
1.1
]
assert
data
[
'c2'
]
==
[
2.2
]
assert
data
[
'c2'
]
==
[
2.2
]
tests/scans/test_pepu_scans.py
View file @
15d5af75
...
@@ -77,7 +77,7 @@ def test_pepu_soft_scan(beacon, pepu):
...
@@ -77,7 +77,7 @@ def test_pepu_soft_scan(beacon, pepu):
scan
.
run
()
scan
.
run
()
gevent
.
sleep
(
0.
)
gevent
.
sleep
(
0.
)
# Checks
# Checks
data
=
scan
s
.
get_data
(
scan
)
data
=
scan
.
get_data
(
)
pepu
.
assert_data
(
data
,
10
)
pepu
.
assert_data
(
data
,
10
)
...
@@ -95,7 +95,7 @@ def test_pepu_continuous_soft_scan(beacon, pepu):
...
@@ -95,7 +95,7 @@ def test_pepu_continuous_soft_scan(beacon, pepu):
scan
.
run
()
scan
.
run
()
gevent
.
sleep
(
0.
)
gevent
.
sleep
(
0.
)
# Checks
# Checks
data
=
scan
s
.
get_data
(
scan
)
data
=
scan
.
get_data
(
)
pepu
.
assert_data
(
data
,
10
)
pepu
.
assert_data
(
data
,
10
)
...
@@ -106,7 +106,7 @@ def test_pepu_default_chain_with_counters(beacon, pepu):
...
@@ -106,7 +106,7 @@ def test_pepu_default_chain_with_counters(beacon, pepu):
scan
=
scans
.
ascan
(
scan
=
scans
.
ascan
(
m0
,
0
,
10
,
10
,
0.01
,
*
pepu
.
counters
,
return_scan
=
True
,
save
=
False
)
m0
,
0
,
10
,
10
,
0.01
,
*
pepu
.
counters
,
return_scan
=
True
,
save
=
False
)
# Checks
# Checks
data
=
scan
s
.
get_data
(
scan
)
data
=
scan
.
get_data
(
)
pepu
.
assert_data
(
data
,
10
)
pepu
.
assert_data
(
data
,
10
)
...
@@ -117,7 +117,7 @@ def test_pepu_default_chain_with_counter_namespace(beacon, pepu):
...
@@ -117,7 +117,7 @@ def test_pepu_default_chain_with_counter_namespace(beacon, pepu):
scan
=
scans
.
ascan
(
scan
=
scans
.
ascan
(
m0
,
0
,
10
,
10
,
0.01
,
pepu
.
counters
,
return_scan
=
True
,
save
=
False
)
m0
,
0
,
10
,
10
,
0.01
,
pepu
.
counters
,
return_scan
=
True
,
save
=
False
)
# Checks
# Checks
data
=
scan
s
.
get_data
(
scan
)
data
=
scan
.
get_data
(
)
pepu
.
assert_data
(
data
,
10
)
pepu
.
assert_data
(
data
,
10
)
...
@@ -132,7 +132,7 @@ def test_pepu_default_chain_with_measurement_group(beacon, pepu):
...
@@ -132,7 +132,7 @@ def test_pepu_default_chain_with_measurement_group(beacon, pepu):
scan
=
scans
.
ascan
(
scan
=
scans
.
ascan
(
m0
,
0
,
10
,
10
,
0.01
,
mg
,
return_scan
=
True
,
save
=
False
)
m0
,
0
,
10
,
10
,
0.01
,
mg
,
return_scan
=
True
,
save
=
False
)
# Checks
# Checks
data
=
scan
s
.
get_data
(
scan
)
data
=
scan
.
get_data
(
)
pepu
.
assert_data
(
data
,
10
)
pepu
.
assert_data
(
data
,
10
)
...
@@ -149,5 +149,5 @@ def test_pepu_continuous_scan(beacon, pepu):
...
@@ -149,5 +149,5 @@ def test_pepu_continuous_scan(beacon, pepu):
scan
=
Scan
(
chain
,
'test'
,
None
)
scan
=
Scan
(
chain
,
'test'
,
None
)
scan
.
run
()
scan
.
run
()
# Checks
# Checks
data
=
scan
s
.
get_data
(
scan
)
data
=
scan
.
get_data
(
)
pepu
.
assert_data
(
data
,
10
)
pepu
.
assert_data
(
data
,
10
)
tests/scans/test_step_by_step.py
View file @
15d5af75
...
@@ -22,7 +22,7 @@ def test_ascan(beacon):
...
@@ -22,7 +22,7 @@ def test_ascan(beacon):
counter
=
counter_class
(
"gaussian"
,
10
,
cnt_time
=
0
)
counter
=
counter_class
(
"gaussian"
,
10
,
cnt_time
=
0
)
s
=
scans
.
ascan
(
m1
,
0
,
10
,
10
,
0
,
counter
,
return_scan
=
True
,
save
=
False
)
s
=
scans
.
ascan
(
m1
,
0
,
10
,
10
,
0
,
counter
,
return_scan
=
True
,
save
=
False
)
assert
m1
.
position
()
==
10
assert
m1
.
position
()
==
10
scan_data
=
s
cans
.
get_data
(
s
)
scan_data
=
s
.
get_data
(
)
assert
numpy
.
array_equal
(
scan_data
[
'gaussian'
],
counter
.
data
)
assert
numpy
.
array_equal
(
scan_data
[
'gaussian'
],
counter
.
data
)
def
test_ascan_gauss
(
beacon
):
def
test_ascan_gauss
(
beacon
):
...
@@ -33,7 +33,7 @@ def test_ascan_gauss(beacon):
...
@@ -33,7 +33,7 @@ def test_ascan_gauss(beacon):
counter
=
counter_class
(
"gaussianCurve"
)
counter
=
counter_class
(
"gaussianCurve"
)
s
=
scans
.
ascan
(
m1
,
0
,
10
,
10
,
0
,
counter
,
return_scan
=
True
,
save
=
False
)
s
=
scans
.
ascan
(
m1
,
0
,
10
,
10
,
0
,
counter
,
return_scan
=
True
,
save
=
False
)
assert
m1
.
position
()
==
10
assert
m1
.
position
()
==
10
scan_data
=
s
cans
.
get_data
(
s
)
scan_data
=
s
.
get_data
(
)
assert
numpy
.
array_equal
(
scan_data
[
'gaussianCurve'
],
counter
.
data
)
assert
numpy
.
array_equal
(
scan_data
[
'gaussianCurve'
],
counter
.
data
)
def
test_dscan
(
beacon
):
def
test_dscan
(
beacon
):
...
@@ -46,7 +46,7 @@ def test_dscan(beacon):
...
@@ -46,7 +46,7 @@ def test_dscan(beacon):
start_pos
=
m1
.
position
()
start_pos
=
m1
.
position
()
s
=
scans
.
dscan
(
m1
,
-
2
,
2
,
10
,
0
,
counter
,
return_scan
=
True
,
save
=
False
)
s
=
scans
.
dscan
(
m1
,
-
2
,
2
,
10
,
0
,
counter
,
return_scan
=
True
,
save
=
False
)
assert
m1
.
position
()
==
start_pos
assert
m1
.
position
()
==
start_pos
scan_data
=
s
cans
.
get_data
(
s
)
scan_data
=
s
.
get_data
(
)
assert
numpy
.
allclose
(
scan_data
[
'm1'
],
numpy
.
linspace
(
start_pos
-
2
,
start_pos
+
2
,
10
),
atol
=
5e-4
)
assert
numpy
.
allclose
(
scan_data
[
'm1'
],
numpy
.
linspace
(
start_pos
-
2
,
start_pos
+
2
,
10
),
atol
=
5e-4
)
assert
numpy
.
array_equal
(
scan_data
[
'gaussian'
],
counter
.
data
)
assert
numpy
.
array_equal
(
scan_data
[
'gaussian'
],
counter
.
data
)
...
@@ -70,7 +70,7 @@ def test_dscan_move_done(beacon):
...
@@ -70,7 +70,7 @@ def test_dscan_move_done(beacon):
start_pos
=
m1
.
position
()
start_pos
=
m1
.
position
()
s
=
scans
.
dscan
(
m1
,
-
2
,
2
,
10
,
0
,
counter
,
return_scan
=
True
,
save
=
False
)
s
=
scans
.
dscan
(
m1
,
-
2
,
2
,
10
,
0
,
counter
,
return_scan
=
True
,
save
=
False
)
assert
m1
.
position
()
==
start_pos
assert
m1
.
position
()
==
start_pos
scan_data
=
s
cans
.
get_data
(
s
)
scan_data
=
s
.
get_data
(
)
assert
numpy
.
allclose
(
scan_data
[
'm1'
],
numpy
.
linspace
(
start_pos
-
2
,
start_pos
+
2
,
10
),
atol
=
5e-4
)
assert
numpy
.
allclose
(
scan_data
[
'm1'
],
numpy
.
linspace
(
start_pos
-
2
,
start_pos
+
2
,
10
),
atol
=
5e-4
)
assert
numpy
.
array_equal
(
scan_data
[
'gaussian'
],
counter
.
data
)
assert
numpy
.
array_equal
(
scan_data
[
'gaussian'
],
counter
.
data
)
assert
positions
[
0
]
==
8.0
assert
positions
[
0
]
==
8.0
...
@@ -86,7 +86,7 @@ def test_timescan(beacon):
...
@@ -86,7 +86,7 @@ def test_timescan(beacon):
counter_class
=
getattr
(
setup_globals
,
'TestScanGaussianCounter'
)
counter_class
=
getattr
(
setup_globals
,
'TestScanGaussianCounter'
)
counter
=
counter_class
(
"gaussian"
,
10
,
cnt_time
=
0.1
)
counter
=
counter_class
(
"gaussian"
,
10
,
cnt_time
=
0.1
)
s
=
scans
.
timescan
(
0.1
,
counter
,
npoints
=
10
,
return_scan
=
True
,
save
=
False
)
s
=
scans
.
timescan
(
0.1
,
counter
,
npoints
=
10
,
return_scan
=
True
,
save
=
False
)
scan_data
=
s
cans
.
get_data
(
s
)
scan_data
=
s
.
get_data
(
)
assert
numpy
.
array_equal
(
scan_data
[
'gaussian'
],
counter
.
data
)
assert
numpy
.
array_equal
(
scan_data
[
'gaussian'
],
counter
.
data
)
...
@@ -100,7 +100,7 @@ def test_pointscan(beacon):
...
@@ -100,7 +100,7 @@ def test_pointscan(beacon):
points
=
[
0.0
,
1.0
,
3.0
,
7.0
,
8.0
,
10.0
,
12.0
,
15.0
,
20.0
,
50.0
]
points
=
[
0.0
,
1.0
,
3.0
,
7.0
,
8.0
,
10.0
,
12.0
,
15.0
,
20.0
,
50.0
]
s
=
scans
.
pointscan
(
m0
,
points
,
0
,
counter
,
return_scan
=
True
,
save
=
False
)
s
=
scans
.
pointscan
(
m0
,
points
,
0
,
counter
,
return_scan
=
True
,
save
=
False
)
assert
m0
.
position
()
==
50.0
assert
m0
.
position
()
==
50.0
scan_data
=
s
cans
.
get_data
(
s
)
scan_data
=
s
.
get_data
(
)
assert
numpy
.
array_equal
(
scan_data
[
'm0'
],
points
)
assert
numpy
.
array_equal
(
scan_data
[
'm0'
],
points
)
assert
numpy
.
array_equal
(
scan_data
[
'gaussian'
],
counter
.
data
)
assert
numpy
.
array_equal
(
scan_data
[
'gaussian'
],
counter
.
data
)
...
@@ -149,5 +149,5 @@ def test_calc_counters(beacon):
...
@@ -149,5 +149,5 @@ def test_calc_counters(beacon):
s
=
scan
.
Scan
(
c
,
name
=
'calc_scan'
,)
s
=
scan
.
Scan
(
c
,
name
=
'calc_scan'
,)
s
.
run
()
s
.
run
()
scan_data
=
s
cans
.
get_data
(
s
)
scan_data
=
s
.
get_data
(
)
assert
numpy
.
array_equal
(
scan_data
[
'gaussian'
]
**
2
,
scan_data
[
'pow'
])
assert
numpy
.
array_equal
(
scan_data
[
'gaussian'
]
**
2
,
scan_data
[
'pow'
])
tests/scans/test_sweep_scan.py
View file @
15d5af75
...
@@ -55,6 +55,6 @@ def test_sweep_motor_master(beacon):
...
@@ -55,6 +55,6 @@ def test_sweep_motor_master(beacon):
with
gevent
.
Timeout
(
10
):
with
gevent
.
Timeout
(
10
):
s
.
run
()
s
.
run
()
data
=
s
cans
.
get_data
(
s
)
data
=
s
.
get_data
(
)
assert
len
(
data
[
"debug_pos"
])
==
5
assert
len
(
data
[
"debug_pos"
])
==
5
tests/temperature/test_scan.py
View file @
15d5af75
...
@@ -4,6 +4,6 @@ from bliss.common import scans
...
@@ -4,6 +4,6 @@ from bliss.common import scans
def
test_temperature_ct
(
temp_tin
,
temp_tout
):
def
test_temperature_ct
(
temp_tin
,
temp_tout
):
scan
=
scans
.
ct
(
0.1
,
temp_tin
,
temp_tout
,
return_scan
=
True
)
scan
=
scans
.
ct
(
0.1
,
temp_tin
,
temp_tout
,
return_scan
=
True
)
data
=
scan
s
.
get_data
(
scan
)
data
=
scan
.
get_data
(
)
assert
data
[
temp_tin
.
name
][
0
]
==
pytest
.
approx
(
temp_tin
.
read
())
assert
data
[
temp_tin
.
name
][
0
]
==
pytest
.
approx
(
temp_tin
.
read
())
assert
data
[
temp_tout
.
name
][
0
]
==
pytest
.
approx
(
temp_tout
.
read
())
assert
data
[
temp_tout
.
name
][
0
]
==
pytest
.
approx
(
temp_tout
.
read
())
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