https://github.com/caley/OpenEPSim
Revision 37cd265c855ea62ba6aac48027d3e1f52f2d0619 authored by Caley Finn on 08 March 2018, 01:43:32 UTC, committed by Caley Finn on 08 March 2018, 01:43:32 UTC
1 parent 56750e5
Tip revision: 37cd265c855ea62ba6aac48027d3e1f52f2d0619 authored by Caley Finn on 08 March 2018, 01:43:32 UTC
Test cases for ASEP against exact analytical results
Test cases for ASEP against exact analytical results
Tip revision: 37cd265
plotdensity.py
#
#
# Plot density profiles from simulation results. Usage:
# python plotdensity.py resultsfile.json
#
import json
import matplotlib.pyplot
import os.path
import sys
if __name__ == "__main__":
resultsfile = sys.argv[1]
fp = open(resultsfile)
results = json.load(fp)
fp.close()
title = os.path.basename(resultsfile)
densities = results['results']['density']
xs = range(1, len(densities[1]) + 1)
i = 0
for ds in densities:
matplotlib.pyplot.plot(xs, ds, "o-", label=str(i))
i += 1
matplotlib.pyplot.legend()
matplotlib.pyplot.gcf().canvas.set_window_title(title)
matplotlib.pyplot.show()
Computing file changes ...