Beispiel #1
0
    def __init__(self,
                 scope,
                 piezo,
                 p=1.,
                 i=0.1,
                 d=0.05,
                 sample_time=0.01,
                 mode='frame'):
        """

        Parameters
        ----------
        scope: PYME.Acquire.Hardware.microscope.microscope
        piezo: PYME.Acquire.Hardware.Piezos.offsetPiezoREST.OffsetPiezoClient
        p: float
        i: float
        d: float
        sample_time: float
            See simple_pid.PID, but this servo does not have a tolerance on the lock position, but rather a dead-time
            of-sorts by only updating at ~regular time intervals. The correction is only changed once per sample_time.
        mode: str
            flag, where 'frame' queries on each frame and 'time' queries at fixed times by polling at sample_time
        """
        self.scope = scope
        self.piezo = piezo
        # self._last_offset = self.piezo.GetOffset()

        self._fitter = GaussFitter1D()
        self.fit_roi_size = 75

        self.peak_position = 512  # default to half of the camera size
        self.subtraction_profile = None

        PID.__init__(self,
                     p,
                     i,
                     d,
                     setpoint=self.peak_position,
                     auto_mode=False,
                     sample_time=sample_time)

        self._mode = mode
        self._polling = False
 def __init__(self, name, type, sensor, actor):
     self.type = "tempController"
     self.name = name
     self.auto = True
     self.state = ""
     self.sensor = sensor
     self.sensorValue = -273
     self.actor = "hlt_heater"
     self.actorValue = 0
     self.contollerSate = "on"
     self.previousControllerSate = self.contollerSate
     self.consoleMsg = msg(self.name, "controller", "controllerState")
     self.actorMsg = msg("controller", self.actor, "command")
     PID.__init__(self,
                  Kp=112.344665712,
                  Ki=0.840663751375,
                  Kd=12.5112685197)
     self.setpoint = 66
     self.output_limits = (0, 100)
     listner.__init__(self)
Beispiel #3
0
    def __init__(self,
                 scope,
                 piezo,
                 p=1.,
                 i=0.1,
                 d=0.05,
                 sample_time=0.01,
                 mode='frame',
                 fit_roi_size=75,
                 min_amp=0,
                 max_sigma=np.finfo(float).max,
                 min_lateral_sigma=0,
                 trigger_failsafe=True):
        """

        Parameters
        ----------
        scope: PYME.Acquire.Hardware.microscope.microscope
        piezo: PYME.Acquire.Hardware.Piezos.offsetPiezoREST.OffsetPiezoClient
        p: float
        i: float
        d: float
        sample_time: float
            See simple_pid.PID, but this servo does not have a tolerance on the lock position, but rather a dead-time
            of-sorts by only updating at ~regular time intervals. The correction is only changed once per sample_time.
        mode: str
            flag, where 'frame' queries on each frame and 'time' queries at fixed times by polling at sample_time
        fit_roi_size : int
            size of profile to crop about the peak for actual fitting, allowing
            us to fit partial profiles and save some time
        min_amp : float
            minimum fit result amplitude which we are willing to accept as a
            valid peak measurement we can use to correct the focus.
        max_sigma : float
            maximum fit result sigma which we are willing to accept as a valid
            peak measurement we can use to correct the focus.
        min_lateral_sigma : float
            minimum standard dev along the dimension we sum (squash) to get the
            profile. If the lateral sigma is below this we reject the frame for
            fitting because we expect a long spread profile.
        trigger_failsafe : bool
            if True, try to kill lasers if the profile intensity saturates a
            majority of the pixels on the focus lock camera
        
        """
        self.scope = scope
        self.piezo = piezo
        self._piezo_control_lock = threading.Lock()
        self._piezo_home = 0.5 * (self.piezo.GetMax() - self.piezo.GetMin())

        self._lock_ok = False
        self._ok_tolerance = 5

        self.fit_roi_size = fit_roi_size
        self._fitter = GaussFitter1D(min_amp=min_amp, max_sigma=max_sigma)
        self._min_lateral_sigma = min_lateral_sigma

        self.peak_position = self.scope.frameWrangler.currentFrame.shape[
            1] * 0.5  # default to half of the camera size
        self.subtraction_profile = None

        self.use_failsafe = trigger_failsafe and hasattr(scope, 'failsafe')

        PID.__init__(self,
                     p,
                     i,
                     d,
                     setpoint=self.peak_position,
                     auto_mode=False,
                     sample_time=sample_time)

        self._mode = mode
        self._polling = False