Пример #1
0
            WavSol = bestWavSol * (1.0 + 1.0e-6 * p_shift)
        final[0, orre, :] = GLOBALutils.ToVacuum(WavSol[::-1])

        #final[0,orre,:] = WavSolx[::-1]
        if len(np.where(np.isnan(obj_S[orre, 2, :][::-1]) == True)[0]) < 100:
            final[1, orre, :] = obj_S[
                orre, 1, :][::-1]  # ...flux in ADU (optimal extraction)...
            final[2, orre, :] = obj_S[orre, 2, :][::-1]  # ...and 1/variance...
            if JustExtract == False:
                final[3, orre, :] = final[1, orre, :] / sm_flat[
                    orre, :][::-1]  # ...flux (optimal)/flat...
                final[4, orre, :] = final[2, orre, :] * (
                    sm_flat[orre, :][::-1]**2
                )  # ...and 1/variance * flat**2...
                cont = GLOBALutils.get_cont_single(final[0, orre, :],
                                                   final[3, orre, :],
                                                   final[4, orre, :],
                                                   nc=3)
                ratio = np.polyval(cont, final[0, orre])
                final[6, orre, :] = final[4, orre, :] * (ratio**2)
                final[7, orre, :] = ratio
                final[8, orre, :] = ratio * sm_flat[orre, :][::-1] / np.sqrt(
                    ratio * sm_flat[orre, :][::-1] / GAIN + (RON / GAIN)**2)
                final[5, orre, :] = final[3, orre, :] / ratio
                nJ = np.where(np.isnan(final[5, orre]) == True)[0]
                nJ2 = np.where(np.isinf(final[5, orre]) == True)[0]
                final[5, orre, nJ] = 1.0
                final[5, orre, nJ2] = 1.0
                #plot(final[8,orre])
                rI = np.where(final[5, orre] > 1. + 8. / final[8, orre])
                final[5, orre, rI] = 1.
                spl = scipy.interpolate.splrep(np.arange(WavSol.shape[0]),
Пример #2
0
       m = order + ro0
       chebs = GLOBALutils.Calculate_chebs(equis, m, npix=data.shape[0],\
 order0=ro0, ntotal=nord1, Inverse=Inverse_m,nx=ncoef_x,nm=ncoef_m)
       WavSol = lbary_ltopo * (
           1.0 / m) * GLOBALutils.Joint_Polynomial_Cheby(
               wsol_dict['p1'], chebs, ncoef_x, ncoef_m)
       spec[0, order, :] = GLOBALutils.ToVacuum(WavSol)
       spec[1, order, :] = sci_S['chip1'][order, 1, :]
       #spec[1,order,:300] = 0.
       spec[2, order, :] = sci_S['chip1'][order, 2, :]
       spec[3, order, :] = spec[1, order, :] / sflat['chip1'][order][::-1]
       spec[4,
            order, :] = spec[2, order, :] * sflat['chip1'][order][::-1]**2
       ccoef = GLOBALutils.get_cont_single(spec[0, order],
                                           spec[3, order],
                                           spec[4, order],
                                           ll=1.5,
                                           lu=5,
                                           nc=3)
       ratio = np.polyval(ccoef, spec[0, order])
       L = np.where(spec[1, order, :] != 0)
       spec[5, order, :][L] = spec[3, order, :][L] / ratio[L]
       spec[3, order, :][L] = spec[3, order, :][L] / ratio[L]
       spec[6, order, :][L] = spec[4, order, :][L] * (ratio[L]**2)
       spec[7, order, :][L] = ratio[L]
       spec[8, order, :][
           L] = ratio[L] * sflat['chip1'][order][::-1][L] / np.sqrt(
               ratio[L] * sflat['chip1'][order][::-1][L] / gain1 +
               (ron1 / gain1)**2)
       rI = np.where(spec[5, order] > 1. + 5. / spec[8, order])
       spec[5, order, rI] = 1.
       lI = np.where(spec[5, order] < -5. / spec[8, order])
Пример #3
0
        final  = np.zeros( [11, orderf - orderi + 1, np.shape(obj_S)[2]] )
        equis  = np.arange( obj_S.shape[2] ) 

        for order in range(orderi,orderf+1):
            m = order + oro0
            chebs = GLOBALutils.Calculate_chebs(equis, m, order0=oro0, ntotal=n_useful, npix=obj_S.shape[2], Inverse=Inverse_m,nx=ncoef_x,nm=ncoef_m)
            WavSol  = lbary_ltopo*(1.0/m) * GLOBALutils.Joint_Polynomial_Cheby(global1,chebs,ncoef_x,ncoef_m)

            final[0,order,:] = WavSol
            final[1,order,:] = obj_S[order,1,:]
            final[2,order,:] = obj_S[order,2,:]
            final[3,order,:] = final[1,order,:]/flat[order,1]
            final[4,order,:] = final[2,order,:]*(flat[order,1]**2)

            ccoef = GLOBALutils.get_cont_single(final[0,order],final[3,order],final[4,order],ll=1.5,lu=5,nc=3)
            L  = np.where( final[1,order] != 0 )

            ratio = np.polyval(ccoef,final[0,order])
            final[5,order,:] = final[3,order,:]/ratio
            Inan = np.where( np.isnan(final[1,order,:]) == True )[0]
            final[5,order,Inan] = 1.
            final[6,order,:] = final[4,order,:]*(ratio**2)
            final[7,order,:] = ratio
            final[8,order,:] = ratio*flat[order,1] / np.sqrt( ratio *flat[order,1] / GAIN + (RON/GAIN)**2 )

            spl        = scipy.interpolate.splrep(np.arange(len(final[0,order,:])),final[0,order,:] ,k=3)
            dlambda_dx = scipy.interpolate.splev(np.arange(len(final[0,order,:])), spl, der=1)
            NN         = np.average(dlambda_dx)
            dlambda_dx /= NN