Skip to content
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

DM-15914: Use obs_metadata for all header translations and unit extraction #114

Merged
merged 1 commit into from Oct 22, 2018

Conversation

timj
Copy link
Member

@timj timj commented Oct 5, 2018

Many methods no longer abstract because obs_metadata is handling the conversions. VisitInfo is now derived directly from an ObservationInfo.

Leave the existing VisitInfo classes to allow for staged migration of obs packages to the new approach.

@timj timj requested a review from TallJimbo October 5, 2018 20:36
@timj timj force-pushed the tickets/DM-15914 branch 2 times, most recently from d1d8816 to 9c5c57f Compare October 5, 2018 21:28
@timj timj changed the title Use obs_metadata for all header translations and unit extraction DM-15914: Use obs_metadata for all header translations and unit extraction Oct 5, 2018
argDict = dict()

obsInfo = ObservationInfo(md, translator_class=self.metadataTranslator)
print(obsInfo.__dict__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debugging relic?


# Strip all the cards out that were used
for c in obsInfo.cards_used:
del md[c]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could/should this operation be an ObservationInfo method?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually is in ObservationInfo, except the method there deliberately returns a copy of the supplied metadata stripped of headers rather than stripping in place. It seemed a bit naughty to modify in place.

from astropy.utils import iers

# This is an unofficial ERFA interface
import astropy._erfa as erfa
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems slightly worrying; mind augmenting the comment with a bit more on either why we shouldn't worry or why we have no choice?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and no. If Astropy ever drops erfa then that will be a problem. On the other hand, the erfa routine in question is pretty simple to reproduce, and there is a python/erfa wrapper extant that we could use.

ut1time = middle

era = erfa.era00(ut1time.jd1, ut1time.jd2)
argDict["era"] = era * radians
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like the kind of calculation I'd have expected to happen inside obs_metadata. Are you just trying to be compatible with VisitInfo's definition of a quantity, while disliking that definition enough to not want it in ObservationInfo?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Earth rotation angle is entirely a property of the time of observation. It's not something that I felt should exist in ObservationInfo and it's not something that is really needed if you are using Astropy coordinates everywhere. afw VisitInfo needs it because it's not got access to astropy. This calculation exists here entirely to be compatible with afw.

self.log.warn("argDict[{}] is None; stripping".format(key, argDict[key]))
del argDict[key]

print("CCCCCCCCCCCCCVC VISIT INFO CCCCCCCCCCCC")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debugging relic.

return None

def to_detector_exposure_id(self):
return self.to_exposure()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstrings or comments on this helper class would be helpful (doesn't need anything huge or formal, just an explanation of the role this plays in the tests).

@timj timj force-pushed the tickets/DM-15914 branch 2 times, most recently from 16b84f2 to 8934873 Compare October 16, 2018 22:38
@timj timj force-pushed the tickets/DM-15914 branch 3 times, most recently from 6c7cff2 to 1e864c9 Compare October 19, 2018 16:53
…traction

Many methods no longer abstract because astro_metadata_translator is handling
the conversions. VisitInfo is now derived directly from an
ObservationInfo.

Leave the existing VisitInfo classes to allow for staged
migration of obs packages to the new approach.
@timj timj merged commit 302af01 into master Oct 22, 2018
@timj timj deleted the tickets/DM-15914 branch June 11, 2020 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants