synthesizer.photoionisation.cloudy17

A module defining cloudy 17 helper utilities.

Given an SED (from an SPS model, for example), generate a cloudy atmosphere grid. Can optionally generate an array of input files for selected parameters.

Functions

synthesizer.photoionisation.cloudy17.convert_cloudy_wavelength(x)[source]

Convert a wavelength string (e.g. 6562.81A, 1.008m) to a unyt_quantity.

Parameters:

x (str) – A cloudy wavelength string

Returns:

float

The wavelength in Angstroms

synthesizer.photoionisation.cloudy17.create_cloudy_input(model_name, shape_commands, abundances, output_dir='./', **kwargs)[source]

Create a cloudy input file.

Parameters:
  • model_name (str) – The model name. Used in the naming of the outputs.

  • shape_commands (list) – List of strings describing the cloudy input commands.

  • abundances – (Abundances): A synthsizer Abundances object.

  • output_dir (str) – The output directory.

  • **kwargs (**dict) – Additional parameters to be passed to the cloudy input file.

Returns:

list

A list of cloudy commands

synthesizer.photoionisation.cloudy17.read_continuum(filename, return_dict=False)[source]

Extract just the spectra from a cloudy.cont file.

Parameters:
  • filename (str) – The cloudy filename

  • return_dict (bool) – If True, return a dictionary of the spectra. If False, return a tuple of the spectra.

Returns:

The wavelength grid nu (np.ndarray of float):

The frequency grid

incident (np.ndarray of float):

The incident spectrum

transmitted (np.ndarray of float):

The transmitted spectrum

nebular (np.ndarray of float):

The nebular spectrum

nebular_continuum (np.ndarray of float):

The nebular continuum spectrum

total (np.ndarray of float):

The total spectrum

linecont (np.ndarray of float):

The line contribution spectrum

alternatively returns a dictionary

Return type:

lam (np.ndarray of float)

synthesizer.photoionisation.cloudy17.read_linelist(filename, extension='elin')[source]

Read a line list from a cloudy output file.

Parameters:
  • filename (str) – The cloudy filename

  • extension (str) – The extension of the file

Returns:

A list of line identificaitons wavelengths (list):

A list of the line wavelengths

luminosities (list):

A list of the luminosities

Return type:

line_ids (list)

synthesizer.photoionisation.cloudy17.read_lines(filename, extension='lines')[source]

Read a full line list from a cloudy output file.

Parameters:
  • filename (str) – The cloudy filename

  • extension (str) – The extension of the file

Returns:

A list of line identificaitons blends (list):

A list containing flags whether the line is a blend

wavelengths (list):

A list of the line wavelengths

intrinsic (list):

A list of the intrinsic luminosities

emergent (list):

A list of emergent luminosities

Return type:

line_ids (list)

synthesizer.photoionisation.cloudy17.read_wavelength(filename)[source]

Extract the wavelength grid from cloudy .cont file.

Note that the order will be reversed relative to the original file.

Parameters:

filename (str) – The cloudy filename

Returns:

ndnarray

The wavelength grid

Classes

class synthesizer.photoionisation.cloudy17.ShapeCommands[source]

A class for holding different cloudy shape commands.

This class is used to create the shape commands for the cloudy input file. It contains methods for creating a cloudy input file using a tabulated SED or a cloudy AGN model. The class also contains methods for creating the shape commands for the AGN model and the SED model.

cloudy_agn(aox=-1.4, auv=-0.5, ax=-1.35)[source]

Define the cloudy AGN model.

See 6.2 Hazy1.pdf.

Parameters:
  • model_name (str) – User defined name of the model used for cloudy inputs and outputs

  • TBB (float) – The Big Bump temperature

  • aox (float) – The x-ray slope (default value from Calabro CEERS AGN model)

  • auv (float) – The uv-slope (default value from Calabro CEERS AGN model)

  • ax (float) – Slope normalisation

Returns:

list

a list of strings with the cloudy input commands

table_sed(lam, lnu, output_dir='./')[source]

Create a cloudy input file using a tabulated SED.

TODO: allow the user to instead specify nu and to automatically convert units if provided

Parameters:
  • model_name (str) – User defined name of the model used for cloudy inputs and outputs.

  • lam (array or unyt_array) – Wavelength grid with or without units (via unyt)

  • lnu (array or unyt_array) – Spectral luminosity density

  • output_dir (str) – Output directory path

Returns:

list

a list of strings with the cloudy input commands