GithubHelp home page GithubHelp logo

cconroy20 / fsps Goto Github PK

View Code? Open in Web Editor NEW
84.0 17.0 48.0 1.4 GB

Flexible Stellar Population Synthesis

License: MIT License

TeX 0.01% Prolog 0.01% Makefile 0.01% Fortran 0.30% Ruby 99.59% sed 0.08% IDL 0.01%

fsps's Introduction

FSPS: Flexible Stellar Population Synthesis

version 3.2

References

When using this code please cite the following papers:

  • Conroy, Gunn, & White 2009, ApJ, 699, 486
  • Conroy & Gunn 2010, ApJ, 712, 833

Installation

If you have git installed, FSPS can be obtained with the following commands:

cd /path/to/desired/location/
git clone https://github.com/cconroy20/fsps

Otherwise download a gzipped tarball from here. Then follow the instructions at doc/INSTALL.

You should not need to update the git repository until an update is announced (which is why you need to be on the mailing list - see doc/INSTALL). If you've obtained FSPS using git then when an update is announced you will need to simply type cd $SPS_HOME; git pull and then recompile. If you have made your own edits to the FSPS files, git will attempt to gracefully merge your local version with the repository version.

Documentation

See the Manual

Contents

Below is a brief description of the contents of the directories in the fsps root directory:

  • ISOCHRONES: Contains the isochrone tables for the BaSTI and Padova isochrone sets. The Geneva isochrones have been pasted onto the BaSTI and Padova tables for high masses (M>70Msun), and the low-mass Lyon models have been pasted on at low masses. You should not edit these files unless you know what you're doing.

  • OUTPUTS: Contains the outputs of a few example calls of the routines autosps and simple. You may wish to use this directory for all outputs of the fsps routines.

  • SPECTRA: Contains the spectral libraries, the spectrum of an A0V star used to set the Vega magnitude zero points, and a spectrum of the Sun. The BaSeL spectra (based on the Kurucz models) are in binary format, primarily to make the read in time faster and to decrease the size of the fsps download. The Hot_spectra directory contain the libraries for O stars, WR stars, and post-AGB stars, from Smith et al. 2002 and Rauch 2003, respectively.

  • data: Contains files that define the set of filters and indices used in FSPS and the tabulated imfs and sfhs if those options are set. The files in this directory are readily user editable.

  • doc: Contains the manual, revision history, and installation instructions.

  • dust: Contains the dust attenuation curves for the Witt & Gordon (2000) dust model and the dust emission spectra from the Draine & Li 2007 grain model. Also contains the circumstellar dust models from Villaume et al. 2015 and the AGN dusty torus models of Nenkova et al. 2008.

  • nebular: Contains the Cloudy lookup tables for nebular emission (both continuum and line emission) computed by Nell Byler.

  • pro: Contains IDL files for reading in the .mag, .indx, and .spec output files

  • src: Contains the source files and routines from Numerical Recipes.

fsps's People

Contributors

bd-j avatar cconroy20 avatar dfm avatar jonathansick avatar jrleja avatar mjpark-astro avatar philrosenfield avatar saethlin avatar vulpicastor avatar

Stargazers

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

Watchers

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

fsps's Issues

Rebinning templates

Hi,

Prospector uses the templates from FSPS. The high-res templates of FSPS significantly affect the execution time. Does FSPS have low-res templates, too, or is it possible to rebin the high-res templates?

Cheers,

Steve

Problem reading MILES library

I am using a Mac 10.12.6, gcc 7.1.0 (but also tried with v6.3.0), and I am finding a problem when running the first instruction in prospector tutorial:

python prospector.py --param_file=demo_params.py --objid=0 --outfile=demo_obj0
gives the following error:

SPS_SETUP ERROR: miles spectral library cannot be opened Z=0.

It seems that something is being truncated.

ages

I am pretty new to this code and I want to plot the spectra at time of 13 Gyr after the big bang in python.
I set the input parameter as sfh=2 to give a tabulated SFH, Chabrier IMF and including no dust.
Here is part of my code:

sp = fsps.StellarPopulation( sfh=2, imf_type=1, sf_start=0.9)
#sfh_filename='sfh.dat'

wave, spec = sp.get_spectrum(tage=13)

and I keep getting this error:

COMPSP ERROR, maxtime too small: 7.7640709935062136E-007

I am using the default file (sfh.dat file in data diractory) and the time values in this file begins from 0.96 Gyr up to 13 Gyr, so I think the time shouldn't be the problem.
I don't know what other initial parameters I need to add to my code and what is "maxtime" parameter is referred to.
Any help on that will be appreciated.

gfortran issue when installing fsps

Hello,

I am installing fsps into a linux machine. After I edited the SPS_HOME path and go to src folder to run make, I got the following error:

gfortran -O3 -cpp -fPIC sps_utils.f90 -c
sps_utils.f90:6.11:

   USE sps_vars
       1

Fatal Error: File 'sps_vars.mod' opened at (1) is not a GNU Fortran module file
make: *** [sps_utils.o] Error 1

I think this is the fortran complier issue? I tried each of the "Compiler Optimizations" available in Makefile but none of them works. Thanks for your help!

--Xinfeng

Linux version:
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"

gfortran version:
GNU Fortran (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)
Copyright (C) 2015 Free Software Foundation, Inc.

Compilation failing on Mac

Dear Dr. Conroy,

I installed fsps and tried running the makefile according to the instructions in doc/install. I got the following error:

emolter% make
gfortran -O -cpp -o compsp.o -c compsp.f90
/var/folders/n5/1jbgx2wd1bb0jklpmpgj8qz00000gp/T//ccTPwlZr.s:167:suffix or operands invalid for `movq'

(the final line, the one with the error, repeated itself 13 times)

My gfortran is up-to-date with version 6.1.0. The line I added to my .tcshrc is the following:
setenv SPS_HOME /Users/emolter/Python/fsps

What can I do to get the makefile to work?

Thanks!

Ned

Current version didn't compile

Hi,

I compiled with intel today and I had to change the RETURN in line 21 of autosps.f90 to STOP, in order to have a compilation free of errors.

question: "better" value of duste_qpah?

I don't have a figure handy to share, but I'm finding that when I turn on the Draine & Li dust emission option (modeling SDSS + unWISE photometry) I get a whopping ~3 micron PAH emission line. I mentioned this to @bd-j and he reminded me that this is a known issue in the dust models and can be tuned using the duste_qpah parameter.

The default value (in python-fsps) of duste_qpah is 3.5 (documented http://dan.iel.fm/python-fsps/current/stellarpop_api/?highlight=pah. Is there more recent work -- or a paper someone can point me to -- suggesting a revised (but physically motivated) alternative value?

Or is there another parameter (or more) I should look at?

more extinction models?

It would be useful to have a couple more options for the extinction curve, specifically the Reddy et al (2015) model and the SMC model as given by Gordon et al (2003). Any chance of adding these to the code?

Mid-IR spectra resolution

Hi,

I am producing some mid-IR SEDs (5-35 μm) and I am estimating that the resolution is ~1500A@15μm (is that correct?). Is there any way that I can increase the resolution of the produced spectrum?

Use BPASS models in FSPS

Hello,

I am trying to use FSPS models by doing fits by Prospector. I found in the manual that BPASS model is now included in FSPS (section 1.16 of the manual). But I found it is not clear how to use BPASS in FSPS. Specifically, my question is:

How to use BPASS on in Prospector code? When I load FSPS models, I just did "build_sps(**run_params)" and I don't know if this reads the BPASS models by default.

Thanks for your help!

-Xinfeng

Error in SPS_SETUP

Hi,
I am now using the Python version of the program. When executing commands such as StellarPopulation, an error "SPS_SETUP ERROR: xsp_feh-2.00.spec cannot be opened" pops up and Python terminates (compilation fails). I found that there is no such file in the folder SPECTRA/xrb/.

For reference, I am using macOS Sonoma (14.0) on my Intel Mac. I also tried compiling the code on a Mac Mini running on M2 chip and similar OS, didn't work either. Python version on both machines is 3.8.18. Gfortran on both machines was installed via brew (GCC version 13.2.0).

Do you have any hints on the cause of the problem and/or how to fix it?

Dust parameters : opacity, optical depth, or Av ?

Hello, I am a little confused about the dust parameters settings and how to set/obtain dust reddening in Av.

The documentation says :

dust2 Dust parameter describing the attenuation of old stellar light, i.e. where $t >dust_tesc$ (for
details, see Conroy et al. 2009a). Specifically, it is the opacity at 5500˚ A. $Default value is 0.0$.

I am a little confused about the statement here. Should the opacity here be optical depth?
(Because $\tau = \int \kappa \rho dx$, and it is $\tau$ that is directly linked with Av, or extinction in magnitude.)

And can I get Av values directly from the code or I need to calculate it myself?

Forgive me if the question seems to be silly. I am not very familiar with the code. I am mainly concerned with is the magnitude, Av and colors of galaxies in my current work.

Thank you.

Nebular emission with multiple metallicities in SSPs

It would be great if it was possible to compute nebular emission even when SSPs of multiple metallicities are being used (e.g. with metallicity evolution in tabular SFH). This will require alterations to the addition of nebular emission in compsp. A slow implementation my be fairly straightforward (adding the nebular emission to every SSP at every likelihood call), an optimized version that only adds nebular emission to the relevant SSPs (or does it after the fact using nebular emission weighted by ssp_weights) would be more difficult.

cannot compile using BASTI

SPS_SETUP ERROR: nebular cont file cannot be opened. Only available for Padova or MIST isochrones.

The nebular/cloudly file is switched off in sps_vars

N_ion

would be nice to cache the computed number of ionizing photons used for nebular photometry, since the ionizing spectrum is subsequently removed and possibly attenuated, making this number difficult to recover.

sfh=2 fail: nzin > 1 no longer supported

I'm on the most recent commit and am running into an issue when running with SFH=2. Everything else I set as default:

thundersnow:src desika$ ./autosps.exe
 enter IMF [0-5; def:0]:
  (0=Salpeter, 1=Chabrier 2003, 2=Kroupa 2001, 3=van Dokkum 2008, 4=Dave 2008, 5=tabulated)
1
 ---> Using IMF 1

 Specify SFH [0-2, def:0]
 (0=SSP, 1=CSP, 2=tabulated)
^C
thundersnow:src desika$ ./autosps.exe
 enter IMF [0-5; def:0]:
  (0=Salpeter, 1=Chabrier 2003, 2=Kroupa 2001, 3=van Dokkum 2008, 4=Dave 2008, 5=tabulated)

 ---> Using IMF 0

 Specify SFH [0-2, def:0]
 (0=SSP, 1=CSP, 2=tabulated)
2
 ---> Computing a tabulated SFH

 Include default dust model? [yes/no, def:no]
 (default: tau1=1.0, tau2=0.3, MW extinction)

 ---> tau1=  0.00, tau2=  0.00

 Enter filename [def: "CSP.out"]

 ---> Output filename: CSP.out
 ---> Running model.......

 COMPSP ERROR: nzin > 1 no longer supported.

Am I doing something wrong with my sps_vars by any chance? The only thing I've done differently is to zero MIST and one PADOVA. MY _sps_vars is pasted here:

http://paste.yt-project.org/show/6880/

thanks
-desika

Problems with importing fsps

I have successfully compiled and installed python-fsps. To do that, I had to make a slight change to the init.py file and add the line os.environ["SPS_HOME"] = "/home/nevil/fsps".
I did this because even after several attempts of adding a export SPS_HOME="/home/nevil/fsps", while running the installation python-fsps setup, I used to get the error SPS_HOME environment not found or not defined. This tweak allows me to successfully install python FSPS, but I am facing an issue when I import fsps. I am getting the following error when I import fsps in python2.7

import fsps

File "build/bdist.linux-x86_64/egg/fsps/init.py", line 62, in
File "build/bdist.linux-x86_64/egg/fsps/fsps.py", line 9, in
File "build/bdist.linux-x86_64/egg/fsps/_fsps.py", line 7, in
File "build/bdist.linux-x86_64/egg/fsps/_fsps.py", line 6, in bootstrap
ImportError: /home/nevil/.cache/Python-Eggs/fsps-0.3.0-py2.7-linux-x86_64.egg-tmp/fsps/fsps.so: undefined symbol: sps_setup

undefined symbol: sps_setup_

Please can somebody help me resolve this issue.

Import Failure

I've tried installing python-fsps using pip and from source, making sure my FSPS repo is checked out to tag v3.2, but I keep getting this error:

>>> import fsps
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/claire/miniconda3/lib/python3.7/site-packages/fsps/__init__.py", line 21, in <module>
    from .fsps import StellarPopulation  # noqa
  File "/home/claire/miniconda3/lib/python3.7/site-packages/fsps/fsps.py", line 8, in <module>
    from ._fsps import driver
ImportError: numpy.core.multiarray failed to import

I thought it was an issue with FSPS version based on the RuntimeError, but the ImportError also suggests that I'm using too new of a NumPy version? Here's the output from installing with pip:

$ pip install fsps --no-cache-dir --no-binary fsps
Collecting fsps
  Downloading fsps-0.4.1.tar.gz (97 kB)
     |████████████████████████████████| 97 kB 2.9 MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: numpy in ./miniconda3/lib/python3.7/site-packages (from fsps) (1.19.2)
Building wheels for collected packages: fsps
  Building wheel for fsps (PEP 517) ... done
  Created wheel for fsps: filename=fsps-0.4.1-cp37-cp37m-linux_x86_64.whl size=397583 sha256=e297a57f35e23d7d75df3772dc29d2b0d38a78bbbcdbeb2f22e7ef95f1f52b35
  Stored in directory: /tmp/pip-ephem-wheel-cache-bcohr8yb/wheels/9a/3e/f2/f089f13bd1ef9a2d95b86a10613b50e42e6e56b15b3320c7c9
Successfully built fsps
Installing collected packages: fsps
Successfully installed fsps-0.4.1

Any help is much appreciated!

Cannot compile fsps

Hi

While trying to compile fsps in Ubuntu I got this error

gfortran -O3 -march=native -cpp -o sps_vars.o -c sps_vars.f90
f951: internal compiler error: Illegal instruction
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.
Makefile:81: recipe for target 'sps_vars.o' failed
make: *** [sps_vars.o] Error 1

Changed the flags, included -fPIC but nothing worked or gave me the same error when trying to make.

Do you have a hint what may be the problem?

sp.stellar_mass variation

Hello FSPS people!
I hope you're doing well.

I've been exploring various SPSs, and I noticed that in FSPS, the sp.stellar_mass parameter shows some variation in the mass fraction between logage 5 to 6.3. For comparison, I observed a decreasing behaviour in the mass fractions of the Bruzual & Charlot SPS. @bd-j suggested that "is due to some numerical issues in the interaction of the IMF upper limit with the sampling of the high mass end of the isochrones at very early age" on dfm/python-fsps#66, but we'd like to know if it's true and if the mass fractions could be improved.

Could you provide some insights into this?

Thanks in advance for your guidance!

A note on SDSS a) magnitudes from fluxes for faint targets and b) zeropoint shifts for all targets

For fainter targets, the formula in the equation (2) of the manual (v 3.1) is not exactly correct for SDSS magnitudes, because SDSS uses asinh magnitudes with the "softening parameter" term for very faint objects.

Also, SDSS zero points for u and z bands have a slight shift from AB system, for all targets.

Just a note, in case somebody's science question needs a very precise determination.

References:
https://www.sdss.org/dr12/algorithms/magnitudes/
http://www.sdss3.org/dr8/algorithms/fluxcal.php#SDSStoAB

Thank you very much,
Maria

Resolution array

It would be nice to have an array, specific to each spectral library, that indicates the library resolution as a function of wavelength.

"SPS_SETUP ERROR: wavelength grid cannot be opened"

Hi,
When I use prospector, and run sps = build_sps(**run_params)
I met this error :"SPS_SETUP ERROR: wavelength grid cannot be opened"
I run prospector under Conda environment.
The version as following:
fsps: 0.4.6
prospect: 1.2.0

maxtime in compsp

Ran into an issue when trying to generate CSPs using the Geneva isochrones. The Geneva isochrones only go up to 100 Myr (logt=8.0), which generates an error at
line 549 in compsp.f90

  IF (maxtime.LE.1E8.AND.pset%sfh.NE.0) THEN
     WRITE(*,*) 'COMPSP ERROR, maxtime too small:',maxtime
     STOP
  ENDIF

I ran into this error when trying to generate populations with constant star formation histories; the maximum age in the Geneva isochrones being 1E8 meant that I got an error when trying to calculate any CSP.

Geneva isochrones aside, does this mean that it isn't possible to generate populations with constant star formation over anything less than 100 Myr? (i.e. trying to return a spectrum with tage anything less than 100 Myr would always raise this error regardless of the isochrone being used).

compilation fail on yosemite

I have an issue and the fix as well, but wanted to post this here for posterity.

In Mac OS X Yosemite compiling with gfortran gives:

gfortran -O -cpp -o sps_vars.o -c sps_vars.f90
gfortran: warning: couldn’t understand kern.osversion ‘14.5.0
gfortran -O -cpp -o sps_utils.o -c sps_utils.f90
gfortran: warning: couldn’t understand kern.osversion ‘14.5.0
...
.....

the way to fix this is to do (for bash):

export MACOSX_DEPLOYMENT_TARGET=10.9

and then it'll work.

Mailing List

Not really an issue, but could you add instructions on how to subscribe to the mailing list in the README file? So far the list is only mentioned:

You should not need to update the git repository until an update is
announced (which is why you need to be on the mailing list). When an
update is announced, you will need to simply type "git pull" in the
root fsps directory. If you have made your own edits to the fsps
files, git will attempt to gracefully merge your local version with
the repository version.

If it is private, you could say, it is invitation-only. Thank you!

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.