sage.core.math

Filename : math.py Description : Short description of the file

Created on 2026-01-21 07:59:05

__author__ = Narenraju Nagarajan __copyright__ = Copyright 2026, ProjectName __license__ = MIT Licence __version__ = 0.0.1 __maintainer__ = Narenraju Nagarajan __affiliation__ = N/A __email__ = N/A __status__ = [‘inProgress’, ‘Archived’, ‘inUsage’, ‘Debugging’]

GitHub Repository: NULL

Documentation: NULL

Classes

Normalise

Min-max normalisation to the unit interval [0, 1].

Standardise

Z-score standardisation to zero mean and unit variance.

Functions

rotation_matrix(angle_in_rad[, axis])

Generate matrices for rotation by some angle around some axis.

Module Contents

class Normalise(min_val, max_val)[source]

Min-max normalisation to the unit interval [0, 1].

Maps val linearly so that min_val → 0 and max_val → 1. Provides a symmetric unnorm() inverse. Used by DistributionSampler to normalise waveform parameters to a common scale before regression targets are passed to the network.

Parameters:
  • min_val (float) – Lower bound of the original parameter range.

  • max_val (float) – Upper bound of the original parameter range.

min_val[source]
max_val[source]
norm(val)[source]

Normalise val to [0, 1].

unnorm(val)[source]

Invert normalisation, recovering the original scale.

class Standardise(mean, std, eps=1e-08)[source]

Z-score standardisation to zero mean and unit variance.

Maps val so that the distribution has mean 0 and std 1. The small eps guard prevents division by zero for constant-valued parameters.

Parameters:
  • mean (float) – Population mean of the parameter.

  • std (float) – Population standard deviation of the parameter.

  • eps (float) – Numerical stability guard (default 1e-8).

mean[source]
std[source]
eps = 1e-08[source]
norm(val)[source]

Standardise val to zero mean, unit variance.

unnorm(val)[source]

Invert standardisation, recovering the original scale.

rotation_matrix(angle_in_rad, axis=2)[source]

Generate matrices for rotation by some angle around some axis. This version ONLY supports x,y,z axes; general axis version removed

Parameters:
  • angle (angle-like) – The amount of rotation the matrices should represent. Can be an array.

  • axis (int) – Only x,y,z supported. {x,y,z} -> {0,1,2}

Returns:

rmat – A unitary rotation matrix.

Return type:

torch.tensor