beast icon indicating copy to clipboard operation
beast copied to clipboard

Dolphot coordinate half-pixel offset

Open meredith-durbin opened this issue 4 years ago • 5 comments

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.)

meredith-durbin avatar Mar 31 '20 20:03 meredith-durbin

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?

karllark avatar Apr 01 '20 13:04 karllark

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

lea-hagen avatar Apr 03 '20 16:04 lea-hagen

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.

meredith-durbin avatar Apr 07 '20 13:04 meredith-durbin

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

karllark avatar Apr 07 '20 13:04 karllark

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.

benw1 avatar Apr 17 '20 18:04 benw1