-
Notifications
You must be signed in to change notification settings - Fork 3
/
Skywave_Amplitude_Normalized.py
548 lines (495 loc) · 22 KB
/
Skywave_Amplitude_Normalized.py
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 14:56:12 2015
@author: lenz
This code plots the skywaves associated with the biggest currents for 6
events with the peak of the ground waves set to t=0. If adjust_peaks_in_time
is set to 0, the GWs are aligned in time t=0 for when the e-field raises above
4 sigma of the noise window
[10:-10] is added when plotting to avoid showing the overshoot at the ends of
the waveforms causeed by the moving average filter
"""
from Skywaves_plot_with_IRIG_LPF import Skywave
import matplotlib.pyplot as plt
import numpy as np
import lecroy as lc
import matplotlib
matplotlib.rcParams.update({'font.size': 16})
plt.figure(figsize=(15.8,10.9))
fs=10e6
date=82715
calfactor=19900.50 #for plotting current
x_min=0*1e6
x_max=0.00050*1e6
yoffset=0.2
distance=208.9 #kilometers
dt_70km=(2*np.sqrt(70*70+(distance/2)*(distance/2))-distance)/2.99e5 #time delay of the first skywave for ionospheric reflection height=70km
dt_80km=(2*np.sqrt(80*80+(distance/2)*(distance/2))-distance)/2.99e5 #time delay of the first skywave for ionospheric reflection height=80km
dt_90km=(2*np.sqrt(90*90+(distance/2)*(distance/2))-distance)/2.99e5 #time delay of the first skywave for ionospheric reflection height=90km
print("70km = %5.2f, 80 km = %5.2f, 90 km = %5.2f (in microseconds)"%(dt_70km*1e6,dt_80km*1e6,dt_90km*1e6))
# Remove 60 Hz slope ##
def remove_60Hz_slope(moving_avg,yoffset):
x0=moving_avg[0][10]
x1=moving_avg[0][500e-6*fs -10] #500 us = 5000 samples at 10MHz fs
y0=moving_avg[1][10]
y1=moving_avg[1][500e-6*fs -10]
m=(y1-y0)/(x1-x0)
# m=m/moving_avg[8] #account for GW amplitude normalization
b=-m*x0*y0
slope=m*moving_avg[0][10:-10]+b #y=mx+b
modified_yoffset=yoffset+slope
return modified_yoffset
def process_and_plot(moving_avg):
waveform=moving_avg[1][10:4990] #500 us of e-field data
raw_waveform=moving_avg[10][10:4990] #500 us of e-field data
first_time=moving_avg[0][10]*1e6 #first sample of the waveform above
yoffset=np.mean(waveform[0:800]) #find the DC offset during noise window
modified_yoffset=remove_60Hz_slope(moving_avg, yoffset) #remove 60Hz slope
t_peak=(np.argmax(waveform-modified_yoffset[10:4990]))*(1/fs)*1e6 #find GW peak
raw_t_peak=(np.argmax(raw_waveform-modified_yoffset[10:4990]))*(1/fs)*1e6 #find GW peak
t_start=moving_avg[5]*1e6 #This sets GW to t=0 based on 4 sigma from noise
adjust_peaks_in_time=t_peak-t_start+first_time #This sets GW to t=0 by alligning GW peaks
raw_adjust_peaks_in_time=raw_t_peak-t_start+first_time #This sets GW to t=0 by alligning GW peaks
time_list=moving_avg[0][10:4990]*1e6-t_start-adjust_peaks_in_time
data_list=waveform-modified_yoffset[10:4990]
raw_data_list=raw_waveform-modified_yoffset[10:4990]
raw_time_list=moving_avg[0][10:4990]*1e6-t_start-raw_adjust_peaks_in_time
return time_list, data_list, t_start, raw_time_list, raw_data_list
#UF 15-40, RS#3
moving_avg_gw=Skywave(40,3,20.767465080,10,x_max,10)
moving_avg_ir=Skywave(40,3,20.767465080,10,x_max,50)
def apply_two_filters(moving_avg_gw,moving_avg_ir):
#The code plots Fig. 1 of the Paper
time, data, t_start,raw_time_list,raw_data_list = process_and_plot(moving_avg_gw)
time2, data2, t_start2,raw_time_list2,raw_data_list2 = process_and_plot(moving_avg_ir)
time_gw=time[:2380]
data_gw=data[:2380]
time_ir=time2[2370:]
data_ir=data2[2370:]
return time_gw, data_gw, time_ir, data_ir, raw_time_list, raw_data_list, t_start
##!!!!!!Plot Fig.1!!!!!!!
#temp=apply_two_filters(moving_avg_gw,moving_avg_ir)
#time_gw=temp[0]
#data_gw=temp[1]
#time_ir=temp[2]
#data_ir=temp[3]
#raw_time_list=temp[4]
#raw_data_list=temp[5]
#
#plt.subplot(211)
#plt.plot(raw_time_list,raw_data_list,linewidth=2.0,color=[1,0,0],label="Raw UF 15-40, RS#3")
#plt.plot(time_gw,data_gw,linewidth=2.0,color=[0,0,1],label="Filtered UF 15-40, RS#3") #moving averaged skywave
#plt.plot(time_ir, data_ir,linewidth=2.0,color=[0,0,1]) #moving averaged skywave
#
#plt.plot([0,0],[-1,1.5],'--',linewidth=2.0) #time when skywave raises 3 std dev from mean noise
#plt.plot([(dt_70km)*1e6,(dt_70km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 70 km h iono
#plt.plot([(dt_80km)*1e6,(dt_80km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 80 km h iono
#plt.plot([(dt_90km)*1e6,(dt_90km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 90 km h iono
#plt.xlabel(moving_avg_gw[2])
#plt.legend()
#plt.grid()
#
#plt.subplot(223)
#plt.plot(raw_time_list,raw_data_list,linewidth=2.0,color=[1,0,0],label="Raw UF 15-40, RS#3")
#plt.plot(time_gw,data_gw,linewidth=2.0,color=[0,0,1],label="Filtered UF 15-40, RS#3") #moving averaged skywave
#plt.plot([0,0],[-1,1.5],'--',linewidth=2.0) #time when skywave raises 3 std dev from mean noise
#plt.legend()
#plt.grid()
#plt.xlim(-10,40)
##plt.ylim(0,1.1)
#
#plt.subplot(224)
#plt.plot(raw_time_list,raw_data_list,linewidth=2.0,color=[1,0,0],label="Raw UF 15-40, RS#3")
#plt.plot(time_ir,data_ir,linewidth=2.0,color=[0,0,1],label="Filtered UF 15-40, RS#3") #moving averaged skywave
#plt.plot([0,0],[-1,1.5],'--',linewidth=2.0) #time when skywave raises 3 std dev from mean noise
#plt.plot([(dt_70km)*1e6,(dt_70km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 70 km h iono
#plt.plot([(dt_80km)*1e6,(dt_80km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 80 km h iono
#plt.plot([(dt_90km)*1e6,(dt_90km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 90 km h iono
#plt.legend()
#plt.xlim(180,240)
#plt.ylim(-0.12,0.28)
#plt.grid()
#
#plt.show()
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#!!!!!!!!!!!!!!!!!!Plot Fig.2!!!!!!!!!!!!!!!!!!!!!!!!!!
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#UF 15-38, RS#1
#Plot channel-base current
suffix26=0
seg=0
lecroy_fileName_IIHI = "/Volumes/2015 Data/0"+str(date)+"/Scope26/C1AC0000"+ \
str(suffix26)+".trc"
lecroy_IIHI = lc.lecroy_data(lecroy_fileName_IIHI)
IIHI_time = lecroy_IIHI.get_seg_time()
IIHI = lecroy_IIHI.get_segments()
plt.subplot(321)
plt.plot((IIHI_time-2.4e-3)*1e6,IIHI[seg]*calfactor/1000,color=[0.3, 0.3, 0.3],linewidth=2)
plt.xlabel("Time ($\mu$s)")
plt.ylabel("Channel-base Current (kA)")
plt.xlim(0,500)
plt.ylim(-1,16.1)
plt.grid()
plt.title("UF 15-38, RS#1, Peak Current = 15.1 kA")
#Plot DBY Data
moving_avg_gw=Skywave(38,1,26.522908895,8,x_max,10)
moving_avg_ir=Skywave(38,1,26.522908895,8,x_max,50)
temp=apply_two_filters(moving_avg_gw,moving_avg_ir)
time_gw=temp[0]
data_gw=temp[1]
time_ir=temp[2]
data_ir=temp[3]
raw_time_list=temp[4]
raw_data_list=temp[5]
t_start=temp[6]
plt.subplot(322)
plt.plot(time_gw,data_gw/np.max(data_gw),linewidth=2.0,color=[1/6,1,1],label="UF 15-38, RS#1") #moving averaged skywave
plt.plot(time_ir, data_ir/np.max(data_gw),linewidth=2.0,color=[1/6,1,1]) #moving averaged skywave
plt.plot([0,0],[-1,1.5],'--',linewidth=2.0) #time when skywave raises 3 std dev from mean noise
plt.plot([(dt_70km)*1e6,(dt_70km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 70 km h iono
plt.plot([(dt_80km)*1e6,(dt_80km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 80 km h iono
plt.plot([(dt_90km)*1e6,(dt_90km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 90 km h iono
plt.title("Event UF 15-38, 1st Return Stroke")
plt.xlabel("UTC time in $\mu$s after %s"%moving_avg_gw[2])
plt.ylabel("Amplitude normalized E-field (arb. units) \n measured 209 km SE of ICLRT")
plt.grid()
plt.xlim(x_min-t_start,x_max-t_start)
plt.ylim(-.2,1.1)
#UF 15-39, RS#1
#Plot channel-base current
suffix26=1
seg=0
lecroy_fileName_IIHI = "/Volumes/2015 Data/0"+str(date)+"/Scope26/C1AC0000"+ \
str(suffix26)+".trc"
lecroy_IIHI = lc.lecroy_data(lecroy_fileName_IIHI)
IIHI_time = lecroy_IIHI.get_seg_time()
IIHI = lecroy_IIHI.get_segments()
plt.subplot(323)
plt.plot((IIHI_time-2.4e-3)*1e6,IIHI[seg]*calfactor/1000,color=[0.3, 0.3, 0.3],linewidth=2)
plt.xlabel("Time ($\mu$s)")
plt.ylabel("Channel-base Current (kA)")
plt.xlim(0,500)
plt.ylim(-1,5.4)
plt.grid()
plt.title("UF 15-39, RS#1, Peak Current = 4.4 kA")
#Plot DBY Data
moving_avg_gw=Skywave(39,1,66.583436840,9,x_max,10)
moving_avg_ir=Skywave(39,1,66.583436840,9,x_max,50)
temp=apply_two_filters(moving_avg_gw,moving_avg_ir)
time_gw=temp[0]
data_gw=temp[1]
time_ir=temp[2]
data_ir=temp[3]
raw_time_list=temp[4]
raw_data_list=temp[5]
t_start=temp[6]
plt.subplot(324)
plt.plot(time_gw,data_gw/np.max(data_gw),linewidth=2.0,color=[2/6,5/6,1],label="UF 15-39, RS#1") #moving averaged skywave
plt.plot(time_ir, data_ir/np.max(data_gw),linewidth=2.0,color=[2/6,5/6,1]) #moving averaged skywave
plt.plot([0,0],[-1,1.5],'--',linewidth=2.0) #time when skywave raises 3 std dev from mean noise
plt.plot([(dt_70km)*1e6,(dt_70km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 70 km h iono
plt.plot([(dt_80km)*1e6,(dt_80km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 80 km h iono
plt.plot([(dt_90km)*1e6,(dt_90km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 90 km h iono
plt.title("Event UF 15-39, 1st Return Stroke")
plt.xlabel("UTC time in $\mu$s after %s"%moving_avg_gw[2])
plt.ylabel("Amplitude normalized E-field (arb. units) \n measured 209 km SE of ICLRT")
plt.grid()
plt.xlim(x_min-t_start,x_max-t_start)
plt.ylim(-.2,1.1)
#UF 15-40, RS#3
#Plot channel-base current
suffix26=2
seg=1
lecroy_fileName_IIHI = "/Volumes/2015 Data/0"+str(date)+"/Scope26/C1AC0000"+ \
str(suffix26)+".trc"
lecroy_IIHI = lc.lecroy_data(lecroy_fileName_IIHI)
IIHI_time = lecroy_IIHI.get_seg_time()
IIHI = lecroy_IIHI.get_segments()
plt.subplot(325)
plt.plot((IIHI_time-2.4e-3)*1e6,IIHI[seg]*calfactor/1000,color=[0.3, 0.3, 0.3],linewidth=2)
plt.xlabel("Time ($\mu$s)")
plt.ylabel("Channel-base Current (kA)")
plt.xlim(0,500)
plt.ylim(-1,20.1)
plt.grid()
plt.title("UF 15-40, RS#3, Peak Current = 19.1 kA")
#Plot DBY Data
moving_avg_gw=Skywave(40,3,20.767465080,10,x_max,10)
moving_avg_ir=Skywave(40,3,20.767465080,10,x_max,50)
temp=apply_two_filters(moving_avg_gw,moving_avg_ir)
time_gw=temp[0]
data_gw=temp[1]
time_ir=temp[2]
data_ir=temp[3]
raw_time_list=temp[4]
raw_data_list=temp[5]
t_start=temp[6]
plt.subplot(326)
plt.plot(time_gw,data_gw/np.max(data_gw),linewidth=2.0,color=[3/6,4/6,1],label="UF 15-40, RS#3") #moving averaged skywave
plt.plot(time_ir, data_ir/np.max(data_gw),linewidth=2.0,color=[3/6,4/6,1]) #moving averaged skywave
plt.plot([0,0],[-1,1.5],'--',linewidth=2.0) #time when skywave raises 3 std dev from mean noise
plt.plot([(dt_70km)*1e6,(dt_70km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 70 km h iono
plt.plot([(dt_80km)*1e6,(dt_80km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 80 km h iono
plt.plot([(dt_90km)*1e6,(dt_90km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 90 km h iono
plt.title("Event UF 15-40, 3rd Return Stroke")
plt.xlabel("UTC time in $\mu$s after %s"%moving_avg_gw[2])
plt.ylabel("Amplitude normalized E-field (arb. units) \n measured 209 km SE of ICLRT")
plt.grid()
plt.xlim(x_min-t_start,x_max-t_start)
plt.ylim(-.2,1.1)
plt.show()
#UF 15-41, RS#1
#Plot channel-base current
suffix26=3
seg=0
lecroy_fileName_IIHI = "/Volumes/2015 Data/0"+str(date)+"/Scope26/C1AC0000"+ \
str(suffix26)+".trc"
lecroy_IIHI = lc.lecroy_data(lecroy_fileName_IIHI)
IIHI_time = lecroy_IIHI.get_seg_time()
IIHI = lecroy_IIHI.get_segments()
plt.subplot(321)
plt.plot((IIHI_time-2.4e-3)*1e6,IIHI[seg]*calfactor/1000,color=[0.3, 0.3, 0.3],linewidth=2)
plt.xlabel("Time ($\mu$s)")
plt.ylabel("Channel-base Current (kA)")
plt.xlim(0,500)
plt.ylim(-1,14.7)
plt.grid()
plt.title("UF 15-41, RS#1, Peak Current = 13.7 kA")
#Plot DBY Data
moving_avg_gw=Skywave(41,1,57.298446790,11,x_max,10)
moving_avg_ir=Skywave(41,1,57.298446790,11,x_max,50)
temp=apply_two_filters(moving_avg_gw,moving_avg_ir)
time_gw=temp[0]
data_gw=temp[1]
time_ir=temp[2]
data_ir=temp[3]
raw_time_list=temp[4]
raw_data_list=temp[5]
t_start=temp[6]
plt.subplot(322)
plt.plot(time_gw,data_gw/np.max(data_gw),linewidth=2.0,color=[4/6,3/6,1],label="UF 15-41, RS#1") #moving averaged skywave
plt.plot(time_ir, data_ir/np.max(data_gw),linewidth=2.0,color=[4/6,3/6,1]) #moving averaged skywave
plt.plot([0,0],[-1,1.5],'--',linewidth=2.0) #time when skywave raises 3 std dev from mean noise
plt.plot([(dt_70km)*1e6,(dt_70km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 70 km h iono
plt.plot([(dt_80km)*1e6,(dt_80km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 80 km h iono
plt.plot([(dt_90km)*1e6,(dt_90km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 90 km h iono
plt.title("Event UF 15-41, 1st Return Stroke")
plt.xlabel("UTC time in $\mu$s after %s"%moving_avg_gw[2])
plt.ylabel("Amplitude normalized E-field (arb. units) \n measured 209 km SE of ICLRT")
plt.grid()
plt.xlim(x_min-t_start,x_max-t_start)
plt.ylim(-.2,1.1)
#UF 15-42, RS#4
#Plot channel-base current
suffix26=4
seg=2
lecroy_fileName_IIHI = "/Volumes/2015 Data/0"+str(date)+"/Scope26/C1AC0000"+ \
str(suffix26)+".trc"
lecroy_IIHI = lc.lecroy_data(lecroy_fileName_IIHI)
IIHI_time = lecroy_IIHI.get_seg_time()
IIHI = lecroy_IIHI.get_segments()
plt.subplot(323)
plt.plot((IIHI_time-2.4e-3)*1e6,IIHI[seg]*calfactor/1000,color=[0.3, 0.3, 0.3],linewidth=2)
plt.xlabel("Time ($\mu$s)")
plt.ylabel("Channel-base Current (kA)")
plt.xlim(0,500)
plt.ylim(-1,23.5)
plt.grid()
plt.title("UF 15-42, RS#4, Peak Current = 22.5 kA")
#Plot DBY Data
moving_avg_gw=Skywave(42,4,43.058185590,12,x_max,10)
moving_avg_ir=Skywave(42,4,43.058185590,12,x_max,50)
temp=apply_two_filters(moving_avg_gw,moving_avg_ir)
time_gw=temp[0]
data_gw=temp[1]
time_ir=temp[2]
data_ir=temp[3]
raw_time_list=temp[4]
raw_data_list=temp[5]
t_start=temp[6]
plt.subplot(324)
plt.plot(time_gw,data_gw/np.max(data_gw),linewidth=2.0,color=[5/6,2/6,1],label="UF 15-42, RS#4") #moving averaged skywave
plt.plot(time_ir, data_ir/np.max(data_gw),linewidth=2.0,color=[5/6,2/6,1]) #moving averaged skywave
plt.plot([0,0],[-1,1.5],'--',linewidth=2.0) #time when skywave raises 3 std dev from mean noise
plt.plot([(dt_70km)*1e6,(dt_70km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 70 km h iono
plt.plot([(dt_80km)*1e6,(dt_80km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 80 km h iono
plt.plot([(dt_90km)*1e6,(dt_90km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 90 km h iono
plt.title("Event UF 15-42, 4th Return Stroke")
plt.xlabel("UTC time in $\mu$s after %s"%moving_avg_gw[2])
plt.ylabel("Amplitude normalized E-field (arb. units) \n measured 209 km SE of ICLRT")
plt.grid()
plt.xlim(x_min-t_start,x_max-t_start)
plt.ylim(-.2,1.1)
#UF 15-43, RS#4
#Plot channel-base current
suffix26=5
seg=3
lecroy_fileName_IIHI = "/Volumes/2015 Data/0"+str(date)+"/Scope26/C1AC0000"+ \
str(suffix26)+".trc"
lecroy_IIHI = lc.lecroy_data(lecroy_fileName_IIHI)
IIHI_time = lecroy_IIHI.get_seg_time()
IIHI = lecroy_IIHI.get_segments()
plt.subplot(325)
plt.plot((IIHI_time-2.4e-3)*1e6,IIHI[seg]*calfactor/1000,color=[0.3, 0.3, 0.3],linewidth=2)
plt.xlabel("Time ($\mu$s)")
plt.ylabel("Channel-base Current (kA)")
plt.xlim(0,500)
plt.ylim(-1,21.5)
plt.grid()
plt.title("UF 15-43, RS#4, Peak Current = 20.5 kA")
#Plot DBY Data
moving_avg_gw=Skywave(43,4,23.293418545,13,x_max,10)
moving_avg_ir=Skywave(43,4,23.293418545,13,x_max,50)
temp=apply_two_filters(moving_avg_gw,moving_avg_ir)
time_gw=temp[0]
data_gw=temp[1]
time_ir=temp[2]
data_ir=temp[3]
raw_time_list=temp[4]
raw_data_list=temp[5]
t_start=temp[6]
plt.subplot(326)
plt.plot(time_gw,data_gw/np.max(data_gw),linewidth=2.0,color=[1,1/6,1],label="UF 15-43, RS#4") #moving averaged skywave
plt.plot(time_ir, data_ir/np.max(data_gw),linewidth=2.0,color=[1,1/6,1]) #moving averaged skywave
plt.plot([0,0],[-1,1.5],'--',linewidth=2.0) #time when skywave raises 3 std dev from mean noise
plt.plot([(dt_70km)*1e6,(dt_70km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 70 km h iono
plt.plot([(dt_80km)*1e6,(dt_80km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 80 km h iono
plt.plot([(dt_90km)*1e6,(dt_90km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 90 km h iono
plt.title("Event UF 15-43, 4th Return Stroke")
plt.xlabel("UTC time in $\mu$s after %s"%moving_avg_gw[2])
plt.ylabel("Amplitude normalized E-field (arb. units) \n measured 209 km SE of ICLRT")
plt.grid()
plt.xlim(x_min-t_start,x_max-t_start)
plt.ylim(-.2,1.1)
##UF 15-38. RS#3
#moving_avg=Skywave(38,3,26.691097980,8,x_max)
#time, data, t_start = process_and_plot(moving_avg)
#plt.plot(time,data/np.max(data),linewidth=2.0,color=[2/5,3/5,1],label="UF 15-38, RS#3") #moving averaged skywave
#
##UF 15-38. RS#4
#moving_avg=Skywave(38,4,26.734557870,8,x_max)
#time, data, t_start = process_and_plot(moving_avg)
#plt.plot(time,data/np.max(data),linewidth=2.0,color=[3/5,2/5,1],label="UF 15-38, RS#4") #moving averaged skywave
#
##UF 15-38. RS#5
#moving_avg=Skywave(38,5,26.764446000,8,x_max)
#time, data, t_start = process_and_plot(moving_avg)
#plt.plot(time,data/np.max(data),linewidth=2.0,color=[4/5,1/5,1],label="UF 15-38, RS#5") #moving averaged skywave
##UF 15-39. RS#1 *
#moving_avg=Skywave(39,1,66.583436840,9,x_max)
#time, data, t_start = process_and_plot(moving_avg)
#plt.plot(time,data/np.max(data),linewidth=2.0,color=[1/6,5/6,1],label="UF 15-39, RS#1") #moving averaged skywave
#data2=data
#
###UF 15-39. RS#3
##moving_avg=Skywave(39,3,66.633136315,9,x_max)
##time, data, t_start = process_and_plot(moving_avg)
##plt.plot(time,data/np.max(data),linewidth=2.0,color=[2/4,2/4,1],label="UF 15-39, RS#3") #moving averaged skywave
##
###UF 15-39. RS#5
##moving_avg=Skywave(39,5,66.671758785,9,x_max)
##time, data, t_start = process_and_plot(moving_avg)
##plt.plot(time,data/np.max(data),linewidth=2.0,color=[3/4,1/4,1],label="UF 15-39, RS#5") #moving averaged skywave
#
###UF15-40, RS#2
##moving_avg=Skywave(40,2,20.746971600,10,x_max)
##time, data, t_start = process_and_plot(moving_avg)
##plt.plot(time,data/np.max(data),linewidth=2.0,color=[1/3,2/3,1],label="UF 15-40, RS#2")
##
##UF15-40, RS#3 *
#moving_avg=Skywave(40,3,20.767465080,10,x_max)
#time, data, t_start = process_and_plot(moving_avg)
#plt.plot(time,data/np.max(data),linewidth=2.0,color=[2/6,4/6,1],label="UF 15-40, RS#3")
#data3=data
##UF 15-41, RS#1 *
#moving_avg=Skywave(41,1,57.298446790,11,x_max)
#time, data, t_start = process_and_plot(moving_avg)
#plt.plot(time,data/np.max(data),linewidth=2.0,color=[3/6,3/6,1],label="UF 15-41, RS#1")
#data4=data
##
###UF 15-41, RS#2
##moving_avg=Skywave(41,2,57.373669615,11,x_max)
##time, data, t_start = process_and_plot(moving_avg)
##plt.plot(time,data/np.max(data),linewidth=2.0,color=[1/4,3/4,1],label="UF 15-41, RS#2")
##
###UF 15-41, RS#3
##moving_avg=Skywave(41,3,57.405116910,11,x_max)
##time, data, t_start = process_and_plot(moving_avg)
##plt.plot(time,data/np.max(data),linewidth=2.0,color=[2/4,2/4,1],label="UF 15-41, RS#3")
##
###UF 15-41, RS#4
##moving_avg=Skywave(41,4,57.555913445,11,x_max)
##time, data, t_start = process_and_plot(moving_avg)
##plt.plot(time,data/np.max(data),linewidth=2.0,color=[3/4,1/4,1],label="UF 15-41, RS#4")
#
##UF 15-42, RS#1
#moving_avg=Skywave(42,1,42.712899355,12,x_max)
#time, data, t_start = process_and_plot(moving_avg)
#plt.plot(time,data/np.max(data),linewidth=2.0,color=[0,0,1],label="UF 15-42, RS#1")
#
##UF 15-42, RS#3
#moving_avg=Skywave(42,3,42.862766400,12,x_max)
#time, data, t_start = process_and_plot(moving_avg)
#plt.plot(time,data/np.max(data),linewidth=2.0,color=[1/5,4/5,1],label="UF 15-42, RS#3")
##
##UF 15-42, RS#4 *
#moving_avg=Skywave(42,4,43.058185590,12,x_max)
#time, data, t_start = process_and_plot(moving_avg)
#plt.plot(time,data/np.max(data),linewidth=2.0,color=[4/5,2/5,1],label="UF 15-42, RS#4")
#data5=data
##UF 15-42, RS#5
#moving_avg=Skywave(42,5,43.338093110,12,x_max)
#time, data, t_start = process_and_plot(moving_avg)
#plt.plot(time,data/np.max(data),linewidth=2.0,color=[3/5,2/5,1],label="UF 15-42, RS#5")
#
##UF 15-42, RS#6
#moving_avg=Skywave(42,6,43.366312590,12,x_max)
#time, data, t_start = process_and_plot(moving_avg)
#plt.plot(time,data/np.max(data),linewidth=2.0,color=[4/5,1/5,1],label="UF 15-42, RS#6")
##UF 15-43, RS#1
#moving_avg=Skywave(43,1,22.706011205,13,x_max)
#time, data, t_start = process_and_plot(moving_avg)
#plt.plot(time,data/np.max(data),linewidth=2.0,color=[0,0,1],label="UF 15-43, RS#1")
#
##UF 15-43, RS#2
#moving_avg=Skywave(43,2,22.934697575,13,x_max)
#time, data, t_start = process_and_plot(moving_avg)
#plt.plot(time,data/np.max(data),linewidth=2.0,color=[1/4,3/4,1],label="UF 15-43, RS#2")
#
##UF 15-43, RS#3
#moving_avg=Skywave(43,3,23.157666725,13,x_max)
#time, data, t_start = process_and_plot(moving_avg)
#plt.plot(time,data/np.max(data),linewidth=2.0,color=[2/4,2/4,1],label="UF 15-43, RS#3")
#
##UF 15-43, RS#4 *
#moving_avg=Skywave(43,4,23.293418545,13,x_max)
#time, data, t_start = process_and_plot(moving_avg)
#plt.plot(time,data/np.max(data),linewidth=2.0,color=[3/4,1/4,1],label="UF 15-43, RS#4")#"UF 15-43, RS#4")
##plt.plot(time+197,-data,linewidth=2.0,color=[1,0,0],label="superposed ground wave")#"UF 15-43, RS#4")
#data6=data
#all_data_averaged=(data1+data2+data3+data4+data5+data6)/6
#plt.plot(time,all_data_averaged, linewidth=2.0, color=[1,0,0] )
#plt.plot([0,0],[-1,1.5],'--',linewidth=2.0) #time when skywave raises 3 std dev from mean noise
#plt.plot([(dt_70km)*1e6,(dt_70km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 70 km h iono
#plt.plot([(dt_80km)*1e6,(dt_80km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 80 km h iono
#plt.plot([(dt_90km)*1e6,(dt_90km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 90 km h iono
#plt.title("Ground-wave peaks are time-alligned to t=0")
#plt.title("Event UF 15-38, 1st Return Stroke")
#plt.xlabel("UTC time in $\mu$s after %r"%moving_avg_gw[2])
#plt.ylabel("Amplitude normalized E-field (arb. units) \n measured 209 km SE of ICLRT")
#plt.grid()
#plt.xlim(x_min-t_start,x_max-t_start)
#plt.ylim(-.2,1.1)
#plt.legend()
plt.show()
##plt.plot(time,all_data_averaged, linewidth=2.0, color=[1,0,0] )
#plt.plot([0,0],[-1,1.5],'--',linewidth=2.0) #time when skywave raises 3 std dev from mean noise
#plt.plot([(dt_70km)*1e6,(dt_70km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 70 km h iono
#plt.plot([(dt_80km)*1e6,(dt_80km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 80 km h iono
#plt.plot([(dt_90km)*1e6,(dt_90km)*1e6],[-1,1.5],'--',linewidth=2.0) #time for 90 km h iono
#plt.title("averaged e-field shape")
#plt.xlabel("Time ($\mu$s)")
#plt.ylabel("E-field (arb. units) \n measured 209 km SE of ICLRT")
#plt.grid()
#plt.xlim(x_min-t_start,x_max-t_start)
#plt.show()