lightlab.laboratory package¶
The laboratory module facilitates the organization and documentation of instruments, experiments and devices. The objects defined here are designed to be “hashable”, i.e., easy to store and share.
Submodules:
Subpackages:
Summary¶
Classes:
FrozenDict |
Don’t forget the docstrings!! |
Hashable |
Hashable class to be used with jsonpickle’s module. |
NamedList |
Object list that enforces that there are only one object.name in the list. |
Node |
Node is a token of an object that exists in a laboratory. |
TypedList |
Object list that enforces that there are only one object.name in the list and that they belong to a certain class (obj_type). |
Functions:
typed_property |
Property that only accepts instances of a class and stores the contents in self.name |
Reference¶
-
class
FrozenDict(data)[source]¶ Bases:
collections.abc.MappingDon’t forget the docstrings!!
-
class
Hashable(**kwargs)[source]¶ Bases:
objectHashable class to be used with jsonpickle’s module. Rationale: This is a fancy way to do
self.__dict__ == other.__dict__. That line fails when there are circular references within the __dict__.Hashablesolves that.By default, every key-value in the initializer will become instance variables. E.g.
Hashable(a=1).a == 1No instance variables starting with “__” will be serialized.
-
context= <MagicMock name='mock.Pickler()' id='140227825994440'>¶
-
-
class
Node(**kwargs)[source]¶ Bases:
lightlab.laboratory.HashableNode is a token of an object that exists in a laboratory. For example, subclasses are:
- a
Device - a
Host - a
Bench - an
Instrument
-
bench= None¶
- a
-
typed_property(type_obj, name)[source]¶ Property that only accepts instances of a class and stores the contents in self.name
-
class
NamedList(*args, read_only=False)[source]¶ Bases:
collections.abc.MutableSequence,lightlab.laboratory.HashableObject list that enforces that there are only one object.name in the list.
-
read_only= False¶
-
dict¶
-
values¶
-
keys¶
-
-
class
TypedList(obj_type, *args, read_only=False, **kwargs)[source]¶ Bases:
lightlab.laboratory.NamedListObject list that enforces that there are only one object.name in the list and that they belong to a certain class (obj_type).