pyretis.inout.analysisio package

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.

Package structure

Modules

analysisio.py (analysisio)
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.
__init__.py
This file, handles imports for PyRETIS.

Important methods defined here

analyse_file (analyse_file())
Method to analyse a file.
run_analysis_files (run_analysis_files())
Method to analyse simulation data in output files. This is a post-processing step.

pyretis.inout.analysisio.analysisio module

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 (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 (run_analysis_files())
Methods to the analysis on a set of files. It will create some output that can be used for reporting.
pyretis.inout.analysisio.analysisio.analyse_file(file_type, file_name, settings)[source]

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.

Parameters:
  • 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 dictates how the analysis should be performed and information on how the simulation was performed.
Returns:

  • results (list or dict) – The output from the analysis
  • raw_data (list, numpy.array or other type of object) – The raw data used in the analysis.

pyretis.inout.analysisio.analysisio.run_analysis_files(settings, files, plotter, txt_plotter)[source]

Run the analysis on a collection of files.

Parameters:
  • settings (dict) – This dict contains settings which dictates 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.
Returns:

out – The results from the analysis.

Return type:

dict