diff --git a/tomcat_bec/devices/gigafrost/stddaq_client.py b/tomcat_bec/devices/gigafrost/stddaq_client.py index 551b859..c0c1e1d 100644 --- a/tomcat_bec/devices/gigafrost/stddaq_client.py +++ b/tomcat_bec/devices/gigafrost/stddaq_client.py @@ -171,6 +171,7 @@ class StdDaqClient(PSIDeviceBase): cfg_bit_depth = Component(Signal, kind=Kind.config) cfg_pixel_height = Component(Signal, kind=Kind.config) cfg_pixel_width = Component(Signal, kind=Kind.config) + cfg_nr_writers = Component(Signal, kind=Kind.config) def __init__( @@ -280,6 +281,9 @@ class StdDaqClient(PSIDeviceBase): trigger_mode : str, optional Trigger mode of the gifafrost (default = unchanged) + nr_writers: int, optional + Number of writers + (default = unchanged) correction_mode : int, optional The correction to be applied to the imaging data. The following modes are available (default = 5): @@ -300,10 +304,16 @@ class StdDaqClient(PSIDeviceBase): self.num_images.set(d['num_points_total']).wait() if 'file_path' in d and d['file_path']!=None: self.file_path.set(d['file_path']).wait() + if 'nr_writers' in d and d['nr_writers']!=None: + self.cfg_nr_writers.set(d['nr_writers']).wait() # Restart the DAQ if resolution changed cfg = self.get_daq_config() - if cfg['image_pixel_height'] != self.cfg_pixel_height.get() or cfg['image_pixel_width'] != self.cfg_pixel_width.get(): + if cfg['image_pixel_height'] != self.cfg_pixel_height.get() or + cfg['image_pixel_width'] != self.cfg_pixel_width.get() or + cfg['bit_depth'] != self.cfg_bit_depth.get() or + cfg['number_of_writers'] != self.cfg_nr_writers.get(): + # Stop if current status is not idle if self.state() != "idle": self.surestop() @@ -313,6 +323,8 @@ class StdDaqClient(PSIDeviceBase): # Update retrieved config cfg['image_pixel_height'] = int(self.cfg_pixel_height.get()) cfg['image_pixel_width'] = int(self.cfg_pixel_width.get()) + cfg['bit_depth'] = int(self.cfg_bit_depth.get()) + cfg['number_of_writers'] = int(self.cfg_nr_writers.get()) self.set_daq_config(cfg) self.read_daq_config() @@ -336,6 +348,7 @@ class StdDaqClient(PSIDeviceBase): self.cfg_bit_depth.set(cfg['bit_depth']).wait() self.cfg_pixel_height.set(cfg['image_pixel_height']).wait() self.cfg_pixel_width.set(cfg['image_pixel_width']).wait() + self.cfg_nr_writers.set(cfg['number_of_writers']).wait() return cfg def set_daq_config(self, config): @@ -353,6 +366,20 @@ class StdDaqClient(PSIDeviceBase): raise ConnectionError(f"[{self.name}] Error {r.status_code}:\t{r.text}") return r.json() + def create_virtual_dataset(self): + """Combine the stddaq written files in a given folder in an interleaved + h5 virtual dataset + """ + url = self.rest_url.get() + '/api/h5/create_interleaved_vds' + + r = requests.pos( + url, + params = {'user': 'ioc'}, + data = {'base_path': self.file_path. 'output_file': 'fede_virtual_test'}, + timeout = 2, + headers = {'Content-type': 'application/json'} + ) + def nuke(self): """ Reconfigures the stdDAQ to restart the services """ diff --git a/tomcat_bec/scripts/scans_fede.py b/tomcat_bec/scripts/scans_fede.py index 41e2de2..f814ca8 100644 --- a/tomcat_bec/scripts/scans_fede.py +++ b/tomcat_bec/scripts/scans_fede.py @@ -28,7 +28,11 @@ class Measurement: """ bec.system_config.file_suffix = self.sample_name bec.system_config.file_directory = os.path.join(self.data_path,self.sample_name) - self.file_path = '/gpfs/test/test-beamline' + self.file_path = '/data/test/test-beamline/test_fede' + if os.path.isdir(self.file_path): + pass + else: + os.mkdir(self.file_path) def configure(self,sample_name=None, data_path=None, exposure_time=None, exposure_period=None, roix=None, roiy=None,nimages=None, @@ -138,7 +142,13 @@ class Measurement: # Commit changes to GF dev.gfcam.cmdSetParam.set(1).wait() + if file_path!=None: + if os.path.isdir(file_path): + pass + else: + os.mkdir(file_path) + ### TODO: camera reset print("Handing over to 'scans.acquire_dark") scans.acquire_dark(exp_burst=nimages_dark, exp_time=exposure_time, exp_period=exposure_period, image_width=roix, - image_height=roiy, acq_mode=acq_mode, file_path=file_path) \ No newline at end of file + image_height=roiy, acq_mode=acq_mode, file_path=file_path, nr_writers=1) \ No newline at end of file