from pathlib import Path from resistics.project.projectIO import loadProject from resistics.project.projectSpectra import calculateSpectra from resistics.project.projectTransferFunction import processProject, viewImpedance from resistics.project.projectStatistics import calculateRemoteStatistics, viewStatistic from resistics.project.projectMask import newMaskData, calculateMask projectPath = Path("remoteProject") projData = loadProject(projectPath, "remoteConfig.ini") calculateSpectra(projData, sites=["M6", "Remote"]) projData.refresh() processProject(projData, sites=["M6", "Remote"]) viewImpedance(projData, sites=["M6", "Remote"], oneplot=False, save=True, show=False) # calculate the statistic we are interested in calculateRemoteStatistics(projData, "Remote", sites=["M6"], sampleFreqs=[128]) # generate mask maskData = newMaskData(projData, 128) maskData.setStats(["RR_coherenceEqn"]) maskData.addConstraint("RR_coherenceEqn", { "ExHyR-HyHyR": [0.8, 1.0], "EyHxR-HxHxR": [0.8, 1.0] }) # finally, lets give maskData a name, which will relate to the output file maskData.maskName = "rr_cohEqn_80_100" calculateMask(projData, maskData, sites=["M6"])
import os from resistics.project.projectIO import loadProject # load the project and also provide a config file projectPath = os.path.join("tutorialProject") projData = loadProject(projectPath, configFile="tutorialConfig.ini") projData.printInfo() # calculate spectrum using the new configuration from resistics.project.projectSpectra import calculateSpectra calculateSpectra(projData) projData.refresh() # process the spectra from resistics.project.projectTransferFunction import processProject, viewImpedance processProject(projData) viewImpedance(projData, sites=["site1"], oneplot=False, save=True)
show=True, save=True, ) # process the new set of spectra from resistics.project.projectTransferFunction import processProject processProject(projData, sites=["site1"], specdir="notch") # plot the transfer functions, again with specifying the relevant specdir from resistics.project.projectTransferFunction import viewImpedance viewImpedance( projData, sites=["site1"], sampleFreqs=[128], oneplot=False, specdir="notch", save=True, ) # and compare to the original viewImpedance( projData, sites=["site1"], sampleFreqs=[128], oneplot=False, specdir="spectra", save=True, )
calculateMask(projData, maskData, sites=["M6"]) maskData.printInfo() processProject( projData, sites=["M6"], sampleFreqs=[512, 4096, 16384, 65536], masks={"M6": "coh_80_100"}, postpend="coh_80_100", ) viewImpedance( projData, sites=["M6"], sampleFreqs=[512, 4096, 16384, 65536], postpend="coh_80_100", oneplot=False, save=True, show=False, ) # # try this # from resistics.utilities.utilsPlotter import plotOptionsTransferFunction, getPaperFonts # plotOptions = plotOptionsTransferFunction(figsize=(24, 12), plotfonts=getPaperFonts()) # print(plotOptions) # projectPath = Path("remoteProject") # projData = loadProject(projectPath, "manualWindowsConfig.ini") # viewImpedance( # projData,
maskData.setStats(["coherence"]) maskData.addConstraint("coherence", {"cohExHy": [0.3, 1.0], "cohEyHx": [0.3, 1.0]}) maskData.maskName = "coh30_100" calculateMask(projData, maskData, sites=["site1"]) fig = maskData.view(0) fig.savefig(os.path.join(projectPath, "images", "maskcoh")) # calculate impedance tensor from resistics.project.projectTransferFunction import processProject processProject( projData, outchans=["Ex", "Ey"], masks={"site1": maskData.maskName}, postpend=maskData.maskName ) projData.refresh() # plot transfer function and save the plot from resistics.project.projectTransferFunction import viewImpedance from resistics.utilities.utilsPlotter import plotOptionsTransferFunction plotoptions = plotOptionsTransferFunction() plotoptions["xlim"] = [0.01, 1000000] plotoptions["phase_ylim"] = [-10, 100] viewImpedance( projData, sites=["site1"], postpend=maskData.maskName, oneplot=True, polarisations=["ExHy", "EyHx"], plotoptions=plotoptions, save=True, )
# calculate spectrum using standard options from resistics.project.projectSpectra import calculateSpectra calculateSpectra(projData) projData.refresh() # process the spectra from resistics.project.projectTransferFunction import processProject processProject(projData) # plot transfer function and save the plot from resistics.project.projectTransferFunction import viewImpedance viewImpedance(projData, sites=["site1"], save=True) # or keep the two most important polarisations on the same plot viewImpedance(projData, sites=["site1"], polarisations=["ExHy", "EyHx"], save=True) # this plot is quite busy, let's plot all the components on separate plots viewImpedance(projData, sites=["site1"], oneplot=False, save=True) # get a transfer function data object from resistics.project.projectTransferFunction import getTransferFunctionData tfData = getTransferFunctionData(projData, "site1", 128) fig = tfData.viewImpedance(oneplot=True,
# process the spectra with tippers from resistics.project.projectTransferFunction import processProject processProject(projData, sites=["site1"], outchans=["Ex", "Ey", "Hz"], postpend="with_Hz") projData.refresh() # plot the tippers from resistics.project.projectTransferFunction import viewTipper viewTipper(projData, sites=["site1"], postpend="with_Hz", save=True) # plot the transfer function from resistics.project.projectTransferFunction import viewImpedance viewImpedance( projData, sites=["site1"], polarisations=["ExHy", "EyHx"], postpend="with_Hz", save=True, ) # process only the tippers processProject(projData, sites=["site1"], outchans=["Hz"], postpend="only_Hz") projData.refresh() viewTipper(projData, sites=["site1"], postpend="only_Hz", save=True)
# process the spectra from resistics.project.projectTransferFunction import processProject processProject(projData, sampleFreqs=[128], datetimes=datetimes, postpend="datetimeConstraint") # plot transfer function and save the plot from resistics.project.projectTransferFunction import viewImpedance viewImpedance( projData, sites=["site1"], postpend="datetimeConstraint", oneplot=False, save=True, show=True, ) # process again with a mask too processProject( projData, sampleFreqs=[128], sites=["site1"], outchans=["Ex", "Ey"], masks={"site1": "coh70_100_tfConstrained"}, datetimes=datetimes, postpend="coh70_100_tfConstrained_datetimeConstrained", )