Acquisition dark working.

This commit is contained in:
gac-x05la
2025-02-05 17:11:04 +01:00
parent 801aa62f82
commit 5c168a902d
2 changed files with 24 additions and 36 deletions

View File

@@ -577,7 +577,7 @@ class GigaFrostCamera(PSIDetectorBase):
self.cfgEnableScheme.set(0).wait()
# Set modes
self.cmdSoftEnable.set(0).wait()
#self.cmdSoftEnable.set(0).wait()
self.enable_mode = "soft"
self.trigger_mode = "auto"
self.exposure_mode = "timer"

View File

@@ -18,18 +18,33 @@ class Measurement:
self.roix = None
self.roiy = None
bec.system_config.file_suffix = self.sample_name
enabled_detectors = [obj for obj in dev.get_devices_with_tags('camera') if obj.enabled]
if len(enabled_detectors) != 1:
print('WARNING! More than 1 detector active')
self.det = enabled_detectors[0]
self.device_name = enabled_detectors[0].name
bec.system_config.file_suffix = None
bec.system_config.file_directory = os.path.join(self.data_path,self.sample_name)
self.build_filename()
def build_filename(self):
"""
Build and set filename for bec and stddaq
Build and set filepath for bec
Build filepath and file prefix for stddaq
"""
#bec.system_config.file_suffix = self.sample_name
self.scan_sample_name = 'S' + str(bec.queue.next_scan_number) + '_' + self.sample_name
print(self.scan_sample_name)
# File path for bec
bec.system_config.file_directory = os.path.join(self.data_path,self.sample_name,self.scan_sample_name)
# File path for stddaq (for now root folders different between console and stddaq server)
self.file_path = os.path.join('/data/test/test-beamline',bec.system_config.file_directory, '_device_dat', self.device_name) # _device_dat does not work for now.
# A hack for now to create the right permissions
self.base_path = os.path.join('/data/test/test-beamline',self.data_path)
self.file_prefix = self.scan_sample_name + '_' + self.device_name + '_data_dark_'
def configure(self,sample_name=None, data_path=None, exposure_time=None,
exposure_period=None, roix=None, roiy=None,nimages=None,
@@ -134,27 +149,6 @@ class Measurement:
dev.daq_stream0.enabled = True
dev.daq_stream1.enabled = False
dev.gfcam.cfgAcqMode.set(1).wait()
dev.gfcam.cmdSetParam.set(1).wait()
dev.gfcam.cfgEnableExt.set(0).wait()
dev.gfcam.cfgEnableSoft.set(0).wait()
dev.gfcam.cfgEnableAlways.set(1).wait()
dev.gfcam.cfgTrigExt.set(0).wait()
dev.gfcam.cfgTrigSoft.set(0).wait()
dev.gfcam.cfgTrigTimer.set(0).wait()
dev.gfcam.cfgTrigAuto.set(1).wait()
dev.gfcam.cfgExpExt.set(0).wait()
dev.gfcam.cfgExpSoft.set(0).wait()
dev.gfcam.cfgExpTimer.set(1).wait()
dev.gfcam.cfgCntStartBit.set(0).wait()
# Commit changes to GF
dev.gfcam.cmdSetParam.set(1).wait()
if exposure_time != None:
self.exposure_time = exposure_time
if exposure_period != None:
@@ -164,16 +158,10 @@ class Measurement:
if roiy != None:
self.roiy = roiy
# To add folder with device name
file_path = os.path.join('/data/test/test-beamline',bec.system_config.file_directory, '_device_dat') # _device_dat does not work for now.
print(file_path)
# A hack for now
base_path = os.path.join('/data/test/test-beamline',self.data_path)
print(base_path)
file_prefix = self.scan_sample_name + '_data_dark_' # to add device name
print(file_prefix)
self.build_filename()
### TODO: camera reset
print("Handing over to 'scans.acquire_dark")
scans.acquire_dark(exp_burst=nimages_dark, exp_time=self.exposure_time, exp_period=self.exposure_period, image_width=self.roix,
image_height=self.roiy, acq_mode=acq_mode, file_path=file_path, nr_writers=2, base_path=base_path,
file_prefix=file_prefix)
image_height=self.roiy, acq_mode=acq_mode, file_path=self.file_path, nr_writers=2, base_path=self.base_path,
file_prefix=self.file_prefix)