sunpeek.components.fluids_wpd_models.WPDModel#

class sunpeek.components.fluids_wpd_models.WPDModel(unit)#

Bases: ABC

Model for a particular property of a fluid, e.g. for density or for heat capacity. # Has an ONNX filename and the units for all inputs (temperature, optionally concentration) and the calculated output. Has the units for all inputs (temperature, optionally concentration) and the calculated output. Can read WebPlotDigitizer csv files, train sklearn fit, save trained model as ONNX file and make predictions. :ivar unit: Units for temperature [‘te’], optionally concentration [‘c’] and (mandatory) output property [‘out’].

Must be valid pint unit strings. These units are sent to the trained model if a prediction is required, and the prediction output is interpreted in unit[‘out’].

Methods

__init__(unit)

csv2df(csv_file)

predict(*args)

Compute model prediction (fluid density, heat capacity) based on trained sklearn model, self.sk_model.

train([fit_type])

Fits polynomial interpolation model to fluid raw data in df.

predict(*args)#

Compute model prediction (fluid density, heat capacity) based on trained sklearn model, self.sk_model.

Parameters:

args (pint Quantity) – Inputs required for prediciton: temperature and (for mixed fluids) concentration. Fluid temperature in unit self.unit[‘te’], typically ‘degC’ Fluid concentration in unit self.unit[‘c’], typically ‘percent’

Returns:

pint Quantity

Return type:

Calculated fluid property (density or heat capacity) in unit self.unit[``’out’``]

train(fit_type='polynomial')#

Fits polynomial interpolation model to fluid raw data in df.

Parameters:

fit_type (str) – Type of sklearn fit. Currently, only ‘polynomial’ implemented, works good enough.

Return type:

Trained sklearn model.