Пример #1
0
                thar_order_orig, 101)
            wei = np.ones(len(thar_order))
            if order == 0:
                do_xc = False
            else:
                do_xc = True
            coeffs_pix2wav, coeffs_pix2sigma, pixel_centers, wavelengths,\
            rms_ms, residuals, centroids, sigmas, intensities =\
                     GLOBALutils.Initial_Wav_Calibration(order_dir+'nborder_'+\
                     order_s+'.iwdat', thar_order, order, wei, rmsmax=100, \
                     minlines=20,FixEnds=False,Dump_Argon=dumpargon,sigmai=2.,\
                     Dump_AllLines=True, Cheby=use_cheby,porder=ncoef_x,do_xc=False, line_width=6,pixelization=True)

            if order == 7:
                Global_ZP = GLOBALutils.Cheby_eval(coeffs_pix2wav,
                                                   0.5 * (len(thar_order) - 1),
                                                   len(thar_order))

            All_Pixel_Centers = np.append(All_Pixel_Centers, pixel_centers)
            All_Wavelengths = np.append(All_Wavelengths, wavelengths)
            All_Orders = np.append(All_Orders,
                                   np.zeros(len(pixel_centers)) + order)
            All_Centroids = np.append(All_Centroids, centroids)
            All_Sigmas = np.append(All_Sigmas, sigmas)
            All_Intensities = np.append(All_Intensities, intensities)

        p0 = np.zeros(npar_wsol)
        p0[0] = (7 + ro0) * Global_ZP
        p1, G_pix, G_ord, G_wav, II, rms_ms, G_res = \
            GLOBALutils.Fit_Global_Wav_Solution(All_Pixel_Centers, All_Wavelengths, All_Orders,\
                                                np.ones(All_Intensities.shape), p0, Cheby=use_cheby,\
Пример #2
0
                order_s = '0' + str(order)
            thar_order_orig = lines_thar[order - difo]
            #IV              = iv_thar_ob_R[order,:]
            L = np.where(thar_order_orig != 0)[0]
            IV = 1. / (thar_order_orig / gain + (ron/gain)**2 )
            IV[L] = 0.
            wei             = np.sqrt( IV )
            thar_order      = thar_order_orig #- bkg

            coeffs_pix2wav, coeffs_pix2sigma, pixel_centers, wavelengths, rms_ms, residuals, centroids,sigmas, intensities \
                = GLOBALutils.Initial_Wav_Calibration( order_dir+'order_'+order_s+'.iwdat', thar_order, order, np.ones(len(thar_order)), rmsmax=300, minlines=10, FixEnds=False,Dump_Argon=dumpargon, Dump_AllLines=True, Cheby=use_cheby,porder=3,rough_shift=rough_shift)

            if (order == int(.5*n_useful)+ro0):

                if (use_cheby):
                    Global_ZP = GLOBALutils.Cheby_eval( coeffs_pix2wav,  0.5*len(thar_order), len(thar_order) )
                else:
                    Global_ZP = scipy.polyval( coeffs_pix2wav, 0.0 )

            All_Pixel_Centers = np.append( All_Pixel_Centers, pixel_centers )
            All_Wavelengths   = np.append( All_Wavelengths, wavelengths )
            All_Orders        = np.append( All_Orders, np.zeros( len(pixel_centers) ) + order -ro0)
            All_Centroids     = np.append( All_Centroids, centroids)
            All_Sigmas        = np.append( All_Sigmas, sigmas)
            All_Intensities   = np.append( All_Intensities, intensities )
            All_residuals     = np.append( All_residuals, residuals )
            wavs.append(GLOBALutils.Cheby_eval( coeffs_pix2wav,  0.5*len(thar_order), len(thar_order) ))
            ords.append(torder)
            torder += 1

        p0    = np.zeros( npar_wsol )
Пример #3
0
            wei = np.ones(len(thar_order))
            ccf_max, rshift = GLOBALutils.cor_thar(lines_thar[order],filename=order_dir+'order_'+\
               order_s+'.iwdat',span=20,binning=binx)

            coeffs_pix2wav, coeffs_pix2sigma, pixel_centers, wavelengths,\
          rms_ms, residuals, centroids, sigmas, intensities =\
      GLOBALutils.Initial_Wav_Calibration(order_dir+'order_'+\
      order_s+'.iwdat', thar_order, order, wei, rmsmax=100, \
      minlines=30,FixEnds=False,Dump_Argon=dumpargon,\
      Dump_AllLines=True, Cheby=use_cheby,porder=5,del_width=4.0,\
      binning=binx,rough_shift=rshift,line_width=6)

            fwhms_lns = sigmas * 2.355
            inis_lns = pixel_centers - fwhms_lns * 0.5
            fins_lns = pixel_centers + fwhms_lns * 0.5
            inis_wvs = GLOBALutils.Cheby_eval(coeffs_pix2wav, inis_lns,
                                              float(len(thar_order)))
            fins_wvs = GLOBALutils.Cheby_eval(coeffs_pix2wav, fins_lns,
                                              float(len(thar_order)))
            fwhms_wvs = fins_wvs - inis_wvs
            resolution = wavelengths / fwhms_wvs

            #print "\t\t\tmedian Resolution of order", order, '('+str(np.around(np.median(wavelengths)))+' A)=', np.around(np.median(resolution))
            #plot(wavelengths, resolution,'ro')
            #show()
            #plot(wavelengths,residuals,'o')
            if (order == 16):
                if (use_cheby):
                    Global_ZP = GLOBALutils.Cheby_eval(coeffs_pix2wav,
                                                       0.5 * len(thar_order),
                                                       len(thar_order))
                else:
Пример #4
0
            J = np.where(np.isnan(thar_order_orig) == False)
            thar_order_orig[I] = np.median(thar_order_orig[J])
            thar_order = thar_order_orig - scipy.signal.medfilt(
                thar_order_orig, 101)
            wei = np.ones(len(thar_order))

            coeffs_pix2wav, coeffs_pix2sigma, pixel_centers, wavelengths,\
            rms_ms, residuals, centroids, sigmas, intensities =\
               GLOBALutils.Initial_Wav_Calibration(order_dir+'echorder_'+\
               order_s+'_'+str(int(chip))+'.iwdat', thar_order, order, wei, rmsmax=100, \
               minlines=20,FixEnds=False,Dump_Argon=dumpargon,\
               Dump_AllLines=True, Cheby=use_cheby,porder=ncoef_x)

            if (chip == 2) and (order == 8):
                Global_ZP = GLOBALutils.Cheby_eval(coeffs_pix2wav,
                                                   0.5 * (len(thar_order) - 1),
                                                   len(thar_order))

            All_Pixel_Centers = np.append(All_Pixel_Centers, pixel_centers)
            All_Wavelengths = np.append(All_Wavelengths, wavelengths)
            All_Orders = np.append(All_Orders,
                                   np.zeros(len(pixel_centers)) + order)
            All_Centroids = np.append(All_Centroids, centroids)
            All_Sigmas = np.append(All_Sigmas, sigmas)
            All_Intensities = np.append(All_Intensities, intensities)

            isz = pixel_centers - sigmas
            der = pixel_centers + sigmas
            isz = GLOBALutils.Cheby_eval(coeffs_pix2wav, isz, len(thar_order))
            der = GLOBALutils.Cheby_eval(coeffs_pix2wav, der, len(thar_order))
            sig = 0.5 * (der - isz)
Пример #5
0
            thar_order_orig = lines_thar[orre, :]
            IV = iv_thar[orre, :]
            wei = np.sqrt(IV)
            #bkg = utils.Lines_mBack(thar_order_orig, IV, thres_rel=3)
            #thar_order = thar_order_orig - bkg
            thar_order = thar_order_orig
            coeffs_pix2wav, coeffs_pix2sigma, pixel_centers, wavelengths,\
            rms_ms, residuals, centroids, sigmas, intensities \
                = GLOBALutils.Initial_Wav_Calibration(order_dir+'gorder'+order_s+'.dat',\
                                                    thar_order,order,wei,rmsmax=5000000,\
                                                    minlines=6,FixEnds=True,Dump_Argon=False,\
                                                    Dump_AllLines=True, Cheby=use_cheby,rough_shift=delta)

            if (order == 20):
                if (use_cheby):
                    Global_ZP = GLOBALutils.Cheby_eval(coeffs_pix2wav, 511,
                                                       len(thar_order))
                else:
                    Global_ZP = scipy.polyval(coeffs_pix2wav, 0.0)
            #print residuals
            All_Pixel_Centers = np.append(All_Pixel_Centers, pixel_centers)
            All_Wavelengths = np.append(All_Wavelengths, wavelengths)
            All_Orders = np.append(All_Orders,
                                   np.zeros(len(pixel_centers)) + order)
            All_Centroids = np.append(All_Centroids, centroids)
            All_Sigmas = np.append(All_Sigmas, sigmas)
            All_Intensities = np.append(All_Intensities, intensities)
            All_Residuals = np.append(All_Residuals, residuals)
            All_Sigmas = np.append(All_Sigmas, sigmas)
            trans[orre, :] = coeffs_pix2wav

            order += 1