Research Blog
Welcome to my Research Blog.
This is mostly meant to document what I am working on for myself, and to communicate with my colleagues. It is likely filled with errors!
This project is maintained by ndrakos
These are my notes on setting up and running FSPS: Flexible Stellar Population Synthesis, in order to generate SEDs.
You are instructed to add setenv SPS_HOME /home/user/fsps/
to .bashrc
file (where the dirctory is the path to the directory containing the src folder). Since I have a zsh shell, I actually added export SPS_HOME="/home/user/fsps/"
to ~/.zshrc
.
Then simply type make inside the src folder (may have to change fortran compiler, I didn’t need to).
I’m going to use the python inteface for running FSPS. To install this package, download the file, and then once inside the folder type python setup.py install
. This does require properly setting the SPS_HOME
environmental variable
If this installed properly, you should be able to import fsps
into python. For documentation, simply use help(fsps)
in python.
The first step in using fsps is to create an SPS object:
sps = fsps.StellarPopulation(zcontinuous=1)
Some variables, such as zontinuous
can only be set on initialization. Most can be set either during initialization, or afterwards, e.g. sps.params['tau'] = 5.0
.
Here is an example code to plot an SED, using the default properties:
import matplotlib.pyplot as plt
import fsps
sps = fsps.StellarPopulation()
tage = 10 # age of stellar population
lam, f_lam = sps.get_spectrum(tage=tage,peraa=True) #peraa=True returns f_lam versus f_nu
plt.loglog(lam, lam*f_lam)
plt.xlabel('$\lambda$ ($\AA$)')
plt.ylabel('$\lambda \, f_{\lambda}$')
plt.xlim(0.9e3, 1e6)
plt.ylim(1e-3, 1)
To match our mock catalogs, we want to get SEDs that are consistent with our assigned galaxy redshifts, masses, and integrated properties (whether it’s star forming, the UV magnitude and UV continuum slope). Some of these are specified in the SPS model, and others are indirectly dependent on set properties.
The redshift is specified in the SPS model, with the parameter zred
.
The stellar mass is stored in the variable sps.stellar_mass
, and is dependant on the stellar formation model and age.
You can get the UV magnitude using the function sps.get_mags()
. This can take a parameter bands
that specifies the filter (there are some filters built into FSPS, but you can also add your own).
The UV continuum slope can be measured from the spectrum.
I want to go through all the possible FSPS parameters carefully, and see which ones should be fixed, and which ones influence the properties we want to match. We then can either generate a “parent” catalog by varying these parameters, and match the outputs to our galaxies, or we can try and fit the output parameters.