예제 #1
0
    def __init__(self, name, config={}):
        super().__init__(name, config)
        ## Connection to the XY stage controller (serial.Serial instance).
        self._proxy = Pyro4.Proxy(config.get('uri'))
        ## Lock around sending commands to the XY stage controller.
        self.xyLock = threading.Lock()
        ## Cached copy of the stage's position.
        self.positionCache = (None, None)
        ## Target positions for movement in X and Y.
        self.motionTargets = [None, None]
        ## Flag to show that sendPositionUpdates is running.
        self.sendingPositionUpdates = False
        ## Status dict updated by remote.
        self.status = {}
        ## Keys for status items that should be logged
        self.logger = valueLogger.ValueLogger(
            name, keys=list(map('t_'.__add__, self._temperature_names)))
        try:
            xlim = self._proxy.get_value_limits('MotorSetpointX')
            ylim = self._proxy.get_value_limits('MotorSetpointY')
        except:
            xlim, ylim = zip(*DEFAULT_LIMITS)
        # _proxy may return (0,0) if it can't query the hardware.
        if not any(xlim):
            xlim, _ = zip(*DEFAULT_LIMITS)
        if not any(ylim):
            _, ylim = zip(*DEFAULT_LIMITS)
        self.hardlimits = tuple(zip(xlim, ylim))
        self.softlimits = self.hardlimits

        events.subscribe(events.USER_ABORT, self.onAbort)
예제 #2
0
    def __init__(self, name, config={}):
        super(LinkamStage, self).__init__(name, config)
        ## Connection to the XY stage controller (serial.Serial instance).
        self._proxy = Pyro4.Proxy(config.get('uri'))
        ## Lock around sending commands to the XY stage controller.
        self.xyLock = threading.Lock()
        ## Cached copy of the stage's position.
        self.positionCache = (None, None)
        ## Target positions for movement in X and Y.
        self.motionTargets = [None, None]
        ## Time of last action using the stage.
        self.lastPiezoTime = time.time()
        ## Stage velocity
        self.stageVelocity = [None, None]
        ## Flag to show that sendPositionUpdates is running.
        self.sendingPositionUpdates = False
        ## Status dict updated by remote.
        self.status = {}
        ## Keys for status items that should be logged
        self.logger = valueLogger.ValueLogger(
            name, keys=list(map('t_'.__add__, self._temperature_names)))
        try:
            xlim = self._proxy.get_value_limits('MotorSetpointX')
            ylim = self._proxy.get_value_limits('MotorSetpointY')
        except:
            xlim, ylim = zip(*DEFAULT_LIMITS)
        # _proxy may return (0,0) if it can't query the hardware.
        if not any(xlim):
            xlim, _ = zip(*DEFAULT_LIMITS)
        if not any(ylim):
            _, ylim = zip(*DEFAULT_LIMITS)
        self.hardlimits = tuple(zip(xlim, ylim))
        self.softlimits = self.hardlimits
        if not self.getPrimitives():
            xoff = self.config.get('xoffset', 0)
            yoff = self.config.get('yoffset', 0)
            xmid = xoff + (xlim[0] + xlim[1]) / 2
            ymid = yoff + (ylim[0] + ylim[1]) / 2
            radius = 1500
            centres = [-4000, 0, 4000]
            self.primitives = [
                'c %f %f %f' % (xmid + dx, ymid, radius) for dx in centres
            ]

        events.subscribe('user abort', self.onAbort)
        #store and recall condensor LED status.
        events.subscribe('save exposure settings', self.onSaveSettings)
        events.subscribe('load exposure settings', self.onLoadSettings)
예제 #3
0
    def __init__(self, name, config={}):
        super().__init__(name, config)
        #get DIO control lines from config file
        linestring = config.get('lines', '')
        self.lines = linestring.split(',')
        #Get microscope paths from config file.
        paths_linesString = config.get('paths', '')
        self.excitation = []
        self.excitationMaps = []
        self.objective = []
        self.objectiveMaps = []
        self.emission = []
        self.emissionMaps = []

        for path in (paths_linesString.split(';')):
            parts = path.split(':')
            if (parts[0] == 'objective'):
                self.objective.append(parts[1])
                self.objectiveMaps.append(parts[2])
            elif (parts[0] == 'excitation'):
                self.excitation.append(parts[1])
                self.excitationMaps.append(parts[2])
            elif (parts[0] == 'emission'):
                self.emission.append(parts[1])
                self.emmisionMaps.append(parts[2])

        #IMD 20150208 this should go into config file but dont understand how t define an array there
        #this stuff just gets set as a raw string.
        self.PLOT_COLORS = ['r', 'g', 'b', 'c', 'm', 'y', 'k']
        ## Labels to use for lines in the plot.
        self.LEGENDS = ['X-nano', 'Y-nano', 'Z-nano', 'Stage', 'Block', 'Room']
        ## How we rearrange the incoming data so that it displays e.g. the nanomover
        # sensors in order.
        #DATA_REORDER = [1, 2, 4, 0, 5, 3]
        self.DATA_REORDER = [0, 1]

        self.makeOutputWindow = makeOutputWindow
        self.buttonName = 'ni6036e'

        ## Pyro4.Proxy for the "NI" portion of the program (mirror flips and
        # a few utility functions).
        self.niConnection = None
        ## cockpit.util.connection.Connection for the temperature sensors.
        self.temperatureConnection = None
        ## cockpit.util.connection.Connection for the light sensor.
        self.lightConnection = None

        ## Maps light modes to the mirror settings for those modes, as a list
        #IMD 20140806
        #map paths to flips.
        self.modeToFlips = collections.OrderedDict()
        for i in range(len(self.excitation)):
            self.modeToFlips[self.excitation[i]] = []
            for flips in self.excitationMaps[i].split('|'):
                flipsList = flips.split(',')
                flipsInt = [int(flipsList[0]), int(flipsList[1])]
                self.modeToFlips[self.excitation[i]].append(flipsInt)
        #map objectives to flips.
        self.objectiveToFlips = collections.OrderedDict()
        for i in range(len(self.objective)):
            print(self.objectiveMaps)
            self.objectiveToFlips[self.objective[i]] = []
            if (self.objectiveMaps[i]):
                for flips in self.objectiveMaps[i].split('|'):
                    flipsList = flips.split(',')
                    flipsInt = [int(flipsList[0]), int(flipsList[1])]
                    self.objectiveToFlips[self.objective[i]].append(flipsInt)

        self.lightPathButtons = []

        ## Current light path mode.
        self.curExMode = None
        self.curStageMode = None
        self.curDetMode = None

        self.logger = valueLogger.ValueLogger(name)