Time Domain Spectral Simulations

Demonstrate how to inspect simulated spectra produced using quicktransients.


In [1]:
import numpy as np

from astropy.io import fits
from astropy.table import Table, Column

from desispec.io.spectra import read_spectra

import matplotlib as mpl
import matplotlib.pyplot as plt

mpl.rc('font', size=14)

Input Files

The quicktransients program in the desisim transients branch will produce two FITS outputs:

  1. A truth file with information about the templates used for each object.
  2. A spect file with the templates "observed" under conditions specified by the user.

The spectra can then be coadded using the desi_coadd_spectra program available in desispec.


In [2]:
truth_file = '../../bgs_2020-03-08_0300s_001_truth.fits'
spect_file = '../../bgs_2020-03-08_0300s_001_spect.fits'
coadd_file = '../../bgs_2020-03-08_0300s_001_coadd.fits'

Contents of the Truth File

The truth file has the following tables:

  1. A wavelength table called WAVE.
  2. A flux table called FLUX.
  3. A TARGETS table simulating a target list available in data.
  4. A simulation TRUTH table with information about the object (redshift, flux, etc.).
  5. A simulation OBJTRUTH table with line fluxes and other data generated for each object.

In [3]:
hdus = fits.open(truth_file)
hdus.info()


Filename: ../../bgs_2020-03-08_0300s_001_truth.fits
No.    Name      Ver    Type      Cards   Dimensions   Format
  0  WAVE          1 PrimaryHDU       8   (32001,)   float64   
  1  FLUX          1 ImageHDU         9   (32001, 100)   float32   
  2  TARGETS       1 BinTableHDU    235   100R x 99C   [I, J, 8A, J, 4A, D, D, E, E, 5E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, I, I, I, E, E, E, E, E, E, E, E, E, E, E, E, B, B, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, 2A, K, E, E, E, E, E, E, E, E, K, E, L, E, E, E, E, E, E, I, E, 1A, K, K, K]   
  3  TRUTH         1 BinTableHDU     51   100R x 17C   [K, K, E, 10A, 10A, 10A, J, K, E, 15A, E, E, E, E, E, E, E]   
  4  OBJTRUTH      1 BinTableHDU     53   100R x 17C   [K, E, E, E, E, E, E, E, E, E, E, E, 20A, 10A, E, E, E]   

In [4]:
wave = hdus['WAVE'].data
flux = hdus['FLUX'].data
targets = Table.read(truth_file, 'TARGETS')
truth = Table.read(truth_file, 'TRUTH')
objtr = Table.read(truth_file, 'OBJTRUTH')

In [5]:
truth


Out[5]:
<Table length=100>
TARGETIDMOCKIDTRUEZTRUESPECTYPETEMPLATETYPETEMPLATESUBTYPETEMPLATEIDSEEDMAGMAGFILTERFLUX_GFLUX_RFLUX_ZFLUX_W1FLUX_W2FLUX_W3FLUX_W4
magnanomaggiesnanomaggiesnanomaggiesnanomaggiesnanomaggiesnanomaggiesnanomaggies
int64int64float32str10str10str10int32int64float32str15float32float32float32float32float32float32float32
122950001394424790.31979337GALAXYBGS152888957041919.522118sdss2010-r8.53025416.15067520.13576518.06329313.5611850.00.0
122950002391917410.30067772GALAXYBGS156877635489519.055407sdss2010-r11.60627425.82629444.90318753.1868838.5438540.00.0
122950003395594400.16610113GALAXYBGS639757082324919.931982sdss2010-r6.691943611.20701714.13419310.0337217.46337840.00.0
122950004404542760.3167331GALAXYBGS728661784619219.62056sdss2010-r9.290114.65133519.76513519.4371614.3806770.00.0
122950005385498580.120078176GALAXYBGS7492116357373319.98743sdss2010-r4.9967710.97576621.22191843.17449635.418560.00.0
122950006395593710.2248764GALAXYBGS742738024658118.639769sdss2010-r22.58122636.20616538.57616431.07500624.0726130.00.0
122950007408900900.25627232GALAXYBGS750795717503619.099724sdss2010-r14.9461723.74137129.9817127.1503122.2250080.00.0
122950008395657740.5775137GALAXYBGS518487216310319.9638sdss2010-r4.368685211.22492617.1844735.57069425.0265140.00.0
122950009405956590.19883993GALAXYBGS5930186450573620.034039sdss2010-r6.114430410.43930213.69172410.5693157.2377310.00.0
...................................................
122950091390094280.16526465GALAXYBGS3142174318319717.890905sdss2010-r51.46321573.46343103.86297691.5306265.2803040.00.0
122950092400294130.31963074GALAXYBGS5212154027385219.277475sdss2010-r12.70722920.7169632.34674536.71819727.3281650.00.0
122950093397048390.12930746GALAXYBGS6868115135044518.657742sdss2010-r18.51085336.44912353.65380547.76738433.3868030.00.0
122950094406673350.1958485GALAXYBGS6171101169350019.092773sdss2010-r13.58535924.75238434.33749437.34998329.4428650.00.0
122950095377799270.3460831GALAXYBGS2521200163654919.47317sdss2010-r5.17758617.89818235.6204550.86488336.362370.00.0
122950096406716210.11701738GALAXYBGS391436058203619.309277sdss2010-r14.56531719.59608524.92983815.51472410.1154130.00.0
122950097415010570.44814777GALAXYBGS5424148029348219.825798sdss2010-r3.65339912.67749221.37872338.1358129.3971940.00.0
122950098394883010.2258223GALAXYBGS165233444623819.46129sdss2010-r10.00162617.66388525.58527227.471220.3958780.00.0
122950099372453010.1321732GALAXYBGS656253988640118.228052sdss2010-r40.91636351.7785754.88875240.67036428.7602160.00.0
122950100409376970.419504GALAXYBGS2429137799832019.747936sdss2010-r5.396812413.57677917.97157729.60990524.414680.00.0

In [6]:
r = 22.5 - 2.5*np.log10(truth['FLUX_R'])
z = truth['TRUEZ']

fig, ax = plt.subplots(1,1, figsize=(6,4))
ax.scatter(z, r)
ax.set(xlabel='$z$', ylabel='$r$')
fig.tight_layout();



In [7]:
targets


Out[7]:
<Table length=100>
RELEASEBRICKIDBRICKNAMEOBJIDTYPERADECRA_IVARDEC_IVARDCHISQ [5]FLUX_GFLUX_RFLUX_ZFLUX_W1FLUX_W2FLUX_W3FLUX_W4FLUX_IVAR_GFLUX_IVAR_RFLUX_IVAR_ZFLUX_IVAR_W1FLUX_IVAR_W2FLUX_IVAR_W3FLUX_IVAR_W4MW_TRANSMISSION_GMW_TRANSMISSION_RMW_TRANSMISSION_ZMW_TRANSMISSION_W1MW_TRANSMISSION_W2MW_TRANSMISSION_W3MW_TRANSMISSION_W4NOBS_GNOBS_RNOBS_ZFRACFLUX_GFRACFLUX_RFRACFLUX_ZFRACMASKED_GFRACMASKED_RFRACMASKED_ZFRACIN_GFRACIN_RFRACIN_ZALLMASK_GALLMASK_RALLMASK_ZWISEMASK_W1WISEMASK_W2PSFDEPTH_GPSFDEPTH_RPSFDEPTH_ZGALDEPTH_GGALDEPTH_RGALDEPTH_ZFRACDEVFRACDEV_IVARSHAPEDEV_RSHAPEDEV_R_IVARSHAPEDEV_E1SHAPEDEV_E1_IVARSHAPEDEV_E2SHAPEDEV_E2_IVARSHAPEEXP_RSHAPEEXP_R_IVARSHAPEEXP_E1SHAPEEXP_E1_IVARSHAPEEXP_E2SHAPEEXP_E2_IVARFIBERFLUX_GFIBERFLUX_RFIBERFLUX_ZFIBERTOTFLUX_GFIBERTOTFLUX_RFIBERTOTFLUX_ZREF_CATREF_IDGAIA_PHOT_G_MEAN_MAGGAIA_PHOT_G_MEAN_FLUX_OVER_ERRORGAIA_PHOT_BP_MEAN_MAGGAIA_PHOT_BP_MEAN_FLUX_OVER_ERRORGAIA_PHOT_RP_MEAN_MAGGAIA_PHOT_RP_MEAN_FLUX_OVER_ERRORGAIA_PHOT_BP_RP_EXCESS_FACTORGAIA_ASTROMETRIC_SIGMA5D_MAXGAIA_ASTROMETRIC_PARAMS_SOLVEDGAIA_ASTROMETRIC_EXCESS_NOISEGAIA_DUPLICATED_SOURCEPARALLAXPARALLAX_IVARPMRAPMRA_IVARPMDECPMDEC_IVARMASKBITSEBVPHOTSYSDESI_TARGETBGS_TARGETMWS_TARGET
degdeg1 / deg21 / deg2nanomaggiesnanomaggiesnanomaggiesnanomaggiesnanomaggiesnanomaggiesnanomaggies1/nanomaggies**21/nanomaggies**21/nanomaggies**21/nanomaggies**21/nanomaggies**21/nanomaggies**21/nanomaggies**21/nanomaggies**21/nanomaggies**21/nanomaggies**21/nanomaggies**21/nanomaggies**21/nanomaggies**2arcsec1 / arcsec2arcsec1 / arcsec2
int16int32str8int32str4float64float64float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32int16int16int16float32float32float32float32float32float32float32float32float32float32float32float32uint8uint8float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32str2int64float32float32float32float32float32float32float32float32int64float32boolfloat32float32float32float32float32float32int16float32str1int64int64int64
99993489123161p030122950001DEV316.15237426757812.996169328689575100000000.0100000000.00.0 .. 400.06.28533213.13010218.01480517.5190610.2174330.00.01438.5999329.5641862.797160.766391460.303708520.00.00.73629650.81366310.890211640.982627330.98929480.99770720.999133652220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188641.00.02.25272044539.6930.26029885667224040000000.00.01381478511969.2850.00.00.00.00.00.00.94589752.05458192.9461390.94589752.05458192.946139-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.10341264S000
99993489153168p030122950002EXP316.833435058593753.007141590118408100000000.0100000000.00.0 .. 400.08.987329521.72029140.68844251.42634638.413250.00.01438.5999329.5641862.797160.765517060.303371550.00.00.77373940.841309250.907145740.985421660.991021630.998078350.999273962220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188640.00.00.00.00.00.00.00.01.369110135064.0270.305224873585341800000000.00.3904959674129.821.53351523.80949887.364681.53351523.80949887.36468-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.08665627S000
99993503533168p032122950003REX316.694152832031253.139270782470703100000000.0100000000.00.0 .. 400.05.0910349.34048612.55983510.06506254.7303690.00.01438.5999329.5641862.797160.76626450.303659620.00.00.76753540.83675920.90437560.98496760.99074120.99801810.99925122220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188640.00.00.00.00.00.00.00.00.3377284169316.80.00.00.00.02.625645.07035837.2194312.625645.07035837.219431-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.08937585S000
99993489103156p030122950004REX315.73654174804692.961479902267456100000000.0100000000.00.0 .. 400.07.086883512.30801317.8656318.97903813.1494930.00.01438.5999329.5641862.797160.76680590.303868230.00.00.76482260.834765850.90315990.9847680.99061790.99799160.99924122220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188640.00.00.00.00.00.00.00.00.539675252387.740.00.00.00.02.89771065.26320558.0347352.89771065.26320558.034735-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.090571955S000
99993503503160p032122950005REX316.0344238281253.1479761600494385100000000.0100000000.00.0 .. 400.03.48730878.58363718.41975841.61551734.8971980.00.01438.5999329.5641862.797160.767202560.304021060.00.00.69631770.78363290.871530230.97949180.9873550.99728960.99897572220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188640.00.00.00.00.00.00.00.00.5795746462183.2850.00.00.00.01.35949733.49531157.8779551.35949733.49531157.877955-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.12227176S000
99993503523165p032122950006EXP316.52816772460943.1505260467529297100000000.0100000000.00.0 .. 400.017.535530.59009235.04615430.46732325.9492990.00.01438.5999329.5641862.797160.766538860.303765330.00.00.776234030.84313550.908255760.98560330.99113380.99810240.99928312220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188640.00.00.00.00.00.00.00.01.9385298111514.130.167990982.0947942e+180.22540268479212.71.89176183.37196663.96026561.89176183.37196663.9602656-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.08556887S000
99993489133163p030122950007EXP316.44247436523443.0266659259796143100000000.0100000000.00.0 .. 400.011.43500319.76164627.02107426.71289623.5398060.00.01438.5999329.5641862.797160.76612830.303607140.00.00.764510150.83453620.90301970.98474490.99060360.99798850.999240042220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188640.00.00.00.00.00.00.00.01.682414910659.6920.61413485197292170000000.00.2675438238836.3831.49766222.65072543.72529131.49766222.65072543.7252913-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.09070997S000
99993474743166p027122950008EXP316.5646972656252.8542842864990234100000000.0100000000.00.0 .. 400.03.42293989.517735515.59044635.63717321.915070.00.01438.5999329.5641862.797160.765236850.303263570.00.00.78289180.848000050.911207440.98608530.99143150.99816640.99930722220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188640.00.00.00.00.00.00.00.01.221741428707.9240.208498692741240300000000.00.1090413334746.4260.668876951.9157283.2459920.668876951.9157283.245992-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.08268376S000
99993489133163p030122950009REX316.4421386718752.884831666946411100000000.0100000000.00.0 .. 400.04.77771048.80663512.28693810.2966367.7250240.00.01438.5999329.5641862.797160.765529450.303376320.00.00.77934650.845411360.909637630.98582910.99127330.99813240.99929442220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188640.00.00.00.00.00.00.00.00.39460093130255.7660.00.00.00.02.31190974.4770146.60100752.31190974.4770146.6010075-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.08421701S000
.........................................................................................................................................................................................................................................................................................................
99993489143166p030122950091DEV316.5876464843752.9565248489379883100000000.0100000000.00.0 .. 400.039.91417761.9960894.3691689.00951465.556630.00.01438.5999329.5641862.797160.76563560.303417240.00.00.77594040.842920660.90812530.985581930.991120640.99809960.9992822220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188641.00.050.7781834.0766740.006465615279916320000000.00.424492276232.2310.00.00.00.00.00.01.99570883.0998044.7184581.99570883.0998044.718458-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.08569665S000
99993489113158p030122950092DEV315.81008911132813.014225482940674100000000.0100000000.00.0 .. 400.09.44276516.95539328.90482935.50477224.6321470.00.01438.5999329.5641862.797160.766932670.303917050.00.00.74297340.81862610.893269840.98313530.98960890.99777470.999159162220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188641.00.01.251002732735.7290.00629051548.7176945e+180.02426355336455.2930.00.00.00.00.00.02.19592294.11604937.3648822.19592294.11604937.364882-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.10036307S000
99993489133163p030122950093DEV316.40682983398442.968167781829834100000000.0100000000.00.0 .. 400.014.12385230.29021548.41070645.695831.4750480.00.01438.5999329.5641862.797160.76592860.303530160.00.00.763517740.83380630.902574240.98467170.99055840.99797880.999236352220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188641.00.01.926653939178.94-0.0432687254.6311996e+180.00280028721503613.60.00.00.00.00.00.02.42834665.42151839.067632.42834665.42151839.06763-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.091148786S000
99993489153168p030122950094REX316.97415161132812.9544930458068848100000000.0100000000.00.0 .. 400.010.61111120.9508231.26286136.30241826.5528850.00.01438.5999329.5641862.797160.76510670.303213420.00.00.780800760.846473630.91028210.98593430.991338250.998146360.999299652220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188640.00.00.00.00.00.00.00.01.201623630821.3030.00.00.00.02.11162284.29566536.6325462.11162284.29566536.632546-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.083587244S000
99993474733163p027122950095DEV316.37179565429692.799359083175659100000000.0100000000.00.0 .. 400.04.105347615.31588332.6238449.61883537.020610.00.01438.5999329.5641862.797160.76526460.303274270.00.00.78993330.85313030.91431230.986590860.99174360.99823340.999332552220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188641.00.00.809483753882.1450.163841023176630000000000.00.0975312537813.3870.00.00.00.00.00.01.2364924.828343410.8257831.2364924.828343410.825783-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.079658955S000
99993489133163p030122950096REX316.44662475585943.0077035427093506100000000.0100000000.00.0 .. 400.011.18018616.3590322.62161815.32102314.4200460.00.01438.5999329.5641862.797160.76604230.303573970.00.00.76532940.83513850.903387250.98480530.990640940.997996570.9992432220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188640.00.00.00.00.00.00.00.00.412502271260.40.00.00.00.05.3020838.14596111.8971055.3020838.14596111.897105-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.09034816S000
99993489163171p030122950097REX317.09582519531252.9794046878814697100000000.0100000000.00.0 .. 400.02.862845210.847918519.55929836.44873431.1714460.00.01438.5999329.5641862.797160.7650470.30319040.00.00.78740340.851288740.913198770.98640970.991631750.998209360.99932352220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188640.00.00.00.00.00.00.00.00.984650239336.3870.00.00.00.00.70840642.77628335.20140930.70840642.77628335.2014093-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.08074262S000
99993503533168p032122950098EXP316.720397949218753.2825276851654053100000000.0100000000.00.0 .. 400.07.451283514.45545723.13822226.89451420.4727460.00.01438.5999329.5641862.797160.76683980.30388130.00.00.74689990.82153790.895060360.9834320.98979230.99781420.999174062220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188640.00.00.00.00.00.00.00.01.795790614877.2210.0335084543.400451e+160.1244367470225.080.89311841.77253482.91253780.89311841.77253482.9125378-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.098582454S000
99993474733163p027122950099DEV316.36035156252.7383956909179688100000000.0100000000.00.0 .. 400.032.54759244.4243150.1697339.94362630.0144860.00.01438.5999329.5641862.797160.76502470.303181830.00.00.795608340.8572540.916802170.98699530.991993250.998286960.99935282220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188641.00.02.238431235845.2540.063583662.455279e+180.057227373184377.390.00.00.00.00.00.04.92875966.9952778.2570044.92875966.9952778.257004-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.07724071S000
99993460343166p025122950100REX316.6174316406252.5801117420196533100000000.0100000000.00.0 .. 400.04.30548411.63343516.26611127.12273422.5215720.00.01438.5999329.5641862.797160.764028250.30279780.00.00.79634280.8577870.91712360.987047430.992025430.99829390.999355442220.00.00.00.00.00.01.01.01.00.00.00.00052.4807477.72680571.870682157.54399513.1825682.51188640.00.00.00.00.00.00.00.00.25987935347452.530.00.00.00.02.40816936.86393810.186222.40816936.86393810.18622-10.00.00.00.00.00.00.00.000.0False0.01.00.01.00.01.000.07692902S000

In [8]:
objtr


Out[8]:
<Table length=100>
TARGETIDOIIFLUXHBETAFLUXEWOIIEWHBETAD4000VDISPOIIDOUBLETOIIIHBETAOIIHBETANIIHBETASIIHBETATRANSIENT_MODELTRANSIENT_TYPETRANSIENT_EPOCHTRANSIENT_RFLUXRATIOTRUEZ_NORSD
erg / (cm2 s)erg / (cm2 s)AngstromAngstromkm / sDexDexDexDexd
int64float32float32float32float32float32float32float32float32float32float32float32str20str10float32float32float32
122950001-1.08.870828e-17-1.03.51950031.307012487.6816560.778824570.62992240.28130755-0.97576165-0.4656399hsiaoIa4.00.81602810.0
122950002-1.00.0-1.00.01.693338579.6028060.741485060.56456360.20991385-1.1360153-0.6713571hsiaoIa-4.00.41405730.0
122950003-1.09.889676e-17-1.03.77801351.266271479.6028060.667103350.243239880.37400806-0.34835115-0.17972317hsiaoIa7.00.229549880.0
122950004-1.01.0823011e-16-1.04.8832331.388933287.6816560.692422-0.63610450.0983756-0.23645414-0.39118406hsiaoIa-5.00.957659360.0
122950005-1.05.307847e-17-1.02.65115931.40257987.6816560.7592538-0.0072159360.21859567-0.0012534182-0.21264657hsiaoIa12.00.294560130.0
122950006-1.02.5055094e-16-1.04.35701231.250361284.3217540.652733450.77453440.15142019-0.8983938-0.6740899hsiaoIa6.00.78419130.0
122950007-1.01.9854571e-16-1.04.10212851.247902384.3217540.664569850.57695970.17034702-1.0902989-0.4393439hsiaoIa-12.00.39014210.0
122950008-1.01.04032904e-16-1.05.41720151.180205279.6028060.7298952-0.304443240.66928250.011213212-0.044433285hsiaoIa-6.00.87175220.0
122950009-1.00.0-1.00.01.737440770.585110.74114350.281995530.46205333-0.49219698-0.33044997hsiaoIa2.00.660080550.0
...................................................
122950091-1.01.9279406e-16-1.01.687051.601822967.843190.75233520.0393269470.3813936-0.11169975-0.08833691hsiaoIa-13.00.77389590.0
122950092-1.00.0-1.00.01.548443762.920120.7588735-0.689043160.5103526-0.087232135-0.06413947hsiaoIa-13.00.76269220.0
122950093-1.00.0-1.00.01.643954667.803450.757023040.386196760.5784496-0.42178124-0.22919591hsiaoIa11.00.319223850.0
122950094-1.01.7652288e-16-1.04.0363311.53644667.843190.6791250.98035294-0.2831387-1.4538585-0.90769523hsiaoIa3.00.489605840.0
122950095-1.00.0-1.00.01.924891167.803450.78102220.635915160.19622882-0.9661813-0.51082635hsiaoIa7.00.303249720.0
122950096-1.00.0-1.00.01.851037667.843190.697476150.90953440.2406731-0.77056324-0.54578745hsiaoIa-8.00.903158370.0
122950097-1.01.6093957e-16-1.06.99430271.361673767.843190.69002473-0.031888330.4611288-0.0999768-0.33187115hsiaoIa9.00.7592150.0
122950098-1.00.0-1.00.01.64210171.846910.7128230.725055340.13574758-1.3457509-0.64145803hsiaoIa0.00.661811770.0
122950099-1.06.033641e-16-1.07.3129991.252805167.803450.657207670.0483503570.4058268-0.14150938-0.11031354hsiaoIa3.00.919316650.0
122950100-1.04.1460976e-16-1.019.409331.153451367.803450.69339260.667287950.13687317-1.0905042-0.48161605hsiaoIa0.00.68767370.0

Object Truth Data

Plot transient data from the objtruth table:

  1. Distribution of "epoch," time in days w.r.t. $t_0$.
  2. Distribution of transient/host flux ratio in $r$ band.

In [9]:
fig, axes = plt.subplots(1,2, figsize=(9,4), sharey=True)
ax = axes[0]
n, bins, patches = ax.hist(objtr['TRANSIENT_EPOCH'], bins=10, color='k', alpha=0.3)
x = 0.5*(bins[1:] + bins[:-1])
dx = 0.5*np.diff(bins)
ax.errorbar(x, n, xerr=dx, yerr=np.sqrt(n), fmt=',', color='k')
ax.set(xlabel='epoch [day]', ylabel='count')

ax = axes[1]
n, bins, patches = ax.hist(objtr['TRANSIENT_RFLUXRATIO'], bins=10, color='k', alpha=0.3)
x = 0.5*(bins[1:] + bins[:-1])
dx = 0.5*np.diff(bins)
ax.errorbar(x, n, xerr=dx, yerr=np.sqrt(n), fmt=',', color='k')
ax.set(xlabel=r'$r_\mathrm{trans}/r_\mathrm{host}$')

fig.tight_layout();


Plot Templates

Draw the first 10 templates generated from the mock catalog.


In [10]:
for i in range(10):
    plt.plot(wave, flux[i])


Observed Spectra

The spectra generated under observing conditions are stored in a single file. A FIBERMAP table provides a summary of target data for each object, and individual wavelength, flux, variance, resolution, and mask tables are present for each camera.

The data are best accessed using the read_spectra function from desispec, which packs everything into a single object.


In [11]:
spectra = read_spectra(spect_file)
hdus = fits.open(spect_file)
hdus.info()


Filename: ../../bgs_2020-03-08_0300s_001_spect.fits
No.    Name      Ver    Type      Cards   Dimensions   Format
  0  PRIMARY       1 PrimaryHDU      50   ()      
  1  FIBERMAP      1 BinTableHDU    164   100R x 76C   [K, K, K, K, K, D, D, D, D, K, K, 4A, J, D, K, E, E, E, E, E, I, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, 1A, J, K, K, J, K, J, J, J, J, J, 3A, E, E, E, K, B, I, D, D, E, E, E, E, E, E, J, J, J, J, J]   
  2  B_WAVELENGTH    1 ImageHDU        10   (2380,)   float64   
  3  B_FLUX        1 ImageHDU        11   (2380, 100)   float32   
  4  B_IVAR        1 ImageHDU        11   (2380, 100)   float32   
  5  B_MASK        1 ImageHDU        12   (2380, 100)   int32 (rescales to uint32)   
  6  B_RESOLUTION    1 ImageHDU        11   (2380, 9, 100)   float32   
  7  R_WAVELENGTH    1 ImageHDU        10   (2116,)   float64   
  8  R_FLUX        1 ImageHDU        11   (2116, 100)   float32   
  9  R_IVAR        1 ImageHDU        11   (2116, 100)   float32   
 10  R_MASK        1 ImageHDU        12   (2116, 100)   int32 (rescales to uint32)   
 11  R_RESOLUTION    1 ImageHDU        11   (2116, 9, 100)   float32   
 12  Z_WAVELENGTH    1 ImageHDU        10   (2399,)   float64   
 13  Z_FLUX        1 ImageHDU        11   (2399, 100)   float32   
 14  Z_IVAR        1 ImageHDU        11   (2399, 100)   float32   
 15  Z_MASK        1 ImageHDU        12   (2399, 100)   int32 (rescales to uint32)   
 16  Z_RESOLUTION    1 ImageHDU        11   (2399, 11, 100)   float32   

In [12]:
spectra.fibermap


Out[12]:
<Table length=100>
TARGETIDDESI_TARGETBGS_TARGETMWS_TARGETSECONDARY_TARGETTARGET_RATARGET_DECTARGET_RA_IVARTARGET_DEC_IVARBRICKIDBRICK_OBJIDMORPHTYPEPRIORITYSUBPRIORITYREF_IDPMRAPMDECREF_EPOCHPMRA_IVARPMDEC_IVARRELEASEFLUX_GFLUX_RFLUX_ZFLUX_W1FLUX_W2FLUX_IVAR_GFLUX_IVAR_RFLUX_IVAR_ZFLUX_IVAR_W1FLUX_IVAR_W2FIBERFLUX_GFIBERFLUX_RFIBERFLUX_ZFIBERFLUX_W1FIBERFLUX_W2FIBERTOTFLUX_GFIBERTOTFLUX_RFIBERTOTFLUX_ZFIBERTOTFLUX_W1FIBERTOTFLUX_W2MW_TRANSMISSION_GMW_TRANSMISSION_RMW_TRANSMISSION_ZEBVPHOTSYSOBSCONDITIONSNUMOBS_INITPRIORITY_INITNUMOBS_MOREHPXPIXELFIBERPETAL_LOCDEVICE_LOCLOCATIONFIBERSTATUSOBJTYPELAMBDA_REFFIBERASSIGN_XFIBERASSIGN_YFA_TARGETFA_TYPENUMTARGETFIBER_RAFIBER_DECFIBER_RA_IVARFIBER_DEC_IVARPLATEMAKER_XPLATEMAKER_YPLATEMAKER_RAPLATEMAKER_DECNUM_ITERSPECTROIDNIGHTEXPIDTILEID
int64int64int64int64int64float64float64float64float64int64int64bytes4int32float64int64float32float32float32float32float32int16float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32bytes1int32int64int64int32int64int32int32int32int32int32bytes3float32float32float32int64uint8int16float64float64float32float32float32float32float32float32int32int32int32int32int32
1229500011152921504606846976000316.15237426757812.9961693286895750.00.034891212295000100.000.00.00.00.00.006.28533213.13010218.01480517.5190610.2174331438.5999329.5641862.797160.766391460.303708520.94589752.05458192.9461390.00.00.94589752.05458192.9461390.00.00.73629650.81366310.890211640.10341264S000000031131105400.083.21898-286.66373000316.15237426757812.9961693286895750.00.00.00.00.00.0202020030800
1229500021152921504606846976000316.833435058593753.0071415901184080.00.034891512295000200.000.00.00.00.00.008.987329521.72029140.68844251.42634638.413251438.5999329.5641862.797160.765517060.303371551.53351523.80949887.364680.00.01.53351523.80949887.364680.00.00.77373940.841309250.907145740.08665627S000001027227205400.059.109577-273.27396000316.833435058593753.0071415901184080.00.00.00.00.00.0202020030800
1229500031152921504606846976000316.694152832031253.1392707824707030.00.035035312295000300.000.00.00.00.00.005.0910349.34048612.55983510.06506254.7303691438.5999329.5641862.797160.76626450.303659622.625645.07035837.2194310.00.02.625645.07035837.2194310.00.00.76753540.83675920.90437560.08937585S000002025225205400.031.751867-269.80435000316.694152832031253.1392707824707030.00.00.00.00.00.0202020030800
1229500041152921504606846976000315.73654174804692.9614799022674560.00.034891012295000400.000.00.00.00.00.007.086883512.30801317.8656318.97903813.1494931438.5999329.5641862.797160.76680590.303868232.89771065.26320558.0347350.00.02.89771065.26320558.0347350.00.00.76482260.834765850.90315990.090571955S000003015615605400.00.18432418-221.17873000315.73654174804692.9614799022674560.00.00.00.00.00.0202020030800
1229500051152921504606846976000316.0344238281253.14797616004943850.00.035035012295000500.000.00.00.00.00.003.48730878.58363718.41975841.61551734.8971981438.5999329.5641862.797160.767202560.304021061.35949733.49531157.8779550.00.01.35949733.49531157.8779550.00.00.69631770.78363290.871530230.12227176S000004019819805400.0-19.776659-253.03535000316.0344238281253.14797616004943850.00.00.00.00.00.0202020030800
1229500061152921504606846976000316.52816772460943.15052604675292970.00.035035212295000600.000.00.00.00.00.0017.535530.59009235.04615430.46732325.9492991438.5999329.5641862.797160.766538860.303765331.89176183.37196663.96026560.00.01.89176183.37196663.96026560.00.00.776234030.84313550.908255760.08556887S000005020420405400.041.488995-240.11723000316.52816772460943.15052604675292970.00.00.00.00.00.0202020030800
1229500071152921504606846976000316.44247436523443.02666592597961430.00.034891312295000700.000.00.00.00.00.0011.43500319.76164627.02107426.71289623.5398061438.5999329.5641862.797160.76612830.303607141.49766222.65072543.72529130.00.01.49766222.65072543.72529130.00.00.764510150.83453620.90301970.09070997S000006023323305400.014.601016-264.20517000316.44247436523443.02666592597961430.00.00.00.00.00.0202020030800
1229500081152921504606846976000316.5646972656252.85428428649902340.00.034747412295000800.000.00.00.00.00.003.42293989.517735515.59044635.63717321.915071438.5999329.5641862.797160.765236850.303263570.668876951.9157283.2459920.00.00.668876951.9157283.2459920.00.00.78289180.848000050.911207440.08268376S000007017217205400.017.358227-226.7752000316.5646972656252.85428428649902340.00.00.00.00.00.0202020030800
1229500091152921504606846976000316.4421386718752.8848316669464110.00.034891312295000900.000.00.00.00.00.004.77771048.80663512.28693810.2966367.7250241438.5999329.5641862.797160.765529450.303376322.31190974.4770146.60100750.00.02.31190974.4770146.60100750.00.00.77934650.845411360.909637630.08421701S000008031031005400.073.0176-288.79773000316.4421386718752.8848316669464110.00.00.00.00.00.0202020030800
1229500101152921504606846976000316.51187133789062.9339671134948730.00.034891412295001000.000.00.00.00.00.006.374146516.33318522.80775530.30836922.5931511438.5999329.5641862.797160.76564260.303419951.14378363.0148234.3482490.00.01.14378363.0148234.3482490.00.00.77579730.842815940.90806160.08575897S000009029029005400.055.85053-283.17615000316.51187133789062.9339671134948730.00.00.00.00.00.0202020030800
....................................................................................................................................................................................................................................
1229500911152921504606846976000316.5876464843752.95652484893798830.00.034891412295009100.000.00.00.00.00.0039.91417761.9960894.3691689.00951465.556631438.5999329.5641862.797160.76563560.303417241.99570883.0998044.7184580.00.01.99570883.0998044.7184580.00.00.77594040.842920660.90812530.08569665S0000090026926905400.028.508-279.7112000316.5876464843752.95652484893798830.00.00.00.00.00.0202020030800
1229500921152921504606846976000315.81008911132813.0142254829406740.00.034891112295009200.000.00.00.00.00.009.44276516.95539328.90482935.50477224.6321471438.5999329.5641862.797160.766932670.303917052.19592294.11604937.3648820.00.02.19592294.11604937.3648820.00.00.74297340.81862610.893269840.10036307S0000091024624605400.0-29.461878-282.7649000315.81008911132813.0142254829406740.00.00.00.00.00.0202020030800
1229500931152921504606846976000316.40682983398442.9681677818298340.00.034891312295009300.000.00.00.00.00.0014.12385230.29021548.41070645.695831.4750481438.5999329.5641862.797160.76592860.303530162.42834665.42151839.067630.00.02.42834665.42151839.067630.00.00.763517740.83380630.902574240.091148786S0000092034534505400.025.688492-317.2147000316.40682983398442.9681677818298340.00.00.00.00.00.0202020030800
1229500941152921504606846976000316.97415161132812.95449304580688480.00.034891512295009400.000.00.00.00.00.0010.61111120.9508231.26286136.30241826.5528851438.5999329.5641862.797160.76510670.303213422.11162284.29566536.6325460.00.02.11162284.29566536.6325460.00.00.780800760.846473630.91028210.083587244S0000093030230205400.0-8.5949-305.9973000316.97415161132812.95449304580688480.00.00.00.00.00.0202020030800
1229500951152921504606846976000316.37179565429692.7993590831756590.00.034747312295009500.000.00.00.00.00.004.105347615.31588332.6238449.61883537.020611438.5999329.5641862.797160.76526460.303274271.2364924.828343410.8257830.00.01.2364924.828343410.8257830.00.00.78993330.85313030.91431230.079658955S0000094036736705400.042.842823-322.85312000316.37179565429692.7993590831756590.00.00.00.00.00.0202020030800
1229500961152921504606846976000316.44662475585943.00770354270935060.00.034891312295009600.000.00.00.00.00.0011.18018616.3590322.62161815.32102314.4200461438.5999329.5641862.797160.76604230.303573975.3020838.14596111.8971050.00.05.3020838.14596111.8971050.00.00.76532940.83513850.903387250.09034816S0000095038838805400.039.591503-332.79407000316.44662475585943.00770354270935060.00.00.00.00.00.0202020030800
1229500971152921504606846976000317.09582519531252.97940468788146970.00.034891612295009700.000.00.00.00.00.002.862845210.847918519.55929836.44873431.1714461438.5999329.5641862.797160.7650470.30319040.70840642.77628335.20140930.00.00.70840642.77628335.20140930.00.00.78740340.851288740.913198770.08074262S0000096026526505400.0-12.30921-288.31976000317.09582519531252.97940468788146970.00.00.00.00.00.0202020030800
1229500981152921504606846976000316.720397949218753.28252768516540530.00.035035312295009800.000.00.00.00.00.007.451283514.45545723.13822226.89451420.4727461438.5999329.5641862.797160.76683980.30388130.89311841.77253482.91253780.00.00.89311841.77253482.91253780.00.00.74689990.82153790.895060360.098582454S0000097024824805400.0-9.055862-278.4183000316.720397949218753.28252768516540530.00.00.00.00.00.0202020030800
1229500991152921504606846976000316.36035156252.73839569091796880.00.034747312295009900.000.00.00.00.00.0032.54759244.4243150.1697339.94362630.0144861438.5999329.5641862.797160.76502470.303181834.92875966.9952778.2570040.00.04.92875966.9952778.2570040.00.00.795608340.8572540.916802170.07724071S0000098030830805400.052.594242-293.08817000316.36035156252.73839569091796880.00.00.00.00.00.0202020030800
1229501001152921504606846976000316.6174316406252.58011174201965330.00.034603412295010000.000.00.00.00.00.004.30548411.63343516.26611127.12273422.5215721438.5999329.5641862.797160.764028250.30279782.40816936.86393810.186220.00.02.40816936.86393810.186220.00.00.79634280.8577870.91712360.07692902S0000099028528505400.04.852069-293.90848000316.6174316406252.58011174201965330.00.00.00.00.00.0202020030800

Coadd Files

The coadds are generated using the desi_coadd_spectra program available in desispec. For example, to add data across the cameras run

desi_coadd_spectra -i bgs_2020-03-08_0150s_001_spect.fits -o bgs_2020-03-08_0150s_001_coadd.fits --coadd-cameras

The data can then be accessed using the read_spectra function.


In [13]:
coadds = read_spectra(coadd_file)
hdus = fits.open(coadd_file)
hdus.info()


Filename: ../../bgs_2020-03-08_0300s_001_coadd.fits
No.    Name      Ver    Type      Cards   Dimensions   Format
  0  PRIMARY       1 PrimaryHDU      52   ()      
  1  FIBERMAP      1 BinTableHDU    196   100R x 92C   [K, K, K, K, K, D, D, D, D, K, K, 4A, J, D, K, E, E, E, E, E, I, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, E, 1A, J, K, K, J, K, J, J, J, J, J, 3A, E, E, E, K, B, I, D, D, E, E, E, E, E, E, J, J, J, J, J, I, K, K, K, K, K, K, K, K, K, K, K, K, K, K, K]   
  2  BRZ_WAVELENGTH    1 ImageHDU        10   (6265,)   float64   
  3  BRZ_FLUX      1 ImageHDU        11   (6265, 100)   float32   
  4  BRZ_IVAR      1 ImageHDU        11   (6265, 100)   float32   
  5  BRZ_MASK      1 ImageHDU        12   (6265, 100)   int32 (rescales to uint32)   
  6  BRZ_RESOLUTION    1 ImageHDU        11   (6265, 11, 100)   float32   
  7  SCORES        1 BinTableHDU     30   100R x 9C   [D, D, D, D, D, D, D, D, D]   

In [14]:
coadds.fibermap


Out[14]:
<Table length=100>
TARGETIDDESI_TARGETBGS_TARGETMWS_TARGETSECONDARY_TARGETTARGET_RATARGET_DECTARGET_RA_IVARTARGET_DEC_IVARBRICKIDBRICK_OBJIDMORPHTYPEPRIORITYSUBPRIORITYREF_IDPMRAPMDECREF_EPOCHPMRA_IVARPMDEC_IVARRELEASEFLUX_GFLUX_RFLUX_ZFLUX_W1FLUX_W2FLUX_IVAR_GFLUX_IVAR_RFLUX_IVAR_ZFLUX_IVAR_W1FLUX_IVAR_W2FIBERFLUX_GFIBERFLUX_RFIBERFLUX_ZFIBERFLUX_W1FIBERFLUX_W2FIBERTOTFLUX_GFIBERTOTFLUX_RFIBERTOTFLUX_ZFIBERTOTFLUX_W1FIBERTOTFLUX_W2MW_TRANSMISSION_GMW_TRANSMISSION_RMW_TRANSMISSION_ZEBVPHOTSYSOBSCONDITIONSNUMOBS_INITPRIORITY_INITNUMOBS_MOREHPXPIXELFIBERPETAL_LOCDEVICE_LOCLOCATIONFIBERSTATUSOBJTYPELAMBDA_REFFIBERASSIGN_XFIBERASSIGN_YFA_TARGETFA_TYPENUMTARGETFIBER_RAFIBER_DECFIBER_RA_IVARFIBER_DEC_IVARPLATEMAKER_XPLATEMAKER_YPLATEMAKER_RAPLATEMAKER_DECNUM_ITERSPECTROIDNIGHTEXPIDTILEIDCOADD_NUMEXPFIRST_NIGHTLAST_NIGHTNUM_NIGHTFIRST_EXPIDLAST_EXPIDNUM_EXPIDFIRST_TILEIDLAST_TILEIDNUM_TILEIDFIRST_SPECTROIDLAST_SPECTROIDNUM_SPECTROIDFIRST_FIBERLAST_FIBERNUM_FIBER
int64int64int64int64int64float64float64float64float64int64int64bytes4int32float64int64float32float32float32float32float32int16float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32float32bytes1int32int64int64int32int64int32int32int32int32int32bytes3float32float32float32int64uint8int16float64float64float32float32float32float32float32float32int32int32int32int32int32int16int64int64int64int64int64int64int64int64int64int64int64int64int64int64int64
1229500011152921504606846976000316.15237426757812.9961693286895750.00.034891212295000100.000.00.00.00.00.006.28533213.13010218.01480517.5190610.2174331438.5999329.5641862.797160.766391460.303708520.94589752.05458192.9461390.00.00.94589752.05458192.9461390.00.00.73629650.81366310.890211640.10341264S000000031131105400.083.21898-286.66373000316.15237426757812.9961693286895750.00.00.00.00.00.0202020030800120200308202003081001001001001
1229500021152921504606846976000316.833435058593753.0071415901184080.00.034891512295000200.000.00.00.00.00.008.987329521.72029140.68844251.42634638.413251438.5999329.5641862.797160.765517060.303371551.53351523.80949887.364680.00.01.53351523.80949887.364680.00.00.77373940.841309250.907145740.08665627S000001027227205400.059.109577-273.27396000316.833435058593753.0071415901184080.00.00.00.00.00.0202020030800120200308202003081001001001111
1229500031152921504606846976000316.694152832031253.1392707824707030.00.035035312295000300.000.00.00.00.00.005.0910349.34048612.55983510.06506254.7303691438.5999329.5641862.797160.76626450.303659622.625645.07035837.2194310.00.02.625645.07035837.2194310.00.00.76753540.83675920.90437560.08937585S000002025225205400.031.751867-269.80435000316.694152832031253.1392707824707030.00.00.00.00.00.0202020030800120200308202003081001001001221
1229500041152921504606846976000315.73654174804692.9614799022674560.00.034891012295000400.000.00.00.00.00.007.086883512.30801317.8656318.97903813.1494931438.5999329.5641862.797160.76680590.303868232.89771065.26320558.0347350.00.02.89771065.26320558.0347350.00.00.76482260.834765850.90315990.090571955S000003015615605400.00.18432418-221.17873000315.73654174804692.9614799022674560.00.00.00.00.00.0202020030800120200308202003081001001001331
1229500051152921504606846976000316.0344238281253.14797616004943850.00.035035012295000500.000.00.00.00.00.003.48730878.58363718.41975841.61551734.8971981438.5999329.5641862.797160.767202560.304021061.35949733.49531157.8779550.00.01.35949733.49531157.8779550.00.00.69631770.78363290.871530230.12227176S000004019819805400.0-19.776659-253.03535000316.0344238281253.14797616004943850.00.00.00.00.00.0202020030800120200308202003081001001001441
1229500061152921504606846976000316.52816772460943.15052604675292970.00.035035212295000600.000.00.00.00.00.0017.535530.59009235.04615430.46732325.9492991438.5999329.5641862.797160.766538860.303765331.89176183.37196663.96026560.00.01.89176183.37196663.96026560.00.00.776234030.84313550.908255760.08556887S000005020420405400.041.488995-240.11723000316.52816772460943.15052604675292970.00.00.00.00.00.0202020030800120200308202003081001001001551
1229500071152921504606846976000316.44247436523443.02666592597961430.00.034891312295000700.000.00.00.00.00.0011.43500319.76164627.02107426.71289623.5398061438.5999329.5641862.797160.76612830.303607141.49766222.65072543.72529130.00.01.49766222.65072543.72529130.00.00.764510150.83453620.90301970.09070997S000006023323305400.014.601016-264.20517000316.44247436523443.02666592597961430.00.00.00.00.00.0202020030800120200308202003081001001001661
1229500081152921504606846976000316.5646972656252.85428428649902340.00.034747412295000800.000.00.00.00.00.003.42293989.517735515.59044635.63717321.915071438.5999329.5641862.797160.765236850.303263570.668876951.9157283.2459920.00.00.668876951.9157283.2459920.00.00.78289180.848000050.911207440.08268376S000007017217205400.017.358227-226.7752000316.5646972656252.85428428649902340.00.00.00.00.00.0202020030800120200308202003081001001001771
1229500091152921504606846976000316.4421386718752.8848316669464110.00.034891312295000900.000.00.00.00.00.004.77771048.80663512.28693810.2966367.7250241438.5999329.5641862.797160.765529450.303376322.31190974.4770146.60100750.00.02.31190974.4770146.60100750.00.00.77934650.845411360.909637630.08421701S000008031031005400.073.0176-288.79773000316.4421386718752.8848316669464110.00.00.00.00.00.0202020030800120200308202003081001001001881
1229500101152921504606846976000316.51187133789062.9339671134948730.00.034891412295001000.000.00.00.00.00.006.374146516.33318522.80775530.30836922.5931511438.5999329.5641862.797160.76564260.303419951.14378363.0148234.3482490.00.01.14378363.0148234.3482490.00.00.77579730.842815940.90806160.08575897S000009029029005400.055.85053-283.17615000316.51187133789062.9339671134948730.00.00.00.00.00.0202020030800120200308202003081001001001991
....................................................................................................................................................................................................................................................................................
1229500911152921504606846976000316.5876464843752.95652484893798830.00.034891412295009100.000.00.00.00.00.0039.91417761.9960894.3691689.00951465.556631438.5999329.5641862.797160.76563560.303417241.99570883.0998044.7184580.00.01.99570883.0998044.7184580.00.00.77594040.842920660.90812530.08569665S0000090026926905400.028.508-279.7112000316.5876464843752.95652484893798830.00.00.00.00.00.020202003080012020030820200308100100100190901
1229500921152921504606846976000315.81008911132813.0142254829406740.00.034891112295009200.000.00.00.00.00.009.44276516.95539328.90482935.50477224.6321471438.5999329.5641862.797160.766932670.303917052.19592294.11604937.3648820.00.02.19592294.11604937.3648820.00.00.74297340.81862610.893269840.10036307S0000091024624605400.0-29.461878-282.7649000315.81008911132813.0142254829406740.00.00.00.00.00.020202003080012020030820200308100100100191911
1229500931152921504606846976000316.40682983398442.9681677818298340.00.034891312295009300.000.00.00.00.00.0014.12385230.29021548.41070645.695831.4750481438.5999329.5641862.797160.76592860.303530162.42834665.42151839.067630.00.02.42834665.42151839.067630.00.00.763517740.83380630.902574240.091148786S0000092034534505400.025.688492-317.2147000316.40682983398442.9681677818298340.00.00.00.00.00.020202003080012020030820200308100100100192921
1229500941152921504606846976000316.97415161132812.95449304580688480.00.034891512295009400.000.00.00.00.00.0010.61111120.9508231.26286136.30241826.5528851438.5999329.5641862.797160.76510670.303213422.11162284.29566536.6325460.00.02.11162284.29566536.6325460.00.00.780800760.846473630.91028210.083587244S0000093030230205400.0-8.5949-305.9973000316.97415161132812.95449304580688480.00.00.00.00.00.020202003080012020030820200308100100100193931
1229500951152921504606846976000316.37179565429692.7993590831756590.00.034747312295009500.000.00.00.00.00.004.105347615.31588332.6238449.61883537.020611438.5999329.5641862.797160.76526460.303274271.2364924.828343410.8257830.00.01.2364924.828343410.8257830.00.00.78993330.85313030.91431230.079658955S0000094036736705400.042.842823-322.85312000316.37179565429692.7993590831756590.00.00.00.00.00.020202003080012020030820200308100100100194941
1229500961152921504606846976000316.44662475585943.00770354270935060.00.034891312295009600.000.00.00.00.00.0011.18018616.3590322.62161815.32102314.4200461438.5999329.5641862.797160.76604230.303573975.3020838.14596111.8971050.00.05.3020838.14596111.8971050.00.00.76532940.83513850.903387250.09034816S0000095038838805400.039.591503-332.79407000316.44662475585943.00770354270935060.00.00.00.00.00.020202003080012020030820200308100100100195951
1229500971152921504606846976000317.09582519531252.97940468788146970.00.034891612295009700.000.00.00.00.00.002.862845210.847918519.55929836.44873431.1714461438.5999329.5641862.797160.7650470.30319040.70840642.77628335.20140930.00.00.70840642.77628335.20140930.00.00.78740340.851288740.913198770.08074262S0000096026526505400.0-12.30921-288.31976000317.09582519531252.97940468788146970.00.00.00.00.00.020202003080012020030820200308100100100196961
1229500981152921504606846976000316.720397949218753.28252768516540530.00.035035312295009800.000.00.00.00.00.007.451283514.45545723.13822226.89451420.4727461438.5999329.5641862.797160.76683980.30388130.89311841.77253482.91253780.00.00.89311841.77253482.91253780.00.00.74689990.82153790.895060360.098582454S0000097024824805400.0-9.055862-278.4183000316.720397949218753.28252768516540530.00.00.00.00.00.020202003080012020030820200308100100100197971
1229500991152921504606846976000316.36035156252.73839569091796880.00.034747312295009900.000.00.00.00.00.0032.54759244.4243150.1697339.94362630.0144861438.5999329.5641862.797160.76502470.303181834.92875966.9952778.2570040.00.04.92875966.9952778.2570040.00.00.795608340.8572540.916802170.07724071S0000098030830805400.052.594242-293.08817000316.36035156252.73839569091796880.00.00.00.00.00.020202003080012020030820200308100100100198981
1229501001152921504606846976000316.6174316406252.58011174201965330.00.034603412295010000.000.00.00.00.00.004.30548411.63343516.26611127.12273422.5215721438.5999329.5641862.797160.764028250.30279782.40816936.86393810.186220.00.02.40816936.86393810.186220.00.00.79634280.8577870.91712360.07692902S0000099028528505400.04.852069-293.90848000316.6174316406252.58011174201965330.00.00.00.00.00.020202003080012020030820200308100100100199991

Spectral Scores

Per-camera median coadded fluxes and SNRs are available in a scores table.

The code below computes a total SNR and adds it to the table.


In [15]:
if 'MEDIAN_COADD_SNR' not in coadds.scores.columns:
    totsnr = None
    for cam in 'BRZ':
        camsnr = coadds.scores['MEDIAN_COADD_SNR_{}'.format(cam)]
        if totsnr is None:
            totsnr = camsnr**2
        else:
            totsnr += camsnr**2
    totsnr = np.sqrt(totsnr)
    coadds.scores.add_column(Column(totsnr, name='MEDIAN_COADD_SNR'))

coadds.scores


Out[15]:
<Table length=100>
INTEG_COADD_FLUX_BMEDIAN_COADD_FLUX_BMEDIAN_COADD_SNR_BINTEG_COADD_FLUX_RMEDIAN_COADD_FLUX_RMEDIAN_COADD_SNR_RINTEG_COADD_FLUX_ZMEDIAN_COADD_FLUX_ZMEDIAN_COADD_SNR_ZMEDIAN_COADD_SNR
float64float64float64float64float64float64float64float64float64float64
5215.2219389250863.04265391826629641.216105582980266001.1673872672653.325556159019472.05068204013563235424.1012508370692.45861554736686741.8265711667995453.0034266839851522
7366.9166165822574.1796963214874271.606310033189249710016.0568232104345.5702605247497563.153320077626061511628.2000633549365.3102579116821293.57241354609507465.028498580988928
3902.3936188961212.1631618738174440.57444708367779084128.7233908467112.3276709318161010.97021645523278883839.50001973767941.68461054563522340.83340027015409281.4020932323648494
5742.1063354366973.23960137367248541.2679592310259195471.6457560625462.94335015965415541.85706053679664045429.363042821262.4280174970626831.8370553105720082.903647131276816
3068.0122210213861.85524207353591920.38752209798210353779.41395840587352.1337250985081370.69428211978193524813.49426056112952.10747605730187540.83395976402572691.1522542802208178
14701.1114057611898.414471149444582.67258710973134313191.5908497604217.2293825149536133.50450747571111711042.2592627153544.9767446517944342.96271015944920535.310550441839412
9325.5231713418735.21539942387868651.78723408288095568758.9164831293244.7493729591369632.6338436706345368121.0343391718753.70629417896270752.43989930210073424.010541952497766
2778.9594356068341.61366969347000120.82300414473001474399.4626987423712.42149758338928221.8990455229817574376.7486961246891.97572427988052371.7954983381376512.7399861318727337
4001.22605492273852.2669712305068970.69802407981255833935.34298612784052.13676822185516361.05125053343467643707.4629262915461.70447063446044920.98986024115540331.6038044135944673
5869.3737965323783.34463324564618741.42608156301478727179.0065233438993.90523265266769842.5922294038585177090.8829888526233.23604428768157962.57284125790113643.9208256840820765
..............................
31134.57634848585817.1791400909423833.997484533281113528054.90988685189615.5162529945373545.37199077013978427538.33242218262212.463941574096685.2131740131961018.486185875889822
7315.2157676937254.12470617827992751.63926372994541057733.7665091620264.2725338935852052.55223426809606048428.9943525429773.81363439559936522.76879560526836874.106983618096352
11651.0415116274566.7477684020996091.360024920806050613767.6084209215467.6512539386749272.409214250888920714009.3054419666866.3203804492950442.41864864298320863.6747574545953756
8687.9084985722735.02842640876771.49044571620497659417.9619116596425.16176533699035642.3524397662634539455.9738305503054.1858637332916262.3457199340555823.641126651996211
3653.0111092347712.2332093291210250.89763188195888297538.4602961205174.1694973634575542.6090350606856649437.001171427054.2632368536218963.07097038291343164.128397514305952
8876.7909782953254.8459002971649170.94398141199274127084.949702465483.85691645668003421.178796116314776835.3971877375953.13817024230957031.14544744703224071.8954448142690075
2827.0996260422321.671656072139740.78352639450675844983.7527691006552.75326013565063481.96340979522435685555.9227037667042.5718160867691042.16779634025421733.027908949702961
6277.1505426704643.5619151592254641.18056816613346936608.8848922748083.62281906604766851.89278974143512366769.6308754370643.05508589744567871.93408093243561252.952467316225667
25543.3735563520314.35644531252.85664836630411319444.2773355829610.6789981573414163.29266147601162214803.9763288002216.58710765838623052.49774362705763945.024020572293274
4018.68044186754922.25988090038299561.01418813920781764910.11024624589752.5950168065921061.80327238388492324889.9492507993512.1625842590861721.85443170738313562.7783602771310565

Plot Results

To visualize the results, the templates, camera data, and coadds for the first 10 spectra in the input files listed at the top of this notebook are plotted.


In [16]:
from scipy.signal import medfilt

fig, axes = plt.subplots(10,3, figsize=(14,30), sharex=True)
for i in range(10):
    axes[i,0].plot(wave, flux[i], alpha=0.7, label='template')
    axes[i,0].legend()
    
    for _filt, _col in zip(spectra.bands, ['b', 'r', 'saddlebrown']):
        wl = spectra.wave[_filt]
        fl = spectra.flux[_filt][i]
        axes[i,1].plot(wl, fl, color=_col, alpha=0.7, label=_filt)
    axes[i,1].legend()
    
    axes[i,2].plot(coadds.wave['brz'], coadds.flux['brz'][i], alpha=0.7, label='coadd')
    axes[i,2].plot(coadds.wave['brz'], medfilt(coadds.flux['brz'][i], 149), color='yellow')
    axes[i,2].legend()

fig.tight_layout();



In [ ]: