forked from jlustigy/coronagraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_safe.py
executable file
·1428 lines (1255 loc) · 61.8 KB
/
main_safe.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
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
#####BOKEH CORONAGRAPH NOISE MODEL SIMULATOR#####
# This code produces an interactive browser widget that runs
# the coronagraph noise model
#
#
# To run this code on your local machine, type
# bokeh serve --show coron_model.py
#
################################################
# Import some standard python packages
from __future__ import print_function
import numpy as np
from astropy.io import fits, ascii
import pdb
import sys
import os
from astropy.table import Table, Column
import os
from bokeh.io import curdoc
from bokeh.client import push_session
from bokeh.themes import Theme
import yaml
from bokeh.plotting import Figure
from bokeh.models import ColumnDataSource, HBox, HoverTool, Paragraph, Range1d, DataRange1d, Label, DataSource
from bokeh.models.glyphs import Text
from bokeh.layouts import column, row, WidgetBox
from bokeh.models.widgets import Slider, Panel, Tabs, Div, TextInput, RadioButtonGroup, Select, RadioButtonGroup
from bokeh.io import curdoc, output_file, show
from bokeh.models.callbacks import CustomJS
from bokeh.embed import components, autoload_server
import coronagraph as cg # Import coronagraph model
import coron_help as h
cwd = os.getenv('LUVOIR_SIMTOOLS_DIR')
#allow it to run it from other folders and still know where planet folder is
#planetdir = "../coronagraph/planets/" #new path compared to before
relpath = cwd+'coron_model/coronagraph/planets/' #### os.path.join(os.path.dirname(__file__), planetdir)
################################
# PARAMETERS
################################
# Integration time (hours)
Dt = 24.0 # - SLIDER
# Telescopes params
diam = 12.2 # mirror diameter - SLIDER
Res = 150. # vis resolution - SLIDER
Res_UV = 20. # UV resolution - SLIDER
Res_NIR = 100. #NIR resolution - SLIDER
Tsys = 270. # system temperature - SLIDER
# Planet params
alpha = 90. # phase angle at quadrature
Phi = 1. # phase function at quadrature (already included in SMART run)
Rp = 1.0 # Earth radii - SLIDER
r = 1.0 # semi-major axis (AU) - SLIDER
# Stellar params
Teff = 5780. # Sun-like Teff (K)
Rs = 1. # star radius in solar radii
# Planetary system params
d = 10. # distance to system (pc) - SLIDER
Nez = 3. # number of exo-zodis - SLIDER
# Instrumental Params
owa = 30. #OWA scaling factor - SLIDER
iwa = 2. #IWA scaling factor - SLIDER
De = 1e-4 # dark current -
Re = 0.1 # read noise -
Dtmax = 1.0 # max single exposure time - SLIDER
wantsnr = 10. #for exposure time calculator - SLIDER
# Template
template = ''
global template
global comparison
global Teff
global Ts
################################
# READ-IN DATA
# Read-in Earth spectrum file to start
fn = 'earth_quadrature_radiance_refl.dat'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=8)
lamhr = model[:,0]
radhr = model[:,1]
solhr = model[:,2]
# Calculate hi-resolution reflectivity
Ahr = np.pi*(np.pi*radhr/solhr)
solhr = cg.noise_routines.Fstar(lamhr, Teff, Rs, r, AU=True) # stellar flux blackbody for comparison
lammin = 0.2
lammax = 3.
planet_label = ['Synthetic spectrum generated by T. Robinson (Robinson et al. 2011)']
Ahr_ = Ahr
lamhr_ = lamhr
solhr_ = solhr
Teff_ = Teff
Rs_ = Rs
################################
# RUN CORONAGRAPH MODEL
################################
# Run coronagraph with default LUVOIR telescope
lam, dlam, A, q, Cratio, cp, csp, cz, cez, cD, cR, cth, DtSNR = \
cg.count_rates(Ahr, lamhr, solhr, alpha, Rp, Teff, Rs, r, d, Nez, lammin=lammin, lammax=lammax, Res=Res, Res_UV = Res_UV, Res_NIR = Res_NIR, diam=diam, Tsys=Tsys, IWA=iwa, OWA=owa,De=De, Re=Re, Dtmax=Dtmax, GROUND=False, THERMAL=True, wantsnr=wantsnr)
# Calculate background photon count rates
cb = (cz + cez + csp + cD + cR + cth)
# Convert hours to seconds
Dts = Dt * 3600.
# Calculate signal-to-noise assuming background subtraction (the "2")
SNR = cp*Dts/np.sqrt((cp + 2*cb)*Dts)
# Calculate 1-sigma errors
sig= Cratio/SNR
# Add gaussian noise to flux ratio
spec = Cratio + np.random.randn(len(Cratio))*sig
#update params
lastlam = lam
lastCratio = Cratio
snr_ymax_ = np.max(Cratio)*1e9
yrange=[snr_ymax_]
snr_ymin_ = np.min(Cratio)*1e9
lamC = lastlam * 0.
CratioC = lastCratio * 0.
global lamC
global CratioC
#data
planet = ColumnDataSource(data=dict(lam=lam, cratio=Cratio*1e9, spec=spec*1e9, downerr=(spec-sig)*1e9, uperr=(spec+sig)*1e9, cz=cz*Dts, cez=cez*Dts, csp=csp*Dts, cD=cD*Dts, cR=cR*Dts, cth=cth*Dts, cp=cp*Dts))
expplanet = ColumnDataSource(data=dict(lam=lam[np.isfinite(DtSNR)], DtSNR=DtSNR[np.isfinite(DtSNR)]))
plotyrange = ColumnDataSource(data = dict(yrange=yrange))
compare = ColumnDataSource(data=dict(lam=lamC, cratio=Cratio*1e9))
expcompare = ColumnDataSource(data=dict(lam=lam[np.isfinite(DtSNR)], DtSNR=DtSNR[np.isfinite(DtSNR)]*(-1000000))) #to make it not show up
textlabel = ColumnDataSource(data=dict(label = planet_label))
################################
# BOKEH PLOTTING
################################
#plots spectrum and exposure time
snr_plot = Figure(plot_height=500, plot_width=750,
tools="crosshair,pan,reset,save,box_zoom,wheel_zoom,resize,hover",
toolbar_location='right', x_range=[0.2, 3.0], y_range=[0, 0.2])
exp_plot = Figure(plot_height=500, plot_width=750,
tools="crosshair,pan,reset,save,box_zoom,wheel_zoom,resize,hover",
toolbar_location='right', x_range=[0.2, 3.0], y_range=[1e-3, 1e10],
y_axis_type="log")
snr_plot.background_fill_color = "beige"
snr_plot.background_fill_alpha = 0.5
snr_plot.yaxis.axis_label='F_p/F_s (x10^9)'
snr_plot.xaxis.axis_label='Wavelength [micron]'
snr_plot.title.text = 'Planet Spectrum: Earth' #initial spectrum is Earth
exp_plot.background_fill_color = "beige"
exp_plot.background_fill_alpha = 0.5
exp_plot.yaxis.axis_label='Integration time for SNR = 10 [hours]'
exp_plot.xaxis.axis_label='Wavelength [micron]'
exp_plot.title.text = 'Planet Spectrum: Earth' #initial spectrum is Earth
snr_plot.line('lam','cratio',source=compare,line_width=2.0, color="navy", alpha=0.7)
snr_plot.line('lam','cratio',source=planet,line_width=2.0, color="darkgreen", alpha=0.7)
snr_plot.circle('lam', 'spec', source=planet, fill_color='lightgreen', line_color='black', size=8)
snr_plot.segment('lam', 'downerr', 'lam', 'uperr', source=planet, line_width=1, line_color='grey', line_alpha=0.5)
exp_plot.line('lam','DtSNR',source=expcompare,line_width=2.0, color="navy", alpha=0.7)
exp_plot.line('lam','DtSNR',source=expplanet,line_width=2.0, color="darkgreen", alpha=0.7)
#text on plot
glyph = Text(x=0.25, y=snr_ymin_*0.95, text="label", text_font_size='9pt', text_font_style='bold', text_color='blue')
#attempting to outline the text here for ease of visibility...
glyph2 = Text(x=0.245, y=snr_ymin_*0.95, text="label", text_font_size='9pt', text_font_style='bold', text_color='white')
glyph3 = Text(x=0.25, y=snr_ymin_*0.935, text="label", text_font_size='9pt', text_font_style='bold', text_color='white')
glyph4 = Text(x=0.25, y=snr_ymin_*0.965, text="label", text_font_size='9pt', text_font_style='bold', text_color='white')
glyph5 = Text(x=0.255, y=snr_ymin_*0.95, text="label", text_font_size='9pt', text_font_style='bold', text_color='white')
snr_plot.add_glyph(textlabel, glyph2)
snr_plot.add_glyph(textlabel, glyph3)
snr_plot.add_glyph(textlabel, glyph4)
snr_plot.add_glyph(textlabel, glyph5)
snr_plot.add_glyph(textlabel, glyph)
#hovertool
hover = snr_plot.select(dict(type=HoverTool))
hover.tooltips = [
('planet', '@cp{int}'),
('zodi', '@cz{int}'),
('exozodi', '@cez{int}'),
('dark current', '@cD{int}'),
('read noise', '@cR{int}'),
('speckle noise', '@csp{int}'),
('thermal', '@cth{int}')
]
ptab1 = Panel(child=snr_plot, title='Spectrum')
ptab2 = Panel(child=exp_plot, title='Exposure Time')
ptabs = Tabs(tabs=[ptab1, ptab2])
#show(ptabs)
################################
# PROGRAMS
################################
def change_filename(attrname, old, new):
format_button_group.active = None
instruction0 = Div(text="""Specify a filename here
(no special characters):""", width=300, height=12)
text_input = TextInput(value="filename", title=" ", width=100)
instruction1 = Div(text="""Then choose a file format here:""", width=300, height=12)
format_button_group = RadioButtonGroup(labels=["txt", "fits"])
instruction2 = Div(text="""The link to download your file will appear here:""", width=300, height=12)
link_box = Div(text=""" """, width=300, height=15)
def i_clicked_a_button(new):
filename=text_input.value + {0:'.txt', 1:'.fits'}[format_button_group.active]
print("Your format is ", format_button_group.active, {0:'txt', 1:'fits'}[format_button_group.active])
print("Your filename is: ", filename)
fileformat={0:'txt', 1:'fits'}[format_button_group.active]
link_box.text = """Working"""
t = Table(planet.data)
t = t['lam', 'spec','cratio','uperr','downerr']
if (format_button_group.active == 1): t.write(filename, overwrite=True)
if (format_button_group.active == 0): ascii.write(t, filename)
filename = cwd+'outputs/'+filename
print('file coming', filename)
os.system('gzip -f ' +filename)
os.system('cp -rp '+filename+'.gz outputs')
print( """Your file is <a href='http://jt-astro.science/outputs/"""+filename+""".gz'>"""+filename+""".gz</a>. """)
link_box.text = """Your file is <a href='http://jt-astro.science/outputs/"""+filename+""".gz'>"""+filename+""".gz</a>. """
#########################################
# GET DATA FROM USER AND UPDATE PLOT
#########################################
def update_data(attrname, old, new):
print('Updating model for exptime = ', exptime.value, ' for planet with R = ', radius.value, ' at distance ', distance.value, ' parsec ')
print(' exozodi = ', exozodi.value, 'diameter (m) = ', diameter.value, 'resolution = ', resolution.value, 'resolution uv =', resolution_UV.value, 'resolution nir =', resolution_NIR.value)
print(' temperature (K) = ', temperature.value, 'IWA = ', inner.value, 'OWA = ', outer.value)
print('You have chosen planet spectrum: ', template.value)
print('You have chosen comparison spectrum: ', comparison.value)
try:
lasttemplate
except NameError:
lasttemplate = 'Earth' #default first spectrum
try:
lastcomparison
except NameError:
lastcomparison = 'none' #default first spectrum
global lasttemplate
global Ahr_
global lamhr_
global solhr_
global Teff_
global Rs_
global Ahr_c
global lamhr_c
global solhr_c
global Teff_c
global Rs_c
global radius_c
global semimajor_c
global lastcomparison
# Read-in new spectrum file only if changed
if template.value != lasttemplate:
if template.value == 'Earth':
fn = 'earth_quadrature_radiance_refl.dat'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=8)
lamhr_ = model[:,0]
radhr_ = model[:,1]
solhr_ = model[:,2]
Ahr_ = np.pi*(np.pi*radhr_/solhr_)
semimajor.value = 1.
radius.value = 1.
Teff_ = 5780. # Sun-like Teff (K)
Rs_ = 1. # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr, Teff, Rs, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by T. Robinson (Robinson et al. 2011)']
if template.value == 'Venus':
fn = 'new_venus.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_ = model[:,0]
Fhr_ = model[:,3]
solhr_ = model[:,2]
Ahr_ = (Fhr_/solhr_)
lamhr_ = lamhr_[::-1]
Ahr_ = Ahr_[::-1]
semimajor.value = 0.72
radius.value = 0.94
Teff_ = 5780. # Sun-like Teff (K)
Rs_ = 1. # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by G. Arney']
if template.value =='Archean Earth':
fn = 'ArcheanEarth_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=8)
lamhr_ = model[:,0]
Ahr_ = model[:,1]
semimajor.value = 1.
radius.value = 1.
Teff_ = 5780. # Sun-like Teff (K)
Rs_ = 1. # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by G. Arney (Arney et al. 2016)']
if template.value =='Hazy Archean Earth':
fn = 'Hazy_ArcheanEarth_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=8)
lamhr_ = model[:,0]
Ahr_ = model[:,1]
semimajor.value = 1.
radius.value = 1.
Teff_ = 5780. # Sun-like Teff (K)
Rs_ = 1. # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by G. Arney (Arney et al. 2016)']
if template.value =='1% PAL O2 Proterozoic Earth':
fn = 'proterozoic_hi_o2_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_ = model[:,0]
Ahr_ = model[:,1]
semimajor.value = 1.
radius.value = 1.
Teff_ = 5780. # Sun-like Teff (K)
Rs_ = 1. # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by G. Arney (Arney et al. 2016)']
if template.value =='0.1% PAL O2 Proterozoic Earth':
fn = 'proterozoic_low_o2_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_ = model[:,0]
Ahr_ = model[:,1]
semimajor.value = 1.
radius.value = 1.
Teff_ = 5780. # Sun-like Teff (K)
Rs_ = 1. # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by G. Arney (Arney et al. 2016)']
if template.value =='Early Mars':
fn = 'EarlyMars_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=8)
lamhr_ = model[:,0]
Ahr_ = model[:,1]
semimajor.value = 1.52
radius.value = 0.53
Teff_ = 5780. # Sun-like Teff (K)
Rs_ = 1. # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by G. Arney based on Smith et al. 2014']
if template.value =='Mars':
fn = 'Mars_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=8)
lamhr_ = model[:,0]
Ahr_ = model[:,1]
semimajor.value = 1.52
radius.value = 0.53
Teff_ = 5780. # Sun-like Teff (K)
Rs_ = 1. # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by T. Robinson']
if template.value =='Jupiter':
fn = 'Jupiter_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_ = model[:,0]
Ahr_ = model[:,1]
semimajor.value = 5.46
radius.value = 10.97
Teff_ = 5780. # Sun-like Teff (K)
Rs_ = 1. # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['0.9-0.3 microns observed by Karkoschka et al. (1998); 0.9-2.4 microns observed by Rayner et al. (2009)']
if template.value =='Saturn':
fn = 'Saturn_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_ = model[:,0]
Ahr_ = model[:,1]
semimajor.value = 9.55
radius.value = 9.14
Teff_ = 5780. # Sun-like Teff (K)
Rs_ = 1. # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['0.9-0.3 microns observed by Karkoschka et al. (1998); 0.9-2.4 microns observed by Rayner et al. (2009)']
if template.value =='Uranus':
fn = 'Uranus_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_ = model[:,0]
Ahr_ = model[:,1]
semimajor.value = 19.21
radius.value = 3.98
Teff_ = 5780. # Sun-like Teff (K)
Rs_ = 1. # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['0.9-0.3 microns observed by Karkoschka et al. (1998); 0.9-2.4 microns observed by Rayner et al. (2009)']
if template.value =='Neptune':
fn = 'Neptune_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_ = model[:,0]
Ahr_ = model[:,1]
semimajor.value = 29.8
radius.value = 3.86
Teff_ = 5780. # Sun-like Teff (K)
Rs_ = 1. # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['0.9-0.3 microns observed by Karkoschka et al. (1998); 0.9-2.4 microns observed by Rayner et al. (2009)']
if template.value =='Warm Neptune at 2 AU':
fn = 'Reflection_a2_m1.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_ = model[:,0]
Ahr_ = model[:,1]
lamhr_ = lamhr_ / 1000. #convert to microns
Ahr_ = Ahr_ * 0.67 #convert to geometric albedo
semimajor.value = 2.0
radius.value = 3.86
Teff_ = 5780. # Sun-like Teff (K)
Rs_ = 1. # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by R. Hu (Hu and Seager 2014)']
if template.value =='Warm Neptune w/o Clouds at 1 AU':
fn = 'Reflection_a1_m2.6_LM_NoCloud.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_ = model[:,0]
Ahr_ = model[:,1]
lamhr_ = lamhr_ / 1000. #convert to microns
Ahr_ = Ahr_ * 0.67 #convert to geometric albedo
semimajor.value = 1.0
radius.value = 3.86
Teff_ = 5780. # Sun-like Teff (K)
Rs_ = 1. # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by R. Hu (Hu and Seager 2014)']
if template.value =='Warm Neptune w/ Clouds at 1 AU':
fn = 'Reflection_a1_m2.6_LM.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_ = model[:,0]
Ahr_ = model[:,1]
lamhr_ = lamhr_ / 1000. #convert to microns
Ahr_ = Ahr_ * 0.67 #convert to geometric albedo
semimajor.value = 1.0
radius.value = 3.86
Teff_ = 5780. # Sun-like Teff (K)
Rs_ = 1. # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by R. Hu']
if template.value =='Warm Jupiter at 0.8 AU':
fn = '0.8AU_3x.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=1)
lamhr_ = model[:,1]
Ahr_ = model[:,3]
semimajor.value = 0.8
radius.value = 10.97
Teff_ = 5780. # Sun-like Teff (K)
Rs_ = 1. # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by K. Cahoy (Cahoy et al. 2010)']
if template.value =='Warm Jupiter at 2 AU':
fn = '2AU_3x.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=1)
lamhr_ = model[:,1]
Ahr_ = model[:,3]
semimajor.value = 2.0
radius.value = 10.97
Teff_ = 5780. # Sun-like Teff (K)
Rs_ = 1. # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by K. Cahoy (Cahoy et al. 2010)']
if template.value =='False O2 Planet (F2V star)':
fn = 'fstarcloudy_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_ = model[:,0]
Ahr_ = model[:,1]
semimajor.value = 1.72 #Earth equivalent distance for F star
radius.value = 1.
Teff_ = 7050. # F2V Teff (K)
Rs_ = 1.3 # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by S. Domagal-Goldman (Domagal-Goldman et al. 2014)']
if template.value =='Proxima Cen b 10 bar 95% O2 dry':
fn = 'Proxima15_o2lb_10bar_dry.pt_filtered_hitran2012_50_100000cm_toa.rad'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=1)
lamhr_ = model[:,0]
solhr_ = model[:,2]
Flx_ = model[:,3]
Ahr_ = Flx_/solhr_
lamhr_ = lamhr_[::-1]
Ahr_ = Ahr_[::-1]
semimajor.value = 0.048
radius.value = 1.
distance.value = 1.3
Teff_ = 3040. # Sun-like Teff (K)
Rs_ = 0.141 # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by E. Schwieterman (Meadows et al. 2016)']
if template.value =='Proxima Cen b 10 bar 95% O2 wet':
fn = 'Proxima15_o2lb_10bar_h2o.pt_filtered_hitran2012_50_100000cm_toa.rad'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=1)
lamhr_ = model[:,0]
solhr_ = model[:,2]
Flx_ = model[:,3]
Ahr_ = Flx_/solhr_
lamhr_ = lamhr_[::-1]
Ahr_ = Ahr_[::-1]
semimajor.value = 0.048
radius.value = 1.
distance.value=1.3
Teff_ = 3040. # Sun-like Teff (K)
Rs_ = 0.141 # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by E. Schwieterman (Meadows et al. 2016)']
if template.value =='Proxima Cen b 10 bar O2-CO2':
fn = 'Proxima16_O2_CO2_10bar_prox_hitran2012_50_100000cm_toa.rad'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=1)
lamhr_ = model[:,0]
solhr_ = model[:,2]
Flx_ = model[:,3]
Ahr_ = Flx_/solhr_
lamhr_ = lamhr_[::-1]
Ahr_ = Ahr_[::-1]
semimajor.value = 0.048
radius.value = 1.
distance.value = 1.3
Teff_ = 3040. # Sun-like Teff (K)
Rs_ = 0.141 # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by E. Schwieterman (Meadows et al. 2016)']
if template.value =='Proxima Cen b 90 bar O2-CO2':
fn = 'Proxima16_O2_CO2_90bar_prox_hitran2012_50_100000cm_toa.rad'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=1)
lamhr_ = model[:,0]
solhr_ = model[:,2]
Flx_ = model[:,3]
Ahr_ = Flx_/solhr_
lamhr_ = lamhr_[::-1]
Ahr_ = Ahr_[::-1]
semimajor.value = 0.048
radius.value = 1.
distance.value = 1.3
Teff_ = 3040. # Sun-like Teff (K)
Rs_ = 0.141 # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by E. Schwieterman (Meadows et al. 2016)']
if template.value =='Proxima Cen b 90 bar Venus':
fn = 'Proxima17_smart_spectra_Venus90bar_clouds_500_100000cm-1_toa.rad'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=1)
lamhr_ = model[:,0]
solhr_ = model[:,2]
Flx_ = model[:,3]
Ahr_ = Flx_/solhr_
lamhr_ = lamhr_[::-1]
Ahr_ = Ahr_[::-1]
semimajor.value = 0.048
radius.value = 1.
distance.value = 1.3
Teff_ = 3040. # Sun-like Teff (K)
Rs_ = 0.141 # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by G. Arney (Meadows et al. 2016)']
if template.value =='Proxima Cen b 10 bar Venus':
fn = 'Proxima17_smart_spectra_Venus10bar_cloudy_500_100000cm-1_toa.rad'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=1)
lamhr_ = model[:,0]
solhr_ = model[:,2]
Flx_ = model[:,3]
Ahr_ = Flx_/solhr_
lamhr_ = lamhr_[::-1]
Ahr_ = Ahr_[::-1]
semimajor.value = 0.048
radius.value = 1.
distance.value = 1.3
Teff_ = 3040. # Sun-like Teff (K)
Rs_ = 0.141 # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by G. Arney (Meadows et al. 2016)']
if template.value =='Proxima Cen b CO2/CO/O2 dry':
fn = 'Proxima18_gao_toa.rad'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=1)
lamhr_ = model[:,0]
solhr_ = model[:,2]
Flx_ = model[:,3]
Ahr_ = Flx_/solhr_
lamhr_ = lamhr_[::-1]
Ahr_ = Ahr_[::-1]
semimajor.value = 0.048
radius.value = 1.
distance.value = 1.3
Teff_ = 3040. # Sun-like Teff (K)
Rs_ = 0.141 # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by E. Schwieterman based on work by P. Gao (Meadows et al. 2016; Gao et al. 2015)']
if template.value =='Proxima Cen b Earth':
# this one needs a weighted average
fn = 'Proxima19_earth_prox.pt_stratocum_hitran2012_50_100000cm_toa.rad'
fn1 = 'Proxima19_earth_prox.pt_filtered_hitran2012_50_100000cm_toa.rad'
fn2 = 'Proxima19_earth_prox.pt_stratocum_hitran2012_50_100000cm_toa.rad'
fn = os.path.join(relpath, fn)
fn1 = os.path.join(relpath, fn1)
fn2 = os.path.join(relpath, fn2)
model = np.loadtxt(fn, skiprows=1)
lamhr_ = model[:,0]
solhr_ = model[:,2]
Flx_ = model[:,3]
model1 = np.loadtxt(fn1, skiprows=1)
lamhr_1 = model1[:,0]
solhr_1 = model1[:,2]
Flx_1 = model1[:,3]
model2 = np.loadtxt(fn2, skiprows=1)
lamhr_2 = model2[:,0]
solhr_2 = model2[:,2]
Flx_2 = model2[:,3]
Ahr_ = Flx_/solhr_
Ahr_1 = Flx_1/solhr_1
Ahr_2 = Flx_2/solhr_2
Ahr_ = (Ahr_*0.25+Ahr_2*0.25+Ahr_1*0.5)
lamhr_ = lamhr_[::-1]
Ahr_ = Ahr_[::-1]
semimajor.value = 0.048
radius.value = 1.
distance.value = 1.3
Teff_ = 3040. # Sun-like Teff (K)
Rs_ = 0.141 # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by E. Schwieterman (Meadows et al. 2016)']
if template.value =='Proxima Cen b Archean Earth':
fn = 'Proxima21_HAZE_msun21_0.0Ga_1.00e-02ch4_rmix_5.0E-2__30.66fscale_toa.rad'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=1)
lamhr_ = model[:,0]
solhr_ = model[:,2]
Flx_ = model[:,3]
Ahr_ = Flx_/solhr_
lamhr_ = lamhr_[::-1]
Ahr_ = Ahr_[::-1]
semimajor.value = 0.048
radius.value = 1.
distance.value = 1.3
Teff_ = 3040. # Sun-like Teff (K)
Rs_ = 0.141 # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by G. Arney (Meadows et al. 2016)']
if template.value =='Proxima Cen b hazy Archean Earth':
fn = 'Proxima21_HAZE_msun21_0.0Ga_3.00e-02ch4_rmix_5.0E-2__30.66fscale_toa.rad'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=1)
lamhr_ = model[:,0]
solhr_ = model[:,2]
Flx_ = model[:,3]
Ahr_ = Flx_/solhr_
lamhr_ = lamhr_[::-1]
Ahr_ = Ahr_[::-1]
semimajor.value = 0.048
radius.value = 1.
distance.value = 1.3
Teff_ = 3040. # Sun-like Teff (K)
Rs_ = 0.141 # star radius in solar radii
solhr_ = cg.noise_routines.Fstar(lamhr_, Teff_, Rs_, semimajor.value, AU=True)
planet_label = ['Synthetic spectrum generated by G. Arney (Meadows et al. 2016)']
global lammin
global lammax
global planet_label
lammin=min(lamhr_)
if lammin <= 0.2:
lammin = 0.2
lammax=3.
print("ground based = ", ground_based.value)
if ground_based.value == "No":
ground_based_ = False
if ground_based.value == "Yes":
ground_based_ = True
# Run coronagraph
lam, dlam, A, q, Cratio, cp, csp, cz, cez, cD, cR, cth, DtSNR = \
cg.count_rates(Ahr_, lamhr_, solhr_, alpha, radius.value, Teff_, Rs_, semimajor.value, distance.value, exozodi.value, diam=diameter.value, Res=resolution.value, Res_UV = resolution_UV.value, Res_NIR = resolution_NIR.value, Tsys=temperature.value, IWA=inner.value, OWA=outer.value, lammin=lammin, lammax=lammax, De=De, Re=Re, Dtmax = dtmax.value, THERMAL=True, GROUND=ground_based_, wantsnr=want_snr.value)
# Calculate background photon count rates
cb = (cz + cez + csp + cD + cR + cth)
# Convert hours to seconds
Dts = exptime.value * 3600.
# Calculate signal-to-noise assuming background subtraction (the "2")
SNR = cp*Dts/np.sqrt((cp + 2*cb)*Dts)
# Calculate 1-sigma errors
sig= Cratio/SNR
# Add gaussian noise to flux ratio
spec = Cratio + np.random.randn(len(Cratio))*sig
lastlam = lam
lastCratio = Cratio
global lastlam
global lastCratio
#UPDATE DATA
planet.data = dict(lam=lam, cratio=Cratio*1e9, spec=spec*1e9, downerr=(spec-sig)*1e9, uperr=(spec+sig)*1e9, cz=cz*Dts, cez=cez*Dts, csp=csp*Dts, cD=cD*Dts, cR=cR*Dts, cth=cth*Dts, cp=cp*Dts)
expplanet.data = dict(lam=lam[np.isfinite(DtSNR)], DtSNR=DtSNR[np.isfinite(DtSNR)])
#make the data the time for a given SNR if user wants this:
textlabel.data = dict(label=planet_label)
format_button_group.active = None
lasttemplate = template.value
#IF YOU WANT COMPARISON SPECTRUM:
if comparison.value != lastcomparison:
if comparison.value == 'Earth':
fn = 'earth_quadrature_radiance_refl.dat'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=8)
lamhr_c = model[:,0]
radhr_c = model[:,1]
solhr_c = model[:,2]
Ahr_c = np.pi*(np.pi*radhr_c/solhr_c)
semimajor_c = 1.
radius_c = 1.
Teff_c = 5780. # Sun-like Teff (K)
Rs_c = 1. # star radius in solar radii
solhr_c = cg.noise_routines.Fstar(lamhr_c, Teff_c, Rs_c, semimajor_c, AU=True)
planet_label_c = ['Synthetic spectrum generated by T. Robinson (Robinson et al. 2011)']
if comparison.value == 'Venus':
fn = 'new_venus.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_c = model[:,0]
Fhr_c = model[:,3]
solhr_c = model[:,2]
Ahr_c = (Fhr_c/solhr_c)
lamhr_c = lamhr_c[::-1]
Ahr_c = Ahr_c[::-1]
semimajor_c = 0.72
radius_c = 0.94
Teff_c = 5780. # Sun-like Teff (K)
Rs_c = 1. # star radius in solar radii
solhr_c = cg.noise_routines.Fstar(lamhr_c, Teff_c, Rs_c, semimajor_c, AU=True)
planet_label_c = ['Synthetic spectrum generated by G. Arney']
if comparison.value =='Archean Earth':
fn = 'ArcheanEarth_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=8)
lamhr_c = model[:,0]
Ahr_c = model[:,1]
semimajor_c = 1.
radius_c = 1.
Teff_c = 5780. # Sun-like Teff (K)
Rs_c = 1. # star radius in solar radii
solhr_c = cg.noise_routines.Fstar(lamhr_c, Teff_c, Rs_c, semimajor_c, AU=True)
planet_label_c = ['Synthetic spectrum generated by G. Arney (Arney et al. 2016)']
if comparison.value =='Hazy Archean Earth':
fn = 'Hazy_ArcheanEarth_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=8)
lamhr_c = model[:,0]
Ahr_c = model[:,1]
semimajor_c = 1.
radius_c = 1.
Teff_c = 5780. # Sun-like Teff (K)
Rs_c = 1. # star radius in solar radii
solhr_c = cg.noise_routines.Fstar(lamhr_c, Teff_c, Rs_c, semimajor_c, AU=True)
planet_label_c = ['Synthetic spectrum generated by G. Arney (Arney et al. 2016)']
if comparison.value =='1% PAL O2 Proterozoic Earth':
fn = 'proterozoic_hi_o2_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_c = model[:,0]
Ahr_c = model[:,1]
semimajor_c = 1.
radius_c = 1.
Teff_c = 5780. # Sun-like Teff (K)
Rs_c = 1. # star radius in solar radii
solhr_c = cg.noise_routines.Fstar(lamhr_c, Teff_c, Rs_c, semimajor_c, AU=True)
planet_label_c = ['Synthetic spectrum generated by G. Arney (Arney et al. 2016)']
if comparison.value =='0.1% PAL O2 Proterozoic Earth':
fn = 'proterozoic_low_o2_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_c = model[:,0]
Ahr_c = model[:,1]
semimajor_c = 1.
radius_c = 1.
Teff_c = 5780. # Sun-like Teff (K)
Rs_c = 1. # star radius in solar radii
solhr_c = cg.noise_routines.Fstar(lamhr_c, Teff_c, Rs_c, semimajor_c, AU=True)
planet_label_c = ['Synthetic spectrum generated by G. Arney (Arney et al. 2016)']
if comparison.value =='Early Mars':
fn = 'EarlyMars_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=8)
lamhr_c = model[:,0]
Ahr_c = model[:,1]
semimajor_c = 1.52
radius_c = 0.53
Teff_c = 5780. # Sun-like Teff (K)
Rs_c = 1. # star radius in solar radii
solhr_c = cg.noise_routines.Fstar(lamhr_c, Teff_c, Rs_c, semimajor_c, AU=True)
planet_label_c = ['Synthetic spectrum generated by G. Arney based on Smith et al. 2014']
if comparison.value =='Mars':
fn = 'Mars_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=8)
lamhr_c = model[:,0]
Ahr_c = model[:,1]
semimajor_c = 1.52
radius_c = 0.53
Teff_c = 5780. # Sun-like Teff (K)
Rs_c = 1. # star radius in solar radii
solhr_c = cg.noise_routines.Fstar(lamhr_c, Teff_c, Rs_c, semimajor_c, AU=True)
planet_label_c = ['Synthetic spectrum generated by T. Robinson']
if comparison.value =='Jupiter':
fn = 'Jupiter_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_c = model[:,0]
Ahr_c = model[:,1]
semimajor_c = 5.46
radius_c = 10.97
Teff_c = 5780. # Sun-like Teff (K)
Rs_c = 1. # star radius in solar radii
solhr_c = cg.noise_routines.Fstar(lamhr_c, Teff_c, Rs_c, semimajor_c, AU=True)
planet_label_c = ['0.9-0.3 microns observed by Karkoschka et al. (1998); 0.9-2.4 microns observed by Rayner et al. (2009)']
if comparison.value =='Saturn':
fn = 'Saturn_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_c = model[:,0]
Ahr_c = model[:,1]
semimajor_c = 9.55
radius_c = 9.14
Teff_c = 5780. # Sun-like Teff (K)
Rs_c = 1. # star radius in solar radii
solhr_c = cg.noise_routines.Fstar(lamhr_c, Teff_c, Rs_c, semimajor_c, AU=True)
planet_label_c = ['0.9-0.3 microns observed by Karkoschka et al. (1998); 0.9-2.4 microns observed by Rayner et al. (2009)']
if comparison.value =='Uranus':
fn = 'Uranus_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_c = model[:,0]
Ahr_c = model[:,1]
semimajor_c = 19.21
radius_c = 3.98
Teff_c = 5780. # Sun-like Teff (K)
Rs_c = 1. # star radius in solar radii
solhr_c = cg.noise_routines.Fstar(lamhr_c, Teff_c, Rs_c, semimajor_c, AU=True)
planet_label_c = ['0.9-0.3 microns observed by Karkoschka et al. (1998); 0.9-2.4 microns observed by Rayner et al. (2009)']
if comparison.value =='Neptune':
fn = 'Neptune_geo_albedo.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_c = model[:,0]
Ahr_c = model[:,1]
semimajor_c = 29.8
radius_c = 3.86
Teff_c = 5780. # Sun-like Teff (K)
Rs_c = 1. # star radius in solar radii
solhr_c = cg.noise_routines.Fstar(lamhr_c, Teff_c, Rs_c, semimajor_c, AU=True)
planet_label_c = ['0.9-0.3 microns observed by Karkoschka et al. (1998); 0.9-2.4 microns observed by Rayner et al. (2009)']
if comparison.value =='Warm Neptune at 2 AU':
fn = 'Reflection_a2_m1.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_c = model[:,0]
Ahr_c = model[:,1]
lamhr_c = lamhr_c / 1000. #convert to microns
Ahr_c = Ahr_c * 0.67 #convert to geometric albedo
semimajor_c = 2.0
radius_c = 3.86
Teff_c = 5780. # Sun-like Teff (K)
Rs_c = 1. # star radius in solar radii
solhr_c = cg.noise_routines.Fstar(lamhr_c, Teff_c, Rs_c, semimajor_c, AU=True)
planet_label_c = ['Synthetic spectrum generated by R. Hu (Hu and Seager 2014)']
if comparison.value =='Warm Neptune w/o Clouds at 1 AU':
fn = 'Reflection_a1_m2.6_LM_NoCloud.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_c = model[:,0]
Ahr_c = model[:,1]
lamhr_c = lamhr_c / 1000. #convert to microns
Ahr_c = Ahr_c* 0.67 #convert to geometric albedo
semimajor_c = 1.0
radius_c = 3.86
Teff_c = 5780. # Sun-like Teff (K)
Rs_c = 1. # star radius in solar radii
solhr_c = cg.noise_routines.Fstar(lamhr_c, Teff_c, Rs_c, semimajor_c, AU=True)
planet_label_c = ['Synthetic spectrum generated by R. Hu (Hu and Seager 2014)']
if comparison.value =='Warm Neptune w/ Clouds at 1 AU':
fn = 'Reflection_a1_m2.6_LM.txt'
fn = os.path.join(relpath, fn)
model = np.loadtxt(fn, skiprows=0)
lamhr_c = model[:,0]
Ahr_c = model[:,1]
lamhr_c = lamhr_c / 1000. #convert to microns
Ahr_c = Ahr_c * 0.67 #convert to geometric albedo
semimajor_c = 1.0