Transforms

Parameter transform schemas (log, log10, exp, negate, inverse, pow10, identity). Mirrors ionworkspipeline.transforms.

Schemas for transforms.

class ionworks_schema.transforms.Exp(parameter)

Bases: Transform

Exponential transform.

Transforms a parameter by taking e raised to the power of the parameter value.

Parameters

parameterTransform or Parameter

The parameter to transform.

Notes

  • The transform is monotonic

Extends: ionworks_schema.transforms.transforms.Transform

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}

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

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks_schema.transforms.Identity(parameter)

Bases: Transform

Identity transform.

A transform that returns the input unchanged. Useful as a placeholder or for testing.

Parameters

parameterTransform or Parameter

The parameter to transform.

Notes

  • The transform is monotonic

Extends: ionworks_schema.transforms.transforms.Transform

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}

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

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks_schema.transforms.Inverse(parameter)

Bases: Transform

Inverse (1/x) transform.

Transforms a parameter by taking its reciprocal (1/x). Cannot be used with zero values.

Parameters

parameterTransform or Parameter

The parameter to transform.

Notes

  • The transform is not monotonic

  • Input values cannot be zero

Extends: ionworks_schema.transforms.transforms.Transform

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}

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

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks_schema.transforms.Log(parameter)

Bases: Transform

Natural logarithm transform.

Transforms a parameter by taking its natural logarithm. Only works with positive values.

Parameters

parameterTransform or Parameter

The parameter to transform.

Notes

  • The transform is monotonic

  • Input values must be positive

Extends: ionworks_schema.transforms.transforms.Transform

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}

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

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks_schema.transforms.Log10(parameter)

Bases: Transform

Logarithm base 10 transform.

Transforms a parameter by taking its base-10 logarithm. Only works with positive values.

Parameters

parameterTransform or Parameter

The parameter to transform.

Notes

  • The transform is monotonic

  • Input values must be positive

Extends: ionworks_schema.transforms.transforms.Transform

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}

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

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks_schema.transforms.Negate(parameter)

Bases: Transform

Negate transform.

Transforms a parameter by negating its value (-x).

Parameters

parameterTransform or Parameter

The parameter to transform.

Notes

  • The transform is not monotonic

Extends: ionworks_schema.transforms.transforms.Transform

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}

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

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks_schema.transforms.Pow10(parameter)

Bases: Transform

Power of 10 transform.

Transforms a parameter by raising 10 to the power of the parameter value.

Parameters

parameterTransform or Parameter

The parameter to transform.

Notes

  • The transform is monotonic

Extends: ionworks_schema.transforms.transforms.Transform

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}

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

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks_schema.transforms.Transform(parameter)

Bases: BaseSchema

Base class for parameter transformations.

Concrete transforms (Exp, Identity, Inverse, Log, Log10, Negate, Pow10) inherit from this base, so anywhere the schema needs to type “a parameter transform” the type is Transform.

Transforms move parameters between different spaces (e.g. log space, exponential space) while maintaining the parameter bounds and initial values, and can be chained together.

Parameters

parameterTransform or Parameter

The parameter to transform.

Extends: ionworks_schema.base.BaseSchema

parameter: Annotated[dict[str, Any] | BaseSchema | Any, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]
to_config() dict

Build the dict you submit through ionworks-api.

The output is the inner parameter’s config with a "transform" key naming this transform ("Log", "Exp", …). Chained transforms collapse into a single dict carrying the outermost transform name plus the underlying parameter’s bounds and initial value.

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}

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

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.