FRBGalaxy Class

Module for galaxies related to FRBs

class frb.galaxies.frbgalaxy.FRBGalaxy(ra, dec, frb, cosmo=None)[source]

Bases: object

Parent class for galaxies in FRB fields

Simple object to hold key observable and derived quantities

Warning: Generating hundreds of these objects will likely be slow. Especially SkyCoord generation. A new class will be warranted for that

Args:
  • ra (float) – RA in deg

  • dec (float) – DEC in deg

  • frb (frb.FRB) – FRB object

  • cosmo (astropy.cosmology) – Cosmology, e.g. Planck18

redshift
Type:

dict

photom
Type:

dict

morphology
Type:

dict

neb_lines
Type:

dict

kinematics
Type:

dict

derived
Type:

dict

classmethod from_dict(frb, idict, override: bool = False, **kwargs)[source]

Instantiate from a dict

Args:
  • frb (frb.FRB)

  • idict (dict)

  • override (bool, optional) – Over-ride the cosmology error Not recommended unless you know what you are doing

  • **kwargs – Passed to the __init__ call

Returns:

classmethod from_json(frb, json_file, verbose: bool = True, **kwargs)[source]
Args:
  • frb (frb.FRB)

  • json_file

  • **kwargs

Returns:

FRBGalaxy or None

__init__(ra, dec, frb, cosmo=None)[source]
Args:
  • ra (float)

  • dec (float)

  • frb (frb.FRB)

  • cosmo (astropy.cosmology, optional)

property z

Return the redshift of the galaxy

Returns:

redshift or nadda

Return type:

float or None

property z_err

Return the redshift error of the galaxy

Returns:

redshift or nadda

Return type:

float or None

calc_nebular_lum(line)[source]

Calculate the line luminosity Applies dust extinction if self.derived[‘AV_nebular’] is filled

Mainly a wrapper to nebular.calc_lum()

Args:

line (str) – Name of the line

calc_nebular_AV(method='Ha/Hb', min_AV=None, **kwargs)[source]

Calculate an A_V extinction from a pair of Nebular lines

Mainly a wrapper to nebular.calc_dust_extinct

self.derived[‘AV_nebular’] is filled

Args:
  • method (str) – Method to use

  • min_AV (float) – Minimum A_V value allowed; might set 0. someday

  • **kwargs – Passed to nebular.calc_dust_extinct

Returns:

calc_nebular_SFR(method='Ha', **kwargs)[source]

Calculate a SFR from a nebular line

Mainly a wrapper to nebular.calc_SFR

self.derived[‘AV_nebular’] is filled with units SFR/yr

Args:
  • method (str) – Method to use, e.g. ‘Ha’ for Halpha

  • **kwargs – passed to nebular.calc_SFR

Returns:

calc_tot_uncert()[source]

Calculate total uncertainty in arcsec of FRB localization + Host localization in the reference frame of the FRB

Returns:

uncerta, uncertb [arcsec]

Return type:

tuple

parse_photom(phot_tbl, max_off=<Quantity 1. arcsec>, overwrite=True, EBV=None)[source]

Parse photometry from an input table

Fills the self.photom dict

Also fills fluxes in mJy

Args:
  • phot_tbl (astropy.table.Table) – ra, dec entires are required

  • max_off (Angle, optional)

  • overwrite (bool, optional)

  • EBV (float, optional) – Galactic reddening. If included, the photometry has been corrected for this. If not, who knows?! :)

Returns:

run_cigale(data_file='cigale_in.fits', config_file='pcigale.ini', wait_for_input=False, save_sed=True, plot=True, outdir='out', **kwargs)[source]

Generates the input data file for CIGALE given the photometric points and redshift of a galaxy

Args:
  • ID – str, optional An ID for the galaxy. If none, “GalaxyA” is assigned.

  • 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.

  • save_sed (bool, optional) – Saves the best fit SED if true

  • 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/

kwargs: These are passed into gen_cigale_in() and _initialise()
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.

get_metaspec(instr=None, return_all=False, specdb_file=None)[source]

Return the meta data and spectra for this FRBGalaxy from the specDB

If there is more than one spectrum, the code returns the first unless return_all=True

Args:
  • instr (str, optional) – Restrict to the input Instrument

  • return_all (bool, optional) – Return all of the meta, spectra

  • specdb_file (str, optional) – Path+name of the specDB file to use (over-ride the default)

Returns:

meta data, spectra

Return type:

astropy.table.Table, linetools.spectra.XSpectrum1D

parse_cigale(cigale_file, sfh_file=None, overwrite=True)[source]

Parse the output file from CIGALE

Read into self.derived

Args:
  • cigale_file (str) – Name of the CIGALE results file

  • sfh_file (str, optional) – Name of the best SFH model file.

  • overwrite (bool, optional) – Over-write any previous values

Returns:

parse_galfit(galfit_file, overwrite=True, twocomponent=False)[source]
Parse an output GALFIT file

or a gallight JSON file

Loaded into self.morphology

Args:
  • galfit_file (str) – processed ‘out.fits’ file produced by frb.galaxies.galfit.run. Contains a binary table with fit parameters. Or a JSON file from gallight

  • overwrite (bool, optional) – Need to overwrite the object’s attributes?

  • twocomponent (bool, optional) – Should the morphology attribute generated contain fit parameters of two components?

parse_ppxf(ppxf_file, overwrite=True, format='ascii.ecsv')[source]

Parse an output pPXF file generated by our custom run

Loaded into self.lines

Args:
  • ppxf_file (str) – pPXF results file

  • overwrite (bool, optional)

  • format (str, optional) – Format of the table

Returns:

set_z(z, origin, err=None)[source]

Set the redshift value(s) in self.redshift

Args:
  • z (float) – Redshift value

  • origin (str) – Origin ‘spec’ for spectroscopic ‘phot’ for photometric

  • err (float, optional) – Error in the redshift

Returns:

vet_one(attr)[source]

Vette one of the main_attr

Parameters:

attr (str)

Returns:

True = passed

Return type:

bool

vet_all()[source]

Vette all of the main dicts

Args:
  • dict

  • valid_defs

Returns:

True = passed

Return type:

bool

make_outfile()[source]

Auto-generate an output name for the class

Returns:

Output filename

Return type:

str

write_to_json(outfile=None, path='./', overwrite=True)[source]

Write key aspects of the class to disk in a JSON file

Args:
  • outfile (str, optional) – Output filename If not provided, one will be generated with make_outfile()

  • path (str, optional) – Path for the output file

  • overwrite (bool, optional) – Overwrite?

Returns:

class frb.galaxies.frbgalaxy.FRBHost(ra, dec, frb, z_frb=None, **kwargs)[source]

Bases: FRBGalaxy

Child of FRBGalaxy specific for an FRB host

Args:
  • ra (float) – RA in deg

  • dec (float) – DEC in deg

  • FRB (frb.FRB)

classmethod by_frb(frb, **kwargs)[source]
Args:
  • frb (frb.FRB) – FRB object

  • **kwargs

Return type:

FRBHost

__init__(ra, dec, frb, z_frb=None, **kwargs)[source]
Args:
  • ra (float)

  • dec (float)

  • frb (frb.FRB)

  • cosmo (astropy.cosmology, optional)

calc_dm_halo(**kwargs)[source]

Calculate the Halo contribution to the host DM given the host stellar mass in its derived properties dict and the FRB coordinates.

Args:

**kwargs – Passed to dm_host.dm_host_halo

Returns:

Halo contribution to the DM in pc/cm^3

Return type:

DM_halo (float)

make_outfile()[source]

Overloads the parent method for Host specific naming

Naming is FRBXXXXXX_host.json with XXXXXXX supplied by self.frb

Returns:

Name of the default outfile

Return type:

str

set_z(z, origin, err=None)[source]

Partially overload the main method

The main change is that the input z also sets z_FRB

self.redshift is modified in place

Args:
  • z (float) – Redshift value

  • origin (str) – Origin ‘spec’ for spectroscopic ‘phot’ for photometric

  • err (float, optional) – Error in the redshift

Returns:

class frb.galaxies.frbgalaxy.FGGalaxy(ra, dec, frb, **kwargs)[source]

Bases: FRBGalaxy

Foreground galaxy class (child of FRBGalaxy)

__init__(ra, dec, frb, **kwargs)[source]
Args:
  • ra (float)

  • dec (float)

  • frb (frb.FRB)

  • cosmo (astropy.cosmology, optional)