adios_db.models.common package
Submodules
adios_db.models.common.measurement module
Generic Measurement Types
These are structures that handle an individual measurment:
They have a value, a unit type and a unit.
They can be converted to other units if need be.
They can accommodate a single value, or a range of values
They can also accommodate a standard deviation and number of replicates.
- class adios_db.models.common.measurement.AngularVelocity(value: float = None, unit: str = None, min_value: float = None, max_value: float = None, standard_deviation: float = None, replicates: int = None, unit_type: str = None)
- Bases: - MeasurementBase- unit_type: str = 'angularvelocity'
 
- class adios_db.models.common.measurement.AnyUnit(*args, **kwargs)
- Bases: - MeasurementBase- This is a type for data that could be any unit_type - validate()
- a kludge – this should probably create the correct Measurement when created instead 
 
- class adios_db.models.common.measurement.Concentration(value: float = None, unit: str = None, min_value: float = None, max_value: float = None, standard_deviation: float = None, replicates: int = None, unit_type: str = None)
- Bases: - MeasurementBase- unit_type: str = 'concentration'
 
- class adios_db.models.common.measurement.Density(value: float = None, unit: str = None, min_value: float = None, max_value: float = None, standard_deviation: float = None, replicates: int = None, unit_type: str = None)
- Bases: - MeasurementBase- unit_type: str = 'density'
 
- class adios_db.models.common.measurement.Dimensionless(value: float = None, unit: str = None, min_value: float = None, max_value: float = None, standard_deviation: float = None, replicates: int = None, unit_type: str = None)
- Bases: - MeasurementBase- This is a type that can be converted to generic fractional amounts, but does not refer to a particular measurable quantity. - unit_type: str = 'dimensionless'
 
- class adios_db.models.common.measurement.DynamicViscosity(value: float = None, unit: str = None, min_value: float = None, max_value: float = None, standard_deviation: float = None, replicates: int = None, unit_type: str = None)
- Bases: - MeasurementBase- unit_type: str = 'dynamicviscosity'
 
- class adios_db.models.common.measurement.InterfacialTension(value: float = None, unit: str = None, min_value: float = None, max_value: float = None, standard_deviation: float = None, replicates: int = None, unit_type: str = None)
- Bases: - MeasurementBase- unit_type: str = 'interfacialtension'
 
- class adios_db.models.common.measurement.KinematicViscosity(value: float = None, unit: str = None, min_value: float = None, max_value: float = None, standard_deviation: float = None, replicates: int = None, unit_type: str = None)
- Bases: - MeasurementBase- unit_type: str = 'kinematicviscosity'
 
- class adios_db.models.common.measurement.Length(value: float = None, unit: str = None, min_value: float = None, max_value: float = None, standard_deviation: float = None, replicates: int = None, unit_type: str = None)
- Bases: - MeasurementBase- unit_type: str = 'length'
 
- class adios_db.models.common.measurement.Mass(value: float = None, unit: str = None, min_value: float = None, max_value: float = None, standard_deviation: float = None, replicates: int = None, unit_type: str = None)
- Bases: - MeasurementBase- unit_type: str = 'mass'
 
- class adios_db.models.common.measurement.MassFraction(value: float = None, unit: str = None, min_value: float = None, max_value: float = None, standard_deviation: float = None, replicates: int = None, unit_type: str = None)
- Bases: - MeasurementBase- unit_type: str = 'massfraction'
 
- class adios_db.models.common.measurement.MassOrVolumeFraction(*args, **kwargs)
- Bases: - MeasurementBase- This could be Mass or Volume Fraction, or unspecified. - Unit_type must be one of:
- MassFraction 
- VolumeFraction 
- Concentration (could be either mass or volume – who knows?) 
 
 - Parameters:
- unit_type – the value itself 
- value – the value itself 
- unit – the value itself 
- min_value – the value itself 
- max_value – the value itself 
- standard_deviation – the value itself 
- replicates – the value itself 
- unit_type – the type of unit – must be “massfraction”, “volumefraction” or “concentration” 
 
 - copy()
- copy an instance - This needs to be special, to preserve the unit_type attribute 
 
- class adios_db.models.common.measurement.NeedleAdhesion(value: float = None, unit: str = None, min_value: float = None, max_value: float = None, standard_deviation: float = None, replicates: int = None, unit_type: str = None)
- Bases: - MeasurementBase- unit_type: str = 'needleadhesion'
 - validate()
- Function to validate a dataclass with fields that have validate methods. The validate methods are expected to return a list of validation messages. - The top-level validator extends the existing list 
 
- class adios_db.models.common.measurement.Pressure(value: float = None, unit: str = None, min_value: float = None, max_value: float = None, standard_deviation: float = None, replicates: int = None, unit_type: str = None)
- Bases: - MeasurementBase- unit_type: str = 'pressure'
 
- class adios_db.models.common.measurement.Temperature(value: float = None, unit: str = None, min_value: float = None, max_value: float = None, standard_deviation: float = None, replicates: int = None, unit_type: str = None)
- Bases: - MeasurementBase- convert_to(new_unit)
- Convert this Measurement object to the specified new unit - The object is mutated in place. - If the conversion can not be performed, an Exception will be raised, and the object not altered. - This will also return the object (self) – but that is a deprecated feature – do not use it! - If you want a new object, use converted_to instead 
 - fixCK = False
 - fix_C_K()
- This is a bit of a kludge: - The correct conversion from C to K is 273.16 - But a lot of data sources (notably the ADIOS2 database) used 273.0. - So we end up with temps like: -0.15 C instead of 0.0 C This function will “correct” that. - Note: it also converts to C 
 - unit_type: str = 'temperature'
 - validate()
- Function to validate a dataclass with fields that have validate methods. The validate methods are expected to return a list of validation messages. - The top-level validator extends the existing list 
 
- class adios_db.models.common.measurement.Time(value: float = None, unit: str = None, min_value: float = None, max_value: float = None, standard_deviation: float = None, replicates: int = None, unit_type: str = None)
- Bases: - MeasurementBase- unit_type: str = 'time'
 
- class adios_db.models.common.measurement.Unitless(value: float = None, unit: str = None, min_value: float = None, max_value: float = None, standard_deviation: float = None, replicates: int = None, unit_type: str = None)
- Bases: - MeasurementBase- This is a type for data with no unit at all. - convert_to(*args, **kwargs)
- Convert this Measurement object to the specified new unit - The object is mutated in place. - If the conversion can not be performed, an Exception will be raised, and the object not altered. - This will also return the object (self) – but that is a deprecated feature – do not use it! - If you want a new object, use converted_to instead 
 - unit_type: str = 'unitless'
 - validate()
- Function to validate a dataclass with fields that have validate methods. The validate methods are expected to return a list of validation messages. - The top-level validator extends the existing list 
 
adios_db.models.common.utilities module
Tools for helping make our data models.
So far: making dataclasses read/writable as JSON
- class adios_db.models.common.utilities.JSON_List(iterable=(), /)
- Bases: - list- just like a list, but with the ability to turn it into JSON - A regular list can only be converted to JSON if it has JSON-able objects in it. - Note: must be subclassed, and the item_type attribute set - classmethod from_py_json(py_json, allow_none=False)
- create a JSON_List from json array of objects that may be json-able. 
 - item_type = None
 - py_json(sparse=True)
 - validate()
 
- adios_db.models.common.utilities.dataclass_to_json(cls)
- class decorator that adds the ability to save a dataclass as JSON - And all the other special behavior that we need for the database objects - e.g. validation, etc. - All fields must be either JSON-able Python types or have be a type with a _to_json method 
- adios_db.models.common.utilities.something(val)
- much like python’s “Truthy” and Falsey”, but we want some values to not be false like zero, for instance 
adios_db.models.common.validators module
- class adios_db.models.common.validators.DateTimeValidator(err_msg=None)
- Bases: - object- Validator for strings that should be an ISO string, e.g. - 2010-06-24T - it uses the build-in: datetime.fromisoformat() - so anything that passes that will pass this validator 
- class adios_db.models.common.validators.EnumValidator(valid_items, err_msg, case_insensitive=False)
- Bases: - object- validator for Enum values: a value that can only be one of a set 
- class adios_db.models.common.validators.FloatRangeValidator(min_value, max_value, err_msg=None)
- Bases: - object- Validator for float values that can only be a given range - range is inclusive (<= and >=) 
- class adios_db.models.common.validators.YearValidator(min_year, max_year, err_msg=None)
- Bases: - object- Validator for float values that can only be a given range - range is inclusive (<= and >=) 
adios_db.models.common.vocabulary module
- adios_db.models.common.vocabulary.read_file_content(filename)