Exemplo n.º 1
0
def plotit(what):
    if what == "DHI":
        plotme = np.stack((Y_C, DHI), axis=1)
    else:
        plotme = np.stack((Y_C, D13C), axis=1)
    plotmeX, plotmeY = dropna(plotme, country_codes)
    plotmeX, plotmeY = drop_lowNs(plotmeX, plotmeY, threshold=5)
    category_frequencies(plotmeY)
    plot(plotmeX, plotmeY, axlabels=["Y", what])
Exemplo n.º 2
0
def split_by_CCode(param):
    bycat = split_by_categories(CCode)
    new = {}
    for cat in bycat:
        catargs = bycat[cat]
        fX, fCoord = dropna(param[catargs], Y_C[catargs])
        if not np.prod(fX.shape):
            continue
        new[cat] = [fX.mean(), fX.std(), fCoord.mean()]
    return new
Exemplo n.º 3
0
def assemble_X(pnm):
    param = globals()[pnm]
    fP, fX, fY, flabel = dropna(param, X_C, Y_C, CCode)
    split = split_by_categories(flabel, np.stack((fP, fX, fY), axis=1))
    data = ["\t".join(("GEO", pnm, "X", "Y"))]
    for label, array in split.items():
        if len(array) > 0:
            mean = array.mean(axis=0)
        else:
            mean = array.mean(axis=0)
        data.append("\t".join([label] + mean.astype(str).tolist()))
    with open(projectroot + pnm + "_MEANS.csv", "w") as handle:
        handle.write("\n".join(data).replace(".", ","))
    print(pnm, "assembled!")
Exemplo n.º 4
0
import numpy as np

from csxdata.stats.inspection import category_frequencies
from csxdata.utilities.highlevel import plot
from csxdata.utilities.parser import parse_csv
from csxdata.utilities.vectorop import drop_lowNs, dropna

from SciProjects.sophie import projectroot

X, Y, head = parse_csv(projectroot + "01GEO.csv",
                       indeps=4, headers=1, decimal=True)

y_coord = Y[:, -1].astype(float)
categ = Y[:, 0]
DHI, D13C = X.T
plotme = np.stack((DHI, D13C, y_coord), axis=1)
plotme, categ = dropna(plotme, categ)
category_frequencies(categ)
plot(plotme, axlabels=["DHI", "D13C", "Y"])
Exemplo n.º 5
0
def correlate(pnm):
    param = globals()[pnm]
    X, Y = dropna(param, Y_C)
    return stats.spearmanr(X, Y)
Exemplo n.º 6
0
from SciProjects.sophie import projectroot

from csxdata.utilities.parser import parse_csv
from csxdata.utilities.vectorop import dropna
from csxdata.stats.inspection import category_frequencies, correlation
from csxdata.stats.normaltest import full

X, Y, head = parse_csv(projectroot + "01GEO.csv",
                       indeps=2,
                       headers=1,
                       decimal=True)

category_frequencies(Y)
X, Y = dropna(X, Y)
correlation(X, ["X", "Y", "DH1", "DH2"])
full(X)
Exemplo n.º 7
0
def plotit3d():
    plotme = np.stack((Y_C, DHI, D13C), axis=1)
    plotmeX, plotmeY = dropna(plotme, country_codes)
    category_frequencies(plotmeY)
    plot(plotmeX, plotmeY, axlabels=["Y", "DHI", "D13C"])
Exemplo n.º 8
0
from matplotlib import pyplot as plt

from csxdata.utilities.parser import parse_csv
from csxdata.utilities.vectorop import dropna
from csxdata.utilities.highlevel import plot

from SciProjects.sophie import projectroot

X, Y, head = parse_csv(projectroot + "01GEO.csv",
                       indeps=4,
                       headers=1,
                       decimal=True)

y_coord = Y[:, -1].astype(float)
countries = Y[:, 0]
DHI, D13C = X.T

plot(np.stack((y_coord, DHI), axis=1), countries, axlabels=["Y", "DHI"])
plotme, c2 = dropna(np.stack((y_coord, D13C), axis=1), countries)
plot(plotme, c2, ["Y", "D13C"])

fig, axarr = plt.subplots(2)
axarr[0].scatter(y_coord, DHI, color="red", marker=".")
axarr[0].set_xlabel(r"$(D/H)_I$")
axarr[1].scatter(y_coord, D13C, color="red", marker=".")
axarr[1].set_xlabel(r"$\delta^13C$")
axarr[0].set_ylabel("Y")
axarr[1].set_ylabel("Y")
plt.tight_layout()
plt.show()
Exemplo n.º 9
0
import numpy as np
from scipy import stats
from matplotlib import pyplot as plt

from csxdata.visual import Plotter2D
from csxdata.utilities.vectorop import dropna
from csxdata.stats.inspection import category_frequencies

from SciProjects.sophie import pull_data, axtitles

X_C, Y_C, DHI, D13C, CCode = pull_data("04GEO_eu.csv")

DHI, Y_C, CCode = dropna(DHI, Y_C, CCode)
category_frequencies(CCode)
R, p = stats.spearmanr(DHI, Y_C)

line = np.polyfit(Y_C, DHI, 1)
line = np.poly1d(line)

ttl = (
    "Korreláció $(D/H)_I$ és az egyenlítőtől való távolság között Európában",
    f"Spearman-korreláció: R = {R:.2f}, p = {p:.2f}, {('nem' if p > 0.05 else '')}szignifikáns"
)
axttl = ["Egyenlítőtől való távolság", axtitles["DHI"]]

plotter = Plotter2D(plt.figure(),
                    np.stack((Y_C, DHI), axis=1),
                    CCode,
                    title="\n".join(ttl),
                    axlabels=axttl)
plotter.split_scatter(center=True, sigma=2, alpha=0.5)