lightlab.util.io.jsonpickleable module¶
Objects that can be serialized in a (sort of) human readable json format
Tested in tests.test_JSONpickleable.
Summary¶
Classes:
HardwareReference |
Spoofs an instrument |
JSONpickleable |
Produces human readable json files. |
Reference¶
-
class
JSONpickleable(**kwargs)[source]¶ Bases:
lightlab.laboratory.HashableProduces human readable json files. Inherits _toJSON from Hashable Automatically strips attributes beginning with __.
-
notPickled¶ set – names of attributes that will be guaranteed to exist in instances. They will not go into the pickled string. Good for references to things like hardware instruments that you should re-init when reloading.
See the test_JSONpickleable for much more detail
- What is not pickled?
- attributes with names in
notPickled - attributes starting with __
- VISAObjects: they are replaced with a placeholder HardwareReference
- bound methods (not checked, will error if you try)
- attributes with names in
- What functions can be pickled
- module-level, such as np.linspace
- lambdas
Todo
This should support unbound methods
- Args:
- filepath (str/Path): path string to file to save to
-
notPickled= set()
-