diff --git a/exoctk/data/throughputs/CHEOPS_CHEOPS.band.txt b/exoctk/data/throughputs/CHEOPS_CHEOPS.band.txt new file mode 100644 index 00000000..dbcf7fa4 --- /dev/null +++ b/exoctk/data/throughputs/CHEOPS_CHEOPS.band.txt @@ -0,0 +1,153 @@ +3400 0.0 +3450 0.005238095238095264 +3500 0.01480331262939965 +3550 0.027784679089026997 +3600 0.048907867494824155 +3650 0.09075569358178082 +3700 0.14814699792960673 +3750 0.2063354037267085 +3800 0.2666418219461706 +3850 0.32336291038154436 +3900 0.37528837622005373 +3950 0.4213250517598327 +4000 0.45859903381642164 +4050 0.49228985507245887 +4100 0.5235362318840523 +4150 0.5538020473889972 +4200 0.5828519668736979 +4250 0.6113084886128296 +4300 0.6393664596273252 +4350 0.6664982746721849 +4400 0.6928557625948901 +4450 0.7192132505175952 +4500 0.7413043478260842 +4550 0.7584726867335548 +4600 0.7756410256410254 +4650 0.789003166483985 +4700 0.801381683108026 +4750 0.813760199732067 +4800 0.8262525879917187 +4850 0.8390062111801245 +4900 0.8517598343685302 +4950 0.8645134575569359 +5000 0.87746066252588 +5050 0.890533126293996 +5100 0.9036055900621119 +5150 0.9166780538302279 +5200 0.929165976535542 +5250 0.9410693581780541 +5300 0.9529727398205664 +5350 0.963627329192547 +5400 0.9725548654244309 +5450 0.9797705314009664 +5500 0.984021739130435 +5550 0.9882729468599036 +5600 0.9925241545893723 +5650 0.9965476190476192 +5700 0.9965476190476192 +5750 0.9965476190476192 +5800 0.9965476190476192 +5850 0.9965476190476192 +5900 0.9960992494824018 +5950 0.9925122929606627 +6000 0.9889253364389236 +6050 0.9853383799171844 +6100 0.9804134316770188 +6150 0.9752322722567289 +6200 0.970051112836439 +6250 0.9633255693581781 +6300 0.9553545548654245 +6350 0.9473835403726709 +6400 0.9394125258799173 +6450 0.9314415113871637 +6500 0.9224741200828159 +6550 0.9129089026915115 +6600 0.903343685300207 +6650 0.8937784679089026 +6700 0.8842132505175982 +6750 0.8746480331262939 +6800 0.8650828157349896 +6850 0.8555175983436852 +6900 0.8459523809523809 +6950 0.8365769496204278 +7000 0.8280745341614907 +7050 0.8195721187025535 +7100 0.8110697032436164 +7150 0.8025672877846792 +7200 0.7936397515527952 +7250 0.7834368530020706 +7300 0.7732339544513458 +7350 0.7630310559006211 +7400 0.7525288376220053 +7450 0.7402307009760426 +7500 0.7279325643300798 +7550 0.7156344276841171 +7600 0.7033362910381544 +7650 0.6910381543921916 +7700 0.6779018197668083 +7750 0.6634700882641387 +7800 0.6490383567614689 +7850 0.6346066252587993 +7900 0.6204397737355813 +7950 0.6065474341910678 +8000 0.5926550946465544 +8050 0.5787627551020409 +8100 0.5648704155575275 +8150 0.5509780760130141 +8200 0.5372777896765903 +8250 0.5236446062682946 +8300 0.5100114228599987 +8350 0.49637823945170284 +8400 0.482745056043407 +8450 0.46911187263511117 +8500 0.45449965493443767 +8550 0.4396204278812976 +8600 0.42474120082815753 +8650 0.40987657270265987 +8700 0.39516085363911485 +8750 0.38044513457556983 +8800 0.36572941551202476 +8850 0.35101369644847974 +8900 0.3362979773849347 +8950 0.3214596273291932 +9000 0.3065804002760528 +9050 0.29170117322291245 +9100 0.27689786059351257 +9150 0.2634357027835286 +9200 0.2499735449735447 +9250 0.2365113871635608 +9300 0.22349206349206327 +9350 0.21126984126984122 +9400 0.19904761904761914 +9450 0.1868253968253971 +9500 0.17460317460317504 +9550 0.16297308488612877 +9600 0.15213250517598365 +9650 0.14129192546583855 +9700 0.13045134575569345 +9750 0.12002070393374721 +9800 0.11045548654244296 +9850 0.10089026915113872 +9900 0.09138198757763984 +9950 0.08341097308488621 +10000 0.07543995859213257 +10050 0.06746894409937892 +10100 0.059497929606625276 +10150 0.05175983436853009 +10200 0.04596273291925478 +10250 0.040165631469979465 +10300 0.03436853002070415 +10350 0.028571428571428834 +10400 0.024624741200828346 +10450 0.02196773636991045 +10500 0.01948956840261203 +10550 0.0182632584806499 +10600 0.017036948558687773 +10650 0.015810638636725643 +10700 0.014584328714763515 +10750 0.013358018792801386 +10800 0.012659555315509925 +10850 0.012105049959492301 +10900 0.011550544603474676 +10950 0.01099603924745705 +11000 0.0 diff --git a/exoctk/data/throughputs/TESS_TESS.Red.txt b/exoctk/data/throughputs/TESS_TESS.Red.txt new file mode 100644 index 00000000..83ce0102 --- /dev/null +++ b/exoctk/data/throughputs/TESS_TESS.Red.txt @@ -0,0 +1,561 @@ +5670 0 +5680 0.00010376 +5690 0.00013632 +5700 0.00018166 +5710 0.00024546 +5720 0.00033674 +5730 0.00046958 +5740 0.00066615 +5750 0.00096281 +5760 0.0014197 +5770 0.0021394 +5780 0.0033016 +5790 0.005229 +5800 0.0085175 +5810 0.014294 +5820 0.024716 +5830 0.043845 +5840 0.078669 +5850 0.13808 +5860 0.22389 +5870 0.31647 +5880 0.38681 +5890 0.42959 +5900 0.45957 +5910 0.4907 +5920 0.52992 +5930 0.57909 +5940 0.63664 +5950 0.69842 +5960 0.75855 +5970 0.81102 +5980 0.85157 +5990 0.87899 +6000 0.89486 +6010 0.90246 +6020 0.9051 +6030 0.90551 +6040 0.90547 +6050 0.90588 +6060 0.90698 +6070 0.90863 +6080 0.91051 +6090 0.91228 +6100 0.9137 +6110 0.91465 +6120 0.91518 +6130 0.91541 +6140 0.91546 +6150 0.91551 +6160 0.91569 +6170 0.91608 +6180 0.91673 +6190 0.91761 +6200 0.91867 +6210 0.91984 +6220 0.921 +6230 0.92208 +6240 0.923 +6250 0.92372 +6260 0.92423 +6270 0.92455 +6280 0.92473 +6290 0.92482 +6300 0.92489 +6310 0.92501 +6320 0.92522 +6330 0.92557 +6340 0.92608 +6350 0.92673 +6360 0.92752 +6370 0.92841 +6380 0.92936 +6390 0.93031 +6400 0.93123 +6410 0.93207 +6420 0.93281 +6430 0.93344 +6440 0.93395 +6450 0.93435 +6460 0.93467 +6470 0.93494 +6480 0.93519 +6490 0.93546 +6500 0.93578 +6510 0.93601 +6520 0.93633 +6530 0.93674 +6540 0.93725 +6550 0.93785 +6560 0.9385 +6570 0.9392 +6580 0.93991 +6590 0.9406 +6600 0.94125 +6610 0.94184 +6620 0.94235 +6630 0.94277 +6640 0.94311 +6650 0.94338 +6660 0.94358 +6670 0.94375 +6680 0.94389 +6690 0.94404 +6700 0.94421 +6710 0.94443 +6720 0.94471 +6730 0.94507 +6740 0.94551 +6750 0.94603 +6760 0.94662 +6770 0.94726 +6780 0.94795 +6790 0.94865 +6800 0.94935 +6810 0.95002 +6820 0.95064 +6830 0.9512 +6840 0.95168 +6850 0.95207 +6860 0.95238 +6870 0.95259 +6880 0.95273 +6890 0.9528 +6900 0.95282 +6910 0.95281 +6920 0.95279 +6930 0.95279 +6940 0.95282 +6950 0.95291 +6960 0.95306 +6970 0.95329 +6980 0.95361 +6990 0.95402 +7000 0.9545 +7010 0.95473 +7020 0.95502 +7030 0.95535 +7040 0.95571 +7050 0.95608 +7060 0.95644 +7070 0.95678 +7080 0.95707 +7090 0.95732 +7100 0.95749 +7110 0.9576 +7120 0.95763 +7130 0.95758 +7140 0.95745 +7150 0.95726 +7160 0.95701 +7170 0.95672 +7180 0.9564 +7190 0.95606 +7200 0.95572 +7210 0.9561 +7220 0.95651 +7230 0.95696 +7240 0.95746 +7250 0.95802 +7260 0.95865 +7270 0.95935 +7280 0.96012 +7290 0.96095 +7300 0.96185 +7310 0.9628 +7320 0.96379 +7330 0.96481 +7340 0.96585 +7350 0.96689 +7360 0.96793 +7370 0.96895 +7380 0.96994 +7390 0.9709 +7400 0.9718 +7410 0.97241 +7420 0.97297 +7430 0.97347 +7440 0.97391 +7450 0.97431 +7460 0.97467 +7470 0.975 +7480 0.9753 +7490 0.97558 +7500 0.97585 +7510 0.97613 +7520 0.97643 +7530 0.97674 +7540 0.97709 +7550 0.97747 +7560 0.9779 +7570 0.97837 +7580 0.97888 +7590 0.97944 +7600 0.98004 +7610 0.98074 +7620 0.98146 +7630 0.98221 +7640 0.98299 +7650 0.98377 +7660 0.98455 +7670 0.98533 +7680 0.98609 +7690 0.98683 +7700 0.98754 +7710 0.98821 +7720 0.98884 +7730 0.98942 +7740 0.98995 +7750 0.99044 +7760 0.99088 +7770 0.99128 +7780 0.99164 +7790 0.99196 +7800 0.99226 +7810 0.99188 +7820 0.99149 +7830 0.99109 +7840 0.9907 +7850 0.99032 +7860 0.98995 +7870 0.98961 +7880 0.9893 +7890 0.98903 +7900 0.9888 +7910 0.9886 +7920 0.98845 +7930 0.98834 +7940 0.98828 +7950 0.98825 +7960 0.98825 +7970 0.98829 +7980 0.98834 +7990 0.98842 +8000 0.98851 +8010 0.989 +8020 0.98949 +8030 0.98997 +8040 0.99043 +8050 0.99088 +8060 0.99129 +8070 0.99168 +8080 0.99203 +8090 0.99234 +8100 0.99262 +8110 0.99285 +8120 0.99304 +8130 0.9932 +8140 0.99333 +8150 0.99342 +8160 0.99349 +8170 0.99354 +8180 0.99357 +8190 0.9936 +8200 0.99362 +8210 0.99345 +8220 0.99328 +8230 0.99314 +8240 0.99301 +8250 0.99291 +8260 0.99284 +8270 0.99281 +8280 0.99281 +8290 0.99285 +8300 0.99293 +8310 0.99305 +8320 0.9932 +8330 0.99339 +8340 0.99362 +8350 0.99387 +8360 0.99416 +8370 0.99446 +8380 0.99479 +8390 0.99513 +8400 0.99547 +8410 0.99592 +8420 0.99637 +8430 0.9968 +8440 0.99722 +8450 0.99762 +8460 0.998 +8470 0.99836 +8480 0.99868 +8490 0.99897 +8500 0.99922 +8510 0.99944 +8520 0.99961 +8530 0.99975 +8540 0.99986 +8550 0.99993 +8560 0.99998 +8570 1 +8580 1 +8590 0.99997 +8600 0.99994 +8610 0.99924 +8620 0.99853 +8630 0.99783 +8640 0.99712 +8650 0.99643 +8660 0.99574 +8670 0.99507 +8680 0.99442 +8690 0.99379 +8700 0.99319 +8710 0.99261 +8720 0.99205 +8730 0.99153 +8740 0.99103 +8750 0.99056 +8760 0.99012 +8770 0.9897 +8780 0.98931 +8790 0.98894 +8800 0.98858 +8810 0.98699 +8820 0.98542 +8830 0.98385 +8840 0.98229 +8850 0.98073 +8860 0.97917 +8870 0.9776 +8880 0.97603 +8890 0.97445 +8900 0.97285 +8910 0.97124 +8920 0.96962 +8930 0.96797 +8940 0.9663 +8950 0.96461 +8960 0.9629 +8970 0.96117 +8980 0.95941 +8990 0.95764 +9000 0.95584 +9010 0.95312 +9020 0.95038 +9030 0.94763 +9040 0.94486 +9050 0.94209 +9060 0.9393 +9070 0.93651 +9080 0.93371 +9090 0.93091 +9100 0.92811 +9110 0.92532 +9120 0.92253 +9130 0.91974 +9140 0.91697 +9150 0.91421 +9160 0.91146 +9170 0.90872 +9180 0.90599 +9190 0.90328 +9200 0.90059 +9210 0.8964 +9220 0.89223 +9230 0.88807 +9240 0.88393 +9250 0.8798 +9260 0.87568 +9270 0.87157 +9280 0.86747 +9290 0.86338 +9300 0.8593 +9310 0.85522 +9320 0.85114 +9330 0.84706 +9340 0.84299 +9350 0.83891 +9360 0.83483 +9370 0.83075 +9380 0.82666 +9390 0.82257 +9400 0.81847 +9410 0.81351 +9420 0.80854 +9430 0.80356 +9440 0.79857 +9450 0.79358 +9460 0.78858 +9470 0.78357 +9480 0.77855 +9490 0.77353 +9500 0.7685 +9510 0.76346 +9520 0.75842 +9530 0.75338 +9540 0.74833 +9550 0.74328 +9560 0.73823 +9570 0.73318 +9580 0.72813 +9590 0.72309 +9600 0.71804 +9610 0.71189 +9620 0.70575 +9630 0.69961 +9640 0.69347 +9650 0.68734 +9660 0.68121 +9670 0.67509 +9680 0.66898 +9690 0.66286 +9700 0.65676 +9710 0.65065 +9720 0.64455 +9730 0.63846 +9740 0.63237 +9750 0.62627 +9760 0.62018 +9770 0.6141 +9780 0.60801 +9790 0.60192 +9800 0.59583 +9810 0.58808 +9820 0.58033 +9830 0.57257 +9840 0.56482 +9850 0.55705 +9860 0.54929 +9870 0.54151 +9880 0.53374 +9890 0.52596 +9900 0.51817 +9910 0.51038 +9920 0.50258 +9930 0.49478 +9940 0.48698 +9950 0.47917 +9960 0.47135 +9970 0.46354 +9980 0.45572 +9990 0.4479 +10000 0.44007 +10010 0.43179 +10020 0.42351 +10030 0.41524 +10040 0.40696 +10050 0.39868 +10060 0.3906 +10070 0.38253 +10080 0.37446 +10090 0.36639 +10100 0.35833 +10110 0.35067 +10120 0.34301 +10130 0.33536 +10140 0.32771 +10150 0.32006 +10160 0.31242 +10170 0.30478 +10180 0.29715 +10190 0.28952 +10200 0.28189 +10210 0.27587 +10220 0.26985 +10230 0.26384 +10240 0.25783 +10250 0.25182 +10260 0.24461 +10270 0.2374 +10280 0.2302 +10290 0.22299 +10300 0.21578 +10310 0.20998 +10320 0.20418 +10330 0.19837 +10340 0.19257 +10350 0.18676 +10360 0.18116 +10370 0.17555 +10380 0.16994 +10390 0.16434 +10400 0.15872 +10410 0.15552 +10420 0.15232 +10430 0.14912 +10440 0.14591 +10450 0.14271 +10460 0.1389 +10470 0.13509 +10480 0.13127 +10490 0.12746 +10500 0.12364 +10510 0.12003 +10520 0.11641 +10530 0.11279 +10540 0.10917 +10550 0.10556 +10560 0.10222 +10570 0.09888 +10580 0.095542 +10590 0.092203 +10600 0.088865 +10610 0.086813 +10620 0.084761 +10630 0.08271 +10640 0.080658 +10650 0.078606 +10660 0.076274 +10670 0.073941 +10680 0.071609 +10690 0.069277 +10700 0.066945 +10710 0.065297 +10720 0.063648 +10730 0.062 +10740 0.060352 +10750 0.058704 +10760 0.056934 +10770 0.055165 +10780 0.053395 +10790 0.051625 +10800 0.049854 +10810 0.049108 +10820 0.048361 +10830 0.047614 +10840 0.046865 +10850 0.046115 +10860 0.044982 +10870 0.043848 +10880 0.042712 +10890 0.041576 +10900 0.040437 +10910 0.039318 +10920 0.038197 +10930 0.037074 +10940 0.03595 +10950 0.034825 +10960 0.033698 +10970 0.032571 +10980 0.031442 +10990 0.030312 +11000 0.029182 +11010 0.028051 +11020 0.02692 +11030 0.025789 +11040 0.024658 +11050 0.023528 +11060 0.022399 +11070 0.021271 +11080 0.020145 +11090 0.019021 +11100 0.017899 +11110 0.016781 +11120 0.015666 +11130 0.014555 +11140 0.013448 +11150 0.012346 +11160 0.011248 +11170 0.010157 +11180 0.0090715 +11190 0.0079924 +11200 0.0069202 +11210 0.005855 +11220 0.0047974 +11230 0.0037476 +11240 0.0027059 +11250 0.0016725 +11260 0.00064763 +11270 0 diff --git a/exoctk/exoctk_app/app_exoctk.py b/exoctk/exoctk_app/app_exoctk.py index 2aca4503..8fa1d905 100644 --- a/exoctk/exoctk_app/app_exoctk.py +++ b/exoctk/exoctk_app/app_exoctk.py @@ -23,6 +23,7 @@ from exoctk.forward_models.forward_models import fortney_grid, generic_grid from exoctk.groups_integrations.groups_integrations import perform_calculation from exoctk.limb_darkening import limb_darkening_fit as lf +from exoctk.limb_darkening import spam from exoctk.modelgrid import ModelGrid from exoctk.phase_constraint_overlap.phase_constraint_overlap import phase_overlap_constraint, calculate_pre_duration from exoctk.throughputs import Throughput @@ -546,6 +547,20 @@ def limb_darkening(): # Load default form form = fv.LimbDarkeningForm() + # Planet properties + planet_properties = ['transit_duration', 'orbital_period', 'rp_rs', 'a_rs', 'inclination', 'eccentricity', 'omega'] + + def empty_fields(form): + form.transit_duration.data = form.transit_duration.data or '' + form.orbital_period.data = form.orbital_period.data or '' + form.rp_rs.data = form.rp_rs.data or '' + form.a_rs.data = form.a_rs.data or '' + form.inclination.data = form.inclination.data or '' + form.eccentricity.data = form.eccentricity.data or '' + form.omega.data = form.omega.data or '' + + return form + # Reload page with stellar data from ExoMAST if form.resolve_submit.data: @@ -557,16 +572,28 @@ def limb_darkening(): form.targname.data = get_canonical_name(form.targname.data) data, target_url = get_target_data(form.targname.data) - # Update the form data + # Update the star data form.feh.data = data.get('Fe/H') form.teff.data = data.get('Teff') form.logg.data = data.get('stellar_gravity') form.target_url.data = str(target_url) + # Update the planet data + form.transit_duration.data = data.get('transit_duration') + form.orbital_period.data = data.get('orbital_period') + form.rp_rs.data = data.get('Rp/Rs') + form.a_rs.data = data.get('a/Rs') + form.inclination.data = data.get('inclination') + form.eccentricity.data = data.get('eccentricity') + form.omega.data = data.get('omega') + except Exception: form.target_url.data = '' form.targname.errors = ["Sorry, could not resolve '{}' in exoMAST.".format(form.targname.data)] + # Ensure planet fields are not None + form = empty_fields(form) + # Send it back to the main page return render_template('limb_darkening.html', form=form) @@ -587,6 +614,9 @@ def limb_darkening(): form.wave_min.data = bandpass.wave_min.value form.wave_max.data = bandpass.wave_max.value + # Ensure planet fields are not None + form = empty_fields(form) + # Send it back to the main page return render_template('limb_darkening.html', form=form) @@ -610,6 +640,9 @@ def limb_darkening(): setattr(form.feh.validators[1], 'max', float(feh_rng[1])) setattr(form.feh.validators[1], 'message', 'Metallicity must be between {} and {}'.format(*feh_rng)) + # Ensure planet fields are not None + form = empty_fields(form) + # Send it back to the main page return render_template('limb_darkening.html', form=form) @@ -647,6 +680,21 @@ def limb_darkening(): for prof in form.profiles.data: ld.calculate(*star_params, prof, mu_min=float(form.mu_min.data), bandpass=bandpass) + # Check if spam coefficients can be calculated + planet_data = {param: getattr(form, param).data for param in planet_properties} + planet_data['Rp/Rs'] = planet_data['rp_rs'] + planet_data['a/Rs'] = planet_data['a_rs'] + spam_calc = all([val is not None and val != '' for key, val in planet_data.items()]) + if spam_calc: + + # Make sure non-linear profile is included for spam calculation if all planet parameters are provided + if '4-parameter' not in form.profiles.data: + ld.calculate(*star_params, '4-parameter', mu_min=float(form.mu_min.data), bandpass=bandpass) + + # Calculate spam coeffs + planet_data = {key: float(val) for key, val in planet_data.items()} + ld.spam(planet_data=planet_data) + # Draw tabbed figure final = ld.plot_tabs() @@ -689,8 +737,41 @@ def limb_darkening(): # Log the successful form inputs log_exoctk.log_form_input(form_input, 'limb_darkening', DB) + # Make a table for each profile with a row for each wavelength bin + profile_spam_tables = '' + spam_file_as_string = '' + if ld.spam_results is not None: + + # Store SPAM tables as string + keep_cols = ['Teff', 'logg', 'FeH', 'profile', 'filter', 'wave_min', 'wave_eff', 'wave_max', 'c1', 'c2'] + print_spam_table = ld.spam_results[[col for col in keep_cols if col in ld.spam_results.colnames]] + spam_file_as_string = '\n'.join(print_spam_table.pformat(max_lines=-1, max_width=-1)) + profile_spam_tables = [] + for profile in list(np.unique(ld.spam_results['profile'])): + + # Make LaTeX for polynomials + latex = lf.ld_profile(profile, latex=True) + poly = '\({}\)'.format(latex).replace('*', '\cdot').replace('\e', 'e') + + # Make the table into LaTeX + table = filter_table(ld.spam_results, profile=profile) + co_cols = [c for c in ld.spam_results.colnames if c.startswith('c') and c not in ['coeffs', 'color']] + table = table[['wave_eff', 'wave_min', 'wave_max'] + co_cols] + table.rename_column('wave_eff', '\(\lambda_\mbox{eff}\hspace{5px}(\mu m)\)') + table.rename_column('wave_min', '\(\lambda_\mbox{min}\hspace{5px}(\mu m)\)') + table.rename_column('wave_max', '\(\lambda_\mbox{max}\hspace{5px}(\mu m)\)') + + # Add the results to the lists + html_table = '\n'.join(table.pformat(max_width=-1, max_lines=-1, html=True)).replace('
Models | {{ form.modeldir.data }} | + {% if spam_table != '' %} +
Transit Duration | +{{ form.transit_duration.data }} | +
Orbital Period | +{{ form.orbital_period.data }} | +
Rp/R* | +{{ form.rp_rs.data }} | +
a/R* | +{{ form.a_rs.data }} | +
Inclination | +{{ form.inclination.data }} | +
Eccentricity | +{{ form.eccentricity.data }} | +
\( \omega \) | +{{ form.omega.data }} | +