afeinstein20 / eleanor

A tool for light curve extraction from the TESS FFIs.
MIT License
92 stars 39 forks source link

Quality flag array and cadence array do not match in sectors 65-66 #267

Closed wardhoward closed 5 months ago

wardhoward commented 1 year ago

set_quality(self) in targetdata.py throws the following error for TIC 254425584, sector=65 as a result of the metadata files cadences_s0065.txt and quality_s0065.txt being different lengths:

Traceback (most recent call last): File "", line 1, in File "/Users/----------/opt/anaconda3/envs/---------/lib/python3.7/site-packages/eleanor-2.0.5-py3.7.egg/eleanor/targetdata.py", line 231, in init self.set_quality() File "/Users/----------/opt/anaconda3/envs/---------/lib/python3.7/site-packages/eleanor-2.0.5-py3.7.egg/eleanor/targetdata.py", line 854, in set_quality self.quality[np.nansum(self.tpf, axis=(1,2)) == 0] = 128 IndexError: boolean index did not match indexed array along dimension 0; dimension is 10296 but corresponding boolean dimension is 11759

I suspect the issue is with the line v = np.bitwise_or.reduce(twoMinQual[where - 5:where + 5]) in get_quality(self) when using update.py for this sector. Alternately, it's possible the issue is with the tpf instead of the quality array, which might mean index_zeropoint = 690247 and index_t0 = 2825.252246759366 might not map correctly for Sector 65? As a temporary workaround, I can produce light curves by changing the line in targetdata.py: self.quality = np.array(self.post_obj.quality) to to self.quality = np.zeros(len(np.array(self.tpf))) and then removing epochs with bad quality afterwards by manually comparing a two-minute light curve in the sector with the FFI light curve sans quality masking.

Prior to hitting these issues, the maxsector is set to the current sector, 66, and I updated the coordinates in def init(self, sector=None) for these sectors in line 131 of update.py. I also had to add year = 2023 to get_cbvs(self) in order to pull from MAST correctly.

pavolgaj commented 1 year ago

I have also a problem with sector 66, but probably different. I got this error:

Traceback (most recent call last): File "/.../ffi_tp.py", line 10, in star = eleanor.Source(name='hd 156097', sector=66) File "/usr/local/lib/python3.10/dist-packages/eleanor/source.py", line 266, in init Update(sector=self.sector) File "/usr/local/lib/python3.10/dist-packages/eleanor/update.py", line 155, in init self.cutout = fits.open(manifest['Local Path'][0], memmap=False) File "astropy/table/_column_mixins.pyx", line 81, in astropy.table._column_mixins._ColumnGetitemShim.getitem File "astropy/table/_column_mixins.pyx", line 64, in astropy.table._column_mixins.base_getitem File "astropy/table/_column_mixins.pyx", line 76, in astropy.table._column_mixins.column_getitem IndexError: index 0 is out of bounds for axis 0 with size 0

I tried to update tess-point, astropy, astroquery - not help. Script tess_stars2px found it: 000000000 | 259.241505 | -31.151059 | 260.711093 | -8.057887 | 66 | 1 | 4 | 752.992052 | 98.290725 | 0

pavolgaj commented 1 year ago

I tried objects from previous sectors. The last working one is Sector 60.

benmontet commented 5 months ago

This should now be working as intended (on the github version)! Was an issue with Sector 65 where one camera due to an issue had three days less data than with the other cameras. Have hard-coded in a catch for this rare case. Was tricky to catch---lesson to myself to figure out what was going on is to read the release notes, as ever!

Will close this, please re-open if you think you see it again or it isn't working for you.

kareemelbadry commented 5 months ago

Hi, I am getting the same error for Sector 72 (with the current GitHub version). Maybe a similar issue?

zessack commented 2 months ago

Hi. I have encountered this issue for hundreds of TICs in Sector 65, and across Cameras 1, 2 & possibly 3 (e.g. TIC 177337491, TIC 272021842, TIC 278429864).

IndexError: boolean index did not match indexed array along dimension 0; dimension is 11758 but corresponding boolean dimension is 11759.

The https://github.com/afeinstein20/eleanor/commit/05e8e8db9eab865dcfa632406cc1eab3cc3b756b commit to fix this issue seems to only be for Camera 4, CCD 4.