コード例 #1
0
ファイル: runWithConfig.py プロジェクト: zhang01GA/resistics
# calculate impedance tensor
from resistics.project.transfunc import processProject

processProject(projData, outchans=["Ex", "Ey"])

# plot impedance tensor and save the plot
from resistics.project.transfunc import viewImpedance
from resistics.common.plot import plotOptionsTransferFunction

plotoptions = plotOptionsTransferFunction(plotfonts=getPaperFonts())
plotoptions["xlim"] = [0.01, 1000000]
plotoptions["phase_ylim"] = [-10, 100]
figs = viewImpedance(
    projData,
    sites=["site1"],
    oneplot=True,
    polarisations=["ExHy", "EyHx"],
    plotoptions=plotoptions,
    save=True,
)
figs[0].savefig(imagePath / "impedance_config")

# process for the tipper
processProject(projData, outchans=["Ex", "Ey", "Hz"], postpend="withHz")

from resistics.project.transfunc import viewTipper
from resistics.common.plot import plotOptionsTipper

plotoptions = plotOptionsTipper(plotfonts=getPaperFonts())
plotoptions["xlim"] = [0.01, 1000000]
figs = viewTipper(
    projData, sites=["site1"], postpend="withHz", plotoptions=plotoptions, save=True
コード例 #2
0
ファイル: intersiteRun.py プロジェクト: zhang01GA/resistics
plotOptions = plotOptionsTransferFunction(figsize=(24, 12),
                                          plotfonts=getPaperFonts())
plotOptions["res_ylim"] = [1, 1000000]
processSite(
    proj,
    "site2_te",
    500,
    inputsite="site1_mt",
    postpend="intersite",
)
figs = viewImpedance(
    proj,
    sites=["site2_te"],
    postpend="intersite",
    plotoptions=plotOptions,
    oneplot=False,
    save=False,
    show=False,
)
figs[0].savefig(intersiteImages / "intersiteTransferFunction.png")

# now try again with some statistics for the dead band
from resistics.project.mask import newMaskData, calculateMask

maskData = newMaskData(proj, 500)
maskData.setStats(["coherence"])
maskData.addConstraintLevel("coherence", {
    "cohExHy": [0.8, 1.0],
    "cohEyHx": [0.8, 1.0]
}, 0)
コード例 #3
0
from resistics.project.mask import newMaskData, calculateMask
from resistics.common.plot import plotOptionsTransferFunction, getPaperFonts

plotOptions = plotOptionsTransferFunction(plotfonts=getPaperFonts())
proj = loadProject(remotePath, "remoteConfig.ini")

calculateSpectra(proj, sites=["M6", "Remote"])
proj.refresh()

# single site processing
processProject(proj, sites=["M6", "Remote"])
figs = viewImpedance(
    proj,
    sites=["M6", "Remote"],
    sampleFreqs=[128],    
    oneplot=False,
    plotoptions=plotOptions,
    save=False,
    show=False,
)
figs[0].savefig(remoteImages / "singleSiteM6_128_dec8_5.png")
figs[1].savefig(remoteImages / "singleSiteRemote_128_dec8_5.png")

# calculate the statistic we are interested in
calculateRemoteStatistics(proj, "Remote", sites=["M6"], sampleFreqs=[128])

# generate mask
maskData = newMaskData(proj, 128)
maskData.setStats(["RR_coherenceEqn"])
maskData.addConstraint(
    "RR_coherenceEqn", {"ExHyR-HyHyR": [0.8, 1.0], "EyHxR-HxHxR": [0.8, 1.0]}
コード例 #4
0
processProject(
    projData,
    sampleFreqs=[4096, 128],
    sites=["site1"],
    outchans=["Ex", "Ey"],
    masks={"site1": "coh70_100"},
    postpend="coh70_100",
)

from resistics.project.transfunc import viewImpedance

figs = viewImpedance(
    projData,
    sites=["site1"],
    postpend="coh70_100",
    oneplot=False,
    save=False,
    show=False,
)
figs[0].savefig(imagePath / "runWithMask_coh70_100")

processProject(
    projData,
    sampleFreqs=[4096, 128],
    sites=["site1"],
    outchans=["Ex", "Ey"],
    masks={"site1": "coh70_100_tfConstrained"},
    postpend="coh70_100_tfConstrained",
)

figs = viewImpedance(
コード例 #5
0
from resistics.project.spectra import calculateSpectra
from resistics.project.transfunc import processProject, viewImpedance
from resistics.project.statistics import calculateStatistics
from resistics.project.mask import newMaskData, calculateMask

if __name__ == "__main__":
    projData = loadProject(projectPath, "multiconfig.ini")

    # calculate spectrum using standard options
    calculateSpectra(projData)
    projData.refresh()
    calculateStatistics(projData)

    # process project with standard options
    processProject(projData)
    figs = viewImpedance(projData, oneplot=False, show=False, save=False)
    figs[0].savefig(imagePath / "multproc_standard_process")

    # calculate mask for 128
    maskData = newMaskData(projData, 128)
    maskData.setStats(["coherence"])
    maskData.addConstraint("coherence", {
        "cohExHy": [0.7, 1.0],
        "cohEyHx": [0.7, 1.0]
    })
    maskData.maskName = "coh70_100"
    calculateMask(projData, maskData, sites=["site1"])
    # calculate mask for 4096
    maskData = newMaskData(projData, 4096)
    maskData.setStats(["coherence"])
    maskData.addConstraint("coherence", {
コード例 #6
0
ファイル: remoteHighFreq.py プロジェクト: zhang01GA/resistics
    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,
コード例 #7
0
)
fig.savefig(imagePath / "multspec_viewspec_notch_section")

# process the new set of spectra
from resistics.project.transfunc import processProject

processProject(projData, sites=["site1"], specdir="notch")

# plot the transfer functions, again with specifying the relevant specdir
from resistics.project.transfunc import viewImpedance

figs = viewImpedance(
    projData,
    sites=["site1"],
    sampleFreqs=[128],
    oneplot=False,
    specdir="notch",
    save=False,
    show=False,
)
figs[0].savefig(imagePath / "multspec_viewimp_notch")

# and compare to the original
figs = viewImpedance(
    projData,
    sites=["site1"],
    sampleFreqs=[128],
    oneplot=False,
    specdir="spectra",
    save=False,
    show=False,
コード例 #8
0
ファイル: processConfig.py プロジェクト: zhang01GA/resistics
from resistics.project.spectra import calculateSpectra
from resistics.project.statistics import calculateStatistics
from resistics.project.transfunc import processProject, viewImpedance
from resistics.common.plot import plotOptionsTransferFunction, getPaperFonts

calculateSpectra(proj)
proj.refresh()
calculateStatistics(proj)
processProject(proj)
plotOptions = plotOptionsTransferFunction(figsize=(24, 12),
                                          plotfonts=getPaperFonts())
plotOptions["res_ylim"] = [1, 1000000]
figs = viewImpedance(proj,
                     oneplot=False,
                     plotoptions=plotOptions,
                     show=False,
                     save=False)
figs[0].savefig(imagePath / "impedance_config.png")

# now try again with some statistics for the dead band
from resistics.project.mask import newMaskData, calculateMask

maskData = newMaskData(proj, 500)
maskData.setStats(["coherence"])
maskData.addConstraintLevel("coherence", {
    "cohExHy": [0.8, 1.0],
    "cohEyHx": [0.8, 1.0]
}, 0)
maskData.addConstraintLevel("coherence", {
    "cohExHy": [0.8, 1.0],
コード例 #9
0
from resistics.project.transfunc import viewTipper

figs = viewTipper(projData,
                  sites=["site1"],
                  postpend="with_Hz",
                  save=True,
                  show=False)
figs[0].savefig(imagePath / "simpleRunWithTipper_viewtip_withHz")

# plot the transfer function
from resistics.project.transfunc import viewImpedance

figs = viewImpedance(
    projData,
    sites=["site1"],
    polarisations=["ExHy", "EyHx"],
    postpend="with_Hz",
    save=False,
    show=False,
)
figs[0].savefig(imagePath / "simpleRunWithTipper_viewimp_withHz_polarisations")

# process only the tippers
processProject(projData, sites=["site1"], outchans=["Hz"], postpend="only_Hz")
figs = viewTipper(projData,
                  sites=["site1"],
                  postpend="only_Hz",
                  save=False,
                  show=False)
figs[0].savefig(imagePath / "simpleRunWithTipper_viewtip_onlyHz")
コード例 #10
0
def test_masked_processing() -> None:
    """Test masked processing the project"""
    from datapaths import path_integrated_singlesite, path_integrated_singlesite_config
    from resistics.project.io import loadProject
    from resistics.project.spectra import calculateSpectra
    from resistics.project.statistics import calculateStatistics
    from resistics.project.mask import newMaskData, calculateMask
    from resistics.project.transfunc import processProject
    from resistics.project.transfunc import getTransferFunctionData, viewImpedance

    # load project
    sites = ["M7_4096"]
    proj = loadProject(path_integrated_singlesite,
                       str(path_integrated_singlesite_config))
    # calculateSpectra(proj)
    # proj.refresh()
    # calculateStatistics(proj)
    # calculate out a mask
    maskData = newMaskData(proj, 4096)
    maskData.setStats(["coherence", "transferFunction", "resPhase"])
    maskData.addConstraintLevel("coherence", {
        "cohExHy": [0.8, 1.0],
        "cohEyHx": [0.8, 1.0]
    }, 0)
    maskData.addConstraintLevel("coherence", {
        "cohExHy": [0.8, 1.0],
        "cohEyHx": [0.8, 1.0]
    }, 1)
    maskData.addConstraintLevel("coherence", {
        "cohExHy": [0.8, 1.0],
        "cohEyHx": [0.7, 1.0]
    }, 2)
    maskData.addConstraintLevel("coherence", {
        "cohExHy": [0.7, 1.0],
        "cohEyHx": [0.7, 1.0]
    }, 3)
    maskData.addConstraintLevel("coherence", {
        "cohExHy": [0.7, 1.0],
        "cohEyHx": [0.7, 1.0]
    }, 4)
    maskData.addConstraintFreq("transferFunction", {
        "EyHxReal": [0, 150],
        "EyHxImag": [0, 220]
    }, 0, 4)
    maskData.addConstraintFreq("transferFunction", {
        "ExHyReal": [-120, 0],
        "ExHyImag": [-200, -30]
    }, 1, 0)
    maskData.addConstraintFreq("transferFunction", {
        "ExHyReal": [-100, 0],
        "ExHyImag": [-160, -30]
    }, 1, 1)
    maskData.addConstraintFreq("transferFunction", {
        "ExHyReal": [-90, 0],
        "ExHyImag": [-120, -30]
    }, 1, 2)
    maskData.addConstraintFreq("transferFunction", {
        "ExHyReal": [-60, -25],
        "ExHyImag": [-90, -75]
    }, 1, 3)
    maskData.addConstraintFreq("transferFunction", {
        "ExHyReal": [-80, 0],
        "ExHyImag": [-100, -20]
    }, 1, 4)
    # finally, lets give maskData a name, which will relate to the output file
    maskData.maskName = "coh_tf"
    calculateMask(proj, maskData, sites=sites)
    # process
    processProject(
        proj,
        sites=sites,
        masks={"M7_4096": "coh_tf"},
        postpend="coh_tf",
    )
    # tf = getTransferFunctionData(proj, "M7_4096", 4096)
    # test the transfer function
    viewImpedance(
        proj,
        sites=sites,
        postpend="coh_tf",
        polarisations=["ExHy", "EyHx"],
        oneplot=False,
        show=False,
        save=True,
    )
コード例 #11
0
# calculate spectrum using standard options
from resistics.project.spectra import calculateSpectra

calculateSpectra(projData)
projData.refresh()

# process the spectra
from resistics.project.transfunc import processProject

processProject(projData)

# plot transfer function and save the plot
from resistics.project.transfunc import viewImpedance

figs = viewImpedance(projData, sites=["site1"], show=False, save=False)
figs[0].savefig(imagePath / "simpleRun_viewimp_default")

# or keep the two most important polarisations on the same plot
figs = viewImpedance(projData,
                     sites=["site1"],
                     polarisations=["ExHy", "EyHx"],
                     save=False,
                     show=False)
figs[0].savefig(imagePath / "simpleRun_viewimp_polarisations")

# this plot is quite busy, let's plot all the components on separate plots
figs = viewImpedance(projData,
                     sites=["site1"],
                     oneplot=False,
                     save=False,
コード例 #12
0
# view time
from resistics.project.time import viewTime

fig = viewTime(
    proj,
    startDate="2019-05-27 14:15:00",
    endDate="2019-05-27 15:00:00",
    filter={"lpfilt": 4},
    save=False,
    show=False,
)
fig.savefig(imagePath / "viewTime.png")

from resistics.project.spectra import calculateSpectra
from resistics.project.statistics import calculateStatistics
from resistics.project.transfunc import processProject, viewImpedance
from resistics.common.plot import plotOptionsTransferFunction, getPaperFonts

calculateSpectra(proj)
proj.refresh()
calculateStatistics(proj)
processProject(proj)
plotOptions = plotOptionsTransferFunction(figsize=(24, 12),
                                          plotfonts=getPaperFonts())
plotOptions["res_ylim"] = [1, 1000000]
figs = viewImpedance(proj,
                     oneplot=False,
                     plotoptions=plotOptions,
                     show=False,
                     save=False)
figs[0].savefig(imagePath / "impedance_default.png")
コード例 #13
0
})
maskData.maskName = "coh30_100"
calculateMask(projData, maskData, sites=["site1"])
fig = maskData.view(0)
fig.savefig(imagePath / "maskcoh")

# calculate impedance tensor
from resistics.project.transfunc import processProject

processProject(projData,
               outchans=["Ex", "Ey"],
               masks={"site1": maskData.maskName},
               postpend=maskData.maskName)

# plot transfer function and save the plot
from resistics.project.transfunc import viewImpedance
from resistics.common.plot import plotOptionsTransferFunction, getPaperFonts

plotoptions = plotOptionsTransferFunction(plotfonts=getPaperFonts())
plotoptions["xlim"] = [0.01, 1000000]
plotoptions["phase_ylim"] = [-10, 100]
figs = viewImpedance(
    projData,
    sites=["site1"],
    postpend=maskData.maskName,
    oneplot=True,
    polarisations=["ExHy", "EyHx"],
    plotoptions=plotoptions,
    save=False,
)
figs[0].savefig(imagePath / "impedance_config_masked")
コード例 #14
0
from datapaths import projectPath, imagePath
from resistics.project.io import loadProject

#  load the project and also provide a config file
projData = loadProject(projectPath, configFile="tutorialConfig.ini")
projData.printInfo()

# calculate spectrum using the new configuration
from resistics.project.spectra import calculateSpectra

calculateSpectra(projData)
projData.refresh()

# process the spectra
from resistics.project.transfunc import processProject, viewImpedance

processProject(projData)
figs = viewImpedance(projData,
                     sites=["site1"],
                     oneplot=False,
                     save=False,
                     show=False)
figs[0].savefig(imagePath / "usingConfigFiles_viewimp")