3 class Asphericity(Base):
5 Class for analysis of asphericities.
13 The run to analyze, as an instance of `Run`.
21 Returns a `matplotlib.axes.Axes` object that contains a plot of the
22 asphericity, with the horizontal axis showing the simulation
23 time `t`, and the vertical axis showing the asphericity at that
27 import matplotlib.figure
29 figure = matplotlib.figure.Figure()
30 axes = figure.add_subplot(1, 1, 1)
35 _line, = axes.plot(data.keys(), data.values())
37 legendLabels.append(
"Asphericity")
39 axes.legend(lines, legendLabels)
41 axes.set_title(
"Star Polymer Asphericity")
42 axes.set_xlabel(
"Simulation Time t")
43 axes.set_ylabel(
"Asphericity")
48 def _computeValueAsFunctionOfTime(self):
50 Takes the raw simulation output, and computes the asphericity as
51 a function of time. The result is returned as an
52 `collcections.OrderedDict`.
55 from collections
import OrderedDict
57 config = self.
getRun().getConfiguration()
62 timestep = config[
"mpc.timestep"]
63 time = timestep * config[
"mpc.warmupSteps"]
68 particles = snapshots.readTimestep()
69 particles.setUniformMass(starPolymers.getParticleMass())
71 if particles.isEmpty():
74 particles.shiftToCenterOfMassFrame()
75 starPolymers.setParticles(particles)
77 ret[time] = particles.getAsphericity()
82 def _getCacheFilename(self):
84 Returns the filename where cached data is (expected to be) saved to.
87 return "asphericity.txt"