<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div style="" class="markdown-here-wrapper"
      data-md-url="Thunderbird">
      <p style="margin: 1.2em 0px ! important;">You can, as David
        suggests, initialize an astropy.wcs.WCS object from a FITS
        header.</p>
      <p style="margin: 1.2em 0px ! important;">You can also create the
        SIP coefficients programmatically, as in the following example:</p>
      <pre style="font-size: 0.85em; font-family: Consolas,Inconsolata,Courier,monospace;font-size: 1em; line-height: 1.2em; overflow: auto;margin: 1.2em 0px;"><code style="font-size: 0.85em; font-family: Consolas,Inconsolata,Courier,monospace;margin: 0px 0.15em; padding: 0px 0.3em; white-space: nowrap; border: 1px solid rgb(234, 234, 234); background-color: rgb(248, 248, 248); border-radius: 3px; display: inline;white-space: pre; border-radius: 3px; border: 1px solid rgb(204, 204, 204); padding: 0.5em 0.7em;display: block; padding: 0.5em; color: rgb(51, 51, 51); background: none repeat scroll 0% 0% rgb(248, 248, 255);">from astropy import wcs
import numpy as np

w = wcs.WCS()
sip = wcs.Sip([[1.03, 0.98], [1.03, 0.76]], [[1.03, 0.98], [1.03, 0.76]],
              [[1.03, 0.98], [1.03, 0.76]], [[1.03, 0.98], [1.03, 0.76]], [0, 0])
w.sip = sip
print w.all_pix2world([[2, 3]], 1)
</code></pre>
      <p style="margin: 1.2em 0px ! important;">The <code
          style="font-size: 0.85em; font-family:
          Consolas,Inconsolata,Courier,monospace;margin: 0px 0.15em;
          padding: 0px 0.3em; white-space: nowrap; border: 1px solid
          rgb(234, 234, 234); background-color: rgb(248, 248, 248);
          border-radius: 3px; display: inline;">Sip</code> constructor
        is documented further here: <a
href="http://astropy.readthedocs.org/en/latest/api/astropy.wcs.Sip.html#astropy.wcs.Sip">http://astropy.readthedocs.org/en/latest/api/astropy.wcs.Sip.html#astropy.wcs.Sip</a><br>
        and don’t hesitate to ask with further questions.</p>
      <p style="margin: 1.2em 0px ! important;">Cheers,<br>
        Mike</p>
      <p style="margin: 1.2em 0px ! important;">On 12/16/2014 05:22 PM,
        David Shupe wrote:</p>
      <p style="margin: 1.2em 0px ! important;"></p>
      <div class="markdown-here-exclude">
        <p></p>
        <blockquote
          cite="mid:73FF2819-F75D-4BBD-AA3F-51689BB63C0C@ipac.caltech.edu"
          type="cite">
          <meta http-equiv="Content-Type" content="text/html;
            charset=UTF-8">
          <br class="">
          <div>
            <blockquote type="cite" class="">
              <div class="">On Dec 16, 2014, at 11:50 AM, Brian York
                <<a moz-do-not-send="true"
                  href="mailto:york@stsci.edu" class="">york@stsci.edu</a>>
                wrote:</div>
              <br class="Apple-interchange-newline">
              <div class="">On 2014/12/16 13:59 , "Paul Kuin" <<a
                  moz-do-not-send="true" href="mailto:npkuin@gmail.com"
                  class="">npkuin@gmail.com</a>> wrote:<br class="">
                <br class="">
                <blockquote type="cite" class="">see<br class="">
                  Shupe, D.L., et al., 2005, Astronomical Data Analysis
                  Soft-<br class="">
                  <br class="">
                  ware and Systems XIV ASP Conference Series, Vol. 347,
                  Proceedings of the<br class="">
                  Conference held 24-27 October, 2004 in Pasadena,
                  California, USA. Edited<br class="">
                  by P. Shopbell, M. Britton, and R. Ebert. San
                  Francisco: Astronomical<br class="">
                  Soci- ety of the Pacific, 2005., p.491<br class="">
                </blockquote>
                <br class="">
                Thank you. This is definitely a helpful resource. What
                it does not have is<br class="">
                any information about modifying an astropy.wcs.WCS
                object to include these<br class="">
                coefficients (given that I am building one
                programmatically). Do you have<br class="">
                any suggestions on that?<br class="">
                <br class="">
                <span class="Apple-tab-span" style="white-space:pre"> </span>-Brian<br
                  class="">
              </div>
            </blockquote>
          </div>
          <br class="">
          <div class="">Brian, I have extensive experience in converting
            polynomials in various formats to WCS and SIP keywords
            suitable for inclusion in FITS headers. I haven’t worked
            much yet with the astropy.wcs.WCS class, but it does look
            like the constructor can take a dictionary of the keywords.
            I have some conversion functions written in Python and I’d
            be happy to help you off-list with converting your
            polynomials.</div>
          <div class=""><br class="">
          </div>
          <div class="">Regards,</div>
          <div class=""><br class="">
          </div>
          <div apple-content-edited="true" class="">
            <div style="color: rgb(0, 0, 0); letter-spacing: normal;
              orphans: auto; text-align: start; text-indent: 0px;
              text-transform: none; white-space: normal; widows: auto;
              word-spacing: 0px; -webkit-text-stroke-width: 0px;
              word-wrap: break-word; -webkit-nbsp-mode: space;
              -webkit-line-break: after-white-space;" class="">David
              Shupe</div>
            <div style="color: rgb(0, 0, 0); letter-spacing: normal;
              orphans: auto; text-align: start; text-indent: 0px;
              text-transform: none; white-space: normal; widows: auto;
              word-spacing: 0px; -webkit-text-stroke-width: 0px;
              word-wrap: break-word; -webkit-nbsp-mode: space;
              -webkit-line-break: after-white-space;" class="">IPAC/Caltech</div>
          </div>
          <br>
          <fieldset class="mimeAttachmentHeader"></fieldset>
          <br>
          <pre wrap="">_______________________________________________
AstroPy mailing list
<a class="moz-txt-link-abbreviated" href="mailto:AstroPy@scipy.org">AstroPy@scipy.org</a>
<a class="moz-txt-link-freetext" href="http://mail.scipy.org/mailman/listinfo/astropy">http://mail.scipy.org/mailman/listinfo/astropy</a>
</pre>
        </blockquote>
        <p></p>
      </div>
      <p style="margin: 1.2em 0px ! important;"></p>
      <div
title="MDH:PGRpdiBjbGFzcz0ibW96LWNpdGUtcHJlZml4Ij5Zb3UgY2FuLCBhcyBEYXZpZCBzdWdnZXN0cywgaW5pdGlhbGl6ZSBhbiBhc3Ryb3B5Lndjcy5XQ1Mgb2JqZWN0IGZyb20gYSBGSVRTIGhlYWRlci48
YnI+PGJyPllvdSBjYW4gYWxzbyBjcmVhdGUgdGhlIFNJUCBjb2VmZmljaWVudHMgcHJvZ3JhbW1h
dGljYWxseSwgYXMgaW4gdGhlIGZvbGxvd2luZyBleGFtcGxlOjxicj48YnI+YGBgPGJyPmZyb20g
YXN0cm9weSBpbXBvcnQgd2NzPGJyPmltcG9ydCBudW1weSBhcyBucDxicj48YnI+dyA9IHdjcy5X
Q1MoKTxicj5zaXAgPSB3Y3MuU2lwKFtbMS4w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cHg7IHdv
cmQtd3JhcDogYnJlYWstd29yZDsgLXdlYmtpdC1uYnNwLW1vZGU6IHNwYWNlOyAtd2Via2l0LWxp
bmUtYnJlYWs6IGFmdGVyLXdoaXRlLXNwYWNlOyIgY2xhc3M9IiI+SVBBQy9DYWx0ZWNoPC9kaXY+
PC9kaXY+Cjxicj48ZmllbGRzZXQgY2xhc3M9Im1pbWVBdHRhY2htZW50SGVhZGVyIj48L2ZpZWxk
c2V0Pjxicj48cHJlIHdyYXA9IiI+X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f
X19fX19fX19fX18KQXN0cm9QeSBtYWlsaW5nIGxpc3QKQXN0cm9QeUBzY2lweS5vcmcKaHR0cDov
L21haWwuc2NpcHkub3JnL21haWxtYW4vbGlzdGluZm8vYXN0cm9weQo8L3ByZT4KCjwvYmxvY2tx
        dW90ZT48YnI+PGJyPg=="
style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0;">​</div>
    </div>
    <pre class="moz-signature markdown-here-signature" cols="72">-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute

<a class="moz-txt-link-freetext" href="http://www.droettboom.com">http://www.droettboom.com</a></pre>
  </body>
</html>