Analyse API¶
Get data¶
Get parameters¶
-
runana.analyse.
read_input_files
(workdir, indices=[], read_func=<function read_input_files_f90nml>)[source]¶ Read information from input files.
Recursively searches through all subdirectories of workdir. read_func is run in any directory containing a file named ‘hostname.txt’, and the result is stored in a
ParamDict
, with the path in tuple-form as key. ThisParamDict
is returned.If indices is given as a non-empty list, the indices in this argument will be used instead of recursive search
Subdirectories of a directory with a ‘hostname.txt’ file are not searched.
-
ParamDict.
diff
()[source]¶ Call
dictdiff()
on ParamDict object
-
ParamDict.
unpack_list_values
()[source]¶ Takes any numerical parameter value in ParamDict object that is a list and packs it into individual slots with name numparam_name + idx
Works in-place
-
class
runana.analyse.
ChangedParams
(param_dicts, *args, **kwargs)[source]¶ Parameters that changed. Derived from dict
Parameters: param_dicts (dict) – Dictionary containing dictionaries of parameters, in the form returned from e.g. collect_from_all()
-
ChangedParams.
groupby_varname
()[source]¶ Groups elements according to the name of the variable.
Returns a dictionary containing the values of the variables, and another with all the pairs of runs
-
class
runana.analyse.
Seqs
(param_dicts, *args, **kwargs)[source]¶ Seqeunces of related runs
Parameters: param_dicts (dict) – Dictionary containing dictionaries of parameters, in the form returned from e.g. collect_from_all()
-
runana.input_file_handling.
read_input_files_f90nml
(patterns=['*.nml'], read_one_file=<function read_and_flatten_namelist>)[source]¶ Read the all files matching patterns with
f90nml.read()
The namelists are flattened and supersetted, the resulting dict is returned
-
runana.input_file_handling.
read_input_files_upname
(patterns=['*.inp'])[source]¶ Read the all files matching patterns with
read_upname_file()
The data from all the files is supersetted and the resulting dict is returned
-
runana.input_file_handling.
read_input_files_positional
(patterns=['*.inp'])[source]¶ Read the all files matching patterns with
read_positional_file()
The data from all the files is supersetted and the resulting dict is returned
-
runana.input_file_handling.
read_upname_file
(filename)[source]¶ Reads file in upname format
In this format the names of variables are given on a line, with the values on the following line. Each variable/name should be seperated by at least two whitespaces or a tab. Each set of names/values lines should be seperated by at least one blank line
Get other stuff¶
-
runana.analyse.
make_collector_function
(workdir, read_func, *args, **kwargs)[source]¶ Returns a function that runs read_func(*args,**kwargs) in the directory that is the join of workdir and the argument to the function
-
runana.analyse.
prepend_dir
(workdir)[source]¶ Returns a function that takes a tuple of directories and returns the combination of those into a path, with workdir prepended
-
runana.analyse.
read_from_dir
(read_func, workdir)[source]¶ Composes read_func with
prepend_dir(workdir)
Analyse with pandas API¶
This module requires the pandas
package
-
class
runana.analyse_pandas.
SeqsDataFrame
(data=None, index: Axes | None = None, columns: Axes | None = None, dtype: Dtype | None = None, copy: bool | None = None)[source]¶
-
SeqsDataFrame.
import_from_seq
(seqsnew, varvals, inplace=False)[source]¶ Converts the seqs object into a SeqsDataFrame
-
SeqsDataFrame.
calc_convergence
()[source]¶ Calculate an estimate for relative convergence error.
Calculates (O2-O1)/O2*x2/(x2-x1) where O are values and x are numerical parameters, which is an estimate of the difference between the value calculated at the given numerical parameter and the “true” value of the fully converged limit.
All numerical parameter values have to be scalar and numeric.
Returns a new SeqsDataFrame.
-
SeqsDataFrame.
plot_
(outfile, logx=False, logy=False, grid=False, param_panda=None)[source]¶ Requires
numpy
andmatplotlib
Read numbers API¶
Matplotlib managers¶
Context managers for using matplotlib
. Use these together with pythons with statement
-
class
runana.matplotlib_managers.
plot_manager
(outfile, print_outfile=True, *args, **kwargs)[source]¶ Creates pdf file using
matplotlib.backends.backend_pdf.PdfPages()
and returns the handle to this pdf.*args and *kwargs are passed to PdfPages
-
class
runana.matplotlib_managers.
single_fig_manager
(pp, *args, **kwargs)[source]¶ Create a
matplotlib.figure.Figure
args and kwargs are passed to the
Figure
constructorParameters: pp (matplotlib.backends.backend_pdf.PdfPages) – handle that has a savefig method
-
class
runana.matplotlib_managers.
single_ax_manager
(pp, *args, **kwargs)[source]¶ Create an axis with a single subplot in a Figure object.
Subclassed from
single_fig_manager
, and all the arguments are the same