fruitbat.methods

fruitbat.methods.ioka2003(z, cosmo, zmin=0)[source]

Calculate the dispersion measure at a redshift z given a cosmology using the Ioka (2003) relation.

Parameters:
  • z (float or int) – The input redshift.
  • cosmo (An instance of astropy.cosmology) – The cosmology to assume when when calculating the dispersion measure at redshift z.
  • zmin (float or int, optional) – The minimum redshift to begin the integral. This should typically be zero. Default: 0.
Returns:

dm (float) – The dispersion measure at the redshift z.

fruitbat.methods.inoue2004(z, cosmo, zmin=0)[source]

Calculate the dispersion measure at a redshift z given a cosmology using the Inoue (2004) relation.

Parameters:
  • z (float or int) – The input redshift.
  • cosmo (An instance of astropy.cosmology) – The cosmology to assume when when calculating the dispersion measure at redshift z.
  • zmin (float or int, optional) – The minimum redshift to begin the integral. This should typically be zero. Default: 0.
Returns:

dm (float) – The dispersion measure at the redshift z.

fruitbat.methods.zhang2018(z, cosmo, zmin=0, **kwargs)[source]

Calculates the dispersion measure at a redshift given a cosmology using the Zhang (2018) relation.

Parameters:
  • z (float or int) – The input redshift.
  • cosmo (An instance of astropy.cosmology) – The cosmology to assume when when calculating the dispersion measure at redshift z.
  • zmin (float or int, optional) – The minimum redshift to begin the integral. This should typically be zero. Default: 0.
Keyword Arguments:
 
  • f_igm (float, optional) – The fraction of baryons in the intergalatic medium. Default: 0.83
  • free_elec (float, optional) – The free electron number per baryon in the intergalactic medium. Default: 0.875
Returns:

dm (float) – The dispersion measure at the redshift z.

fruitbat.methods.builtin_method_functions()[source]

Returns a dictionary of the builtin methods with keywords and corresponding dispersion measure functions.

Returns:methods (dict) – Contains the keywords and function for each method.
fruitbat.methods.add_method(name, func)[source]

Add a user defined method/DM-z relation to the list of available methods.

Parameters:
  • name (str) – The keyword for the new method.
  • func (function) – The function to calculate the dispersion measure at a given redshift. The first argument of func must be z.

Example

>>> def simple_dm(z):
        dm = 1200 * z
        return dm
>>> fruitbat.add_method("simple_dm", simple_dm)
fruitbat.methods.available_methods()[source]

Returns the list containing all the keywords for valid methods.

fruitbat.methods.reset_methods()[source]

Resets the list of available methods to the default builtin methods.

fruitbat.methods.method_functions()[source]

Returns a dictionary containing the valid method keys and their corresponding dispersion measure functions.