import numpy as np import calc_adj as ca import matplotlib.pyplot as plt if 'ifuncs_x' not in globals(): ifuncs_ry = ca.load_ifuncs('RY', 'p', case='7+2') ifuncs_x = ca.load_ifuncs('X', 'p', case='7+2') # displ_x = ca.load_displ_legendre(ifuncs_x, 8, 4, rms=5.0) # displ_ry, _ = np.gradient(displ_x, 0.5) # 0.5 mm displ_x = ca.load_displ_grav(axis='X') displ_ry = ca.load_displ_grav(axis='RY') displ_rz = ca.load_displ_grav(axis='RZ') displ_ry_calc, _ = np.gradient(displ_x, 0.5) # 0.5 mm if 'clip' not in globals(): clip = 20 if 'n_ss' not in globals(): n_ss = 5 # Optimize on X print print "** Optimize on X **" print coeffs_x, adj_x, M_2d_x, displ_x_clip = ca.calc_adj( ifuncs_x, displ_x, n_ss, clip) # print results
"""Run calc_adj for the exemplar data """ import numpy as np import matplotlib.pyplot as plt import calc_adj RAD2ARCSEC = 206000. # convert to arcsec for better scale clip = 20 scale_ry = RAD2ARCSEC / 1000. # ampl in microns, slope in arcsec if 'ifuncs_x' not in globals() or 'ifuncs_ry' not in globals(): ifuncs_x = calc_adj.load_ifuncs('X', case='10+0_half') ifuncs_ry = calc_adj.load_ifuncs('RY', case='10+0_half') displ_x = calc_adj.load_file_legendre( ifuncs_x, slope=False, filename='data/exemplar_021312.dat') out = open('exemplar_displ_X.dat', 'w') for i in range(displ_x.shape[0]): for j in range(displ_x.shape[1]): print >>out, i, j, '%.4f' % displ_x[i, j] out.close()
import numpy as np import matplotlib.pyplot as plt import calc_adj RAD2ARCSEC = 206000.0 # convert to arcsec for better scale clip = 20 scale_ry = RAD2ARCSEC / 1000.0 # ampl in microns, slope in arcsec if "save" not in globals(): save = None if "corr_using" not in globals(): corr_using = "x" if "ifuncs_x" not in globals() or "ifuncs_ry" not in globals(): ifuncs_x = calc_adj.load_ifuncs("X", case="10+0_half") ifuncs_ry = calc_adj.load_ifuncs("RY", case="10+0_half") if 1: displ_x = calc_adj.load_file_legendre(ifuncs_x, slope=False, filename="data/exemplar_021312.dat") save = "exemplar2_" else: displ_x = calc_adj.load_displ_legendre(ifuncs_x, 8, 4, 0.5) save = "leg84_" # displ_ry = np.gradient(displ_x, 0.5 * 1000)[0] * RAD2ARCSEC # radians (for exemplar down by factor of 1000) displ_ry = np.gradient(displ_x, 0.5)[0] if corr_using == "x": # coeffs from optimizing on amplitude