Skip to content

Commit

Permalink
Ensure flyback pixels metadata gets recorded to match real hardware.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeyer committed Feb 22, 2024
1 parent eb24e6f commit 271deea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nionswift_plugin/usim/CameraSimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ def _get_frame_settings(self, readout_area: Geometry.IntRect, binning_shape: Geo
if self.instrument.probe_state == "scanning" and hasattr(scan_device, "current_probe_position"):
probe_position = scan_device.current_probe_position
elif self.instrument.probe_state == "parked" and parked_probe_position is not None:
probe_position = parked_probe_position
probe_position = parked_probe_position
return FrameSettings(readout_area, binning_shape, exposure_s, copy.deepcopy(scan_context), probe_position, self.instrument.sample.title)
3 changes: 3 additions & 0 deletions nionswift_plugin/usim/ScanDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def __init__(self, instrument: InstrumentDevice.Instrument):
self.__frame: typing.Optional[Frame] = None
self.__frame_number = 0
self.__is_scanning = False
self.__flyback_pixels = 2
self.on_device_state_changed = None
self.__frame_parameters = ScanFrameParameters()
self.flyback_pixels = 2
Expand Down Expand Up @@ -424,6 +425,7 @@ def read_partial(self, frame_number: typing.Optional[int], pixels_to_skip: int)
properties["center_y_nm"] = current_frame.frame_parameters.center_nm[0]
properties["rotation_deg"] = math.degrees(current_frame.frame_parameters.rotation_rad)
properties["channel_id"] = channel.channel_id
properties["flyback_pixels"] = self.__flyback_pixels
data_element["properties"] = properties
data_elements.append(data_element)

Expand Down Expand Up @@ -498,6 +500,7 @@ def __start_next_frame(self) -> None:
frame_parameters.fov_size_nm.width / size.width)
self.__scan_box.external_clock = self.__frame_parameters.external_clock_mode != 0
self.__is_scanning = True
self.__flyback_pixels = self.calculate_flyback_pixels(frame_parameters)

def cancel(self) -> None:
"""Cancel acquisition (immediate)."""
Expand Down

0 comments on commit 271deea

Please sign in to comment.