Spectral library — species 0.1.2 documentation

# Spectral library

    [1]:

    import species
    species.SpeciesInit()

    Initiating species v0.1.0... [DONE]
    Creating species_config.ini... [DONE]
    Database: /Users/tomasstolker/applications/species/docs/tutorials/species_database.hdf5
    Data folder: /Users/tomasstolker/applications/species/docs/tutorials/data
    Working folder: /Users/tomasstolker/applications/species/docs/tutorials
    Creating species_database.hdf5... [DONE]
    Creating data folder... [DONE]

    [1]:

    <species.core.setup.SpeciesInit at 0x103bf8f28>

    [2]:

    database = species.Database()

    [3]:

    database.add_spectrum(spec_library='irtf',
                          sptypes=['L', 'T'])

    Downloading IRTF Spectral Library - L dwarfs (850 kB)... [DONE]
    Downloading IRTF Spectral Library - T dwarfs (100 kB)... [DONE]
    Unpacking IRTF Spectral Library... [DONE]
    Adding IRTF Spectral Library... 2MASS J05591915-1404489

    /Users/tomasstolker/.pyenv/versions/3.6.0/envs/general3.6/lib/python3.6/site-packages/astroquery/simbad/core.py:138: UserWarning: Warning: The script line number 3 raised an error (recorded in the `errors` attribute of the result table): Identifier not found in the database : 2MASS J05591915-1404489
      (error.line, error.msg))

    Adding IRTF Spectral Library... [DONE]

    /Users/tomasstolker/applications/species/species/data/queries.py:209: UserWarning: No parallax was found for 2MASS J05591915-1404489 so storing a NaN value.
      warnings.warn(f'No parallax was found for {target} so storing a NaN value.')

    [4]:

    read_spectrum = species.ReadSpectrum(spec_library='irtf',
                                         filter_name=None)

    [5]:

    specbox = read_spectrum.get_spectrum(sptypes=['L0', 'L1'])

    [6]:

    read_spectrum = species.ReadSpectrum(spec_library='irtf',
                                         filter_name='MKO/NSFCam.H')

    Adding filter: MKO/NSFCam.H... [DONE]

    [7]:

    photbox = read_spectrum.get_flux(sptypes=['L0', 'L1'])

    [8]:

    specbox.open_box()

    Opening SpectrumBox...

    spectrum = None
    wavelength = [array([0.8125008, 0.8125008, 0.8127338, ..., 4.126095 , 4.1269007,
           4.127706 ], dtype=float32)
     array([0.93558633, 0.93558633, 0.93585825, ..., 2.416591  , 2.4171278 ,
           2.417665  ], dtype=float32)
     array([0.8106775 , 0.8106775 , 0.81091094, ..., 4.113586  , 4.1143913 ,
           4.1151967 ], dtype=float32)]
    flux = [array([1.8895840e-14, 1.8895840e-14, 2.1758479e-14, ..., 3.7088523e-15,
           4.1113438e-15, 4.4284915e-15], dtype=float32)
     array([-1.0867816e-15, -1.0867816e-15,  2.5373139e-15, ...,
            2.0060095e-15,  2.1450817e-15,  2.2615936e-15], dtype=float32)
     array([3.8497135e-15, 3.8497135e-15, 2.5441878e-15, ..., 1.3200795e-15,
           1.2305833e-15, 1.0569799e-15], dtype=float32)]
    error = None
    name = [b'2MASS J07464256+2000321' b'2MASS J02081833+2542533'
     b'2MASS J14392836+1929149']
    simbad = [b'LSPM J0746+2000' b'2MASSW J0208183+254253' b'2MASS J14392836+1929149']
    sptype = [b'L0' b'L1' b'L1']
    distance = [11.60092807 23.65777607 14.36781609]
    spec_library = irtf

    [9]:

    species.plot_spectrum(boxes=[specbox, photbox],
                          filters=['MKO/NSFCam.J', 'MKO/NSFCam.H', 'MKO/NSFCam.Ks'],
                          xlim=(0.9, 2.5),
                          ylim=(0., 8.5e-14),
                          offset=(-0.08, -0.05),
                          legend=(0.6, 0.75),
                          output='spectrum.png')

    Adding filter: MKO/NSFCam.J... [DONE]
    Adding filter: MKO/NSFCam.Ks... [DONE]
    Plotting spectrum: spectrum.png... [DONE]

    [10]:

    from IPython.display import Image
    Image('spectrum.png')

    [10]: