synthesizer.components.component

A module containing generic component functionality.

This module contains the abstract base class for all components in the synthesizer. It defines the basic structure of a component and the methods that all components should have.

StellarComponents and BlackHoleComponents are children of this class and contain the specific functionality for stellar and black hole components respectively.

Classes

class synthesizer.components.component.Component(component_type, fesc, **kwargs)[source]

The parent class for all components in the synthesizer.

This class contains the basic structure of a component and the methods that all components should have.

component_type

The type of component, either “Stars” or “BlackHole”.

Type:

str

spectra

A dictionary to hold the stellar spectra.

Type:

dict

lines

A dictionary to hold the stellar emission lines.

Type:

dict

photo_lnu

A dictionary to hold the stellar photometry in luminosity units.

Type:

dict

photo_fnu

A dictionary to hold the stellar photometry in flux units.

Type:

dict

images_lnu

A dictionary to hold the images in luminosity units.

Type:

dict

images_fnu

A dictionary to hold the images in flux units

Type:

dict

fesc

The escape fraction of the component.

Type:

float

model_param_cache

A cache for parameters calculated by emission models.

Type:

dict

apply_noise_to_images_fnu(instrument, limit_to=None, apply_to_psf=True)[source]

Apply instrument noise to this component’s images.

This method now acts as an orchestration wrapper around the instrument-owned imaging-noise path. It fetches the relevant image collections, passes them into the instrument, and stores the returned noisy images on the component.

Parameters:
  • instrument (Instrument) – The instrument with the noise to apply.

  • limit_to (str/list) – If not None, defines a specific model (or list of models) to limit the image generation to. Otherwise, all models with saved spectra will have images generated.

  • apply_to_psf (bool) – If True, apply the noise to the PSF images. Otherwise, apply to the non-PSF images.

Returns:

dict The images with the noise applied.

apply_noise_to_images_lnu(instrument, limit_to=None, apply_to_psf=True)[source]

Apply instrument noise to this component’s images.

This method now acts as an orchestration wrapper around the instrument-owned imaging-noise path. It fetches the relevant image collections, passes them into the instrument, and stores the returned noisy images on the component.

Parameters:
  • instrument (Instrument) – The instrument with the noise to apply.

  • limit_to (str/list) – If not None, defines a specific model (or list of models) to limit the image generation to. Otherwise, all models with saved spectra will have images generated.

  • apply_to_psf (bool) – If True, apply the noise to the PSF images. Otherwise, apply to the non-PSF images.

Returns:

dict The images with the noise applied.

apply_psf_to_images_fnu(instrument, limit_to=None)[source]

Apply instrument PSFs to this component’s flux images.

This method now acts as an orchestration wrapper around the instrument-owned PSF application path. It fetches the relevant image collections, passes them into the instrument, and stores the returned PSF-processed images on the component.

Parameters:
  • instrument (Instrument) – The instrument with the PSF to apply.

  • limit_to (str/list) – If not None, defines a specific model (or list of models) to limit the image generation to. Otherwise, all models with saved spectra will have images generated.

Returns:

dict The images with the PSF applied.

apply_psf_to_images_lnu(instrument, limit_to=None)[source]

Apply instrument PSFs to this component’s luminosity images.

This method now acts as an orchestration wrapper around the instrument-owned PSF application path. It fetches the relevant image collections, passes them into the instrument, and stores the returned PSF-processed images on the component.

Parameters:
  • instrument (Instrument) – The instrument with the PSF to apply.

  • limit_to (str/list) – If not None, defines a specific model (or list of models) to limit the image generation to. Otherwise, all models with saved spectra will have images generated.

Returns:

dict The images with the PSF applied.

clear_all_emissions()[source]

Clear all emissions from the component.

This clears all spectra, lines, and photometry.

clear_all_lines()[source]

Clear all lines from the component.

clear_all_photometry()[source]

Clear all photometry from the component.

clear_all_spectra()[source]

Clear all spectra from the component.

clear_all_spectroscopy()[source]

Clear all spectroscopy from the component.

clear_weights()[source]

Clear all cached grid weights from the component.

This clears all grid weights calculated using different methods from this component, and resets the _grid_weights dictionary.

get_angular_diameter_distance(cosmo)[source]

Get the angular diameter distance of the component.

This requires the redshift to be set on the component.

This will use the astropy cosmology module to calculate the angular diameter distance. If the redshift is 0, the distance will be set to 10 pc to avoid any issues with 0s.

Parameters:

cosmo (astropy.cosmology) – The cosmology to use for the calculation.

Returns:

The angular diameter distance of the component in kpc.

Return type:

unyt_quantity

get_data_cube(label, fov, instrument, cube_type='smoothed', kernel=None, kernel_threshold=1, quantity='lnu', nthreads=1, cosmo=None)[source]

Get a data cube for one saved spectrum on this component.

This is the public component-level cube API. It delegates the low-level cube construction to the IFU, stores the generated cube on the component, and returns it.

Parameters:
  • label (str) – Saved spectrum label to turn into a data cube.

  • fov (unyt_quantity) – Width of the requested data cube.

  • instrument (IntegratedFieldUnit) – Instrument defining the wavelength sampling and spatial resolution.

  • cube_type (str) – Either "smoothed" or "hist".

  • kernel (array-like, optional) – Kernel used for smoothed particle cubes.

  • kernel_threshold (float) – Kernel impact-parameter threshold.

  • quantity (str) – Spectral quantity to store in the cube.

  • nthreads (int) – Number of threads to use for particle cube generation.

  • cosmo (astropy.cosmology, optional) – Cosmology used for mixed-unit conversions.

Returns:

Generated spectral data cube.

Return type:

SpectralCube

get_images_flux(*labels, fov, instrument, img_type='smoothed', kernel=None, kernel_threshold=1, nthreads=1, cosmo=None)[source]

Make an ImageCollection from component fluxes.

For Parametric components, images can only be smoothed. An exception will be raised if a histogram is requested.

For Particle components, images can either be a simple histogram (“hist”) or an image with particles smoothed over their SPH kernel.

Which images are produced is defined by the labels passed. If any of the necessary photometry is missing for generating a particular image, an exception will be raised.

Note that black holes will never be smoothed and only produce a histogram due to the point source nature of black holes.

All images that are created will be stored on the emitter (Stars or BlackHole/s) under the images_fnu attribute.

Parameters:
  • *labels (str) – The labels of the emission models to make images for. These must be present in the photometry dicts of the component. For particle components, these labels must be present in the particle photometry dicts.

  • fov (unyt_quantity of float) – The width of the image in image coordinates.

  • instrument (Instrument) – The instrument to use for the image.

  • img_type (str) – The type of image to be made, either “hist” -> a histogram, or “smoothed” -> particles smoothed over a kernel for a particle galaxy. Otherwise, only smoothed is applicable.

  • kernel (np.ndarray of float) – The values from one of the kernels from the kernel_functions module. Only used for smoothed images.

  • kernel_threshold (float) – The kernel’s impact parameter threshold (by default 1).

  • nthreads (int) – The number of threads to use in the tree search. Default is 1.

  • cosmo (astropy.cosmology) – The cosmology to use for the calculation of the luminosity distance. Only needed for internal conversions from cartesian to angular coordinates when an angular resolution is used.

Returns:

ImageCollection/dict

Either a single ImageCollection if only one label is passed, otherwise a dict of ImageCollections keyed by label.

get_images_luminosity(*labels, fov, instrument, img_type='smoothed', kernel=None, kernel_threshold=1, nthreads=1, cosmo=None)[source]

Make an ImageCollection from component luminosities.

For Parametric components, images can only be smoothed. An exception will be raised if a histogram is requested.

For Particle components, images can either be a simple histogram (“hist”) or an image with particles smoothed over their SPH kernel.

Which images are produced is defined by the labels passed. If any of the necessary photometry is missing for generating a particular image, an exception will be raised.

Note that black holes will never be smoothed and only produce a histogram due to the point source nature of black holes.

All images that are created will be stored on the emitter (Stars or BlackHole/s) under the images_lnu attribute.

Parameters:
  • *labels (str) – The labels of the emission models to make images for. These must be present in the photometry dicts of the component. For particle components, these labels must be present in the particle photometry dicts.

  • fov (unyt_quantity of float) – The width of the image in image coordinates.

  • instrument (Instrument) – The instrument to use for the image.

  • img_type (str) – The type of image to be made, either “hist” -> a histogram, or “smoothed” -> particles smoothed over a kernel for a particle galaxy. Otherwise, only smoothed is applicable.

  • kernel (np.ndarray of float) – The values from one of the kernels from the kernel_functions module. Only used for smoothed images.

  • kernel_threshold (float) – The kernel’s impact parameter threshold (by default 1).

  • nthreads (int) – The number of threads to use in the tree search. Default is 1.

  • cosmo (astropy.cosmology) – The cosmology to use for the calculation of the luminosity distance. Only needed for internal conversions from cartesian to angular coordinates when an angular resolution is used.

Returns:

ImageCollection/dict

Either a single ImageCollection if only one label is passed, otherwise a dict of ImageCollections keyed by label.

get_line_maps_flux(*labels, line_ids, fov, instrument, img_type='smoothed', kernel=None, kernel_threshold=1, nthreads=1, cosmo=None)[source]

Make an ImageCollection of emission line maps from fluxes.

For Parametric components, maps can only be smoothed. An exception will be raised if a histogram is requested.

For Particle components, maps can either be a simple histogram (“hist”) or an image with particles smoothed over their SPH kernel.

All maps that are created will be stored on the emitter (Stars or BlackHole/s) under the line_maps_fnu attribute.

Parameters:
  • *labels (str) – The labels of the emission models to make line maps for. These must be present in the lines dicts of the component.

  • line_ids (list) – The line ids to make maps for. Blended lines (e.g. doublets) can be given as a comma separated string (e.g. “O 3 4958.91A, O 3 5006.84A”) or a nested list of line ids; these produce a single map of the summed lines keyed by the “, “ joined id.

  • fov (unyt_quantity of float) – The width of the map in image coordinates.

  • instrument (Instrument) – The instrument to use for the map (typically a LineImager).

  • img_type (str) – The type of map to be made, either “hist” -> a histogram, or “smoothed” -> particles smoothed over a kernel for a particle galaxy. Otherwise, only smoothed is applicable.

  • kernel (np.ndarray of float) – The values from one of the kernels from the kernel_functions module. Only used for smoothed maps.

  • kernel_threshold (float) – The kernel’s impact parameter threshold (by default 1).

  • nthreads (int) – The number of threads to use in the tree search. Default is 1.

  • cosmo (astropy.cosmology) – The cosmology to use for the calculation of the luminosity distance. Only needed for internal conversions from cartesian to angular coordinates when an angular resolution is used.

Returns:

dict

A dict of the form {label: ImageCollection}, each containing one line map (Image) per requested line id.

get_line_maps_luminosity(*labels, line_ids, fov, instrument, img_type='smoothed', kernel=None, kernel_threshold=1, nthreads=1, cosmo=None)[source]

Make an ImageCollection of emission line maps from luminosities.

For Parametric components, maps can only be smoothed. An exception will be raised if a histogram is requested.

For Particle components, maps can either be a simple histogram (“hist”) or an image with particles smoothed over their SPH kernel.

All maps that are created will be stored on the emitter (Stars or BlackHole/s) under the line_maps_lnu attribute.

Parameters:
  • *labels (str) – The labels of the emission models to make line maps for. These must be present in the lines dicts of the component.

  • line_ids (list) – The line ids to make maps for. Blended lines (e.g. doublets) can be given as a comma separated string (e.g. “O 3 4958.91A, O 3 5006.84A”) or a nested list of line ids; these produce a single map of the summed lines keyed by the “, “ joined id.

  • fov (unyt_quantity of float) – The width of the map in image coordinates.

  • instrument (Instrument) – The instrument to use for the map (typically a LineImager).

  • img_type (str) – The type of map to be made, either “hist” -> a histogram, or “smoothed” -> particles smoothed over a kernel for a particle galaxy. Otherwise, only smoothed is applicable.

  • kernel (np.ndarray of float) – The values from one of the kernels from the kernel_functions module. Only used for smoothed maps.

  • kernel_threshold (float) – The kernel’s impact parameter threshold (by default 1).

  • nthreads (int) – The number of threads to use in the tree search. Default is 1.

  • cosmo (astropy.cosmology) – The cosmology to use for the calculation of the luminosity distance. Only needed for internal conversions from cartesian to angular coordinates when an angular resolution is used.

Returns:

dict

A dict of the form {label: ImageCollection}, each containing one line map (Image) per requested line id.

get_lines(line_ids, emission_model, dust_curves=None, tau_v=None, fesc=None, mask=None, verbose=True, out_dtype=None, covering_fraction=None, **kwargs)[source]

Generate stellar lines as described by the emission model.

Parameters:
  • line_ids (list) – A list of line_ids. Doublets can be specified as a nested list or using a comma (e.g. ‘OIII4363,OIII4959’).

  • emission_model (EmissionModel) – The emission model to use.

  • dust_curves (dict) – No longer supported, passing it raises an error. Modify the EmissionModel (or the emitter) instead.

  • tau_v (dict) – No longer supported, passing it raises an error. Modify the EmissionModel (or the emitter) instead.

  • fesc (dict) – No longer supported, passing it raises an error. Modify the EmissionModel (or the emitter) instead.

  • mask (dict) – No longer supported, passing it raises an error. Modify the EmissionModel (or the emitter) instead.

  • verbose (bool) – Are we talking?

  • out_dtype (np.dtype) – Requested floating-point dtype for extracted line arrays.

  • covering_fraction (dict) – No longer supported, passing it raises an error. Modify the EmissionModel (or the emitter) instead.

  • kwargs (dict) – Any additional keyword arguments to pass to EmissionModel._get_lines, which raises an error for any it doesn’t accept.

Returns:

LineCollection

A LineCollection object containing the lines defined by the root model.

get_luminosity_distance(cosmo)[source]

Get the luminosity distance of the component.

This requires the redshift to be set on the component.

This will use the astropy cosmology module to calculate the luminosity distance. If the redshift is 0, the distance will be set to 10 pc to avoid any issues with 0s.

Parameters:

cosmo (astropy.cosmology) – The cosmology to use for the calculation.

Returns:

The luminosity distance of the component in kpc.

Return type:

unyt_quantity

abstract get_mask(attr, thresh, op, mask=None, attr_override_obj=None)[source]

Return a mask based on the attribute and threshold.

Will derive a mask of the form attr op thresh, e.g. age > 10 Myr.

Overloading functions should use synthesizer.emission_models.utils.get_param instead of getattr to allow for attribute overrides, e.g.:

from synthesizer.emission_models.utils import get_param attr_values = get_param(

attr, override_obj, None, self

) # then use attr_values to derive the mask

Parameters:
  • attr (str) – The attribute to derive the mask from.

  • thresh (float) – The threshold value.

  • op (str) – The operation to apply. Can be ‘<’, ‘>’, ‘<=’, ‘>=’, “==”, or “!=”.

  • mask (np.ndarray) – Optionally, a mask to combine with the new mask.

  • attr_override_obj (object) – An alternative object to check from the attribute. This is specifically used when an EmissionModel may have a fixed parameter override, but can be used more generally.

Returns:

The mask array.

Return type:

mask (np.ndarray)

get_photo_fnu(filters, verbose=True, nthreads=1, limit_to=None, out_dtype=None)[source]

Calculate flux photometry using a FilterCollection object.

Parameters:
  • filters (FilterCollection) – A FilterCollection object.

  • verbose (bool) – Are we talking?

  • nthreads (int) – The number of threads to use for the integration. If -1, all threads will be used.

  • limit_to (str/list, optional) – If None, then photometry is calculated for all spectra in the galaxy. If a string or list of strings is provided, then photometry is only calculated for the specified spectra.

  • out_dtype (np.dtype) – Requested floating-point dtype for the returned photometry.

Returns:

A dictionary of fluxes in each filter in filters.

Return type:

dict

get_photo_lnu(filters, verbose=True, nthreads=1, limit_to=None, out_dtype=None)[source]

Calculate luminosity photometry using a FilterCollection object.

Parameters:
  • filters (filters.FilterCollection) – A FilterCollection object.

  • verbose (bool) – Are we talking?

  • nthreads (int) – The number of threads to use for the integration. If -1, all threads will be used.

  • limit_to (str/list, optional) – If None, then photometry is calculated for all spectra in the galaxy. If a string or list of strings is provided, then photometry is only calculated for the specified spectra.

  • out_dtype (np.dtype) – Requested floating-point dtype for the returned photometry.

Returns:

A dictionary of rest frame broadband luminosities.

Return type:

photo_lnu (dict)

get_spectra(emission_model, dust_curves=None, tau_v=None, fesc=None, mask=None, vel_shift=None, verbose=True, nthreads=1, grid_assignment_method='cic', out_dtype=None, covering_fraction=None, **kwargs)[source]

Generate stellar spectra as described by the emission model.

Parameters:
  • emission_model (EmissionModel) – The emission model to use.

  • dust_curves (dict) – No longer supported, passing it raises an error. Modify the EmissionModel (or the emitter) instead.

  • tau_v (dict) – No longer supported, passing it raises an error. Modify the EmissionModel (or the emitter) instead.

  • fesc (dict) – No longer supported, passing it raises an error. Modify the EmissionModel (or the emitter) instead.

  • mask (dict) – No longer supported, passing it raises an error. Modify the EmissionModel (or the emitter) instead.

  • vel_shift (bool) – No longer supported, passing it raises an error. Modify the EmissionModel (or the emitter) instead.

  • verbose (bool) – Are we talking?

  • nthreads (int) – The number of threads to use for the tree search. If -1, all available threads will be used.

  • grid_assignment_method (str) – The method to use for assigning particles to the grid. Options are “cic” (cloud-in-cell) or “ngp” (nearest grid point).”

  • out_dtype (np.dtype) – Requested floating-point dtype for extracted spectra arrays.

  • covering_fraction (dict) – No longer supported, passing it raises an error. Modify the EmissionModel (or the emitter) instead.

  • **kwargs (dict) – Any additional keyword arguments to pass to EmissionModel._get_spectra, which raises an error for any it doesn’t accept.

Returns:

dict

A dictionary of spectra which can be attached to the appropriate spectra attribute of the component (spectra/particle_spectra)

get_spectroscopy(instrument, limit_to=None, out_dtype=None)[source]

Get spectroscopy for the component based on a specific instrument.

Deprecated alias for get_spectroscopy_fnu, which treats the instrument wavelengths as observer frame wavelengths.

Parameters:
  • instrument (Instrument) – The instrument to use for the spectroscopy.

  • limit_to (str/list, optional) – If None, then spectroscopy is calculated for all spectra in the component. If a string or list of strings is provided, then spectroscopy is only calculated for the specified spectra.

  • out_dtype (np.dtype, optional) – Requested floating-point dtype for the resulting spectra. If None the spectroscopy inherits the source spectra dtype.

Returns:

dict

The observer frame spectroscopy for the component.

get_spectroscopy_fnu(instrument, limit_to=None, out_dtype=None)[source]

Get observer frame spectroscopy for the component.

The instrument wavelengths are interpreted as observer frame wavelengths (see SpectroscopicInstrument.apply_lam_array_fnu), so the spectra must already have their fluxes computed. The results are stored in spectroscopy_fnu (and particle_spectroscopy_fnu for any particle spectra).

If the instrument has a line spread function (LSF), the spectroscopy with it applied is also stored (in spectroscopy_lsf_fnu and particle_spectroscopy_lsf_fnu) and is the one returned.

Parameters:
  • instrument (Instrument) – The instrument to use for the spectroscopy.

  • limit_to (str/list, optional) – If None, then spectroscopy is calculated for all spectra in the component. If a string or list of strings is provided, then spectroscopy is only calculated for the specified spectra.

  • out_dtype (np.dtype, optional) – Requested floating-point dtype for the resulting spectra. If None the spectroscopy inherits the source spectra dtype.

Returns:

dict

The observer frame spectroscopy for the component.

get_spectroscopy_lnu(instrument, limit_to=None, out_dtype=None)[source]

Get rest frame spectroscopy for the component from an instrument.

The instrument wavelengths are interpreted as rest frame wavelengths (see SpectroscopicInstrument.apply_lam_array_lnu). The results are stored in spectroscopy_lnu (and particle_spectroscopy_lnu for any particle spectra).

If the instrument has a line spread function (LSF), the spectroscopy with it applied is also stored (in spectroscopy_lsf_lnu and particle_spectroscopy_lsf_lnu) and is the one returned.

Parameters:
  • instrument (Instrument) – The instrument to use for the spectroscopy.

  • limit_to (str/list, optional) – If None, then spectroscopy is calculated for all spectra in the component. If a string or list of strings is provided, then spectroscopy is only calculated for the specified spectra.

  • out_dtype (np.dtype, optional) – Requested floating-point dtype for the resulting spectra. If None the spectroscopy inherits the source spectra dtype.

Returns:

dict

The rest frame spectroscopy for the component.

abstract get_weighted_attr(attr, weights, **kwargs)[source]

Return the weighted attribute.

property is_parametric

Return whether the component is parametric.

Returns:

bool

Whether the component is parametric.

property is_particle

Return whether the component is particle based.

Returns:

bool

Whether the component is particle based.

property particle_spectroscopy

Return the observer frame particle spectroscopy (deprecated alias).

Returns:

dict

The particle_spectroscopy_fnu dictionary.

plot_observed_spectroscopy(instrument_label, spectra_to_plot=None, show=False, ylimits=(), xlimits=(), figsize=(3.5, 5), fig=None, ax=None, **kwargs)[source]

Plot the instrument’s observer frame spectroscopy of the component.

This will plot the observer frame spectroscopy (spectroscopy_fnu) for the component using the instrument’s wavelength array. The spectra are plotted in the order they are stored in the spectroscopy dictionary.

If the instrument has a line spread function (LSF), the spectroscopy with it applied (spectroscopy_lsf_fnu) is plotted instead.

Can either plot specific spectroscopy (specified via spectra_to_plot) or all spectroscopy on the component.

Parameters:
  • instrument_label (str) – The label of the instrument to use for the spectroscopy.

  • spectra_to_plot (string/list, string) –

    The specific spectroscopy to plot.
    • If None all spectra are plotted.

    • If a list of strings each specifc spectra is plotted.

    • If a single string then only that spectra is plotted.

  • show (bool) – Flag for whether to show the plot or just return the figure and axes.

  • ylimits (tuple) – The limits to apply to the y axis. If not provided the limits will be calculated with the lower limit set to 100 times less than the peak of the spectrum.

  • xlimits (tuple) – The limits to apply to the x axis. If not provided the optimal limits are found based on the ylimits.

  • figsize (tuple) – Tuple with size 2 defining the figure size.

  • fig (matplotlib.pyplot.figure) – The matplotlib figure object for the plot.

  • ax (matplotlib.axes) – The matplotlib axes object containing the plotted data.

  • **kwargs (dict) – Arguments to the sed.plot_observed_spectra method called from this wrapper.

Returns:

fig (matplotlib.pyplot.figure)

The matplotlib figure object for the plot.

ax (matplotlib.axes)

The matplotlib axes object containing the plotted data.

plot_spectra(spectra_to_plot=None, show=False, ylimits=(), xlimits=(), figsize=(3.5, 5), **kwargs)[source]

Plot the spectra of the component.

Can either plot specific spectra (specified via spectra_to_plot) or all spectra on the child object.

Parameters:
  • spectra_to_plot (string/list, string) –

    The specific spectra to plot.
    • If None all spectra are plotted.

    • If a list of strings each specifc spectra is plotted.

    • If a single string then only that spectra is plotted.

  • show (bool) – Flag for whether to show the plot or just return the figure and axes.

  • ylimits (tuple) – The limits to apply to the y axis. If not provided the limits will be calculated with the lower limit set to 1000 (100) times less than the peak of the spectrum for rest_frame (observed) spectra.

  • xlimits (tuple) – The limits to apply to the x axis. If not provided the optimal limits are found based on the ylimits.

  • figsize (tuple) – Tuple with size 2 defining the figure size.

  • kwargs (dict) – Arguments to the sed.plot_spectra method called from this wrapper.

Returns:

fig (matplotlib.pyplot.figure)

The matplotlib figure object for the plot.

ax (matplotlib.axes)

The matplotlib axes object containing the plotted data.

plot_spectroscopy(instrument_label, spectra_to_plot=None, show=False, ylimits=(), xlimits=(), figsize=(3.5, 5), fig=None, ax=None, **kwargs)[source]

Plot the instrument’s rest frame spectroscopy of the component.

This will plot the rest frame spectroscopy (spectroscopy_lnu) for the component using the instrument’s wavelength array. The spectra are plotted in the order they are stored in the spectroscopy dictionary.

If the instrument has a line spread function (LSF), the spectroscopy with it applied (spectroscopy_lsf_lnu) is plotted instead.

Can either plot specific spectroscopy (specified via spectra_to_plot) or all spectroscopy on the component.

Parameters:
  • instrument_label (str) – The label of the instrument to use for the spectroscopy.

  • spectra_to_plot (string/list, string) –

    The specific spectroscopy to plot.
    • If None all spectra are plotted.

    • If a list of strings each specifc spectra is plotted.

    • If a single string then only that spectra is plotted.

  • show (bool) – Flag for whether to show the plot or just return the figure and axes.

  • ylimits (tuple) – The limits to apply to the y axis. If not provided the limits will be calculated with the lower limit set to 1000 (100) times less than the peak of the spectrum for rest_frame (observed) spectra.

  • xlimits (tuple) – The limits to apply to the x axis. If not provided the optimal limits are found based on the ylimits.

  • figsize (tuple) – Tuple with size 2 defining the figure size.

  • fig (matplotlib.pyplot.figure) – The matplotlib figure object for the plot.

  • ax (matplotlib.axes) – The matplotlib axes object containing the plotted data.

  • **kwargs (dict) – Arguments to the sed.plot_spectra method called from this wrapper.

Returns:

fig (matplotlib.pyplot.figure)

The matplotlib figure object for the plot.

ax (matplotlib.axes)

The matplotlib axes object containing the plotted data.

print_used_parameters(*models)[source]

Print the parameters used by emission models in a formatted table.

This method displays all parameters that have been cached during emission model calculations, organized by model label. Each model’s parameters are shown with their computed values.

The output is formatted using TableFormatter to match the style of other print methods in synthesizer.

Parameters:

*models (str) – Optional model labels to print. If provided, only the specified models will be printed. If not provided, all cached models will be printed.

property spectroscopy

Return the observer frame spectroscopy (deprecated alias).

Returns:

dict

The spectroscopy_fnu dictionary.

Examples using synthesizer.components.component.Component

Parametric Young Stars Example

Parametric Young Stars Example

Sommovigo & Bartlett 2026 attenuation

Sommovigo & Bartlett 2026 attenuation

Extreme model variations example

Extreme model variations example

Plot model variations example

Plot model variations example

Photometry example

Photometry example

Plot spectra example

Plot spectra example

Image addition example

Image addition example

Create image example

Create image example

Plot delta_lambda for a grid.

Plot delta_lambda for a grid.

Demonstrate the dense basis approach for describing the SFZH

Demonstrate the dense basis approach for describing the SFZH

Plot equivalent width for UV indices

Plot equivalent width for UV indices

Generating Lines from a Parametric Galaxy

Generating Lines from a Parametric Galaxy

Generate parametric observed SED

Generate parametric observed SED

An example showing how to scale a galaxy’s mass by luminosity/flux.

An example showing how to scale a galaxy's mass by luminosity/flux.

Generate parametric galaxy SED

Generate parametric galaxy SED

Point LOS Column Densities With A Truncated Source Kernel

Point LOS Column Densities With A Truncated Source Kernel

Compare SPS grid assignment methods

Compare SPS grid assignment methods

Compare smoothed and point-particle LOS column densities

Compare smoothed and point-particle LOS column densities

Compare parametric and particle SEDs

Compare parametric and particle SEDs

Create sampled SED

Create sampled SED

Plot line of sight optical depth calculations

Plot line of sight optical depth calculations

Plot line of sight diagnostics

Plot line of sight diagnostics

Rotating particle distributions

Rotating particle distributions

Compare Single star particle to instantaneous SFZH

Compare Single star particle to instantaneous SFZH

Spatial-resampling attribute modes

Spatial-resampling attribute modes

Spatial resampling with parametric SFH and MetalDist

Spatial resampling with parametric SFH and MetalDist