-
-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
heasarc: Adding extra parsing for non-fits standard units #2349
Conversation
|
except ValueError: | ||
try: | ||
return self._fallback(response.text) | ||
except Exception as e: | ||
except Exception: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a catch-all Exception. I think we should keep this as
except Exception: | |
except Exception as ex: | |
print(f"Caught exception {ex}: using fallback") |
because I don't like catching generic Exceptions
(that can block even user-triggered control-c, for example). It would be better to catch the right exceptions, but without knowing what those are, I suggest we just be noisy instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(this is also extremely minor and it's fine to ignore me)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I agree, I have the same annoyance (on top of catching them but don't use the stored item), but didn't know what the expected exception would be from _fallback()
. OTOH, here I clearly made this change quite late in the night without reading properly that ex
is in fact used 🤦♀️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like catching generic
Exceptions
(that can block even user-triggered control-c, for example)
except:
does catch KeyboardInterrupt
, but except Exception:
does not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤯 I didn't know that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bsipocz - I don't know of any better approaches. I can only apologize for the original catalog not being FITS compliant since I was involved in that project. I am surprised that HEASARC does not validate input tables at the point of ingest since that would be the right place to make sure their archive is clean, but clearly that is water under the bridge at this point. |
Hmm, another approach is to ditch the fits file format and switch to votable. The units come up properly in that case, so after all this might be a heasarc API issue during the process of converting the DB response to the desired output format, rather than an issue with the original data holding and ingestion. That would not address the desire in #2333 to write out the table in fits format. 1) we either fix all the issues to support that or 2) advocate for astronomers to drop the usage of fits for catalogues in favour of votable. Option 2 would certainly make life much much easier 😅 (Issues with saving as fits are:
cc @volodymyrss and @zoghbi-a to see whether they have any recommendations. Long term I suppose it would be nice to switch to a VO backend, but for now, a workaround PR like the one proposed would fix the annoyances that came yup in the fornax use case. |
I think also switch to VOTable of heasarc is also not too complex: #2353 |
This PR was a deadend and as the module is now being refactored, I'm closing it without merging. The issue for the bug remains open and we should check if it's still present when the refactoring is done. |
This is to make the module compatible with the more strict unit parsing in astropy 5.1.
See details and example code in #2333
I'm still running into an ERG related warning at writing out time:
And unfortunately, it seems that some of the parsing gone very wrong, too, e.g.
S
understandably parsed asu.S
rather thanu.second
.I'm copying the first row here for troubleshooting:
I'm cc-ing @mhvk from the units side of the problem and @taldcroft as Tables and Chandra expert to see whether there are better approaches than
add_enabled_aliases
for this problem. I'm certain similar issues may come up in other modules, after all hardly any data providers follow the fits standards.