CIGALE

A module to automate CIGALE. Currently works for a single galaxy. It generates a configuration file and runs the standard pcigale script. Requires pcigale already installed on the system.

frb.galaxies.cigale.gen_cigale_in(photometry_table, zcol, idcol=None, infile='cigale_in.fits', overwrite=True, **kwargs)[source]

Generates the input catalog from a photometric catalog.

Parameters:
  • photometry_table (astropy Table) –

    A table from some photometric catalog with magnitudes and error measurements. Currently supports DES, DECaLS, SDSS, Pan-STARRS and WISE

    The naming convention follows those specified in frb.galaxies.defs with the exception of WISE which use WISE-1, etc. although the code also handles WISE-W1, etc.

  • zcol (str) – Name of the column with redshift estimates

  • idcol (str, optional) – Name of the column with object IDs. By default, the code looks for the first column with “ID” in its name. If that’s not present, it creates a column with row numbers for IDs.

  • infile (str, optional) – Output name + path for the CIGALE input file generated

  • overwrite (bool, optional) – If true, overwrites file if it already exists

  • kwargs – only here to catch extras

frb.galaxies.cigale.run(photometry_table, zcol, data_file='cigale_in.fits', config_file='pcigale.ini', wait_for_input=False, save_sed=True, plot=True, outdir='out', **kwargs)[source]

Input parameters and then run CIGALE.

Parameters:
  • photometry_table (astropy Table) – A table from some photometric catalog with magnitudes and error measurements. Currently supports DES, DECaLS, SDSS, Pan-STARRS and WISE

  • zcol (str) – Name of the column with redshift estimates.

  • data_file (str, optional) – Root name for the photometry data file generated used as input to CIGALE

  • config_file (str, optional) – Root name for the file where CIGALE’s configuration is generated

  • wait_for_input (bool, optional) – If true, waits for the user to finish editing the auto-generated config file before running.

  • plot (bool, optional) – Plots the best fit SED if true

  • cores (int, optional) – Number of CPU cores to be used. Defaults to all cores on the system.

  • outdir (str, optional) – Path to the many outputs of CIGALE If not supplied, the outputs will appear in a folder named out/

  • save_sed (bool, optional) – Save the best fit SEDs to disk for each galaxy.

kwargs: These are passed into gen_cigale_in() and _initialise()
variables (str or list, optional):

A single galaxy property name to save to results or a list of variable names. Names must belong to the list defined in the CIGALE documentation.

sed_modules (list of ‘str’, optional):

A list of SED modules to be used in the PDF analysis. If this is being input, there should be a corresponding correct dict for sed_modules_params.

sed_module_params (dict, optional):

A dict containing parameter values for the input SED modules. Better not use this unless you know exactly what you’re doing.

frb.galaxies.cigale.host_run(host, cut_photom=None, cigale_file=None)[source]

Run CIGALE on an FRBGalaxy’s photometry and store results in a folder with the FRBGalaxy’s name. :param photom (astropy Table): galaxy photometry. Table columns

must be in the format ‘<SOURCE>_<BAND>’ and ‘<SOURCE>_<BAND>_err’. e.g. SDSS_u, SDSS_u_err, Pan-STARRS_g

Parameters:
  • (FRBGalaxy) (host)

  • (str (cigale_file) – CIGALE output file. Must be in the format <something>_CIGALE.fits. No file is renamed if nothing is provided.

  • optional) (Name of main) – CIGALE output file. Must be in the format <something>_CIGALE.fits. No file is renamed if nothing is provided.

Overview

This module provides automation for CIGALE (Code Investigating GALaxy Emission) spectral energy distribution fitting. It generates configuration files and runs the standard pcigale script for single galaxy analysis.

Note

This module requires pcigale to be installed on the system.

Constants

frb.galaxies.cigale._DEFAULT_SED_MODULES = ('sfhdelayed', 'bc03', 'nebular', 'dustatt_calzleit', 'dale2014', 'restframe_parameters', 'redshifting')

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

Default list of SED modules for CIGALE analysis: (‘sfhdelayed’, ‘bc03’, ‘nebular’, ‘dustatt_calzleit’, ‘dale2014’,

‘restframe_parameters’, ‘redshifting’)

Functions

Main Functions

frb.galaxies.cigale.run(photometry_table, zcol, data_file='cigale_in.fits', config_file='pcigale.ini', wait_for_input=False, save_sed=True, plot=True, outdir='out', **kwargs)[source]

Input parameters and then run CIGALE.

Parameters:
  • photometry_table (astropy Table) – A table from some photometric catalog with magnitudes and error measurements. Currently supports DES, DECaLS, SDSS, Pan-STARRS and WISE

  • zcol (str) – Name of the column with redshift estimates.

  • data_file (str, optional) – Root name for the photometry data file generated used as input to CIGALE

  • config_file (str, optional) – Root name for the file where CIGALE’s configuration is generated

  • wait_for_input (bool, optional) – If true, waits for the user to finish editing the auto-generated config file before running.

  • plot (bool, optional) – Plots the best fit SED if true

  • cores (int, optional) – Number of CPU cores to be used. Defaults to all cores on the system.

  • outdir (str, optional) – Path to the many outputs of CIGALE If not supplied, the outputs will appear in a folder named out/

  • save_sed (bool, optional) – Save the best fit SEDs to disk for each galaxy.

kwargs: These are passed into gen_cigale_in() and _initialise()
variables (str or list, optional):

A single galaxy property name to save to results or a list of variable names. Names must belong to the list defined in the CIGALE documentation.

sed_modules (list of ‘str’, optional):

A list of SED modules to be used in the PDF analysis. If this is being input, there should be a corresponding correct dict for sed_modules_params.

sed_module_params (dict, optional):

A dict containing parameter values for the input SED modules. Better not use this unless you know exactly what you’re doing.

Input parameters and run CIGALE analysis for a photometry table.

This is the main entry point for running CIGALE on a table of photometric measurements. It handles both single galaxy and multi-galaxy analysis.

frb.galaxies.cigale.gen_cigale_in(photometry_table, zcol, idcol=None, infile='cigale_in.fits', overwrite=True, **kwargs)[source]

Generates the input catalog from a photometric catalog.

Parameters:
  • photometry_table (astropy Table) –

    A table from some photometric catalog with magnitudes and error measurements. Currently supports DES, DECaLS, SDSS, Pan-STARRS and WISE

    The naming convention follows those specified in frb.galaxies.defs with the exception of WISE which use WISE-1, etc. although the code also handles WISE-W1, etc.

  • zcol (str) – Name of the column with redshift estimates

  • idcol (str, optional) – Name of the column with object IDs. By default, the code looks for the first column with “ID” in its name. If that’s not present, it creates a column with row numbers for IDs.

  • infile (str, optional) – Output name + path for the CIGALE input file generated

  • overwrite (bool, optional) – If true, overwrites file if it already exists

  • kwargs – only here to catch extras

Generate input data file for CIGALE from photometric measurements.

frb.galaxies.cigale._initialise(data_file, config_file='pcigale.ini', cores=None, save_sed=False, variables='', sed_modules=('sfhdelayed', 'bc03', 'nebular', 'dustatt_calzleit', 'dale2014', 'restframe_parameters', 'redshifting'), sed_modules_params=None, photo_z=False, **kwargs)[source]

Initialise a CIGALE configuration file and write to disk.

Parameters:
  • data_file (str) – Path to the input photometry data file.

  • config_file (str, optional) – Path to the file where CIGALE’s configuration is stored.

  • cores (int, optional) – Number of CPU cores to be used. Defaults to all cores on the system.

  • save_sed (bool, optional) – Save the best fit SEDs to disk for each galaxy.

  • variables (str or list, optional) – A single galaxy property name to save to results or a list of variable names. Names must belong to the list defined in the CIGALE documentation.

  • sed_modules (list or tuple, optional) – A list of SED modules to be used in the PDF analysis. If this is being input, there should be a corresponding correct dict for sed_modules_params.

  • sed_module_params (dict, optional) – A dict containing parameter values for the input SED modules. Better not use this unless you know exactly what you’re doing.

  • photo_z (bool, optional) – If true, CIGALE will try to estimate the redshift from SED fitting.

  • kwargs – only here to catch extras

Returns:

CIGALE Configuration object

Return type:

cigconf (pcigale.session.configuration.Configuration)

Initialize CIGALE configuration with specified parameters.

Utility Functions

frb.galaxies.cigale._sed_default_params(module, photo_z=False)[source]

Set the default parameters for CIGALE

Parameters:

module (str) – Specify the SED using the CIGALE standard names, e.g. sfhdelayed, bc03, etc.

Returns:

the default dict of SED modules and their initial parameters.

Return type:

params (dict)

Set the default parameters for CIGALE SED modules.

Provides default parameter grids for different SED modules including:

  • sfhdelayed: Delayed star formation history

  • bc03: Bruzual & Charlot 2003 stellar population models

  • nebular: Nebular emission modeling

  • dustatt_calzleit: Calzetti attenuation law

  • dale2014: Dust emission templates

Parameters

The module supports extensive customization of CIGALE analysis through various parameters:

SED Modules
  • Star formation history models (sfhdelayed, exponential, etc.)

  • Stellar population synthesis (bc03, m05, etc.)

  • Nebular emission (nebular)

  • Dust attenuation (dustatt_calzleit, dustatt_modified_starburst, etc.)

  • Dust emission (dale2014, casey2012, etc.)

Analysis Parameters
  • Redshift estimation (photometric vs spectroscopic)

  • Output variables (stellar mass, SFR, metallicity, etc.)

  • Core usage and computational settings

Examples

Basic CIGALE analysis:

from frb.galaxies import cigale
from astropy.table import Table

# Load photometry table
photom_table = Table.read('galaxy_photom.fits')

# Run CIGALE with default settings
cigale.run(photom_table, zcol='z_spec',
           data_file='input.fits',
           config_file='config.ini',
           plot=True)

Custom SED modules:

# Define custom SED modules
custom_modules = ['sfhdelayed', 'bc03', 'nebular', 'dustatt_calzleit']

# Run with custom configuration
cigale.run(photom_table, zcol='z_phot',
           sed_modules=custom_modules,
           save_sed=True,
           cores=4)

Integration with FRBGalaxy:

from frb.galaxies.frbgalaxy import FRBGalaxy

# Assuming galaxy object exists with photometry
galaxy.run_cigale(data_file='frb_galaxy.fits',
                  wait_for_input=False,
                  plot=True)