edges.modeling.xtransforms

Module defining x-variable transforms for modelling.

class edges.modeling.xtransforms.CentreTransform(*, range, centre=0.0)[source]

A transform that shifts the coordinates to a new centre point.

The new coordinates will be centered at the mid-point of range plus centre.

Parameters:
  • range (tuple[float, float]) – The range of the input coordinates.

  • centre (float) – The new centre point for the coordinates.

transform(x: ndarray) ndarray[source]

Transform the coordinates.

class edges.modeling.xtransforms.IdentityTransform[source]

A transform that does nothing.

transform(x: ndarray) ndarray[source]

Transform the coordinates.

class edges.modeling.xtransforms.Log10Transform(*, scale: float = 1.0)[source]

A transform that takes the base10 logarithm of the input.

The final coordinates will be log10(original / scale).

transform(x: ndarray) ndarray[source]

Transform the coordinates.

class edges.modeling.xtransforms.LogTransform(*, scale: float = 1.0)[source]

A transform that takes the logarithm of the input.

The final coordinates will be log(original / scale).

transform(x: ndarray) ndarray[source]

Transform the coordinates.

class edges.modeling.xtransforms.ScaleTransform(*, scale)[source]

A transform that scales the coordinates by a single factor.

Parameters:

scale (float) – The scale factor to apply to the coordinates. The resulting coordinates will be original/scale.

transform(x: ndarray) ndarray[source]

Transform the coordinates.

class edges.modeling.xtransforms.ShiftTransform(*, shift=0.0)[source]

A transform that shifts the coordinates by a fixed amount.

Parameters:

shift (float) – The amount to shift the coordinates by.

transform(x: ndarray) ndarray[source]

Transform the coordinates.

class edges.modeling.xtransforms.UnitTransform(*, range)[source]

A transform that takes the input range down to -1 to 1.

Parameters:

range (tuple[float, float]) – The range that is rescaled to (-1, 1). This need not be the range of the actual data, so that the final coordinates may extend past (-1, 1).

transform(x: ndarray) ndarray[source]

Transform the coordinates.

class edges.modeling.xtransforms.XTransform[source]

Abstract base class for all coordinate transforms.

classmethod from_file(path: str | Path | Group)

Load an HDF5 file as a given type.

classmethod get(model: str) type[Self][source]

Get a ModelTransform class.

abstractmethod transform(x: ndarray) ndarray[source]

Transform the coordinates.

write(path: str | Path | Group)

Write an attrs class to HDF5.

class edges.modeling.xtransforms.ZerotooneTransform(*, range)[source]

A transform that takes an input range down to (0,1).

Like UnitTransform, but rescales to (0, 1).

transform(x: ndarray) ndarray[source]

Transform the coordinates.

edges.modeling.xtransforms.tuple_converter(x)[source]

Convert input to tuple of floats.