<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Juan,<div><br></div><div>This only works if you have installed AstroPy in the Python that yt uses. If you installed from the install script, you can use "pip install astropy".</div><div><br></div><div>There should probably be a more sensible error message than the one you got, I'll set about fixing it shortly. </div><div><br></div><div>Best,</div><div><br></div><div>John</div><div><br><div><div>On Jul 24, 2014, at 5:03 PM, Juan Camilo Ibanez Mejia <<a href="mailto:jibanezmejia@amnh.org">jibanezmejia@amnh.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
Dear yt users,
<div><br>
</div>
<div>I was trying to generate a FITS file from one of my simulations but I obtained an error I </div>
<div>do not understand and do not know how to solve. I followed the procedure in:</div>
<div><a href="http://yt-project.org/docs/dev-3.0/visualizing/writing_fits_images.html">http://yt-project.org/docs/dev-3.0/visualizing/writing_fits_images.html</a></div>
<div>and in the moment I call <b>fib = FITSImageBuffer(cvg, fields=["density"])</b></div>
<div>I obtain the error:</div>
<div><br>
</div>
<div>
<pre style="padding: 0px; font-size: 14px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; margin-top: 0px; margin-bottom: 0px; line-height: 17.603300094604492px; word-break: break-all; word-wrap: break-word; white-space: pre-wrap; border: 0px; vertical-align: baseline; background-color: rgb(255, 255, 255);"><span class="ansired" style="color: rgb(139, 0, 0);">---------------------------------------------------------------------------</span>
<span class="ansired" style="color: rgb(139, 0, 0);">AttributeError</span>                            Traceback (most recent call last)
<span class="ansigreen" style="color: rgb(0, 100, 0);"><ipython-input-87-25a548a040e2></span> in <span class="ansicyan" style="color: rgb(70, 130, 180);"><module><span class="ansiblue" style="color: rgb(0, 0, 139);">()</span>
<span class="ansigreen" style="color: rgb(0, 100, 0);">----> 1<span class="ansiyellow" style="color: rgb(165, 42, 42);"> </span>fib</span> <span class="ansiyellow" style="color: rgb(165, 42, 42);">=</span> </span>FITSImageBuffer<span class="ansiyellow" style="color: rgb(165, 42, 42);">(</span>cvg<span class="ansiyellow" style="color: rgb(165, 42, 42);">,</span> fields<span class="ansiyellow" style="color: rgb(165, 42, 42);">=</span><span class="ansiyellow" style="color: rgb(165, 42, 42);">[</span><span class="ansiblue" style="color: rgb(0, 0, 139);">"density"</span><span class="ansiyellow" style="color: rgb(165, 42, 42);">]</span><span class="ansiyellow" style="color: rgb(165, 42, 42);">)</span><span class="ansiyellow" style="color: rgb(165, 42, 42);"></span>

<span class="ansigreen" style="color: rgb(0, 100, 0);">/home/jcibanezm/codes/yt30/yt-x86_64/src/yt-hg/yt/utilities/fits_image.pyc</span> in <span class="ansicyan" style="color: rgb(70, 130, 180);">__init__<span class="ansiblue" style="color: rgb(0, 0, 139);">(self, data, fields, units, center, scale, wcs)</span>
<span class="ansigreen" style="color: rgb(0, 100, 0);">    104</span>                 </span>mylog<span class="ansiyellow" style="color: rgb(165, 42, 42);">.</span>info<span class="ansiyellow" style="color: rgb(165, 42, 42);">(</span><span class="ansiblue" style="color: rgb(0, 0, 139);">"Making a FITS image of field %s"</span> <span class="ansiyellow" style="color: rgb(165, 42, 42);">%</span> <span class="ansiyellow" style="color: rgb(165, 42, 42);">(</span>key<span class="ansiyellow" style="color: rgb(165, 42, 42);">)</span><span class="ansiyellow" style="color: rgb(165, 42, 42);">)</span><span class="ansiyellow" style="color: rgb(165, 42, 42);"></span>
<span class="ansigreen" style="color: rgb(0, 100, 0);">    105</span>                 <span class="ansigreen" style="color: rgb(0, 100, 0);">if</span> first<span class="ansiyellow" style="color: rgb(165, 42, 42);">:</span><span class="ansiyellow" style="color: rgb(165, 42, 42);"></span>
<span class="ansigreen" style="color: rgb(0, 100, 0);">--> 106<span class="ansiyellow" style="color: rgb(165, 42, 42);">                     </span>hdu</span> <span class="ansiyellow" style="color: rgb(165, 42, 42);">=</span> pyfits<span class="ansiyellow" style="color: rgb(165, 42, 42);">.</span>PrimaryHDU<span class="ansiyellow" style="color: rgb(165, 42, 42);">(</span>np<span class="ansiyellow" style="color: rgb(165, 42, 42);">.</span>array<span class="ansiyellow" style="color: rgb(165, 42, 42);">(</span>img_data<span class="ansiyellow" style="color: rgb(165, 42, 42);">[</span>key<span class="ansiyellow" style="color: rgb(165, 42, 42);">]</span><span class="ansiyellow" style="color: rgb(165, 42, 42);">)</span><span class="ansiyellow" style="color: rgb(165, 42, 42);">)</span><span class="ansiyellow" style="color: rgb(165, 42, 42);"></span>
<span class="ansigreen" style="color: rgb(0, 100, 0);">    107</span>                     first <span class="ansiyellow" style="color: rgb(165, 42, 42);">=</span> False<span class="ansiyellow" style="color: rgb(165, 42, 42);"></span>
<span class="ansigreen" style="color: rgb(0, 100, 0);">    108</span>                 <span class="ansigreen" style="color: rgb(0, 100, 0);">else</span><span class="ansiyellow" style="color: rgb(165, 42, 42);">:</span><span class="ansiyellow" style="color: rgb(165, 42, 42);"></span>

<span class="ansired" style="color: rgb(139, 0, 0);">AttributeError</span>: 'NoneType' object has no attribute 'PrimaryHDU'
</pre>
</div>
<div><br>
</div>
<div>Any idea how can I solve this ?</div>
<div><br>
</div>
<div>thanks in advance</div>
<div><br>
</div>
<div>Juan</div>
<div><br>
</div>
<div>
<div>
<div apple-content-edited="true">
<div style="font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="font-family: Helvetica; font-size: inherit; font-weight: normal; font-style: normal;">
_____________________________</div>
<div style="font-family: Helvetica;  font-weight: normal; font-style: normal;"><span style="font-size: 12px; orphans: auto; widows: auto;">Juan Camilo Ibañez Mejia</span><br style="font-size: 12px; orphans: auto; widows: auto;">
<span style="font-size: 12px; orphans: auto; widows: auto;">PhD candidate in physics</span><br style="font-size: 12px; orphans: auto; widows: auto;">
<span style="font-size: 12px; orphans: auto; widows: auto;">Institute für Theoretische Astrophysik</span><br style="font-size: 12px; orphans: auto; widows: auto;">
<span style="font-size: 12px; orphans: auto; widows: auto;">Heidelberg University</span><br style="font-size: 12px; orphans: auto; widows: auto;">
<span style="font-size: 12px; orphans: auto; widows: auto;"><a href="mailto:jibanez@zah.uni-heidelberg.de">jibanez@zah.uni-heidelberg.de</a></span><br style="font-size: 12px; orphans: auto; widows: auto;">
<br style="font-size: 12px; orphans: auto; widows: auto;">
<span style="font-size: 12px; orphans: auto; widows: auto;">Research Scholar</span></div>
<div>
<div>Department of Astrophysics</div>
<div>American Museum of Natural History</div>
<div>+1-212-313-7435</div>
<div><a href="mailto:jibanezmejia@amnh.org">jibanezmejia@amnh.org</a></div>
<div>_____________________________</div>
</div>
</div>
</div>
<br>
</div>
</div>
</div>

_______________________________________________<br>yt-users mailing list<br><a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org<br></blockquote></div><br></div></body></html>