More refactoring
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
from scipy.integrate import solve_ivp
|
from scipy.integrate import solve_ivp
|
||||||
from plotter import U
|
from plotter import U
|
||||||
import select_snapshot
|
import utils.snapshotselector
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ from mpl_toolkits.axes_grid1.inset_locator import inset_axes
|
|||||||
from baseprocessor import Rule, BaseProcessor
|
from baseprocessor import Rule, BaseProcessor
|
||||||
from aggregator import Aggregator
|
from aggregator import Aggregator
|
||||||
from studyprocessor import StudyProcessor
|
from studyprocessor import StudyProcessor
|
||||||
from runselector import RunSelector
|
from utils.runselector import RunSelector
|
||||||
from utils.units import U, unit_str, convert_exp
|
from utils.units import U, unit_str, convert_exp
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ from baseprocessor import (
|
|||||||
oct_vect_getter,
|
oct_vect_getter,
|
||||||
)
|
)
|
||||||
|
|
||||||
from runselector import RunSelector
|
from utils.runselector import RunSelector
|
||||||
|
|
||||||
|
|
||||||
# Getters
|
# Getters
|
||||||
@@ -1440,6 +1440,8 @@ class SnapshotProcessor(HDF5Container):
|
|||||||
pspec.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])
|
return np.array([self.pspec_filename])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _write_particles(self):
|
def _write_particles(self):
|
||||||
"""Ensure particles are written in the hdf5 file"""
|
"""Ensure particles are written in the hdf5 file"""
|
||||||
if not os.path.exists(self.parts_filename) and not self.parts_loaded:
|
if not os.path.exists(self.parts_filename) and not self.parts_loaded:
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ from scipy.stats import linregress
|
|||||||
from baseprocessor import Rule, HDF5Container
|
from baseprocessor import Rule, HDF5Container
|
||||||
from aggregator import Aggregator
|
from aggregator import Aggregator
|
||||||
from snapshotprocessor import SnapshotProcessor
|
from snapshotprocessor import SnapshotProcessor
|
||||||
from runselector import RunSelector
|
from utils.runselector import RunSelector
|
||||||
from utils.params import default_params
|
from utils.params import default_params
|
||||||
from utils.units import U
|
from utils.units import U
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -29,7 +29,7 @@ def get_pspec(pp, field:str, dim:int=3):
|
|||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
tupple (np.array, np.array)
|
tupple (np.array, np.array)
|
||||||
wave number and correponding powers
|
wave number and corresponding powers
|
||||||
"""
|
"""
|
||||||
h5file = tables.File(pp.pspec_filename)
|
h5file = tables.File(pp.pspec_filename)
|
||||||
path = f"/out_{pp.num:05}/d{dim}/{field}"
|
path = f"/out_{pp.num:05}/d{dim}/{field}"
|
||||||
@@ -48,7 +48,7 @@ span_resolution = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def get_slope(pp, field:str, resol:int, plotdebug:bool=False):
|
def get_pspec_slope(pp, field:str, resol:int, plotdebug:bool=False):
|
||||||
"""Get the slope of the Power specturm using linear regression in the selected range
|
"""Get the slope of the Power specturm using linear regression in the selected range
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
@@ -64,8 +64,8 @@ def get_slope(pp, field:str, resol:int, plotdebug:bool=False):
|
|||||||
tuple (float, float)
|
tuple (float, float)
|
||||||
Slope, square value of the correlation coefficient
|
Slope, square value of the correlation coefficient
|
||||||
"""
|
"""
|
||||||
# Trustworthy span od the power spectrum in log10(k) as a function of the resolution
|
|
||||||
|
|
||||||
|
# Trustworthy span od the power spectrum in log10(k) as a function of the resolution
|
||||||
logkmin, logkmax = span_resolution[resol]
|
logkmin, logkmax = span_resolution[resol]
|
||||||
k, power = get_pspec(pp, field)
|
k, power = get_pspec(pp, field)
|
||||||
logk, logpower = np.log10(k), np.log10(power)
|
logk, logpower = np.log10(k), np.log10(power)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
Select snaphots with a criterion
|
Select snaphots with a criterion
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from runselector import RunSelector
|
from utils.runselector import RunSelector
|
||||||
from plotter import Plotter, U
|
from plotter import Plotter, U
|
||||||
import os
|
import os
|
||||||
|
|
||||||
Reference in New Issue
Block a user