Ejemplo n.º 1
0
    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]}
)
# finally, lets give maskData a name, which will relate to the output file
maskData.maskName = "rr_cohEqn_80_100"
calculateMask(proj, maskData, sites=["M6"])
maskData.printInfo()

# process with masks
processProject(
    proj,
    sites=["M6"],
    sampleFreqs=[128],
    remotesite="Remote",
Ejemplo n.º 2
0
)
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)
maskData.addConstraintLevel("coherence", {
    "cohExHy": [0.8, 1.0],
    "cohEyHx": [0.8, 1.0]
}, 1)
maskData.addConstraintLevel("coherence", {
    "cohExHy": [0.7, 1.0],
    "cohEyHx": [0.7, 1.0]
}, 2)
maskData.addConstraintLevel("coherence", {
    "cohExHy": [0.6, 1.0],
Ejemplo n.º 3
0
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", {
        "cohExHy": [0.7, 1.0],
        "cohEyHx": [0.7, 1.0]
    })
    maskData.maskName = "coh70_100"
Ejemplo n.º 4
0
from resistics.project.transfunc import processProject, viewImpedance
from resistics.project.statistics import (
    calculateStatistics,
    calculateRemoteStatistics,
    viewStatistic,
)
from resistics.project.mask import newMaskData, calculateMask

projData = loadProject(remotePath, "remoteConfig.ini")

calculateStatistics(projData,
                    sites=["M6"],
                    sampleFreqs=[512, 4096, 16384, 65536])
# generate mask
for fs in [512, 4096, 16384, 65536]:
    maskData = newMaskData(projData, fs)
    maskData.setStats(["coherence"])
    maskData.addConstraint("coherence", {
        "cohExHy": [0.8, 1.0],
        "cohEyHx": [0.8, 1.0]
    })
    # finally, lets give maskData a name, which will relate to the output file
    maskData.maskName = "coh_80_100"
    calculateMask(projData, maskData, sites=["M6"])
    maskData.printInfo()

processProject(
    projData,
    sites=["M6"],
    sampleFreqs=[512, 4096, 16384, 65536],
    masks={"M6": "coh_80_100"},
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,
    )
Ejemplo n.º 6
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="asciiconfig.ini")
projData.printInfo()

# calculate statistics
from resistics.project.statistics import calculateStatistics

calculateStatistics(projData)

# create a mask based on coherence
from resistics.project.mask import newMaskData, calculateMask

maskData = newMaskData(projData, 0.5)
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(imagePath / "maskcoh")

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

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