Skip to content

Commit

Permalink
Update example_runcounting.py
Browse files Browse the repository at this point in the history
  • Loading branch information
smarbach authored Sep 24, 2024
1 parent ccd7a4e commit 2308188
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions example_runcounting.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,15 @@
# run the main counting code
results = countoscope.calculate_nmsd(data=data, window_size_x=Lx, window_size_y=Ly, box_sizes=box_sizes, sep_sizes=sep_sizes)

# load the results and save the data
N2_mean = results.nmsd
N2_std = results.nmsd_std
# now do what you want with the data!
# I would save it into a numpy archive with np.savez:
# np.savez(f'{folder}{filename}_counted.npz', N2_mean=N2_mean, N2_std=N2_std, box_sizes=box_sizes, sep_sizes=sep_sizes)

# but for backward compatibility or for further processing outside of Python, you could also do this:
# for i, L in enumerate(N_stats[:, 0]):
# np.savetxt(f'{folder}{filename}_{L}_mean.txt', N2_mean[i, :], delimiter=' ', fmt='%.10f')
# np.savetxt(f'{folder}{filename}{L}_std.txt', N2_std [i, :], delimiter=' ', fmt='%.10f')
# np.savetxt(f'{folder}{filename}N_stats.txt', N_stats, delimiter=' ', fmt='%.10f')

N_mean = results.N_mean
N_var_mod = results.N_var_mod
np.savez(f'{folder}{filename}_counted.npz', N2_mean=N2_mean, N2_std=N2_std, N_mean= N_mean, N_var_mod = N_var_mod, box_sizes=box_sizes, sep_sizes=sep_sizes)



# a few plots for sanity checks

cmap = cm.viridis #pick a great colormap
Expand Down

0 comments on commit 2308188

Please sign in to comment.