Пример #1
0
def re_measure(cycle=1):
    Temp = Ud = Ud_m = Id = 0.

    if ag.temperature() >= 50.0:
        print "Hi, temperature! Cool!"
        ag.stop_output("all")
        ag.state_output()
        while ag.temperature() >= 40.0:
            print "Current Temperature: %.2f, Delay: %d sec" % ( ag.temperature(),60 * MEASURE_DELAY )
            print "Delay"
            for sec in xrange( 12 * MEASURE_DELAY ):
                print "%d, " % (sec*5),
                time.sleep(5)

        ag.start_output("all")
        

    for i in xrange(cycle):
        time.sleep( MEASURE_DELAY )
        
        Temp    += ag.temperature()
        Ud      += ag.source_value(1,"volt")
        Ud_m    += ag.measure(1,"volt")
        Id      += ag.measure(1,"cur")


        

    cycle = float(cycle)
    Measurements["Temp"] = Temp / cycle
    Measurements["Ud"]   = Ud   / cycle
    Measurements["Ud_m"] = Ud_m / cycle
    Measurements["Id"]   = Id   / cycle
Пример #2
0
def re_measure(cycle=1):
    Temp = Uc = Uc_m = Ic = Ue = Ue_m = Ib = 0.0

    if ag.temperature() >= 50.0:
        print "High temperature! Cooler!!!!"
        ag.stop_output("all")
        ag.state_output()
        while ag.temperature() >= 40.0:
            print "Current Temperature: %.2f, Delay: %d sec" % (ag.temperature(), 60 * DELAY_MEASURE)
            print "Delay"
            for sec in xrange(12 * DELAY_MEASURE):
                print "%d, " % (sec * 5),
                time.sleep(5)

        ag.start_output("all")

    for i in xrange(cycle):
        time.sleep(DELAY_MEASURE)

        Temp += ag.temperature()
        Uc += ag.source_value(2, "volt")
        Uc_m += ag.measure(2, "volt")
        Ic += ag.measure(2, "cur")
        Ue += ag.source_value(1, "volt")
        Ue_m += ag.measure(1, "volt")
        Ib += ag.measure(1, "cur")

    cycle = float(cycle)
    Measurements["Temp"] = Temp / cycle
    Measurements["Uc"] = Uc / cycle
    Measurements["Uc_m"] = Uc_m / cycle
    Measurements["Ic"] = Ic / cycle
    Measurements["Ue"] = Ue / cycle
    Measurements["Ue_m"] = Ue_m / cycle
    Measurements["Ib"] = Ib / cycle
Пример #3
0
def re_measure(cycle=1):
    Temp = Uc = Uc_m = Ic = Ue = Ib = Ib_m = 0.

    if ag.temperature() >= 50.0:
        ag.cooler(36.0)

    for i in xrange(cycle):
        time.sleep( DELAY_MEASURE )
        
        Temp    += ag.temperature()
        Uc      += ag.source_value(2,"volt")
        Uc_m    += ag.measure(2,"volt")
        Ic      += ag.measure(2,"cur")
        Ue      += ag.measure(1,"volt")
        Ib		+= ag.source_value(1,"c")
        Ib_m    += ag.measure(1,"cur")

        

    cycle = float(cycle)
    Measurements["Temp"] = Temp / cycle
    Measurements["Uc"]   = Uc   / cycle
    Measurements["Uc_m"] = Uc_m / cycle
    Measurements["Ic"]   = Ic   / cycle
    Measurements["Ue"]   = Ue   / cycle
    Measurements["Ib_m"] = Ib_m / cycle
    Measurements["Ib"]   = Ib   / cycle
Пример #4
0
#chan_min = min(x.chan for x in conversions)
chan_min = 101
chan_max = 126
print(chan_min)
chan_lst = [i for i in range(chan_min, chan_max+1)]

vheader = ["Channel Name", "Value"]

try:
    while(True):

        print("______________________________________________")


        # Perform measurement
        m_str = agilent.measure(adc, chan_min, chan_max+1)
        m_lst = m_str.split(",")


        vtable = []

        for i in chan_lst:

            conv_ind = [j for j, x in enumerate(conversions) if x.chan == i]

            if(len(conv_ind) == 1):
                this_conv = conversions[conv_ind[0]]
                #print(this_conv.str, this_conv.eq(float(m_lst[i - chan_min])))
                vtable.append([this_conv.str, str('%.3f' % this_conv.eq(float(m_lst[i - chan_min]))) + " " + this_conv.units])

            else :
Пример #5
0
# prepare the directory structure
cur_dir = "Output/NoiseTest"
if not os.path.exists(cur_dir):
    os.makedirs(cur_dir)

timestr = time.strftime("%Y%m%d-%H%M%S")

# Open the Agilent 34970A for voltage measurements
voltmet = agilent.init_serial()

# Open CSV file for writing output
csv_fn = cur_dir + "/" + timestr + ".csv"
csvfile = open(csv_fn, 'w', newline='')
csv_writer = csv.writer(csvfile)

#for j in range(0, num_meas):        # Take intensity measurements
while True:
    data = []
    raw = agilent.measure(voltmet)
    rawlist = raw.split(",")
    for datum in rawlist:
        #print(datum)
        data.append(datum)

    csv_writer.writerow(data)  # write next row of data to file
    csvfile.flush()

csvfile.close()  # Close CSV file

input("Press Enter to quit...")
Пример #6
0
        # Move the motor to the new position and wait for completion
        motor.position = start_pos + num * dx
        sleep(0.2)
        while (motor.status_in_motion_forward or motor.status_in_motion_reverse
               or motor.status_in_motion_jogging_forward
               or motor.status_in_motion_jogging_reverse
               or motor.status_in_motion_homing):
            sleep(0.1)
            #motor.print_state()

        # Take the intesity measurements
        data = []
        data.append(str(motor.position))
        for j in range(0, num_meas):  # Take intensity measurements
            raw = agilent.measure(voltmet, 101, 101)
            rawlist = raw.split(",")
            for k in range(0, len(rawlist)):
                if k < 3:  # photodiode measurement
                    data.append(rawlist[k])
                else:
                    data.append(steinhart(rawlist[k]))

        csv_writer.writerow(data)  # write next row of data to file
        csvfile.flush()

    csvfile.close()  # Close CSV file

    [cont_loop, start_pos, end_pos, num_steps, num_meas,
     iteration] = eng.complete_align_single(csv_fn,
                                            iteration,
Пример #7
0
os.makedirs(exp_dir)

# Open the Agilent 34970A for voltage measurements
voltmet = agilent.init_serial()

csv_fn = exp_dir + "/data.csv"
csvfile = open(csv_fn, 'w', newline='')
csv_writer = csv.writer(csvfile)

start_time = time.time()

dif = 0

while dif < duration:
    data = []
    raw = agilent.measure(voltmet, 104, 114)
    rawlist = raw.split(",")
    for k in range(0, (len(rawlist) + 1)):
        if k == 0:  # photodiode & Vin measurement
            data.append(rawlist[k])
        elif k == 11:
            dif = time.time() - start_time
            data.append(dif)
        else:
            data.append(steinhart(float(rawlist[k]), float(rawlist[0])))
    sleep(1.0)

    csv_writer.writerow(data)  # write next row of data to file
    csvfile.flush()

eng.temp_long(csv_fn, nargout=0)
            # Make sure the motor isn't going to be damaged by the move
            if(motor.status_motor_current_limit_reached or motor.status_motion_error or motor.status_forward_hardware_limit_switch_active or motor.status_reverse_hardware_limit_switch_active):
                sys.exit("Z812B encountered an error")

            # Move the motor to the new position and wait for completion
            motor.position = start_pos + num * dx
            sleep(0.2)
            while (motor.status_in_motion_forward or motor.status_in_motion_reverse or motor.status_in_motion_jogging_forward or motor.status_in_motion_jogging_reverse or motor.status_in_motion_homing):
                sleep(0.1)
                #motor.print_state()

            # Take the intesity measurements
            data = []
            data.append(str(motor.position))
            for j in range(0, 1):        # Take intensity measurements
                raw = agilent.measure(voltmet,102,102)
                rawlist = raw.split(",")
                for datum in rawlist:
                    #print(datum)
                    data.append(datum)

            csv_writer.writerow(data)   # write next row of data to file
            csvfile.flush()



    csvfile.close() # Close CSV file

    [cont_loop, start_pos, end_pos, num_steps, num_meas, iteration] = eng.complete_align_single(csv_fn, iteration,grating_num,grating_type, nargout=6)
    cont_loop = int(cont_loop)
    num_steps = int(num_steps)