ranch.reduction package
Submodules
ranch.reduction.astro module
- ranch.reduction.astro.integral(cube: Cube, ppv_mask: Cube | None = None, ignore_nans: bool = True) Map[source]
Returns the integral of cube over it spectral axis. Output unit is [cube unit] * km/s.
- Parameters:
cube (Cube) – Input line cube.
- Returns:
integ – Output map such that integ.nx == cube.nx and integ.ny == cube.ny.
- Return type:
Map
- ranch.reduction.astro.noise_map(cube: Cube, signal_mask: slice | List[slice], unit='index') Map[source]
Returns the noise map (pixel-wise standard deviation of noise) of cube by hiding the velocity channels containing signal. If every channel contains signal, the noise map will be filled with NaNs.
- Parameters:
cube (Cube) – Input line cube.
signal_mask (slice | list[slice]) – Intervals of channels to hide. Only step of 1 is supported.
unit (str, optional) – Describe how to read the bound values of signal_mask. Must be ‘index’, ‘velocity’ or ‘frequency’. If unit == ‘index’, the values are numpy indexes (starting from 0). If unit == ‘velocity’, the values are in km/s. If unit == ‘frequency’, the values are in GHz.
- Returns:
noise_map – Noise map of cube.
- Return type:
Map
- ranch.reduction.astro.reduce_spatial(input: Cube, x_interv: slice | None = None, y_interv: slice | None = None) Cube[source]
- ranch.reduction.astro.reduce_spatial(input: Map, x_interv: slice | None = None, y_interv: slice | None = None) Map
x_interv must be a slice (indices begin to zero) y_interv must be a slice (indices begin to zero) unit must be ‘index’ or ‘angle’
ranch.reduction.getters module
- ranch.reduction.getters.get_channels(cube: Cube, z: Sequence[int | float], unit='index') List[Map][source]
TODO
ranch.reduction.stats module
- ranch.reduction.stats.all(input: Struct, output_type: Type[float] = float, ignore_nans: bool = True) float[source]
- ranch.reduction.stats.all(input: Struct, output_type: Type[Map] = float, ignore_nans: bool = True) Map
- ranch.reduction.stats.all(input: Struct, output_type: Type[Profile] = float, ignore_nans: bool = True) Profile
Returns True if input.data contains only non-zero elements over the considered axis.
- Parameters:
- Returns:
Resulting data of type output_type.
- Return type:
- ranch.reduction.stats.any(input: Struct, output_type: Type[float] = float, ignore_nans: bool = True) float[source]
- ranch.reduction.stats.any(input: Struct, output_type: Type[Map] = float, ignore_nans: bool = True) Map
- ranch.reduction.stats.any(input: Struct, output_type: Type[Profile] = float, ignore_nans: bool = True) Profile
Returns True if input.data contains at least one non-zero elements over the considered axis.
- Parameters:
- Returns:
Resulting data of type output_type.
- Return type:
- ranch.reduction.stats.argmax(input: Struct, output_type: Type[float] = float, ignore_nans: bool = True) float[source]
- ranch.reduction.stats.argmax(input: Struct, output_type: Type[Map] = float, ignore_nans: bool = True) Map
- ranch.reduction.stats.argmax(input: Struct, output_type: Type[Profile] = float, ignore_nans: bool = True) Profile
Computes an argmax value over the needed axes to obtain a data of type output_type. In case of multiple occurrences of the maximum values, the indices corresponding to the first occurrence are returned.
- Parameters:
- Returns:
Resulting data of type output_type.
- Return type:
- ranch.reduction.stats.argmin(input: Struct, output_type: Type[float] = float, ignore_nans: bool = True) tuple[source]
- ranch.reduction.stats.argmin(input: Struct, output_type: Type[Map] = float, ignore_nans: bool = True) Map
- ranch.reduction.stats.argmin(input: Struct, output_type: Type[Profile] = float, ignore_nans: bool = True) Profile
Computes an argmin over the needed axes to obtain a data of type output_type. In case of multiple occurrences of the minimum values, the indices corresponding to the first occurrence are returned.
- Parameters:
- Returns:
Resulting data of type output_type.
- Return type:
- ranch.reduction.stats.max(input: Struct, output_type: Type[float] = float, ignore_nans: bool = True) float[source]
- ranch.reduction.stats.max(input: Struct, output_type: Type[Map] = float, ignore_nans: bool = True) Map
- ranch.reduction.stats.max(input: Struct, output_type: Type[Profile] = float, ignore_nans: bool = True) Profile
Computes the maximum value over the needed axes to obtain a data of type output_type.
- Parameters:
- Returns:
Resulting data of type output_type.
- Return type:
- ranch.reduction.stats.mean(input: Struct, output_type: Type[float] = float, ignore_nans: bool = True) float[source]
- ranch.reduction.stats.mean(input: Struct, output_type: Type[Map] = float, ignore_nans: bool = True) Map
- ranch.reduction.stats.mean(input: Struct, output_type: Type[Profile] = float, ignore_nans: bool = True) Profile
Computes the mean value over the needed axes to obtain a data of type output_type.
- Parameters:
- Returns:
Resulting data of type output_type.
- Return type:
- ranch.reduction.stats.median(input: Struct, output_type: Type[float] = float, ignore_nans: bool = True) float[source]
- ranch.reduction.stats.median(input: Struct, output_type: Type[Map] = float, ignore_nans: bool = True) Map
- ranch.reduction.stats.median(input: Struct, output_type: Type[Profile] = float, ignore_nans: bool = True) Profile
Computes median value over the needed axes to obtain a data of type output_type.
- Parameters:
- Returns:
Resulting data of type output_type.
- Return type:
- ranch.reduction.stats.min(input: Struct, output_type: Type[float] = float, ignore_nans: bool = True) float[source]
- ranch.reduction.stats.min(input: Struct, output_type: Type[Map] = float, ignore_nans: bool = True) Map
- ranch.reduction.stats.min(input: Struct, output_type: Type[Profile] = float, ignore_nans: bool = True) Profile
Computes the minimum value over the needed axes to obtain a data of type output_type.
- Parameters:
- Returns:
Resulting data of type output_type.
- Return type:
- ranch.reduction.stats.moment(input: Struct, order: int, centered: bool = True, output_type: Type[float] = float, ignore_nans: bool = True) float[source]
- ranch.reduction.stats.moment(input: Struct, order: int, centered: bool = True, output_type: Type[Map] = float, ignore_nans: bool = True) Map
- ranch.reduction.stats.moment(input: Struct, order: int, centered: bool = True, output_type: Type[Profile] = float, ignore_nans: bool = True) Profile
Computes the statistical moment of order order over the needed axes to obtain a data of type output_type. If centered is True, the centered moment is computed.
- Parameters:
input (struct.Struct) – Input multidimensional data.
order (int) – Order of the statistical moment.
centered (bool) – Whether the centered moment is computed. Default: True.
output_type (Type[Map] | Type[Profile] | Type[float]) – Type of output data. Determine the axis over which the operator has to be applied.
operator – Operation on numpy array that reduce the number of dimensions.
- Returns:
Resulting data of type output_type.
- Return type:
- ranch.reduction.stats.percentile(input: Struct, p: float, output_type: Type[float] = float, ignore_nans: bool = True) float[source]
- ranch.reduction.stats.percentile(input: Struct, p: float, output_type: Type[Map] = float, ignore_nans: bool = True) Map
- ranch.reduction.stats.percentile(input: Struct, p: float, output_type: Type[Profile] = float, ignore_nans: bool = True) Profile
Computes the percentile p over the needed axes to obtain a data of type output_type.
- Parameters:
input (struct.Struct) – Input multidimensional data.
p (float) – Percentile (between 0 and 100).
output_type (Type[Map] | Type[Profile] | Type[float]) – Type of output data. Determine the axis over which the operator has to be applied.
operator – Operation on numpy array that reduce the number of dimensions.
- Returns:
Resulting data of type output_type.
- Return type:
- ranch.reduction.stats.ptp(input: Struct, output_type: Type[float] = float, ignore_nans: bool = True) float[source]
- ranch.reduction.stats.ptp(input: Struct, output_type: Type[Map] = float, ignore_nans: bool = True) Map
- ranch.reduction.stats.ptp(input: Struct, output_type: Type[Profile] = float, ignore_nans: bool = True) Profile
Computes the peak-to-peak value over the needed axes to obtain a data of type output_type.
- Parameters:
- Returns:
Resulting data of type output_type.
- Return type:
- ranch.reduction.stats.quantile(input: Struct, q: float, output_type: Type[float] = float, ignore_nans: bool = True) float[source]
- ranch.reduction.stats.quantile(input: Struct, q: float, output_type: Type[Map] = float, ignore_nans: bool = True) Map
- ranch.reduction.stats.quantile(input: Struct, q: float, output_type: Type[Profile] = float, ignore_nans: bool = True) Profile
Computes the quantile q over the needed axes to obtain a data of type output_type.
- Parameters:
input (struct.Struct) – Input multidimensional data.
q (float) – Quantile (between 0 and 1).
output_type (Type[Map] | Type[Profile] | Type[float]) – Type of output data. Determine the axis over which the operator has to be applied.
operator – Operation on numpy array that reduce the number of dimensions.
- Returns:
Resulting data of type output_type.
- Return type:
- ranch.reduction.stats.rms(input: Struct, output_type: Type[float] = float, ignore_nans: bool = True) float[source]
- ranch.reduction.stats.rms(input: Struct, output_type: Type[Map] = float, ignore_nans: bool = True) Map
- ranch.reduction.stats.rms(input: Struct, output_type: Type[Profile] = float, ignore_nans: bool = True) Profile
Computes the root mean squared (RMS) value over the needed axes to obtain a data of type output_type.
- Parameters:
- Returns:
Resulting data of type output_type.
- Return type:
- ranch.reduction.stats.std(input: Struct, output_type: Type[float] = float, ignore_nans: bool = True) float[source]
- ranch.reduction.stats.std(input: Struct, output_type: Type[Map] = float, ignore_nans: bool = True) Map
- ranch.reduction.stats.std(input: Struct, output_type: Type[Profile] = float, ignore_nans: bool = True) Profile
Computes the standard deviation over the needed axes to obtain a data of type output_type.
- Parameters:
- Returns:
Resulting data of type output_type.
- Return type:
- ranch.reduction.stats.sum(input: Struct, output_type: Type[float] = float, ignore_nans: bool = True) float[source]
- ranch.reduction.stats.sum(input: Struct, output_type: Type[Map] = float, ignore_nans: bool = True) Map
- ranch.reduction.stats.sum(input: Struct, output_type: Type[Profile] = float, ignore_nans: bool = True) Profile
Computes a sum over the needed axes to obtain a data of type output_type.
- Parameters:
- Returns:
Resulting data of type output_type.
- Return type:
- ranch.reduction.stats.var(input: Struct, output_type: Type[float] = float, ignore_nans: bool = True) float[source]
- ranch.reduction.stats.var(input: Struct, output_type: Type[Map] = float, ignore_nans: bool = True) Map
- ranch.reduction.stats.var(input: Struct, output_type: Type[Profile] = float, ignore_nans: bool = True) Profile
Computes the variance over the needed axes to obtain a data of type output_type.
- Parameters:
- Returns:
Resulting data of type output_type.
- Return type: