jobovy / apogee

Tools for dealing with APOGEE data
BSD 3-Clause "New" or "Revised" License
43 stars 25 forks source link

Using allStarLite as default for DR16 breaks importation #67

Closed jmackereth closed 2 years ago

jmackereth commented 2 years ago

Not a priority, but I found a slight bug due to the difference in formatting between the allStarLite files in DR16 and DR17. For DR17, the file has 3 HDU's, with HDU 3 being loaded, whereas DR16 just has 2. This means the DR16 file is downloaded then unable to read by the current code in apogee/tools/__init__.py:

https://github.com/jobovy/apogee/blob/b218e62bd158d56695d8f3c8ae4ab3b78800d7af/apogee/tools/__init__.py#L14-L21

Since PARAM_SYMBOL isn't present in the DR16 allStarLite, just changing the extension for DR16 won't help much.

The best solution could be to just check for dr17 or not and just use the regular allStar for all DR's but DR17. Another is to simply catch the IndexError that gets raised (alongside the ValueError catch), but I wasn't sure about what the effect of _INDEX_ARRAYS_LOADED= False might be downstream?

jobovy commented 2 years ago

Yeah, we need the index arrays, so I think your proposed fix is correct.