diff --git a/scope/client_util/calibrate.py b/scope/client_util/calibrate.py index afa6507..608b33a 100644 --- a/scope/client_util/calibrate.py +++ b/scope/client_util/calibrate.py @@ -31,8 +31,9 @@ def __init__(self, scope, min_exposure_ms=0.5, max_exposure_ms=1000, frames_to_a self.exposure_times = [] with contextlib.ExitStack() as stack: # set up all the scope states - stack.enter_context(scope.il.in_state(shutter_open=False)) - stack.enter_context(scope.tl.in_state(shutter_open=False)) + if hasattr(scope.il, 'shutter_open'): # Inverted scope doesn't have shutters. + stack.enter_context(scope.il.in_state(shutter_open=False)) + stack.enter_context(scope.tl.in_state(shutter_open=False)) stack.enter_context(scope.tl.lamp.in_state(enabled=False)) if hasattr(scope.il, 'spectra'): stack.enter_context(scope.il.spectra.in_state(**{lamp+'_enabled': False for lamp in scope.il.spectra.lamp_specs.keys()})) @@ -321,4 +322,4 @@ def _smooth_flat_field(image): image = image[::2, ::2] image = ndimage.median_filter(image, footprint=_m9) image = ndimage.zoom(image, 2) - return ndimage.gaussian_filter(image, 5) \ No newline at end of file + return ndimage.gaussian_filter(image, 5) diff --git a/scope/timecourse/timecourse_handler.py b/scope/timecourse/timecourse_handler.py index a34a931..d64adb3 100644 --- a/scope/timecourse/timecourse_handler.py +++ b/scope/timecourse/timecourse_handler.py @@ -153,17 +153,20 @@ def configure_timepoint(self): pass assert self.scope.nosepiece.magnification == objective - self.scope.il.shutter_open = True self.scope.il.spectra.lamps(**{lamp+'_enabled': False for lamp in self.scope.il.spectra.lamp_specs}) - self.scope.tl.shutter_open = True self.scope.tl.lamp.enabled = False - self.scope.tl.condenser_retracted = objective == 5 # only retract condenser for 5x objective - if self.TL_FIELD_DIAPHRAGM is not None: - self.scope.tl.field_diaphragm = self.TL_FIELD_DIAPHRAGM - if self.TL_APERTURE_DIAPHRAGM is not None: - self.scope.tl.aperture_diaphragm = self.TL_APERTURE_DIAPHRAGM - if self.IL_FIELD_WHEEL is not None: - self.scope.il.field_wheel = self.IL_FIELD_WHEEL + + if hasattr(self.scope.il, 'shutter_open'): # For non-inverted scope acquisitions + self.scope.il.shutter_open = True + self.scope.tl.shutter_open = True + self.scope.tl.condenser_retracted = objective == 5 # only retract condenser for 5x objective + if self.TL_FIELD_DIAPHRAGM is not None: + self.scope.tl.field_diaphragm = self.TL_FIELD_DIAPHRAGM + if self.TL_APERTURE_DIAPHRAGM is not None: + self.scope.tl.aperture_diaphragm = self.TL_APERTURE_DIAPHRAGM + if self.IL_FIELD_WHEEL is not None: + self.scope.il.field_wheel = self.IL_FIELD_WHEEL + self.scope.il.filter_cube = self.experiment_metadata['filter_cube'] self.scope.camera.sensor_gain = '16-bit (low noise & high well capacity)' self.scope.camera.readout_rate = self.PIXEL_READOUT_RATE