[yt-svn] commit/yt: 3 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed May 15 22:58:46 PDT 2013
3 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/eea9c5cdb0eb/
Changeset: eea9c5cdb0eb
Branch: yt
User: MatthewTurk
Date: 2013-05-13 21:57:01
Summary: Move the pyfits import to an on-demand import.
Astropy doesn't log the same way we do. So we move any potential import inside
where it would be used.
Affected #: 1 file
diff -r ab3828c6bcf3f9d07e6fe4eef1a17c9b2b613cdf -r eea9c5cdb0eb017fa74a2c40397475e36d6348fc yt/visualization/volume_rendering/image_handling.py
--- a/yt/visualization/volume_rendering/image_handling.py
+++ b/yt/visualization/volume_rendering/image_handling.py
@@ -23,8 +23,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import h5py
-try: import pyfits
-except: pass
import numpy as np
from yt.funcs import *
@@ -44,13 +42,15 @@
f.close()
if fits:
try:
- hdur = pyfits.PrimaryHDU(image[:,:,0])
- hdug = pyfits.ImageHDU(image[:,:,1])
- hdub = pyfits.ImageHDU(image[:,:,2])
- hdua = pyfits.ImageHDU(image[:,:,3])
- hdulist = pyfits.HDUList([hdur,hdug,hdub,hdua])
- hdulist.writeto('%s.fits'%fn,clobber=True)
- except: mylog.error('You do not have pyfits, install before attempting to use fits exporter')
+ import pyfits
+ except ImportError:
+ mylog.error('You do not have pyfits, install before attempting to use fits exporter')
+ hdur = pyfits.PrimaryHDU(image[:,:,0])
+ hdug = pyfits.ImageHDU(image[:,:,1])
+ hdub = pyfits.ImageHDU(image[:,:,2])
+ hdua = pyfits.ImageHDU(image[:,:,3])
+ hdulist = pyfits.HDUList([hdur,hdug,hdub,hdua])
+ hdulist.writeto('%s.fits'%fn,clobber=True)
def import_rgba(name, h5=True):
"""
https://bitbucket.org/yt_analysis/yt/commits/682867d4fd63/
Changeset: 682867d4fd63
Branch: yt
User: MatthewTurk
Date: 2013-05-13 22:06:42
Summary: Adding a raise if pyfits isn't around. This lets the import error show up, but
we also print out the error message, too.
Affected #: 1 file
diff -r eea9c5cdb0eb017fa74a2c40397475e36d6348fc -r 682867d4fd6338f3af87d7d1aa67df5fc45e5cd6 yt/visualization/volume_rendering/image_handling.py
--- a/yt/visualization/volume_rendering/image_handling.py
+++ b/yt/visualization/volume_rendering/image_handling.py
@@ -45,6 +45,7 @@
import pyfits
except ImportError:
mylog.error('You do not have pyfits, install before attempting to use fits exporter')
+ raise
hdur = pyfits.PrimaryHDU(image[:,:,0])
hdug = pyfits.ImageHDU(image[:,:,1])
hdub = pyfits.ImageHDU(image[:,:,2])
https://bitbucket.org/yt_analysis/yt/commits/c3dccff32a42/
Changeset: c3dccff32a42
Branch: yt
User: ngoldbaum
Date: 2013-05-16 07:58:38
Summary: Merged in MatthewTurk/yt (pull request #499)
Move the pyfits import to an on-demand import.
Affected #: 1 file
diff -r a03fc16b5457aa3deba49a11277fbb41ffebd09e -r c3dccff32a42e77621d971da15ad0b8a57ccf8eb yt/visualization/volume_rendering/image_handling.py
--- a/yt/visualization/volume_rendering/image_handling.py
+++ b/yt/visualization/volume_rendering/image_handling.py
@@ -23,8 +23,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import h5py
-try: import pyfits
-except: pass
import numpy as np
from yt.funcs import *
@@ -44,13 +42,16 @@
f.close()
if fits:
try:
- hdur = pyfits.PrimaryHDU(image[:,:,0])
- hdug = pyfits.ImageHDU(image[:,:,1])
- hdub = pyfits.ImageHDU(image[:,:,2])
- hdua = pyfits.ImageHDU(image[:,:,3])
- hdulist = pyfits.HDUList([hdur,hdug,hdub,hdua])
- hdulist.writeto('%s.fits'%fn,clobber=True)
- except: mylog.error('You do not have pyfits, install before attempting to use fits exporter')
+ import pyfits
+ except ImportError:
+ mylog.error('You do not have pyfits, install before attempting to use fits exporter')
+ raise
+ hdur = pyfits.PrimaryHDU(image[:,:,0])
+ hdug = pyfits.ImageHDU(image[:,:,1])
+ hdub = pyfits.ImageHDU(image[:,:,2])
+ hdua = pyfits.ImageHDU(image[:,:,3])
+ hdulist = pyfits.HDUList([hdur,hdug,hdub,hdua])
+ hdulist.writeto('%s.fits'%fn,clobber=True)
def import_rgba(name, h5=True):
"""
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list