Organize in submodules

This commit is contained in:
Noe Brucy
2022-10-07 11:20:04 +02:00
parent 1f3b0762c9
commit 0d90179292
32 changed files with 231 additions and 510 deletions
+8 -8
View File
@@ -34,10 +34,10 @@ from pymses.sources.hop.hop import HOP
from fil_finder import FilFinder2D
from scipy import fft
import pspec_new
from scripts import pspec as pspec
from units import U
from utils.units import U
from baseprocessor import (
HDF5Container,
Rule,
@@ -48,7 +48,7 @@ from baseprocessor import (
oct_vect_getter,
)
from run_selector import RunSelector
from runselector import RunSelector
# Getters
@@ -212,10 +212,10 @@ def pspec(map2D):
# Compute fft
fmap = fft.fft2(map2D)
# Compute the power map from the fft
pmap = pspec_new.pcube(fmap)
pmap = pspec.pcube(fmap)
# Use the power map and the fft to compute the powerspectrum
# This is typically an histogram of k weighted by the fourier transform value
pspec, kbins, pspec2, fbins = pspec_new.pspectrum(pmap, kmap, kbins, 1, 0)
pspec, kbins, pspec2, fbins = pspec.pspectrum(pmap, kmap, kbins, 1, 0)
# Return bin center and power spectrum
return 0.5 * (kbins[1:] + kbins[:-1]), pspec
@@ -1434,10 +1434,10 @@ class SnapshotProcessor(HDF5Container):
return {key: df[key].values for key in df}
def _pspec(self, overwrite_file=False, **kwargs):
def pspec(self, overwrite_file=False, **kwargs):
outfile = self.pspec_filename
if overwrite_file or not os.path.exists(self.pspec_filename):
pspec_new.pspec(repo=self.path, iouts=[self.num], outfile=outfile, **kwargs)
pspec.pspec(repo=self.path, iouts=[self.num], outfile=outfile, **kwargs)
return np.array([self.pspec_filename])
def _write_particles(self):
@@ -1754,7 +1754,7 @@ class SnapshotProcessor(HDF5Container):
"vz_gas": "unit_velocity",
},
),
"pspec": Rule(self._pspec, "Power spectrum", "/hdf5"),
"pspec": Rule(self.pspec, "Power spectrum", "/hdf5"),
"write_particles": Rule(self._write_particles, "Particles file", "/hdf5"
),
"write_cells": Rule(self._write_cells, "Cells file", "/hdf5"),