hyperion.model.ModelOutput

class hyperion.model.ModelOutput(filename)

A class that can be used to access data in the output file from radiative transfer models.

Parameters:

name : str

The name of the model output file (including extension)

Methods

get_sed([stokes, group, technique, …]) Retrieve SEDs for a specific image group and Stokes component.
get_image([stokes, group, technique, …]) Retrieve images for a specific image group and Stokes component.
get_quantities([iteration]) Retrieve one of the physical grids for the model
get_available_sources() Find out what sources are available in the output image (useful if detailed tracking was used)

Methods (detail)

get_sed(stokes='I', group=0, technique='peeled', distance=None, component='total', inclination='all', aperture='all', uncertainties=False, units=None, source_id=None, dust_id=None, n_scat=None)

Retrieve SEDs for a specific image group and Stokes component.

Parameters:

stokes : str, optional

The Stokes component to return. This can be:

  • ‘I’: Total intensity [default]
  • ‘Q’: Q Stokes parameter (linear polarization)
  • ‘U’: U Stokes parameter (linear polarization)
  • ‘V’: V Stokes parameter (circular polarization)
  • ‘linpol’: Total linear polarization fraction
  • ‘circpol’: Total circular polariation fraction

Note that if the SED was set up with set_stokes(False), then only the I component is available.

technique : str, optional

Whether to retrieve SED(s) computed with photon peeling-off (‘peeled’) or binning (‘binned’). Default is ‘peeled’.

group : int, optional

The peeloff group (zero-based). If multiple peeloff image groups were requested, this can be used to select between them. The default is to return the first group. This option is only used if technique=’peeled’.

distance : float, optional

The distance to the observer, in cm.

component : str, optional

The component to return based on origin and last interaction. This can be:

  • ‘total’: Total flux
  • ‘source_emit’: The photons were last emitted from a source and did not undergo any subsequent interactions.
  • ‘dust_emit’: The photons were last emitted dust and did not undergo any subsequent interactions
  • ‘source_scat’: The photons were last emitted from a source and were subsequently scattered
  • ‘dust_scat’: The photons were last emitted from dust and were subsequently scattered
  • ‘source’: The photons that were last emitted from a source
  • ‘dust’: The photons that were last emitted from dust

aperture : int, optional

The index of the aperture to plot (zero-based). Use ‘all’ to return all apertures, and -1 to show the largest aperture.

inclination : int, optional

The index of the viewing angle to plot (zero-based). Use ‘all’ to return all viewing angles.

uncertainties : bool, optional

Whether to compute and return uncertainties

units : str, optional

The output units for the SED(s). Valid options if a distance is specified are:

  • 'ergs/cm^2/s'
  • 'ergs/cm^2/s/Hz'
  • 'Jy'
  • 'mJy'

The default is 'ergs/cm^2/s'. If a distance is not specified, then this option is ignored, and the output units are ergs/s.

source_id, dust_id : int or str, optional

If the output file was made with track_origin=’detailed’, a specific source and dust component can be specified (where 0 is the first source or dust type). If ‘all’ is specified, then all components are returned individually. If neither of these are not specified, then the total component requested for all sources or dust types is returned. For sources, it is also possible to specify a source name as a string, if the source name was set during the set-up.

n_scat : int, optional

If the output file was made with track_origin=’scatterings’, the number of scatterings can be specified here. If specified, the image is constructed only from photons that have scattered n_scat times since being last emitted.

Returns:

wav : numpy.ndarray

The wavelengths for which the SEDs are defined, in microns

flux or degree of polarization : numpy.ndarray

The flux or degree of polarization. This is a data cube which has at most three dimensions (n_inclinations, n_apertures, n_wavelengths). If an aperture or inclination is specified, this reduces the number of dimensions in the flux cube. If stokes is one of ‘I’, ‘Q’, ‘U’, or ‘V’, the flux is either returned in ergs/s (if distance is not specified) or in the units specified by units= (if distance is specified). If stokes is one of ‘linpol’ or ‘circpol’, the degree of polarization is returned as a fraction in the range 0 to 1.

uncertainty : numpy.ndarray

The uncertainties on the flux or degree of polarization. This has the same dimensions as the flux or degree of polarization array. This is only returned if uncertainties were requested.

get_image(stokes='I', group=0, technique='peeled', distance=None, component='total', inclination='all', uncertainties=False, units=None, source_id=None, dust_id=None, n_scat=None)

Retrieve images for a specific image group and Stokes component.

Parameters:

stokes : str, optional

The Stokes component to return. This can be:

  • ‘I’: Total intensity [default]
  • ‘Q’: Q Stokes parameter (linear polarization)
  • ‘U’: U Stokes parameter (linear polarization)
  • ‘V’: V Stokes parameter (circular polarization)
  • ‘linpol’: Total linear polarization fraction
  • ‘circpol’: Total circular polariation fraction

Note that if the image was set up with set_stokes(False), then only the I component is available.

technique : str, optional

Whether to retrieve an image computed with photon peeling-off (‘peeled’) or binning (‘binned’). Default is ‘peeled’.

group : int, optional

The peeloff group (zero-based). If multiple peeloff image groups were requested, this can be used to select between them. The default is to return the first group. This option is only used if technique=’peeled’.

distance : float, optional

The distance to the observer, in cm.

component : str, optional

The component to return based on origin and last interaction. This can be:

  • ‘total’: Total flux
  • ‘source_emit’: The photons were last emitted from a source and did not undergo any subsequent interactions.
  • ‘dust_emit’: The photons were last emitted dust and did not undergo any subsequent interactions
  • ‘source_scat’: The photons were last emitted from a source and were subsequently scattered
  • ‘dust_scat’: The photons were last emitted from dust and were subsequently scattered
  • ‘source’: The photons that were last emitted from a source
  • ‘dust’: The photons that were last emitted from dust

inclination : int, optional

The index of the viewing angle to plot (zero-based). Use ‘all’ to return all viewing angles.

uncertainties : bool, optional

Whether to compute and return uncertainties

units : str, optional

The output units for the image(s). Valid options if a distance is specified are:

  • 'ergs/cm^2/s'
  • 'ergs/cm^2/s/Hz'
  • 'Jy'
  • 'mJy'
  • 'MJy/sr'

The default is 'ergs/cm^2/s'. If a distance is not specified, then this option is ignored, and the output units are ergs/s.

source_id, dust_id : int or str, optional

If the output file was made with track_origin=’detailed’, a specific source and dust component can be specified (where 0 is the first source or dust type). If ‘all’ is specified, then all components are returned individually. If neither of these are not specified, then the total component requested for all sources or dust types is returned. For sources, it is also possible to specify a source name as a string, if the source name was set during the set-up.

n_scat : int, optional

If the output file was made with track_origin=’scatterings’, the number of scatterings can be specified here. If specified, the image is constructed only from photons that have scattered n_scat times since being last emitted.

Returns:

wav : numpy.ndarray

The wavelengths for which the SEDs are defined, in microns

flux or degree of polarization : numpy.ndarray

The flux or degree of polarization. This is a data cube which has at most three dimensions (n_inclinations, n_wavelengths). If an aperture or inclination is specified, this reduces the number of dimensions in the flux cube. If stokes is one of ‘I’, ‘Q’, ‘U’, or ‘V’, the flux is either returned in ergs/s (if distance is not specified) or in the units specified by units= (if distance is specified). If stokes is one of ‘linpol’ or ‘circpol’, the degree of polarization is returned as a fraction in the range 0 to 1.

uncertainty : numpy.ndarray

The uncertainties on the flux or degree of polarization. This has the same dimensions as the flux or degree of polarization array. This is only returned if uncertainties were requested.

get_quantities(iteration=-1)

Retrieve one of the physical grids for the model

Parameters:

iteration : integer, optional

The iteration to retrieve the quantities for. The default is to return the grid for the last iteration.

Returns:

grid : Grid instance

An object containing information about the geometry and quantities

get_available_sources()

Find out what sources are available in the output image (useful if detailed tracking was used)