Commit 15d5af75 authored by bliss administrator's avatar bliss administrator Committed by Matias Guijarro

common/scans.py: removed global 'get_data' function

parent ec7ad980
......@@ -20,13 +20,10 @@ __all__ = [
'timescan',
'loopscan',
'ct',
'get_data',
'DEFAULT_CHAIN']
import logging
from bliss.data.scan import get_data
from bliss.common.motor_group import Group
from bliss.common.axis import estimate_duration
from bliss.scanning.default import DefaultAcquisitionChain
......
......@@ -24,6 +24,7 @@ from bliss.common.utils import periodic_exec
from bliss.config.conductor import client
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.scan import get_data
from bliss.common.session import get_current as _current_session
from .chain import AcquisitionDevice, AcquisitionMaster
from . import writer
......@@ -549,7 +550,6 @@ class Scan(object):
It is a 1D array corresponding to the scan points.
Each point is a named structure corresponding to the counter names.
"""
from bliss.common.scans import get_data
return get_data(self)
def get_plot(self, scan_item):
......
......@@ -120,6 +120,6 @@ def test_timescan(pepu):
scan = scans.timescan(
0.1, pepu.counters.CALC1, pepu.counters.CALC2,
npoints=3, return_scan=True, save=False)
data = scans.get_data(scan)
data = scan.get_data()
assert data['CALC1'].tolist() == [1.5] * 3
assert data['CALC2'].tolist() == [-1.5] * 3
......@@ -62,7 +62,7 @@ def test_software_position_trigger_master(beacon):
with gevent.Timeout(5):
s.run()
# Check data
data = scans.get_data(s)
data = s.get_data()
# Typical position error is +0.025 in position unit
# That's because of redis + gevent delays (~2.5 ms)
expected_triggers = [0.01, 0.03, 0.05, 0.07, 0.09]
......
......@@ -30,6 +30,6 @@ def ct2(mocker):
def test_ct2_scan(beacon, ct2):
s = scans.ct(0.1, ct2, return_scan=True)
data = scans.get_data(s)
data = s.get_data()
assert data['c1'] == [1.1]
assert data['c2'] == [2.2]
......@@ -77,7 +77,7 @@ def test_pepu_soft_scan(beacon, pepu):
scan.run()
gevent.sleep(0.)
# Checks
data = scans.get_data(scan)
data = scan.get_data()
pepu.assert_data(data, 10)
......@@ -95,7 +95,7 @@ def test_pepu_continuous_soft_scan(beacon, pepu):
scan.run()
gevent.sleep(0.)
# Checks
data = scans.get_data(scan)
data = scan.get_data()
pepu.assert_data(data, 10)
......@@ -106,7 +106,7 @@ def test_pepu_default_chain_with_counters(beacon, pepu):
scan = scans.ascan(
m0, 0, 10, 10, 0.01, *pepu.counters, return_scan=True, save=False)
# Checks
data = scans.get_data(scan)
data = scan.get_data()
pepu.assert_data(data, 10)
......@@ -117,7 +117,7 @@ def test_pepu_default_chain_with_counter_namespace(beacon, pepu):
scan = scans.ascan(
m0, 0, 10, 10, 0.01, pepu.counters, return_scan=True, save=False)
# Checks
data = scans.get_data(scan)
data = scan.get_data()
pepu.assert_data(data, 10)
......@@ -132,7 +132,7 @@ def test_pepu_default_chain_with_measurement_group(beacon, pepu):
scan = scans.ascan(
m0, 0, 10, 10, 0.01, mg, return_scan=True, save=False)
# Checks
data = scans.get_data(scan)
data = scan.get_data()
pepu.assert_data(data, 10)
......@@ -149,5 +149,5 @@ def test_pepu_continuous_scan(beacon, pepu):
scan = Scan(chain, 'test', None)
scan.run()
# Checks
data = scans.get_data(scan)
data = scan.get_data()
pepu.assert_data(data, 10)
......@@ -22,7 +22,7 @@ def test_ascan(beacon):
counter = counter_class("gaussian", 10, cnt_time=0)
s = scans.ascan(m1, 0, 10, 10, 0, counter, return_scan=True, save=False)
assert m1.position() == 10
scan_data = scans.get_data(s)
scan_data = s.get_data()
assert numpy.array_equal(scan_data['gaussian'], counter.data)
def test_ascan_gauss(beacon):
......@@ -33,7 +33,7 @@ def test_ascan_gauss(beacon):
counter = counter_class("gaussianCurve")
s = scans.ascan(m1, 0, 10, 10, 0, counter, return_scan=True, save=False)
assert m1.position() == 10
scan_data = scans.get_data(s)
scan_data = s.get_data()
assert numpy.array_equal(scan_data['gaussianCurve'], counter.data)
def test_dscan(beacon):
......@@ -46,7 +46,7 @@ def test_dscan(beacon):
start_pos = m1.position()
s = scans.dscan(m1, -2, 2, 10, 0, counter, return_scan=True, save=False)
assert m1.position() == start_pos
scan_data = scans.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.array_equal(scan_data['gaussian'], counter.data)
......@@ -70,7 +70,7 @@ def test_dscan_move_done(beacon):
start_pos = m1.position()
s = scans.dscan(m1, -2, 2, 10, 0, counter, return_scan=True, save=False)
assert m1.position() == start_pos
scan_data = scans.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.array_equal(scan_data['gaussian'], counter.data)
assert positions[0] == 8.0
......@@ -86,7 +86,7 @@ def test_timescan(beacon):
counter_class = getattr(setup_globals, 'TestScanGaussianCounter')
counter = counter_class("gaussian", 10, cnt_time=0.1)
s = scans.timescan(0.1, counter, npoints=10, return_scan=True, save=False)
scan_data = scans.get_data(s)
scan_data = s.get_data()
assert numpy.array_equal(scan_data['gaussian'], counter.data)
......@@ -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]
s = scans.pointscan(m0, points, 0, counter, return_scan=True, save=False)
assert m0.position() == 50.0
scan_data = scans.get_data(s)
scan_data = s.get_data()
assert numpy.array_equal(scan_data['m0'], points)
assert numpy.array_equal(scan_data['gaussian'], counter.data)
......@@ -149,5 +149,5 @@ def test_calc_counters(beacon):
s = scan.Scan(c, name='calc_scan',)
s.run()
scan_data = scans.get_data(s)
scan_data = s.get_data()
assert numpy.array_equal(scan_data['gaussian']**2,scan_data['pow'])
......@@ -55,6 +55,6 @@ def test_sweep_motor_master(beacon):
with gevent.Timeout(10):
s.run()
data = scans.get_data(s)
data = s.get_data()
assert len(data["debug_pos"]) == 5
......@@ -4,6 +4,6 @@ from bliss.common import scans
def test_temperature_ct(temp_tin, temp_tout):
scan = scans.ct(0.1, temp_tin, temp_tout, return_scan=True)
data = scans.get_data(scan)
data = scan.get_data()
assert data[temp_tin.name][0] == pytest.approx(temp_tin.read())
assert data[temp_tout.name][0] == pytest.approx(temp_tout.read())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment