Skip to content

Commit

Permalink
format code...
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenjw committed Jan 1, 2025
1 parent 4523e87 commit f02192e
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions dsmts/dsmts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ def test_model(N, file_stem):
model_file = file_stem + ".mod"
mean_file = file_stem + "-mean.csv"
sd_file = file_stem + "-sd.csv"
mean = pd.read_csv(mean_file).to_numpy()[:,1:]
sd = pd.read_csv(sd_file).to_numpy()[:,1:]
mean = pd.read_csv(mean_file).to_numpy()[:, 1:]
sd = pd.read_csv(sd_file).to_numpy()[:, 1:]
spn = smfsb.mod_to_spn(model_file)
u = len(spn.n)
sx = np.zeros((51, u))
sxx = np.zeros((51, u))
step = spn.step_gillespie() # testing the exact simulator
step = spn.step_gillespie() # testing the exact simulator
for i in range(N):
out = smfsb.sim_time_series(spn.m, 0, 50, 1, step)
sx = sx + out
si = out - mean
sxx = sxx + (si * si)
sample_mean = sx/N
z_scores = np.sqrt(N)*(sample_mean - mean)/sd
sts = sxx/N
y_scores = (sts/(sd*sd) - 1)*np.sqrt(N/2)
sample_mean = sx / N
z_scores = np.sqrt(N) * (sample_mean - mean) / sd
sts = sxx / N
y_scores = (sts / (sd * sd) - 1) * np.sqrt(N / 2)
fails = np.array([np.sum(abs(z_scores) > 3), np.sum(abs(y_scores) > 5)])
if (np.sum(fails) > 0):
if np.sum(fails) > 0:
print(str(fails) + " for " + file_stem)
return fails


# Run a demo test if run as a script

if __name__ == '__main__':
if __name__ == "__main__":
print("A demo test run. Use pytest to run the full suite properly.")
N = 10000
print(test_model(N, "stochastic/00001/dsmts-001-01"))
Expand All @@ -44,4 +44,3 @@ def test_model(N, file_stem):


# eof

0 comments on commit f02192e

Please sign in to comment.