hpcflow.sdk.core.parameters.ValueSequence#

class hpcflow.sdk.core.parameters.ValueSequence(path, values, nesting_order=None, label=None, value_class_method=None)#

Bases: JSONLike

A sequence of values.

Parameters:
  • path (str) – The path to this sequence.

  • values (list[Any] | None) – The values in this sequence.

  • nesting_order (int) – A nesting order for this sequence. Can be used to compose sequences together.

  • label (str) – A label for this sequence.

  • value_class_method (str) – Name of a method used to generate sequence values. Not normally used directly.

Methods

from_file

Build a sequence from a simple file.

from_geometric_space

Build a sequence from a NumPy geometric space.

from_json_like

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

from_linear_space

Build a sequence from a NumPy linear space.

from_log_space

Build a sequence from a NumPy logarithmic space.

from_random_uniform

Build a sequence from a uniform random number generator.

from_range

Build a sequence from a range.

from_rectangle

Build a sequence to cover a rectangle.

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

input_path

The path of the input sequence this is, if it is one.

input_type

The type of input sequence this is, if it is one.

is_sub_value

True if the values are for a sub part of the parameter.

labelled_type

The labelled type of input sequence this is, if it is one.

normalised_inputs_path

The normalised path without the "inputs" prefix, if the sequence is an inputs sequence, else return None.

normalised_path

The path to this sequence.

parameter

The parameter this sequence supplies.

path_split

The components of ths path.

path_type

The type of path this is.

resource_scope

The scope of the resources this is, if it is one.

values

The values in this sequence.

workflow

The workflow containing this sequence.

path

The path to this sequence.

label

The label of this sequence.

nesting_order

The nesting order for this sequence.

value_class_method

Name of a method used to generate sequence values.

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

Build a sequence from a simple file.

Parameters:
  • path (str) –

  • file_path (str | Path) –

  • nesting_order (float) –

  • label (str | int | None) –

Return type:

Self

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

Build a sequence 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(path, start, stop, num, nesting_order=0, label=None, **kwargs)#

Build a sequence from a NumPy linear space.

Parameters:
Return type:

Self

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

Build a sequence from a NumPy logarithmic space.

Parameters:
Return type:

Self

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

Build a sequence from a uniform random number generator.

Parameters:
Return type:

Self

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

Build a sequence from a range.

Parameters:
Return type:

Self

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

Build a sequence to cover 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”.

  • path (str) –

  • start (Sequence[float]) –

  • stop (Sequence[float]) –

  • num (Sequence[int]) –

  • nesting_order (float) –

  • label (str | int | None) –

Return type:

Self

property input_path: str | None#

The path of the input sequence this is, if it is one.

property input_type: str | None#

The type of input sequence this is, if it is one.

property is_sub_value: bool#

True if the values are for a sub part of the parameter.

label#

The label of this sequence.

property labelled_type: str | None#

The labelled type of input sequence this is, if it is one.

make_persistent(workflow, source)#

Save value to a persistent workflow.

Parameters:
Return type:

tuple[str, list[int], bool]

nesting_order#

The nesting order for this sequence.

property normalised_inputs_path: str | None#

The normalised path without the “inputs” prefix, if the sequence is an inputs sequence, else return None.

property normalised_path: str#

The path to this sequence.

property parameter: Parameter | None#

The parameter this sequence supplies.

path#

The path to this sequence.

property path_split: Sequence[str]#

The components of ths path.

property path_type: str#

The type of path this is.

property resource_scope: str | None#

The scope of the resources this is, if it is one.

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]

value_class_method#

Name of a method used to generate sequence values.

property values: list[Any] | None#

The values in this sequence.

property workflow: Workflow | None#

The workflow containing this sequence.