-
Notifications
You must be signed in to change notification settings - Fork 0
/
Master.pro
1215 lines (866 loc) · 60.8 KB
/
Master.pro
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
pro Master
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; This is the GDL library created for Ursinus College Summer Fellows Program.
;
; Useful abbreviations to know:
; - RA = Right Ascension
; - RAh = Right Ascension Hour(s)
; - RAm = Right Ascension Minute(s)
; - RAs = Right Ascension Second(s)
;
; - Dec = Declination
; - DecD = Declination Degrees
; - DecM = Declination Minutes
; - DecS = Declination Seconds
;
; It contains a search feature with two options:
; - Search a .CSV file
; - The .CSV file columns must have the following format to be read properly:
; - Source Name, RAh, RAm, RAs, DecD, DecM, DecS
; - Searching with Observation Time and Date
;
; It contains a calculation feature with three options:
; - Calculate Day of the Year, also known as Day of the Julian Calendar
; - Calculate Declination of the Mean Sun using either:
; - Day of the Julian Calendar
; - Days since Vernal Equinox
; - Calculate Right Ascension of the Mean Sun using either:
; - Day of the Julian Calendar
; - Days since Vernal Equinox
;
; Latest Update Date: 5-25-2021
; Latest Update Contributor: Brian Barker
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Close any previously opened file
close, /all
; This begins and repeats the entire procedure until the user wants to stop
repeat begin
; Give the user options for what they want to do
; Repeats until the user picks an available option
repeat begin
print,""
print,"Home Menu:"
read,choice,prompt="|1 - Search Options| |2 - Calculations| "
endrep until (choice ge 1) && (choice le 2)
; If Home Menu option 1 is picked do this
if choice eq 1 then begin
print,"...Accessing Searches..."
; Repeats until the user picks an available option
repeat begin
print,""
print,"How Would You Like To Search?"
read,search_option,prompt="|1 - From A .CSV File| |2 - Using Observation Time And Date| "
print,""
endrep until (search_option ge 1) && (search_option le 2)
; If Search Menu option 1 is picked do this
if search_option eq 1 then begin
print,"Please Pick The .CSV File That You Would Like To Search"
print,""
; Declarations of variables for the manipulations during the search
RAh = 0.0
RAm = 0.0
RAs = 0.0
DecD = 0.0
DecM = 0.0
DecS = 0.0
; Open a file for the search history
openw,2,'GDLSearch.txt'
; Use dialog_pickfile to locate the file to be used and assign it a name
; The name is "user_file" and the filter can be changed to different file types or taken out. "/read" changes the title of the dialog box
user_file = dialog_pickfile(FILTER='*.csv',/read)
; Read the file in and assign it to the Source_Data variable, assign the header information to variables
Source_Data = read_csv(user_file, COUNT=count, HEADER=SourceHead, N_TABLE_HEADER=0)
; Take the columns (FIELDS) of the csv and assign them variables for later use
Names = Source_Data.FIELD1
RAHs = Source_Data.FIELD2
RAMs = Source_Data.FIELD3
RASs = Source_Data.FIELD4
DECDs = Source_Data.FIELD5
DECMs = Source_Data.FIELD6
DECSs = Source_Data.FIELD7
; Put all the columns from the csv into one list
DataList = list(Names,RAHs,RAMs,RASs,DECDs,DECMs,DECSs)
; This command will provide a readout of what is printed to the screen for the entire process until it is ended so there is a record.
;JOURNAL,"GDLsearchJournal.txt"
; This begins the search process. It repeats the whole process until the user decides to stop
repeat begin
; Ask user if they want to search by Source Name, RAh, or DecD
; Repeats until the user picks an available option
repeat begin
print,""
print,"How Would You Like To Search The File? "
read,mode,prompt="|1 = Source Name| |2 = Right Ascension Hours| |3 = Declination Degrees| "
print,""
endrep until (mode ge 1) && (mode le 3)
; Mode 1 Selected ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;If Search Mode option 1 is picked do this
if mode eq 1 then begin
; Print the list of sources with selector numbers so the user can pick which one they want
; This section will repeat if the user chooses to
repeat begin
for i=0,N_ELEMENTS(Names)-1 do begin
print,i+1," --- ",Names[i]
endfor
; User selects source from the list
print,""
read,source_selector,prompt="Which Source Would You Like Information For? "
; This question repeats until the user enters a number that is on the list.
; If a number NOT on the list is picked, GDL will produce an error and stop the procedure. This prevents that.
repeat begin
if source_selector gt N_ELEMENTS(Names) then begin
read,source_selector,prompt="Which Source Would You Like Information For? "
endif
endrep until source_selector le N_ELEMENTS(Names)
; Assign the most recent selected source's data to variables for display and calling
RAh = RAHs[source_selector-1]
RAm = RAMs[source_selector-1]
RAs = RASs[source_selector-1]
DecD = DECDs[source_selector-1]
DecM = DECMs[source_selector-1]
DecS = DECSs[source_selector-1]
; Display the source information chosen by user
print,""
print,Names[source_selector-1],":"
print,""
print,"RA Hr: ",RAh
print,"RA Min: ",RAm
print,"RA Sec: ",RAs
print,"Dec Deg: ",DecD
print,"Dec Min: ",DecM
print,"Dec Sec: ",DecS
print,""
; Identify if the chosen source is a star or constellation
; Constellations are not point sources, so their location information is more general without minutes or seconds
; This tests if the minutes and seconds are 0 in BOTH Dec and RA
if (RAm eq 0) && (RAs eq 0) && (DecM) && (DecS) then begin
print,"This Source Is A Constellation!"
print,""
endif else begin
print,"This Source Is A Star!"
print,""
endelse
; Allow the user to pick another source until they are satisfied
; Repeat this question until either 1 or 0 is chosen
repeat begin
print,"Would You Like to Pick Another Source From The List? "
read,cont,prompt="|1 = Yes| |0 = No| "
print,""
endrep until (cont le 1) && (cont ge 0)
endrep until cont eq 0 ; End to the repeat loop at the beginning of Mode 1
; Print the selected source and its info to the GDLSearch file. This is not printed to screen.
printf,2,systime()
printf,2,Names[source_selector-1],":"
printf,2,"RAh: ",RAh
printf,2,"RAm: ",RAm
printf,2,"RAs: ",RAs
printf,2,"DecD: ",DecD
printf,2,"DecM: ",DecM
printf,2,"DecS: ",DecS
endif ; End if to initialize Mode 1
; Mode 2 Selected ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; If Search Mode 2 is picked do this
if mode eq 2 then begin
; Ask the user what RA they want
read,user_RAh,prompt="What Right Ascension Hour Are You Searching For? "
print,""
; Ask for a search range input and then indicate searching has begun
read,user_range,prompt="Please Enter A Plus Or Minus Value For The Search Range. Entering 0 Means Only Exact Matches Will Be Shown. "
print,""
print,"Searching for RA Hours With Your Value..."
print,""
; Create some lists and arrays to be able to manipulate the master file
RALS = list()
RAA = []
RAAS = list()
NAA = list()
CC = list()
; Print titles for the displayed info
print," Name ------- RAh ------- RAm ------- RAs ------- DecD ------- DecM ------- DecS "
; If a range is entered do this
if user_range gt 0 then begin
search_floor = (user_RAh - user_range)
; Go through DataList and search for RAH minus user_range
; Only happens if the user picks a range above 0
; Goes through the list of RAHs and if the source is a match, it adds it to a main list for display
for i=0,N_ELEMENTS(RAHs)-1 do begin
if RAHs[i] eq search_floor then begin
RAA = [RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i]] ; Take only the number columns and add them to a temporary list
RAAS.add,RAA ; Add them
NAA.add,Names[i]
CC.add,Names[i] ; Take all the names that match that data and add them to another temporary list
RALS = list(Names[i],RAA,/EXTRACT) ; Combine the lists to show user's search results and provide a count
print,Names[i],RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i] ; Print user's search results
endif
endfor
for i=0,N_ELEMENTS(RAHs)-1 do begin
if (RAHs[i] gt search_floor) && (RAHs[i] lt user_RAh) then begin
RAA = [RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i]] ; Take only the number columns and add them to a temporary list
RAAS.add,RAA ; Add them
NAA.add,Names[i] ; Take all the names that match that data and add them to another temporary list
CC.add,Names[i]
RALS = list(Names[i],RAA,/EXTRACT) ; Combine the lists to show user's search results and provide a count
print,Names[i],RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i] ; Print user's search results
endif
endfor
endif
; Go through DataList and search for matching RAHs
; Goes through the list of RAHs and if the source is a match, it adds it to a main list for display
for i=0,N_ELEMENTS(RAHs)-1 do begin
if RAHs[i] eq user_RAh then begin
RAA = [RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i]] ; Take only the number columns and add them to a temporary list
RAAS.add,RAA ; Add them
NAA.add,Names[i] ; Take all the names that match that data and add them to another temporary list
CC.add,Names[i]
RALS = list(Names[i],RAA,/EXTRACT) ; Combine the lists to show user's search results and provide a count
print,Names[i],RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i] ; Print user's search results
endif
endfor
; Go through DataList and search for RAH plus user_range
; Goes through the list of RAHs and if the source is a match, it adds it to a main list for display
; Only happens if the user picks a range above 0
if user_range gt 0 then begin
search_ceiling = (user_RAh + user_range)
for i=0,N_ELEMENTS(RAHs)-1 do begin
if (RAHs[i] gt user_RAh) && (RAHs[i] lt search_ceiling) then begin
RAA = [RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i]] ; Take only the number columns and add them to a temporary list
RAAS.add,RAA ; Add them
NAA.add,Names[i] ; Take all the names that match that data and add them to another temporary list
CC.add,Names[i]
RALS = list(Names[i],RAA,/EXTRACT) ; Combine the lists to show user's search results and provide a count
print,Names[i],RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i] ; Print user's search results
endif
endfor
for i=0,N_ELEMENTS(RAHs)-1 do begin
if RAHs[i] eq search_ceiling then begin
RAA = [RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i]] ; Take only the number columns and add them to a temporary list
RAAS.add,RAA ; Add them
NAA.add,Names[i] ; Take all the names that match that data and add them to another temporary list
CC.add,Names[i]
RALS = list(Names[i],RAA,/EXTRACT) ; Combine the lists to show user's search results and provide a count
print,Names[i],RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i] ; Print user's search results
endif
endfor
endif
; Counts the temporary lists to make sure they have stuff in them and prints communications
RC = RALS.count()
Counter = CC.count()
; If there are no matches do this
if RC lt 1 then begin
print,"Sorry. No Matches."
print,""
endif
; If the user entered a number that can not be an RAH do this
if user_RAh gt 23 then begin ; If the user enters a number bigger than 23.99, explain why that isn't allowed
print,"Right Ascension Hours Go From 1 - 23.99"
print,""
endif
; If there are matches, ask the user to pick one to proceed with
if RC ge 1 then begin
print,""
; Repeats until the user has picked a line number on the list
repeat begin
read,line_selector,prompt="Which Line Number Would You Like to Proceed With? "
print,""
endrep until line_selector le Counter
; Assign the most recent selected source's data to variables for display and calling
RAh = RAAS[line_selector - 1,0]
RAm = RAAS[line_selector - 1,1]
RAs = RAAS[line_selector - 1,2]
DecD = RAAS[line_selector - 1,3]
DecM = RAAS[line_selector - 1,4]
DecS = RAAS[line_selector - 1,5]
; Print the final choice from user and indicate the next step is being started
print,""
print,"Proceeding with: "
print,NAA[line_selector - 1]
print,""
print,"RA Hr: ",RAh
print,"RA Min: ",RAm
print,"RA Sec: ",RAs
print,"Dec Deg: ",DecD
print,"Dec Min: ",DecM
print,"Dec Sec: ",DecS
print,""
; Identify if the chosen source is a star or constellation
; Constellations are not point sources, so their location information is more general without minutes or seconds
; This tests if the minutes and seconds are 0 in BOTH Dec and RA
if (RAm eq 0) && (RAs eq 0) && (DecM) && (DecS) then begin
print,"This Source Is A Constellation!"
print,""
endif else begin
print,"This Source Is A Star!"
print,""
endelse
; Print the selected source and its info to the GDLSearch file
printf,2,systime()
printf,2,NAA[line_selector - 1],":"
printf,2,"RAh: ",RAh
printf,2,"RAm: ",RAm
printf,2,"RAs: ",RAs
printf,2,"DecD: ",DecD
printf,2,"DecM: ",DecM
printf,2,"DecS: ",DecS
endif ; End if for when there are matches to display
endif ; End if mode 2 is selected
; Mode 3 Selected ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; If Search Mode 3 is selected do this
if mode eq 3 then begin
; Ask the user what Dec Degrees they want
read,user_DecD,prompt="What Declination Degrees Are You Searching For? "
print,""
; Ask for a search range input and then indicate searching
read,user_range,prompt="Please Enter A Plus Or Minus Value For The Search Range. Entering 0 Means Only Exact Matches Will Be Shown. "
print,""
print,"Searching for Dec Degrees With Your Value..."
print,""
; Create some lists and arrays to be able to manipulate the master file
DecDL = list()
RALS = list()
DLL = []
DLLS = list()
NAAS = list()
CC = list()
; Print titles for display
print," Line ------- Name ------- RAh ------- RAm ------- RAs ------- DecD ------- DecM ------- DecS "
; If a range is entered do this
if user_range gt 0 then begin
search_floor = (user_DecD - user_range)
; Go through DataList and search for DecD minus user_range
; Only happens if the user picks a range above 0
; Goes through the list of DecDs and if the source is a match, it adds it to a main list for display
for i=0,N_ELEMENTS(DECDs)-1 do begin
if DECDs[i] eq search_floor then begin
DLL = [RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i]] ; Take only the numbers from the list and arrange them to be checked and displayed
DLLS.add,DLL ; Add them to a temporary list
NAAS.add,Names[i] ; Add the names to a temporary list
CC.add,Names[i]
DecDL = list(Names[i],DLL,/EXTRACT) ; Combine the temporary lists
print,Names[i],RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i] ; Print the matches for the users search
endif
endfor
for i=0,N_ELEMENTS(DECDs)-1 do begin
if (DECDs[i] gt search_floor) && (DECDs[i] lt user_DecD) then begin
DLL = [RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i]] ; Take only the numbers from the list and arrange them to be checked and displayed
DLLS.add,DLL ; Add them to a temporary list
NAAS.add,Names[i] ; Add the names to a temporary list
CC.add,Names[i]
DecDL = list(Names[i],DLL,/EXTRACT) ; Combine the temporary lists
print,Names[i],RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i] ; Print the matches for the users search
endif
endfor
endif
; Go through DataList and search for DECDs that match the users search
; Goes through the list of DecDs and if the source is a match, it adds it to a main list for display
for i=0,N_ELEMENTS(DECDs)-1 do begin
if DECDs[i] eq user_DecD then begin
DLL = [RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i]] ; Take only the numbers from the list and arrange them to be checked and displayed
DLLS.add,DLL ; Add them to a temporary list
NAAS.add,Names[i] ; Add the names to a temporary list
CC.add,Names[i]
DecDL = list(Names[i],DLL,/EXTRACT) ; Combine the temporary lists
print,Names[i],RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i] ; Print the matches for the users search
endif
endfor
; Go through DataList and search for DecD minus user_range
; Only happens if the user picks a range above 0
; Goes through the list of DecDs and if the source is a match, it adds it to a main list for display
if user_range gt 0 then begin
search_ceiling = (user_DecD + user_range)
for i=0,N_ELEMENTS(DECDs)-1 do begin
if (DECDs[i] gt user_DecD) && (DECDs[i] lt search_ceiling) then begin
DLL = [RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i]] ; Take only the numbers from the list and arrange them to be checked and displayed
DLLS.add,DLL ; Add them to a temporary list
NAAS.add,Names[i] ; Add the names to a temporary list
CC.add,Names[i]
DecDL = list(Names[i],DLL,/EXTRACT) ; Combine the temporary lists
print,Names[i],RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i] ; Print the matches for the users search
endif
endfor
for i=0,N_ELEMENTS(DECDs)-1 do begin
if DECDs[i] eq search_ceiling then begin
DLL = [RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i]] ; Take only the numbers from the list and arrange them to be checked and displayed
DLLS.add,DLL ; Add them to a temporary list
NAAS.add,Names[i] ; Add the names to a temporary list
CC.add,Names[i]
DecDL = list(Names[i],DLL,/EXTRACT) ; Combine the temporary lists
print,Names[i],RAHs[i],RAMs[i],RASs[i],DECDs[i],DECMs[i],DECSs[i] ; Print the matches for the users search
endif
endfor
endif
; Test to make sure there are matches to the users search
DL = DecDL.count()
Counter = CC.count()
; If there are no matches do this
if DL lt 1 then begin
print,"Sorry. No Matches."
print,""
endif
; If there are matches, ask the user to pick one to proceed with
if DL ge 1 then begin
print,""
; Repeats until the user picks a line that is displayed
repeat begin
read,line_selector,prompt="Which Line Would You Like to Proceed With? "
print,""
endrep until line_selector le Counter
; Assign the most recent selected source's data to variables for display and calling
RAh = DLLS[line_selector - 1,0]
RAm = DLLS[line_selector - 1,1]
RAs = DLLS[line_selector - 1,2]
DecD = DLLS[line_selector - 1,3]
DecM = DLLS[line_selector - 1,4]
DecS = DLLS[line_selector - 1,5]
; Print the final choice from user and indicate the next step is being started
print,""
print,"Proceeding with: "
print,""
print,NAAS[line_selector - 1]
print,""
print,"RA Hr: ",RAh
print,"RA Min: ",RAm
print,"RA Sec: ",RAs
print,"Dec Deg: ",DecD
print,"Dec Min: ",DecM
print,"Dec Sec: ",DecS
print,""
; Identify if the chosen source is a star or constellation
; Constellations are not point sources, so their location information is more general without minutes or seconds
; This tests if the minutes and seconds are 0 in BOTH Dec and RA
if (RAm eq 0) && (RAs eq 0) && (DecM) && (DecS) then begin
print,"This Source Is A Constellation!"
print,""
endif else begin
print,"This Source Is A Star!"
print,""
endelse
; Print the selected source and its info to the GDLSearch file
printf,2,systime()
printf,2,NAAS[line_selector - 1],':'
printf,2,"RAh: ",RAh
printf,2,"RAm: ",RAm
printf,2,"RAs: ",RAs
printf,2,"DecD: ",DecD
printf,2,"DecM: ",DecM
printf,2,"DecS: ",DecS
endif
endif ; End if mode 3 is selected
; Ask the user if they want to start over and search again
repeat begin
print,"Would You Like To Start The Search Over Again?"
read,end_Ref4,prompt="|1 = Yes| |0 = No| "
endrep until (end_Ref4 le 1) && (end_Ref4 ge 0)
endrep until end_Ref4 eq 0 ; End repeat from very beginning if user chooses not to start over
;JOURNAL ; End journal entries
; Makes sure the user knows where to find the files that log what happened in their session
; Warn them that they will be overwritten with every new session
print,""
print,"***"
print,"Please Make Sure To Find 'GDLSearch.txt' As Well As 'GDLsearchJournal.txt' In The Directory Where This Program Is Saved."
print,"'GDLSearch.txt' Provides A Log of The Stars That Were Selected. 'GDLsearchJournal' Provides A Detailed Log Of Everything Printed To Screen."
print,"Both Files Are Overwritten With Every New Call Of The Program. Once It Is Started Again, This Session Will Be Lost."
print,"***"
print,""
; End the search
print,"End Search."
print,""
endif ; End if for .csv search option
; If Search Option 2 is picked do this
if search_option eq 2 then begin
; Repeats this question until one of the options is picked
repeat begin
print,""
print,"Is The Observation Date During Daylight Savings Time? "
read,time_mode,prompt="|1 = Yes| |0 = No| "
print,""
endrep until (time_mode le 1) && (time_mode ge 0)
; If Time Mode is 0 do this
if time_mode eq 0 then begin
; Ask for the hour of observation to calculate HA of the Mean Sun
read,MST,prompt="What Is The Hour Of Observation In 24-hr Format? "
print,""
HAms = MST - 12
; Find RAms for this observation date
repeat begin ; Repeats the RA calculation section until the user wants to stop
; Repeats this question until the user picks one of the options
repeat begin
print,"How Would You Like To Calculate Right Ascension Of The Mean Sun?"
read,search_mode,prompt="|1 = Using Day Of The Julian Calendar| |2 = Using Days Since Vernal Equinox| "
print,""
endrep until search_mode le 2 && search_mode ge 1
; If search_mode 1 is picked do this
if search_mode eq 1 then begin
; User inputs for calculation
read,t,prompt="What Day Of The Julian Calendar Would You Like To Use? "
print,""
RA = 18.62 + (.0657 * t)
; If the RA is bigger than 24, it has gone around the entire CE and must have 24 subtracted from it. Do this
if RA gt 24 then begin
new_RA = RA - 24
print,"Right Ascension Of The Mean Sun On This Day Is: ", (new_RA)
print,""
RAms = new_RA
endif
; Prints the RA if it is less than 24
if RA le 24 then begin
print,"Right Ascension Of The Mean Sun On This Day Is: ", RA
print,""
RAms = RA
endif
endif ; End if for Search Mode 1
; If search_mode 2 is picked, do this
if search_mode eq 2 then begin
; User inputs for calculation
read,tv,prompt="How Many Days Since The Vernal Equinox? "
print,""
RA = 0.0 + (24.0/365.0) * tv
; If the RA is bigger than 24, it has gone around the entire CE and must have 24 subtracted from it. Do this
if RA gt 24 then begin
new_RA = RA - 24
print,"Right Ascension Of The Mean Sun On This Day Is: ", (new_RA)
print,""
RAms = new_RA
endif
; Prints the RA if it is less than 24
if RA le 24 then begin
print,"Right Ascension Of The Mean Sun On This Day Is: ", RA
print,""
RAms = RA
endif
endif ; End if for Search Mode 1
; Repeats question until one of the choices is picked
repeat begin
print,"Would You Like To Calculate A New RA?"
read,end_RASun,prompt="|1 = Yes| |0 = No| "
print,""
endrep until end_RASun le 1
endrep until end_RASun eq 0 ; End RASun calculation
; Calculates the Local Sidereal Time for the observation date and time
LST = RAms + HAms
; Displays the information calculated
print,"The Local Sidereal Time Is: ",LST
print,""
; Adds and subtracts 6 hours to the RA hour.
; The calculated RA will be transiting the meridian so adding and subtracting 6 will give the RA values on the horizon to the east and west
RA_w = LST - 6
RA_e = LST + 6
; Shows the RA hours on the horizon
print,"Looking South At This Time, Sources With An RA Hour Between The Following Two Values Will Be Visible. "
print,"RA To The East ",floor(RA_e)
print,"RA To The West ",floor(RA_w)
print,""
endif ; Ends if Time Mode is 0
; If Time Mode 1 is picked do this
if time_mode eq 1 then begin
; User inputs for calculation
read,MST,prompt="What Is The Hour Of Observation In 24-hr Format? "
print,""
; If Daylight Saving Time is being observed, the time is one hour ahead of MST and a conversion is needed
DST = MST + 1
HAms = DST - 13
; Calculate RA of the Mean Sun and repeat until the user doesn't want to calculate a new one
repeat begin
; Repeats the question until one of the choices is picked
repeat begin
print,"How Would You Like To Calculate Right Ascension Of The Mean Sun?"
read,search_mode,prompt="|1 = Using Day Of The Julian Calendar| |2 = Using Days Since Vernal Equinox| "
print,""
endrep until search_mode le 2 && search_mode ge 1
; If search_mode 1 is picked do this
if search_mode eq 1 then begin
; User inputs for calculation
read,t,prompt="What Day Of The Julian Calendar Would You Like To Use? "
print,""
RA = 18.62 + (.0657 * t)
; If the RA is bigger than 24, it has gone around the entire CE and must have 24 subtracted from it. Do this
if RA gt 24 then begin
new_RA = RA - 24
print,"Right Ascension Of The Mean Sun On This Day Is: ", (new_RA)
print,""
RAms = new_RA
endif
; Prints the RA if it is less than 24
if RA le 24 then begin
print,"Right Ascension Of The Mean Sun On This Day Is: ", RA
print,""
RAms = RA
endif
endif ; End if Search Mode 1 is picked
; If search_mode 2 is picked, do this
if search_mode eq 2 then begin
; User inputs for calculation
read,tv,prompt="How Many Days Since The Vernal Equinox? "
print,""
RA = 0.0 + (24.0/365.0) * tv
; If the RA is bigger than 24, it has gone around the entire CE and must have 24 subtracted from it. Do this
if RA gt 24 then begin
new_RA = RA - 24
print,"Right Ascension Of The Mean Sun On This Day Is: ", (new_RA)
print,""
RAms = new_RA
endif
; Prints the RA if it is less than 24
if RA le 24 then begin
print,"Right Ascension Of The Mean Sun On This Day Is: ", RA
print,""
RAms = RA
endif
endif ; End if Search Mode 2 is picked
; Repeats this question until the user picks a choice that is available
repeat begin
print,"Would You Like To Calculate A New RA?"
read,end_RASun,prompt="|1 = Yes| |0 = No| "
print,""
endrep until end_RASun le 1
endrep until end_RASun eq 0 ; Ends the RASun calculation
; Calculates Local Sidereal Time for observation date and time
LST = RAms + HAms
; Displays the information calculated
print,"The Local Sidereal Time Is: ",LST
print,""
; Adds and subtracts 6 hours to the RA hour.
; The calculated RA will be transiting the meridian so adding and subtracting 6 will give the RA values on the horizon to the east and west
RA_w = LST - 6
RA_e = LST + 6
; Shows the RA hours on the horizon
print,"Looking South At This Time, Sources With An RA Hour Between The Following Two Values Will Be Visible. "
print,""
print,"RA To The East ",RA_e
print,"RA To The West ",RA_w
print,""
endif ; End if Time Mode 1 is picked
endif ; End if Search Option 2 is picked
;print,"RA_e:", RA_e
;print,"RA_w:", RA_w
repeat begin
print,"Would You Like To Return To The Home Menu?"
read,over,prompt="|1 - Yes| |0 - No| "
endrep until over le 1
endif ; End if for Home Menu option 1
; If Home Menu option 2 is picked do this
if choice eq 2 then begin
; Prints something to make the user experience a bit better
print,""
print,"...Accessing Calculations..." ; User experience
print,""
; Show options for what the user can calculate
; Repeats until one of the options is picked
repeat begin
print,"What Would You Like To Calculate?"
read,mode,prompt="|1 - Day of Year| |2 - Declination of the Mean Sun| |3 - Right Ascension of the Mean Sun| |4 - Telescope Calculations| "
print,""
endrep until (mode ge 1) && (mode le 4)
; If Calculation Mode 1 is picked do this
if mode eq 1 then begin
; Repeats mode 1 until the user wants to stop
repeat begin
; Input Month
; Repeats until the user enters a number that corresponds to a month
repeat begin
read,Mon,prompt="Enter Month in MM Format: "
print,""
endrep until (Mon gt 0) && (Mon le 12)
; Input Date
; Repeats until the user enters a number that corresponds to a date
repeat begin
read,Date,prompt="Enter Date in DD Format: "
print,""
endrep until (Date gt 0) && (Date le 31)
; Determine the day of the year from the date
DoY=0
; Creates an array that contains the day numbers of the firsts of each month to calculate the day of the year
DoMon=[0,31,59,90,120,151,181,212,243,273,304,334]
; Calculates the day of the year
DoY=DoMon[Mon-1] + Date
; display the calculated day of the year
print,"The Day Of The Year is: ",DoY
print,""
; Repeats the question until the user picks one of the options
repeat begin
print,"Would You Like To Calculate Again?"
read,end_DOY,prompt="|1 = Yes| |0 = No| "
print,""
endrep until end_DOY le 1
endrep until end_DOY eq 0 ; End DOY calculation
endif ; End if Calculation Mode 1 is picked
; If Calculation Mode 2 is picked do this
if mode eq 2 then begin
; Repeats the beginning question until one of the choices is picked
repeat begin
; Repeats the calculation until the user wants to stop
repeat begin
; Offer choices for how to calculate Dec of the Mean Sun
repeat begin
print,"How Would You Like To Calculate Declination Of The Mean Sun?"
read,mode,prompt="|1 = Using Day Of The Julian Calendar| |2 = Using Days Since Vernal Equinox| "
print,""
endrep until (mode le 2) && (mode ge 1)
; If mode 1 is picked then do this
if mode eq 1 then begin
; user inputs for calculation
repeat begin
read,t,prompt="What Day Of The Julian Calendar Would You Like To Use? "
print,""
endrep until (t ge 1) && (t le 365)
; Calculate Dec of the Mean Sun and display
Dec = 23.5*sin((2*!pi/365)*(t-79))
print,"Declination Of The Mean Sun On This Day Is: ", Dec
print,""
endif ; End if mode 1 is picked
; If mode 2 is picked then do this
if mode eq 2 then begin
; User inputs for calculation
read,tv,prompt="How Many Days Since The Vernal Equinox? "
print,""
; Calculate Dec of the Mean Sun and display