More refactoring

This commit is contained in:
Noe Brucy
2022-11-03 16:50:05 +01:00
parent 0d117132d3
commit e56c09cd59
9 changed files with 10 additions and 8 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
from scipy.integrate import solve_ivp
from plotter import U
import select_snapshot
import utils.snapshotselector
import numpy as np
import pandas as pd
+1 -1
View File
@@ -39,7 +39,7 @@ from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from baseprocessor import Rule, BaseProcessor
from aggregator import Aggregator
from studyprocessor import StudyProcessor
from runselector import RunSelector
from utils.runselector import RunSelector
from utils.units import U, unit_str, convert_exp
try:
View File
+3 -1
View File
@@ -48,7 +48,7 @@ from baseprocessor import (
oct_vect_getter,
)
from runselector import RunSelector
from utils.runselector import RunSelector
# Getters
@@ -1440,6 +1440,8 @@ class SnapshotProcessor(HDF5Container):
pspec.pspec(repo=self.path, iouts=[self.num], outfile=outfile, **kwargs)
return np.array([self.pspec_filename])
def _write_particles(self):
"""Ensure particles are written in the hdf5 file"""
if not os.path.exists(self.parts_filename) and not self.parts_loaded:
+1 -1
View File
@@ -12,7 +12,7 @@ from scipy.stats import linregress
from baseprocessor import Rule, HDF5Container
from aggregator import Aggregator
from snapshotprocessor import SnapshotProcessor
from runselector import RunSelector
from utils.runselector import RunSelector
from utils.params import default_params
from utils.units import U
+3 -3
View File
@@ -29,7 +29,7 @@ def get_pspec(pp, field:str, dim:int=3):
Returns
-------
tupple (np.array, np.array)
wave number and correponding powers
wave number and corresponding powers
"""
h5file = tables.File(pp.pspec_filename)
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
Parameters
@@ -64,8 +64,8 @@ def get_slope(pp, field:str, resol:int, plotdebug:bool=False):
tuple (float, float)
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]
k, power = get_pspec(pp, field)
logk, logpower = np.log10(k), np.log10(power)
@@ -5,7 +5,7 @@
Select snaphots with a criterion
"""
from runselector import RunSelector
from utils.runselector import RunSelector
from plotter import Plotter, U
import os