Attributes & Reads
Environmental attributes, how they are inherited down the location tree, and instrument reads. See the Environmental Attributes & Inheritance and Reads & Instrument Measurements manual chapters.
CHESSCore.Unknown — Constant
const Unknown = UnknownValue()Singleton representing an actively-indeterminate attribute value. Unlike missing, an Unknown value is inserted into a computed environment and propagates/overrides like a normal value — it asserts "unknown here" down to descendants, rather than silently deferring to an ancestor.
CHESSCore.attribute_kinds — Constant
const attribute_kinds::Dict{Symbol,AttributeKind}Registry of every AttributeKind defined with @attribute, keyed by name. Kinds registered in any module are also added here. Look up a single kind with @attr_str (attr"Temperature") rather than indexing this directly.
CHESSCore.Attribute — Type
mutable struct AttributeAttribute values define the environmental properties of Location objects. There is a single concrete Attribute type for every environmental variable — the specific kind (Temperature, Humidity, ...) is carried as data (an AttributeKind), not as a distinct Julia type.
value is one of:
- a
Real: a concrete reading, stored inkind.unit. missing: no local opinion —environmentdefers to an inherited value.Unknown: actively indeterminate — asserts "unknown" down to descendants.
CHESSCore.AttributeKind — Type
struct AttributeKindA named, interned, immutable value describing a kind of environmental attribute (e.g. :Temperature, :Humidity), mirroring LocationKind. Registered via @attribute.
Fields:
name: the kind's unique identifier.unit: canonical storage unit (e.g.u"°C") — values are converted to this unit on construction.
CHESSCore.UnknownValue — Type
struct UnknownValue endSentinel type for an attribute value that is actively indeterminate (e.g. a broken sensor), as distinct from missing ("no local opinion, defer to an ancestor's value"). Use the singleton Unknown.
See also: isunknown
CHESSCore.attribute_kind — Method
attribute_kind(x::Attribute)Access the AttributeKind of an Attribute
CHESSCore.attribute_unit — Method
attribute_unit(x::Attribute)Access the canonical unit of an Attribute
CHESSCore.isunknown — Method
isunknown(x::Attribute)Return true if x's value is the Unknown sentinel. Mirrors ismissing.
CHESSCore.quantity — Method
quantity(x::Attribute)Return the quantity of an Attribute. Returns missing/Unknown unchanged if the attribute's value is missing/Unknown.
CHESSCore.set_attribute! — Method
set_attribute!(x::AttributeDict,attribute::Attribute)Set the value for key attribute.kind.name of dict to attribute.
This method keeps each attribute under the name of its own kind, so the key and the attribute always match.
CHESSCore.value — Method
value(x::Attribute)Access the value property of an Attribute
CHESSCore.@attr_str — Macro
@attr_str(kind)String macro to recall an AttributeKind registered with @attribute by name, mirroring @loc_str (and sharing its lookup machinery). @attribute doesn't export the name it defines (to avoid flooding the namespace of anyone who usings a lab module with dozens of kind names), so this is the collision-safe way to look one up without needing to using the specific lab module that defined it.
Example:
julia> attr"Temperature"
AttributeKind(Temperature)CHESSCore.@attribute — Macro
@attribute name unitDefine a new AttributeKind and register it under name, both as a const binding and in the attribute_kinds registry — mirrors @species/@location_kind. name is directly callable as a constructor, e.g. Temperature(10u"°C").
Example:
julia> using Unitful
julia> @attribute Temperature u"°C"
julia> Temperature(10u"°C")
10.0 °CSee also: Attribute
CHESSCore._environment_cache — Constant
const _environment_cacheEvictable, external cache for environment results, keyed by object identity. Entries are reclaimed automatically once a Location is garbage-collected.
CHESSCore.environment — Method
environment(x::Location)Compute the environmental attributes of location x: x's own non-missing attributes overriding its parent's (already-computed, cached) environment.
missing attribute values mean "no local opinion, defer to the inherited value" and are skipped. Unknown values are inserted like any concrete value — they assert "unknown here" down to descendants unless a more proximal location overrides with a real reading or an explicit missing.
Results are cached (see invalidate_environment!); the cache is bounded by whatever's currently resident in memory.
CHESSCore.invalidate_environment! — Method
invalidate_environment!(x::Location)Clear the cached environment for x and every currently-resident descendant. Called whenever x's attributes or tree position change (set_attribute!, move_into!, remove!).
CHESSCore.read_kinds — Constant
const read_kinds::Dict{Symbol,ReadKind}Registry of every ReadKind defined with @read, keyed by name. Kinds registered in any module are also added here. Look up a single kind with @read_str (read"Absorbance") rather than indexing this directly.
CHESSCore.Read — Type
struct ReadRead values represent a single instrument measurement of a Location — the specific kind (Absorbance, Fluorescence, ...) is carried as data (a ReadKind), not as a distinct Julia type, mirroring Attribute. Unlike Attribute, Read is immutable: nothing ever edits a Read in place, since many independent Reads of the same ReadKind can coexist for the same location at once (as opposed to Attribute's single-slot-per-kind, overwritable semantics) — see reads/record_read!.
value is one of:
- a
Real(quantitative kinds only): a concrete measurement, stored inkind.unit. - a
String(qualitative kinds only): a categorical result or free-text observation, validated againstkind.allowed_valuesif that's set. Unknown: the instrument attempted this read and got an indeterminate/invalid result (sensor error, saturation, timeout).missing: this location was in scope for a batch of reads but produced no result (e.g. masked out of a plate scan) — distinct from never having attempted a read at all.
time is the instrument's own recorded time for this read (nothing if unknown/unavailable) — kept as data only, never compared across different instruments. See read_time.
CHESSCore.ReadKind — Type
struct ReadKindA named, interned, immutable value describing a kind of instrument measurement (e.g. :Absorbance, :ColorimetricResult), mirroring AttributeKind/LocationKind. Registered via @read.
A ReadKind is either quantitative or qualitative — mode is data, not a distinct type (mirroring how LocationKind avoids a type per kind):
- Quantitative:
unitis set (e.g.u"percent") — values areReal, converted touniton construction. Seeis_quantitative. - Qualitative:
unitisnothing— values areString.allowed_values, if set, constrains them to a fixed enumerated set (e.g. a colorimetric result); ifnothing, any string is accepted (free-text observation). Seeis_qualitative.
Fields:
name: the kind's unique identifier.unit: canonical storage unit for a quantitative kind;nothingfor a qualitative kind.allowed_values: the fixed set of valid strings for a constrained qualitative kind;nothingfor a quantitative kind, or for an unconstrained (free-text) qualitative kind.
CHESSCore.is_qualitative — Method
is_qualitative(k::ReadKind)Return true if k is a qualitative (string-valued) kind.
CHESSCore.is_quantitative — Method
is_quantitative(k::ReadKind)Return true if k is a quantitative (unit-bearing) kind.
CHESSCore.quantity — Method
quantity(x::Read)Return the quantity of a Read. Returns missing/Unknown unchanged if the read's value is missing/Unknown. For a qualitative read, there's no unit to attach – returns the raw String value as-is. Mirrors quantity(x::Attribute).
CHESSCore.read_kind — Method
read_kind(x::Read)Access the ReadKind of a Read. Mirrors attribute_kind.
CHESSCore.read_time — Method
read_time(x::Read)Access the instrument's own recorded time for a Read, or nothing if unavailable. Named to avoid colliding with Base.time.
CHESSCore.read_unit — Method
read_unit(x::Read)Access the canonical unit of a Read. Mirrors attribute_unit.
CHESSCore.value — Method
value(x::Read)Access the value property of a Read. Mirrors value(x::Attribute).
CHESSCore.@read — Macro
@read name unit=nothing allowed_values=nothingDefine a new ReadKind and register it under name, both as a const binding and in the read_kinds registry — mirrors @attribute. name is directly callable as a constructor, e.g. Absorbance(0.9u"percent") or ColorimetricResult("Positive").
Examples:
julia> using Unitful
julia> @read Absorbance u"percent" # quantitative
julia> Absorbance(90u"percent")
90.0 %
julia> @read Observation # qualitative, free text
julia> Observation("looked a bit cloudy")
julia> @read ColorimetricResult nothing Set(["Positive","Negative"]) # qualitative, constrained
julia> ColorimetricResult("Positive")See also: Read
CHESSCore.@read_str — Macro
@read_str(kind)String macro to recall a ReadKind registered with @read by name, mirroring @loc_str/@attr_str (and sharing their lookup machinery). @read doesn't export the name it defines (to avoid flooding the namespace of anyone who usings a lab module with dozens of kind names), so this is the collision-safe way to look one up without needing to using the specific lab module that defined it.
Example:
julia> read"Absorbance"
ReadKind(Absorbance)