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

Add Resample Capabilities to NDCube #155

Closed
DanRyanIrish opened this issue Apr 5, 2019 · 2 comments
Closed

Add Resample Capabilities to NDCube #155

DanRyanIrish opened this issue Apr 5, 2019 · 2 comments
Labels
Milestone

Comments

@DanRyanIrish
Copy link
Member

Description

NDCube should have the ability to:

  • Downsample the resolution of the cube via a number of different methods, e.g.:
    • mean
    • sum
    • min
    • max
    • median
  • Collapse an axis, which is a special case of the first point
  • Upsample based on N-D fits, e.g. spline fits.

The first pass of this functionality should only support upsampling or downsampling an integer multiple of the resolution along each axis. Later versions could support resampling onto a user-defined grid for each axis/axes. However, this may be beyond the minimalist scope of ndcube and perhaps more advanced resampling methods should be left to higher level subclasses of the ndcube data classes.

A possible API might be

my_cube.resample((1, 1/2, 3, 100), method=None)

where my_cube is a 4-D NDCube instance and the input is a tuple of the resample factor for each data axis, i.e. the size of each pixel as a factor of the original pixel size in that axis. In this scheme, 1 denotes no resampling.
A number, x where 0 < x < 1, e.g. 1/2, denotes the axis will be upsampled so that each pixel is half as big as the original pixel along that axis. In this case, x will be inverted and rounded to the nearest integer and that will be the upsample factor.
Numbers > 1, e.g. 3, denote that the new pixels will be 3 times as big as the original pixels along this axis. In the first pass, this number must be an integer factor of the number of pixels along that axis. Numbers > 1 will be rounded to the nearest integer.
A number that is >= the number of pixels along the axis collapses the axis entirely and reduces the dimensionality of the cube.
The method kwarg (or a better name) would denote how the resampling would be done. In cases where the resample factor is > 1, i.e. downsampling, the allowed values may be "mean", "sum", "min", "max", "median".
In cases where the resample factor is < 1, the allowed values may be "spline", or whatever fitting types are supported.

Additional context

@Cadair Cadair added this to the 2.1 milestone Jan 8, 2020
@DanRyanIrish DanRyanIrish modified the milestones: 2.1, 2.0 Apr 9, 2020
@DanRyanIrish
Copy link
Member Author

This an now be implemented using the new reproject functionality in astropy wcs.

@DanRyanIrish
Copy link
Member Author

This issue is addressed by #450

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

No branches or pull requests

3 participants