noise module

Provides classes to generate noise for data cubes.

class martini.noise.GaussianNoise(rms: Quantity, Unit("Jy / beam")]=<Quantity 1. Jy / beam>, seed: int = 0)[source]

Bases: _BaseNoise

Implementation of a simple Gaussian noise model.

Provides a generate() method producing a cube of Gaussian noise.

Parameters:
  • rms (Quantity) – Quantity, with dimensions of flux density per beam. Desired root mean square amplitude of the noise field after convolution with the beam.

  • seed (int, optional) – Seed for random number generator.

generate(datacube: DataCube, beam: _BaseBeam) Annotated[Quantity, Unit('Jy / arcsec2')][source]

Create a cube containing Gaussian noise.

Some numpy functions such as numpy.random.normal() strip units, so need to handle them explicitly.

Parameters:
  • datacube (DataCube) – This method will be called passing the DataCube instance as an argument; its attributes can thus be accessed here. datacube._array.shape is particularly relevant.

  • beam (_BaseBeam) – This method will be called passing the object derived from _BaseBeam (for example a GaussianBeam) as an argument. Its attributes can thus be accessed here. The beam size is needed to estimate the pre-convolution rms required to obtain the desired post-convolution rms.

Returns:

Quantity, with dimensions of flux density. Noise realization with size matching the _array.

Return type:

Quantity

reset_rng() None

Reset the random number generator to its initial state.