dfm / tess-atlas

MIT License
9 stars 8 forks source link

number of periods < 0 #230

Open avivajpeyi opened 2 years ago

avivajpeyi commented 2 years ago

Eg. TOI 5152

cat july12_cat/log_pe/pe_28112380_676.log
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
[00:00:05 - TESS-ATLAS-RUNNER] run_toi(5152)
[00:00:05 - TESS-ATLAS-RUNNER] Executing july12_cat/0.2.1.dev64+gc7fa3a0/toi_5152.ipynb
[00:00:50 - TESS-ATLAS-RUNNER] Preprocessing july12_cat/0.2.1.dev64+gc7fa3a0/toi_5152.ipynb failed:

 An error occurred while executing the following cell:
------------------
planet_transit_model, params = build_planet_transit_model(tic_entry)
model_varnames = get_untransformed_varnames(planet_transit_model)
test_model(planet_transit_model)
# %notify -m "Planet model ready!"

------------------

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/tmp/ipykernel_20890/225095833.py in <module>
----> 1 planet_transit_model, params = build_planet_transit_model(tic_entry)
      2 model_varnames = get_untransformed_varnames(planet_transit_model)
      3 test_model(planet_transit_model)
      4 # %notify -m "Planet model ready!"

/tmp/ipykernel_20890/2338191979.py in build_planet_transit_model(tic_entry)
     92                 tmax_norm = pm.Bound(
     93                     pm.Normal,
---> 94                     lower=planet.tmax - planet.duration_max,
     95                     upper=planet.tmax + planet.duration_max,
     96                 )

/fred/oz200/avajpeyi/projects/tess-atlas/src/tess_atlas/data/planet_candidate.py in tmax(self)
     80     def tmax(self):
     81         """Time of the last transit"""
---> 82         tlast = self.num_periods * self.period
     83         return self.tmin + tlast
     84

/fred/oz200/avajpeyi/projects/tess-atlas/src/tess_atlas/data/planet_candidate.py in num_periods(self)
     65         n = np.floor(lc_tmax - self.tmin) / self.period
     66         if n <= 0:
---> 67             raise ValueError(
     68                 """Number periods {} is invalid:
     69                 (np.floor(lc_tmax - tmin) / period)

ValueError: Number periods -0.44181611067462645 is invalid:
                (np.floor(lc_tmax - tmin) / period)
                lc_tmax = 2169.948279103876
                tmin = 2193.4745606000497
                spoc period = 54.3212423

ValueError: Number periods -0.44181611067462645 is invalid:
                (np.floor(lc_tmax - tmin) / period)
                lc_tmax = 2169.948279103876
                tmin = 2193.4745606000497
                spoc period = 54.3212423

[00:00:50 - TESS-ATLAS-RUNNER] TOI 5152 execution complete: False (45.72s)
avivajpeyi commented 2 years ago

These arnt single-transit systems

import pandas as pd
x = "2537 5152".split()
p = [f"toi_{i}_files/tic_data.csv" for i in x]
df = pd.concat([pd.read_csv(i) for i in p])
df[['TOI int', 'Single Transit', 'Multiplanet System', 'Planet SNR']]
   TOI int  Single Transit  Multiplanet System  Planet SNR
0     5152           False               False        16.0

5152:

Screen Shot 2022-07-15 at 12 16 51 pm

This is a 2-planet system

tmin_interval__           1.71
p_1_lowerbound__           NaN
tmax_2_interval__         1.38

Weirdness 1: period nan Weirdness 2: tmax < tmin (for planet 2)

avivajpeyi commented 2 years ago

Add some unit tests to check this