Transforms

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

Schemas for transforms.

class ionworks.pipeline.transforms.Exp(parameter)[source]

Bases: Transform

Exponential transform.

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

Parameters:

parameter (Transform or Parameter) – The parameter to transform.

Notes

  • The transform is monotonic

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': 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 initialize 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.pipeline.transforms.Identity(parameter)[source]

Bases: Transform

Identity transform.

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

Parameters:

parameter (Transform or Parameter) – The parameter to transform.

Notes

  • The transform is monotonic

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': 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 initialize 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.pipeline.transforms.Inverse(parameter)[source]

Bases: Transform

Inverse (1/x) transform.

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

Parameters:

parameter (Transform or Parameter) – The parameter to transform.

Notes

  • The transform is not monotonic

  • Input values cannot be zero

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': 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 initialize 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.pipeline.transforms.Log(parameter)[source]

Bases: Transform

Natural logarithm transform.

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

Parameters:

parameter (Transform or Parameter) – The parameter to transform.

Notes

  • The transform is monotonic

  • Input values must be positive

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': 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 initialize 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.pipeline.transforms.Log10(parameter)[source]

Bases: Transform

Logarithm base 10 transform.

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

Parameters:

parameter (Transform or Parameter) – The parameter to transform.

Notes

  • The transform is monotonic

  • Input values must be positive

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': 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 initialize 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.pipeline.transforms.Negate(parameter)[source]

Bases: Transform

Negate transform.

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

Parameters:

parameter (Transform or Parameter) – The parameter to transform.

Notes

  • The transform is not monotonic

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': 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 initialize 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.pipeline.transforms.Pow10(parameter)[source]

Bases: Transform

Power of 10 transform.

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

Parameters:

parameter (Transform or Parameter) – The parameter to transform.

Notes

  • The transform is monotonic

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': 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 initialize 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.pipeline.transforms.Transform(parameter)[source]

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:

parameter (Transform or Parameter) – The parameter to transform.

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

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}

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 initialize 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.