Skip to content

Commit

Permalink
Revert "Eliminate the old_move_axis arg to make_synchronized_scan_dat…
Browse files Browse the repository at this point in the history
…a_stream."

This reverts commit 286cd50.
  • Loading branch information
cmeyer committed Feb 29, 2024
1 parent 608ba1f commit 731598a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion nion/instrumentation/MultiAcquire.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,8 @@ def run(self, number_frames: int) -> None:
synchronized_scan_data_stream = scan_base.make_synchronized_scan_data_stream(
scan_hardware_source=self.__scan_hardware_source,
scan_frame_parameters=copy.copy(self.scan_frame_parameters),
camera_hardware_source=self.__camera_hardware_source, camera_frame_parameters=camera_frame_parameters)
camera_hardware_source=self.__camera_hardware_source, camera_frame_parameters=camera_frame_parameters,
old_move_axis=True)
synchronized_scan_data_stream = camera_base.ChannelDataStream(
synchronized_scan_data_stream,
self.camera_data_channel, Acquisition.Channel(self.__camera_hardware_source.hardware_source_id))
Expand Down
8 changes: 7 additions & 1 deletion nion/instrumentation/scan_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2489,7 +2489,8 @@ def make_synchronized_scan_data_stream(
enable_drift_tracker: bool = False,
drift_rotation: float = 0.0,
fov_nm_model: typing.Optional[Model.PropertyModel[float]] = None,
rotation_model: typing.Optional[Model.PropertyModel[float]] = None) -> Acquisition.DataStream:
rotation_model: typing.Optional[Model.PropertyModel[float]] = None,
old_move_axis: bool = False) -> Acquisition.DataStream:

# there are two separate drift corrector possibilities:
# 1 - a drift corrector that takes a separate scan, implemented using the scan_data_stream_functor
Expand Down Expand Up @@ -2548,6 +2549,11 @@ def make_synchronized_scan_data_stream(
collectors.append(Acquisition.CollectedDataStream(combined_data_stream, (stop - start, scan_size.width), get_scan_calibrations(scan_frame_parameters)))
# stack the sections together
collector: Acquisition.DataStream = Acquisition.StackedDataStream(collectors)
if not old_move_axis and camera_frame_parameters.processing == "sum_masked":
active_masks = camera_frame_parameters.active_masks
if active_masks and len(active_masks) > 1:
collector = Acquisition.FramedDataStream(collector, operator=Acquisition.MoveAxisDataStreamOperator(
processed_camera_data_stream.channels[0]))
# SynchronizedDataStream saves and restores the scan parameters; also enters/exits synchronized state
collector = SynchronizedDataStream(collector, scan_hardware_source, camera_hardware_source, section_count)
if scan_count > 1:
Expand Down
6 changes: 3 additions & 3 deletions nion/instrumentation/test/SynchronizedAcquisition_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def test_grab_synchronized_sum_masked_produces_data_of_correct_shape(self):
si_data_item = data_item
break
self.assertIsNotNone(si_data_item)
self.assertEqual((4, 5, 3), si_data_item.data_shape)
self.assertEqual((3, 4, 5), si_data_item.data_shape)

def test_grab_rotated_synchronized_eels(self):
# tests whether rotation was applied, as judged by the resulting metadata
Expand Down Expand Up @@ -1174,8 +1174,8 @@ def test_scan_acquisition_controller_sum_masked(self):
break
self.assertIsNotNone(si_data_item)
if len(masks) > 1:
self.assertEqual(2, si_data_item.collection_dimension_count)
self.assertEqual((4, 4, len(masks)), si_data_item.data_shape)
self.assertEqual(si_data_item.collection_dimension_count, 1)
self.assertEqual((len(masks), 4, 4), si_data_item.data_shape)
else:
self.assertEqual(si_data_item.collection_dimension_count, 0)
self.assertEqual((4, 4), si_data_item.data_shape)
Expand Down

0 comments on commit 731598a

Please sign in to comment.