BEAST-Fitting / beast

Bayesian Extinction And Stellar Tool
http://beast.readthedocs.io
23 stars 35 forks source link

Dolphot coordinate half-pixel offset #525

Open meredith-durbin opened 4 years ago

meredith-durbin commented 4 years ago

The Astropy WCS documentation suggests 0 or 1 for the "origin" argument for conversion between pixel and world coordinates (as in all_pix2world and similar functions), depending on the standard; this is duplicated with the wcs_origin keyword argument in the two make_ast_xy_list functions. Dolphot, meanwhile, uses 0.5 as its origin; as a result, using either 0 or 1 as the origin for generated AST coordinates will result in a half-pixel coordinate discrepancy.

While the trivial single-use solution here is for a user to simply pass wcs_origin=0.5, I think it would be sensible to set 0.5 as the default origin, and to include a note about it in the documentation, given that the BEAST is designed for use on Dolphot catalogs. (I'm happy to make this change if it's agreed upon, and to look for anywhere else in the code it might be relevant.)

(NB: I can't find anything about it in the astropy changelogs, but I seem to recall that previously it only accepted 0 or 1 as the origin argument; this could have been my misreading of the documentation, though, and at least as of v4.0, it accepts 0.5 as an origin.)

karllark commented 4 years ago

Thanks for this issue. Good to know and I'm guessing we'll have to update the AST code. @lea-hagen or @galaxyumi - is this something one of you would be interested in tackling?

lea-hagen commented 4 years ago

I'd be happy to take a look, but with my current limited work hours, it would probably take a little longer than usual.

meredith-durbin commented 4 years ago

I'd be happy to do the quick fix for the AST position code, although seeing if it's also needed anywhere else in the BEAST might take a little longer.

karllark commented 4 years ago

That would be great @meredith-durbin. Should only be needed in the AST input setup code.

benw1 commented 4 years ago

DOLPHOT interprets the center of the first pixel in the image to have the coordinate 0.5,0.5, while most fits interpreters (including DS9, wcsctran, wcslib, etc.), interpret the center of the pixel to have the coordinate 1, 1. Thus, when you convert an RA, and DEC to X, Y using the header, it will return, for example, the position 1, 1, but if you want to generate an input AST X, Y position for DOLPHOT at that RA and DEC, you need to give it X, Y of 0.5, 0.5.

This also goes the other way. If you want to find the RA and DEC of a star position that DOLPHOT reports to be at pixel X, Y of 1, 1, you would need to put 1.5, 1.5 into your WCS interpreter.