[params] Now use default value if not in the param file

This commit is contained in:
Noe Brucy
2021-07-24 15:46:48 +02:00
parent 5a970dca91
commit a3318595ef
2 changed files with 11 additions and 4 deletions
+9 -2
View File
@@ -26,11 +26,18 @@ _loader.add_implicit_resolver(
)
def load_params(filename):
def params_from_file(filename):
with open(filename) as f:
para_disk = yaml.load(f, Loader=_loader)
return munch.munchify(para_disk)
def default_params():
return load_params(_dir_path + "/params.yml")
return params_from_file(_dir_path + "/params.yml")
def load_params(filename):
basic_params = default_params()
new_params = params_from_file(filename)
basic_params.update(new_params)
return basic_params
+2 -2
View File
@@ -53,7 +53,7 @@ pymses: # Parameters for Pymses reader
# Processing options
levelmax : 20 # Maximal AMR level visited when looking levels
fft : False # Quick and dirty rendering using FFT
verbose : True # Let pymses write on standart output
verbose : False # Let pymses write on standart output
multiprocessing : True # Whether to use multiprocessing
# Camera settings
@@ -90,7 +90,7 @@ out: # Parameters for post processing
process: # General setting of the post-processor module
verbose : False # Give more infos on what is going on
verbose : True # Give more infos on what is going on
num_process : 1 # Number of forks
save_cells : True # Save cells structure on disk
save_parts : True # Save particles on disk