class Test(TestScript):
    def __init__(self):
        TestScript.__init__(self)
        self.Name = 'Temperature control'
        self.Description = """Sets the thermostat temperature 
        and waits for stabilization"""
        return
    def init_parameters(self):
        """
        create the list of the parameter and initialize some basic values
        """
        
        self.generate_parameter(Name='NEW temperature',
                                Unit='Celsius', 
                                Type='float', 
                                Iterable = False, 
                                Limits = [ 120, -40.0, None], 
                                Description='Temperature to be reached by HAAKE thermostat inside the sample chamber')
        self.set_parameter_value('NEW temperature', 0.05)
        
        self.generate_parameter(Name='Acquisition delay',
                                Unit='Seconds', 
                                Type='float', 
                                Iterable = False, 
                                Limits = [ None, None, [1, 2, 5, 10, 20, 40]], 
                                Description='delay of the subsequent temperature readings in seconds')
        self.set_parameter_value('Acquisition delay', 2)
        
        self.generate_parameter(Name='Stabilization period',
                                Unit='Minutes', 
                                Type='float', 
                                Iterable = False, 
                                Limits = [ None, 1.0, None], 
                                Description='How long the reached stable temperature should be kept')
        self.set_parameter_value('Stabilization period', 5.0)
        
        self.generate_parameter(Name='Stabilization tolerance',
                                Unit='Celsius', 
                                Type='float', 
                                Iterable = False, 
                                Limits = [ None, 0.01, None], 
                                Description='How how much the temperature can vary in the "stabilized" condition')
        self.set_parameter_value('Stabilization tolerance', 0.05)
        
        return
    def init_devices(self):
        from Devices import Clock, Thermostat
                            
        
        
        
        self.Thermostat = Thermostat()
        self.append_active_devices_list(self.Thermostat)
        self.Stopwatch = Clock()
        self.append_active_devices_list(self.Stopwatch)
        
    def _run(self):
        """ simple current-voltage characteristics measurement """
        ################################################################
        ##  Here begins the experimetal part ###########################
        ################################################################
        
        Setpoint =  self.get_parameter_value('NEW temperature')
        WaitDAQ = self.get_parameter_value('Acquisition delay')
        WaitSetpoint = self.get_parameter_value('Stabilization period')
        Tolerance = self.get_parameter_value('Stabilization tolerance')
        WaitSetpointSeconds = WaitSetpoint * 60.0
        
        self.datastore.report('Setting the thermostat HAAKE to NEW temperature setpoint: %(Setpoint)+0.2f degrees Celsius'  % \
            {'Setpoint':Setpoint})
        
        self.Thermostat.set_regulation_external()
        self.Thermostat.set_regulation_on()
        
        self.Thermostat.set_setpoint(Setpoint)
        self.Thermostat.Measure()
        self.Stopwatch.Measure()
        self.datastore.acquireData()
        # get the timer key:
        keyTimer = self.Stopwatch.Readings.keys()[0]
        keyTemperature = 'HAAKEtempEXT(degC)'
        # main data acquisistion loop
        while True:
            # periodically check the actual tempearure and evaluate the deviation
            self.Stopwatch.Wait(WaitDAQ)
            self.Thermostat.Measure()
            self.Stopwatch.Measure()
            self.datastore.acquireData()
            # get the timestaps of the temperature readings: 
            timestamps = self.datastore.datagram.extract_data(key=keyTimer)
            historicalTimestamp = timestamps[-1] -   WaitSetpointSeconds
            # if the measurement history is long enough, find an index 
            if historicalTimestamp > 0:
                # if the measurement history is long enough, find an index of recent reading
                historicalIndex = numpy.searchsorted(timestamps,historicalTimestamp)
                historicalTemperatures = self.datastore.datagram.extract_data(key=keyTemperature,from_to=([historicalIndex,None]))
                #filter for reading errors
                historicalTemperatures = numpy.delete(historicalTemperatures, numpy.argwhere(historicalTemperatures==-1e999))
                # calcualte the root mean square of the deviation of the recent temperature readings :
                TempSTD = numpy.std(historicalTemperatures)
                #self.datastore.report('%d, %f, %f' % historicalIndex, historicalTimestamp, TempSTD)
                print 'standard deviation of measured temperature:', TempSTD
                if len(historicalTemperatures) > 2:
                    if TempSTD < Tolerance:
                        break
        
        return
Exemple #2
0
class Test(TestScript):
    def __init__(self):
        TestScript.__init__(self)
        self.Name = 'RRT protocol output chars of FET'
        self.Description = """Filed-effect transistor 'output' and 'transfer' characteristic
        Intended for fast scans utilizing the Keithley dual source meter (K 2602) unit
        with built in TSP programming \nSpecialized for the FlexNet RRT"""
        return

    def init_parameters(self):
        """
        create the list of the parameter and initialize some basic values
        """
        #voltages, acquizDelay=0.1, voltStepDelay=5

        self.generate_parameter(
            Name='Source-Drain (ChA) voltages',
            Unit='Volts',
            Type='float',
            Iterable=True,
            Limits=[40, -40, None],
            Description=
            'List of voltages (in Volts) to be applied to the sample given order, usually between Source-Drain'
        )
        #self.set_parameter_value('Source-Drain (ChA) voltages', [0.1,0.2])

        self.generate_parameter(
            Name='Gate-Source (ChB) voltages',
            Unit='Volts',
            Type='float',
            Iterable=True,
            Limits=[40, -40, None],
            Description=
            """List of voltages (in Volts) to be applied to the sample given order, 
                                Usually between Source and Gate.
                                This voltage is held constant, while testing a sequence of Source-Drain (ChA) voltages,
                                then the next channel 'B' voltage is applied and cycle of Source-Drain (ChA) voltages is repeated."""
        )
        #self.set_parameter_value('Gate-Source (ChB) voltages', [0.1,0.2])

        self.generate_parameter(
            Name='Source-Drain settle time',
            Unit='Seconds',
            Type='float',
            Iterable=False,
            Limits=[None, 0.001, None],
            Description='delay between the voltage steps in seconds')
        self.set_parameter_value('Source-Drain settle time', 0.1)

        self.generate_parameter(
            Name='Gate-Source settle time',
            Unit='Seconds',
            Type='float',
            Iterable=False,
            Limits=[None, 0.001, None],
            Description=
            'delay between the voltage steps of the Channel  in seconds')
        self.set_parameter_value('Gate-Source settle time', 1.0)
        self.generate_parameter(
            Name='Current integration time',
            Unit='NPLC',
            Type='float',
            Iterable=False,
            Limits=[25.0, 0.001, None],
            Description=
            'Integration time of current measurement in NPLC \nNumber of Power Line Cycles, 1 PLC = 20 ms.'
        )
        self.set_parameter_value('Current integration time', 1)
        #        self.generate_parameter(Name='Device',
        #                                Unit='name',
        #                                Type='name',
        #                                Iterable = False,
        #                                Limits = [ None, None, ['Keithley 617','Keithley 2602 - channel A','Keithley 2602 - channel A, fast sweep','Keithley 2602 - channel B','Keithley 2602 - channel B, fast sweep','TTi TSX3510P']],
        #                                Description='Device to measure the current voltage characteristics with')
        #        self.set_parameter_value('Device', 'Keithley 617')
        return

    def init_devices(self):
        from Devices import Clock, Thermometer, SMU_FET_tester

        ################################################################
        ##  Here begins the initialization of devices ##################
        ################################################################
        # define and ACTIVATE the instruments

        #        self.Channel = SMU_channelA()
        #        self.append_active_devices_list(self.Channel)
        #        self.Gate = SMU_channelB()
        #        self.append_active_devices_list(self.Gate)
        #
        self.FET = SMU_FET_tester()
        self.append_active_devices_list(self.FET)

        self.Stopwatch = Clock()
        self.append_active_devices_list(self.Stopwatch)
        self.Temper = Thermometer()
        self.append_active_devices_list(self.Temper)

    def _run(self):
        """ simple current-voltage characteristics measurement """
        ################################################################
        ##  Here begins the experimetal part ###########################
        ################################################################

        # switch on the voltage source:

        SDvoltages = self.get_parameter_value('Source-Drain (ChA) voltages')
        self.FET.Upload_source_drain_voltages(SDvoltages)
        Gvoltages = self.get_parameter_value('Gate-Source (ChB) voltages')

        SDwait = self.get_parameter_value('Source-Drain settle time')
        Gwait = self.get_parameter_value('Gate-Source settle time')
        Integr = self.get_parameter_value('Current integration time')
        self.FET.cfg_measure_current_integration_time(NPLC=Integr)

        self.datastore.report(
            'Starting new FET measurement of I-V characteristic S-D for various Gate voltages'
        )
        self.FET.set_volts(0.0, channel='a')
        self.FET.set_volts(0.0, channel='b')
        self.FET.set_output_on(channel='b')  # set gate channel B output ON
        self.Stopwatch.zeroTimer()

        for Vgate in Gvoltages:
            self.datastore.report('applying Gate voltage = %0.3f V' % Vgate)
            self.FET.set_volts(Vgate, channel='b')
            self.Stopwatch.Wait(Gwait)
            self.Stopwatch.Measure()
            self.Temper.Measure()
            self.FET.MeasureSweepChannelA(SDsettle_time=SDwait)
            self.datastore.acquireData()
            self.datastore.separateData()

        self.FET.set_output_off(channel='b')
        self.FET.set_output_off(channel='a')
        #self.Channel.set_output_off()
        self.datastore.report('Experiment finished')
        return
class Test(TestScript):
    def __init__(self):
        TestScript.__init__(self)
        self.Name = 'Current-Voltage'
        self.Description = """Current Voltage characteristic measurement"""
        return

    def init_parameters(self):
        """
        create the list of the parameter and initialize some basic values
        """
        #voltages, acquizDelay=0.1, voltStepDelay=5
        self.generate_parameter(
            Name='Tungsten lamp voltage',
            Unit='Volts',
            Type='float',
            Iterable=False,
            Limits=[20, 0.0, None],
            Description=
            'Select value > 0 to activate irradiation of the sample with light'
        )
        self.set_parameter_value('Tungsten lamp voltage', 0.0)

        self.generate_parameter(
            Name='Tested wavelength',
            Unit='nm',
            Type='float',
            Iterable=False,
            Limits=[1200, 200, None],
            Description=
            'List of wavelengths to irradiate the sample with, in the given order'
        )
        self.set_parameter_value('Tested wavelength', 800)

        self.generate_parameter(
            Name='Tested voltages',
            Unit='Volts',
            Type='float',
            Iterable=True,
            Limits=[1000, -1000, None],
            Description=
            'List of voltages (in Volts) to be applied to the sample given order'
        )
        #self.set_parameter_value('Tested voltages', [0.1,0.2])
        self.generate_parameter(
            Name='Acquisition delay',
            Unit='Seconds',
            Type='float',
            Iterable=False,
            Limits=[None, None, [0.01, 0.1, 0.2, 0.5, 1.0, 2.0, 5.0]],
            Description='delay of the data acquizition loop in seconds')
        self.set_parameter_value('Acquisition delay', 0.1)
        self.generate_parameter(
            Name='Acquisition time',
            Unit='Seconds',
            Type='float',
            Iterable=False,
            Limits=[None, 0.001, None],
            Description='delay between the voltage steps in seconds')
        self.set_parameter_value('Acquisition time', 5.0)
        self.generate_parameter(
            Name='Device',
            Unit='name',
            Type='name',
            Iterable=False,
            Limits=[
                None, None,
                [
                    'Keithley 617', 'Keithley 6517A (A)', 'Keithley 6517A (B)',
                    'Keithley 2602 - channel A',
                    'Keithley 2602 - channel A, fast sweep',
                    'Keithley 2602 - channel B',
                    'Keithley 2602 - channel B, fast sweep', 'TTi TSX3510P'
                ]
            ],
            Description=
            'Device to measure the current voltage characteristics with')
        self.set_parameter_value('Device', 'Keithley 617')
        self.generate_parameter(
            Name='Thermo',
            Unit='name',
            Type='name',
            Iterable=False,
            Limits=[None, None, ["HAAKE F6", "none"]],
            Description='Device to measure the temperature with')
        self.set_parameter_value('Thermo', 'none')
        return

    def init_devices(self):
        from Devices import Clock, Thermometer

        self.deviceName = self.get_parameter_value('Device')

        LampVoltage = self.get_parameter_value('Tungsten lamp voltage')
        if LampVoltage > 0:
            from Devices import PowerSource, Monochromator, HamamatsuPhotodiode
            self.Filter = Monochromator()
            self.append_active_devices_list(self.Filter)
            self.LightMeter = HamamatsuPhotodiode()
            self.append_active_devices_list(self.LightMeter)
            if self.deviceName != 'TTi TSX3510P':
                self.Lamp = PowerSource()
                self.Lamp.set_amperes_limit(10.0)

        if self.deviceName == 'Keithley 6517A (A)':
            from Devices import ElectrometerA
            self.Elmeter = ElectrometerA()
            self.append_active_devices_list(self.Elmeter)
        if self.deviceName == 'Keithley 6517A (B)':
            from Devices import ElectrometerB
            self.Elmeter = ElectrometerB()
            self.append_active_devices_list(self.Elmeter)

        if self.deviceName == 'Keithley 617':
            from Devices import Electrometer
            self.Elmeter = Electrometer()
            self.append_active_devices_list(self.Elmeter)
        if self.deviceName == 'TTi TSX3510P':
            from Devices import PowerSource
            self.Elmeter = PowerSource()
            self.Elmeter.set_amperes_limit(10.0)
            self.append_active_devices_list(self.Elmeter)
        if self.deviceName == 'Keithley 2602 - channel A':
            from Devices import SMU_channelA
            self.Elmeter = SMU_channelA()
            self.append_active_devices_list(self.Elmeter)
        if self.deviceName == 'Keithley 2602 - channel B':
            from Devices import SMU_channelB
            self.Elmeter = SMU_channelB()
            self.append_active_devices_list(self.Elmeter)
        if self.deviceName == 'Keithley 2602 - channel A, fast sweep':
            from Devices import SMU_channelA
            self.Elmeter = SMU_channelA()
            self.append_active_devices_list(self.Elmeter)
        if self.deviceName == 'Keithley 2602 - channel B, fast sweep':
            from Devices import SMU_channelB
            self.Elmeter = SMU_channelB()
            self.append_active_devices_list(self.Elmeter)
        #from instruments.Keithley import Electrometer617
        #from instruments.Agilent import A34401_4ohm
        ################################################################
        ##  Here begins the initialization of devices ##################
        ################################################################
        # define and ACTIVATE the instruments
        self.Stopwatch = Clock()
        self.append_active_devices_list(self.Stopwatch)
        if self.get_parameter_value('Thermo') == "HAAKE F6":
            self.Temper = Thermometer()
            self.append_active_devices_list(self.Temper)

    def _run(self):
        """ simple current-voltage characteristics measurement """
        ################################################################
        ##  Here begins the experimetal part ###########################
        ################################################################

        # switch on the voltage source:

        voltages = self.get_parameter_value('Tested voltages')
        voltStepDelay = self.get_parameter_value('Acquisition time')
        acquizDelay = self.get_parameter_value('Acquisition delay')

        LampVoltage = self.get_parameter_value('Tungsten lamp voltage')
        Wavelength = self.get_parameter_value('Tested wavelength')

        if LampVoltage > 0:
            #self.LightMeter.Measure()
            if self.deviceName != 'TTi TSX3510P':
                self.Lamp.set_volts(LampVoltage)
                self.Lamp.set_output_on()
            self.Filter.set_wave(Wavelength)
            self.Filter.open_shutter()
            if self.deviceName in ['Keithley 617']:
                self.Elmeter.zero_check('off')
            self.observe(voltStepDelay, acquizDelay)
            self.datastore.separateData()

        if self.deviceName in [
                'Keithley 617', 'Keithley 6517A (A)', 'Keithley 6517A (B)'
        ]:
            self.Elmeter.set_output_on()
            self.Elmeter.zero_check('off')
            for voltage in voltages:
                self.Elmeter.set_volts(voltage)
                self.observe(voltStepDelay, acquizDelay)
                #self.datastore.separateData()
            self.Elmeter.zero_check('on')
            self.Elmeter.set_output_off()

        if self.deviceName in [
                'TTi TSX3510P', 'Keithley 2602 - channel A',
                'Keithley 2602 - channel B'
        ]:
            self.Elmeter.set_output_on()
            for voltage in voltages:
                self.Elmeter.set_volts(voltage)
                self.observe(voltStepDelay, acquizDelay)
                self.datastore.separateData()
            self.Elmeter.set_output_off()

        if self.deviceName in [
                'Keithley 2602 - channel A, fast sweep',
                'Keithley 2602 - channel B, fast sweep'
        ]:
            numberOfPoints = len(voltages)
            self.Temper.Measure()
            self.Stopwatch.Measure()
            self.Elmeter.MeasureIListV(voltages, settle_time=voltStepDelay)
            self.datastore.acquireData()