releso.spline.SplineDefinition

class releso.spline.SplineDefinition(*, save_location: Path, logger_name: str | None = None, control_points: List[List[VariableLocation]] | None = None, space_dimensions: List[SplineSpaceDimension])

Bases: ShapeDefinition

Defines the spline.

Base class for the NURBS and B-Spline implementations.

__init__(**data: Any) None

Constructor for the ReLeSO basemodel object.

Methods

convert_all_control_point_locations_to_variable_locations(v, ...)

Validator control_points.

convert_to_pathlib_add_datetime(v)

Add timestamp to save_location, of applicable.

draw_action_space([save_location, no_axis, ...])

Draw the action space of the defined shape as a matplotlib figure.

get_actions()

Returns the action defined.

get_logger()

Gets the currently defined environment logger.

get_number_of_points()

Returns the number of points in the Spline.

get_parameter_values()

Returns the current positions of all control points.

get_shape()

Generates the current shape.

make_default_control_point_grid(values)

Validator for control_point_variables.

reset()

Resets the shape to the original values.

set_logger_name_recursively(logger_name)

Set the logger_name variable for all child elements.

Attributes

space_dimensions

Definition of the space dimensions of the spline

control_points

control points of the spline.

save_location

Definition of the save location of the logs and validation results.

logger_name

name of the logger.

control_points: List[List[VariableLocation]] | None

control points of the spline.

get_number_of_points() int

Returns the number of points in the Spline.

Currently the number of points in the spline is calculated by multiplying the number of points in each spline dimension.

Returns:

number of points in the spline

Return type:

int

classmethod make_default_control_point_grid(values: Dict[str, Any]) List[List[VariableLocation]]

Validator for control_point_variables.

If value is None a equidistant grid of control points will be given with variability of half the space between the each control point.

Parameters:
  • v ([type]) – Value to validate.

  • values ([type]) – Already validated values.

  • field ([type]) – Name of the field that is currently validated.

Raises:

ParserException – Emitted parser error.

Returns:

Definition of the control_points

Return type:

List[List[VariableLocation]]

space_dimensions: List[SplineSpaceDimension]

Definition of the space dimensions of the spline