Example #1
0
h = []
# READ INPUT DATA FILE
# --------------------

if os.path.isdir(args.f):
    print "using directory " + args.f
    for f in os.listdir(args.f):
        print "processing file " + f
        if f.endswith(".log"):
            print "ignoring file"
            continue
        fi = args.f.rstrip('/') + '/' + f

        # READ INPUT DATA FILE
        # --------------------
        this_run_time, this_run_x, this_run_y, this_run_d, this_run_d_err, this_run_t, this_run_h = read_data_file(fi, args.de, args.w)

        # CORRECT FOR NONLINEAR MOTION OF STAGES
        # --------------------------------------
        if args.nc:
            this_run_x, this_run_y = correct_stage_positions(F_CALX, F_CALY, this_run_x, this_run_y)

        # CORRECT FOR TEMPERATURE EXCURSIONS
        # ----------------------------------
        if args.nt:
            this_run_d = correct_for_temperature(F_CORT, this_run_d, this_run_t)

        TIME.append(np.asarray(this_run_time))
        x.append(np.mean(this_run_x))
        y.append(np.mean(this_run_y))
        d.append(np.mean(this_run_d))
args.w = ([float(n) for n in args.w.split(',')])

run_data_x = []
run_data_y = []
run_data_d = []
run_data_d_err = []
for f in os.listdir(args.f):
    print "processing file " + f
    if f.endswith(".log"):
        print "ignoring file"
        continue
    fi = args.f.rstrip('/') + '/' + f
    # READ INPUT DATA FILE
    # --------------------
    this_time, x, y, d, d_err, t, h = read_data_file(fi, args.de, args.w)

    # CORRECT FOR NONLINEAR MOTION OF STAGES
    # --------------------------------------
    if args.nc:
        x, y = correct_stage_positions(F_CALX, F_CALY, x, y)

    # CORRECT FOR TEMPERATURE EXCURSIONS
    # ----------------------------------
    if args.nt:
        d = correct_for_temperature(F_CORT, d, t)

    run_data_x.append(np.mean(x))
    run_data_y.append(np.mean(y))
    run_data_d.append(np.mean(d))
    run_data_d_err.append(np.mean(d_err))
Example #3
0
h = []
# READ INPUT DATA FILE
# --------------------

if os.path.isdir(args.f):
    print "using directory " + args.f
    for f in os.listdir(args.f):
        print "processing file " + f
        if f.endswith(".log"):
            print "ignoring file"
            continue
        fi = args.f.rstrip('/') + '/' + f

        # READ INPUT DATA FILE
        # --------------------
        this_run_time, this_run_x, this_run_y, this_run_d, this_run_d_err, this_run_t, this_run_h = read_data_file(
            fi, args.de, args.w)

        # CORRECT FOR NONLINEAR MOTION OF STAGES
        # --------------------------------------
        if args.nc:
            this_run_x, this_run_y = correct_stage_positions(
                F_CALX, F_CALY, this_run_x, this_run_y)

        # CORRECT FOR TEMPERATURE EXCURSIONS
        # ----------------------------------
        if args.nt:
            this_run_d = correct_for_temperature(F_CORT, this_run_d,
                                                 this_run_t)

        TIME.append(np.asarray(this_run_time))
        x.append(np.mean(this_run_x))
Example #4
0
parser.add_argument(
    '--tcal',
    help="temperature at which to correct at (should be mid-range ish)",
    action="store",
    type=float,
    default=24)
parser.add_argument('--p', help="make plots?", action="store_true")
args = parser.parse_args()

args.tr = ([float(T) for T in args.tr.split(',')])

print "processing file " + args.f

# READ INPUT DATA FILE
# --------------------
this_time, x, y, d, d_err, t, h = read_data_file(args.f, args.de, None)

c = np.polyfit(
    [ti for ti in t if ti > args.tr[0] and ti < args.tr[1]],
    [di
     for di, ti in zip(d, t) if ti > args.tr[0] and ti < args.tr[1]], args.o)

# we correct for the position by finding how much by calibrating the measured distance to
# what it would be at a reference temperature of [t_cal]

d_cal = np.polyval(
    c, args.tcal)  # the calibration measurement at our reference temperature
offsets = np.polyval(
    c, t
) - d_cal  # the offsets that need to be applied for these measured temperatures to make them equivalent to being taken at the reference temperature
args.w = ([float(n) for n in args.w.split(',')])

run_data_x = []
run_data_y = []
run_data_d = []
run_data_d_err = []
for f in os.listdir(args.f):
    print "processing file " + f
    if f.endswith(".log"):
        print "ignoring file"
        continue
    fi = args.f.rstrip('/') + '/' + f
    # READ INPUT DATA FILE
    # --------------------
    this_time, x, y, d, d_err, t, h = read_data_file(fi, args.de, args.w)

    # CORRECT FOR NONLINEAR MOTION OF STAGES
    # --------------------------------------
    if args.nc:
        x, y = correct_stage_positions(F_CALX, F_CALY, x, y)

    # CORRECT FOR TEMPERATURE EXCURSIONS
    # ----------------------------------
    if args.nt:
        d = correct_for_temperature(F_CORT, d, t)

    run_data_x.append(np.mean(x))
    run_data_y.append(np.mean(y))
    run_data_d.append(np.mean(d))
    run_data_d_err.append(np.mean(d_err))
Example #6
0
parser = argparse.ArgumentParser()
parser.add_argument('--fl', help="add file to list", action='append')
parser.add_argument('--de', help="maximum error in distance measurement", action="store", type=float, default=1.0)
parser.add_argument('--w', help="window, defaults to min/max of data (x1,x2,y1,y2)", action="store", type=str, default='25,210,285,285')
parser.add_argument('--ca', help="don't apply stage calibration files", action="store_false")
parser.add_argument('--cax', help="calibration file for x if stage calibration is to be applied", action="store", type=str, default='calibration_files/45855915_cal.dat')
parser.add_argument('--cay', help="calibration file for y if stage calibration is to be applied", action="store", type=str, default='calibration_files/45855916_cal.dat')
args = parser.parse_args()

args.w = ([float(n) for n in args.w.split(',')])

for f in args.fl:
    # READ INPUT DATA FILE(S)
    # -----------------------
    x, y, d, de = read_data_file(f, args.de, args.w)

    # CORRECT FOR NONLINEAR MOTION OF STAGES
    # --------------------------------------
    if args.ca:
        x, y = correct_stage_positions(args.cax, args.cay, x, y)

    c = np.polyfit(x, d, 1)
    d_slope = np.polyval(c, x)
    plt.plot(x, d-d_slope, label="y= " + f)

plt.legend()
plt.ylim([-50,50])
plt.show()

Example #7
0
    action="store",
    type=str,
    default='calibration_files/45855915_cal.dat')
parser.add_argument(
    '--cay',
    help="calibration file for y if stage calibration is to be applied",
    action="store",
    type=str,
    default='calibration_files/45855916_cal.dat')
args = parser.parse_args()

args.w = ([float(n) for n in args.w.split(',')])

for f in args.fl:
    # READ INPUT DATA FILE(S)
    # -----------------------
    x, y, d, de = read_data_file(f, args.de, args.w)

    # CORRECT FOR NONLINEAR MOTION OF STAGES
    # --------------------------------------
    if args.ca:
        x, y = correct_stage_positions(args.cax, args.cay, x, y)

    c = np.polyfit(x, d, 1)
    d_slope = np.polyval(c, x)
    plt.plot(x, d - d_slope, label="y= " + f)

plt.legend()
plt.ylim([-50, 50])
plt.show()
parser = argparse.ArgumentParser()
parser.add_argument('--f', help="path to file", action="store", type=str)
parser.add_argument('--de', help="maximum error in distance measurement", action="store", type=float, default=1.0)
parser.add_argument('--o', help="order of fit", action="store", type=int, default=2)
parser.add_argument('--tr', help="CSV range of temperatures over which to fit", action="store", type=str, default='23,25')
parser.add_argument('--tcal', help="temperature at which to correct at (should be mid-range ish)", action="store", type=float, default=24)
parser.add_argument('--p', help="make plots?", action="store_true")
args = parser.parse_args()

args.tr = ([float(T) for T in args.tr.split(',')])

print "processing file " + args.f

# READ INPUT DATA FILE
# --------------------
this_time, x, y, d, d_err, t, h = read_data_file(args.f, args.de, None)

c = np.polyfit([ti for ti in t if ti>args.tr[0] and ti<args.tr[1]], [di for di, ti in zip(d, t) if ti>args.tr[0] and ti<args.tr[1]], args.o)

# we correct for the position by finding how much by calibrating the measured distance to 
# what it would be at a reference temperature of [t_cal]

d_cal = np.polyval(c, args.tcal) 	# the calibration measurement at our reference temperature
offsets = np.polyval(c, t) - d_cal	# the offsets that need to be applied for these measured temperatures to make them equivalent to being taken at the reference temperature

c2 = np.polyfit([ti for ti in t if ti>args.tr[0] and ti<args.tr[1]], [oi for oi, ti in zip(offsets, t) if ti>args.tr[0] and ti<args.tr[1]], args.o)

np.save("t_cor", c2)

if args.p:
    plt.subplot(211)