ranch package
Subpackages
- ranch.core package
- Submodules
- ranch.core.header module
bound_coordinates()bound_frequencies()bound_velocities()change_coordinates()check_header()coordinates_to_indices()create_header()frequency_to_index()index_to_frequency()index_to_velocity()indices_to_coordinates()merge_headers()move_header_axes()remove_header_axis()update_header()velocity_to_index()
- ranch.core.math module
- ranch.core.util module
apply_element_wise()astype()change_axes_order()clip()copy()cube_from()cube_from_maps()cube_from_profiles()flatten()from_fits()from_numpy()is_logical()isfinite()isnan()map_from()nan_to_num()ones()ones_like()profile_from()stack_numpy()to_numpy()where()x_axis()y_axis()z_axis()zeros()zeros_like()
- Module contents
- ranch.filtering package
- ranch.io package
- ranch.learning package
- ranch.models package
- ranch.reduction package
Submodules
ranch.structures module
- class ranch.structures.Cube(data: ndarray, header: Header)[source]
Bases:
StructRadio astronomy data cube
Initializer.
- Parameters:
data (np.ndarray) – Data array.
header (fits.Header) – FITS header.
- filter(kernel: ndarray, filtering_mode: str = 'linear', padding_mode: str = 'constant', cval: float = 0)
TODO
- filter_channels(kernel: ndarray, filtering_mode: str = 'linear', padding_mode: str = 'constant', cval: float = 0)
TODO
- filter_pixels(kernel: ndarray, filtering_mode: str = 'linear', padding_mode: str = 'constant', cval: float = 0)
TODO
- static from_maps(maps: Sequence[Map]) Cube
Returns a cube builded by concatening maps in maps sequences.
- static from_profiles(profiles: Sequence[Sequence[Profile]]) Cube
Returns a cube builded by concatening maps in maps sequences.
- Parameters:
profiles (Sequence[Sequence[Profile]]) – Sequence of sequence of profiles of same shape. The sequence must not be empty and each sub-sequence must also not be empty. profiles[i][j] is the pixel of the i-th row and the j-th column.
- Returns:
cube – Output cube with same spectral shape than elements of profiles.
- Return type:
- integral(ppv_mask: Cube | None = None, ignore_nans: bool = True) Map
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
- map_from(value: float = 0.0)
Returns a map with the same x and y axis than cube filled with value.
- noise_map(signal_mask: slice | List[slice], unit='index') Map
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
- property nx: int
Length of cube x axis
- property ny: int
Length of cube y axis
- property nz: int
Length of cube z axis
- plot_channel(z: int | float, unit: str = 'index', **kwargs)
TODO
- plot_pixel(xy: tuple[int, float], unit: str = 'index', **kwargs)
TODO
- profile_from(value: float = 0.0)
Returns a profile with the same z axis than cube filled with value.
- reduce_spatial(x_interv: slice | None = None, y_interv: slice | None = None, unit: str = 'index') Cube | 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’
- reduce_spectral(z_interv: slice | None = None, unit: str = 'index') Cube | Profile
z_interv must be a slice (indices begin to zero) unit must be ‘index’, ‘velocity’ or ‘frequency’
- save_channel_plot(z: int | float, filename: str, unit: str = 'index', path: str | None = None, **kwargs) None
TODO
- save_pixel_plot(xy: tuple[int] | tuple[float], filename: str, unit: str = 'index', path: str | None = None, **kwargs) None
TODO
- show_channel(z: int | float, unit: str = 'index', **kwargs) None
TODO
- show_pixel(xy: tuple[int] | tuple[float], unit: str = 'index', **kwargs) None
TODO
- spectrum() Profile
Returns the mean spectrum of cube ,i.e., the channel-wise average.
- Parameters:
cube (Cube) – Input line cube.
- Returns:
spectrum – Output spectrum such that spectrum.nz == cube.nz.
- Return type:
Profile
- x_axis(unit: Literal['index', 'angle'] = 'index') ndarray
TODO
- y_axis(unit: Literal['index', 'angle'] = 'index') ndarray
TODO
- z_axis(unit: Literal['index', 'velocity', 'frequency'] = 'index') ndarray
TODO
- class ranch.structures.Map(data: ndarray, header: Header)[source]
Bases:
StructRadio astronomy data map
Initializer.
- Parameters:
data (np.ndarray) – Data array.
header (fits.Header) – FITS header.
- filter(kernel: ndarray, filtering_mode: str = 'linear', padding_mode: str = 'constant', cval: float = 0)
TODO
- property nx: int
Length of cube x axis
- property ny: int
Length of cube y axis
- plot(ax: ~matplotlib.axes._axes.Axes | None = None, label_unit: str = 'angle', no_logical=False, norm: ~matplotlib.colors.Normalize | None = None, cmap: str | ~matplotlib.colors.Colormap = <matplotlib.colors.LinearSegmentedColormap object>, vmin: float | None = None, vmax: float | None = None)
Plots a map. Returns the figure axis and the colorbar.
- reduce_spatial(x_interv: slice | None = None, y_interv: slice | None = None, unit: str = 'index') Cube | 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’
- save_plot(filename: str, path: str | None = None, **kwargs) None
TODO
- show(**kwargs) None
TODO
- x_axis(unit: Literal['index', 'angle'] = 'index') ndarray
TODO
- y_axis(unit: Literal['index', 'angle'] = 'index') ndarray
TODO
- class ranch.structures.Profile(data: ndarray, header: Header)[source]
Bases:
StructRadio astronomy data profile
Initializer.
- Parameters:
data (np.ndarray) – Data array.
header (fits.Header) – FITS header.
- filter(kernel: ndarray, filtering_mode: str = 'linear', padding_mode: str = 'constant', cval: float = 0)
TODO
- property nz: int
Length of cube z axis
- plot(ax: Axes | None = None, label_unit: str = 'velocity', logy: bool = False, linestyle: str | None = 'solid', color: str | None = 'k', linewidth: float | None = 1.5, label: str | None = None)
Plot a profile. Returns the figure axis.
- reduce_spectral(z_interv: slice | None = None, unit: str = 'index') Cube | Profile
z_interv must be a slice (indices begin to zero) unit must be ‘index’, ‘velocity’ or ‘frequency’
- save_plot(filename: str, path: str | None = None, **kwargs) None
TODO
- show(**kwargs) None
TODO
- z_axis(unit: Literal['index', 'velocity', 'frequency'] = 'index') ndarray
TODO
- class ranch.structures.Struct(data: ndarray, header: Header)[source]
Bases:
ABCRadio astronomy multidimensional data
Initializer.
- Parameters:
data (np.ndarray) – Data array.
header (fits.Header) – FITS header.
- abs() Struct
Element-wise absolute value operator.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- additive_noise(noise_type: Literal['gaussian', 'uniform'], std: Struct | float = 1.0) Struct
Return the input structure degraded with an additive noise of type noise_type.
- all(output_type: ~typing.Type[~ranch.structures.Map | ~ranch.structures.Profile | float] = <class 'float'>) Map | Profile | float
Returns True if input.data contains only non-zero elements over the considered axis.
- Parameters:
- Returns:
Resulting data of type output_type.
- Return type:
- any(output_type: ~typing.Type[~ranch.structures.Map | ~ranch.structures.Profile | float] = <class 'float'>) bool
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:
- apply_element_wise(fun: Callable[[ndarray], ndarray]) Struct
Apply the element-wise operator fun on the input structure.
- Parameters:
input (Cube | Map | Profile) – Input structure.
fun (Callable[[np.ndarray], ndarray]) – Element-wise operator.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- arccos()
Element-wise inverse cosine operator.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- arccosh()
Element-wise inverse hyperbolic cosine operator.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- arcsin()
Element-wise inverse sine operator.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- arcsinh()
Element-wise inverse hyperbolic sine operator.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- arctan()
Element-wise inverse tangent operator.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- arctanh()
Element-wise inverse hyperbolic tangent operator.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- argmax(output_type: ~typing.Type[~ranch.structures.Map | ~ranch.structures.Profile | float] = <class 'float'>, ignore_nans: bool = True) Struct | Tuple[int] | int
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:
- argmin(output_type: ~typing.Type[~ranch.structures.Map | ~ranch.structures.Profile | float] = <class 'float'>, ignore_nans: bool = True) Struct | Tuple[int] | int
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:
- astype(dtype: Literal['float', 'double']) Struct
Return the input structure with floating type ‘float’ or ‘double’. Note that there is no function as_int or as_float because structures are always of type float.
- Parameters:
input (Cube | Map | Profile) – Input structure.
dtype (str) – Floating type of output data. Must be ‘float’ or ‘double’.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- cbrt() Struct
Element-wise cube root operator.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- copy() Struct
Returns a copy of input.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- cos()
Element-wise cosine operator.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- cosh()
Element-wise hyperbolic cosine operator.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- data: ndarray
Data array
- exp()
Element-wise exponential operator.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- flatten()
Shortcut for input.data.flatten().
- classmethod from_fits(filename: str, path: str | None = None, axes: str | None = None) Struct
Load an inputect of type cls from file filename/path.
- Parameters:
cls (Type[Cube] | Type[Map] | Type[Profile]) – Type of structure to create.
filename (str) – Filename of FITS file to load. Extension can be ommited. Handle both .fits or .fits.gz files, but notice that .gz files take longer to load.
path (str, optional) – Path to the FITS file.
axes (str, optional) – Order of axes. Must be ‘xyz’, ‘yxz’, ‘zxy’, ‘zyx’, ‘xy’, ‘yx’ or None.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- classmethod from_numpy(array: ndarray, header: Header, axes: str | None = None) Struct
Create an inputect of type cls from numpy array array and astropy header header.
- Parameters:
cls (Type[Cube] | Type[Map] | Type[Profile]) – Type of structure to create.
array (np.ndarray) – Data of structure to create. Must be 1D if cls is Profile, 2D if cls is Map and 3D if cls is Cube.
header (fits.Header) – Astropy fits header. Can be taken from another cube or created by hand.
axes (str, optional) – Order of axes. Must be ‘xyz’, ‘yxz’, ‘zxy’, ‘zyx’, ‘xy’, ‘yx’ or None.
- Returns:
out – Created structure.
- Return type:
Cube | Map | Profile
- header: Header
FITS header
- is_logical() bool
TODO
- isfinite() Profile
Return a structure similar to input where a sample is 1 if input same sample is finite and 0 if is not. A finite element is a value different of nan, inf or neginf. This function is the opposite to isnan because inf and neginf are automatically casted to nan in structures constructors. So in practice : isnan(input) == ~isfinite(input).
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- isnan() Struct
Return a structure similar to input where a sample is 1 if input same sample is nan and 0 if is not.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- kde(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]
If axis == ‘spectral’ then the kde is computed over the spectral axis i.e. pixel-wise. Use a gaussian kernel of parameter h
- Parameters:
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.
- log(base: float | None = None)
Element-wise logarithm operator.
- Parameters:
input (Cube | Map | Profile) – Input structure.
base (float | None, optional) – Base of the logarithm (by default natural logarithm). Must a positive number.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- max(output_type: ~typing.Type[~ranch.structures.Map | ~ranch.structures.Profile | float] = <class 'float'>, ignore_nans: bool = True) Struct | float
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:
- mean(output_type: ~typing.Type[~ranch.structures.Map | ~ranch.structures.Profile | float] = <class 'float'>, ignore_nans: bool = True) Struct | float
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:
- median(output_type: ~typing.Type[~ranch.structures.Map | ~ranch.structures.Profile | float] = <class 'float'>, ignore_nans: bool = True) Struct | float
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:
- min(output_type: ~typing.Type[~ranch.structures.Map | ~ranch.structures.Profile | float] = <class 'float'>, ignore_nans: bool = True) Struct | float
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:
- moment(order: int, centered: bool = True, output_type: ~typing.Type[~ranch.structures.Map | ~ranch.structures.Profile | float] = <class 'float'>, ignore_nans: bool = True) Struct | float
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:
- multiplicative_noise(noise_type: Literal['gaussian', 'uniform'], std: Struct | float = 1.0) Struct
Return the input structure degraded with a multiplicative noise of type noise_type.
- normalize(axis: Literal['spectral', 'spatial', 'all'] = 'all', training_subset: Struct | None = None, alternative_mode: bool = False) Tuple[Struct | float, ...]
If alternative_mode is False, return a modified version of input with every values between 0 and 1. If alternative_mode is True, return a modified version of input with every values between -1 and 1.
- classmethod ones(header: Header) Struct
Create an inputect of type cls fill with ones from astropy header header.
- Parameters:
cls (Type[Cube] | Type[Map] | Type[Profile]) – Type of structure to create.
header (fits.Header) – Astropy fits header. Can be taken from another cube or created by hand.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- percentile(p: float, output_type: ~typing.Type[~ranch.structures.Map | ~ranch.structures.Profile | float] = <class 'float'>, ignore_nans: bool = True) Struct | float
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:
- plot_hist(bins: int | str = 'auto', ax: Axes | None = None, logx: bool = False, logy: bool = False, density: bool = False, color: str | None = None, xlim: tuple | None = None, ylim: tuple | None = None) Tuple[ndarray, ndarray, Axes]
TODO
- plot_hist2d(input2: ~ranch.structures.Struct, bins: int | tuple | str = 'auto', ax: ~matplotlib.axes._axes.Axes | None = None, logx: bool = False, logy: bool = False, logz: bool = False, density: bool = False, plot_identity: bool = False, cmap: str | ~matplotlib.colors.Colormap = <matplotlib.colors.LinearSegmentedColormap object>, scatter: bool = False, scatter_threshold: int = 1, zeros_to_nans: bool = True, xlim: tuple | None = None, ylim: tuple | None = None, vmin: float | None = None, vmax: float | None = None) Tuple[ndarray, Tuple[ndarray, ndarray], Axes]
Plot a 2-dimensional histogram of two structures of same shape input1 and input2.
- Parameters:
input1 (Cube | Map | Profile.) – Structure whose data will be plotted on the x axis.
input2 (Cube | Map | Profile.) – Structure whose data will be plotted on the y axis.
bins (int | tuple | str, optional.) – Number of bins. If it is an integer, then the same number of bins is used for each axis. If it is a tuple, then we assume that the format is (bins_x, bins_y). If bins is a string, then the number of bins is automatically computed (default: ‘auto’). For more information, refer to numpy.histogram_bin_edges.
ax (Axes, optional.) – Matplotlib axis to plot the histogram. If ax is None, then matplotlib.pyplot.gca() is used. Default: None.
logx (bool, optional.) – If True, then the x axis is plotted in log scale. Default: False.
logy (bool, optional.) – If True, then the y axis is plotted in log scale. Default: False.
logz (bool, optional.) – If True, then the colorbar is in log scale. Default: False.
density (bool, optional.) – If True, then the density is plotted. Else, the standard counting of samples by bin is plotted. Default: False.
plot_identity (bool, optional.) – If True, then the y=x line is plotted on the figure. Default: False.
cmap (str, optional) – Default: default_colormap.
scatter (bool, optional.) – If True, the samples that are less than 2 per bins are displayed individually (using matplotlib.pyplot.scatter) instead of being included in the histogram. Default: False.
scatter_threshold (int, optional.) – The minimum number of pixel by bins necessary to be plotted as an histogram and not as a scatter plot. Must be positive. Default: 1.
zeros_to_nans (bool, optional.) – If True, then the bins without samples are plotted as nan. Default: True.
xlim (tuple | None, optional.) – X axis limits for matplotlib.pyplot.xlim. Default: None.
ylim (tuple | None, optional.) – Y axis limits for matplotlib.pyplot.ylim. Default: None.
vmin (float, optional.) – Minimum value for colormap. Default: None.
vmax (float, optional.) – Maximum value for colormap. Default: None.
- Returns:
H (ndarray) – Matrix of 2-dimensional histogram.
edges (tuple of ndarray) – Tuple of x and y axis bins (xedges, yedges)
ax (Axes) – Matplotlib axis.
- ptp(output_type: ~typing.Type[~ranch.structures.Map | ~ranch.structures.Profile | float] = <class 'float'>, ignore_nans: bool = True) Struct | float
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:
- quantile(q: float, output_type: ~typing.Type[~ranch.structures.Map | ~ranch.structures.Profile | float] = <class 'float'>, ignore_nans: bool = True) Struct | float
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:
- rms(output_type: ~typing.Type[~ranch.structures.Map | ~ranch.structures.Profile | float] = <class 'float'>, ignore_nans: bool = True) Struct | float
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:
- save_fits(filename: str, path: str | None = None, overwrite=False) None
Save input structure in a FITS file. The extension of the file can be ommited.
- save_hist(filename: str, path: str | None = None, **kwargs)
TODO
- scale(axis: Literal['spectral', 'spatial', 'all'] = 'all', training_subset: Struct | None = None, alternative_mode: bool = False) Tuple[Map | Profile | float, ...]
If alternative_mode is False, return a modified version of input where every value is between -1 and 1 If alternative_mode is True, raise a NotImplementedError
- property shape: tuple[int]
Shape of the data
- show_hist(**kwargs)
TODO
- sin()
Element-wise sine operator.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- sinh()
Element-wise hyperbolic sine operator.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- property size: int
Number of scalars in the cube.
- sqrt() Struct
Element-wise square root operator.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- standardize(axis: Literal['spectral', 'spatial', 'all'] = 'all', training_subset: Struct | None = None, alternative_mode: bool = False) Tuple[Struct, ...]
If alternative_mode is False, return a modified version of input with mean 0 and standart deviation 1. If alternative_mode is True, return a modified version of input with mean 0 but same standart deviation.
- std(output_type: ~typing.Type[~ranch.structures.Map | ~ranch.structures.Profile | float] = <class 'float'>, ignore_nans: bool = True) Struct | float
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:
- sum(output_type: ~typing.Type[~ranch.structures.Map | ~ranch.structures.Profile | float] = <class 'float'>, ignore_nans: bool = True) Struct | float
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:
- tan()
Element-wise tangent operator.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- tanh()
Element-wise hyperbolic tangent operator.
- Parameters:
input (Cube | Map | Profile) – Input structure.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
- to_numpy(item: str) ndarray
TODO
- unnormalize(a: Map | Profile | float, b: Struct | float, alternative_mode: bool = False) Struct
TODO
- unstandardize(mu: Struct | float, sigma: Struct | float, alternative_mode: bool = False) Struct
TODO
- var(output_type: ~typing.Type[~ranch.structures.Map | ~ranch.structures.Profile | float] = <class 'float'>, ignore_nans: bool = True) Struct | float
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:
- classmethod zeros(header: Header) Struct
Create an inputect of type cls fill with zeros from astropy header header.
- Parameters:
cls (Type[Cube] | Type[Map] | Type[Profile]) – Type of structure to create.
header (fits.Header) – Astropy fits header. Can be taken from another cube or created by hand.
- Returns:
out – Output structure.
- Return type:
Cube | Map | Profile
Module contents
ranch module