astropy / astropy/specutils

moment should work on non-square

Open
#925 0 comments 0 reactions 0 assignees View on GitHub
analysis bug spectral-cube
Dominant language
Python
Stars
204
Forks
134
Avg merge
12h 55m
Merged PRs (30d)
1

Description

This is a follow-on from #912 - there, in the process of fixing something *else*, @pllim incidentally uncovered an odd test case:
https://github.com/astropy/specutils/pull/912/commits/703affd3ca69f630d13718698327da67ce7aa4e8#diff-17f72e2d3ef7080f564b5e8468fabad5155bed36eba4f3ee531c2fee6ac1b6aaL1034

Specifically, if you do moment(order=2,axis=1) on a 2 (spatial)d Spectrum1d, it doesn't work if the spatial dimensions are not square. This seems wrong to me, as I would expect the moment along a single spatial direction to not care at all about the other dimensionalities. So the underlying problem should probably be tracked down.

Contributor guide

Open the contributing guide

Research direction

Reproduce moment(order=2, axis=1) on a two-dimensional Spectrum1d with non-square spatial dimensions, then inspect the referenced PR #912 diff and the moment implementation to locate the dimensionality assumption. Done means the moment calculation works for rectangular spatial dimensions and a regression test covers that case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.