hpcflow.sdk.core.parameters.InputValue#

class hpcflow.sdk.core.parameters.InputValue(parameter, value=None, label=None, value_class_method=None, path=None, _check_obj=True)#

Bases: AbstractInputValue, ValuesMixin

An input value to a task.

Parameters:
  • parameter (Parameter | SchemaInput | str) – Parameter whose value is to be specified.

  • label (str) – Optional identifier to be used where the associated SchemaInput accepts multiple parameters of the specified type. This will be cast to a string.

  • value (Any) – The input parameter value.

  • value_class_method (How to obtain the real value.) – A class method that can be invoked with the value attribute as keyword arguments.

  • path (str) – Dot-delimited path within the parameter’s nested data structure for which value should be set.

  • _check_obj (bool)

Methods

from_file

Generate a value from a NumPy range.

from_geometric_space

Generate a value from a NumPy geometric space.

from_json_like

Make an instance of this class from JSON (or YAML) data.

from_linear_space

Generate a value from a NumPy linear space.

from_log_normal

Generate a value from a log-normal random number generator.

from_log_space

Generate a value from a NumPy geometric space.

from_normal

Generate a value from a normal (Gaussian) random number generator.

from_random_uniform

Generate a value from a uniform random number generator.

from_range

Generate a value from a NumPy range.

from_rectangle

Generate a value from a sequence of coordinates to cover the perimeter of a rectangle.

from_uniform

Generate a value from a uniform random number generator.

make_persistent

Save value to a persistent workflow.

to_dict

Serialize this object as a dictionary.

to_json_like

Serialize this object as an object structure that can be trivially converted to JSON.

Attributes

is_sub_value

True if the value is for a sub part of the parameter (i.e. if path is set).

labelled_type

The labelled type of this input value.

normalised_inputs_path

The normalised input path without the inputs. prefix.

normalised_path

The full normalised input path.

value

The value itself.

workflow

The workflow containing this input value.

parameter

Parameter whose value is to be specified.

label

Identifier to be used where the associated SchemaInput accepts multiple parameters of the specified type.

path

Dot-delimited path within the parameter's nested data structure for which value should be set.

value_class_method

A class method that can be invoked with the value attribute as keyword arguments.

classmethod from_file(parameter, file_path, path=None, label=None, **kwargs)#

Generate a value from a NumPy range.

Parameters:
Return type:

Self

classmethod from_geometric_space(parameter, start, stop, num, endpoint=True, path=None, label=None, **kwargs)#

Generate a value from a NumPy geometric space.

Parameters:
Return type:

Self

classmethod from_json_like(json_like, shared_data=None)#

Make an instance of this class from JSON (or YAML) data.

Parameters:
  • json_like – The data to deserialise.

  • shared_data – Shared context data.

Return type:

The deserialised object.

classmethod from_linear_space(parameter, start, stop, num, path=None, label=None, **kwargs)#

Generate a value from a NumPy linear space.

Parameters:
Return type:

Self

classmethod from_log_normal(parameter, mean=0.0, sigma=1.0, shape=None, seed=None, path=None, label=None, **kwargs)#

Generate a value from a log-normal random number generator.

Parameters:
Return type:

Self

classmethod from_log_space(parameter, start, stop, num, base=10.0, endpoint=True, path=None, label=None, **kwargs)#

Generate a value from a NumPy geometric space.

Parameters:
Return type:

Self

classmethod from_normal(parameter, loc=0.0, scale=1.0, shape=None, seed=None, path=None, label=None, **kwargs)#

Generate a value from a normal (Gaussian) random number generator.

Parameters:
Return type:

Self

classmethod from_random_uniform(parameter, num, low=0.0, high=1.0, seed=None, path=None, label=None, **kwargs)#

Generate a value from a uniform random number generator.

Parameters:
Return type:

Self

classmethod from_range(parameter, start, stop, step=1, path=None, label=None, **kwargs)#

Generate a value from a NumPy range.

Parameters:
Return type:

Self

classmethod from_rectangle(parameter, start, stop, num, coord=None, include=None, path=None, label=None, **kwargs)#

Generate a value from a sequence of coordinates to cover the perimeter of a rectangle.

Parameters:
  • coord (int | None) – Which coordinate to use. Either 0, 1, or None, meaning each value will be both coordinates.

  • include (list[str] | None) – If specified, include only the specified edges. Choose from “top”, “right”, “bottom”, “left”.

  • parameter (Parameter | SchemaInput | str)

  • start (Sequence[float])

  • stop (Sequence[float])

  • num (Sequence[int])

  • path (str | None)

  • label (str | int | None)

Return type:

Self

classmethod from_uniform(parameter, low=0.0, high=1.0, shape=None, seed=None, path=None, label=None, **kwargs)#

Generate a value from a uniform random number generator.

Parameters:
Return type:

Self

property is_sub_value: bool#

True if the value is for a sub part of the parameter (i.e. if path is set). Sub-values are not added to the base parameter data, but are interpreted as single-value sequences.

label#

Identifier to be used where the associated SchemaInput accepts multiple parameters of the specified type.

property labelled_type: str#

The labelled type of this input value.

make_persistent(workflow, source)#

Save value to a persistent workflow.

Returns:

  • str – Normalised path for this task input.

  • list[int | list[int]] – The index of the parameter data Zarr group where the data is stored.

  • bool – Whether this is newly persistent.

Parameters:
Return type:

tuple[str, list[int | list[int]], bool]

property normalised_inputs_path: str#

The normalised input path without the inputs. prefix.

property normalised_path: str#

The full normalised input path.

parameter#

Parameter whose value is to be specified.

path#

Dot-delimited path within the parameter’s nested data structure for which value should be set.

to_dict()#

Serialize this object as a dictionary.

Return type:

dict[str, Any]

to_json_like(dct=None, shared_data=None, exclude=(), path=None)#

Serialize this object as an object structure that can be trivially converted to JSON. Note that YAML can also be produced from the result of this method; it just requires a different final serialization step.

Parameters:
  • dct (dict[str, JSONable] | None)

  • shared_data (_JSONDeserState)

  • exclude (Container[str | None])

  • path (list | None)

Return type:

tuple[JSONDocument, _JSONDeserState]

property value: Any#

The value itself.

value_class_method#

A class method that can be invoked with the value attribute as keyword arguments.

property workflow: Workflow | None#

The workflow containing this input value.