resistics.project.spectra module

resistics.project.spectra.calculateSpectra(projData: resistics.project.data.ProjectData, **kwargs) → None[source]

Calculate spectra for the project time data

The philosophy is that spectra are calculated out for all data and later limited using statistics and time constraints

Parameters
projDataProjectData

A project data object

sitesstr, List[str], optional

Either a single site or a list of sites

sampleFreqsint, float, List[float], optional

The frequencies in Hz for which to calculate the spectra. Either a single frequency or a list of them.

chansList[str], optional

The channels for which to calculate out the spectra

polreverseDict[str, bool]

Keys are channels and values are boolean flags for reversing

scaleDict[str, float]

Keys are channels and values are floats to multiply the channel data by

calibratebool, optional

Flag whether to calibrate the data or not

notchList[float], optional

List of frequencies to notch

filterDict, optional

Filter parameters

specdirstr, optional

The spectra directory to save the spectra data in

ncoresint, optional

The number of cores to run the transfer function calculations on

resistics.project.spectra.calculateWindowSpectra(timeDataList: List[resistics.time.data.TimeData], sampleFreq: float, windowSize: int, config: Union[Dict, NoneType] = None)[source]

Calculate spectra for a list of TimeData

Parameters
timeDataListList[TimeData]

A list of TimeData objects

sampleFreqfloat

The sampling frequency of the TimeData

windowSizeint

The number of samples in the window

Returns
specDataListList[SpectrumData]

A list of spectra data

resistics.project.spectra.getSpecReader(projData: resistics.project.data.ProjectData, site: str, meas: str, **kwargs) → Union[resistics.spectra.io.SpectrumReader, NoneType][source]

Get the spectrum reader for a measurement

Parameters
sitestr

Site for which to get the spectra reader

measstr

The measurement

optionsDict

Options in a dictionary

declevelint, optional

Decimation level for which to get data

specdirstr, optional

String that specifies spectra directory for the measurement

Returns
SpectrumReader

The SpectrumReader object or None if data does not exist

resistics.project.spectra.multiSpectra(ncores: int, timeDataList: List[resistics.time.data.TimeData], sampleFreq: float, windowSize: int, config: Dict[str, NoneType] = None)[source]

Multiprocessing of spectra

Parameters
ncores: int

The number of cores for multiprocessing

timeDataListList[TimeData]

A list of TimeData objects

sampleFreqfloat

The sampling frequency of the TimeData

windowSizeint

The number of samples in the window

Returns
specDataListList[SpectrumData]

A list of spectra data

resistics.project.spectra.viewSpectra(projData: resistics.project.data.ProjectData, site: str, meas: str, **kwargs) → Union[matplotlib.figure.Figure, NoneType][source]

View spectra for a measurement

Parameters
projDataprojecData

The project data

sitestr

The site to view

meas: str

The measurement of the site to view

chansList[str], optional

Channels to plot

declevelint, optional

Decimation level to plot

plotwindowint, str, Dict, optional

Windows to plot (local). If int, the window with local index plotwindow will be plotted. If string and “all”, all the windows will be plotted if there are less than 20 windows, otherwise 20 windows throughout the whole spectra dataset will be plotted. If a dictionary, needs to have start and stop to define a range.

specdirstr, optional

String that specifies spectra directory for the measurement

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, then None is returned.

resistics.project.spectra.viewSpectraSection(projData: resistics.project.data.ProjectData, site: str, meas: str, **kwargs) → Union[matplotlib.figure.Figure, NoneType][source]

View spectra section for a measurement

Parameters
projDataprojecData

The project data

sitestr

The site to view

meas: str

The measurement of the site to view

chansList[str], optional

Channels to plot

declevelint, optional

Decimation level to plot

specdirstr, optional

String that specifies spectra directory for the measurement

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, then None is returned.

resistics.project.spectra.viewSpectraStack(projData: resistics.project.data.ProjectData, site: str, meas: str, **kwargs) → Union[matplotlib.figure.Figure, NoneType][source]

View spectra stacks for a measurement

Parameters
projDataprojecData

The project data

sitestr

The site to view

meas: str

The measurement of the site to view

chansList[str], optional

Channels to plot

declevelint, optional

Decimation level to plot

numstacksint, optional

The number of windows to stack

coherencesList[List[str]], optional

A list of coherences to add, specified as [[“Ex”, “Hy”], [“Ey”, “Hx”]]

specdirstr, optional

String that specifies spectra directory for the measurement

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, then None is returned.