MCALF utils

This sub-package contains:

  • Functions for processing spectra (mcalf.utils.spec).

  • Functions for smoothing n-dimensional arrays (mcalf.utils.smooth).

  • Functions for masking the input data to limit the region computed (mcalf.utils.mask).

  • Functions for helping with plotting (mcalf.utils.plot).

  • Classes for managing collections of data (mcalf.utils.collections).

  • Miscellaneous utility functions (mcalf.utils.misc).

mcalf.utils Package

mcalf.utils.spec Module


reinterpolate_spectrum(spectrum, ...)

Reinterpolate the spectrum.

normalise_spectrum(spectrum[, ...])

Normalise an individual spectrum to have intensities in range [0, 1].

generate_sigma(sigma_type, wavelengths, ...)

Generate the default sigma profiles.

mcalf.utils.smooth Module


moving_average(array, width)

Boxcar moving average.

gaussian_kern_3d([width, sigma])

3D Gaussian kernel.

smooth_cube(cube, mask, **kwargs)

Apply Gaussian smoothing to velocities.

mask_classifications(class_map[, vmin, ...])

Mask 2D and 3D arrays of classifications.

mcalf.utils.mask Module


genmask(width, height[, radius, ...])

Generate a circular mask of specified size.

radial_distances(n_cols, n_rows)

Generates a 2D array of specified shape of radial distances from the centre.

mcalf.utils.plot Module


hide_existing_labels(plot_settings[, axes, fig])

Hides labels for each dictionary provided if label already exists in legend.

calculate_axis_extent(resolution, px[, ...])

Calculate the extent from a resolution value along a particular axis.

calculate_extent(shape, resolution[, ...])

Calculate the extent from a particular data shape and resolution.

class_cmap(style, n)

Create a listed colormap for a specific number of classifications.

mcalf.utils.collections Module


Parameter(name[, value])

A named parameter with a optional value.


An unordered dictionary of Parameter objects.


An ordered dictionary of Parameter objects.


A base class for dictionaries of Parameter objects.


Database for keeping Parameter objects in sync.

Class Inheritance Diagram

Inheritance diagram of mcalf.utils.collections.Parameter, mcalf.utils.collections.ParameterDict, mcalf.utils.collections.OrderedParameterDict, mcalf.utils.collections.BaseParameterDict, mcalf.utils.collections.SyncedParameters

mcalf.utils.misc Module



Returns each inputted argument, wrapping in a list if not already iterable.

load_parameter(parameter[, wl])

Load parameters from file, optionally evaluating variables from strings.

merge_results(filenames, output)

Merges files generated by the method.


Update the signature of a model class.