4 __metaclass__ = abc.ABCMeta
7 Base class for analysis of star polymer simulations.
15 The run in question, which must be an instance of `Run`.
20 if not isinstance(run, Run):
29 Sets the path to the directory that data files are written to.
32 If not `None`, a path used to write data to.
40 Returns the run that is being analyzed.
48 Returns the asphericity as a function of time, in the form of a
49 `collections.OrderedDict`.
51 This function will make use of cache results, if available.
57 data = self._computeValueAsFunctionOfTime()
66 Updates the cache, if necessary or if forced.
69 Whether to force an update, even if the cache is up to date.
75 data = self._computeValueAsFunctionOfTime()
82 Returns the cache instance for this run.
85 from .Cache
import Cache
90 def _getSnapshotsPath(self):
92 Returns the path to this run's snapshots.
95 return self.
getRun().getPath() +
"/StarPolymers/snapshots.vtf"
98 def _getSnapshots(self):
100 Returns an instance of `VTFSnapshotFile` for this run.
103 Throws if the snapshot file does not exist.
106 from ..VTFSnapshotFile
import VTFSnapshotFile
111 def _getStarPolymers(self):
113 Returns an instance of `StarPolymers` that corresponds to this run.
116 from ..StarPolymers
import StarPolymers
118 config = self.
getRun().getConfiguration()[
"solute.StarPolymers"]
119 return StarPolymers(config)
122 def _getCacheMetadata(self):
124 Returns the cache metadata.
129 metadata = {
"cacheVersion": cacheVersion}
133 def _hasDataInCache(self):
135 Returns whether there are cached data.
139 return self.
_getCache().hasData(self._getCacheFilename(), metadata)
142 def _storeDataInCache(self, data):
144 Stores the given data in the cache.
148 self.
_getCache().storeData(self._getCacheFilename(), data, metadata)
151 def _getCacheKeyInterpreter(self):
153 Returns what is to be used as the `keyInterpreter` argument to
154 `Cache.getDataOrderedDict`.
160 def _getCacheValueInterpreter(self):
162 Returns what is to be used as the `valueInterpreter` argument to
163 `Cache.getDataOrderedDict`.
169 def _getDataInCache(self):
171 Returns the cached data.
174 Throws if `not self._hasDataInCache()`.
180 filename = self._getCacheFilename()