[yt-svn] commit/yt: 3 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Aug 7 08:52:50 PDT 2017
3 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/3ea56ef92462/
Changeset: 3ea56ef92462
User: jzuhone
Date: 2017-08-04 15:27:25+00:00
Summary: Make sure that only the first HDU is a PrimaryHDU
Affected #: 1 file
diff -r 73d27659e3b280ec7f665210eb712704c6f698b9 -r 3ea56ef924626fc7b35ea7192f1198773f421134 yt/visualization/fits_image.py
--- a/yt/visualization/fits_image.py
+++ b/yt/visualization/fits_image.py
@@ -432,11 +432,17 @@
w = image_list[0].wcs
img_shape = image_list[0].shape
data = []
+ first = True
for fid in image_list:
assert_same_wcs(w, fid.wcs)
if img_shape != fid.shape:
raise RuntimeError("Images do not have the same shape!")
- data += fid.hdulist
+ for hdu in fid.hdulist:
+ if first:
+ data.append(hdu)
+ first = False
+ else:
+ data.append(_astropy.pyfits.ImageHDU(hdu.data, header=hdu.header))
data = _astropy.pyfits.HDUList(data)
return cls(data)
https://bitbucket.org/yt_analysis/yt/commits/2bada28ba8f8/
Changeset: 2bada28ba8f8
User: jzuhone
Date: 2017-08-04 19:00:17+00:00
Summary: Fixing the formatting of info()
Affected #: 1 file
diff -r 3ea56ef924626fc7b35ea7192f1198773f421134 -r 2bada28ba8f80063c949432a634e9e818ed5d016 yt/visualization/fits_image.py
--- a/yt/visualization/fits_image.py
+++ b/yt/visualization/fits_image.py
@@ -286,13 +286,20 @@
the FITSImageData info. Writes to ``sys.stdout`` by default.
"""
hinfo = self.hdulist.info(output=False)
- format = '{:3d} {:10} {:11} {:5d} {} {} {}'
+ num_cols = len(hinfo[0])
+ if output is None:
+ output = sys.stdout
+ if num_cols == 8:
+ header = 'No. Name Ver Type Cards Dimensions Format Units'
+ format = '{:3d} {:10} {:3} {:11} {:5d} {} {} {}'
+ else:
+ header = 'No. Name Type Cards Dimensions Format Units'
+ format = '{:3d} {:10} {:11} {:5d} {} {} {}'
if self.hdulist._file is None:
name = '(No file associated with this FITSImageData)'
else:
name = self.hdulist._file.name
- results = ['Filename: {}'.format(name),
- 'No. Name Type Cards Dimensions Format Units']
+ results = ['Filename: {}'.format(name), header]
for line in hinfo:
units = self.field_units[self.hdulist[line[0]].header['btype']]
summary = tuple(list(line[:-1]) + [units])
@@ -300,8 +307,7 @@
results.append(format.format(*summary))
else:
results.append(summary)
- if output is None:
- output = sys.stdout
+
if output:
output.write('\n'.join(results))
output.write('\n')
https://bitbucket.org/yt_analysis/yt/commits/b409ebd065a2/
Changeset: b409ebd065a2
User: ngoldbaum
Date: 2017-08-07 15:52:34+00:00
Summary: Merge pull request #1524 from jzuhone/fid_fixes_redux
[bugfix] More FITSImageData fixes
Affected #: 1 file
diff -r aba396f68b779976b5a7acc76d0f868963d0e388 -r b409ebd065a228e75b1e1a6b602eaaab799bdf03 yt/visualization/fits_image.py
--- a/yt/visualization/fits_image.py
+++ b/yt/visualization/fits_image.py
@@ -286,13 +286,20 @@
the FITSImageData info. Writes to ``sys.stdout`` by default.
"""
hinfo = self.hdulist.info(output=False)
- format = '{:3d} {:10} {:11} {:5d} {} {} {}'
+ num_cols = len(hinfo[0])
+ if output is None:
+ output = sys.stdout
+ if num_cols == 8:
+ header = 'No. Name Ver Type Cards Dimensions Format Units'
+ format = '{:3d} {:10} {:3} {:11} {:5d} {} {} {}'
+ else:
+ header = 'No. Name Type Cards Dimensions Format Units'
+ format = '{:3d} {:10} {:11} {:5d} {} {} {}'
if self.hdulist._file is None:
name = '(No file associated with this FITSImageData)'
else:
name = self.hdulist._file.name
- results = ['Filename: {}'.format(name),
- 'No. Name Type Cards Dimensions Format Units']
+ results = ['Filename: {}'.format(name), header]
for line in hinfo:
units = self.field_units[self.hdulist[line[0]].header['btype']]
summary = tuple(list(line[:-1]) + [units])
@@ -300,8 +307,7 @@
results.append(format.format(*summary))
else:
results.append(summary)
- if output is None:
- output = sys.stdout
+
if output:
output.write('\n'.join(results))
output.write('\n')
@@ -432,11 +438,17 @@
w = image_list[0].wcs
img_shape = image_list[0].shape
data = []
+ first = True
for fid in image_list:
assert_same_wcs(w, fid.wcs)
if img_shape != fid.shape:
raise RuntimeError("Images do not have the same shape!")
- data += fid.hdulist
+ for hdu in fid.hdulist:
+ if first:
+ data.append(hdu)
+ first = False
+ else:
+ data.append(_astropy.pyfits.ImageHDU(hdu.data, header=hdu.header))
data = _astropy.pyfits.HDUList(data)
return cls(data)
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