The SKIRT project
advanced radiative transfer for astrophysics
pts.storedtable.do.fsps_to_stored_table Namespace Reference

Convert FSPS-generated SED family to stored table format. More...

Functions

"Convert FSPS-generated SED family to stored table format" do ((str,"filepath pattern of the FSPS files to be converted") infilepath,(str,"filepath of the resulting stored table file") outfilepath)

Detailed Description

Convert FSPS-generated SED family to stored table format.

This script converts data representing a family of SEDs for single stellar populations generated by the FSPS code (see Conroy, Gunn, & White (2009, ApJ) and Conroy & Gunn (2010, ApJ)) to SKIRT stored table format. This enables users to generate customized FSPS SED families and use them with SKIRT.

The SKIRT FSPSSEDFamily class offers built-in FSPS SED families generated using the default MIST isochrones and the default MILES spectral libraries, excluding dust attenuation and emission as well as nebular emission, for each of the Salpeter, Chabrier and Kroupa IMFs. If one of these built-in SED families suits your use case, you don't need this script.

Users who need one or more FSPS SED families generated with other settings than the built-in families can use the SKIRT FileSSPSEDFamily class, after following the workflow described below to create the appropriate resources.

  • Download the FSPS code from https://github.com/cconroy20/fsps and follow the installation instructions.
  • Adjust the compile-time options in sps_vars.f90 to your needs.
  • Create a new Fortran program (or adjust one of the provided example programs) to drive the FSPS engine. SKIRT needs just the ".spec" output files, so you can skip outputting anything else. However, you do need to generate a ".spec" file for each metallicity index in the table applicable to the isochrone set of your choice. For example:

       ...
       CALL SPS_SETUP(-1)
       DO i = 1, 12
           pset%zmet = i
           WRITE(filename,"(I0.2)") i
           filename = 'FSSP_' // TRIM(imf_name) // '_' // TRIM(filename)
           CALL SSP_GEN(pset,mass_ssp,lbol_ssp,spec_ssp)
           CALL COMPSP(2,1,filename,mass_ssp,lbol_ssp,spec_ssp,pset,ocompsp)
       END DO
       ...
    
  • Adjust your Fortran program to set any global and local (pset) run-time parameter values that differ from the defaults provided by FSPS.
  • Compile and run your program; this should output a separate ".spec" output file for each metallicity value.
  • Run this script to convert the set of ".spec" files into a single SKIRT stored table file (".stab").
  • Place the stored table file in the SKIRT input directory or in some common location.
  • Configure a FileSSPSEDFamily instance in the SKIRT parameter file, specifying the name of the stored table (if it resides in the SKIRT input directory) or the absolute path to the stored table (if it resides in a common location).

This script expects two arguments:

  • A file path pattern for the files generated by FSPS: in other words a file path where the string "*" will be replaced by some metallicity identifier in the filename. For example: "~/FSSP/FSSP_MyTemplates_*.spec". See the note below.
  • A file path and/or filename for the stored table file, or "." to place the file in the current directory with a default name.
Note
The first argument must be included in quotes to keep the shell from expanding the asterisks into multiple file names. The pattern is used only for locating the files; the actual metallicity values are obtained from the file contents, and the files are automatically sorted as needed.