synthesizer.parametric.morphology

A module for defining parametric morphologies for use in making images.

This module provides a base class for defining parametric morphologies, and specific classes for the Sersic profile and point sources. The base class provides a common interface for defining morphologies, and the specific classes provide the functionality for the Sersic profile and point sources.

Example usage:

# Import the module
from synthesizer import morphology

# Define a Sersic profile
sersic = morphology.Sersic(r_eff=10.0, sersic_index=4, ellipticity=0.5)

# Define a point source
point_source = morphology.PointSource(offset=[0.0, 0.0])

Classes

class synthesizer.parametric.morphology.MorphologyBase[source]

A base class holding common methods for parametric morphology descriptions.

r_eff_kpc

The effective radius in kpc.

Type:

float

r_eff_mas

The effective radius in milliarcseconds.

Type:

float

sersic_index

The Sersic index.

Type:

float

ellipticity

The ellipticity.

Type:

float

theta

The rotation angle.

Type:

float

cosmo

The cosmology object.

Type:

astropy.cosmology

redshift

The redshift.

Type:

float

model_kpc

The Sersic2D model in kpc.

Type:

astropy.modeling.models.Sersic2D

model_mas

The Sersic2D model in

Type:

astropy.modeling.models.Sersic2D

compute_density_grid_from_arrays(*args)[source]

Compute the density grid from coordinate grids.

This is a place holder method to be overwritten by child classes.

get_density_grid(resolution, npix)[source]

Get the density grid based on resolution and npix.

Parameters:
  • resolution (unyt_quantity) – The resolution of the grid.

  • npix (tuple, int) – The number of pixels in each dimension.

plot_density_grid(resolution, npix)[source]

Make a quick density plot.

Arguments
resolution (float)

The resolution (in the same units provded to the child class).

npix (int)

The number of pixels.

Examples using synthesizer.parametric.morphology.MorphologyBase

Image addition example

Image addition example

Create image example

Create image example
class synthesizer.parametric.morphology.PointSource(offset=unyt_array([0., 0.], 'kpc'), cosmo=None, redshift=None)[source]

A class holding the Sersic2D profile. This is a wrapper around the astropy.models.Sersic2D class.

compute_density_grid_from_arrays(xx, yy, units=kpc)[source]

Compute the density grid defined by this morphology as a function of the input coordinate grids.

This acts as a wrapper to astropy functionality (defined above) which only work in units of kpc or milliarcseconds (mas)

Arguments
xx: array-like (float)

x values on a 2D grid.

yy: array-like (float)

y values on a 2D grid.

unitsunyt.unit

The units in which the coordinate grids are defined.

Returns
density_gridnp.ndarray

The density grid produced

class synthesizer.parametric.morphology.Sersic2D(r_eff=None, sersic_index=1, ellipticity=0, theta=0.0, cosmo=None, redshift=None)[source]

A class holding the Sersic2D profile. This is a wrapper around the astropy.models.Sersic2D class.

compute_density_grid_from_arrays(xx, yy, units=kpc)[source]

Compute the density grid defined by this morphology as a function of the input coordinate grids.

This acts as a wrapper to astropy functionality (defined above) which only work in units of kpc or milliarcseconds (mas)

Arguments
xx: array-like (float)

x values on a 2D grid.

yy: array-like (float)

y values on a 2D grid.

unitsunyt.unit

The units in which the coordinate grids are defined.

Returns
density_gridnp.ndarray

The density grid produced