noether.core.schemas.normalizers

Attributes

Classes

NormalizerConfig

Base configuration for normalizers. All normalizer configs should inherit from this class.

MeanStdNormalizerConfig

Base configuration for normalizers. All normalizer configs should inherit from this class.

PositionNormalizerConfig

Base configuration for normalizers. All normalizer configs should inherit from this class.

ShiftAndScaleNormalizerConfig

Base configuration for normalizers. All normalizer configs should inherit from this class.

FieldNormalizerConfig

Declarative normalizer config that references dataset statistics by convention.

Functions

Module Contents

noether.core.schemas.normalizers.validate_tensor(v)
Parameters:

v (Any)

Return type:

torch.Tensor

noether.core.schemas.normalizers.TorchTensor
noether.core.schemas.normalizers.FloatOrArray
noether.core.schemas.normalizers.SequenceOrTensor
class noether.core.schemas.normalizers.NormalizerConfig(/, **data)

Bases: noether.core.schemas.lib._RegistryBase

Base configuration for normalizers. All normalizer configs should inherit from this class.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

kind: str | None = None

Kind of normalizer to use, i.e. class path

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class noether.core.schemas.normalizers.MeanStdNormalizerConfig(/, **data)

Bases: NormalizerConfig

Base configuration for normalizers. All normalizer configs should inherit from this class.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

kind: str | None = 'noether.data.preprocessors.normalizers.MeanStdNormalization'

Kind of normalizer to use, i.e. class path

mean: TorchTensor

mean to subtract from the input data. Can be a single value or a Sequence if we want to apply a different mean per dimension.

std: TorchTensor

standard deviation to divide the input data by. Can be a single value or a Sequence if we want to apply a different std per dimension.

logscale: bool = False

If true, the input data is assumed to be in log scale.

class noether.core.schemas.normalizers.PositionNormalizerConfig(/, **data)

Bases: NormalizerConfig

Base configuration for normalizers. All normalizer configs should inherit from this class.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

kind: str | None = 'noether.data.preprocessors.normalizers.PositionNormalizer'

Kind of normalizer to use, i.e. class path

raw_pos_min: TorchTensor

Minimum raw position values of the entire simulation mesh. Can be a single value or a sequence of values.

raw_pos_max: TorchTensor

Maximum raw position values of the entire simulation mesh. Can be a single value or a sequence of values.

scale: float = None

Scaling factor, the coordinates will be scaled linearly between [0, scale]. Defaults to 1000.

check_min_max()
Return type:

Self

class noether.core.schemas.normalizers.ShiftAndScaleNormalizerConfig(/, **data)

Bases: NormalizerConfig

Base configuration for normalizers. All normalizer configs should inherit from this class.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

kind: str | None = 'noether.data.preprocessors.normalizers.ShiftAndScaleNormalizer'

Kind of normalizer to use, i.e. class path

shift: TorchTensor

Value to subtract from the input data. Can be a single value or a Sequence if we want to apply a different shift per dimension. Assumed in log scale if logscale is True.

scale: TorchTensor

Value to divide the input data by. Can be a single value or a Sequence if we want to apply a different scale per dimension. Assumed in log scale if logscale is True.

logscale: bool = False

If true, the input data is assumed to be in log scale.

check_shift_scale()
Return type:

Self

class noether.core.schemas.normalizers.FieldNormalizerConfig(/, **data)

Bases: NormalizerConfig

Declarative normalizer config that references dataset statistics by convention.

Instead of embedding numeric values (mean, std, etc.) directly, this config declares how to normalize a field. The actual statistics are resolved at runtime from the dataset’s statistics file.

For "mean_std" normalization, the builder looks up {field}_mean and {field}_std in the dataset statistics (customizable via stat_keys).

For "position" normalization, the builder looks up raw_pos_min and raw_pos_max (customizable via stat_keys).

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

kind: str | None = 'noether.data.preprocessors.normalizers.FieldNormalizer'

Kind of normalizer to use, i.e. class path

strategy: Literal['mean_std', 'position'] = 'mean_std'

Normalization strategy. "mean_std" for mean/std normalization, "position" for position normalization.

logscale: bool = False

If true, the input data is converted to log scale before normalization. Only used for "mean_std".

stat_keys: dict[str, str] | None = None

{"mean": "custom_mean_key", "std": "custom_std_key"}. For "position": {"min": "custom_min_key", "max": "custom_max_key"}.

Type:

Optional overrides for statistic key lookup. For "mean_std"

scale: float = None

Scaling factor for position normalization. Coordinates are scaled to [0, scale]. Only used for "position".

noether.core.schemas.normalizers.AnyNormalizer