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 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 dictate 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 another type of object) – The raw data used in the analysis.

pyretis.inout.analysisio.analysisio.read_first_block(file_type, file_name)[source]

Read the first block of data from a file.

This method will read the first block of data from a file and immediately return.

Parameters:
  • file_type (string) – A string used for selecting the file object to use here.
  • file_name (string) – The file to open.
Returns:

out (numpy.array) – The raw data read from the file.

pyretis.inout.analysisio.analysisio.repptis_running_pcross_analysis(l_ptypes)[source]

Recursive block analysis for repptis.

Parameters:l_ptypes (list) – List of cumsum ptypes for the ensembles [0+-‘], [1+-], … [N-1+-].
Returns:results (dict) – The results from the analysis.
pyretis.inout.analysisio.analysisio.run_analysis(settings)[source]

Run a predefined analysis task.

Parameters:settings (dict) – Simulation settings and settings for the analysis.
Returns:out (dict) – A dictionary with the results from the analysis. This dict can be used to generate a report.
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 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.
Returns:

out (dict) – The results from the analysis.