Exemplo n.º 1
0
def kde_multiplot(datlist,order=None):
    cols = 3
    rows = int(np.ceil(len(datlist)/cols))
    fig,ax = pl.subplots(rows,cols)
    if order is None:
        order = range(0,len(datlist))
    for el in list(order):       
        fig.axes[el] = vis.kde(datlist[el],fig.axes[el])
    return fig
Exemplo n.º 2
0
import matplotlib.pyplot as pl
import visualize as vis
import pickle as pic    
import numpy as np

regnames = ["5053","5215","5654","6405","6449"]


fg,ax = pl.subplots(1)

for i,regname in enumerate(regnames):
    dat = np.load("bin/{}_{}.npz".format(regname,"qu1"))
    lines = pic.load(open("bin/{}_{}.lin".format(regname,"qu1"),"rb"))  
    sel = lines[ np.array([lin.dept for lin in lines]).argmin() ]
    sel = "{}_{:4.0f}".format(sel.name.split()[0],int(sel.cent*10))
    vis.kde(dat[sel][:,10],axis=ax)
    ax.lines[-1].set_label(sel)


pl.legend(loc="best")
pl.show()
Exemplo n.º 3
0
as2flat = list(range(197,229))+list(range(404,423))+list(range(972,995))
as2 = sf64_as2.make_spectra()
cont_as2 = as2[:,as2flat].mean(axis=1)

if False:
    pl.plot(as1.lmbd,as1[:,:].mean(axis=0),label="Quiet Sun, series a")
    pl.plot(bs1.lmbd,bs1[:,:].mean(axis=0),label="Quiet Sun, series b")
    pl.plot(as2.lmbd,as2[:,:].mean(axis=0),label="Sun spot")
    pl.xlabel("Wavelength [nm]")
    pl.ylabel("Relative intensity")
    pl.legend(loc="lower left")
    pl.show()

if False:
    ax = pl.subplot(111)
    ax = vis.kde(cont_as1,ax)
    ax = vis.kde(cont_bs1,ax)
    ax = vis.kde(cont_as2,ax)
    ax.lines[0].set_label("Quiet Sun, series a")
    ax.lines[1].set_label("Quiet Sun, series b")
    ax.lines[2].set_label("Sun spot")
    ax.legend(loc="upper left")
    ax.set_xlabel("Continuum value")
    ax.set_ylabel("Number of spectra")
    ax.set_title("Distribution of continuum value")
    ax.figure.show()

def selected(cont,spec):
    mnspec = spec[:,:].mean(axis=0)
    pl.plot(spec.lmbd,mnspec)
    pl.plot(cont.lmbd,mnspec[cont.idx],'ro')