Ejemplo n.º 1
0
N = 1
for d in np.arange(dimObs):
    N *= cfg.grid.nx[d]
    if (hasattr(cfg.grid, 'nSTDLow') & hasattr(cfg.grid, 'nSTDHigh')):
        gridPostfix = "%s_n%dl%dh%d" % (gridPostfix, cfg.grid.nx[d],
                                        cfg.grid.nSTDLow[d], cfg.grid.nSTDHigh[d])
    else:
        gridPostfix = "%s_n%dminmax" % (gridPostfix, cfg.grid.nx[d])
gridPostfix = "%s%s%s" % (srcPostfix, obsName, gridPostfix)

mifName = 'mif'
mifLabel = r'$MI(t)$'

# Read ccf
print 'Reading mutual information function...'
mif = np.loadtxt('%s/mutual_information/mif_lag%d%s.txt'\
                 % (cfg.general.resDir, int(cfg.stat.lagMax),
                    gridPostfix))
lags = np.loadtxt('%s/mutual_information/lags_lag%d%s.txt'\
                  % (cfg.general.resDir, int(cfg.stat.lagMax),
                     gridPostfix))
        
# Plot MIF
print 'Plotting mutual information function...'
(fig, ax) = ergoPlot.plotCCF(mif, lags, ylabel=mifLabel, plotPositive=False,
                             ylim=[0., mif.max()])
plt.savefig('%s/plot/mutual_information/%s_lag%d%s.%s'\
           % (cfg.general.resDir, mifName, int(cfg.stat.lagMax),
              gridPostfix, ergoPlot.figFormat),
            dpi=ergoPlot.dpi, bbox_inches=ergoPlot.bbox_inches)
Ejemplo n.º 2
0
lags = np.loadtxt('%s/correlation/lags_lag%d%s.txt'\
                  % (cfg.general.resDir, int(cfg.stat.lagMax),
                     srcPostfix))
perio = np.loadtxt('%s/power/%s_chunk%d%s.txt'\
                   % (cfg.general.resDir, powerName, int(cfg.stat.chunkWidth),
                      srcPostfix))
perioSTD = np.loadtxt('%s/power/%sSTD_chunk%d%s.txt' \
                      % (cfg.general.resDir, powerName, int(cfg.stat.chunkWidth),
                         srcPostfix))
freq = np.loadtxt('%s/power/freq_chunk%d%s.txt' \
                  % (cfg.general.resDir, cfg.stat.chunkWidth,
                     srcPostfix))
        
# Plot CCF
print 'Plotting correlation function...'
(fig, ax) = ergoPlot.plotCCF(ccf, lags, ylabel=corrLabel, plotPositive=True)
plt.savefig('%s/plot/correlation/%s_lag%d%s.%s'\
           % (cfg.general.resDir, corrName, int(cfg.stat.lagMax),
              srcPostfix, ergoPlot.figFormat),
            dpi=ergoPlot.dpi, bbox_inches=ergoPlot.bbox_inches)

# Plot perio
print 'Plotting periodogram...'
angFreq = freq * 2 * np.pi
(fig, ax) = ergoPlot.plotPerio(perio, perioSTD=perioSTD, freq=angFreq,
                               ylabel=powerLabel, plotPositive=True,
                               absUnit='', yscale='log',
                               xlim=(0, cfg.stat.angFreqMax),
                               ylim=(cfg.stat.powerMin, cfg.stat.powerMax))
plt.savefig('%s/plot/power/%s_chunk%d%s.%s'\
            % (cfg.general.resDir, powerName, int(cfg.stat.chunkWidth),
Ejemplo n.º 3
0
np.savetxt('%s/correlation/lags%s_lagMax%dyr.txt' \
           % (cfg.general.resDir, dstPostfix,
              cfg.stat.lagMax), lags)
np.savetxt('%s/power/powerSample%s_chunk%dyr.txt' \
           % (cfg.general.resDir, dstPostfix,
              cfg.stat.chunkWidth), powerSample)
np.savetxt('%s/power/powerSampleSTD%s_chunk%dyr.txt' \
           % (cfg.general.resDir, dstPostfix,
              cfg.stat.chunkWidth), powerSampleSTD)
np.savetxt('%s/power/freq%s_chunk%dyr.txt' \
           % (cfg.general.resDir, dstPostfix,
              cfg.stat.chunkWidth), freq)

# Plot corrSample
print 'Plotting correlation function...'
(fig, ax) = ergoPlot.plotCCF(corrSample, lags, plotPositive=True)
plt.savefig('%s/correlation/corrSample%s_lagMax%dyr.%s'\
            % (cfg.general.plotDir, dstPostfix,
               cfg.stat.lagMax, ergoPlot.figFormat),
            dpi=ergoPlot.dpi, bbox_inches=ergoPlot.bbox_inches)

# Plot powerSample
print 'Plotting powerSampledogram...'
angFreq = freq * 2 * np.pi
(fig, ax) = ergoPlot.plotPerio(powerSample,
                               perioSTD=powerSampleSTD,
                               freq=angFreq,
                               plotPositive=True,
                               absUnit='',
                               yscale='log',
                               xlim=(0, cfg.stat.angFreqMax),
Ejemplo n.º 4
0
            % (cfg.general.resDir, outDir, postfix, nSeeds, cfg.stat.chunkWidth),
            powerSample,
        )
        np.savetxt(
            "%s/%s/powerSampleSTD%s_nSeeds%d_chunk%dyr.txt"
            % (cfg.general.resDir, outDir, postfix, nSeeds, cfg.stat.chunkWidth),
            powerSampleSTD,
        )
        np.savetxt(
            "%s/%s/freq%s_nSeeds%d_chunk%dyr.txt" % (cfg.general.resDir, outDir, postfix, nSeeds, cfg.stat.chunkWidth),
            freq,
        )

        # Plot CORRSAMPLE
        print "Plotting correlation function..."
        (fig, ax) = ergoPlot.plotCCF(corrSample, lags, plotPositive=True)
        plt.savefig(
            "%s/%s/corrSample%s_nSeeds%d_lagMax%dyr.%s"
            % (cfg.general.plotDir, outDir, postfix, nSeeds, cfg.stat.lagMax, ergoPlot.figFormat),
            dpi=ergoPlot.dpi,
            bbox_inches=ergoPlot.bbox_inches,
        )

        # Plot powerSample
        print "Plotting powerSampledogram..."
        angFreq = freq * 2 * np.pi
        (fig, ax) = ergoPlot.plotPerio(
            powerSample,
            perioSTD=powerSampleSTD,
            freq=angFreq,
            plotPositive=True,