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.Mapping

Don’t forget the docstrings!!

class Hashable(**kwargs)[source]

Bases: object

Hashable 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__. Hashable solves that.

By default, every key-value in the initializer will become instance variables. E.g. Hashable(a=1).a == 1

No instance variables starting with “__” will be serialized.

context = <MagicMock name='mock.Pickler()' id='140227825994440'>
class Node(**kwargs)[source]

Bases: lightlab.laboratory.Hashable

Node is a token of an object that exists in a laboratory. For example, subclasses are:

bench = None
placeBench(new_bench)[source]
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.Hashable

Object list that enforces that there are only one object.name in the list.

read_only = False
dict
values
keys
items()[source]
check(value)[source]
check_presence(name)[source]
insert(index, value)[source]

S.insert(index, value) – insert value before index

class TypedList(obj_type, *args, read_only=False, **kwargs)[source]

Bases: lightlab.laboratory.NamedList

Object list that enforces that there are only one object.name in the list and that they belong to a certain class (obj_type).

check(value)[source]