In [1]:
%matplotlib inline
import matplotlib
matplotlib.style.use('ggplot')
import matplotlib.pyplot as plt
import pandas as pd
from atntools import features
def plot_comparisons(file_prefix, plot_col):
# Get biomass data
datadir = '/Users/ben/SFSU/thesis/test-data/WS-comparison/'
atn_data = features.get_simulation_data(datadir + file_prefix + '.ATN.h5')[2]
ws_data = features.get_simulation_data(datadir + file_prefix + '.WS.csv')[2]
biomass = pd.concat([atn_data, ws_data], axis=1)
biomass.columns = "Java code", "Web service"
# Plot biomass
ax = biomass.plot(title=(file_prefix + " - log10(biomass)"), logy=True, ax=plt.subplot(320 + plot_col))
ax.set_xlabel("timestep")
# Plot rate of change
change = biomass / biomass.shift(1)
ax = change.plot(title=(file_prefix + " - rate of change"), ax=plt.subplot(322 + plot_col))
ax.set_xlabel("timestep")
# Plot rate of change over 10 timesteps (t increment of 1)
change10 = biomass / biomass.shift(10)
ax = change10.plot(title=(file_prefix + "- rate of change over 10 timesteps (t increment of 1)"), ax=plt.subplot(324 + plot_col))
ax.set_xlabel("timestep")
plt.figure(figsize=(18, 16))
plot_comparisons('1plant', 1)
plot_comparisons('1animal', 2)
plt.tight_layout()
In [ ]: