3.1.1.4. obj_tables.sci package

3.1.1.4.1. Submodules

3.1.1.4.2. obj_tables.sci.onto module

Ontology attributes

Author

Jonathan Karr <karr@mssm.edu>

Date

2019-01-14

Copyright

2019, Karr Lab

License

MIT

class obj_tables.sci.onto.OntoTermAttribute(ontology, namespace=None, namespace_sep=':', terms=None, none=True, default=None, default_cleaned_value=None, none_value=None, verbose_name='', description='', primary=False, unique=False, unique_case_insensitive=False)[source]

Bases: obj_tables.core.LiteralAttribute

Ontology attribute

ontology[source]

ontology

Type

pronto.Ontology

namespace[source]

prefix in term ids

Type

str

terms[source]

list of allowed terms. If None, all terms are allowed.

Type

list of pronto.Term

none[source]

if False, the attribute is invalid if its value is None

Type

bool

Parameters
  • ontology (pronto.Ontology) – ontology

  • namespace (str, optional) – prefix in term ids

  • namespace_sep (str, optional) – namespace separator

  • terms (list of pronto.Term, optional) – list of allowed terms. If None, all terms are allowed.

  • none (bool, optional) – if False, the attribute is invalid if its value is None

  • default (pronto.Term, optional) – default value

  • default_cleaned_value (pronto.Term, optional) – value to replace None values with during cleaning

  • none_value (object, optional) – none value

  • verbose_name (str, optional) – verbose name

  • description (str, optional) – description

  • primary (bool, optional) – indicate if attribute is primary attribute

  • unique (bool, optional) – indicate if attribute value must be unique

  • unique_case_insensitive (bool, optional) – if true, conduct case-insensitive test of uniqueness

Raises
  • ValueError – if ontology is not an instance of pronto.Ontology,

  • ValueError – if default not in ontology

  • ValueError – if default_cleaned_value not in ontology

clean(value)[source]

Convert attribute value into the appropriate type

Parameters

value (object) – value of attribute to clean

Returns

  • pronto.Term or None: cleaned value

  • core.InvalidAttribute or None: cleaning error

Return type

tuple

copy_value(value, objects_and_copies)[source]

Copy value

Parameters
  • value (object) – value

  • objects_and_copies (dict) – dictionary that maps objects to their copies

Returns

copy of value

Return type

object

from_builtin(json)[source]

Decode a simple Python representation (dict, list, str, float, bool, None) of a value of the attribute that is compatible with JSON and YAML

Parameters

json (str) – simple Python representation of a value of the attribute

Returns

decoded value of the attribute

Return type

pronto.Term

get_default()[source]

Get default value for attribute

Returns

initial value

Return type

object

get_default_cleaned_value()[source]

Get value to replace None values with during cleaning

Returns

initial value

Return type

object

get_xlsx_validation(sheet_models=None, doc_metadata_model=None)[source]

Get XLSX validation

Parameters
  • sheet_models (list of Model, optional) – models encoded as separate sheets

  • doc_metadata_model (type) – model whose worksheet contains the document metadata

Returns

validation

Return type

wc_utils.workbook.io.FieldValidation

serialize(value)[source]

Serialize ontology instance

Parameters

value (pronto.Term) – Python representation

Returns

simple Python representation

Return type

str

to_builtin(value)[source]

Encode a value of the attribute using a simple Python representation (dict, list, str, float, bool, None) that is compatible with JSON and YAML

Parameters

value (pronto.Term) – value of the attribute

Returns

simple Python representation of a value of the attribute

Return type

str

validate(obj, value)[source]

Determine if value is a valid value of the attribute

Parameters
  • obj (Model) – object being validated

  • value (pronto.Term) – value of attribute to validate

Returns

None if attribute is valid, other return list of

errors as an instance of core.InvalidAttribute

Return type

core.InvalidAttribute or None

value_equal(val1, val2, tol=0.0)[source]

Determine if attribute values are equal

Parameters
  • val1 (pronto.Term) – first value

  • val2 (pronto.Term) – second value

  • tol (float, optional) – equality tolerance

Returns

True if attribute values are equal

Return type

bool

3.1.1.4.3. obj_tables.sci.refs module

Attributes for references

Author

Jonathan Karr <karr@mssm.edu>

Date

2019-09-20

Copyright

2019, Karr Lab

License

MIT

class obj_tables.sci.refs.Identifier(namespace=None, id=None)[source]

Bases: object

An identifier in a namespace registered with Identifiers.org

namespace[source]

namespace

Type

str

id[source]

identifier in namespace

Type

str

Parameters
  • namespace (str, optional) – namespace

  • id (str, optional) – identifier in namespace

__str__()[source]

Generate a string representation

Returns

string representation

Return type

str

from_dict(value)[source]

Set value from a dictionary representation

Parameters

value (dict) – dictionary representation

Returns

self

Return type

Identifier

from_str(value)[source]

Set value from a string representation ('id' @ 'namespace')

Parameters

value (value) – string representation

Returns

self

Return type

Identifier

Raises

ValueError – if string representation doesn’t match the pattern 'id' @ 'namespace'

get_url()[source]

Get the URL for the webpage for the identifier

Returns

URL for the webpage for the identifier

Return type

str

to_dict()[source]

Get a dictionary representation

Returns

dictionary representation

Return type

dict

to_str()[source]

Generate a string representation ('id' @ 'namespace')

Returns

string representation

Return type

str

class obj_tables.sci.refs.IdentifierAttribute[source]

Bases: obj_tables.core.LiteralAttribute

Identifier attribute

Args: init_value (object, optional): initial value default (object, optional): default value default_cleaned_value (object, optional): value to replace

None values with during cleaning, or function which computes the value to replace None values

none_value (object, optional): none value verbose_name (str, optional): verbose name description (str, optional): description primary (bool, optional): indicate if attribute is primary attribute unique (bool, optional): indicate if attribute value must be unique unique_case_insensitive (bool, optional): if true, conduct case-insensitive test of uniqueness

deserialize(value)[source]

Deserialize value

Parameters

value (str) – string representation of structure

Returns

  • Identifier: cleaned value

  • core.InvalidAttribute: cleaning error

Return type

tuple

from_builtin(json)[source]

Decode a simple Python representation (dict, list, str, float, bool, None) of a value of the attribute that is compatible with JSON and YAML

Parameters

json (list of int) – simple Python representation of a value of the attribute

Returns

value of attribute to validate

Return type

Identifier

get_xlsx_validation(sheet_models=None, doc_metadata_model=None)[source]

Get XLSX validation

Parameters
  • sheet_models (list of Model, optional) – models encoded as separate sheets

  • doc_metadata_model (type) – model whose worksheet contains the document metadata

Returns

validation

Return type

wc_utils.workbook.io.FieldValidation

serialize(value)[source]

Serialize string

Parameters

value (Identifier) – value of attribute to validate

Returns

simple Python representation

Return type

str

to_builtin(value)[source]

Encode a value of the attribute using a simple Python representation (dict, list, str, float, bool, None) that is compatible with JSON and YAML

Parameters

value (Identifier) – value of attribute to validate

Returns

simple Python representation of a value of the attribute

Return type

list of int

validate(obj, value)[source]

Determine if value is a valid value

Parameters
  • obj (Model) – class being validated

  • value (Identifier) – value of attribute to validate

Returns

None if attribute is valid, other

return list of errors as an instance of core.InvalidAttribute

Return type

core.InvalidAttribute or None

class obj_tables.sci.refs.IdentifiersAttribute[source]

Bases: obj_tables.core.LiteralAttribute

Identifiers attribute

Args: init_value (object, optional): initial value default (object, optional): default value default_cleaned_value (object, optional): value to replace

None values with during cleaning, or function which computes the value to replace None values

none_value (object, optional): none value verbose_name (str, optional): verbose name description (str, optional): description primary (bool, optional): indicate if attribute is primary attribute unique (bool, optional): indicate if attribute value must be unique unique_case_insensitive (bool, optional): if true, conduct case-insensitive test of uniqueness

deserialize(value)[source]

Deserialize value

Parameters

value (str) – string representation of structure

Returns

  • Identifier: cleaned value

  • core.InvalidAttribute: cleaning error

Return type

tuple

from_builtin(json)[source]

Decode a simple Python representation (dict, list, str, float, bool, None) of a value of the attribute that is compatible with JSON and YAML

Parameters

json (list of int) – simple Python representation of a value of the attribute

Returns

decoded value of the attribute

Return type

list of int

get_xlsx_validation(sheet_models=None, doc_metadata_model=None)[source]

Get XLSX validation

Parameters
  • sheet_models (list of Model, optional) – models encoded as separate sheets

  • doc_metadata_model (type) – model whose worksheet contains the document metadata

Returns

validation

Return type

wc_utils.workbook.io.FieldValidation

serialize(value)[source]

Serialize string

Parameters

value (list of int) – Python representation

Returns

simple Python representation

Return type

str

to_builtin(value)[source]

Encode a value of the attribute using a simple Python representation (dict, list, str, float, bool, None) that is compatible with JSON and YAML

Parameters

value (list of Identifier) – value of the attribute

Returns

simple Python representation of a value of the attribute

Return type

list of int

validate(obj, value)[source]

Determine if value is a valid value

Parameters
  • obj (Model) – class being validated

  • value (list of Identifier) – value of attribute to validate

Returns

None if attribute is valid, other

return list of errors as an instance of core.InvalidAttribute

Return type

core.InvalidAttribute or None

class obj_tables.sci.refs.DoiAttribute(primary=False, unique=True)[source]

Bases: obj_tables.core.RegexAttribute

DOI attribute

Parameters
  • primary (bool, optional) – indicate if attribute is primary attribute

  • unique (bool, optional) – indicate if attribute value must be unique

static get_url(doi)[source]

Get the URL for a DOI

Parameters

doi (str) – URL for DOI

class obj_tables.sci.refs.DoisAttribute[source]

Bases: obj_tables.core.LiteralAttribute

DOIs attribute

Args: init_value (object, optional): initial value default (object, optional): default value default_cleaned_value (object, optional): value to replace

None values with during cleaning, or function which computes the value to replace None values

none_value (object, optional): none value verbose_name (str, optional): verbose name description (str, optional): description primary (bool, optional): indicate if attribute is primary attribute unique (bool, optional): indicate if attribute value must be unique unique_case_insensitive (bool, optional): if true, conduct case-insensitive test of uniqueness

PATTERN = '^10.\\d{4,9}\\/[-._;()/:A-Z0-9]+$'[source]
deserialize(value)[source]

Deserialize value

Parameters

value (str) – string representation of structure

Returns

  • list of int: cleaned value

  • core.InvalidAttribute: cleaning error

Return type

tuple

from_builtin(json)[source]

Decode a simple Python representation (dict, list, str, float, bool, None) of a value of the attribute that is compatible with JSON and YAML

Parameters

json (list of int) – simple Python representation of a value of the attribute

Returns

decoded value of the attribute

Return type

list of int

get_xlsx_validation(sheet_models=None, doc_metadata_model=None)[source]

Get XLSX validation

Parameters
  • sheet_models (list of Model, optional) – models encoded as separate sheets

  • doc_metadata_model (type) – model whose worksheet contains the document metadata

Returns

validation

Return type

wc_utils.workbook.io.FieldValidation

serialize(value)[source]

Serialize string

Parameters

value (list of int) – Python representation

Returns

simple Python representation

Return type

str

to_builtin(value)[source]

Encode a value of the attribute using a simple Python representation (dict, list, str, float, bool, None) that is compatible with JSON and YAML

Parameters

value (list of int) – value of the attribute

Returns

simple Python representation of a value of the attribute

Return type

list of int

validate(obj, value)[source]

Determine if value is a valid value

Parameters
  • obj (Model) – class being validated

  • value (list of str) – value of attribute to validate

Returns

None if attribute is valid, other

return list of errors as an instance of core.InvalidAttribute

Return type

core.InvalidAttribute or None

class obj_tables.sci.refs.PubMedIdAttribute(primary=False, unique=True)[source]

Bases: obj_tables.core.IntegerAttribute

PubMed id attribute

Parameters
  • primary (bool, optional) – indicate if attribute is primary attribute

  • unique (bool, optional) – indicate if attribute value must be unique

static get_url(pmid)[source]

Get the URL for a PubMed id

Parameters

pmid (int) – URL for PubMed id

class obj_tables.sci.refs.PubMedIdsAttribute[source]

Bases: obj_tables.core.LiteralAttribute

PubMed ids attribute

Args: init_value (object, optional): initial value default (object, optional): default value default_cleaned_value (object, optional): value to replace

None values with during cleaning, or function which computes the value to replace None values

none_value (object, optional): none value verbose_name (str, optional): verbose name description (str, optional): description primary (bool, optional): indicate if attribute is primary attribute unique (bool, optional): indicate if attribute value must be unique unique_case_insensitive (bool, optional): if true, conduct case-insensitive test of uniqueness

deserialize(value)[source]

Deserialize value

Parameters

value (str) – string representation of structure

Returns

  • list of int: cleaned value

  • core.InvalidAttribute: cleaning error

Return type

tuple

from_builtin(json)[source]

Decode a simple Python representation (dict, list, str, float, bool, None) of a value of the attribute that is compatible with JSON and YAML

Parameters

json (list of int) – simple Python representation of a value of the attribute

Returns

decoded value of the attribute

Return type

list of int

get_xlsx_validation(sheet_models=None, doc_metadata_model=None)[source]

Get XLSX validation

Parameters
  • sheet_models (list of Model, optional) – models encoded as separate sheets

  • doc_metadata_model (type) – model whose worksheet contains the document metadata

Returns

validation

Return type

wc_utils.workbook.io.FieldValidation

serialize(value)[source]

Serialize string

Parameters

value (list of int) – Python representation

Returns

simple Python representation

Return type

str

to_builtin(value)[source]

Encode a value of the attribute using a simple Python representation (dict, list, str, float, bool, None) that is compatible with JSON and YAML

Parameters

value (list of int) – value of the attribute

Returns

simple Python representation of a value of the attribute

Return type

list of int

validate(obj, value)[source]

Determine if value is a valid value

Parameters
  • obj (Model) – class being validated

  • value (list of Identifier) – value of attribute to validate

Returns

None if attribute is valid, other

return list of errors as an instance of core.InvalidAttribute

Return type

core.InvalidAttribute or None

3.1.1.4.4. obj_tables.sci.uncertainty module

Uncertain value attribute

Author

Jonathan Karr <karr@mssm.edu>

Date

2012-03-05

Copyright

2020, Karr Lab

License

MIT

class obj_tables.sci.uncertainty.UncertainFloatAttribute(none=True, default=None, default_cleaned_value=None, none_value=None, verbose_name='', description="Measurement (e.g. 'x ± y')", primary=False, unique=False, unique_case_insensitive=False)[source]

Bases: obj_tables.core.LiteralAttribute

Attribute for a value and its uncertainty

none[source]

if False, the attribute is invalid if its value is None

Type

bool

Parameters
  • none (bool, optional) – if False, the attribute is invalid if its value is None

  • default (uncertainties.core.Variable, optional) – default value

  • default_cleaned_value (uncertainties.core.Variable, optional) – value to replace None values with during cleaning

  • none_value (object, optional) – none value

  • verbose_name (str, optional) – verbose name

  • description (str, optional) – description

  • primary (bool, optional) – indicate if attribute is primary attribute

  • unique (bool, optional) – indicate if attribute value must be unique

  • unique_case_insensitive (bool, optional) – if true, conduct case-insensitive test of uniqueness

clean(value)[source]

Convert attribute value into the appropriate type

Parameters

value (object) – value of attribute to clean

Returns

tuple of cleaned value and cleaning error

Return type

tuple of str, core.InvalidAttribute or None

copy_value(value, objects_and_copies)[source]

Copy value

Parameters
  • value (uncertainties.core.Variable) – value

  • objects_and_copies (dict) – dictionary that maps objects to their copies

Returns

copy of value

Return type

uncertainties.core.Variable

from_builtin(json)[source]

Decode a simple Python representation (dict, list, str, float, bool, None) of a value of the attribute that is compatible with JSON and YAML

Parameters

json (dict) – simple Python representation of a value of the attribute

Returns

decoded value of the attribute

Return type

uncertainties.core.Variable

get_default()[source]

Get default value for attribute

Returns

initial value

Return type

uncertainties.core.Variable

get_default_cleaned_value()[source]

Get value to replace None values with during cleaning

Returns

initial value

Return type

uncertainties.core.Variable

get_xlsx_validation(sheet_models=None, doc_metadata_model=None)[source]

Get XLSX validation

Parameters
  • sheet_models (list of Model, optional) – models encoded as separate sheets

  • doc_metadata_model (type) – model whose worksheet contains the document metadata

Returns

validation

Return type

wc_utils.workbook.io.FieldValidation

serialize(value)[source]

Serialize to a string

Parameters

value (uncertainties.core.Variable) – Python representation

Returns

simple Python representation

Return type

str

to_builtin(value)[source]

Encode a value of the attribute using a simple Python representation (dict, list, str, float, bool, None) that is compatible with JSON and YAML

Parameters

value (uncertainties.core.Variable) – value of the attribute

Returns

simple Python representation of a value of the attribute

Return type

dict

validate(obj, value)[source]

Determine if value is a valid value for this UncertainFloatAttribute

Parameters
  • obj (Model) – class being validated

  • value (uncertainties.core.Variable) – value of attribute to validate

Returns

None if attribute is valid, other return list of

errors as an instance of core.InvalidAttribute

Return type

core.InvalidAttribute or None

value_equal(val1, val2, tol=0.0)[source]

Determine if attribute values are equal

Parameters
  • val1 (uncertainties.core.Variable) – first value

  • val2 (uncertainties.core.Variable) – second value

  • tol (float, optional) – equality tolerance

Returns

True if attribute values are equal

Return type

bool

3.1.1.4.5. obj_tables.sci.units module

Unit attribute

Author

Jonathan Karr <karr@mssm.edu>

Date

2019-01-20

Copyright

2019, Karr Lab

License

MIT

class obj_tables.sci.units.UnitAttribute(registry, choices=None, none=True, default=None, default_cleaned_value=None, none_value=None, verbose_name='', description="Units (e.g. 'second', 'meter', or 'gram')", primary=False, unique=False, unique_case_insensitive=False)[source]

Bases: obj_tables.core.LiteralAttribute

Unit attribute

registry[source]

unit registry

Type

pint.UnitRegistry

choices[source]

allowed values

Type

tuple of pint.unit._Unit

none[source]

if False, the attribute is invalid if its value is None

Type

bool

Parameters
  • registry (pint.UnitRegistry) – unit registry

  • choices (tuple of pint.unit._Unit, optional) – allowed units

  • none (bool, optional) – if False, the attribute is invalid if its value is None

  • default (registry.Unit, optional) – default value

  • default_cleaned_value (registry.Unit, optional) – value to replace None values with during cleaning

  • none_value (object, optional) – none value

  • verbose_name (str, optional) – verbose name

  • description (str, optional) – description

  • primary (bool, optional) – indicate if attribute is primary attribute

  • unique (bool, optional) – indicate if attribute value must be unique

  • unique_case_insensitive (bool, optional) – if true, conduct case-insensitive test of uniqueness

Raises
  • ValueError – if registry is not an instance of pint.UnitRegistry

  • ValueError – if default is not an instance of registry.Unit

  • ValueError – if default_cleaned_value is not an instance of registry.Unit

  • ValueError – if a choice is not an instance of registry.Unit

clean(value)[source]

Convert attribute value into the appropriate type

Parameters

value (object) – value of attribute to clean

Returns

tuple of cleaned value and cleaning error

Return type

tuple of str, core.InvalidAttribute or None

copy_value(value, objects_and_copies)[source]

Copy value

Parameters
  • value (pint.unit._Unit) – value

  • objects_and_copies (dict) – dictionary that maps objects to their copies

Returns

copy of value

Return type

pint.unit._Unit

from_builtin(json)[source]

Decode a simple Python representation (dict, list, str, float, bool, None) of a value of the attribute that is compatible with JSON and YAML

Parameters

json (str) – simple Python representation of a value of the attribute

Returns

decoded value of the attribute

Return type

pint.unit._Unit

get_default()[source]

Get default value for attribute

Returns

initial value

Return type

pint.unit._Unit

get_default_cleaned_value()[source]

Get value to replace None values with during cleaning

Returns

initial value

Return type

pint.unit._Unit

get_xlsx_validation(sheet_models=None, doc_metadata_model=None)[source]

Get XLSX validation

Parameters
  • sheet_models (list of Model, optional) – models encoded as separate sheets

  • doc_metadata_model (type) – model whose worksheet contains the document metadata

Returns

validation

Return type

wc_utils.workbook.io.FieldValidation

serialize(value)[source]

Serialize string

Parameters

value (pint.unit._Unit) – Python representation

Returns

simple Python representation

Return type

str

to_builtin(value)[source]

Encode a value of the attribute using a simple Python representation (dict, list, str, float, bool, None) that is compatible with JSON and YAML

Parameters

value (pint.unit._Unit) – value of the attribute

Returns

simple Python representation of a value of the attribute

Return type

str

validate(obj, value)[source]

Determine if value is a valid value for this UnitAttribute

Parameters
  • obj (Model) – class being validated

  • value (pint.unit._Unit) – value of attribute to validate

Returns

None if attribute is valid, other return list of

errors as an instance of core.InvalidAttribute

Return type

core.InvalidAttribute or None

value_equal(val1, val2, tol=0.0)[source]

Determine if attribute values are equal

Parameters
  • val1 (pint.unit._Unit) – first value

  • val2 (pint.unit._Unit) – second value

  • tol (float, optional) – equality tolerance

Returns

True if attribute values are equal

Return type

bool

class obj_tables.sci.units.QuantityAttribute(registry, choices=None, none=True, default=None, default_cleaned_value=None, none_value=None, verbose_name='', description="Units (e.g. 'second', 'meter', or 'gram')", primary=False, unique=False, unique_case_insensitive=False)[source]

Bases: obj_tables.core.LiteralAttribute

Quantity (magntitude and units) attribute

registry[source]

unit registry

Type

pint.UnitRegistry

choices[source]

allowed units

Type

tuple of pint.unit._Unit

none[source]

if False, the attribute is invalid if its value is None

Type

bool

Parameters
  • registry (pint.UnitRegistry) – unit registry

  • choices (tuple of pint.unit._Unit, optional) – allowed units

  • none (bool, optional) – if False, the attribute is invalid if its value is None

  • default (pint.unit.unit, optional) – default value

  • default_cleaned_value (str, optional) – value to replace None values with during cleaning

  • none_value (object, optional) – none value

  • verbose_name (str, optional) – verbose name

  • description (str, optional) – description

  • primary (bool, optional) – indicate if attribute is primary attribute

  • unique (bool, optional) – indicate if attribute value must be unique

  • unique_case_insensitive (bool, optional) – if true, conduct case-insensitive test of uniqueness

Raises
  • ValueError – if registry is not an instance of pint.UnitRegistry

  • ValueError – if default is not an instance of registry.Unit

  • ValueError – if default_cleaned_value is not an instance of registry.Unit

  • ValueError – if a choice is not an instance of registry.Unit

clean(value)[source]

Convert attribute value into the appropriate type

Parameters

value (object) – value of attribute to clean

Returns

tuple of cleaned value and cleaning error

Return type

tuple of str, core.InvalidAttribute or None

copy_value(value, objects_and_copies)[source]

Copy value

Parameters
  • value (pint.quantity._Quantity) – value

  • objects_and_copies (dict) – dictionary that maps objects to their copies

Returns

copy of value

Return type

pint.quantity._Quantity

from_builtin(json)[source]

Decode a simple Python representation (dict, list, str, float, bool, None) of a value of the attribute that is compatible with JSON and YAML

Parameters

json (str) – simple Python representation of a value of the attribute

Returns

decoded value of the attribute

Return type

pint.quantity._Quantity

get_default()[source]

Get default value for attribute

Returns

initial value

Return type

pint.quantity._Quantity

get_default_cleaned_value()[source]

Get value to replace None values with during cleaning

Returns

initial value

Return type

pint.quantity._Quantity

get_xlsx_validation(sheet_models=None, doc_metadata_model=None)[source]

Get XLSX validation

Parameters
  • sheet_models (list of Model, optional) – models encoded as separate sheets

  • doc_metadata_model (type) – model whose worksheet contains the document metadata

Returns

validation

Return type

wc_utils.workbook.io.FieldValidation

serialize(value)[source]

Serialize string

Parameters

value (pint.quantity._Quantity) – Python representation

Returns

simple Python representation

Return type

str

to_builtin(value)[source]

Encode a value of the attribute using a simple Python representation (dict, list, str, float, bool, None) that is compatible with JSON and YAML

Parameters

value (pint.quantity._Quantity) – value of the attribute

Returns

simple Python representation of a value of the attribute

Return type

str

validate(obj, value)[source]

Determine if value is a valid value for this QuantityAttribute

Parameters
  • obj (Model) – class being validated

  • value (pint.quantity._Quantity) – value of attribute to validate

Returns

None if attribute is valid, other return list of

errors as an instance of core.InvalidAttribute

Return type

core.InvalidAttribute or None

value_equal(val1, val2, tol=1e-12)[source]

Determine if attribute values are equal

Parameters
  • val1 (pint.quantity._Quantity) – first value

  • val2 (pint.quantity._Quantity) – second value

  • tol (float, optional) – equality tolerance

Returns

True if attribute values are equal

Return type

bool

obj_tables.sci.units.get_obj_units(obj)[source]

Get units used in a model object and related objects

Parameters

obj (core.Model) – model object

Returns

units used in model object

Return type

list of pint.unit._Unit

3.1.1.4.6. Module contents