mask_hw_wide = av_m * disp / (GLOBALutils.Constants.c / 1.0e3) ml_v = av_m - mask_hw_wide mh_v = av_m + mask_hw_wide print '\t\t\tComputing the CCF...' cond = True while (cond): # first rough correlation to find the minimum vels, xc_full, sn, nlines_ccf, W_ccf = \ GLOBALutils.XCor(spec, ml_v, mh_v, weight, 0, lbary_ltopo, vel_width=velw,vel_step=velsh,\ spec_order=9,iv_order=10,sn_order=8,max_vel_rough=velw) xc_av = GLOBALutils.Average_CCF(xc_full, sn, sn_min=3., Simple=True, W=W_ccf) yy = scipy.signal.medfilt(xc_av, 11) pred = lowess(yy, vels, frac=0.4, it=10, return_sorted=False) tck1 = scipy.interpolate.splrep(vels, pred, k=1) xc_av_orig = xc_av.copy() xc_av /= pred vel0_xc = vels[np.argmin(xc_av)] rvels, rxc_av, rpred, rxc_av_orig, rvel0_xc = vels.copy( ), xc_av.copy(), pred.copy(), xc_av_orig.copy(), vel0_xc xc_av_rough = xc_av vels_rough = vels vel_width = np.maximum(20.0, 6 * disp)
disp = 3. else: known_sigma = True mask_hw_wide = av_m * disp / (GLOBALutils.Constants.c/1.0e3) ml_v = av_m - mask_hw_wide mh_v = av_m + mask_hw_wide print '\t\t\tComputing the CCF...' cond = True while (cond): #first rough correlation to find the minimum vels, xc_full, sn, nlines_ccf, W_ccf = GLOBALutils.XCor(spec1, ml_v, mh_v,\ weight, 0, lbary_ltopo, vel_width=300, vel_step=3, start_order=0,\ spec_order=9, iv_order=10, sn_order=8,max_vel_rough=300) xc_av = GLOBALutils.Average_CCF(xc_full, sn, sn_min=3, Simple=True, start_order=0, W=W_ccf) #Normalize the continuum of the CCF robustly with R yy = scipy.signal.medfilt(xc_av,11) pred = lowess(yy, vels,frac=0.4,it=10,return_sorted=False) tck1 = scipy.interpolate.splrep(vels,pred,k=1) xc_av_orig = xc_av.copy() xc_av /= pred pred_rough = pred.copy() vel0_xc = vels[ np.argmin( xc_av ) ] rvels, rxc_av, rpred, rxc_av_orig, rvel0_xc = vels.copy(), \ xc_av.copy(), pred.copy(), xc_av_orig.copy(), vel0_xc xc_av_rough = xc_av vels_rough = vels