Commit 6c77c0f1 authored by Jason Reneuve's avatar Jason Reneuve
Browse files

doc example + fix bugs

parent 1770455a6120
...@@ -103,13 +103,17 @@ params.output.periods_save.spect_energy_budg = 1.0 ...@@ -103,13 +103,17 @@ params.output.periods_save.spect_energy_budg = 1.0
params.output.spectra.kzkh_periodicity = 1 params.output.spectra.kzkh_periodicity = 1
params.output.periods_save.temporal_spectra = 0.1 params.output.periods_save.temporal_spectra = period_N / 4
params.output.temporal_spectra.probes_deltax = 1 params.output.temporal_spectra.probes_deltax = 1
params.output.temporal_spectra.probes_deltay = 1 params.output.temporal_spectra.probes_deltay = 1
params.output.temporal_spectra.probes_deltaz = 0.5 params.output.temporal_spectra.probes_deltaz = 0.5
params.output.temporal_spectra.probes_region = (1, 11, 1, 11, 0, 2) params.output.temporal_spectra.probes_region = (1, 11, 1, 11, 0, 2)
params.output.temporal_spectra.file_max_size = 0.1 params.output.temporal_spectra.file_max_size = 0.1
params.output.periods_save.spatiotemporal_spectra = period_N / 4
params.output.spatiotemporal_spectra.probes_region = (8, 8, 2)
params.output.spatiotemporal_spectra.file_max_size = 0.1
sim = Simul(params) sim = Simul(params)
sim.time_stepping.start() sim.time_stepping.start()
......
...@@ -336,7 +336,9 @@ class SpatiotemporalSpectra(SpecificOutput): ...@@ -336,7 +336,9 @@ class SpatiotemporalSpectra(SpecificOutput):
times.append(times_file[cond_times]) times.append(times_file[cond_times])
times = np.concatenate(times) times = np.concatenate(times)
print(f"tmin={times.min():8.6g}, tmax={times.max():8.6g}") print(
f"tmin={times.min():8.6g}, tmax={times.max():8.6g}, nit={times.size}"
)
# get sequential shape of Fourier space # get sequential shape of Fourier space
ikxmax, ikymax, ikzmax = region ikxmax, ikymax, ikzmax = region
...@@ -367,12 +369,15 @@ class SpatiotemporalSpectra(SpecificOutput): ...@@ -367,12 +369,15 @@ class SpatiotemporalSpectra(SpecificOutput):
continue continue
with h5py.File(path_file, "r") as file: with h5py.File(path_file, "r") as file:
# check if the file contains the time we're looking for # check if the file contains the time we're looking for
tmin_file, tmax_file = file["times"][[0, -1]] # add [:] in case file contains only one time
# or else : h5py TypeError!
tmin_file, tmax_file = file["times"][:][[0, -1]]
if (time < tmin_file) or (time > tmax_file): if (time < tmin_file) or (time > tmax_file):
continue continue
# time index # time indices
it = np.where(file["times"][:] == time)[0] it = np.where(times == time)[0]
it_file = np.where(file["times"][:] == time)[0]
# k_adim_loc = global probes indices! # k_adim_loc = global probes indices!
ik0 = file["probes_k0adim_loc"][:] ik0 = file["probes_k0adim_loc"][:]
...@@ -383,7 +388,7 @@ class SpatiotemporalSpectra(SpecificOutput): ...@@ -383,7 +388,7 @@ class SpatiotemporalSpectra(SpecificOutput):
for key in self.keys_fields: for key in self.keys_fields:
skey = f"spect_{key}_loc" skey = f"spect_{key}_loc"
series[skey][ik0, ik1, ik2, it] = file[skey][ series[skey][ik0, ik1, ik2, it] = file[skey][
:, it :, it_file
].transpose() ].transpose()
# stop opening files when we've reached the right one # stop opening files when we've reached the right one
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment