Skip to content

Add a custom unit to registry as a Unit object #192

@skeating

Description

@skeating

Currently we have functions that use name and attributes of unit

def add_custom_unit(self, units_name, unit_attributes):
    """Define a new Pint unit definition and adds it to the unit registry.
    :param units_name: name of unit to add - cannot be an existing CellML unit
    :param unit_attributes: dict object for unit
        {'multiplier': float, 'units': string, 'exponent': integer, 'prefix': string/integer}
        Not all fields necessary but 'units' must match a unit in Pint registry
    """

we need to be able to add a Unit object (obtained elsewhere) but this not as straightforward as it might seem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions