fix: online changes e20643
This commit is contained in:
parent
592ddfe6da
commit
0bf308a13d
@ -232,8 +232,8 @@ class Eiger9mCsaxs(DetectorBase):
|
|||||||
# self.cam.acquire_period.set(
|
# self.cam.acquire_period.set(
|
||||||
# self.scaninfo.exp_time + (self.scaninfo.readout_time - self.reduce_readout)
|
# self.scaninfo.exp_time + (self.scaninfo.readout_time - self.reduce_readout)
|
||||||
# )
|
# )
|
||||||
self.cam.num_cycles.set(int(self.scaninfo.num_points * self.scaninfo.frames_per_trigger))
|
self.cam.num_cycles.put(int(self.scaninfo.num_points * self.scaninfo.frames_per_trigger))
|
||||||
self.cam.num_frames.set(1)
|
self.cam.num_frames.put(1)
|
||||||
|
|
||||||
def _set_trigger(self, trigger_source: TriggerSource) -> None:
|
def _set_trigger(self, trigger_source: TriggerSource) -> None:
|
||||||
"""Set trigger source for the detector, either directly to value or TriggerSource.* with
|
"""Set trigger source for the detector, either directly to value or TriggerSource.* with
|
||||||
@ -243,7 +243,7 @@ class Eiger9mCsaxs(DetectorBase):
|
|||||||
BURST_TRIGGER = 3
|
BURST_TRIGGER = 3
|
||||||
"""
|
"""
|
||||||
value = int(trigger_source)
|
value = int(trigger_source)
|
||||||
self.cam.timing_mode.set(value)
|
self.cam.timing_mode.put(value)
|
||||||
|
|
||||||
def _prep_file_writer(self) -> None:
|
def _prep_file_writer(self) -> None:
|
||||||
self.filepath = self.filewriter.compile_full_filename(
|
self.filepath = self.filewriter.compile_full_filename(
|
||||||
@ -316,6 +316,11 @@ class Eiger9mCsaxs(DetectorBase):
|
|||||||
def unstage(self) -> List[object]:
|
def unstage(self) -> List[object]:
|
||||||
"""unstage the detector and file writer"""
|
"""unstage the detector and file writer"""
|
||||||
logger.info("Waiting for Eiger9M to finish")
|
logger.info("Waiting for Eiger9M to finish")
|
||||||
|
old_scanID = self.scaninfo.scanID
|
||||||
|
self.scaninfo.load_scan_metadata()
|
||||||
|
logger.info(f"Old scanID: {old_scanID}, ")
|
||||||
|
if self.scaninfo.scanID != old_scanID:
|
||||||
|
self._stopped = True
|
||||||
if self._stopped ==True:
|
if self._stopped ==True:
|
||||||
return super().unstage()
|
return super().unstage()
|
||||||
self._eiger9M_finished()
|
self._eiger9M_finished()
|
||||||
@ -349,7 +354,7 @@ class Eiger9mCsaxs(DetectorBase):
|
|||||||
break
|
break
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
timer += 0.1
|
timer += 0.1
|
||||||
if timer > 5:
|
if timer > 8:
|
||||||
self._stopped == True
|
self._stopped == True
|
||||||
self._close_file_writer()
|
self._close_file_writer()
|
||||||
raise EigerTimeoutError(
|
raise EigerTimeoutError(
|
||||||
|
@ -234,6 +234,11 @@ class FalconCsaxs(Device):
|
|||||||
|
|
||||||
def unstage(self) -> List[object]:
|
def unstage(self) -> List[object]:
|
||||||
logger.info("Waiting for Falcon to return from acquisition")
|
logger.info("Waiting for Falcon to return from acquisition")
|
||||||
|
old_scanID = self.scaninfo.scanID
|
||||||
|
self.scaninfo.load_scan_metadata()
|
||||||
|
logger.info(f"Old scanID: {old_scanID}, ")
|
||||||
|
if self.scaninfo.scanID != old_scanID:
|
||||||
|
self._stopped = True
|
||||||
if self._stopped:
|
if self._stopped:
|
||||||
return super().unstage()
|
return super().unstage()
|
||||||
self._falcon_finished()
|
self._falcon_finished()
|
||||||
@ -252,20 +257,20 @@ class FalconCsaxs(Device):
|
|||||||
"""Function with 10s timeout"""
|
"""Function with 10s timeout"""
|
||||||
timer = 0
|
timer = 0
|
||||||
while True:
|
while True:
|
||||||
det_ctrl = self.acquiring.read()[self.acquiring.name]['value']
|
det_ctrl = self.state.read()[self.state.name]['value']
|
||||||
writer_ctrl = self.hdf5.capture.get()
|
writer_ctrl = self.hdf5.capture.get()
|
||||||
received_frames = self.dxp.current_pixel.get()
|
received_frames = self.dxp.current_pixel.get()
|
||||||
total_frames = int(self.scaninfo.num_points * self.scaninfo.frames_per_trigger)
|
total_frames = int(self.scaninfo.num_points * self.scaninfo.frames_per_trigger)
|
||||||
# TODO if no writing was performed before
|
# TODO if no writing was performed before
|
||||||
if det_ctrl == 0 and writer_ctrl == 0 and total_frames == received_frames:
|
if total_frames == received_frames:
|
||||||
break
|
break
|
||||||
if self._stopped == True:
|
if self._stopped == True:
|
||||||
break
|
break
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
timer += 0.1
|
timer += 0.1
|
||||||
if timer > 5:
|
if timer > 8:
|
||||||
raise FalconTimeoutError(
|
raise FalconTimeoutError(
|
||||||
f"Reached timeout with detector state {det_ctrl}, std_daq state {writer_ctrl} and received frames of {received_frames} for the file writer"
|
f"Reached timeout with detector state {det_ctrl}, falcon state {writer_ctrl} and received frames of {received_frames} for the file writer"
|
||||||
)
|
)
|
||||||
|
|
||||||
def stop(self, *, success=False) -> None:
|
def stop(self, *, success=False) -> None:
|
||||||
|
@ -223,7 +223,7 @@ class McsCsaxs(SIS38XX):
|
|||||||
self._set_trigger(TriggerSource.MODE3)
|
self._set_trigger(TriggerSource.MODE3)
|
||||||
self.input_polarity.set(0)
|
self.input_polarity.set(0)
|
||||||
self.output_polarity.set(1)
|
self.output_polarity.set(1)
|
||||||
self.count_on_start.set(0)
|
self.count_on_start.set(1)
|
||||||
self.stop_all.set(1)
|
self.stop_all.set(1)
|
||||||
|
|
||||||
def _progress_update(self, value, **kwargs) -> None:
|
def _progress_update(self, value, **kwargs) -> None:
|
||||||
@ -243,9 +243,10 @@ class McsCsaxs(SIS38XX):
|
|||||||
self.mca_data[obj.attr_name] = kwargs["value"][1:]
|
self.mca_data[obj.attr_name] = kwargs["value"][1:]
|
||||||
if len(self.mca_names) != len(self.mca_data):
|
if len(self.mca_names) != len(self.mca_data):
|
||||||
return
|
return
|
||||||
logger.info("Entered _on_mca_data")
|
#logger.info("Entered _on_mca_data")
|
||||||
self._updated = True
|
self._updated = True
|
||||||
self.counter += 1
|
self.counter += 1
|
||||||
|
#logger.info(f'data from mca {self.mca_data["mca1"]} and {self.mca_data["mca4"]}')
|
||||||
if (self.scaninfo.scan_type == "fly" and self.counter == self.num_lines.get()) or (
|
if (self.scaninfo.scan_type == "fly" and self.counter == self.num_lines.get()) or (
|
||||||
self.scaninfo.scan_type == "step" and self.counter == self.scaninfo.num_points
|
self.scaninfo.scan_type == "step" and self.counter == self.scaninfo.num_points
|
||||||
):
|
):
|
||||||
@ -253,7 +254,7 @@ class McsCsaxs(SIS38XX):
|
|||||||
self.stop_all.put(1, use_complete=False)
|
self.stop_all.put(1, use_complete=False)
|
||||||
self._send_data_to_bec()
|
self._send_data_to_bec()
|
||||||
self.erase_all.put(1)
|
self.erase_all.put(1)
|
||||||
logger.info("Entered _on_mca_data, acquisition finished")
|
#logger.info("Entered _on_mca_data, acquisition finished")
|
||||||
# Require wait for
|
# Require wait for
|
||||||
# time.sleep(0.01)
|
# time.sleep(0.01)
|
||||||
self.mca_data = defaultdict(lambda: [])
|
self.mca_data = defaultdict(lambda: [])
|
||||||
@ -348,11 +349,15 @@ class McsCsaxs(SIS38XX):
|
|||||||
def unstage(self) -> List[object]:
|
def unstage(self) -> List[object]:
|
||||||
"""unstage"""
|
"""unstage"""
|
||||||
logger.info("Waiting for mcs to finish acquisition")
|
logger.info("Waiting for mcs to finish acquisition")
|
||||||
if self._stopped == True:
|
old_scanID = self.scaninfo.scanID
|
||||||
|
self.scaninfo.load_scan_metadata()
|
||||||
|
logger.info(f"Old scanID: {old_scanID}, ")
|
||||||
|
if self.scaninfo.scanID != old_scanID:
|
||||||
|
self._stopped = True
|
||||||
|
if self._stopped is True:
|
||||||
logger.info("Entered unstage _stopped =True")
|
logger.info("Entered unstage _stopped =True")
|
||||||
return super().unstage()
|
return super().unstage()
|
||||||
if self._stopped:
|
self._mcs_finished()
|
||||||
self._mcs_finished()
|
|
||||||
self._acquisition_done = False
|
self._acquisition_done = False
|
||||||
self._stopped = False
|
self._stopped = False
|
||||||
logger.info("mcs done")
|
logger.info("mcs done")
|
||||||
@ -369,7 +374,7 @@ class McsCsaxs(SIS38XX):
|
|||||||
break
|
break
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
timer += 0.1
|
timer += 0.1
|
||||||
if timer > 5:
|
if timer > 8:
|
||||||
total_frames = self.counter * int(
|
total_frames = self.counter * int(
|
||||||
self.scaninfo.num_points / self.num_lines.get()
|
self.scaninfo.num_points / self.num_lines.get()
|
||||||
) + max(self.current_channel.get() - 1, 0)
|
) + max(self.current_channel.get() - 1, 0)
|
||||||
|
@ -359,6 +359,11 @@ class PilatusCsaxs(DetectorBase):
|
|||||||
"""unstage the detector and file writer"""
|
"""unstage the detector and file writer"""
|
||||||
# Reset to software trigger
|
# Reset to software trigger
|
||||||
logger.info("Waiting for Pilatus to return from acquisition")
|
logger.info("Waiting for Pilatus to return from acquisition")
|
||||||
|
old_scanID = self.scaninfo.scanID
|
||||||
|
self.scaninfo.load_scan_metadata()
|
||||||
|
logger.info(f"Old scanID: {old_scanID}, ")
|
||||||
|
if self.scaninfo.scanID != old_scanID:
|
||||||
|
self._stopped = True
|
||||||
if self._stopped:
|
if self._stopped:
|
||||||
return super().unstage()
|
return super().unstage()
|
||||||
self._pilatus_finished()
|
self._pilatus_finished()
|
||||||
|
@ -212,7 +212,7 @@ class EnergyKev(VirtualEpicsSignalRO):
|
|||||||
)
|
)
|
||||||
|
|
||||||
offs = np.interp(energy_keV, self._th2_offsets[:, 0], self._th2_offsets[:, 1])
|
offs = np.interp(energy_keV, self._th2_offsets[:, 0], self._th2_offsets[:, 1])
|
||||||
print(offs)
|
#print(offs)
|
||||||
return offs
|
return offs
|
||||||
|
|
||||||
def calc(self, val):
|
def calc(self, val):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user