Skip to content

Commit

Permalink
Deal with astropy and h5py deprecation issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonywong94 committed Dec 24, 2020
1 parent df3b668 commit 47e3f99
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion astrodendro/flux.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def compute_flux(input_quantities, output_unit, wavelength=None, spatial_scale=N
# Convert input quantity to Fnu in Jy
# Implicitly, this equivalency gives the Janskys in a single beam, so we make this explicit by dividing out a beam
jansky_per_beam = input_quantities.to(u.Jy,
equivalencies=u.brightness_temperature(omega_beam, nu)) / u.beam
equivalencies=u.brightness_temperature(nu, beam_area=omega_beam)) / u.beam

q = jansky_per_beam * beams_per_pixel

Expand Down
8 changes: 4 additions & 4 deletions astrodendro/io/hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def dendro_import_hdf5(filename):

log.debug('Loading HDF5 file from disk...')
with h5py.File(filename, 'r') as h5f:
newick = h5f['newick'].value
data = h5f['data'].value
index_map = h5f['index_map'].value
newick = h5f['newick'][()]
data = h5f['data'][()]
index_map = h5f['index_map'][()]

params = {}
if 'min_value' in h5f.attrs:
Expand All @@ -70,7 +70,7 @@ def dendro_import_hdf5(filename):
params['min_npix'] = h5f.attrs['min_npix']

try:
wcs = WCS(h5f['wcs_header'].value)
wcs = WCS(h5f['wcs_header'][()])
except KeyError:
wcs = None

Expand Down
6 changes: 6 additions & 0 deletions astrodendro/io/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

def parse_newick(string):

# Convert bytestring if needed
try:
string = string.decode('utf-8')
except (UnicodeDecodeError, AttributeError):
pass

items = {}

# Find maximum level
Expand Down

0 comments on commit 47e3f99

Please sign in to comment.