[run_selector] Change load_info to use pymses one

This commit is contained in:
Noe Brucy
2021-05-29 00:28:26 +02:00
parent c20d698884
commit f640b03eee
+5 -21
View File
@@ -5,9 +5,10 @@
import glob
import os
from functools import partial
from pymses.sources.ramses.info import read_ramses_info_file
import numpy as np
import yaml
import f90nml
@@ -263,25 +264,8 @@ class RunSelector:
return runs
def load_info(self, run, num):
info_file = open(
self.path_in
+ "/"
+ run
+ "/"
+ "output_"
+ str(num).zfill(5)
+ "/"
+ "info_"
+ str(num).zfill(5)
+ ".txt",
"r",
)
info = {}
for line in info_file.readlines():
parsed = yaml.safe_load(line.replace("=", ":"))
if type(parsed) == dict:
info.update(parsed)
info_file.close()
info_filename = f"{self.path_in}/{run}/output_{num:05}/info_{num:05}.txt"
info = read_ramses_info_file(info_filename)
return info
def get_nums(
@@ -292,7 +276,7 @@ class RunSelector:
try:
self.info[run][num] = self.load_info(run, num)
success = True
except IOError:
except (IOError, AttributeError):
success = False
else:
success = True