pynbody.analysis.ionfrac.use_custom_ion_table

pynbody.analysis.ionfrac.use_custom_ion_table#

pynbody.analysis.ionfrac.use_custom_ion_table(path_or_table)[source]#

Select an ionisation table to use for subsequent calculations.

The specified table will be used for all subsequent calls to calculate(). A context manager is returned, so you can use this function in a with block to temporarily use a custom table, i.e.:

>>> with use_custom_ion_table('FG20'):
...     civ_fg20 = calculate(sim, 'CIV')
>>> civ_hm12 = calculate(sim, 'CIV')

Here the first calculation uses the FG20 table, while the second uses the HM12 table. However, you do not need to use a context manager if you want to use the custom table indefinitely.

Available tables are:

  • hm12: calculated using cloudy 23.01 with the Haardt & Madau (2012) background for redshifts between 0 and 15, i.e. uses the HM12 radiation density tables shipped with cloudy.

  • fg20: calculated by replacing the HM12 background in cloudy with the table by Claude-Andre Faucher-Giguere. Unfortunately this involves some hacking due to the architecture of cloudy. To reproduce, one needs to download the FG20 table from https://galaxies.northwestern.edu/uvb-fg20/, and follow the instructions in the readme file. The table is calculated for redshifts between 0 and 10.

  • v1: gives results calculated by Greg Stinson for pynbody v1. It is retained only for backwards compatibility and we do not recommend using it for new work.

  • v1_duffy: gives results for hydrogen only, calculated by Alan Duffy for pynbody v1. It is retained only for backwards compatibility and we do not recommend using it for new work.

  • v1_duffy_shielded: gives results for hydrogen only, calculated by Alan Duffy for pynbody v1, with self-shielding prescription turned on. It is retained only for backwards compatibility and we do not recommend using it for new work.

Parameters:

path_or_table (str or IonFractionTableBase) – If a string, the name of the table to use. If an instance of IonFractionTableBase, the table to use. Built-in tables are ‘v1’, ‘v1_duffy’, ‘v1_duffy_shielded’, ‘hm12’, ‘fg20’ and are case-insensitive. See above for the origins of these tables.

Returns:

A context manager that can be used to control the lifetime of the table. See above for usage guidance.

Return type:

IonTableContext