resistics.project.statistics module

resistics.project.statistics.calculateRemoteStatistics(projData: resistics.project.data.ProjectData, remoteSite: str, **kwargs)[source]

Calculate statistics involving a remote reference site

Parameters
projDataProjectData

A project data instance

remoteSitestr

The name of the site to use as the remote site

sitesList[str], optional

A list of sites to calculate statistics for

sampleFreqsList[float], optional

List of sampling frequencies for which to calculate statistics

specdirstr, optional

The spectra directory for which to calculate statistics

remotestatsList[str], optional

The statistics to calculate out. Acceptable statistics are: “RR_coherence”, “RR_coherenceEqn”, “RR_absvalEqn”, “RR_transferFunction”, “RR_resPhase”. Configuration file values are used by default.

resistics.project.statistics.calculateStatistics(projData: resistics.project.data.ProjectData, **kwargs)[source]

Calculate statistics for sites

Parameters
projDataProjectData

A project data instance

sitesList[str], optional

A list of sites to calculate statistics for

sampleFreqsList[float], optional

List of sampling frequencies for which to calculate statistics

specdirstr, optional

The spectra directory for which to calculate statistics

statsList[str], optional

The statistics to calculate out. Acceptable values are: “absvalEqn” “coherence”, “psd”, “poldir”, “transFunc”, “resPhase”, “partialcoh”. Configuration file values are used by default.

ncoresint, optional

The number of cores to run the transfer function calculations on

resistics.project.statistics.calculateWindowStatistics(winSpecData: resistics.spectra.data.SpectrumData, evalFreq: numpy.ndarray, stats: List[str], remoteSpecData: Union[resistics.spectra.data.SpectrumData, NoneType] = None, statCalculator: Union[resistics.statistics.calculator.StatisticCalculator, NoneType] = None) → Dict[str, Any][source]

Calculate the statistics for a single window

This method is meant to be used with multiprocessing

Parameters
winSpecDataSpectrumData

Spectrum data for a single window

evalFreqnp.ndarray

Array for evaluation frequencies

statsList[str]

List of statistics to calculate

remoteSpecDataNone, SpectrumData

Optionally add remote spectrum data to calculate remote statistics

statCalculatorNone, StatisticCalculator

Provide a statistic calculator to avoid multiple creation of objects

resistics.project.statistics.getStatisticData(projData: resistics.project.data.ProjectData, site: str, meas: str, stat: str, declevel: int = 0, **kwargs) → resistics.statistics.data.StatisticData[source]

Get the statistic data for a statistic for a site measurement

Parameters
projDataProjectData

Project instance

sitestr

The site for which to get the statistic data

measstr

The measurement for which to get the statistic

statstr

The statistic for which to get the measurement

declevelint, optional

The decimation level to read in. Default is 0.

specdirstr, optional

The spectra directory

Returns
StatisticData, None

A StatisticData object or None if the statistic data does not exist

resistics.project.statistics.getStatisticDataForSampleFreq(projData: resistics.project.data.ProjectData, site: str, sampleFreq: float, stat: str, declevel: int = 0, **kwargs) → List[resistics.statistics.data.StatisticData][source]

Get the statistic data (for a particular decimation level) for all measurements in a site with sampling frequency sampleFreq

Parameters
projDataProjectData

Project instance

sitestr

The site for which to get the statistic data

sampleFreqfloat

The sampling frequency

statstr

The statistic for which to get the measurement

declevelint, optional

The decimation level to read in. Default is 0.

specdirstr, optional

The spectra directory

Returns
Dict[str, StatisticData]

A statistic data object

resistics.project.statistics.multiStatistics(ncores: int, spectraData: List[resistics.spectra.data.SpectrumData], evalFreq: numpy.ndarray, stats: List[str], remoteData: Union[List[resistics.spectra.data.SpectrumData], NoneType] = None)[source]

Multiprocessing of statistics

Parameters
ncoresint

The number of cores to use

spectraDataList[SpectrumData]

List of spectrum data to process

evalFreqnp.ndarray

The evaluation frequencies

statsList[str]

The statistics to calculate

remoteDataNone, List[SpectrumData]

Remote data in case of remote reference statistics. None is default

Returns
List[Dict[str, Any]]

The statistic data returned as a list with an entry for every window. The dictionary maps the statistic name to the data for that window.

resistics.project.statistics.viewStatistic(projData: resistics.project.data.ProjectData, site: str, sampleFreq: Union[int, float], stat: str, **kwargs) → Union[matplotlib.figure.Figure, NoneType][source]

View statistic data for a single sampling frequency of a site

Parameters
projDataProjectData

A project instance

sitestr

The site for which to plot statistics

statstr

The statistic to plot

sampleFreqfloat

The sampling frequency for which to plot statistics

declevelint

The decimation level to plot

eFreqIint

The evaluation frequency index

specdirstr

The spectra directory

masknamestr

Mask name

climList, optional

Limits for colourbar axis

xlimList, optional

Limits for the x axis

ylimList, optional

Limits for the y axis

colortitlestr, optional

Title for the colourbar

showbool, optional

Show the spectra plot

savebool, optional

Save the plot to the images directory

plotoptionsDict, optional

Dictionary of plot options

Returns
matplotlib.pyplot.figure or None

A matplotlib figure unless the plot is not shown and is saved, in which case None and the figure is closed. If no data was found, None.

resistics.project.statistics.viewStatisticCrossplot(projData: resistics.project.data.ProjectData, site: str, sampleFreq: Union[int, float], stat: str, crossplots: List[List[str]], **kwargs) → Union[matplotlib.figure.Figure, NoneType][source]

View statistic crossplot data for a single sampling frequency of a site

Parameters
projDataProjectData

A project instance

sitestr

The site for which to plot statistics

statstr

The statistic to plot

sampleFreqfloat

The sampling frequency for which to plot statistics

crossplotsList[List[str]]

The statistic element pairs to crossplot

declevelint

The decimation level to plot

eFreqIint

The evaluation frequency index

specdirstr

The spectra directory

masknamestr

Mask name

xlimList, optional

Limits for the x axis

ylimList, optional

Limits for the y axis

maxcolsint

The maximum number of columns in the plots

showbool, optional

Show the spectra plot

savebool, optional

Save the plot to the images directory

plotoptionsDict, optional

Dictionary of plot options

Returns
matplotlib.pyplot.figure or None

A matplotlib figure unless the plot is not shown and is saved, in which case None and the figure is closed. If no data was found, None.

resistics.project.statistics.viewStatisticDensityplot(projData: resistics.project.data.ProjectData, site: str, sampleFreq: Union[int, float], stat: str, crossplots: List[List[str]], **kwargs) → Union[matplotlib.figure.Figure, NoneType][source]

View statistic data as a density plot for a single sampling frequency of a site

Parameters
projDataProjectData

A project instance

sitestr

The site for which to plot statistics

statstr

The statistic to plot

sampleFreqfloat

The sampling frequency for which to plot statistics

crossplotsList[List[str]]

The statistic element pairs to crossplot

declevelint

The decimation level to plot

eFreqIint

The evaluation frequency index

specdirstr

The spectra directory

masknamestr

Mask name

xlimList, optional

Limits for the x axis

ylimList, optional

Limits for the y axis

maxcolsint

The maximum number of columns in the plots

showbool, optional

Show the spectra plot

savebool, optional

Save the plot to the images directory

plotoptionsDict, optional

Dictionary of plot options

Returns
matplotlib.pyplot.figure or None

A matplotlib figure unless the plot is not shown and is saved, in which case None and the figure is closed. If no data was found, None.

resistics.project.statistics.viewStatisticHistogram(projData: resistics.project.data.ProjectData, site: str, sampleFreq: float, stat: str, **kwargs) → Union[matplotlib.figure.Figure, NoneType][source]

View statistic histograms for a single sampling frequency of a site

Parameters
projDataProjectData

A project instance

sitestr

The site for which to plot statistics

statstr

The statistic to plot

sampleFreqfloat

The sampling frequency for which to plot statistics

declevelint

The decimation level to plot

eFreqIint

The evaluation frequency index

specdirstr

The spectra directory

masknamestr

Mask name

numbinsint

The number of bins for the histogram data binning

xlimList, optional

Limits for the x axis

maxcolsint

The maximum number of columns in the plots

showbool, optional

Show the spectra plot

savebool, optional

Save the plot to the images directory

plotoptionsDict, optional

Dictionary of plot options

Returns
matplotlib.pyplot.figure or None

A matplotlib figure unless the plot is not shown and is saved, in which case None. If no data was found, None.