Exemple #1
0
def get_AVs(filter='F606W',verbose=True):
    """
    Get Av values for MUSE CDFS fields

    --- INPUT ---
    MUSEidlist

    --- EXAMPLE OF USE ---
    import CDFS_lumfct as cft
    cft.get_AVs()

    """

    fieldinfo = cft.get_fieldinfo()

    for ff in fieldinfo.keys():
        if verbose: print ' - Getting Av in filter '+filter+' for '+fieldinfo[ff]['name']
        Av,Ebv = kbs.getAv(fieldinfo[ff]['ra'],fieldinfo[ff]['dec'],filter)
        print Av, Ebv
utcstart_bri = parameters[12]
utcstop_bri = parameters[13]
spec1D_sci = parameters[14]
nightdate_sci = parameters[15]
utcstart_sci = parameters[16]
utcstop_sci = parameters[17]
throughput = np.genfromtxt(tpfile)  # reading througput into array
#-------------------------------------------------------------------------------------------------------------
#                           A:                      TELLURIC STAR
#-------------------------------------------------------------------------------------------------------------
# reading wavelengths, spectrum and ra dec from file
wave_tel, spec1D_tel_eps, radec_tel = cal.readfitsspec1D(spec1D_tel,
                                                         spec='SPEC1D_SUM')

# get E(B-V) for ra and dec
AV, extval_tel = kbs.getAv(radec_tel[0], radec_tel[1],
                           'F098M')  # filter only important when using AV

# interpolating throughput to telluric wavelengths
tpinterp_tel = kbs.interpn(throughput[:, 0] * 10**4, throughput[:, 1],
                           wave_tel)

# loading expected initial 'template' spectrum of standard star (in flux units: [erg/s/cm2/A]
standat = np.genfromtxt(spec1Dstandard)
wave_stan = standat[:, 0]
flux_stan = standat[:, 1]
spec_stan_flux = kbs.interpn(wave_stan, flux_stan, wave_tel)

# rescale 'template' spec to match telluric's magnitude
magABstan = cal.magFromSpec(wave_tel, spec_stan_flux,
                            tpinterp_tel)  # magnitude of standard in band
magABtel = magV_tel + magABstan  # assuming telluric A0V (Vega) star => magABtel_band - magABtel_V = magABstan_band
nightdate_bri     = parameters[11]
utcstart_bri      = parameters[12]
utcstop_bri       = parameters[13]
spec1D_sci        = parameters[14]
nightdate_sci     = parameters[15]
utcstart_sci      = parameters[16]
utcstop_sci       = parameters[17]
throughput        = np.genfromtxt(tpfile) # reading througput into array
#-------------------------------------------------------------------------------------------------------------
#                           A:                      TELLURIC STAR
#-------------------------------------------------------------------------------------------------------------
# reading wavelengths, spectrum and ra dec from file 
wave_tel, spec1D_tel_eps, radec_tel = cal.readfitsspec1D(spec1D_tel,spec='SPEC1D_SUM')

# get E(B-V) for ra and dec
AV, extval_tel = kbs.getAv(radec_tel[0],radec_tel[1],'F098M') # filter only important when using AV

# interpolating throughput to telluric wavelengths
tpinterp_tel       = kbs.interpn(throughput[:,0]*10**4,throughput[:,1],wave_tel) 

# loading expected initial 'template' spectrum of standard star (in flux units: [erg/s/cm2/A]
standat            = np.genfromtxt(spec1Dstandard) 
wave_stan          = standat[:,0]
flux_stan          = standat[:,1]
spec_stan_flux     = kbs.interpn(wave_stan,flux_stan,wave_tel)

# rescale 'template' spec to match telluric's magnitude
magABstan          = cal.magFromSpec(wave_tel,spec_stan_flux,tpinterp_tel) # magnitude of standard in band
magABtel           = magV_tel+magABstan  # assuming telluric A0V (Vega) star => magABtel_band - magABtel_V = magABstan_band
spec_stanscale     = cal.scalespec(wave_tel,spec_stan_flux,tpinterp_tel,magABtel) # scaling standard spectrum to match telluric
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -