-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path1_short.bas
1492 lines (1123 loc) · 32.6 KB
/
1_short.bas
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
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#Include Once "albom_lib.bi" 'Îïèñàíèå áèáëèîòåêè "albom.dll"
#Include Once "albom_log.bi" 'Ïîäêëþ÷åíèå ëîãà
#Include "fbgfx.bi" 'Ïîäêëþ÷åíèå ãðàôè÷åñêîé áèáëèîòåêè
#Include Once "albom_version.bi"
#Include "crt/stdlib.bi"
#Include "dir.bi"
#include "string.bi"
#If __FB_LANG__ = "fb"
Using FB 'äëÿ ïåðåõîäà â ïîëíîýêðàííûé ðåæèì ìîíèòîðà
#EndIf
Type seans_struct
Dim filename_full As ZString*256
Dim filename As ZString*64
Dim p1(0 To 679) As Double
Dim p2(0 To 679) As Double
Dim p(0 To 679) As Double
Dim m1(0 To 679) As Integer
Dim m2(0 To 679) As Integer
Dim time_decimal As Double
Dim time_computer As Integer
End Type
Type seans_struct_out
Dim p(0 To 679) As Double
Dim qh2(0 To 679) As Double
Dim hm As Double
Dim qhm As Double
Dim pn As Double
Dim time_decimal As Double
End Type
Dim filename As ZString*256 = ""
Dim filename_full As ZString*512 = ""
Dim directory As String
Dim As Integer i, j, k
Dim is1s As Integer
Dim As String SEANS_DIR = "./in/"
Dim As String SEANS_DIR_OUT = "./out/"
Dim As Integer symbol = 0 ' âñïîìîãàòåëüíàÿ ïåðåìåííàÿ äëÿ îòîáðàæåíèÿ ïðîöåññà çàãðóçêè ñåàíñîâ
Dim As String DirectoryOutput
Dim Shared timestr As ZString*16 ' ïåðåìåííàÿ äëÿ ïðåäñòàâëåíèÿ âðåìåíè â âèäå ñòðîêè
ReDim Preserve Shared As seans_struct seans_str(0 To 1)
Dim Shared seans_loaded As Integer ' ñåàíñîâ çàãðóæåíî
Declare Sub LoadFiles(ByVal Directory As String)
Declare Function seans_struct_time_compare cdecl (elem1 as any ptr, elem2 as any ptr) as Integer
Declare Sub Vis_array_load()
Declare Sub Filter(wnd_width As Integer, lev As Double, direction As Integer)
Declare Sub SaveLabels(ByVal Directory As String)
Declare Sub LoadLabels(ByVal Directory As String)
Dim As Integer d_month, d_year, d_day, d_ndays
Dim As String s_year, s_month, s_day
Dim Shared As Double razr(0 To 350)
Dim As Integer file, t, h
Dim As Integer seans_num_out = 0
Dim As String razr_filename
Dim As Integer h_start, h_end, h_step
Dim As Integer is_clear = 1
Dim As Integer wnd_width = 15
Dim As Integer n2 = 20
Dim As Double lev = 4.5
Dim As Integer tnak = 15
Dim As Integer tstep = 1
Dim Shared As Integer hCur = 55
Dim Shared As Integer position = 0
Dim As Integer START_X = 0
Dim As Integer DX = 1 ' ìàñøòàá ïî îñè x
Dim As Integer DY = 200 ' ìàñøòàá ïî îñè y
Dim As Integer Y0 = 250 ' íà÷àëüíîå çíà÷åíèå ïî îñè y
ReDim Shared vis_array(0 To 1, 0 To 1) As Double ' áóôåð äëÿ îòîáðàæåíèÿ ãðàôèêîâ
ReDim Shared vis_array_alt(0 To 1, 0 To 679) As Double ' áóôåð äëÿ îòîáðàæåíèÿ ãðàôèêîâ
Dim As Integer Config_qh2_hmin, Config_qh2_hmax
Dim As Integer Config_q_01
Dim As Integer start_alt_mark = 0
Dim As Integer end_alt_mark = -1
Dim As Integer is_alt_mark = 0
Dim As Integer start_time_mark = 0
Dim As Integer end_time_mark = -1
Dim As Integer is_time_mark = 0
Dim As String Config_driver = "GDI"
Dim As Integer Config_resolution = 0
Dim As Integer Config_width, Config_height
Dim As Integer screen_width = 1024
Dim As Integer screen_height = 768
''' =======================================================================
' Çàãðóçêà êîíôèãóðàöèîííîãî ôàéëà
file = FreeFile()
Open "config/config_screen.dat" For Input As #file
If Err <> 0 Then
PrintErrorToLog(ErrorFilter, __FILE__, __LINE__)
End
EndIf
Input #file, Config_driver
Input #file, Config_resolution
Input #file, Config_width, Config_height
Close #file
SetEnviron("fbgfx="+Config_driver)
If Config_resolution = 0 Then
Screen 20
Else
ScreenRes Config_width, Config_height, 8
screen_width = Config_width
screen_height = Config_height
EndIf
Y0 = screen_height / 2
DY = Y0 * 0.8
#Include Once "albom_font.bi"
Open Err For Output As #1
file = FreeFile()
Open "config/config_short.dat" For Input As #file
Input #file, razr_filename
Input #file, h_start
Input #file, h_end
Input #file, h_step
Input #file, is_clear
Input #file, wnd_width
Input #file, lev
Input #file, n2
Input #file, tnak
Input #file, tstep
Input #file, Config_qh2_hmin
Input #file, Config_qh2_hmax
Input #file, Config_q_01
Close #file
If razr_load(razr_filename, @razr(0), 330) = 0 Then
PrintErrorToLog(ErrorRazrNotLoaded, __FILE__, __LINE__)
End
EndIf
Cls
Color 11
Print "UPRISE version " + UPRISE_VERSION
Print "(Unified Processing of the Results of Incoherent Scatter Experiments)"
Print
Color 7
Print "Short - ïðîãðàììà äëÿ ðàáîòû ñ äàííûìè, ïîëó÷åííûìè ïî êîðîòêîìó èìïóëüñó"
Print "(c) Áîãîìàç À.Â., Êîòîâ Ä.Â. (Èíñòèòóò èîíîñôåðû)"
Color 8
Print
Print "================================"
Print "Ïðîãðàììà ñîáðàíà " + Mid(__DATE__, 4, 2)+"."+Mid(__DATE__, 1, 2)+"."+Mid(__DATE__, 7, 4)
Print "================================"
Print
Color 11
Print "Èñõîäíûå äàííûå, íàõîäÿùèåñÿ â ïàïêå " + Chr(34) + "in" + Chr(34) + ":"
Color 10
Dim As String fn
fn = Dir("./in/*", fbDirectory)
While Len(fn) > 0
fn = Dir()
If Len(fn)=6 Then
Print fn;" ";
EndIf
Wend
Print
Print
Color 15
Input "Ââåäèòå äàòó íà÷àëà èçìåðåíèé (äåíü ìåñÿö ãîä): ", d_day, d_month, d_year
Input "Ââåäèòå êîëè÷åñòâî ñóòîê: ", d_ndays
If (d_day < 1) Or (d_month < 1) Or (d_year < 1996) Or (d_ndays < 1) Then
PrintErrorToLog(ErrorInputData, __FILE__, __LINE__)
End
EndIf
Print "Çàãðóçêà... ";
seans_loaded = 0
DirectoryOutput = ""
For i = 0 To d_ndays-1
If date_valid(d_day, d_month, d_year) = 1 Then
If d_day < 10 Then
s_day = "0"+Str(d_day)
Else
s_day = Str(d_day)
EndIf
If d_month < 10 Then
s_month = "0"+Str(d_month)
Else
s_month = Str(d_month)
EndIf
s_year = Mid(Str(d_year), 3, 2)
directory = s_day+s_month+s_year
LoadFiles(SEANS_DIR+directory)
date_next(@d_day, @d_month, @d_year)
If i = 0 Then
DirectoryOutput += directory + "-"
EndIf
EndIf
Next i
If seans_loaded = 0 Then
PrintErrorToLog(ErrorSeansNotLoaded, __FILE__, __LINE__)
End
EndIf
DirectoryOutput += directory
MkDir(SEANS_DIR_OUT +DirectoryOutput)
MkDir(SEANS_DIR_OUT +DirectoryOutput+"/step3")
MkDir(SEANS_DIR_OUT +DirectoryOutput+"/step2")
Print "OK"
Print #1, Str(seans_loaded)+" files loaded"
Print #1, "Free memory: "; Fre()\(1024*1024); " MBytes"
' Ñîðòèðîâêà ñåàíñîâ ïî âðåìåíè
Print "Ñîðòèðîâêà ïî âðåìåíè... ";
qsort(@seans_str(0), seans_loaded, SizeOf(seans_struct), @seans_struct_time_compare)
Print "OK"
LoadLabels(SEANS_DIR_OUT +DirectoryOutput+"/step2")
ReDim vis_array(0 To 1, 0 To seans_loaded) As Double ' áóôåð äëÿ îòîáðàæåíèÿ ãðàôèêîâ
Vis_array_load()
Do
ScreenLock
Cls
If is_time_mark = 1 Then
For i = start_time_mark To end_time_mark
Line(5+(i-START_X)*DX, 25)-(5+(i-START_X)*DX+DX, Y0-16), 7, BF
Next
EndIf
If seans_str(position).m1(hCur) = 0 And seans_str(position).m2(hCur) = 0 Then
Line (5+(position-START_X)*DX, 25)-(5+(position-START_X)*DX, Y0-16), 15
Else
Line (5+(position-START_X)*DX, 25)-(5+(position-START_X)*DX, Y0-16), 15, , &b0000000011110000
End If
Line(0, Y0)-(screen_width, Y0), 15, , &b0001000100010001
For i = START_X To (seans_loaded-2)
If seans_str(i).m1(hCur) <> 0 Then
Line(5+(i-START_X)*DX, Y0-DY*(vis_array(0, i)))-(5+(i+1-START_X)*DX, Y0-DY*(vis_array(0, i+1))), 15, , &b0001000100010001
Else
If seans_str(i+1).m1(hCur) <> 0 Then
Line(5+(i-START_X)*DX, Y0-DY*(vis_array(0, i)))-(5+(i+1-START_X)*DX, Y0-DY*(vis_array(0, i+1))), 15, , &b0001000100010001
Else
Line(5+(i-START_X)*DX, Y0-DY*(vis_array(0, i)))-(5+(i+1-START_X)*DX, Y0-DY*(vis_array(0, i+1))), 15'+1
End If
End If
If seans_str(i).m2(hCur) <> 0 Then
Line(5+(i-START_X)*DX, Y0-DY*(vis_array(1, i)))-(5+(i+1-START_X)*DX, Y0-DY*(vis_array(1, i+1))), 14, , &b0001000100010001
Else
If seans_str(i+1).m2(hCur) <> 0 Then
Line(5+(i-START_X)*DX, Y0-DY*(vis_array(1, i)))-(5+(i+1-START_X)*DX, Y0-DY*(vis_array(1, i+1))), 14, , &b0001000100010001
Else
Line(5+(i-START_X)*DX, Y0-DY*(vis_array(1, i)))-(5+(i+1-START_X)*DX, Y0-DY*(vis_array(1, i+1))), 14'+1
End If
End If
Next i
If is_alt_mark = 1 Then
For i = start_alt_mark To end_alt_mark
Line(5-55+i, screen_height-16)-(5-55+i, Y0), 7
Next
EndIf
For i = 55 To 679-1
If seans_str(position).m1(i) <> 0 Then
Line(5+i-55, screen_height-16-DY*vis_array_alt(0, i))-(5+i+1-55, screen_height-16-DY*vis_array_alt(0, i+1)), 15, , &b0001000100010001
Else
If seans_str(position).m1(i+1) <> 0 Then
Line(5+i-55, screen_height-16-DY*vis_array_alt(0, i))-(5+i+1-55, screen_height-16-DY*vis_array_alt(0, i+1)), 15, , &b0001000100010001
Else
Line(5+i-55, screen_height-16-DY*vis_array_alt(0, i))-(5+i+1-55, screen_height-16-DY*vis_array_alt(0, i+1)), 15
EndIf
EndIf
Next
For i = 55 To 679-1
If seans_str(position).m2(i) <> 0 Then
Line(5+i-55, screen_height-16-DY*vis_array_alt(1, i))-(5+i+1-55, screen_height-16-DY*vis_array_alt(1, i+1)), 14, , &b0001000100010001
Else
If seans_str(position).m2(i+1) <> 0 Then
Line(5+i-55, screen_height-16-DY*vis_array_alt(1, i))-(5+i+1-55, screen_height-16-DY*vis_array_alt(1, i+1)), 14, , &b0001000100010001
Else
Line(5+i-55, screen_height-16-DY*vis_array_alt(1, i))-(5+i+1-55, screen_height-16-DY*vis_array_alt(1, i+1)), 14
EndIf
EndIf
Next
If seans_str(position).m1(hCur) = 0 Then
Line(5+hCur-55, screen_height-16)-(5+hCur-55, screen_height/2), 15
Else
Line(5+hCur-55, screen_height-16)-(5+hCur-55, screen_height/2), 15, , &b0000000011110000
EndIf
Color 14
Print Using "###.### "; seans_str(position).time_decimal;
Color 10
Print Using " ###"; hCur;
Print Using " #### êì"; seans2_altS(hCur);
Print
Color 11
Print "A: Ôèëüòðàöèÿ ";
Color 15
Print "(W)hite - 1ch ";
Color 14
Print "(Y)ellow - 2ch ";
Color 10
Print "Ctrl+S: Ñîõðàíèòü ";
Color 13
Print "Ctrl+N: Ïðîäîëæèòü ";
Color 12
Print "Ctrl+Q: Âûõîä"
Color 15
Draw String (0, screen_height/2-16), "Left, Right",
If is_time_mark Then
Color 11
Draw String (screen_height/2, screen_height/2-16), _
"Selected from " + Format(CDbl(start_time_mark), "#####") + Format(seans_str(start_time_mark).time_decimal, " (###.###)") _
+ " to " + Format (CDbl(end_time_mark), "#####") + Format (seans_str(end_time_mark).time_decimal, " (###.###)")
Color 15
EndIf
Draw String (0, screen_height-14), "Page Down, Page Up",
If is_alt_mark Then
Color 11
Draw String (screen_height/2, screen_height-14), _
"Selected from " + Format(CDbl(start_alt_mark), "#####") + Format(seans2_altS(start_alt_mark), " (####.# km)") _
+ " to " + Format (CDbl(end_alt_mark), "#####") + Format (seans2_altS(end_alt_mark), " (####.# km)")
Color 15
EndIf
Locate 4, 1
ScreenUnLock
Dim key As Integer
key = GetKey()
If key = KEY_CTRL_N Then Exit Do End If
If key = KEY_CTRL_Q Then End End If
Select Case key
Case KEY_CTRL_S
SaveLabels(SEANS_DIR_OUT +DirectoryOutput+"/step2")
Case KEY_W, KEY_W_CAPITAL
If seans_str(position).m1(hCur) = 0 Then
seans_str(position).m1(hCur) = 1
Else
seans_str(position).m1(hCur) = 0
EndIf
Vis_array_load()
Case KEY_Y, KEY_Y_CAPITAL
If seans_str(position).m2(hCur) = 0 Then
seans_str(position).m2(hCur) = 1
Else
seans_str(position).m2(hCur) = 0
EndIf
Vis_array_load()
Case KEY_A, KEY_A_CAPITAL
Dim As Integer mode
Color 15
Print "Àâòîìàòè÷åñêàÿ ôèëüòðàöèÿ êîãåðåíòíûõ îòðàæåíèé"
Print
Print "Îïòèìàëüíûå ïàðàìåòðû: øèðèíà îêíà - 15, óðîâåíü - 4.5"
Print
Print "0: Âûõîä"
Print "1: Óäàëèòü âñå ìåòêè"
Print "2: Ïðîâåðêà ïðåäûäóùåé òî÷êè"
Print "3: Ïðîâåðêà ñëåäóþùåé òî÷êè"
Input "[0..3]: ", mode
Print
Select Case mode
Case 1
For v As Integer = 0 To seans_loaded-1
For z As Integer = 0 To 679
seans_str(v).m1(z) = 0
seans_str(v).m2(z) = 0
Next
Next
Case 2
Input "Øèðèíà îêíà: ", wnd_width
Input "Óðîâåíü: ", lev
Filter(wnd_width, lev, 0)
Case 3
Input "Øèðèíà îêíà: ", wnd_width
Input "Óðîâåíü: ", lev
Filter(wnd_width, lev, 1)
End Select
Vis_array_load()
Case KEY_RIGHT
If position < seans_loaded-1 And is_time_mark = 0 Then
position += 1
EndIf
Vis_array_load() ' çàãðóçèòü äàííûå äëÿ îòîáðàæåíèÿ
Case KEY_LEFT
If position > 0 And is_time_mark = 0 Then
position -= 1
EndIf
Vis_array_load() ' çàãðóçèòü äàííûå äëÿ îòîáðàæåíèÿ
Case KEY_DOWN
If START_X < seans_loaded-1 Then START_X += 1 End If
Case KEY_UP
If START_X > 0 Then START_X -= 1 End If
Case KEY_PLUS
If DX < 32 Then DX = DX*2 End If
Case KEY_MINUS
If DX > 1 Then DX = DX/2 End If
Case KEY_PAGE_UP
If hCur < 679 And is_alt_mark = 0 Then
hCur += 1
EndIf
Vis_array_load() ' çàãðóçèòü äàííûå äëÿ îòîáðàæåíèÿ
Case KEY_PAGE_DOWN
If hCur > 0 And is_alt_mark = 0 Then
hCur -= 1
EndIf
Vis_array_load() ' çàãðóçèòü äàííûå äëÿ îòîáðàæåíèÿ
Case KEY_CTRL_PAGE_UP
If is_time_mark = 0 Then
If is_alt_mark = 0 Then
start_alt_mark = hCur
end_alt_mark = hCur
is_alt_mark = 1
If hCur < 679 Then
hCur += 1
EndIf
Else
If hCur < 679 Then
end_alt_mark += 1
hCur += 1
EndIf
EndIf
Vis_array_load()
EndIf
Case KEY_CTRL_PAGE_DOWN
If is_time_mark = 0 Then
If is_alt_mark = 1 Then
If hCur > 0 Then
If end_alt_mark = start_alt_mark Then
is_alt_mark = 0
EndIf
end_alt_mark -= 1
hCur -= 1
EndIf
EndIf
Vis_array_load()
EndIf
Case KEY_CTRL_RIGHT
If is_alt_mark = 0 Then
If is_time_mark = 0 Then
start_time_mark = position
end_time_mark = position
is_time_mark = 1
If position < seans_loaded-1 Then
position += 1
EndIf
Else
If position < seans_loaded-1 Then
end_time_mark += 1
position += 1
EndIf
EndIf
Vis_array_load()
EndIf
Case KEY_CTRL_LEFT
If is_alt_mark = 0 Then
If is_time_mark = 1 Then
If position > 0 Then
If end_time_mark = start_time_mark Then
is_time_mark = 0
EndIf
end_time_mark -= 1
position -= 1
EndIf
EndIf
Vis_array_load()
EndIf
Case KEY_DEL
If is_alt_mark = 1 Then
For i = start_alt_mark To end_alt_mark
seans_str(position).m1(i) = 1
seans_str(position).m2(i) = 1
Next
is_alt_mark = 0
EndIf
If is_time_mark = 1 Then
For i = start_time_mark To end_time_mark
seans_str(i).m1(hCur) = 1
seans_str(i).m2(hCur) = 1
Next
is_time_mark = 0
EndIf
Vis_array_load()
Case KEY_CTRL_DEL
If is_alt_mark = 1 Then
For i = start_alt_mark To end_alt_mark
For j = 0 To seans_loaded-1
seans_str(j).m1(i) = 1
seans_str(j).m2(i) = 1
Next
Next
is_alt_mark = 0
EndIf
If is_time_mark = 1 Then
For i = start_time_mark To end_time_mark
For j = 0 To 679
seans_str(i).m1(j) = 1
seans_str(i).m2(j) = 1
Next
Next
is_time_mark = 0
EndIf
Vis_array_load()
Case KEY_R, KEY_R_CAPITAL
If is_alt_mark = 1 Then
For i = start_alt_mark To end_alt_mark
seans_str(position).m1(i) = 0
seans_str(position).m2(i) = 0
Next
is_alt_mark = 0
EndIf
If is_time_mark = 1 Then
For i = start_time_mark To end_time_mark
seans_str(i).m1(hCur) = 0
seans_str(i).m2(hCur) = 0
Next
is_time_mark = 0
EndIf
Vis_array_load()
Case KEY_CTRL_R
If is_alt_mark = 1 Then
For i = start_alt_mark To end_alt_mark
For j = 0 To seans_loaded-1
seans_str(j).m1(i) = 0
seans_str(j).m2(i) = 0
Next
Next
is_alt_mark = 0
EndIf
If is_time_mark = 1 Then
For i = start_time_mark To end_time_mark
For j = 0 To 679
seans_str(i).m1(j) = 0
seans_str(i).m2(j) = 0
Next
Next
is_time_mark = 0
EndIf
Vis_array_load()
End Select
Loop
Cls
Print "Èíòåðïîëÿöèÿ äàííûõ... ";
' èíòðåðïîëÿöèÿ
For h = 0 To 679
For t = 0 To seans_loaded-1
If seans_str(t).m1(h) = 1 Then
Dim As Integer c = 0
Dim As Double d = 0
' left
i = 0
Do While (c < n2\2)
If t-i < 0 Then
Exit Do
EndIf
If seans_str(t-i).m1(h) = 0 Then
c += 1
d += seans_str(t-i).p1(h)
EndIf
i += 1
Loop
' right
i = 0
Do While (c < n2\2)
If t+i > seans_loaded-1 Then
Exit Do
EndIf
If seans_str(t+i).m1(h) = 0 Then
c += 1
d += seans_str(t+i).p1(h)
EndIf
i += 1
Loop
If c <> 0 Then
seans_str(t).p1(h) = d/c
Else
seans_str(t).p1(h) = 0
EndIf
EndIf
Next t
Next h
For h = 0 To 679
For t = 0 To seans_loaded-1
If seans_str(t).m2(h) = 1 Then
Dim As Integer c = 0
Dim As Double d = 0
' left
i = 0
Do While (c < n2\2)
If t-i < 0 Then
Exit Do
EndIf
If seans_str(t-i).m2(h) = 0 Then
c += 1
d += seans_str(t-i).p2(h)
EndIf
i += 1
Loop
' right
i = 0
Do While (c < n2\2)
If t+i > seans_loaded-1 Then
Exit Do
EndIf
If seans_str(t+i).m2(h) = 0 Then
c += 1
d += seans_str(t+i).p2(h)
EndIf
i += 1
Loop
If c <> 0 Then
seans_str(t).p2(h) = d/c
Else
seans_str(t).p2(h) = 0
EndIf
EndIf
Next t
Next h
For t = 0 To seans_loaded-1
For h = 0 To 679
seans_str(t).p(h) = seans_str(t).p1(h) + seans_str(t).p2(h)
Next h
Next t
Print "OK"
Print "Íàêîïëåíèå äàííûõ ïî âðåìåíè... ";
' íàêîïëåíèå ïî âðåìåíè
ReDim As seans_struct_out seans_str_out(0 To seans_loaded-1)
Dim As Integer seans_current
seans_current = 0
t = 0
Do Until t + tNak > seans_loaded-1
For h = 0 To 679
seans_str_out(seans_current).p(h) = 0
For i = 0 To tNak-1
seans_str_out(seans_current).p(h) += seans_str(t+i).p(h)
Next i
seans_str_out(seans_current).time_decimal = seans_str(t+tNak\2).time_decimal
Next h
t += tStep
seans_current += 1
Loop
Print "OK"
Print "Ó÷¸ò õàðàêòåðèñòèêè ðàçðÿäíèêà... ";
' ó÷¸ò ðàçðÿäíèêà
For t = 0 To seans_current-1
For h = 0 To 300
If razr(h) > 0.001 Then
seans_str_out(t).p(h) /= razr(h)
Else
seans_str_out(t).p(h) = 0
EndIf
Next h
Next t
Print "OK"
Print "Ðàñ÷¸ò ìîùíîñòè ÍÐ ñèãíàëà... ";
' ðàñ÷¸ò ìîùíîñòè øóìà
For t = 0 To seans_current-1
seans_str_out(t).pn = 0
For h = 500 To 599
seans_str_out(t).pn += seans_str_out(t).p(h)
Next h
seans_str_out(t).pn /= 100
Next t
For t = 0 To seans_current-1
For h = 0 To 679
seans_str_out(t).p(h) -= seans_str_out(t).pn
Next h
Next t
For t = 0 To seans_current-1
For h = 0 To 679
seans_str_out(t).p(h) /= seans_str_out(t).pn
Next h
Next t
Print "OK"
Print "Ðàñ÷¸ò qh2 è q(qh2max)... ";
For t = 0 To seans_current-1
For h = 0 To 679
seans_str_out(t).qh2(h) = seans_str_out(t).p(h) * seans2_altS(h)^2
Next h
Next t
For t = 0 To seans_current-1
Dim As Double qh2 = -1e200
For h = Config_qh2_hmin To Config_qh2_hmax
If seans_str_out(t).qh2(h) > qh2 Then
seans_str_out(t).hm = seans2_altS(h)
seans_str_out(t).qhm = seans_str_out(t).p(h)
qh2 = seans_str_out(t).qh2(h)
EndIf
Next h
Next t
Print "OK"
file = FreeFile()
Open SEANS_DIR_OUT +DirectoryOutput+"/step3/T.txt" For Input As #file
If Err() <> 0 Then
Print "Âûâîä ðåçóëüòàòîâ â ôàéëû... ";
file = FreeFile()
Open SEANS_DIR_OUT +DirectoryOutput+"/step3/ShortPn.txt" For Output As #file
For t = 0 To seans_current-1
Print #file, Using " ##.#### ########"; seans_str_out(t).time_decimal; CInt(seans_str_out(t).pn)
Next
Close #file
file = FreeFile()
Open SEANS_DIR_OUT +DirectoryOutput+"/step3/ShortHm.txt" For Output As #file
For t = 0 To seans_current-1
Print #file, Using " ##.#### ########"; seans_str_out(t).time_decimal; CInt(seans_str_out(t).hm)
Next
Close #file
file = FreeFile()
Open SEANS_DIR_OUT +DirectoryOutput+"/step3/ShortQHm.txt" For Output As #file
For t = 0 To seans_current-1
Print #file, Using " ##.#### #####.#####"; seans_str_out(t).time_decimal; seans_str_out(t).qhm
Next
Close #file
file = FreeFile()
Open SEANS_DIR_OUT +DirectoryOutput+"/step3/ShortQ.txt" For Output As #file
Print #file, " 0";
For h = h_start To h_end Step h_step
Print #file, Using " ####"; seans2_altS(h);
Next h
Print #file,
For t = 0 To seans_current-1
Print #file, Using " ##.####"; seans_str_out(t).time_decimal;
For h = h_start To h_end Step h_step
Print #file, Using " #####.#####"; seans_str_out(t).p(h);
Next
Print #file,
Next t
Close #file ' "ShortQ.txt"
file = FreeFile()
Open SEANS_DIR_OUT +DirectoryOutput+"/step3/ShortQh2.txt" For Output As #file
Print #file, " 0";
For h = h_start To h_end Step h_step
Print #file, Using " ####"; seans2_altS(h);
Next h
Print #file,
For t = 0 To seans_current-1
Print #file, Using " ##.####"; seans_str_out(t).time_decimal;
For h = h_start To h_end Step h_step
Print #file, Using " ##.####^^^^"; seans_str_out(t).qh2(h);
Next
Print #file,
Next t
Print "OK"
Close #file ' "ShortQh2.txt"
Else
Dim As Integer nT = 0
Dim As String temp
Do Until Eof(file)
Line Input #file, temp
nT += 1
Loop
ReDim As Double out_time(0 To nT-1)
ReDim As Double out_q(h_start To h_end, 0 To nT-1)
ReDim As Double out_qh2(h_start To h_end, 0 To nT-1)
ReDim As Double in_time(0 To seans_current-1)
ReDim As Double in_q(0 To seans_current-1)
ReDim As Double pnIn(0 To seans_current-1)
ReDim As Double pnOut(0 To nT-1)
ReDim As Double hmIn(0 To seans_current-1)
ReDim As Double hmOut(0 To nT-1)
ReDim As Double qhmIn(0 To seans_current-1)
ReDim As Double qhmOut(0 To nT-1)
For t = 0 To seans_current-1
in_time(t) = seans_str_out(t).time_decimal
Next
time_linear(@in_time(0), seans_current)
Seek #file, 1
For t = 0 To nT-1
Input #file, out_time(t)
Next
time_linear(@out_time(0), nT)
Close #file ' "T.txt"
For h = h_start To h_end Step h_step
For t = 0 To seans_current-1
in_q(t) = seans_str_out(t).p(h)
Next
For t = 0 To nT-1
out_q(h, t) = array_linear_d(out_time(t), @in_time(0), @in_q(0), seans_current)
Next
Next
For h = h_start To h_end Step h_step
For t = 0 To seans_current-1
in_q(t) = seans_str_out(t).qh2(h)
Next
For t = 0 To nT-1
out_qh2(h, t) = array_linear_d(out_time(t), @in_time(0), @in_q(0), seans_current)
Next
Next
For t = 0 To seans_current-1
pnIn(t) = seans_str_out(t).pn