[misc] May last round of bug corrections
This commit is contained in:
+22
-21
@@ -2,10 +2,6 @@ from run_selector import RunSelector
|
||||
from plotter import Plotter, U
|
||||
import os
|
||||
|
||||
path_from_home = "simus/ismfeed/allmode"
|
||||
names = "n6_st_2e5_seed3_T5Myr_nsink1e3_comp*"
|
||||
|
||||
|
||||
def prep_mcons(study):
|
||||
study.coarse_step_from_log()
|
||||
|
||||
@@ -18,12 +14,19 @@ def time_mcons(study, run, target=0.2):
|
||||
return time_target
|
||||
|
||||
|
||||
def find_nums(study, prep_function, time_function):
|
||||
def find_nums(study, prep_function, time_function, time_min=0):
|
||||
"""
|
||||
Once other filter are applied, select one output based on the time given by time function
|
||||
|
||||
Args:
|
||||
prep_function (study:studyProcessor -> None): prepare a study object
|
||||
time_function (study:studyProcessor, run:str -> time:float): compute selected time from the object
|
||||
"""
|
||||
nums = {}
|
||||
prep_function(study)
|
||||
for run in study.runs:
|
||||
time_target = time_function(study, run)
|
||||
rs = RunSelector(path_in=in_dir, in_runs=run, time=time_target, unit_time=U.Myr)
|
||||
time_target = max(time_min, time_function(study, run))
|
||||
rs = RunSelector(path_in=study.path, in_runs=run, time_min=time_min, time=time_target, unit_time=U.Myr)
|
||||
nums.update(rs.nums)
|
||||
return nums
|
||||
|
||||
@@ -38,18 +41,16 @@ def write_paths(nums, path_from_home, filename="~/list_file"):
|
||||
f.close()
|
||||
|
||||
|
||||
in_dir = os.path.expanduser(f"~/{path_from_home}")
|
||||
study = Plotter(
|
||||
in_dir,
|
||||
filter_name=names,
|
||||
nums="first",
|
||||
tag="select",
|
||||
).study
|
||||
if __name__ == '__main__':
|
||||
path_from_home = "simus/ismfeed/allmode"
|
||||
names = "n6_st_2e5_seed3_T5Myr_nsink1e3_comp*"
|
||||
|
||||
|
||||
nums = find_nums(study, prep_mcons, time_mcons)
|
||||
write_paths(nums, ".")
|
||||
|
||||
pl = Plotter(in_dir, runs=nums.keys(), nums=nums)
|
||||
|
||||
pl.rho_pdf()
|
||||
in_dir = os.path.expanduser(f"~/{path_from_home}")
|
||||
study = Plotter(
|
||||
in_dir,
|
||||
filter_name=names,
|
||||
nums="first",
|
||||
tag="select",
|
||||
).study
|
||||
nums = find_nums(study, prep_mcons, time_mcons)
|
||||
write_paths(nums, ".")
|
||||
Reference in New Issue
Block a user