<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Solved this myself:<div class=""><br class=""></div><div class=""><pre style="margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; font-stretch: inherit; line-height: inherit; vertical-align: baseline; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); word-wrap: normal; color: rgb(36, 39, 41);" class=""><code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-style: inherit; font-variant-caps: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; white-space: inherit;" class="">n = numpy.sqrt(1-l**2-m**2)-1.0
dc = n + 1, l, m
target = SkyCoord(x=dc[0], y=dc[1], z=dc[2], representation='cartesian', frame=phasecentre.skyoffset_frame())
return target.transform_to(phasecentre.frame)</code></pre><div class=""><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">On 11 Feb 2018, at 5:47 pm, Tim Cornwell <<a href="mailto:realtimcornwell@gmail.com" class="">realtimcornwell@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="post-text" itemprop="text" style="margin: 0px 0px 5px; padding: 0px; border: 0px; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; font-stretch: inherit; line-height: 1.3; vertical-align: baseline; width: 660px; word-wrap: break-word; color: rgb(36, 39, 41);"><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant-caps: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; clear: both;" class="">I'm working with some radio data in astropy. I need to convert to and from the l, m, n. Given a position on the sky, pos, I can calculate l, m, n as follows:</p><pre style="margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; font-style: inherit; font-variant-caps: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); word-wrap: normal;" class=""><code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-style: inherit; font-variant-caps: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; white-space: inherit;" class="">todc = pos.transform_to(phasecentre.skyoffset_frame())
dc = todc.represent_as(CartesianRepresentation)
l, m, n = dc.y.value, dc.z.value, dc.x.value - 1
</code></pre><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant-caps: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; clear: both;" class="">How do I do the reverse operation? i.e. given a set of l, m, n defined with respect to phase centre how to get the SkyCoord? The easy part is the conversion between direction cosines and l, m, n:</p><pre style="margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; font-style: inherit; font-variant-caps: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; width: auto; max-height: 600px; overflow: auto; background-color: rgb(239, 240, 241); word-wrap: normal;" class=""><code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-style: inherit; font-variant-caps: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; white-space: inherit;" class="">dc = lm[2] + 1, lmn[0], lmn[1]
</code></pre><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant-caps: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; clear: both;" class="">Thanks, Tim</p><div class=""><br class=""></div></div></div></div></blockquote></div><br class=""></div></body></html>