...
 
Commits (32)
before_script:
# set pip cache to the Docker volume
- echo ${CI_PROJECT_DIR}
- export PIP_CACHE_DIR="/opt/cache/pip"
- /opt/conda/bin/conda init && source /root/.bashrc
- conda config --append channels conda-forge
- conda config --add channels defaults
- conda config --add channels http://bcu-ci.esrf.fr/stable
- conda config --add channels tango-controls
default:
before_script:
# set pip cache to the Docker volume
- echo ${CI_PROJECT_DIR}
- export PIP_CACHE_DIR="/opt/cache/pip"
- /opt/conda/bin/conda init && source /root/.bashrc
- conda config --append channels conda-forge
- conda config --add channels defaults
- conda config --add channels http://bcu-ci.esrf.fr/stable
- conda config --add channels tango-controls
stages:
- style
......@@ -18,27 +19,34 @@ stages:
check_style:
stage: style
image: continuumio/miniconda3:latest
before_script:
- pip install -r requirements-dev.txt
script:
- pip install -r requirements-dev.txt
# run black
- LC_ALL=C.UTF-8 black --check --safe .
check_lint:
stage: style
image: continuumio/miniconda3:latest
before_script:
- pip install -r requirements-dev.txt
script:
- pip install -r requirements-dev.txt
# run flake8 on diff between current branch and last common ancestor with master
- git diff -U0 origin/master...$CI_COMMIT_SHA | flake8 --diff
# allow failure without impacting the rest of the CI (will show an orange warning in the UI)
allow_failure: true
.run_tests:source:
run_tests:source:
stage: tests
image: continuumio/miniconda3:latest
script:
- >
if [ $CI_COMMIT_REF_NAME != 'master' ]; then
# Check for changes manually to circumvent gitlab-ci limitation (issue #1115)
echo 'Looking for changes...'
if ! (git diff --name-only origin/master...$CI_COMMIT_SHA | grep -E "$CHANGES"); then
echo 'Nothing to do'
exit 0
fi
fi
# install Xvfb and opengl libraries (needed for test_flint)
- apt-get update && apt-get -y install xvfb libxi6
# create test env and install BLISS
......@@ -55,32 +63,8 @@ check_lint:
paths:
- htmlcov/
expire_in: 7 days
only:
changes: # skip tests for doc changes
- "bin/**/*"
- "**/*.{py}"
- "extensions/**/*"
- "scripts/**/*"
- "spec/**/*"
- "tests/**/*"
- ".gitlab-ci.yml"
- "requirements*"
- "setup.*"
run_tests:branch:
extends: .run_tests:source
only:
refs:
- branches
except:
refs:
- merge_requests
run_tests:merge_request:
extends: .run_tests:source
only:
refs:
- merge_requests
variables:
CHANGES: '\.(py|cfg)$|requirements|gitlab-ci|^(bin|extensions|scripts|spec|tests)/'
package:
stage: build
......
This diff is collapsed.
......@@ -47,16 +47,15 @@ import gevent
from functools import wraps
import types
from bliss import global_map, current_session
from bliss import current_session
from bliss.common.utils import rounder
from bliss.common.motor_group import Group
from bliss.common.cleanup import cleanup, axis as cleanup_axis
from bliss.common.axis import Axis
from bliss.common.cleanup import error_cleanup
from bliss.config.settings import HashSetting
from bliss.data.scan import get_counter_names
from bliss.scanning.toolbox import DefaultAcquisitionChain
from bliss.scanning.scan import Scan, StepScanDataWatch, SCANS
from bliss.scanning.scan import Scan, StepScanDataWatch
from bliss.scanning.acquisition.motor import VariableStepTriggerMaster
from bliss.scanning.acquisition.motor import MeshStepTriggerMaster
from bliss.controllers.motor import CalcController
......@@ -1065,9 +1064,9 @@ def _get_selected_counter_name(counter=None):
Used to determine which counter to use for cen pic curs functions.
"""
if not SCANS:
if not current_session.scans:
raise RuntimeError("Scans list is empty!")
scan_counter_names = set(get_counter_names(SCANS[-1]))
scan_counter_names = set(get_counter_names(current_session.scans[-1]))
plot_select = HashSetting("%s:plot_select" % current_session.name)
selected_flint_counter_names = set(plot_select.keys())
alignment_counts = scan_counter_names.intersection(selected_flint_counter_names)
......@@ -1098,9 +1097,9 @@ def last_scan_motor(axis=None):
"""
Return the last motor used in the last scan
"""
if not len(SCANS):
if not len(current_session.scans):
raise RuntimeError("No scan available. Hint: do at least one ;)")
scan = SCANS[-1]
scan = current_session.scans[-1]
axis_name = scan._get_data_axis_name(axis=axis)
return current_session.env_dict[axis_name]
......@@ -1109,9 +1108,9 @@ def last_scan_motors():
"""
Return a list of motor used in the last scan
"""
if not len(SCANS):
if not len(current_session.scans):
raise RuntimeError("No scan available. Hint: do at least one ;)")
scan = SCANS[-1]
scan = current_session.scans[-1]
axes_name = scan._get_data_axes_name()
return [current_session.env_dict[axis_name] for axis_name in axes_name]
......@@ -1208,14 +1207,14 @@ def _goto_multimotors(func):
@_multimotors
def cen(counter=None, axis=None):
counter_name = _get_selected_counter_name(counter=counter)
return SCANS[-1].cen(counter_name, axis=axis)
return current_session.scans[-1].cen(counter_name, axis=axis)
@_goto_multimotors
def goto_cen(counter=None, axis=None):
counter_name = _get_selected_counter_name(counter=counter)
motor = last_scan_motor(axis)
scan = SCANS[-1]
scan = current_session.scans[-1]
motor = last_scan_motor(axis)
cfwhm, _ = scan.cen(counter_name, axis=axis)
_log.warning("Motor %s will move from %f to %f", motor.name, motor.position, cfwhm)
......@@ -1225,33 +1224,33 @@ def goto_cen(counter=None, axis=None):
@_multimotors
def com(counter=None, axis=None):
counter_name = _get_selected_counter_name(counter=counter)
return SCANS[-1].com(counter_name, axis=axis)
return current_session.scans[-1].com(counter_name, axis=axis)
@_goto_multimotors
def goto_com(counter=None, axis=None):
counter_name = _get_selected_counter_name(counter=counter)
motor = last_scan_motor(axis)
scan = SCANS[-1]
scan = current_session.scans[-1]
motor = last_scan_motor(axis)
com_pos = scan.com(counter_name, axis=axis)
_log.warning(
"Motor %s will move from %f to %f", motor.name, motor.position, com_pos
)
return SCANS[-1].goto_com(counter_name, axis=axis)
return current_session.scans[-1].goto_com(counter_name, axis=axis)
@_multimotors
def peak(counter=None, axis=None):
counter_name = _get_selected_counter_name(counter=counter)
return SCANS[-1].peak(counter_name, axis=axis)
return current_session.scans[-1].peak(counter_name, axis=axis)
@_goto_multimotors
def goto_peak(counter=None, axis=None):
counter_name = _get_selected_counter_name(counter=counter)
motor = last_scan_motor(axis)
scan = SCANS[-1]
scan = current_session.scans[-1]
motor = last_scan_motor(axis=axis)
peak_pos = scan.peak(counter_name, axis=axis)
_log.warning(
......@@ -1262,4 +1261,4 @@ def goto_peak(counter=None, axis=None):
def where():
for axis in last_scan_motors():
SCANS[-1].where(axis=axis)
current_session.scans[-1].where(axis=axis)
......@@ -8,6 +8,7 @@
import os
import sys
import warnings
import collections
from treelib import Tree
from bliss import setup_globals, global_map
......@@ -154,6 +155,7 @@ class Session:
self.__include_sessions = []
self.__map = None
self.__log = None
self.__scans = collections.deque(maxlen=20)
self.init(config_tree)
......@@ -197,6 +199,10 @@ class Session:
def name(self):
return self.__name
@property
def scans(self):
return self.__scans
@property
def config(self):
return ConfigProxy(static.get_config, self.env_dict)
......@@ -272,14 +278,14 @@ class Session:
RuntimeWarning,
)
names_list.remove(name)
class_name = object_config.get("class", "")
if class_name.lower() == "session":
warnings.warn(
f"Session {self.name} 'config-objects' list contains session {name}, ignoring (hint: add session in 'include-sessions' list)",
RuntimeWarning,
)
names_list.remove(name)
else:
class_name = object_config.get("class", "")
if class_name.lower() == "session":
warnings.warn(
f"Session {self.name} 'config-objects' list contains session {name}, ignoring (hint: add session in 'include-sessions' list)",
RuntimeWarning,
)
names_list.remove(name)
for name in self.__exclude_objects_names:
try:
......@@ -405,10 +411,15 @@ class Session:
env_dict["load_script"] = self.load_script
from bliss.scanning.scan import ScanSaving
from bliss.scanning.scan_meta import create_user_scan_meta
self.scan_saving = ScanSaving(self.name)
self.user_scan_meta = create_user_scan_meta()
if is_bliss_shell():
env_dict["SCAN_SAVING"] = self.scan_saving
env_dict["USER_SCAN_META"] = self.user_scan_meta
env_dict["ALIASES"] = global_map.aliases
from bliss.common.measurementgroup import ACTIVE_MG
......
......@@ -20,7 +20,6 @@ from bliss import global_map, global_log, current_session
from bliss.common import scans
from bliss.common.scans import *
from bliss.common.plot import plot
from bliss.scanning.scan import SCANS
from bliss.common.soft_axis import SoftAxis
from bliss.common.counter import SoftCounter
from bliss.common.cleanup import cleanup, error_cleanup
......@@ -679,7 +678,7 @@ def edit_roi_counters(detector, acq_time=None):
scan = ct(acq_time, detector)
else:
try:
scan = SCANS[-1]
scan = current_session.scans[-1]
except IndexError:
print(
f"SCANS list is empty -- do an acquisition with {detector.name} before editing roi counters"
......
......@@ -3,7 +3,8 @@ import gevent.lock
from bliss.controllers.wago.wago import ModulesConfig, WagoController, get_wago_comm
from bliss.config.channels import Channel
from bliss.common.measurement import SamplingCounter, counter_namespace
from bliss.common.counter import SamplingCounter
from bliss.controllers.counter import SamplingCounterController
from bliss.common.utils import add_property
from bliss.common import event
from bliss import global_map
......@@ -50,13 +51,21 @@ class EBVDiodeRange:
self.value = float_value
class EBVCounterController(SamplingCounterController):
def __init__(self, ebv_master, diode_name):
super().__init__(ebv_master.name)
self._ebv_master = ebv_master
self._diode_name = diode_name
def read(self, counter):
if counter.name == self._diode_name:
return self._ebv_master.current
class EBVCounter(SamplingCounter):
def __call__(self, *args, **kwargs):
return self
def read(self):
return self.controller.current
class EBV:
_PULSE_INDEX = {"led_on": 0, "led_off": 1, "screen_in": 1, "screen_out": 0}
......@@ -71,11 +80,13 @@ class EBV:
def __init__(self, name, config_node):
self.name = name
# --- config parsing
self._single_model = config_node.get("single_model", False)
self._channel = config_node.get("channel", 0)
self._has_foil = config_node.get("has_foil", False)
self._cnt_name = config_node.get("counter_name", "diode")
# --- shared states
self._led_status = Channel(
f"{name}:led_status",
default_value="UNKNOWN",
......@@ -96,25 +107,30 @@ class EBV:
callback=self.__foil_status_changed,
)
# --- wago interface
self.__comm_lock = gevent.lock.RLock()
mapping = build_wago_mapping(self._single_model, self._channel, self._has_foil)
comm = get_wago_comm(config_node)
self.controller = WagoController(comm, mapping)
self._wago = WagoController(comm, mapping)
self.initialize()
self._diode_counter = EBVCounter(self._cnt_name, self, unit="mA")
add_property(self, self._cnt_name, self._diode_counter)
# --- counter interface
self.master_controller = None
self.controller = EBVCounterController(self, self._cnt_name)
diode_counter = EBVCounter(self._cnt_name, self.controller, unit="mA")
self.controller.add_counter(diode_counter)
add_property(self, self._cnt_name, diode_counter)
global_map.register(
self,
parents_list=["ebv"],
children_list=[self.controller],
children_list=[self._wago],
tag=f"EBV({self.name})",
)
def initialize(self):
self.controller.connect()
self._wago.connect()
self.__update()
def __led_status_changed(self, state):
......@@ -140,7 +156,7 @@ class EBV:
def __update_state(self):
with self.__comm_lock:
status = self.controller.get("status")
status = self._wago.get("status")
# --- screen status
if status[0] and not status[1]:
screen = "IN"
......@@ -160,7 +176,7 @@ class EBV:
self._foil_status.value = "NONE"
else:
with self.__comm_lock:
status = self.controller.get("foil_status")
status = self._wago.get("foil_status")
if status[0] and not status[1]:
self._foil_status.value = "IN"
elif not status[0] and status[1]:
......@@ -170,7 +186,7 @@ class EBV:
def __update_diode_range(self):
with self.__comm_lock:
gain_value = self.controller.get("gain")
gain_value = self._wago.get("gain")
for gain in self._DIODE_RANGES:
if gain_value == gain.wago_value:
self._diode_range.value = gain.name
......@@ -180,17 +196,17 @@ class EBV:
index = self._PULSE_INDEX[value]
with self.__comm_lock:
set_value = [0, 0]
self.controller.set(name, set_value)
self._wago.set(name, set_value)
gevent.sleep(0.01)
set_value[index] = 1
self.controller.set(name, set_value)
self._wago.set(name, set_value)
set_value[index] = 0
gevent.sleep(0.01)
self.controller.set(name, set_value)
self._wago.set(name, set_value)
def __info__(self):
self.__update()
info = f"EBV [{self.name}] (wago: {self.controller.client.host})\n"
info = f"EBV [{self.name}] (wago: {self._wago.client.host})\n"
try:
info += f" screen : {self._screen_status.value}\n"
info += f" led : {self._led_status.value}\n"
......@@ -201,13 +217,6 @@ class EBV:
info += "!!! Failed to read EBV status !!!"
return info
@property
def counters(self):
return counter_namespace([self._diode_counter])
def read(self):
return self.current
@property
def screen_status(self):
self.__update_state()
......@@ -237,7 +246,7 @@ class EBV:
for gain in self._DIODE_RANGES:
if gain.name == value:
with self.__comm_lock:
self.controller.set("gain", gain.wago_value)
self._wago.set("gain", gain.wago_value)
self.__update_diode_range()
return
raise ValueError(f"Invalid diode range [{value}]")
......@@ -261,7 +270,7 @@ class EBV:
set_gain = gain
if set_gain is not None:
with self.__comm_lock:
self.controller.set("gain", set_gain.wago_value)
self._wago.set("gain", set_gain.wago_value)
self.__update_diode_range()
else:
raise ValueError(f"Cannot adjust gain for [{value}]")
......@@ -269,7 +278,7 @@ class EBV:
@property
def raw_current(self):
with self.__comm_lock:
value = self.controller.get("current")
value = self._wago.get("current")
return float(value)
@property
......@@ -304,5 +313,5 @@ class EBV:
def __set_foil(self, flag):
with self.__comm_lock:
self.controller.set("foil_cmd", flag)
self._wago.set("foil_cmd", flag)
self.__update_foil_state()
This diff is collapsed.
......@@ -94,11 +94,11 @@ class tab3(CalcController):
positions_dict["back1"] - positions_dict["back2"]
)
xtilt = numpy.atan(
xtilt = numpy.arctan(
(positions_dict["back2"] - positions_dict["back1"]) / self.d1
)
ytilt = numpy.atan((back - positions_dict["front"]) / self.d2)
ytilt = numpy.arctan((back - positions_dict["front"]) / self.d2)
if self.geometry in (2, 6):
xtilt, ytilt = map(numpy.degrees, (xtilt, ytilt))
......
......@@ -45,7 +45,7 @@ class tabsup(CalcController):
return {
"ttrans": (d1 * tyb - d2 * tyf) / (d1 - d2),
"trot": numpy.atan((tyf - tyb) / (d2 - d1)),
"trot": numpy.arctan((tyf - tyb) / (d2 - d1)),
}
def calc_to_real(self, positions_dict):
......
......@@ -116,7 +116,7 @@ class trans4(CalcController):
"""
d1 = self.config.get("d1", float)
d2 = self.config.get("d2", float)
alpha = numpy.atan(d2 / d1)
alpha = numpy.arctan(d2 / d1)
cos2_alpha = numpy.cos(alpha) ** 2
dh = positions_dict["dh"]
......@@ -130,9 +130,9 @@ class trans4(CalcController):
p2z = (ur + uh) / 2.
ty = (p1y + p2y * cos2_alpha) / (1 + cos2_alpha)
thetaz = -numpy.atan((p1y - p2y) / d1 * (cos2_alpha / (1 + cos2_alpha)))
thetaz = -numpy.arctan((p1y - p2y) / d1 * (cos2_alpha / (1 + cos2_alpha)))
tz = (p2z + p1z) / 2.
thetay = numpy.atan((p2z - p1z) / (2 * d1))
thetay = numpy.arctan((p2z - p1z) / (2 * d1))
thetaz *= 1000.
thetay *= 1000.
......@@ -149,7 +149,7 @@ class trans4(CalcController):
"""
d1 = self.config.get("d1", float)
d2 = self.config.get("d2", float)
alpha = numpy.atan(d2 / d1)
alpha = numpy.arctan(d2 / d1)
cos2_alpha = numpy.cos(alpha) ** 2
ty = positions_dict["ty"]
......
......@@ -196,7 +196,6 @@ class ScanManager:
# FIXME: This is a trick to trig _update() function, else last_image_ready is wrong
image_view.last_index
redis_frame_id = image_view.last_image_ready
print("redis_frame_id", redis_frame_id)
if redis_frame_id == -1:
# Mitigate with #1069
# A signal can be emitted when there is not yet data
......
......@@ -420,12 +420,12 @@ class SamplingCounterAcquisitionSlave(BaseCounterAcquisitionSlave):
class IntegratingCounterAcquisitionSlave(BaseCounterAcquisitionSlave):
def __init__(self, *counters, count_time=None, ctrl_params=None):
def __init__(self, *counters, count_time=None, npoints=1, ctrl_params=None):
super().__init__(
*counters,
count_time=count_time,
npoints=1,
npoints=npoints,
prepare_once=False,
start_once=False,
ctrl_params=ctrl_params,
......
......@@ -13,7 +13,6 @@ import weakref
import sys
import time
import datetime
import collections
import uuid
from functools import wraps
......@@ -39,7 +38,6 @@ from louie import saferef
# Globals
SCANS = collections.deque(maxlen=20)
current_module = sys.modules[__name__]
# STORE THE CALLBACK FUNCTIONS THAT ARE CALLED DURING A SCAN ON THE EVENTS SCAN_NEW, SCAN_DATA, SCAN_END
......@@ -1241,7 +1239,7 @@ class Scan:
self.__state = ScanState.DONE
# Add scan to the globals
SCANS.append(self)
current_session.scans.append(self)
if self.writer:
# write scan_info to file
......
......@@ -13,14 +13,13 @@ Information are classify into categories like:
- technique
- ...
"""
__all__ = ["get_user_scan_meta"]
__all__ = ["get_user_scan_meta", "create_user_scan_meta"]
import copy as copy_module
import enum
from bliss import global_map
from bliss import global_map, current_session
USER_SCAN_META = None
CATEGORIES = enum.Enum(
"categories", "INSTRUMENT SAMPLE SAMPLE_DESCRIPTION PROPOSAL TECHNIQUE"
)
......@@ -31,15 +30,17 @@ def categories_names():
def get_user_scan_meta():
global USER_SCAN_META
if USER_SCAN_META is None:
USER_SCAN_META = scan_meta()
USER_SCAN_META.instrument.set("positioners", fill_positioners)
USER_SCAN_META.sample.set("NX_class", {"NX_class": "NXsample"})
USER_SCAN_META.proposal.set("NX_class", {"NX_class": "NXcollection"})
USER_SCAN_META.sample_description.set("NX_class", {"NX_class": "NXcollection"})
USER_SCAN_META.technique.set("NX_class", {"NX_class": "NXcollection"})
return USER_SCAN_META
return current_session.user_scan_meta
def create_user_scan_meta():
user_scan_meta = scan_meta()
user_scan_meta.instrument.set("positioners", fill_positioners)
user_scan_meta.sample.set("NX_class", {"NX_class": "NXsample"})
user_scan_meta.proposal.set("NX_class", {"NX_class": "NXcollection"})
user_scan_meta.sample_description.set("NX_class", {"NX_class": "NXcollection"})
user_scan_meta.technique.set("NX_class", {"NX_class": "NXcollection"})
return user_scan_meta
def scan_meta(info=None):
......
......@@ -26,7 +26,7 @@ else:
from gevent import socket
import functools
from bliss import release
from bliss import release, current_session
from bliss.config import static
from bliss.common import session
from bliss.common.session import DefaultSession
......@@ -121,15 +121,15 @@ def initialize(session_name=None):
env_dict = {}
exec("from bliss.common.standard import *", env_dict)
from bliss.scanning.scan import ScanDisplay, SCANS
from bliss.scanning.scan import ScanDisplay
env_dict["SCANS"] = SCANS
env_dict["SCAN_DISPLAY"] = ScanDisplay(session.name)
env_dict["history"] = lambda: print("Please press F3-key to view history!")
try:
session.setup(env_dict, verbose=True)
env_dict["SCANS"] = current_session.scans
except Exception:
error_flag = True
sys.excepthook(*sys.exc_info())
......
......@@ -324,6 +324,10 @@ SCANS[-1].get_data()
}
```
!!! note
Scans are stored per session in the `.scans` property of Session object.
The global `SCANS` is only available from Bliss Shell and refers to `current_session.scans`.
#### Getting image data
Image data is not directly retrieved via the scan object `.get_data()` method,
......
## User metadata
BLISS provides a global structure to associate names (string keys) to functions, which return values are
......@@ -42,9 +40,4 @@ The function receives the scan object as argument. In the example above, this ar
Each subsequent scan will have an 'instrument' section filled with the metadata:
![Screenshot](img/scan_metadata.png)
![Screenshot](img/scan_meta.png)
## Architecture
![Screenshot](img/scan_data_flow_path.svg)
## SCAN_SAVING
`SCAN_SAVING` is a per session structure to tell BLISS how to save data.
## SCAN_SAVING
Access it with `.scan_saving` property of Session object.
`SCAN_SAVING` is a global structure to tell BLISS how to save data:
From Bliss Shell you have also access to a global variable `SCAN_SAVING` that refers to `current_session.scan_saving`.
example:
......@@ -40,7 +40,6 @@ return value is used.
`SCAN_SAVING.get()` performs template string interpolation and returns
a dictionary, whose key `root_path` is the final path to scan files.
#### SCAN_SAVING members
* `base_path`: the highest level directory for the file path, e.g. `/data`
......@@ -72,6 +71,7 @@ project later.
### Configuration example
#### template configuration example
In this example `SCAN_SAVING` we will add two extra parameters
(**sample** and **experiment**) and use them to generate the final path.
......@@ -123,4 +123,4 @@ TEST_SESSION [12]: SCAN_SAVING.get_path()
TEST_SESSION [13]: SCAN_SAVING.user_name='toto'
TEST_SESSION [14]: SCAN_SAVING.get_path()
Out [14]: '/data/visitor/unknown/lysozyme'
```
\ No newline at end of file
```
......@@ -33,7 +33,6 @@ pyzmq
redis >= 5.0
redis-py >= 3.3.7
requests
silx == 0.11.0
sqlalchemy
tabulate
tango >= 9.3.2
......@@ -41,4 +40,9 @@ pytango
tblib
tmux >= 2.7
treelib
# Flint
qt
silx == 0.11.0
pyopengl
scipy
......@@ -129,7 +129,7 @@ def test_read_calc_channels(pepu, channel_id):
@pytest.mark.parametrize("acquisitions", [1, 2, 10])
@pytest.mark.parametrize("blocks", [1, 2, 10])
@pytest.mark.parametrize("block_size", [1, 2, 10])
def test_streams_acquisition(pepu, acquisitions, blocks, block_size):
def test_streams_acquisition(beacon, pepu, acquisitions, blocks, block_size):
# Mocking
command = "?DSTREAM TEST"
......
......@@ -170,6 +170,5 @@ def dummy_acq_master():
@pytest.fixture
def scan_meta():
s = scan_meta_module.get_user_scan_meta()
s = scan_meta_module.create_user_scan_meta()
yield s
scan_meta_module.USER_SCAN_META = None
......@@ -6,8 +6,7 @@
# Distributed under the GNU LGPLv3. See LICENSE for more info.
import pytest
from bliss import setup_globals
from bliss import global_map
from bliss import global_map, current_session
from bliss.common import scans
from bliss.common.axis import Axis
from bliss.scanning.scan import Scan, ScanSaving
......@@ -44,7 +43,7 @@ def test_hdf5_metadata(session):
diode = session.config.get("diode")
s = scans.ascan(roby, 0, 10, 10, 0.01, diode, save=True, return_scan=True)
assert s is scans.SCANS[-1]
assert s is current_session.scans[-1]
iso_start_time = datetime.datetime.fromtimestamp(
s.scan_info["start_timestamp"]
......
......@@ -10,7 +10,7 @@ import time
import gevent
import numpy
import pickle as pickle
from bliss import setup_globals
from bliss import setup_globals, current_session
from bliss.common import scans
from bliss.scanning.scan import Scan
from bliss.scanning.chain import AcquisitionChain, AcquisitionMaster, AcquisitionSlave
......@@ -149,7 +149,7 @@ def test_scan_data_0d(session, redis_data_conn):
simul_counter = session.env_dict.get("sim_ct_gauss")
s = scans.timescan(0.1, simul_counter, npoints=10, return_scan=True, save=False)
assert s == scans.SCANS[-1]
assert s == current_session.scans[-1]
# redis key is build from node name and counter name with _data suffix
# ":timer:<counter_name>:<counter_name>_data"
......@@ -352,9 +352,9 @@ def test_children_timing(beacon, session, scan_tmpdir):
def test_scan_end_timing(
session, scan_meta, dummy_acq_master, dummy_acq_device
session, dummy_acq_master, dummy_acq_device
): # , clean_gevent):
scan_meta.clear()
session.user_scan_meta.clear()
# Get controllers
chain = AcquisitionChain()
......
......@@ -89,8 +89,8 @@ def test_scan_meta_order_function(scan_meta):
assert scan_meta_dict["sample"] == first_info
def test_scan_meta_master_and_device(session, scan_meta):
scan_meta.clear()
def test_scan_meta_master_and_device(session):
session.user_scan_meta.clear()
master_dict = {"super master": 10}
class DummyMaster(AcquisitionMaster):
......