Skip to content

DM-34885: Write utility functions for calculating exposure sky position offsets#12

Merged
mfisherlevine merged 3 commits intomainfrom
tickets/DM-34885
May 20, 2022
Merged

DM-34885: Write utility functions for calculating exposure sky position offsets#12
mfisherlevine merged 3 commits intomainfrom
tickets/DM-34885

Conversation

@mfisherlevine
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

@timj timj left a comment

Choose a reason for hiding this comment

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

Please fix the AUXTEL_LOCATION hack. Other than that I've mostly looked at it before and it's fine.

this will need correcting.
"""
skyLocation = SkyCoord(skyPos.getRa().asRadians(), skyPos.getDec().asRadians(), unit=u.rad)
altAz = AltAz(obstime=visitInfo.date.toPython(), location=AUXTEL_LOCATION)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The irony being that ObservationInfo has all the information you need, including the Astropy AltAz object. More importantly, VisitInfo has the observatory location stored in it so you should not be guessing. VisitInfo.getObservatory returns lsst.afw.coord.Observatory which you should be able to transform into an astropy location.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good plan. Trivial to add to the code, torture to add to the test suite. Any idea how I'd add the location to the obsInfo/visitInfo I'm crafting by hand? I've tried a few things, but don't even really know where to look to work it out...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I tried adding some values for telescope to the base header dict but that didn't work.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are you making a VisitInfo from scratch or going via a header and ObservationInfo. The code to go from astropy location to Observatory is here:

https://github.com/lsst/obs_base/blob/main/python/lsst/obs/base/makeRawVisitInfoViaObsInfo.py#L207-L212

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Via a "header" and ObservationInfo (where the scare quotes denote it being a hand-made dict rather than an actual FITS header). You can see the code here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Going between astropy location to Observatory isn't a problem, it's getting the test obsInfo/visitInfo to have it in it that's the problem.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What I meant by not knowing where to look is not really understanding what things to shove into the header to make it pop out in the obsInfo.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The location comes from the OBSGEO-* FITS headers.

Copy link
Copy Markdown
Contributor Author

@mfisherlevine mfisherlevine May 20, 2022

Choose a reason for hiding this comment

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

Right, but sticking values for those into the baseHeader dict doesn't get them into the output visitInfo, which is what I mean about not getting how to do this 😬
Crossed while typing


self.viMaker = MakeRawVisitInfoViaObsInfo()
self.mi = afwImage.maskedImage.MaskedImageF(0, 0)
self.baseHeader = dict(boresight_airmass=1.5,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

oh, this is a dict pretending to be an ObservationInfo? You need to create an astropy.coordinates.EarthLocation object and attach it to location in here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, great, thanks!

obsInfo2 = makeObservationInfo(**header2)

vi1 = self.viMaker.observationInfo2visitInfo(obsInfo1)
vi2 = self.viMaker.observationInfo2visitInfo(obsInfo2)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Huh? I am, on that very line, no? self.viMaker is MakeRawVisitInfoViaObsInfo

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

but also there's no long any problems here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The observationInfo2visitInfo takes the ObservationInfo object you created above. The __call__ method takes a header and first converts it to an ObservationInfo.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't understand what you're asking me to do. I added location=AUXTEL_LOCATION to the base header and everything works.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You are right. Sorry. Trying to comment whilst in a meeting.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No probs. Merging 🎉

@mfisherlevine mfisherlevine changed the title Write utility functions for calculating exposure sky position offsets DM-34885: Write utility functions for calculating exposure sky position offsets May 20, 2022
@mfisherlevine mfisherlevine merged commit 92a352a into main May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants