Code Monkey home page Code Monkey logo

quarum's Introduction

quarum

Bayesian quasar spectrum modeling

This project is in the early development stage.

Usage

Fit a model to a spectrum

$ python spec_fit.py --single_NV -k=0.870763 -z=2.235563 -c=1 -n=1e4 -p=1 -s=data/SDSS_spectra/spSpec-51993-0542-631.fit -o output/spSpec-51993-0542-631 -b=1e3

Fit a model with two-component Ly-alpha and CIV emission lines (-c=2)

$ python spec_fit.py --single_NV -k=0.870763 -z=2.235563 -c=2 -n=1e4 -p=1 -s=data/SDSS_spectra/spSpec-51993-0542-631.fit -o output/spSpec-51993-0542-631_c2 -b=1e3

Now load and plot the fit results:

(I suggest you run from an ipython --pylab session.)

>>> from quarum import powergauss
>>> m = powergauss.PowerGaussMCMC.load('output/spSpec-51993-0542-631.mcmc')
>>> m.plot_spectra(thin=m.len()/10)

http://github.com/roban/quarum/raw/master/plots/spSpec-51993-0542-631.png

Load and plot the 2-component fit results:

>>> m2 = powergauss.PowerGaussMCMC.load('output/spSpec-51993-0542-631_c2.mcmc')
>>> m2.plot_spectra(thin=m2.len()/10)

http://github.com/roban/quarum/raw/master/plots/spSpec-51993-0542-631_c2.png

Plot the joint distributions of widths and shifts for the Ly-alpha line:

>>> import margplot
>>> al = margplot.marginal_plot([m.db.width_0[::100], m.db.vshift_0[::100]], color='k')
>>> margplot.marginal_plot([m2.db.width_0[::100], m2.db.vshift_0[::100]], axeslist=al, color='b')
>>> margplot.marginal_plot([m2.db.width_1[::100], m2.db.vshift_1[::100]], axeslist=al, color='g')
>>> al[0].set_xlabel('Width (Ang)')
>>> al[0].set_ylabel('V_Shift (km/s)')

http://github.com/roban/quarum/raw/master/plots/Lya_width_shift.png

If you aren't running from ipython --pylab, show the fits:

>>> import pylab
>>> pylab.show()

quarum's People

Contributors

roban avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.