Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pad_spectrum does not fully obey axis argument #25

Closed
zpace opened this issue Jan 25, 2017 · 0 comments · Fixed by #92
Closed

pad_spectrum does not fully obey axis argument #25

zpace opened this issue Jan 25, 2017 · 0 comments · Fixed by #92

Comments

@zpace
Copy link

zpace commented Jan 25, 2017

The FilterResponse object's pad_spectrum method appears to not add elements along the correct axis. For example...

import numpy as np, astropy.units as u, speclite.filters as filters
# 1-dim wavelength array
lam0 = np.arange(3800., 5500., 1.) * u.AA
# compatible datacube shape
flam0 = np.tile(np.ones_like(lam0.value)[..., None, None], (1, 20, 20)) * \
    u.Unit('1e-17 erg/s/cm2/AA')
sdss = filters.load_filters('sdss2010-*')
flam, lam = sdss.pad_spectrum(spectrum=flam0, wavelength=lam0, method='zero', axis=0)
print(flam0.shape, lam0.shape, flam.shape, lam.shape)

which outputs (1700, 20, 237) (1917,) instead of (1917, 20, 20), (1917,)

my version is 0.5

The workaround seems to be to np.moveaxis from 0 ==> -1 prior to calling pad_spectrum, and then reversing that operation after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant