Giter VIP home page Giter VIP logo

easygalaxy's Introduction

EzGal

EzGal calculates observables (apparent magnitude, absolute magnitude, k-corrections, e-corrections, masses, mass-to-light-ratios, and distance moduli) of stellar populations as a function of redshift, given the formation redshift. It can also generate spectral-energy distributions (SEDs) of complex-stellar populations (CSPs) from simple-stellar populations (SSPs). It takes as a primary input grids of SEDs as a function of age which can be read from plain text files, the Bruzual and Charlot binary ised files, and its own format stored in binary fits tables. It can pre-grid observables as a function of redshift and formation redshift and store the results in its own fits files to perform quick lookups later.

Install

pip install ezgal

Example Usage

import ezgal
from pylab import *

# load an EzGal model file
model = ezgal.model( 'bc03_ssp_z_0.02.fits' )

# get a grid of redshifts out to the desired formation redshift
zf = 3
zs = model.get_zs( zf )

# plot mass-to-light ratio evolution versus redshift for three filters
plot( zs, model.get_rest_ml_ratios( zf, filters='sloan_i', zs=zs ), 'k-', label='Sloan i' )
plot( zs, model.get_rest_ml_ratios( zf, filters='ks', zs=zs ), 'r--', label='2MASS Ks' )
plot( zs, model.get_rest_ml_ratios( zf, filters='ch2', zs=zs ), 'b:', label='IRAC ch2' )

# and set labels for the plot
xlabel( 'z' )
ylabel( 'M/L Ratio' )

# how about a legend?
legend()

# all done
show()

Which makes:

alt tag

API

Full API documentation can be viewed online in html and pdf formats.

Testing

python test.py

Contributors

Conor Mancone and Anthony Gonzalez

Acknowledgements

We gratefully acknowledge the authors of the primary model sets included in this project for giving us permission to redistribute their work in this way. We especially thank Charlie Conroy, Maurizio Salaris, Santi Cassisi, St´efane Charlot, Gustavo Bruzual, and Claudia Maraston for their input on this project. We are also grateful to our many collaborators - Adam Stanford, Peter Eisenhardt, Yen-Ting Lin, Greg Snyder, and others who have tested EzGal extensively and provided us with invaluable feedback.

License

MIT

easygalaxy's People

Contributors

boada avatar cmancone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

easygalaxy's Issues

problem with loading a filter

Hi. When I run the example,

plot( zs, model.get_rest_ml_ratios( zf, filters='sloan_i', zs=zs ), 'k-', label='Sloan i' )

I run into this error:
ValueError: Pass a numpy array with the vega spectrum to calculate vega conversion!

Similarly, I get the same error when I try to add a new filter.

Trouble reading BC03 .ised files

I'm having some trouble reading these files under python3.6. In the utils.py there is some reading of the binary files, line

junk = _read_binary(fh, type='c', number=80)
. The typecode c is deprecated after python3.5. I changed them to b, now I am getting another error.


IndexError Traceback (most recent call last)
in
----> 1 model2 = ezgal.model('/home/boada/Projects/BC2003/bc03/newiseds/1_0gyr_hr_m62_salp.ised')

~/.local/lib/python3.6/site-packages/ezgal/ezgal.py in init(self, model_file, is_ised, is_fits, is_ascii, has_masses, units, age_units, skip_load)
207 has_masses=has_masses,
208 units=units,
--> 209 age_units=age_units)
210
211 #####################

~/.local/lib/python3.6/site-packages/ezgal/ezgal.py in _load(self, model_file, is_ised, is_fits, is_ascii, has_masses, units, age_units)
247 # test for a bruzual-charlot binary ised file
248 if model_file[len(model_file) - 5:] == '.ised' or is_ised:
--> 249 self._load_ised(self.filename)
250 else:
251 # And then the rest.

~/.local/lib/python3.6/site-packages/ezgal/ezgal.py in _load_ised(self, file)
2507
2508 # read ised file
-> 2509 (seds, ages, vs) = utils.read_ised(file)
2510
2511 # store ages

~/.local/lib/python3.6/site-packages/ezgal/utils.py in read_ised(file)
477 sinds = vs.argsort()
478
--> 479 return (seds[sinds, :], ages, vs[sinds, :])

IndexError: too many indices for array

So now there is some indexing problems... @cmancone do you have a minute to look at this?

ModuleNotFoundError: No module named 'astro_filter'

Hi, I had successfully installed the EzGal python module. However, when I try to import the module through the web interface, it returns that ModuleNotFoundError: No module named 'astro_filter'. I was wondering if there are some suggestions on how to solve this problem. Thanks!

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.