Skip to content

Normalisation parameters

cutana.normalisation_parameters

Normalisation parameters for Cutana astronomical image processing.

This module defines all default values, ranges, and validation constants for image normalization/stretching methods. These parameters can be easily updated by users to customize the normalization behavior.

The parameters are organized by normalization method and include: - Default values for each parameter - Valid ranges (min/max values) - Step sizes for UI controls - Method-specific defaults for unified parameters

NormalisationDefaults

Default values for normalization parameters.

NormalisationRanges

Valid ranges for normalization parameters.

NormalisationSteps

Step sizes for UI controls.

get_method_specific_a_default(method)

Get the default 'a' parameter value for a specific normalization method.

Parameters:

Name Type Description Default
method str

Normalization method ('asinh', 'log', 'linear', 'zscale')

required

Returns:

Type Description
float

Default 'a' parameter value for the method

get_method_specific_a_range(method)

Get the valid range for 'a' parameter for a specific normalization method.

Parameters:

Name Type Description Default
method str

Normalization method ('asinh', 'log', 'linear', 'zscale')

required

Returns:

Type Description
Tuple[float, float]

Tuple of (min_value, max_value) for the method

get_method_specific_a_step(method)

Get the step size for 'a' parameter for a specific normalization method.

Parameters:

Name Type Description Default
method str

Normalization method ('asinh', 'log', 'linear', 'zscale')

required

Returns:

Type Description
float

Step size for the method

get_default_normalisation_config()

Get default normalization configuration as DotMap.

Returns:

Type Description
DotMap

DotMap with default normalization parameters

get_method_tooltip(method)

Get tooltip text for 'a' parameter based on normalization method.

Parameters:

Name Type Description Default
method str

Normalization method

required

Returns:

Type Description
str

Tooltip text string

build_fitsbolt_params_from_external_cfg(external_cfg, num_channels)

Build fitsbolt parameters dictionary from an external fitsbolt configuration.

This function handles the external_fitsbolt_cfg DotMap from AnomalyMatch, converting it to the format expected by fitsbolt.normalise_images().

Parameters:

Name Type Description Default
external_cfg DotMap

External fitsbolt config DotMap (from AnomalyMatch's fb_create_cfg())

required
num_channels int

Number of channels in the images to be normalized

required

Returns:

Type Description
Dict[str, Any]

Dictionary of fitsbolt parameters ready for normalise_images()

preserves_physical_scale(config)

Whether normalisation leaves the pixel values on their physical scale.

Only fitsbolt's CONVERSION_ONLY can preserve the scale, and even then only when the dtype conversion is a no-op: _conversiononly_normalisation returns the array untouched when the input dtype already matches output_dtype and is floating, but min-max rescales into the integer range otherwise. Every other method stretches the pixels by construction.

external_fitsbolt_cfg takes precedence over normalisation_method in apply_normalisation, so the effective method is read with the same precedence here — otherwise the header would describe a normalisation that never ran.

Parameters:

Name Type Description Default
config DotMap

Processing configuration.

required

Returns:

Type Description
bool

True if the pixel values keep their physical scale through normalisation.

Raises:

Type Description
AttributeError

If a required configuration key is missing (DotMap attribute access on a non-dynamic config).

convert_cfg_to_fitsbolt_cfg(config, num_channels=1)

Convert Cutana configuration to fitsbolt parameters dictionary.

This function consolidates all the parameter extraction logic from the config and builds the fitsbolt_params dictionary based on the normalisation method. The images array should be added separately to avoid unnecessary data copying.

Parameters:

Name Type Description Default
config DotMap

Configuration DotMap containing all normalisation parameters

required
num_channels int

Number of channels in the image array (for asinh parameters)

1

Returns:

Type Description
Dict[str, Any]

Dictionary containing fitsbolt parameters ready for normalise_images()

Dict[str, Any]

(Note: 'images' key should be added separately by the caller)