- class openpathsampling.netcdfplus.stores.ImmutableDictStore[source]
json (bool or str json or jsonobj) – if False the store will not create a json variable for serialization if True the store will use the json pickling to store objects and a single storable object will be serialized and not referenced. If a string is given the string is taken as the variable type of the json variable. Here only two values are allowed: jsonobj (equivalent to True) or json which will also reference directly given storable objects.
nestable (bool) – if True this marks the content_class to be saved as nested dict objects and not a pointing to saved objects. So the saved complex object is only stored once and not split into several objects that are referenced by each other in a tree-like fashion
Usually you want caching, but limited. Recommended is to use an LRUCache with a reasonable maximum number of objects that depends on the typical number of objects to cache and their size
The class that takes care of storing data in a file is called a Storage, so the netCDF+ subclassed Storage is a storage. The classes that know how to load and save an object from the storage are called Store, like ObjectStore, SampleStore, etc…
The difference between json and jsonobj is subtle. Consider storing a complex object. Then there are two ways to do that. 1. json: Store a reference to the object (provided) it is stored and 2. jsonobj: serialize the object and only use references for contained objects. All inner objects will always be stored using references. The only exception is using nestable. Consider objects that contain references to objects of the same type, like e.g. operations in an equation (2*3 + 3). Each operation represents a value but each operation needs values to operate on. To save such an object you have again two options: 1. nestable=False. Store all single objects and always reference the contained objects. For an equation that would mean to store several objects op1 = plus(op2, 3), op2 = times(2, 3). Since this is correct though not intuitive you can also use 2. nestable=True. Store all the serialized objects nested into one object (string). For our example this corresponds to plus(times(2,3), 3).
- param content_class
add_attribute(store_cls, attribute, template)
- param store_cls
Add a single object to cache by json
add_single_to_cache_named(idx, name, json)
Add a single object to cache by json
Return a list of args of the __init__ function of a class
Return the most parent class actually derived from StorableObject
Load all samples as fast as possible into the cache
Clear the cache and force reloading
Compute all missing values of a CV and store them
Return number of objects subclassed from StorableObject still in memory
create_variable(var_name, var_type[, ...])
Create a new variable in the netCDF storage.
Return a list of all subclassed objects
Return last object with a given name
Return indices for all objects with a given name
Set the objects name to be immutable.
This will revert remembering non-stored objects.
Return the number of the next free index for this store
Reconstruct an object from a dictionary representaiton
Return the index in this store for a given object
Initialize the associated storage to allow for object storage.
Returns an object from the storage.
Name an unnamed object.
Returns a dictionary of all storable objects
Return a proxy of a object for this store
Associate the object store to a specific storage with a given prefix
Tell a store that an obj should be assumed as stored
Saves an object to the storage.
Set the caching mode for this store
Select which store or none should be used to prefix dimension names
(De-)Activate observing creation of storable objects
Store all cached values of a CV in the diskcache
Convert object into a dictionary representation
Update the internal name cache with all stored names in the store.
write(variable, idx, obj[, attribute])
Return the base class
Return the name of the base class
Return the class name as a string
Return the default name.
Returns the first stored object.
True if this object has a custom name.
Returns the last generated trajectory.
Return the current name of the object.
Returns a dictionary of all names pointing to stored indices
Return the simplifier instance used to create JSON serialization
Return the associated storage object