Пример #1
0
 def __init__(self,
              name,
              experiment,
              description='a DC Noise Eater channel'):
     super(Channel, self).__init__(name, experiment, description)
     self.kp = IntProp('kp', self.experiment, 'kp', '2560')
     self.ki = IntProp('ki', self.experiment, 'ki', '64')
     self.properties += [
         'allow_get', 'update', 'mode', 'warnSetting', 'limitRange',
         'invert', 'integrationTime', 'trigNum', 'measNum', 'kp', 'ki',
         'setpoint', 'average', 'error', 'vin', 'vout', 'warning'
     ]
Пример #2
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 = []
 def __init__(self, name, experiment, description=''):
     super(UnlockMonitor, self).__init__(name, experiment, description)
     self.IP = StrProp('IP', experiment, 'IP Address of Raspberry Pi',
                       '10.141.196.160')
     self.Port = IntProp('Port', experiment, 'Port', '50007')
     self.Threshold = FloatProp('Threshold', experiment,
                                'Threshold for locked/unlocked', '30')
     self.properties += ['version', 'IP', 'Port', 'Threshold']
Пример #4
0
 def __init__(self, name, experiment, description=''):
     super(Picomotor, self).__init__(name, experiment, description)
     self.desired_position = IntProp('desired_position', experiment,
                                     'the desired position', '0')
     self.properties += [
         'serial_number', 'motor_number', 'desired_position',
         'max_angle_error'
     ]
     self.current_position = self.desired_position.value
Пример #5
0
 def __init__(self, experiment):
     super(AnalogInput, self).__init__('AnalogInput', experiment)
     self.sample_rate = FloatProp('sample_rate', experiment, 'samples per second', '1000.0')
     self.source = StrProp('source', experiment, '', '"PXI1Slot6/ai0:15"')
     self.samples_per_measurement = IntProp('samples_per_measurement', experiment, '', '1')
     self.waitForStartTrigger = BoolProp('waitForStartTrigger', experiment, '', 'True')
     self.triggerSource = StrProp('triggerSource', experiment, '', '"/PXI1Slot6/PFI0"')
     self.triggerEdge = StrProp('triggerEdge', experiment, '"Rising" or "Falling"', '"Rising"')
     self.channels = Numpy1DProp('channels', experiment, 'a list of channel descriptions', dtype=[('description', object)], hdf_dtype=[('description', h5py.special_dtype(vlen=str))], zero=('new'))
     self.ground_mode = StrProp('ground_mode', experiment, 'RSE for ungrounded sensors, NRSE for grounded sensors', '"NRSE"')
     self.properties += ['version', 'sample_rate', 'source', 'samples_per_measurement', 'waitForStartTrigger',
                         'triggerSource', 'triggerEdge', 'channels', 'ground_mode']
     self.doNotSendToHardware += ['channels']
Пример #6
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'
     ]
Пример #7
0
 def __init__(self, name, experiment, description=''):
     super(PICamCamera, self).__init__(name, experiment, description)
     self.AdcEMGain = IntProp('AdcEMGain', experiment, 'EM gain', '0')
     #self.AdcAnalogGain = IntProp('AdcAnalogGain', experiment, 'Analog gain', '0')
     self.exposureTime = FloatProp('exposureTime', experiment,
                                   'exposure time for edge trigger (ms)',
                                   '0')
     self.shotsPerMeasurement = IntProp('shotsPerMeasurement', experiment,
                                        'number of expected shots', '0')
     self.currentCamera = StrProp('currentCamera', experiment,
                                  'Current Camera', '0')
     self.minPlot = IntProp('minPlot', experiment,
                            'Minimum Plot Scale Value', '0')
     self.maxPlot = IntProp('maxPlot', experiment,
                            'Maximum Plot Scale Value', '32768')
     self.properties += [
         'AdcEMGain', 'AdcAnalogGain', 'exposureTime', 'triggerMode',
         'shotsPerMeasurement', 'minPlot', 'maxPlot', 'currentCamera',
         'acquisitionMode', 'binMode', 'AdvancedEMGain', 'EMGainMode',
         'numPixX', 'numPixY', 'useDemo', 'ReadoutControl', 'shutterMode',
         'averageMeasurements', 'ROI', 'roilowv', 'roilowh', 'roihighv',
         'roihighh'
     ]
Пример #8
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']
Пример #9
0
 def __init__(self, name, experiment, description=''):
     super(InstekPST, self).__init__(name, experiment, description)
     self.com_port = StrProp('com_port', experiment, 'Communications port of PST','0')
     self.tracking = IntProp('tracking', experiment, 'Tracking Mode (0 Independent; 1 Parallel; 2 Series)','0')
     #self.num_chans = IntProp('num_chans', experiment, 'Number of channels','0')
     self.voltage_setpoint_1 = FloatProp('voltage_setpoint_1', experiment, 'Voltage Setpoint for Channel 1','0')
     self.current_setpoint_1 = FloatProp('current_setpoint_1', experiment, 'Current Setpoint for Channel 1','0')
     self.voltage_setpoint_2 = FloatProp('voltage_setpoint_2', experiment, 'Voltage Setpoint for Channel 2','0')
     self.current_setpoint_2 = FloatProp('current_setpoint_2', experiment, 'Current Setpoint for Channel 2','0')
     self.voltage_setpoint_3 = FloatProp('voltage_setpoint_3', experiment, 'Voltage Setpoint for Channel 3','0')
     self.current_setpoint_3 = FloatProp('current_setpoint_3', experiment, 'Current Setpoint for Channel 3','0')
     self.properties += ['com_port', 'serial_number', 'tracking',
                         'voltage_setpoint_1', 'current_setpoint_1', 'voltage_setpoint_2', 'current_setpoint_2',
                         'voltage_setpoint_3', 'current_setpoint_3', 'actual_voltage_1', 'actual_current_1',
                         'actual_voltage_2', 'actual_current_2', 'actual_voltage_3', 'actual_current_3',
                         ]
Пример #10
0
    def __init__(self, name, experiment, description=''):
        super(Embezzletron, self).__init__(name, experiment, description)
        self.enable = self.experiment.Config.config.getboolean(
            'DEV', 'EnableFakeData')
        self.shotsPerMeasurement = IntProp('shotsPerMeasurement', experiment,
                                           'number of expected shots', '2')
        self.shotsPerMeasurement.value = 2

        self.photoelectronScaling = FloatProp('photoelectronScaling',
                                              experiment,
                                              'photoelectron scaling', '1')
        self.exposureTime = FloatRangeProp('exposureTime',
                                           experiment,
                                           'exposure time (seconds)',
                                           low=0.000001,
                                           high=7200)
        self.exposureTime.value = 0.05
Пример #11
0
 def __init__(self, name, experiment, description=''):
     super(Vaunix, self).__init__(name, experiment, description)
     self.frequency = FloatProp('Frequency', experiment, 'Frequency (MHz)',
                                '0')
     self.power = FloatProp('Power', experiment, 'Power (dBm)', '0')
     self.pulsewidth = FloatProp('PulseWidth', experiment,
                                 'Pulse Width (us)', '0')
     self.pulserep = FloatProp('PulseRep', experiment,
                               'Pulse Rep Time (us)', '0')
     self.startfreq = FloatProp('StartFreq', experiment,
                                'Start Frequency (MHz)', '0')
     self.endfreq = FloatProp('EndFreq', experiment, 'End Frequency (MHz)',
                              '0')
     self.sweeptime = IntProp('SweepTime', experiment, 'Sweep Time (ms)',
                              '0')
     self.properties += [
         'ID', 'model', 'serial', 'frequency', 'power', 'pulsewidth',
         'pulserep', 'pulseenable', 'startfreq', 'endfreq', 'sweeptime',
         'sweepmode', 'sweeptype', 'sweepdir', 'sweepenable', 'internalref',
         'useexternalmod', 'rfonoff', 'maxPower'
     ]
Пример #12
0
 def __init__(self, name, experiment, description=''):
     super(NIScopeInstrument, self).__init__(name, experiment, description)
     self.DeviceName = StrProp('DeviceName', experiment, 'NI Device Name',
                               'Dev0')
     self.TrigLevel = FloatProp('TrigLevel', experiment,
                                'Trigger Level (V)', '0')
     self.TrigDelay = FloatProp('TrigDelay', experiment,
                                'Trigger Delay (s)', '0')
     self.HorizRecordLength = IntProp(
         'HorizRecordLength', experiment,
         'Number of points to take per trigger', '0')
     self.Chan0Offset = FloatProp('Chan0Offset', experiment,
                                  'CH0 Offset (V)', '0')
     self.Chan1Offset = FloatProp('Chan1Offset', experiment,
                                  'CH1 Offset (V)', '0')
     self.properties += [
         'DeviceName', 'TrigLevel', 'TrigDelay', 'HorizRecordLength',
         'Chan0Offset', 'Chan1Offset', 'Chan1Atten', 'Chan1Impedance',
         'Chan1Coupling', 'Chan1VertScale', 'Chan0Atten', 'Chan0Impedance',
         'Chan0Coupling', 'Chan0VertScale', 'HorizScale', 'TrigSource',
         'TrigMode', 'TrigSlope', 'FFTMeas'
     ]
Пример #13
0
 def __init__(self, name, experiment, description=''):
     super(NIDAQmxAI, self).__init__(name, experiment, description)
     self.DeviceName = StrProp('DeviceName', experiment, 'Device Name',
                               'Dev1')
     self.chanList = StrProp('chanList', experiment, 'Channel List',
                             '[\'ai0\']')
     self.samples_per_measurement = IntProp('samples_per_measurement',
                                            experiment,
                                            'Samples per Measurement', '1')
     self.sample_rate = FloatProp('sample_rate', experiment, 'Sample Rate',
                                  '1000')
     self.waitForStartTrigger = BoolProp('waitForStartTrigger', experiment,
                                         'Wait For Start Trigger', 'True')
     self.triggerSource = StrProp('triggerSource', experiment,
                                  'Trigger Source', 'Dev1/PFI0')
     self.triggerEdge = StrProp('triggerEdge', experiment,
                                'Trigger Edge (\"Rising\" or \"Falling\")',
                                'Rising')
     self.properties += [
         'enable', 'DeviceName', 'chanList', 'samples_per_measurement',
         'sample_rate', 'waitForStartTrigger', 'triggerSource',
         'triggerEdge', 'applyFormula', 'formula'
     ]
Пример #14
0
class Channel(Prop):

    allow_get = Bool(
        False
    )  # enables settings on noise eater to overwrite settings on computer

    # read/write variables
    update = Bool(False)  # bool
    mode = Int(0)  # int8
    warnSetting = Bool(False)  # bool
    limitRange = Int(0)  # int16
    invert = Bool(False)  # bool
    integrationTime = Int(100)  # int16
    trigNum = Int(0)  # int8
    measNum = Int(0)  # int8
    #kp = Int(2560)  # int16
    kp = Typed(IntProp)
    #ki = Int(64)  # int16
    ki = Typed(IntProp)
    setpoint = Int(9823)  # int16

    # variables from DC noise eater
    # read only
    average = Int(0)  # int16
    error = Int(0)  # int16
    vin = Int(0)  # int16
    vout = Int(0)  # int16
    warning = Bool(False)  # bool

    def __init__(self,
                 name,
                 experiment,
                 description='a DC Noise Eater channel'):
        super(Channel, self).__init__(name, experiment, description)
        self.kp = IntProp('kp', self.experiment, 'kp', '2560')
        self.ki = IntProp('ki', self.experiment, 'ki', '64')
        self.properties += [
            'allow_get', 'update', 'mode', 'warnSetting', 'limitRange',
            'invert', 'integrationTime', 'trigNum', 'measNum', 'kp', 'ki',
            'setpoint', 'average', 'error', 'vin', 'vout', 'warning'
        ]

    def read_status_from_hardware(self, data):
        # format the data returned by the noise eater
        # the code 'b?h?hbbhhhhhhh?' specifies b: signed int8, ?: binary stored as 8 bits, h: uint16
        # '<' is because the propeller chip is little-endian
        # status variables are written to immediately, but use intermediate variables for the settings
        mode, warnSetting, limitRange, invert, integrationTime, trigNum, measNum, kp, ki, setpoint, average, error, vin, vout, warning = struct.unpack(
            '<b?h?hbbhhhhhhh?', data)
        self.set_gui({
            'average': average,
            'error': error,
            'vin': vin,
            'vout': vout,
            'warning': warning
        })

    def settings_in_from_hardware(self, data):
        # format the data returned by the noise eater
        # the code 'b?h?hbbhhhhhhh?' specifies b: signed int8, ?: binary stored as 8 bits, h: uint16
        # '<' is because the propeller chip is little-endian
        # status variables are written to immediately, but use intermediate variables for the settings
        mode, warnSetting, limitRange, invert, integrationTime, trigNum, measNum, kp, ki, setpoint, average, error, vin, vout, warning = struct.unpack(
            '<b?h?hbbhhhhhhh?', data)
        self.set_gui({
            'average': average,
            'error': error,
            'vin': vin,
            'vout': vout,
            'warning': warning
        })
        if self.allow_get:
            self.set_gui({
                'mode': mode,
                'warnSetting': warnSetting,
                'limitRange': limitRange,
                'invert': invert,
                'integrationTime': integrationTime,
                'trigNum': trigNum,
                'measNum': measNum,
                'setpoint': setpoint
            })
            self.kp.set_gui({'function': str(kp)})
            self.ki.set_gui({'function': str(ki)})

    def settings_out_to_hardware(self):
        # return a 15 byte array that will be what is sent to the hardware for this channel
        # the code 'b?h?hbbhhh' specifies the 15 bytes as b: signed int8, ?: binary stored as 8 bits, h: uint16
        # '<' is because the propeller chip is little-endian
        data = struct.pack('<b?h?hbbhhh', self.mode, self.warnSetting,
                           self.limitRange, self.invert, self.integrationTime,
                           self.trigNum, self.measNum, self.kp.value,
                           self.ki.value, self.setpoint)
        return data

    def print_settings(self):
        # print all the settings for this channel

        print 'channel {} mode {} warnSetting {} limitRange {} invert {} integrationTime {} trigNum {} measNum {} kp {} ki {} setpoint {}'.format(
            self.mode, self.warnSetting, self.limitRange, self.invert,
            self.integrationTime, self.trigNum, self.measNum, self.kp.value,
            self.ki.value, self.setpoint)
        print 'average {} error {} vin {} vout {} warning {}'.format(
            self.average, self.error, self.vin, self.vout, self.warning)
        print '\n'