def __init__(self, name, experiment, description=''):
        super(Origin, self).__init__(name, experiment, description)
        #self.timeout = FloatProp('timeout', experiment, 'how long before TCP gives up [s]', '1.0')
        self.isInitialized = False
        self.streamNameSpace = ''

        self.measurementDataList = ListProp(
          'measurementDataList',
          experiment,
          'A list of per-measurement values that can be sent to the origin data server',
          listElementType=Stream,
          listElementName='stream'
        )
        self.iterationDataList = ListProp(
          'iterationDataList',
          experiment,
          'A list of per-iteration values that can be sent to the origin data server',
          listElementType=Stream,
          listElementName='stream'
        )

        self.properties += ['measurementDataList', 'iterationDataList', 'enable']
        self.properties += ['streamNameSpace']

        # threading stuff
        self.queueAfterMeasurement = True
        # dependencies are added pre experiment due to call order

        # set IP as a blank value in case the configuration doesn't work
        self.IP = ''
Пример #2
0
 def __init__(self, name, experiment, description=''):
     super(Vaunixs, self).__init__(name, experiment, description)
     self.motors = ListProp('motors',
                            experiment,
                            'A list of individual Vaunix signal generators',
                            listElementType=Vaunix,
                            listElementName='Vaunix')
     self.properties += ['version', 'motors']
     num = self.initialize()
     self.motors.length = num
     self.motors.refreshGUI()
Пример #3
0
 def __init__(self, name, experiment, description='DC Noise Eaters'):
     super(DCNoiseEaters, self).__init__(name, experiment, description)
     self.boxes = ListProp('boxes',
                           experiment,
                           listElementType=DCNoiseEater,
                           listElementName='box')
     self.properties += ['version', 'boxes', 'deviceList']
Пример #4
0
 def __init__(self, name, experiment):
     super(HSDIO, self).__init__(name, experiment)
     self.resourceName = StrProp('resourceName', experiment,
                                 'the hardware location of the HSDIO card',
                                 "'Dev1'")
     self.clockRate = FloatProp('clockRate', experiment,
                                'samples/channel/sec', '1000')
     self.units = FloatProp(
         'units', experiment,
         'multiplier for HSDIO timing values (milli=.001)', '1')
     self.hardwareAlignmentQuantum = IntProp('hardwareAlignmentQuantum',
                                             experiment,
                                             '(PXI=1,SquareCell=2)', '1')
     self.channels = NumpyChannels(experiment, self)
     self.triggers = ListProp('triggers',
                              self.experiment,
                              listElementType=ScriptTrigger,
                              listElementName='trigger')
     self.startTrigger = StartTrigger(experiment)
     self.properties += [
         'version', 'resourceName', 'clockRate', 'units',
         'hardwareAlignmentQuantum', 'triggers', 'channels', 'startTrigger',
         'numChannels'
     ]
     # script and waveforms are handled specially in HSDIO.toHardware()
     self.doNotSendToHardware += ['units', 'numChannels']
     self.transition_list = []  # an empty list to store
     self.repeat_list = []
Пример #5
0
 def __init__(self, name, experiment, description=''):
     super(Counters, self).__init__(name, experiment, description)
     # start with a blank list of counters
     self.counters = ListProp('counters',
                              experiment,
                              listElementType=Counter,
                              listElementName='counter')
     self.properties += ['version', 'counters']
Пример #6
0
 def __init__(self, name, experiment, description=''):
     super(Picomotors, self).__init__(name, experiment, description)
     self.motors = ListProp('motors',
                            experiment,
                            'A list of individual picomotors',
                            listElementType=Picomotor,
                            listElementName='motor')
     self.properties += ['version', 'IP', 'port', 'motors']
Пример #7
0
 def __init__(self, name, experiment, description=''):
     super(Noise_Eaters, self).__init__(name, experiment, description)
     self.pis = ListProp('pis',
                         experiment,
                         'A list of individual Raspberry Pis',
                         listElementType=Noise_Eater,
                         listElementName='pi')
     self.properties += ['version', 'pis']
Пример #8
0
 def __init__(self, name, experiment, description=''):
     super(Noise_Eaters, self).__init__(name, experiment, description)
     self.NEchannels = ListProp('NEchannels',
                                experiment,
                                'A list of Noise Eater channels',
                                listElementType=Noise_Eater,
                                listElementName='NEchannel')
     self.properties += ['version', 'NEchannels']
Пример #9
0
 def __init__(self, name, experiment, description=''):
     super(BILTcards, self).__init__(name, experiment, description)
     self.channels = ListProp('channels',
                              experiment,
                              'A list of voltage channels',
                              listElementType=BILTcard,
                              listElementName='channel')
     self.properties += ['version', 'IP', 'port', 'channels']
Пример #10
0
 def __init__(self, name, experiment, description=''):
     super(UnlockMonitors, self).__init__(name, experiment, description)
     self.motors = ListProp(
         'motors',
         experiment,
         'A list of individual Raspberry Pi unlock monitors',
         listElementType=Andor,
         listElementName='motor')
     self.properties += ['version', 'motors']
Пример #11
0
 def __init__(self, name, experiment, description=''):
     super(NIScopes, self).__init__(name, experiment, description)
     self.motors = ListProp('motors',
                            experiment,
                            'A list of individual NIScopes',
                            listElementType=NIScope,
                            listElementName='motor')
     self.properties += ['version', 'motors']
     self.initialize(True)
Пример #12
0
 def __init__(self, name, experiment, description=''):
     super(Aerotechs, self).__init__(name, experiment, description)
     self.motors = ListProp('motors',
                            experiment,
                            'A list of individual Aerotech stages',
                            listElementType=Aerotech,
                            listElementName='motor')
     self.OneAerotech = Aerotech('OneAerotech', experiment,
                                 'One Aerotech Ensemble')
     self.properties += ['version', 'IP', 'port', 'motors', 'OneAerotech']
Пример #13
0
 def __init__(self, name, experiment, description=''):
     super(PICams, self).__init__(name, experiment, description)
     self.motors = ListProp(
         'motors',
         experiment,
         'A list of individual Princeton Instruments cameras',
         listElementType=PICam,
         listElementName='motor')
     self.properties += ['version', 'motors']
     self.initialize(True)
Пример #14
0
 def __init__(self, experiment):
     super(Piezo, self).__init__('piezo', experiment)
     self.controllers = ListProp('controllers',
                                 self.experiment,
                                 listProperty=[
                                     PiezoController(
                                         'controller' + str(i),
                                         self.experiment) for i in range(2)
                                 ],
                                 listElementType=PiezoController,
                                 listElementName='controller')
     self.properties += ['version', 'controllers']
Пример #15
0
 def __init__(self, name, experiment, description=''):
     super(PyPicoServer, self).__init__(name, experiment, description)
     self.motors = ListProp(
         'motors',
         experiment,
         'A list of individual picomotors',
         listElementType=PyPicomotor,
         listElementName='motor'
     )
     self.properties += [
         'version', 'IP', 'port', 'motors', 'enable_measurement',
         'enable_iteration', 'enable_movement', 'timeout'
     ]
Пример #16
0
 def __init__(self, name, experiment, description=''):
     super(Aerotech, self).__init__(name, experiment, description)
     '''self.Xi = FloatProp('Xi', experiment, 'Initial X position (mm)','0')
     self.Xend = FloatProp('Xend', experiment, 'Final X position (mm)','0')
     self.Xvmx = FloatProp('Xvmx', experiment, 'Max X velocity (mm/s)','0')
     self.Xamx = FloatProp('Xend', experiment, 'Max X acceleration (mm/s^2)','0')
     self.Zi = FloatProp('Zi', experiment, 'Initial Z position (mm)','0')
     self.Zend = FloatProp('Zend', experiment, 'Final Z position (mm)','0')
     self.Zvmx = FloatProp('Zvmx', experiment, 'Max Z velocity (mm/s)','0')
     self.Zamx = FloatProp('Zend', experiment, 'Max Z acceleration (mm/s^2)','0')
     self.XretTrig = IntProp('XretTrig', experiment, 'X Trig Return?','0')'''
     self.globals = ListProp('globals',
                             experiment,
                             listElementType=FloatProp,
                             listElementName='global')
     self.properties += ['globals']
Пример #17
0
 def __init__(self, name, experiment, description='DC Noise Eater'):
     super(DCNoiseEater, self).__init__(name, experiment, description)
     # create a channel object for each noise eater channel
     # we won't dynamic add or remove channels, always 3 per box
     # if we did dynamically add, they would need to get the channel number passed to their __init__
     self.channels = ListProp('channels',
                              experiment,
                              listProperty=[
                                  Channel('channel' + str(i),
                                          self.experiment)
                                  for i in xrange(3)
                              ],
                              listElementType=Channel,
                              listElementName='channel',
                              listElementKwargs=None)
     #self.channels = [Channel(i) for i in xrange(3)]  # TODO: make this a ListProp
     self.properties += ['version', 'comport', 'channels']
Пример #18
0
 def __init__(self, name, experiment, description=''):
     super(PiezoController, self).__init__(name, experiment, description)
     self.enable = False
     self.serialNumber = ''
     self.identificationRead = ''
     self.serialNumberRead = ''
     self.channels = ListProp('channels',
                              self.experiment,
                              listProperty=[
                                  PiezoChannel('channel' + str(i),
                                               self.experiment)
                                  for i in range(9)
                              ],
                              listElementType=PiezoChannel,
                              listElementName='channel')
     self.properties = [
         'version', 'enable', 'serialNumber', 'identificationRead',
         'serialNumberRead', 'channels'
     ]
Пример #19
0
 def __init__(self, name, experiment, description='', DDS=None):
     self.DDS = DDS
     self.enable = False
     self.DIOport = 0
     self.serialClockRate = 1000
     super(DDSbox, self).__init__(name, experiment, description)
     # each box has exactly 4 channels
     self.channels = ListProp('channels',
                              experiment,
                              listProperty=[
                                  DDSchannel('channel', self.experiment)
                                  for i in range(4)
                              ],
                              listElementType=DDSchannel,
                              listElementName='channel')
     self.properties += [
         'enable', 'deviceReference', 'DIOport', 'serialClockRate',
         'channels'
     ]
Пример #20
0
    def __init__(self, name, experiment, description=''):
        super(DDS, self).__init__(name, experiment, description)
        self.boxes = ListProp('boxes',
                              experiment,
                              listElementType=DDSbox,
                              listElementName='box',
                              listElementKwargs={'DDS': self})
        self.deviceList = []
        self.boxDescriptionList = []
        self.properties += [
            'version', 'boxes', 'deviceList', 'boxDescriptionList'
        ]
        self.doNotSendToHardware += ['deviceList', 'boxDescriptionList']

        # setup the experiment thread
        self.restart = threading.Event()
        self.dds_thread = threading.Thread(target=self.dds_loop,
                                           name='dds_thread')
        self.dds_thread.daemon = True
        self.dds_thread.start()
        self.task = 'none'
Пример #21
0
 def __init__(self, name, experiment, description='', channel=None):
     self.channel = channel
     super(DDSprofile, self).__init__(name, experiment, description)
     self.frequency = FloatProp('frequency', self.experiment, '[MHz]', '0')
     self.amplitude = FloatProp('amplitude', self.experiment, '[dBm]', '0')
     self.phase = FloatProp('phase', self.experiment, '[rad]', '0')
     self.RAMMode = IntProp(
         'RAMMode', self.experiment,
         '0:Direct Switch, 1:Ramp Up, 2:Bidirectional Ramp, 3:Continuous Bidirectional Ramp, 4: Continuous Recirculate, 5: Direct Switch 2, 6: Direct Switch 3',
         '1')
     self.ZeroCrossing = BoolProp('ZeroCrossing', self.experiment, '',
                                  'False')
     self.NoDwellHigh = BoolProp('NoDwellHigh', self.experiment, '',
                                 'False')
     self.FunctionOrStatic = BoolProp('FunctionOrStatic', self.experiment,
                                      'True=function, False=static',
                                      'False')
     self.RAMFunction = StrProp('RAMFunction', self.experiment, '', '""')
     self.RAMInitialValue = FloatProp('RAMInitialValue', self.experiment,
                                      '', '0')
     self.RAMStepValue = FloatProp('RAMStepValue', self.experiment, '', '0')
     self.RAMTimeStep = FloatProp('RAMTimeStep', self.experiment, '[us]',
                                  '0')
     self.RAMNumSteps = IntProp('RAMNumSteps', self.experiment, '', '0')
     self.RAMStaticArray = ListProp('RAMStaticArray',
                                    self.experiment,
                                    listElementType=RAMStaticPoint,
                                    listElementName='point')
     self.properties += [
         'frequency', 'amplitude', 'phase', 'RAMMode', 'ZeroCrossing',
         'NoDwellHigh', 'FunctionOrStatic', 'RAMFunction',
         'RAMInitialValue', 'RAMStepValue', 'RAMTimeStep', 'RAMNumSteps',
         'RAMStaticArray'
     ]
     self.doNotSendToHardware += [
         'RAMFunction', 'RAMInitialValue', 'RAMStepValue', 'RAMNumSteps',
         'RAMStaticArray'
     ]
Пример #22
0
 def __init__(self, name, experiment, description=''):
     super(DDSchannel, self).__init__(name, experiment, description)
     self.power = BoolProp('power', self.experiment,
                           'enable RF output from this channel', 'False')
     self.refClockRate = IntProp('refClockRate', self.experiment, '[MHz]',
                                 '1000')
     self.fullScaleOutputPower = FloatProp('fullScaleOutputPower',
                                           self.experiment, '[dBm]', '0')
     self.RAMenable = BoolProp('RAMenable', self.experiment, 'RAM enable',
                               'False')
     self.RAMDestType = IntProp('RAMDestType', self.experiment,
                                '0:Frequency,1:Phase,2:Amplitude,3:Polar',
                                '0')
     self.RAMDefaultFrequency = FloatProp('RAMDefaultFrequency',
                                          self.experiment, '[MHz]', '0')
     self.RAMDefaultAmplitude = FloatProp('RAMDefaultAmplitude',
                                          self.experiment, '[dBm]', '0')
     self.RAMDefaultPhase = FloatProp('RAMDefaultPhase', self.experiment,
                                      '[rad]', '0')
     '''each channel has exactly 8 profiles'''
     self.profileDescriptionList = []
     self.profiles = ListProp('profiles',
                              self.experiment,
                              listProperty=[
                                  DDSprofile('profile',
                                             self.experiment,
                                             channel=self) for i in range(8)
                              ],
                              listElementType=DDSprofile,
                              listElementName='profile',
                              listElementKwargs={'channel': self})
     self.properties += [
         'power', 'refClockRate', 'fullScaleOutputPower', 'RAMenable',
         'RAMDestType', 'RAMDefaultFrequency', 'RAMDefaultAmplitude',
         'RAMDefaultPhase', 'profiles', 'profileDescriptionList'
     ]
     self.doNotSendToHardware += ['profileDescriptionList']
Пример #23
0
 def __init__(self, name, experiment, description=''):
     super(Conexes, self).__init__(name, experiment, description)
     self.motors = ListProp('motors', experiment, 'A list of individual CONEX-CC stages', listElementType=Conex,
                            listElementName='motor')
     self.properties += ['version', 'motors']
Пример #24
0
    def __init__(self, name, experiment, description=''):
        super(Rearrange, self).__init__(name, experiment, description='')
        self.properties += [
            'version', 'IP', 'port', 'enable', 'sub_array_left',
            'sub_array_top', 'sub_array_width', 'sub_array_height'
        ]

        self.frequency_increment = FloatProp('frequency_increment', experiment,
                                             'the target power 1 percentage',
                                             '100')
        self.jump_time = FloatProp('jump_time', experiment,
                                   'the target power 1 percentage', '100')
        self.laser_ramp_on_time = FloatProp('laser_ramp_on_time', experiment,
                                            'the target power 1 percentage',
                                            '100')
        self.fit_freq_sites = ListProp(
            'fit_freq_sites',
            experiment,
            'A of sites fequency offsets which can take variable inputs',
            listElementType=Fit_Sites,
            listElementName='fit_site_freq')
        self.force_freq_sites = ListProp(
            'force_freq_sites',
            experiment,
            'A of sites fequency offsets which can take variable inputs',
            listElementType=Force_Sites,
            listElementName='force_site_freq')
        self.site_pattern = ListProp(
            'site_pattern',
            experiment,
            'A of sites fequency offsets which can take variable inputs',
            listElementType=Pattern_Sites,
            listElementName='site_occupation')

        #self.site_pattern = List('site_pattern', experiment, 'occupation', listElementType=Site_Offset,listElementName='occupation signature')
        self.properties += [
            'jump_time', 'frequency_increment', 'laser_ramp_on_time', 'enable',
            'version', 'fit_freq_sites', 'force_freq_sites', 'site_pattern'
        ]

        # where we are going to dump data after analysis
        self.iter_analysis_base_path = 'analysis'

        # open settings file
        settings = h5py.File('settings.hdf5', 'r')

        # get rows and columns
        self.rows = settings['settings/experiment/ROI_rows'].value
        self.columns = settings['settings/experiment/ROI_columns'].value

        # get gaussian roi parameters and append image rows and columns to front of list
        bottom = eval(settings[
            'settings/experiment/LabView/camera/frameGrabberAcquisitionRegionBottom/function']
                      .value)
        top = eval(settings[
            'settings/experiment/LabView/camera/frameGrabberAcquisitionRegionTop/function']
                   .value)
        image_rows = bottom - top
        right = eval(settings[
            'settings/experiment/LabView/camera/frameGrabberAcquisitionRegionRight/function']
                     .value)
        left = eval(settings[
            'settings/experiment/LabView/camera/frameGrabberAcquisitionRegionLeft/function']
                    .value)
        image_columns = right - left

        self.gaussian_roi_params = settings[
            'settings/experiment/gaussian_roi/fitParams'].value
        self.gaussian_roi_params = [(image_rows, image_columns)] + list(
            self.gaussian_roi_params)

        # get cutoffs to send to rearranger
        barecutoff = settings[
            'settings/experiment/thresholdROIAnalysis/threshold_array'].value[
                0]
        self.s0_thresholds = numpy.zeros(self.rows * self.columns)
        if len(barecutoff) != len(self.s0_thresholds):
            logger.warning(
                'ROI number change detected, thresholds for rearrangement are invalid.'
            )
            barecutoff = numpy.resize(barecutoff, len(self.s0_thresholds))
        for i in range(self.rows * self.columns):
            self.s0_thresholds[i] = barecutoff[i][0]
        self.s0_thresholds[i] = self.s0_thresholds[i]

        #close hdf5 file
        settings.close()
Пример #25
0
 def __init__(self, name, experiment, description=''):
     super(InstekPSTs, self).__init__(name, experiment, description)
     self.motors = ListProp('motors', experiment, 'A list of individual PST power supplies', listElementType=InstekPST,
                            listElementName='PST')
     self.properties += ['version', 'motors']
Пример #26
0
class Vaunixs(Instrument):
    version = '2015.11.19'
    motors = Member()
    isInitialized = Bool(False)
    va = Member()

    testMode = Bool(False)  #Test mode: Set to False for actual use.

    def __init__(self, name, experiment, description=''):
        super(Vaunixs, self).__init__(name, experiment, description)
        self.motors = ListProp('motors',
                               experiment,
                               'A list of individual Vaunix signal generators',
                               listElementType=Vaunix,
                               listElementName='Vaunix')
        self.properties += ['version', 'motors']
        num = self.initialize()
        self.motors.length = num
        self.motors.refreshGUI()

    #Initialize: loads and initializes DLL
    def initialize(self):
        num = 0
        if self.enable:
            CDLL_file = "./vaunix/VNX_fmsynth.dll"
            self.va = CDLL(CDLL_file)
            if (self.testMode):
                logger.warning(
                    "Warning: Vaunix in test mode. Set testMode=False in vaunix.py to turn off test mode."
                )
            self.va.fnLMS_SetTestMode(
                self.testMode
            )  #Test mode... this needs to be set False for actual run. Do not remove this command (default setting is True).
            self.isInitialized = True
            num = self.detect_generators()
        return num

    def preExperiment(self, hdf5):
        if self.enable:
            if (not self.isInitialized):
                self.initialize()
            for i in self.motors:
                #initialize serial connection to each power supply
                i.initialize(self.va)

            self.isInitialized = True

    def preIteration(self, iterationresults, hdf5):
        """
        Every iteration, send the motors updated positions.
        """
        if self.enable:
            msg = ''
            try:
                for i in self.motors:
                    i.update()
            except Exception as e:
                logger.error('Problem updating Vaunix:\n{}\n{}\n'.format(
                    msg, e))
                self.isInitialized = False
                raise PauseError

    def postMeasurement(self, measurementresults, iterationresults, hdf5):
        return

    def postIteration(self, iterationresults, hdf5):
        return

    def postExperiment(self, hdf5):
        return

    def finalize(self, hdf5):
        return

#detect_generators: Calls DLL function to check for number of generators and their IDs.

    def detect_generators(self):
        if (not self.isInitialized
            ):  #test if DLL is already loaded. If not, load it.
            self.initialize()
        num = self.va.fnLMS_GetNumDevices(
        )  #ask DLL for the number of connected devices
        logger.debug("Number of vaunix devices detected: {}".format(num))
        while (num > len(self.motors)
               ):  #if num connected devices > number in array, add elements.
            self.motors.add()
        while (num < len(self.motors)):  #if <, subtract elements.
            self.motors.pop(self.motors.length - 1)
            self.motors.length -= 1
        devinfotype = c_uint * num
        devinfo = devinfotype()
        self.va.fnLMS_GetDevInfo(addressof(devinfo))  #get device IDs
        for mn, i in enumerate(self.motors):
            i.ID = int(devinfo[mn])  #copy device IDs to ID variable
            modnumtype = c_char * 100
            modnum = modnumtype()
            self.va.fnLMS_GetModelNameA(
                i.ID, addressof(modnum))  #get device model names
            i.model = modnum.value
            serial = c_int()
            serial = self.va.fnLMS_GetSerialNumber(
                i.ID)  #get device serial numbers
            i.serial = serial
        return num