while((len(thislin)<maxline) and len(pieces)>0):
                thislin += ','+pieces.pop(0)
            suptitl += thislin + '\n'

    pl.figure(num='cl[{cl}] delta phase'.format(cl=cl))
    if clearfigs: pl.clf()
    for (i,ph) in enumerate(decimate(ph5,limit=1000)): pl.plot(ph[sel],'k',linewidth=.03,hold=i>0)
    for (i,ph) in enumerate(decimate(ph5[wc],limit=1000)): pl.plot(ph[sel],'g',linewidth=.01,hold=i>-1)
    if len(wcc)>0: 
        for (i,ph) in enumerate(decimate(ph5[wcc],limit=1000)): pl.plot(ph[sel],'r',linewidth=.01,hold=i>-1)
    if show_cc: pl.plot(subset[clinds[cl][0]],'y',linewidth=2,label='cluster ')
    # averaging will mess up if two pi jumps happen - average relative 
    # to assumed cluster centre and then shift back by that amount
    data_cent = (subset[clinds[cl][0]] 
                 + np.average(modtwopi(ph5[:,sel]-
                                       subset[clinds[cl][0]], 
                                       offset=0) ,0))
    if show_dc: pl.plot(data_cent,'--c',linewidth=2, label='data_centroid')
    cc5.append(np.average(ph5[:,sel],0))
    pl.legend()
    pl.title(titl)
    pl.suptitle(suptitl)
    pl.xlabel(xlab)
    pl.show(block=0)
    report_mem(start_mem)
    pl.figure(num='cl[{cl}] freq-time'.format(cl=cl))
    if clearfigs: pl.clf()
    if alpha < 0:
        alpha_ = (1.*len(w5))**(alpha)  # -0.25 10,000pts -> alpha_=.1
    else:
        alpha_ = alpha
Пример #2
0
data=dev.acq.getdata(27233,diag_name)
#data.plot_signals()
# extract the phi DIrectly from the cfg file
Phi = np.array([2*np.pi/360*float(pyfusion.config.get
                                  ('Diagnostic:{cn}'.
                                   format(cn=c.name), 
                                   'Coords_reduced')
                                  .split(',')[0]) 
                for c in data.channels])

pl.subplot(121)
pl.plot(Phi, linestyle='steps')
Phi_circ = fix2pi_skips(np.append(Phi, Phi[0]), around=0)
dp = np.diff(Phi_circ)
pl.plot(dp, linestyle='steps')
pl.figure()
pl.subplot(122)
phases = []
for N in range(-5, 5):
    ph = modtwopi(N*dp, offset=0)
    phases.append(ph)
    pl.plot(phases[-1], label='N={N}'.format(N=N))
pl.legend()
pl.show(block=0)

# fake up a clusters file
clinds = [[c] for c in np.arange(len(phases))]
subset = phases
subset_counts = np.ones(len(phases))
np.savez_compressed('ideal_toroidal_modes', clinds=clinds, subset=subset, subset_counts=subset_counts, dphase=-1, sel=np.arange(10, 16))
Пример #3
0
            while((len(thislin)<maxline) and len(pieces)>0):
                thislin += ','+pieces.pop(0)
            suptitl += thislin + '\n'

    pl.figure(num='cl[{cl}] delta phase'.format(cl=cl))
    if clearfigs: pl.clf()
    for (i,ph) in enumerate(decimate(ph5,limit=1000)): pl.plot(ph[sel],'k',linewidth=.03,hold=i>0)
    for (i,ph) in enumerate(decimate(ph5[wc],limit=1000)): pl.plot(ph[sel],'g',linewidth=.01,hold=i>-1)
    if len(wcc)>0: 
        for (i,ph) in enumerate(decimate(ph5[wcc],limit=1000)): pl.plot(ph[sel],'r',linewidth=.01,hold=i>-1)
    if show_cc: pl.plot(subset[clinds[cl][0]],'y',linewidth=2,label='cluster ')
    # averaging will mess up if two pi jumps happen - average relative 
    # to assumed cluster centre and then shift back by that amount
    data_cent = (subset[clinds[cl][0]] 
                 + np.average(modtwopi(ph5[:,sel]-
                                       subset[clinds[cl][0]], 
                                       offset=0) ,0))
    if show_dc: pl.plot(data_cent,'--c',linewidth=2, label='data_centroid')
    cc5.append(np.average(ph5[:,sel],0))
    pl.legend()
    pl.title(titl)
    pl.suptitle(suptitl)
    pl.xlabel(xlab)
    pl.show(block=0)
    report_mem(start_mem)
    pl.figure(num='cl[{cl}] freq-time'.format(cl=cl))
    if clearfigs: pl.clf()
    if alpha < 0:
        alpha_ = (1.*len(w5))**(alpha)  # -0.25 10,000pts -> alpha_=.1
    else:
        alpha_ = alpha