riverine.experiments#

Classes#

AbstractLocationType

LocationInfo

LocationDict

Experiment

A class collecting many related mixes and components, allowing methods to be run that consider all of them

Functions#

Module Contents#

riverine.experiments._exp_attr_set_reference(self, attribute: Any, reference: riverine.references.Reference | None) riverine.references.Reference | None[source]#
class riverine.experiments.AbstractLocationType[source]#
__slots__ = ()[source]#
abstract property name[source]#
property is_echo_source_compatible: bool[source]#
Abstractmethod:

class riverine.experiments.LocationInfo[source]#
echo_source_type: str | None = None[source]#
echo_dest_type: str | None = None[source]#
full_location: tuple[str, Ellipsis] = ()[source]#
info: dict[str, Any][source]#
classmethod from_obj(obj) LocationInfo[source]#
class riverine.experiments.LocationDict(locs: dict[str, LocationInfo | Any])[source]#
_locs: dict[str, LocationInfo][source]#
classmethod from_obj(obj) LocationDict[source]#
__getitem__(key: str) LocationInfo[source]#
__setitem__(key: str, value: LocationInfo | Any) None[source]#
__delitem__(key: str) None[source]#
__contains__(key: str) bool[source]#
__iter__() Iterator[str][source]#
__len__() int[source]#
keys() collections.abc.KeysView[str][source]#
values() collections.abc.ValuesView[LocationInfo][source]#
items() collections.abc.ItemsView[str, LocationInfo][source]#
__repr__() str[source]#
__str__() str[source]#
__eq__(other) bool[source]#
get(key: str, default: Any | None = None) LocationInfo | None[source]#
class riverine.experiments.Experiment[source]#

A class collecting many related mixes and components, allowing methods to be run that consider all of them together.

Components can be referenced, and set, by name with [], and can be iterated through.

__hash__[source]#
components: dict[str, riverine.components.AbstractComponent][source]#
volume_checks: bool = True[source]#
reference: riverine.references.Reference | None[source]#
locations: LocationDict[source]#
generate_picklist(_cache_key=None) Experiment.generate_picklist.PickList[source]#
add(component: riverine.components.AbstractComponent, *, check_volumes: bool | None = None, apply_reference: bool = True, check_existing: bool | Literal['equal'] = 'equal') Experiment[source]#
add_mix(mix_or_actions: riverine.mixes.Mix | Sequence[riverine.actions.AbstractAction] | riverine.actions.AbstractAction, name: str = '', test_tube_name: str | None = None, *, fixed_total_volume: riverine.units.DecimalQuantity | str | None = None, fixed_concentration: str | riverine.units.DecimalQuantity | None = None, buffer_name: str = 'Buffer', min_volume: riverine.units.DecimalQuantity | str = Q_('0.5', uL), check_volumes: bool | None = None, apply_reference: bool = True, check_existing: bool | Literal['equal'] = 'equal') Experiment[source]#

Add a mix to the experiment, either as a Mix object, or by creating a new Mix.

Either the first argument should be a Mix, or arguments should be passed as for initializing a Mix.

If check_volumes is True (by default), the mix will be added to the experiment, and volumes checked. If the mix causes a volume usage problem, it will not be added to the Experiment, and a VolumeError will be raised.

If check_existing is True (by default), then a exception is raised if the experiment already contains a mix with the name name. Otherwise, the existing mix is replaced with the new mix.

__setitem__(name: str, mix: riverine.components.AbstractComponent) None[source]#
get(key: str, default=None)[source]#
__getitem__(name: str) riverine.components.AbstractComponent[source]#
__delitem__(name: str) None[source]#
__contains__(name: str) bool[source]#
remove_mix(name: str) None[source]#

Remove a mix from the experiment, referenced by name,

remove(name: str) None[source]#

Remove a mix from the experiment, referenced by name,

__len__() int[source]#
__iter__() Iterator[riverine.components.AbstractComponent][source]#
consumed_and_produced_volumes() Mapping[str, Tuple[riverine.units.DecimalQuantity, riverine.units.DecimalQuantity]][source]#
check_volumes(showall: bool = False, display: bool = True, raise_error: bool = False) str | None[source]#

Check to ensure that consumed volumes are less than made volumes.

_unstructure() dict[str, Any][source]#

Create a dict representation of the Experiment.

classmethod _structure(d: dict[str, Any]) Experiment[source]#

Create an Experiment from a dict representation.

classmethod load(filename_or_stream: str | os.PathLike | TextIO) Experiment[source]#

Load an experiment from a JSON-formatted file created by Experiment.save.

resolve_components() None[source]#

Resolve string/blank-component components in mixes, searching through the mixes in the experiment. FIXME Add used mixes to the experiment if they are not already there.

save(filename_or_stream: str | os.PathLike | TextIO) None[source]#

Save an experiment to a JSON-formatted file.

Tries to store each component/mix only once, with other mixes referencing those components.

use_reference(reference: riverine.references.Reference) Experiment[source]#

Apply a Reference, in place, to all components in the Experiment.