noraeisner / LATTE

Lightcurve Analysis Tool for Transiting Exoplanet
GNU Lesser General Public License v3.0
39 stars 10 forks source link

[LATTE-dev] Vetting in FFI mode hits KeyError: "Keyword '1CTYP5' not found." #31

Open orionlee opened 4 years ago

orionlee commented 4 years ago

When running LATTE in --FFI mode interactively, the following error was generated: KeyError: "Keyword '1CTYP5' not found."

Traceback (most recent call last):
  File "C:\pkg\_winNonPortables\Anaconda3\envs\LATTE-dev\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\pkg\_winNonPortables\Anaconda3\envs\LATTE-dev\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\dev\_juypter\LATTE\LATTE\__main__.py", line 544, in <module>
    utils.interact_LATTE_FFI(tic, indir, syspath, sectors_all, sectors, ra, dec, args)
  File "C:\dev\_juypter\LATTE\LATTE\LATTEutils.py", line 2111, in interact_LATTE_FFI
    brew.brew_LATTE_FFI(tic, indir, syspath, transit_list, simple, BLS, model, save, DV, sectors, sectors_all, alltime0, allflux_list, allflux_small, allflux0, all_md, allfbkg, allfbkg_t, start_sec, end_sec, in_sec, X1_list, X4_list, apmask_list, arrshape_list, tpf_filt_list, t_list, bkg_list, tpf_list, ra, dec, args)
  File "C:\dev\_juypter\LATTE\LATTE\LATTEbrew.py", line 558, in brew_LATTE_FFI
    tessmag, teff, srad, mstar,vmag, logg, plx, c_id = utils.plot_TESS_stars(tic,indir, transit_sec, tpf_list, args)
  File "C:\dev\_juypter\LATTE\LATTE\LATTEutils.py", line 5176, in plot_TESS_stars
    tpf_wcs = extract_wcs(tpf)
  File "C:\dev\_juypter\LATTE\LATTE\LATTEutils.py", line 6417, in extract_wcs
    if (tpf[1].header[oldkey] != Undefined):
  File "C:\pkg\_winNonPortables\Anaconda3\envs\LATTE-dev\lib\site-packages\astropy\io\fits\header.py", line 148, in __getitem__
    card = self._cards[self._cardindex(key)]
  File "C:\pkg\_winNonPortables\Anaconda3\envs\LATTE-dev\lib\site-packages\astropy\io\fits\header.py", line 1708, in _cardindex
    raise KeyError(f"Keyword {keyword!r} not found.")
KeyError: "Keyword '1CTYP5' not found."

The error was generated when running interactive equivalent of the following input:

TICID,sectors,transits,BLS,model,FFI
25227021,"1,28","1332.75,2080.54",no,0,yes

When running the batch mode against the above input, it failed silently before aperture was selected. It might be the same error but I cannot be sure.

$python -m LATTE --targetlist=dataLATTE/input25227021_sector1_28_FFI.csv
Downloading https://hpiers.obspm.fr/iers/bul/bulc/Leap_Second.dat
|===========================================| 1.3k/1.3k (100.00%)         0s
Warning: Downloading data from multiple FFI sectors may take a while to run.
Importing FFI data sector 1... done.

Start PCA analysis... TIC 25227021 failed to complete. Continue anyway. You can find a list of the failed IDs stored in the output folder.

  Complete!
orionlee commented 4 years ago

For the following line: https://github.com/noraeisner/LATTE/blob/9f762f9a0497c561ee65c97262961df4ee0f5429/LATTE/LATTEutils.py#L6417

I think it should be:

        if (tpf[1].header.get(oldkey, None) is not None):