mcsas3.mcanalysis.McAnalysis#
- class mcsas3.mcanalysis.McAnalysis(inputFile: Path, measData: dict, histRanges: pandas.DataFrame, store: bool = False, resultIndex: int = 1)[source]#
Bases:
object
This class is the analyzer / histogramming code for the entire set of repetitions. It can only been run after each individual repetition has been histogrammed using the McModelHistogrammer class.
McAnalysis uses the individual repetition histograms to calculate the mean and spread of each histogram bin, and the mean and spread of each population mode. It also uses the scaling parameters to scale all values to absolute volume fractions.
Due to the complexity of setting up, McAnalysis must be provided an output HDF5 file, where all the results and set-up are stored. It then reads the individual optimization results and performs its statistical calculations.
- __init__(inputFile: Path, measData: dict, histRanges: pandas.DataFrame, store: bool = False, resultIndex: int = 1) None [source]#
Methods
__init__
(inputFile, measData, histRanges[, ...])averageHistogram
(histIndex)Produces a single averaged histogram for a given histogram range index.
Averages all the histogram ranges sequentially and stores the averaged histograms in a dict with {histIndex: histogram DataFrame}.
averageI
()averageMode
(histIndex)Calculates the mean and standard deviation for each mode, for a particular repetition index, and returns a multiindex DataFrame.
Combines the multiindex dataframes into a single table with one row per histogram range.
Combines the multiindex dataframes into a single table with one row per histogram range.
debugAddString
(fieldName, valMean, valStd)debugPlot
(histIndex, **kwargs)Plots a single histogram, for debugging purposes only, can only be done after histogramming is complete.
debugReport
(histIndex)Preformats the rangeInfo results ready for printing (mostly translated from the original McSAS).
Preformats the run statistics results ready for printing (mostly translated from the original McSAS).
ensureConcatEssentials
(histIndex)Small function that makes sure at least an empty DataFrame exists for appending the concatenated data to
getNRep
(inputFile)Finds out which repetition indices are available in the results file, skipping potential missing indices.
histAndLoadReps
(inputFile, store[, resultIndex])For every repetition, runs its mcModelHistogrammer, and loads the results into the local namespace for further processing.
store
(filename)Attributes
modelIAvg
optParAvg
- averageHistogram(histIndex: int) None [source]#
Produces a single averaged histogram for a given histogram range index. Returns a DataFrame.
- averageHistograms() None [source]#
Averages all the histogram ranges sequentially and stores the averaged histograms in a dict with {histIndex: histogram DataFrame}.
- averageMode(histIndex: int) pandas.DataFrame [source]#
Calculates the mean and standard deviation for each mode, for a particular repetition index, and returns a multiindex DataFrame.
- averageModes() None [source]#
Combines the multiindex dataframes into a single table with one row per histogram range.
- averageOpts() None [source]#
Combines the multiindex dataframes into a single table with one row per histogram range.
- debugPlot(histIndex: int, **kwargs: dict) None [source]#
Plots a single histogram, for debugging purposes only, can only be done after histogramming is complete.
- debugReport(histIndex: int) str [source]#
Preformats the rangeInfo results ready for printing (mostly translated from the original McSAS). Should be plotted with a fixed-width font because nothing says 2020 like misaligned text.
- debugRunReport() str [source]#
Preformats the run statistics results ready for printing (mostly translated from the original McSAS). Should be plotted with a fixed-width font because nothing says 2020 like misaligned text.
- ensureConcatEssentials(histIndex: int) None [source]#
Small function that makes sure at least an empty DataFrame exists for appending the concatenated data to