fuellib.gcm.core.GCM

class fuellib.gcm.core.GCM(*, name, property_fns)

Bases: BaseModel

Base class for Core Group Contribution Methods.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Attributes

model_computed_fields

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_extra

Get extra fields set during validation.

model_fields

model_fields_set

Returns the set of fields that have been explicitly set on this model instance.

name

property_fns

Methods

construct

copy

Returns a copy of the model.

dict

from_orm

get_property

Retrieve the property function for the specified property name.

json

list_property_fns

List the names of all registered property functions.

model_construct

Creates a new instance of the Model class with validated data.

model_copy

!!! abstract "Usage Documentation"

model_dump

!!! abstract "Usage Documentation"

model_dump_json

!!! abstract "Usage Documentation"

model_json_schema

Generates a JSON schema for a model class.

model_parametrized_name

Compute the class name for parametrizations of generic classes.

model_post_init

Override this method to perform additional initialization after __init__ and model_construct.

model_rebuild

Try to rebuild the pydantic-core schema for the model.

model_validate

Validate a pydantic model instance.

model_validate_json

!!! abstract "Usage Documentation"

model_validate_strings

Validate the given object with string data against the Pydantic model.

parse_file

parse_obj

parse_raw

predict

Predict the specified property for a fuel's components.

predict_all

Predict all registered property functions for a fuel's components.

register_property

Register a new property implementation for this GCM.

schema

schema_json

update_forward_refs

validate

Parameters:
get_property(property_name)

Retrieve the property function for the specified property name.

Parameters:

property_name (str) – The name of the property function to retrieve.

Returns:

The property function corresponding to the specified property name.

Raises:

ValueError – If the specified property is not implemented by this GCM.

Return type:

PropertyProtocol

list_property_fns()

List the names of all registered property functions.

Returns:

A list of the names of all registered property functions.

Return type:

list[str]

model_config = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
predict(property_name, fuel)

Predict the specified property for a fuel’s components.

Parameters:
  • property_name (str) – The name of the property to predict.

  • fuel (Fuel) – The fuel object containing the decomposition matrix.

Returns:

The predicted property values for the fuel’s components as a Quantity1D.

Return type:

Quantity[ndarray[tuple[int]]]

predict_all(fuel)

Predict all registered property functions for a fuel’s components.

Parameters:

fuel (Fuel) – The fuel object containing the decomposition matrix.

Returns:

A dictionary mapping property names to their predicted values for the fuel’s

components.

Return type:

dict[str, dict[str, Quantity[ndarray[tuple[int]]]]]

property_fns: dict[str, PropertyProtocol]
register_property(function)

Register a new property implementation for this GCM.

Parameters:

function (PropertyProtocol) – The property function to register.

Returns:

The registered property function.

Return type:

PropertyProtocol