Skip to main content

SpeX Prism Library Analysis Toolkit

Project description

# SPLAT: The SpeX Prism Library Analysis Toolkit

## Preamble

SPLAT is a python package built upon numpy, scipy, astropy and matplotlib, as well as some other common packages. SPLAT is designed to interface specifically with the SpeX Prism Library (SPL: http://www.browndwarfs.org/spexprism), an online repository of over 1500 low-resolution, near-infrared spectra of low-temperature stars and brown dwarfs. SPLAT tools allow you to search the library; read in spectra from it; perform basic spectral analyses such as classification, index measurement and spectrophotometry; perform advanced analyses such as spectral model fitting and spectral binary analysis; and plot/tabulate your results.

## Installation and Dependencies

SPLAT is best forked from this github site, which is updated on a semi-regular basis. SPLAT has not yet reached v1.0, so bugs are rampant. Please help us knock them down by sending bug reports to aburgasser@ucsd.edu or noting them on the github page (“Issues”)

Documentation on setting up and using SPLAT are maintained at http://www.browndwarfs.org/splat

There are two additional steps to complete to get full functionality:

  • Copy the file .splat_access into your home directory - this is your access key

  • Set up your environment variables to find the SPLAT code; this can be done in three ways (in the order of which the code looks for this directory):

    • Best: create an environment variable called SPLAT_PATH and set it to the root directory of the SPLAT code (in bsh environment, add the line export SPLAT_PATH=/Users/adam/projects/splat to your .bashrc or .bash_profile)

    • If you use the PYTHONPATH environment variable, add the root directory of the SPLAT code to it (in bsh environment add the line export PYTHONPATH=/Users/adam/projects/splat:${PYTHONPATH} to your .bashrc or .bash_profile)

    • add the root directory of the SPLAT code to your system PATH variable (in bsh environment add the line export PATH=/Users/adam/projects/splat:${PATH} to your .bashrc or .bash_profile)

## Using SPLAT

The best place to start is the code documentation, housed at http://www.browndwarfs.org/splat

Here are some examples:

  • The best way to read in a spectrum is to use getSpectrum:

` import splat splist = splat.getSpectrum(shortname='0415-0935') splist = splat.getSpectrum(young=True) splist = splat.getSpectrum(spt=['M7','L5'],jmag=[14.,99.]) `

In each case, splist is a list of Spectrum objects, which is a container of various aspects of the spectrum and it source. For example, selecting the first spectrum,

` sp = splist[0] `

sp.wave gives the wavelength values of this spectrum, sp.flux the flux values, and sp.noise the flux uncertainty.

You can also read in your own spectrum by passing the Spectrum object a filename:

` sp = splat.pectrum(filename='myspectrum.fits',local=True) `

Note that this file must conform to the standard of the SPL data: the first column is wavelength in microns, second column flux in f_lambda units, third column (optional) is flux uncertainty.

  • To flux calibrate the spectrum, use the object’s built in fluxCalibrate() method:

` sp = splat.getSpectrum(shortname='0415-0935')[0] sp.fluxCalibrate('2MASS J',14.0) `

  • To display the spectrum, use the Spectrum object’s plot function or plotSpectrum

` sp.plot() splat.plotSpectrum(sp) `

which will pop up a window displaying flux and noise vs. wavelength. You can save this display by adding a filename:

` splat.plotSpectrum(sp,file='spectrum.png') `

You can also compare multiple spectra:

` sp1 = splat.getSpectrum(shortname='0415-0935')[0] sp2 = splat.getSpectrum(shortname='1217-0311')[1] splat.plotSpectrum(sp1,sp2,colors=['k','r']) `

  • To measure spectral indices, use measureIndex or measureIndexSet:

` sp = splat.getSpectrum(shortname='0415-0935')[0] value, error = splat.measureIndex(sp,[1.14,1.165],[1.21,1.235],method='integrate') indices = splat.measureIndexSet(sp,set='burgasser') `

Note that the latter is a dictionary, whose value,error pair can be accessed by the name of the index:

` print indices['H2O-J'] # returns value, error `

  • To classify a spectrum, use the classifyByXXX methods:

` sp = splat.getSpectrum(shortname='0415-0935')[0] spt,unc = splat.classifyByIndex(sp,set='burgasser') spt,unc = splat.classifyByStandard(sp) spt,unc = splat.classifyByTemplate(sp,spt=['M7','L0']) `

  • To compare a spectrum to another spectrum or a model, use compareSpectra:

` sp = splat.getSpectrum(shortname='0415-0935')[0] mdl = splat.loadModel(teff=700,logg=5.0,set='BTSettl2008') # currently BTSettl08 only chi,scale = splat.compareSpectra(sp,mdl) mdl.scale(scale) splat.plotSpectrum(sp,mdl,colors=['k','r']) `

There is a prototype MCMC fitting program that can determine the best fitting model to a spectrum as well

` sp = splat.getSpectrum(shortname='0415-0935')[0] table = splat.modelFitMCMC(sp,initial_guess=[800,5.0,0.],nsamples=1000,step_sizes=[50.,0.5,0.]) `

All of these routines have many options worth exploring, and we are continually adding additional functionality. If there are capabilities you need, please suggest them, or even better contribute your own code!

## Authors

SPLAT is an experimental, collaborative project of research students in Adam Burgasser’s UCSD Cool Star Lab, aimed at teaching students how to do research by building their own analysis tools. Contributors to SPLAT include Christian Aganze, Daniella Bardalez Gagliuffi, Adam Burgasser (PI), Caleb Choban, Ivanna Escala, Aishwarya Iyer, Yuhui Jin, Mike Lopez, Alex Mendez, Gretel Mercado, Johnny Parra, Maitrayee Sahi, Melisa Tallis, Tomoki Tamiya and Chris Theissen.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SPLAT-0.32.tar.gz (4.5 MB view details)

Uploaded Source

Built Distribution

SPLAT-0.32-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file SPLAT-0.32.tar.gz.

File metadata

  • Download URL: SPLAT-0.32.tar.gz
  • Upload date:
  • Size: 4.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for SPLAT-0.32.tar.gz
Algorithm Hash digest
SHA256 b73db07bef9bd4c3ae06a7bbc1f1848f00715f98dd58bfed8660654822621c4e
MD5 f69defc9fc2c25fa4413e52433487126
BLAKE2b-256 30559e5b394d4d81b8dc8e0fad7c08e85a13188a70a115e5596e35f702ff9325

See more details on using hashes here.

File details

Details for the file SPLAT-0.32-py3-none-any.whl.

File metadata

File hashes

Hashes for SPLAT-0.32-py3-none-any.whl
Algorithm Hash digest
SHA256 e3446cbc765725c788827dd88a71898c7525d58a18b156f64d040d5fa0a83165
MD5 d388c09f3baa1070c68342fe458db4d5
BLAKE2b-256 26b733a69deb7c2fa54b1befd1a2a228e7fcd2a251f01f59ee647482566899cf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page