elscntplot.pro
4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
;==========================================================
; DD DDMARS/DDVEX
; elscntplot.pro
;
;-----------------------------------------------------------
pro elscntplot, Mission, anodStart, anodStop, enMin, enMax
common VexELS, VexELS, VexElsPlus
common MexELS, MexELS, MexElsPlus
common GraphC, Graph,GraphN, Item
common request, List, StartTime, TimeInt
cmd = 'ElsPlus = ' + Mission + 'ElsPlus'
R = execute(cmd);
; Expand DeltaT a little : Get Energy Calibration
StD = call_external(!DDLIB+'DD_idl.so','GetDTime', StartTime, /D_VALUE)
DtD = call_external(!DDLIB+'DD_idl.so','GetDTime', TimeInt, /D_VALUE)
StD = StD - 100.0D0
DtD = DtD + 200.0D0
stloc = call_external(!DDLIB+'DD_idl.so','GetTime',StD, /S_VALUE)
dtloc = call_external(!DDLIB+'DD_idl.so','GetTime',DtD, /S_VALUE)
Size = Long(DtD/4. + 2)
Nen = 128;
Energy = fltarr(Nen, Size)
Tm = dblarr(Size)
ID = -1L;
err = call_external(!PROJLIB + 'libplanetcom.so','SetMission_idl', Mission);
RetSize = call_external(!PROJLIB + 'els_idl.so','GetRef', $
ID, $
stloc, $
dtloc, $
Size, $
Tm, $
Energy)
if (err GE 0) then Tm -= Graph[GraphN].TimeBase
err = call_external(!DDLIB +'DD_idl.so','CloseID',ID)
; data
Time = (*Graph[GraphN].Time[0]);
N_Time = N_elements(Time);
Val = (*Graph[GraphN].Val[0]);
Val = temporary(reform(Val, 16, Nen, N_Time));
num = where(abs(Tm - Time[N_Time/2]) EQ min(abs(Tm - Time[N_Time/2])));
E = Energy[*,num[0]]*ElsPlus.Sens[7];
if ((enmin eq enmax) and (enmin eq 0)) then begin
enmax = E[0];
enmin = E[126];
endif
Data = anodStop GT anodStart ? total(Val[anodStart:anodStop,*,*],1) : reform(Val[anodStart,*,*], 128, N_Time);
; if reduced Energy Table
reducedEnergy = E[0] LT 1000.0 ? 1 : 0;
; if reduced Energy Table expand time
if (reducedEnergy) then begin
Nen = 32;
enMax = enMax < 158.0;
newTime = dblarr(N_Time*4);
for i = 0, N_Time-1 do for j = 0, 3 do newTime[i*4+j] = Time[i] + double(j);
Time = newTime;
Data = reform(Data, Nen, N_Time*4);
N_Time *= 4;
E = E(0:Nen-1);
endif
E[Nen-1] = E[Nen-2];
EBounds = fltarr(Nen+1);
EBounds[0] = E[0];
EBounds[Nen] = E[Nen-1];
for ie = 1, Nen-1 do EBounds(ie) = sqrt(E(ie-1)*E(ie));
num0 = where(EBounds ge enMin, Index0);
num1 = where(EBounds ge enMax, Index1);
if (Index1 eq Nen+1) then begin
nodatafortimeinterval
return
endif
if (Index1 eq 0) then numStop = 0 else numStop = num1[Index1-1];
if (Index0 eq Nen+1) then numStart = 31 else numStart = num0[Index0-1];
Data = numStart ne numStop ? total(Data[numStop:numStart,*],1) : reform(Data[numStart,*], N_Time);
; Data = IndexE gt 1 ? total(Data[numE,*],1) : reform(Data[numE[0],*], N_Time);
; if (avEnergy) then Data /= IndexE;
; if (avAngle) then Data /= (anodStop-anodStart+1);
numMinMax = where(finite(Data), IndexMinMax)
;--------------------- No DATA - just axes -----------------------
if (IndexMinMax LE 0) then begin
nodatafortimeinterval
return
endif
if (Time[0] GT Graph[GraphN].TotalTime) then begin
nodatafortimeinterval
return
endif
;-------------------------------------------------------------------
;TODO test mode if E(1) EQ E(126) then begin ; The test mode, just plot everything???
MinVal = min(Data[numMinMax]);
MaxVal = max(Data[numMinMax]);
if Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1] then begin
Graph[GraphN].Ly.range = Graph[GraphN].AxisF eq 'logaxis' ? [MinVal, MaxVal] : [0.0, MaxVal]
Graph[GraphN].Ly.style = 0
endif else Graph[GraphN].Ly.style = 1
!y = Graph[GraphN].Ly;
if (execute(Graph[GraphN].AxisF) NE 1) then plot, Time, Data, MAX_VALUE=MaxValue, color = !dnc-1, /NODATA, /NOERASE
oplot, Time, Data, MAX_VALUE=MaxValue, color = !dnc-1
return
end
;--------------------------------------------------------------------