data_farming_core
Core module for creating data farming designs.
Module Contents
- class data_farming_core.Scaler(original_min: float, original_max: float, scaled_min: float, scaled_max: float, precision: int = 0)
Class to scale values from one range to another.
Initialize the Scaler.
- Parameters:
original_min (float) – The minimum value of the original range.
original_max (float) – The maximum value of the original range.
scaled_min (float) – The minimum value of the scaled range.
scaled_max (float) – The maximum value of the scaled range.
precision (int, optional) – The number of decimal places to round to. Defaults to 0.
- property original_min: float
The minimum value of the original range.
- property original_max: float
The maximum value of the original range.
- property scaled_min: float
The minimum value of the scaled range.
- property scaled_max: float
The maximum value of the scaled range.
- property precision: int
The number of decimal places to round to.
- property scale_factor: int
The factor by which to scale values.
- property scale: float
The scale factor between the original and scaled ranges.
- scale_value(value: float) int | float
Scale a value from the original range to the scaled range.
Returns an int if the value has no decimal component after rounding, otherwise returns a float.
- class data_farming_core.DesignType(designs: list[tuple[float, float, int]] | None = None, *args: Any, **kwargs: Any)
Bases:
abc.ABCAbstract base class for design types.
Initialize the DesignType class.
- abstractmethod generate_design() list[list[float]]
Generate a design as a 2D list.
- Returns:
A 2D list containing the scaled design points.
- Return type:
list[list[float]]
- save_design(output_file: pathlib.Path) None
Save the design to a file.
- Parameters:
output_file (Path) – The path to the output file.