This package contains functions for input/output for the analysis.
The functions defined here will typically run the analysis on the given input and write outputs, typically this will be plots and simple text files.
- analysisio.py (
- Methods that will output results from the analysis functions. The methods defined here can also be used to run an analysis on output files from PyRETIS.
- This file handles imports for PyRETIS.
Methods that will output results from the analysis functions.
The Methods defined here will also run the analysis and output according to given settings.
Important methods defined here¶
- analyse_file (
Method to analyse a file. For example, it can be used as
>>> from pyretis.inout.analysisio import analyse_file >>> result, raw_data = analyse_file('cross', 'cross.txt', settings)
To output the results, for instance by plotting, one can do:
>>> figures = output_results(file_type, plotter, result, raw_data) >>> txt_file = output_results(file_type, txt_plotter, result, raw_data)
- run_analysis_files (
- Methods to the analysis on a set of files. It will create output that can be used for reporting.
analyse_file(file_type, file_name, settings)¶
Run analysis on the given file.
This function is included for convenience so that we can call an analysis like
analyse_file('cross', 'cross.txt')i.e. it should automatically open the file and apply the correct analysis according to a given file type. Here we return a function to do the analysis, so we are basically wrapping one of the analysis functions. This is done in case we wish to rerun the analysis but with different settings for instance.
- file_type (string) – This is the type of file we are to analyse.
- file_name (string) – The file name to open.
- settings (dict) – This dict contains settings which dictate how the analysis should be performed and information on how the simulation was performed.
- results (list or dict) – The output from the analysis
- raw_data (list, numpy.array or another type of object) – The raw data used in the analysis.
run_analysis_files(settings, files, plotter, txt_plotter)¶
Run the analysis on a collection of files.
- settings (dict) – This dict contains settings which dictate how the analysis should be performed and it should also contain information on how the simulation was performed.
- files (list of tuples) – This list contains the raw files to be analysed. The tuples are on format (‘filetype’, ‘filename’).
- plotter (object like
Plotter) – This is the object that handles the plotting.
- txt_plotter (object like
Plotter) – This is the object that handles the text output.
out (dict) – The results from the analysis.