ranch.models package

Submodules

ranch.models.distribution module

ranch.models.distribution.kde(input: Struct, axis: Literal['spatial', 'spectral'] | None = None, h: float | ndarray | None = None, t: ndarray | None = None, t_bounds: Tuple[float] | None = None, t_step: float = 0.05) Tuple[ndarray][source]

If axis == ‘spectral’ then the kde is computed over the spectral axis i.e. pixel-wise. Use a gaussian kernel of parameter h

Parameters:
  • input (Cube | Map | Profile) – Input structure.

  • axis (str, optional) – Axis over which to compute the PDF. Must be set only if input is an instance of Cube. If axis is None, the PDF is computed over all the flattened structure so the output pdf is a 1D-array

  • h (float or ndarray, optional) – Kernel parameter. Must be a scalar if input is an instance of Map or Profile. If input is an instance of Cube, h must be an array of shape (nz,) if axis == ‘spectral’ or (ny, nx) if axis == ‘spatial’.

  • t (ndarray, optional) – Variable of the estimated PDF. Must be set if a specific range of value is needed.

  • t_bounds (tuple of float, optional) – Bounds of t. Ignored if t is not None. Default : None.

  • t_step (float, optional) – Step between two values of t. Ignored if t is not None. Default : 0.05. If t_step is not compatible with t_step, the right bound could be modified.

Returns:

  • t (ndarray) – Variable of the estimated PDF.

  • pdf (ndarray) – Estimated PDF.

ranch.models.noise module

ranch.models.noise.additive_noise(input: Cube, noise_type: Literal['gaussian', 'uniform'], std: Cube | Map | Profile | float) Cube[source]
ranch.models.noise.additive_noise(input: Map, noise_type: Literal['gaussian', 'uniform'], std: Map | float) Map
ranch.models.noise.additive_noise(input: Profile, noise_type: Literal['gaussian', 'uniform'], std: Profile | float) Profile

Return the input structure degraded with an additive noise of type noise_type.

Parameters:
  • input (Cube | Map | Profile) – Input structure.

  • noise_type (str) – Type of noise. Must be ‘gaussian’ or ‘uniform’.

  • std (Cube | Map | Profile) – Standard deviation of noise.

Returns:

res – Noisy structure.

Return type:

Cube | Map | Profile

ranch.models.noise.multiplicative_noise(input: Cube, noise_type: Literal['gaussian', 'uniform'], std: Cube | Map | Profile | float) Cube[source]
ranch.models.noise.multiplicative_noise(input: Map, noise_type: Literal['gaussian', 'uniform'], std: Map | float) Map
ranch.models.noise.multiplicative_noise(input: Profile, noise_type: Literal['gaussian', 'uniform'], std: Profile | float) Profile

Return the input structure degraded with a multiplicative noise of type noise_type.

Parameters:
  • input (Cube | Map | Profile) – Input structure.

  • noise_type (str) – Type of noise. Must be ‘gaussian’ or ‘uniform’.

  • std (Cube | Map | Profile) – Standard deviation of noise.

Returns:

res – Noisy structure.

Return type:

Cube | Map | Profile

ranch.models.peaks module

ranch.models.peaks.peaks_detection(input: Cube, delta_peaks: int = 1, peaks_min: float | Struct = -float('inf')) Cube[source]
ranch.models.peaks.peaks_detection(input: Profile, delta_peaks: int = 1, peaks_min: float | Struct = -float('inf')) Profile

axis must be ‘spectral’, ‘spatial’ or ‘all’

Module contents