Exemple #1
0
 def test_moving_from_grid2_to_grid1_in_fm_imaging_Area(self):
     f = cryoSwitchSamplePosition(LOADING)
     f.result()
     # move to the fm imaging area
     f = cryoSwitchSamplePosition(FM_IMAGING)
     f.result()
     current_imaging_mode = getCurrentPositionLabel(
         self.stage.position.value, self.stage)
     self.assertEqual(FM_IMAGING, current_imaging_mode)
     # move to the grid2
     f = cryoSwitchSamplePosition(GRID_2)
     f.result()
     current_grid = getCurrentGridLabel(self.stage.position.value,
                                        self.stage)
     self.assertEqual(GRID_2, current_grid)
     # move back to the grid1
     f = cryoSwitchSamplePosition(GRID_1)
     f.result()
     current_grid = getCurrentGridLabel(self.stage.position.value,
                                        self.stage)
     self.assertEqual(GRID_1, current_grid)
     # make sure we are still in fm imaging area
     current_imaging_mode = getCurrentPositionLabel(
         self.stage.position.value, self.stage)
     self.assertEqual(FM_IMAGING, current_imaging_mode)
Exemple #2
0
 def test_moving_to_sem_from_fm(self):
     f = cryoSwitchSamplePosition(LOADING)
     f.result()
     # move to the fm imaging area
     f = cryoSwitchSamplePosition(FM_IMAGING)
     f.result()
     current_imaging_mode = getCurrentPositionLabel(self.stage.position.value, self.stage)
     self.assertEqual(FM_IMAGING, current_imaging_mode)
     # move to sem
     f = cryoSwitchSamplePosition(SEM_IMAGING)
     f.result()
     current_imaging_mode = getCurrentPositionLabel(self.stage.position.value, self.stage)
     self.assertEqual(SEM_IMAGING, current_imaging_mode)
Exemple #3
0
 def test_unknown_label_at_initialization(self):
     arbitrary_position = {"x": 0.0, "y": 0.0, "z":-3.0e-3}
     self.stage.moveAbs(arbitrary_position).result()
     current_imaging_mode = getCurrentPositionLabel(self.stage.position.value, self.stage)
     self.assertEqual(UNKNOWN, current_imaging_mode)
     current_grid = getCurrentGridLabel(self.stage.position.value, self.stage)
     self.assertEqual(current_grid, None)
Exemple #4
0
def enable_tab_on_stage_position(button, stage, pos, target):
    """
    Enable the given tab button if the stage is in target position, disable it otherwise
    :param button: (Button) the Tab button to enable/disable
    :param stage: (Actuator) the stage driver
    :param pos: (dict str->float) current position to check its label
    :param target: (int) target position label (IMAGING, LOADING..etc)
    """
    button.Enable(getCurrentPositionLabel(pos, stage) == target)
Exemple #5
0
 def test_moving_from_grid1_to_grid2_in_sem_imaging_area(self):
     # move to loading position
     f = cryoSwitchSamplePosition(LOADING)
     f.result()
     # move the stage to the sem imaging area
     f = cryoSwitchSamplePosition(SEM_IMAGING)
     f.result()
     current_imaging_mode = getCurrentPositionLabel(self.stage.position.value, self.stage)
     self.assertEqual(SEM_IMAGING, current_imaging_mode)
     # now the selected grid is already the grid1
     current_grid = getCurrentGridLabel(self.stage.position.value, self.stage)
     self.assertEqual(GRID_1, current_grid)
     # move the stage to grid2 
     f = cryoSwitchSamplePosition(GRID_2)
     f.result()
     current_grid = getCurrentGridLabel(self.stage.position.value, self.stage)
     self.assertEqual(GRID_2, current_grid)
     # make sure we are still in sem  imaging area 
     current_imaging_mode = getCurrentPositionLabel(self.stage.position.value, self.stage)
     self.assertEqual(SEM_IMAGING, current_imaging_mode)
Exemple #6
0
 def test_moving_to_grid2_in_sem_imaging_area_after_loading(self):
     # move the stage to the loading position  
     f = cryoSwitchSamplePosition(LOADING)
     f.result()
     # move the stage to grid2
     f = cryoSwitchSamplePosition(GRID_2)
     f.result()
     position_label = getCurrentPositionLabel(self.stage.position.value, self.stage)
     grid_label = getCurrentGridLabel(self.stage.position.value, self.stage)
     self.assertEqual(position_label, SEM_IMAGING)
     self.assertEqual(grid_label, GRID_2)
Exemple #7
0
 def test_moving_to_grid1_in_fm_imaging_area_after_loading(self):
     # move the stage to the loading position  
     f = cryoSwitchSamplePosition(LOADING)
     f.result()
     # move the stage to the fm imaging area, and grid1 will be chosen by default
     f = cryoSwitchSamplePosition(FM_IMAGING)
     f.result()
     position_label = getCurrentPositionLabel(self.stage.position.value, self.stage)
     grid_label = getCurrentGridLabel(self.stage.position.value, self.stage)
     self.assertEqual(position_label, FM_IMAGING)
     self.assertEqual(grid_label, GRID_1)
Exemple #8
0
    def test_get_current_position(self):
        """
        Test getCurrentPositionLabel function behaves as expected
        """
        stage = self.stage
        # Move to loading position
        cryoSwitchSamplePosition(LOADING).result()
        pos_label = getCurrentPositionLabel(stage.position.value, stage)
        self.assertEqual(pos_label, LOADING)

        # Move to imaging position and cancel the movement before reaching there
        f = cryoSwitchSamplePosition(IMAGING)
        # abit long wait for the loading-imaging referencing to finish
        time.sleep(7)
        f.cancel()
        pos_label = getCurrentPositionLabel(stage.position.value, stage)
        self.assertEqual(pos_label, LOADING_PATH)

        # Move to imaging position
        cryoSwitchSamplePosition(LOADING).result()
        cryoSwitchSamplePosition(IMAGING).result()
        pos_label = getCurrentPositionLabel(stage.position.value, stage)
        self.assertEqual(pos_label, IMAGING)

        # Move to alignment
        f = cryoSwitchSamplePosition(ALIGNMENT)
        f.result()
        pos_label = getCurrentPositionLabel(stage.position.value, stage)
        self.assertEqual(pos_label, ALIGNMENT)

        # Move to SEM imaging
        f = cryoSwitchSamplePosition(SEM_IMAGING)
        f.result()
        pos_label = getCurrentPositionLabel(stage.position.value, stage)
        self.assertEqual(pos_label, SEM_IMAGING)

        # Move to coating position
        cryoSwitchSamplePosition(LOADING).result()
        f = cryoSwitchSamplePosition(COATING)
        f.result()
        pos_label = getCurrentPositionLabel(stage.position.value, stage)
        self.assertEqual(pos_label, COATING)

        # Return to loading and cancel before reaching
        f = cryoSwitchSamplePosition(LOADING)
        time.sleep(4)
        f.cancel()
        pos_label = getCurrentPositionLabel(stage.position.value, stage)
        self.assertEqual(pos_label, LOADING_PATH)
Exemple #9
0
    def test_get_current_position(self):
        """
        Test getCurrentPositionLabel function behaves as expected
        """
        stage = self.stage
        # Move to loading position
        f = cryoLoadSample(LOADING)
        f.result()
        pos_label = getCurrentPositionLabel(stage.position.value, stage)
        self.assertEqual(pos_label, LOADING)

        # Move to imaging position and cancel the movement before reaching there
        f = cryoLoadSample(IMAGING)
        time.sleep(2)
        f.cancel()
        pos_label = getCurrentPositionLabel(stage.position.value, stage)
        self.assertEqual(pos_label, LOADING_PATH)

        # Move to imaging position
        f = cryoLoadSample(LOADING)
        f.result()
        f = cryoLoadSample(IMAGING)
        f.result()
        pos_label = getCurrentPositionLabel(stage.position.value, stage)
        self.assertEqual(pos_label, IMAGING)

        # Move to tilting
        f = cryoTiltSample(rx=self.rx_angle, rz=self.rz_angle)
        f.result()
        pos_label = getCurrentPositionLabel(stage.position.value, stage)
        self.assertEqual(pos_label, TILTED)

        # Move to coating position
        f = cryoLoadSample(COATING)
        f.result()
        pos_label = getCurrentPositionLabel(stage.position.value, stage)
        self.assertEqual(pos_label, COATING)

        # Return to loading and cancel before reaching
        f = cryoLoadSample(LOADING)
        time.sleep(4)
        f.cancel()
        pos_label = getCurrentPositionLabel(stage.position.value, stage)
        self.assertEqual(pos_label, LOADING_PATH)