Commit 1b0802d2 authored by Wout De Nolf's avatar Wout De Nolf
Browse files

scan_saving: deprecate technique

parent bf34b958
...@@ -749,7 +749,6 @@ class ESRFScanSaving(BasicScanSaving): ...@@ -749,7 +749,6 @@ class ESRFScanSaving(BasicScanSaving):
"date_format": "%Y%m%d", "date_format": "%Y%m%d",
"scan_number_format": "%04d", "scan_number_format": "%04d",
"dataset_number_format": "%04d", "dataset_number_format": "%04d",
"technique": "",
# saved properties in Redis: # saved properties in Redis:
"_writer_module": "nexus", "_writer_module": "nexus",
"_proposal": "", "_proposal": "",
...@@ -796,12 +795,16 @@ class ESRFScanSaving(BasicScanSaving): ...@@ -796,12 +795,16 @@ class ESRFScanSaving(BasicScanSaving):
self._remove_deprecated() self._remove_deprecated()
def _remove_deprecated(self): def _remove_deprecated(self):
"""Remove deprecated items from existing Redis databases"""
stored = self.to_dict() stored = self.to_dict()
if "_sample" in stored: if "_sample" in stored:
# Deprecated in Bliss 1.7 # Deprecated in Bliss > 1.7.0
value = stored["_sample"] value = stored["_sample"]
self.remove("._sample") self.remove("._sample")
self._collection = value self._collection = value
if "technique" in stored:
# Deprecated in Bliss > 1.8.0
self.remove("technique")
def __dir__(self): def __dir__(self):
keys = super().__dir__() keys = super().__dir__()
......
...@@ -108,7 +108,6 @@ DEMO [5]: SCAN_SAVING ...@@ -108,7 +108,6 @@ DEMO [5]: SCAN_SAVING
.date_format = '%Y%m%d' .date_format = '%Y%m%d'
.scan_number_format = '%04d' .scan_number_format = '%04d'
.dataset_number_format = '%04d' .dataset_number_format = '%04d'
.technique = ''
.session = 'demo' .session = 'demo'
.date = '20200208' .date = '20200208'
.scan_name = '{scan_name}' .scan_name = '{scan_name}'
......
...@@ -12,14 +12,14 @@ class Session: ...@@ -12,14 +12,14 @@ class Session:
self.env_dict["SCAN_SAVING"] = self.scan_saving self.env_dict["SCAN_SAVING"] = self.scan_saving
``` ```
Creating a custom data policy means deriving a class from `bliss.scanning.scan_saving.BaseScanSaving`: Creating a custom data policy means deriving a class from `bliss.scanning.scan_saving.BasicScanSaving`:
```python ```python
class CustomScanSaving(BaseScanSaving): class CustomScanSaving(BasicScanSaving):
DEFAULT_VALUES = { DEFAULT_VALUES = {
# default and not removable values # default and not removable values
"technique": "", "scan_number_format": "%04d",
... ...
# saved properties in Redis: # saved properties in Redis:
"_proposal": "", "_proposal": "",
......
...@@ -207,7 +207,7 @@ def prepare_scan_saving(session=None, tmpdir=None, policy=True, **kwargs): ...@@ -207,7 +207,7 @@ def prepare_scan_saving(session=None, tmpdir=None, policy=True, **kwargs):
) )
scan_saving.proposal_name = "testproposal" scan_saving.proposal_name = "testproposal"
technique = nxw_test_config.technique["withpolicy"] technique = nxw_test_config.technique["withpolicy"]
scan_saving.technique = technique scan_saving.proposal.all.definition = technique
measurementgroup.set_active_name(technique + "MG") measurementgroup.set_active_name(technique + "MG")
else: else:
tmpdir = str(tmpdir) tmpdir = str(tmpdir)
......
...@@ -21,7 +21,7 @@ def _test_nxw_plotselect( ...@@ -21,7 +21,7 @@ def _test_nxw_plotselect(
): ):
scan_saving = session.scan_saving scan_saving = session.scan_saving
env_dict = session.env_dict env_dict = session.env_dict
scan_saving.technique = "" scan_saving.dataset.all.definition = "none"
detectors = [env_dict[name] for name in ["diode3", "diode4", "diode5"]] detectors = [env_dict[name] for name in ["diode3", "diode4", "diode5"]]
scan_shape = (10,) scan_shape = (10,)
......
...@@ -41,7 +41,7 @@ def _test_nxw_readers( ...@@ -41,7 +41,7 @@ def _test_nxw_readers(
config=True, config=True,
**kwargs **kwargs
): ):
session.scan_saving.technique = "none" session.scan_saving.dataset.all.definition = "none"
detector = "diode3" detector = "diode3"
detectorobj = session.env_dict[detector] detectorobj = session.env_dict[detector]
......
...@@ -40,7 +40,10 @@ def test_nxw_scangroup_base_nopolicy(nexus_writer_base_nopolicy): ...@@ -40,7 +40,10 @@ def test_nxw_scangroup_base_nopolicy(nexus_writer_base_nopolicy):
@nxw_test_utils.writer_stdout_on_exception @nxw_test_utils.writer_stdout_on_exception
def _test_nxw_scangroup(session=None, tmpdir=None, writer=None, **kwargs): def _test_nxw_scangroup(session=None, tmpdir=None, writer=None, **kwargs):
session.scan_saving.add("technique", "none") try:
session.scan_saving.dataset.all.definition = "none"
except AttributeError:
pass # data policy disabled
npoints = 10 npoints = 10
detector1 = session.env_dict["diode3"] detector1 = session.env_dict["diode3"]
detector2 = session.env_dict["diode4"] detector2 = session.env_dict["diode4"]
......
Supports Markdown
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