Commit 20675b5e authored by bliss administrator's avatar bliss administrator
Browse files

Merge branch '2.0' of https://gitlab.esrf.fr/tomo/ebs-tomo into 2.0

parents 973c7fba d7eede8a
......@@ -206,6 +206,10 @@ class TomoConfig(object):
self.__ref_chain_presets = dict()
self.__return_scan_presets = dict()
self.__return_chain_presets = dict()
for i in ["dark", "ref", "return"]:
for j in ["scan", "chain"]:
self.create_add_preset(i, j)
def dark_images(self,expo_time,dark_n,*detectors,scan_sequence=None,header={},save=True,run=True):
scan_info = {}
......@@ -227,63 +231,44 @@ class TomoConfig(object):
scan.run()
return scan
def add_dark_scan_preset(self, preset, name=None):
if not isinstance(preset, ScanPreset):
raise ValueError("preset should be an instance of ScanPreset !!")
preset_name = id(preset) if name is None else name
self.__dark_scan_presets[preset_name] = preset
def create_add_preset(self, i, j):
if j == "scan":
Preset = ScanPreset
else:
Preset = ChainPreset
def add_preset(preset, name=None):
if not isinstance(preset, Preset):
raise ValueError(
"preset should be an instance of ScanPreset !!")
preset_name = id(preset) if name is None else name
presets = getattr(self, "__"+i+"_scan_presets")
presets[preset_name] = preset
add_preset.__doc__ = "docstring"
add_preset.__name__ = "add_" + i + "_" + j + "_preset"
setattr(self, add_preset.__name__, add_preset)
def remove_dark_scan_preset(self, name):
if name in self.__dark_scan_presets:
self.__dark_scan_presets.pop(name)
def add_dark_chain_preset(self, preset, name=None):
if not isinstance(preset, ChainPreset):
raise ValueError("preset should be an instance of ChainPreset !!")
preset_name = id(preset) if name is None else name
self.__dark_chain_presets[preset_name] = preset
def remove_dark_chain_preset(self, name):
if name in self.__dark_chain_presets:
self.__dark_chain_presets.pop(name)
def add_ref_scan_preset(self, preset, name=None):
if not isinstance(preset, ScanPreset):
raise ValueError("preset should be an instance of ScanPreset !!")
preset_name = id(preset) if name is None else name
self.__ref_scan_presets[preset_name] = preset
def remove_ref_scan_preset(self, name):
if name in self.__ref_scan_presets:
self.__ref_scan_presets.pop(name)
def add_ref_chain_preset(self, preset, name=None):
if not isinstance(preset, ChainPreset):
raise ValueError("preset should be an instance of ChainPreset !!")
preset_name = id(preset) if name is None else name
self.__ref_chain_presets[preset_name] = preset
def remove_ref_chain_preset(self, name):
if name in self.__ref_chain_presets:
self.__ref_chain_presets.pop(name)
def add_return_scan_preset(self, preset, name=None):
if not isinstance(preset, ScanPreset):
raise ValueError("preset should be an instance of ScanPreset !!")
preset_name = id(preset) if name is None else name
self.__return_scan_presets[preset_name] = preset
def remove_return_scan_preset(self, name):
if name in self.__return_scan_presets:
self.__return_scan_presets.pop(name)
def add_return_chain_preset(self, preset, name=None):
if not isinstance(preset, ChainPreset):
raise ValueError("preset should be an instance of ChainPreset !!")
preset_name = id(preset) if name is None else name
self.__return_chain_presets[preset_name] = preset
def remove_return_chain_preset(self, name):
if name in self.__return_chain_presets:
self.__return_chain_presets.pop(name)
......
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