Introduction
Introduction Statistics Contact Development Disclaimer Help
tchange general data format, read general information in python - slidergrid - …
git clone git://src.adamsgaard.dk/slidergrid
Log
Files
Refs
README
LICENSE
---
commit 94f9fb9eafe08a8193268b2375418756a34d8dbb
parent 5a85affe06c9ef33083476a69ceddd03b0eb4155
Author: Anders Damsgaard <[email protected]>
Date: Wed, 30 Mar 2016 14:23:06 -0700
change general data format, read general information in python
Diffstat:
M postprocessing.py | 14 ++++++++++++++
M slidergrid/simulation.c | 31 +++++++++++++++++++++--------…
2 files changed, 35 insertions(+), 10 deletions(-)
---
diff --git a/postprocessing.py b/postprocessing.py
t@@ -45,6 +45,19 @@ class sgvis:
self.mass = raw[:, 24]
self.moment_of_inertia = raw[:, 25]
+ def read_general(self, filename):
+ self.general_filename = filename
+ raw = np.loadtxt(self.folder + '/' + self.general_filename)
+ self.version = raw[0]
+ self.id = raw[1]
+ self.N = raw[2]
+ self.time = raw[3]
+ self.time_end = raw[4]
+ self.dt = raw[5]
+ self.file_interval = raw[6]
+ self.iteration = raw[7]
+ self.bond_length_limit = raw[8]
+
def plot_sliders(self):
plt.plot(self.pos[:, 0], self.pos[:, 1], '+')
outfile = self.folder + '/' + self.filename + '.pdf'
t@@ -90,6 +103,7 @@ class sgvis:
and '.pdf' in filename \
and '.png' not in filename:
self.read_sliders(filename)
+ self.read_general(filename.replace('sliders', 'general'))
t.append(self.current_time)
E_t, E_r = self.current_kinetic_energy()
E_t_series.append(E_t)
diff --git a/slidergrid/simulation.c b/slidergrid/simulation.c
t@@ -151,16 +151,27 @@ int save_general_state_to_file(const simulation* sim, co…
return 1;
}
- fprintf(f, "version = %s\n", VERSION);
- fprintf(f, "id = %s\n", sim->id);
- fprintf(f, "id = %s\n", sim->id);
- fprintf(f, "N = %d\n", sim->N);
- fprintf(f, "time = %f\n", sim->time);
- fprintf(f, "time_end = %f\n", sim->time_end);
- fprintf(f, "dt = %f\n", sim->dt);
- fprintf(f, "file_interval = %f\n", sim->file_interval);
- fprintf(f, "iteration = %ld\n", sim->iteration);
- fprintf(f, "bond_length_limit = %f\n", sim->bond_length_limit);
+ fprintf(f,
+ "%s\t" // VERSION
+ "%s\t" // sim->id
+ "%d\t" // sim->N
+ "%f\t" // sim->time
+ "%f\t" // sim->time_end
+ "%f\t" // sim->dt
+ "%f\t" // sim->file_interval
+ "%ld\t" // sim->iteration
+ "%f" // sim->bond_length_limit
+ ,
+ VERSION,
+ sim->id,
+ sim->N,
+ sim->time,
+ sim->time_end,
+ sim->dt,
+ sim->file_interval,
+ sim->iteration,
+ sim->bond_length_limit
+ );
fclose(f);
return 0;
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.