def Test(slopeList, acquizDelay=0.1, acquizTime=6): Stopwatch = MainTimerClass() Stopwatch.Activate() Line = GeneratorLine() Line.Activate() # dont forget to activate the instruments before opening the output file: Data = OutputHandler() Data.setDataFileName() for slope in slopeList: intercept = slope / 10.0 Data.analysis.mark_from() #begin DATA ACQUISITION script here: print 'starteing data generation. Slope>', slope, 'intercept:', intercept Stopwatch.zeroTimer() while Stopwatch.getSinceLastZeroed() < 1.2: Stopwatch.Wait(0.1) Stopwatch.Measure() Line.Measure(slope, intercept) Data.acquireData() print 'data gen finished, starting analysis' Data.analysis.mark_to() print 'analysing data in range', Data.analysis.get_markers() print 'average:', Data.analysis.average_marked("U(V)") print 'average last 10 points:', Data.analysis.average_last('U(V)', 10) print 'linear regression:', Data.analysis.linear_regres_marked( "time(s)", "U(V)")
# instruments: from instruments.DummyMeter import GeneratorLine from instruments.TimeMeter import MainTimerClass # file-output libraries from Output.Output import OutputHandler # define and ACTIVATE the instruments Stopwatch = MainTimerClass() Stopwatch.Activate() Line = GeneratorLine() Line.Activate() # dont forget to activate the instruments before opening the output file: Data = OutputHandler() Data.setDataFileName('test-01.dat') Data.analysis.mark_from() #begin DATA ACQUISITION script here: Stopwatch.zeroTimer() while Stopwatch.getSinceLastZeroed() < 5: Stopwatch.Wait(0.1) Stopwatch.Measure() Line.Measure() Data.acquireData() #end Data.analysis.mark_to() #print Data.analysis.average_marked("U(V)") print Data.analysis.linear_regres_marked("time(s)", "U(V)")
) piezoVoltage = Piezo.get_volts( ) # start with the piezo element maximally extended wireVoltage = 0.001 # voltage for the wire break detection thresholdCurrent = 1e-9 # threshold current to detect wire break (broken if the current is lower than that) #Piezo.set_volts(piezoVoltage) Piezo.set_output_on() Piezo.Measure() timeout = 600 # timeout for breaking the wire by hand junctionBroken = False # indicator of break detection Stopwatch.zeroTimer() Wire.set_volts(wireVoltage) # apply the voltage 1 mV to the wire Wire.set_output_on() while True: # break detecton loop, not recorded Stopwatch.Wait(0.02) #Stopwatch.Measure() #Wire.Measure() #Data.acquireData() #actualCurrent = Data.analysis.average_last(key="aCurrent(A)",number=1) actualCurrent = Wire.get_amperes() report('PIEZO=%.3fV; wire: I=%e A' % (piezoVoltage, actualCurrent)) if (actualCurrent < thresholdCurrent): report('the wire break detected, proceeding with piezo retraction') Wire.beep() junctionBroken = True break # finish the measurement if the wire broke if Stopwatch.getSinceLastZeroed() > timeout: junctionBroken = False report( 'the timeout elapsed. no wire break detected. Stopping the experiment'
Electrometer = Electrometer617('Electrometer') Electrometer.Activate() PeltierP = PIDHeater() # temperature regulation PeltierP.Activate() Platinum = A34401_4ohm('FastMultimeter') Platinum.Activate() # don`t forget to activate the instruments before opening the output file: Data = OutputHandler() Data.setDataFileName() ################################################################ ## Here begins the experimetal part ########################### ################################################################ # switch on the voltage source: Electrometer.set_output_on() # initialize PID temperature regulation PeltierP.set_PID_params(Kp=1.788, Ti=12.8, Td=0.313, looptime=0.1) PeltierP.setNew_setpoint(value=setpoint, tolerance=0.2, evalPeriod=300) PeltierP.startRegulation() PeltierP.waitForSetpoint() for voltage in voltages: Electrometer.set_volts(voltage) Stopwatch.Wait(5) Stopwatch.Measure() Platinum.Measure() PeltierP.Measure() Data.acquireData()