Commit e2dc5800 authored by Jason Reneuve's avatar Jason Reneuve
Browse files

more memory efficient save_spectra_kzkhomega

parent bde96ca00c31
...@@ -68,11 +68,6 @@ class SpatioTemporalSpectraNS3D(SpatioTemporalSpectra): ...@@ -68,11 +68,6 @@ class SpatioTemporalSpectraNS3D(SpatioTemporalSpectra):
print("Computing spectra...") print("Computing spectra...")
dict_spectra = self.compute_spectra(tmin=tmin, tmax=tmax) dict_spectra = self.compute_spectra(tmin=tmin, tmax=tmax)
# toroidal/poloidal decomposition
if save_urud:
print("Computing ur, ud spectra...")
dict_spectra.update(self.compute_spectra_urud(tmin=tmin, tmax=tmax))
# get kz, kh # get kz, kh
oper = self.sim.oper oper = self.sim.oper
order = dict_spectra["dims_order"] order = dict_spectra["dims_order"]
...@@ -130,6 +125,24 @@ class SpatioTemporalSpectraNS3D(SpatioTemporalSpectra): ...@@ -130,6 +125,24 @@ class SpatioTemporalSpectraNS3D(SpatioTemporalSpectra):
for key, val in dict_spectra_kzkhomega.items(): for key, val in dict_spectra_kzkhomega.items():
file.create_dataset(key, data=val) file.create_dataset(key, data=val)
# toroidal/poloidal decomposition
if save_urud:
print("Computing ur, ud spectra...")
del dict_spectra, dict_spectra_kzkhomega
dict_spectra = self.compute_spectra_urud(tmin=tmin, tmax=tmax)
dict_spectra_kzkhomega = {}
for key, data in dict_spectra.items():
if not key.startswith("spect"):
continue
dict_spectra_kzkhomega[key] = self.loop_spectra_kzkhomega(
data, kh_spectra, KH, kz_spectra, KZ
)
with h5py.File(path_file, "a") as file:
for key, val in dict_spectra_kzkhomega.items():
file.create_dataset(key, data=val)
def plot_kzkhomega( def plot_kzkhomega(
self, self,
key_field=None, key_field=None,
......
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