def __init__(self, year, timeframe): self.year = year self.timeframe = timeframe self.hedata = loadswicsiondata("He2+", 720., self.year, self.timeframe, "/data/etph/ace/") self.odata = loadswicsiondata("O6+", 720., self.year, self.timeframe, "/data/etph/ace/") self.hdata = swicsdcrtcr("H1+", self.year, self.timeframe, "/data/etph/ace/pui/12mdata/") self.swedata = swepamdata(64., self.year, self.timeframe, "/data/etph/ace/swepam/") self.swedata.sync_h(self.hedata) self.mag = magdata(1., self.year, self.timeframe, "/data/etph/ace/mag/") self.mag.sync_mag(self.hedata) self.theta = arccos(cos(self.mag.phi) * cos(self.mag.theta)) self.valf = 21.8 / sqrt(self.swedata.dens) * (self.mag.magb) self.valf[isinf(self.valf)] = -1. self.valf[isnan(self.valf)] = -2. self.effh = zeros([58]) self.effhe = zeros([58]) self.effo = zeros([58]) self.gp = Gnuplot() self.gp("set xr [-2:3]") self.gp("set yr [0:1]") self.gp("set xlabel '(v-v_{sw})/C_{A}'") self.stdhe = [] self.stdo = [] self.stdh = [] self.skewhe = [] self.skewo = [] self.skewh = [] self.kurthe = [] self.kurto = [] self.kurth = [] self.meanvhe = [] self.meanvo = [] self.meanvh = [] self.maxvhe = [] self.maxvo = [] self.maxvh = [] self.time = [] self.years = [] self.valfs = [] self.magb = [] self.thetas = [] self.sigtheta = [] self.vsw = [] self.dsw = [] self.tsw = [] self.load_eff()
def __init__(self, swicspath, swepampath, magpath, effpath, ionname, timeframe): self.swicspath = swicspath self.swepampath = swepampath self.magpath = magpath self.effpath = effpath self.ionname = ionname self.timeframe = timeframe self.swepamres = 720 self.magres = 240 self.year = 2007 swepam = swepamdata(720, 2007, timeframe[0][0], timeframe[len(timeframe) - 1][1] + 1., swepampath) swepam.load() mag = magdata(240, 2007, float(daylist[0]), float(daylist[len(daylist) - 1]), magpath) mag.load() att = attdata(mag.year, mag.path) att.load()
timeframequietplot = [[4., 9.], [17.4, 25.25], [30.5, 35.], [45.5, 55.], [60., 63.], [65.5, 70.], [73.25, 80.5], [93., 97.5], [103., 107.], [119., 126.5], [129., 131.], [134., 135.], [145.25, 151.1]] timeframequietplot = [[1., 360.]] he = swicsiondata("He2+", timeframequietplot, swicspath) he.load() h = swepamdata(720, 2001, 1., 362., swepampath) h.load() hsync = sync_h(h, he) """ hswics=swicsprotondata("H1+",timeframequietplot,ppath) hswics.load() """ mag = magdata(240, 2007, 1., 362., magpath) mag.load() magsync = sync_mag(mag, he) o = swicselemdata("O", timeframequietplot, swicspath) fe = swicselemdata("Fe", timeframequietplot, swicspath) o.load() fe.load() feoheh = [] feoheh2 = [] feoheh3 = [] feoheh4 = [] feoheh5 = [] gp = Gnuplot() hehmag = []
def load_mag(self): from libacepy.mag import magdata self.mag = magdata(self.magres, self.year, self.timeframe[0][0], self.timeframe[len(self.timeframe) - 1][1] + 1., self.magpath) self.mag.load()
bintime = 4 * 3600 year = 2007 timeframe = [mark - 4, mark + 4] #Multiplotklasse initialisieren mp = multiplot(6, 0) mp.setgv(0) mp.setxrange(timeframe[0], timeframe[1]) mpi = 0 #vertikale Marks setzen for i in range(len(marks)): mp.addplotmark("vline") mp.plotmarks[i].setvlinepos(marks[i]) # Anfang: Magdaten auswerten mdata = magdata(mres, year, timeframe[0], timeframe[1], "/data/ivar/ace/mag/") mdata.load() binres = bintime / mres mbin = [] for i in range(len(mdata.magbx)): # Anfang: Winkel ausrechnen if (mdata.magbx[i][1] < 0): phi = atan(-mdata.magby[i][1] / mdata.magbx[i][1]) elif (mdata.magbx[i][1] == 0): if (mdata.magby[i][1] > 0): phi = pi / 2 elif (mdata.magby[i][1] < 0): phi = -pi / 2 else: phi = 0 else:
timeframe = [[222, 223.]] timeframe = [[39., 40.]] timeframe = [[4., 5.]] timeframe = [[153., 155.]] timeframe = [[32., 34.]] #year=2008 #timeframe=[[20.,22.]] hdata = swicsdcrtcr("H1+", year, timeframe, "/data/etph/ace/pui/12mdata/") hedata = loadswicsiondata("He2+", 720., year, timeframe, "/data/etph/ace/") odata = loadswicsiondata("O6+", 720., year, timeframe, "/data/etph/ace/") fedata = loadswicsiondata("Fe9+", 720., year, timeframe, "/data/etph/ace/") sidata = loadswicsiondata("C6+", 720., year, timeframe, "/data/etph/ace/") cdata = loadswicsiondata("Fe8+", 720., year, timeframe, "/data/etph/ace/") swdata = swepamdata(64., year, timeframe, "/data/etph/ace/swepam/") magdat = magdata(1., year, timeframe, "/data/etph/ace/mag/") #magdat.sync_mag(hedata) #gp=Gnuplot() def get_tseries(iond): from numpy import where, mean timestep = 12. / 86400. # time of single esa-step d3iondata = [] d3ionv = [] for i in range(len(iond.time)): ionmax = amax(iond.countspec[i, :, 1]) vtime = 0. for j in range(58): #d3iondata.append([iond.time[i]-(58-j)*timestep,iond.countspec[i,j,0],iond.countspec[i,j,1]/ionmax])
corrarr2 = [] for year in years: print year for doy in range(start, doys[ycount] + 1): #for doy in range(start,stop+1):#doys[ycount]+1): try: listin = open(path + "%.4i/%.3i/list.in" % (year, doy), "r") hesum = 0. hesumeff = 0. hesumeff2 = 0. magsum = 0. magangsum = 0. magphisum = 0. magthetasum = 0. magdoy = magdata(1., year, [[doy, doy + 0.999999]], magpath) nr = 0. for s in listin: k = s.split() tmpdat, tmptime, tmpvsw = read_pui(path + "%.4i/%.3i/He1+_%s" % (year, doy, k[0])) v = tmpdat[:, 0] w = tmpdat[:, 1] dcr = tmpdat[:, 2] tcr = tmpdat[:, 3] mag = mean(magdoy.magb[(magdoy.time > tmptime) * (magdoy.time < tmptime + 12. / 1440.)]) magphi = mean( magdoy.phi[(magdoy.time > tmptime) * (magdoy.time < tmptime + 12. / 1440.)]) magtheta = mean(
dvvsvparr = [] ratioarr = [] for i in range(len(ionlist)): meandvvsvparr.append([0., 0., 0., 0.]) dvvsvparr.append([]) ratioarr.append([]) p = -1 magarr = [] alfarr = [] masscharge = [] for tf in timeframe: p += 1 hedata = swicsiondata("He2+", resswics, year, [tf], datapath) swepam = swepamdata(resswepam, year, [tf], swepampath) swepam.sync_h(hedata) mag = magdata(resmag, year, [tf], magpath) mag.sync_mag(hedata) ionnr = -1 for ion in ionlist: ionnr += 1 iondata = swicsiondata(ion[0], resswics, year, [tf], datapath) meandvvsvparr[ionnr][0] = iondata.mass / iondata.charge meandvvsvparr[ionnr][3] = iondata.mass / iondata.charge**2 if p == 0: masscharge.append([iondata.mass, iondata.charge, 0, 0]) for i in range(len(iondata.time)): if (swepam.dens[i] > 0.): valf = 21.8 * mag.magb[i] / sqrt(swepam.dens[i]) else: valf = 0.
#syncatt=sync_attitude(att,iondata) polarity = zeros([len(timeframe)]) uppervel = 700. lowervel = 600. linetype = 0 for ion in ionlist: iondata = swicsiondata(ion, resswics, year, timeframe, datapath) #if (ion!="He2+"): # hedata=swicsiondata("He2+",resswics,year,timeframe,datapath) #else: # hedata=iondata #iondata.load() swepam = swepamdata(resswepam, year, timeframe, swepampath) mag = magdata(resmag, year, timeframe, magpath) att = attdata(mag.year, mag.path) att.load() mag.sync_mag(iondata) swepam.sync_h(iondata) syncatt = sync_attitude(att, iondata) dblistin = open("sigb_2007.dat") dblistin.readline() sigarr = [] barr = [] i = 0 for s in dblistin: k = s.split() if (float(k[0]) > iondata.time[i] - 0.001
daylist=range(1,153) timeframe=[[4.,9.],[17.4,25.25],[30.5,35.],[45.5,55.],[60.,63.],[65.5,70.],[73.25,80.5],[93.,97.5],[103.,107.],[119.,126.5],[129.,135.],[145.25,151.1]] #timeframe=[[4.,9.]] effpath="/data/ivar/ace/efficencies/aspeff/" datapath="/data/wimmer/ace/12mdata/2007/" datapath2="/data/zechine/ace/12mprotons/2007/" swepampath="/data/ivar/ace/swepam/" magpath="/data/ivar/ace/mag/" #protondata=swicsprotondata("H1+",timeframe,datapath2) #protondata.load() ionlist=["He2+","C6+","C5+","N7+","N6+","O7+","O6+","Ne8+","Mg8+","Mg9+","Si8+","Si9+","S8+","S9+","Ca9+","Ca10+","Fe9+","Fe10+","Fe11+","Fe12+","Fe13+"] ionlist=["He2+"] swepam=swepamdata(720,2007,timeframe[0][0],timeframe[len(timeframe)-1][1]+1.,swepampath) swepam.load() mag=magdata(240,2007,float(daylist[0]),float(daylist[len(daylist)-1]),magpath) mag.load() att=attdata(mag.year,mag.path) att.load() pdvhist=[] pdvhist2=[] pdvmqhist=[] ptemphist=[] pdenshist=[] pvthhist=[] pvthhist2=[] swepamvel=[] swepamvthhist=[] gp=Gnuplot() gp2=Gnuplot()
from libacepy.mag import magdata from Gnuplot import Gnuplot, Data, GridData timeframe = [[25.25, 26.5]] #[15.,22.5]]#[6.25,12.2]] #timeframe=[[6.25,12.2],[15.,22.5],[25.25,26.5],[33.,37.8],[42.5,49.],[50.,53.5],[61.,64.],[69.5,77.5],[88.5,91.5],[97.75,105.75],[115.5,118.5],[126.,130.],[143.,147.5],[151.,155.],[168.,171.],[172.5,175.5],[179.,181.5],[194.5,200.5],[223.25,226.75],[232.,234.75],[248.5,253.5],[259.5,261.],[276.5,281.5],[286.,288.5],[303.5,308.75],[313.25,314.25],[331.,335.],[341.5,344.],[359.,361.5]] magpath = "/data/wimmer/ace/mag/" #mag=magdata(1.,2008,timeframe,magpath) binres = 64. thetaarr = [] phiarr = [] THETAarr = [] magbarr = [] phiser = [] for tf in timeframe: mag = magdata(1., 2008, [tf], magpath) for i in range(len(mag.time) / binres): tmpmag = 0. tmpmag2 = 0. tmpmagx = 0. tmpmagy = 0. tmpmagz = 0. tmpmagphi1 = 0. tmpmagphi2 = 0. tmpmagphi3 = 0. tmpmagtheta1 = 0. tmpmagtheta2 = 0. tmpmagtheta3 = 0. tmpmagTHETA1 = 0. tmpmagTHETA2 = 0. tmpmagTHETA3 = 0.