Added extror from logs and namelist

This commit is contained in:
Noe Brucy
2019-11-13 17:33:15 +01:00
parent 3986b1cdf4
commit ea6f9b6bdd
4 changed files with 563 additions and 249 deletions
+24 -62
View File
@@ -1,69 +1,31 @@
# coding: utf-8
import numpy as np
import re
import bunch
import yaml
import os
class PlotParams:
"""
Plot parameters
"""
out_ext = '.jpeg' # extension for plots
put_title = False # Add a title to plot
ntick = 6 # Number of ticks for maps
set_lim = True # Set default limits
vel_red = 40 # Take point each vel_red for velocities
put_title = False
_dir_path = os.path.dirname(os.path.realpath(__file__))
# Add support for '1e3' kind of float
_loader = yaml.SafeLoader
_loader.add_implicit_resolver(
u'tag:yaml.org,2002:float',
re.compile(u'''^(?:
[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+]?[0-9]+)?
|[-+]?(?:[0-9][0-9_]*)(?:[eE][-+]?[0-9]+)
|\\.[0-9_]+(?:[eE][-+][0-9]+)?
|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*
|[-+]?\\.(?:inf|Inf|INF)
|\\.(?:nan|NaN|NAN))$''', re.X),
list(u'-+0123456789.'))
class DiskParams:
"""
Disk speficic parameters
"""
on = False # Enable specific disk analysis
pos_star = np.array([1., 1., 1.]) # Position of the central star
binning = "log" # Kind of binning (lin = linear, log = logarithmic)
nb_bin = 100 # Number of bins for averaged quantities
bin_in = 1e-3 # Outer radius of the inner bin
bin_out = 0.25 # Inner radius of the outer bin
rmin_pdf = 0.075 # Inner radius for PDF computation
rmax_pdf = 0.3 # Outer radius for PDF computation
beta = False # Beta cooling. Do nothing if False.
# If true, beta will be parsed,
# otherwise the value is read therre
class PdfParams:
"""
parameters for probability density functions
"""
nb_bin = 50 # Number of bins for the PDF
xmin_fit = 0. # Lower boundary of the fit
xmax_fit = 1.25 # Upper boundary of the fit
class PymsesParams:
"""
Parameters for Pymses reader
"""
order = '<' # In which order the output are read
fft = False # Quick and dirty rendering using FFT
class OutputParams:
"""
Parameters for post processing
"""
center = [0.5, 0.5, 0.5] # Center of the image
zoom = 1. # Zoom of the image
map_size = 512 # Size of the computed maps in pixel
tag = "" # Tag for the image
class Params:
"""
Strutured parameters for the post processing
"""
disk = DiskParams()
pdf = PdfParams
pymses = PymsesParams()
out = OutputParams()
plot = PlotParams()
def load_params(filename):
with open(filename) as f:
para_disk = yaml.load(f, Loader=_loader)
return bunch.bunchify(para_disk)
def default_params():
return load_params(_dir_path + '/pp_params.yml')