This package defines analysis tools for the PyRETIS program.
The analysis tools are intended to be used for analysis of the simulation output from the PyRETIS program. The typical use of this package is in postprocessing of the results from a simulation (or several simulations).
pyretis.analysis.analysis
)pyretis.analysis.energy_analysis
)pyretis.analysis.histogram
)pyretis.analysis.order_analysis
)pyretis.analysis.path_analysis
)analyse_energies()
)analyse_flux()
)analyse_orderp()
)analyse_path_ensemble()
)match_probabilities()
)histogram()
)histogram
.match_all_histograms()
)retis_flux()
)retis_rate()
)pyretis.analysis.
analyse_md_flux
(crossdata, energydata, orderdata, settings)[source]¶Analyse the output from a MDflux simulation.
The obtained results will be returned as a convenient structure for plotting or reporting.
Parameters: 


Returns:  results (dict) – This dict contains the results from the different analysis as a dictionary. This dict can be used further for plotting or for generating reports. 
Module defining functions useful in the analysis of simulation data.
running_average()
)block_error()
)block_error_corr()
)pyretis.analysis.analysis.
running_average
(data)[source]¶Create a running average of the given data.
The running average will be calculated over the rows.
Parameters:  data (numpy.array) – This is the data we will average. 

Returns:  out (numpy.array) – The running average. 
pyretis.analysis.analysis.
block_error
(data, maxblock=None, blockskip=1)[source]¶Perform block error analysis.
This function will estimate the standard deviation in the input data by performing a block analysis. The number of blocks to consider can be specified or it will be taken as the half of the length of the input data. Averages and variance are calculated using an onthefly algorithm [1].
Parameters: 


Returns: 

References
[1]  Wikipedia, “Algorithms for calculating variance”, http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance 
pyretis.analysis.analysis.
block_error_corr
(data, maxblock=None, blockskip=1)[source]¶Run block error analysis on the given data.
This will run the block error analysis and return the relative errors and correlation length.
Parameters: 


Returns: 

Methods for analysing energy data from simulations.
pyretis.analysis.energy_analysis.
analyse_energies
(energies, settings)[source]¶Run the energy analysis on several energy types.
The function will run the energy analysis on several energy types and collect the energies into a structure which is convenient for plotting the results.
Parameters: 


Returns:  results (dict) – For each energy key results[key] contains the result from the energy analysis. 
See also
analyse_data()
in pyretis.analysis.analysis.py
.
Methods for analysis of crossings for flux data.
analyse_flux()
)pyretis.analysis.flux_analysis.
analyse_flux
(fluxdata, settings)[source]¶Run the analysis on the given flux data.
This will run the flux analysis and collect the results into a structure which is convenient for plotting and reporting the results.
Parameters: 


Returns:  results (dict) – This dict contains the results from the flux analysis. The keys are defined in the results variable. 
Histogram functions for data analysis.
This module defines some simple functions for histograms.
histogram()
)match_all_histograms()
)histogram_and_avg()
)pyretis.analysis.histogram.
histogram
(data, bins=10, limits=(1, 1), density=False, weights=None)[source]¶Create a histogram of the given data.
Parameters: 


Returns: 

Examples
>>> import numpy as np
>>> from pyretis.analysis.histogram import histogram
>>> data = np.random.randn(50000)
>>> hist, bins, bin_mid = histogram(data, bins=30, limits=(5, 5))
For plotting the histogram:
>>> from matplotlib import pyplot as plt
>>> plt.plot(bin_mid, hist, 'o', lw=3, alpha=0.8, ms=9)
>>> plt.show()
pyretis.analysis.histogram.
match_all_histograms
(histograms, umbrellas)[source]¶Match several histograms from an umbrella sampling.
Parameters: 


Returns: 

pyretis.analysis.histogram.
histogram_and_avg
(data, bins, density=True)[source]¶Create histogram an return bins, midpoints and simple statistics.
The simple statistics include the mean value and the standard deviation. The return structure is useful for plotting routines. The midpoints returned are the midpoints of the bins.
Parameters: 


Returns: 

See also
Examples
>>> import numpy as np
>>> from pyretis.analysis.histogram import histogram_and_avg
>>> data = np.random.randn(50000)
>>> hist_data = histogram_and_avg(data, bins=30)
Print out the average and standard deviation:
>>> print(hist_data[2])
For plotting with matplotlib:
>>> from matplotlib import pyplot as plt
>>> plt.plot(hist_data[1], hist_data[0], 'o', lw=3, alpha=0.8, ms=9)
>>> plt.show()
Module defining functions for analysis of order parameters.
analyse_orderp()
)pyretis.analysis.order_analysis.
analyse_orderp
(orderdata, settings)[source]¶Run the analysis on several order parameters.
The results are collected into a structure which is convenient for plotting.
Parameters: 


Returns:  results (numpy.array) – For each order parameter key, results[key] contains the result of the analysis. 
See also
analyse_data in pyretis.analysis.analysis.py
Note
We here (and in the plotting routines) make certain assumptions about the structure, i.e. the positions are assumed to have a specific meaning: column zero is the time, column one the order parameter and so on.
Methods for analysis of path ensembles.
analyse_path_ensemble()
)analyse_path_ensemble_object()
)match_probabilities()
)retis_flux()
)retis_rate()
)pyretis.analysis.path_analysis.
analyse_path_ensemble
(path_ensemble, settings)[source]¶Analyse a path ensemble.
This function will make use of the different analysis functions and analyse a path ensemble. This function is more general than the analyse_path_ensemble_object function in that it should work on both PathEnsemble and PathEnsembleFile objects. The running average is updated onthefly, see Wikipedia for details [wikimov].
Parameters: 


Returns:  out (dict) – This dictionary contains the main results for the analysis which can be used for plotting or other kinds of output. 
See also
_update_shoot_stats()
, pcross_lambda_cumulative()
and _create_shoot_histograms()
.
References
[wikimov]  Wikipedia, “Moving Average”, https://en.wikipedia.org/wiki/Moving_average 
pyretis.analysis.path_analysis.
analyse_path_ensemble_object
(path_ensemble, settings)[source]¶Analyse a path ensemble object.
This function will make use of the different analysis functions and
analyse a path ensemble. This analysis function assumes that the
given path ensemble is an object like PathEnsemble
and that this path ensemble contains all the paths that are needed.
Parameters: 


Returns:  out (dict) – This dictionary contains the main results for the analysis which can be used for plotting or other kinds of output. 
See also
_pcross_lambda()
, _running_pcross()
,
_get_path_distribution()
and _shoot_analysis()
.
pyretis.analysis.path_analysis.
match_probabilities
(path_results, detect)[source]¶Match probabilities from several path ensembles.
It will also calculate efficiencies and error for the matched probability.
Parameters: 


Returns:  results (dict) – These are results for the overall probability and error and also some overall TIS efficiencies. 
pyretis.analysis.path_analysis.
retis_flux
(results0, results1, timestep)[source]¶Calculate the initial flux for RETIS.
Parameters: 


Returns: 

pyretis.analysis.path_analysis.
retis_rate
(pcross, pcross_relerror, flux, flux_relerror)[source]¶Calculate the rate constant for RETIS.
Parameters: 


Returns: 
