-
Notifications
You must be signed in to change notification settings - Fork 6
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
Opportunities to simplify codebase by leveraging ndcube 2.3 #108
Comments
FYI ndcube 2.3 has now been officially released, in case anyone is interested for this issue or any other. |
Hello @DanRyanIrish. thanks for reaching out! These are some exciting and useful features! I will take a look and see how we can clean-up and simplify the code now. On point (3), how does rebinning work with sliceable metadata? Will all grid-aligned metadata be rebinned too or will they just be sliced? |
Hi @MJWeberg. That's a great question regarding point 3. To answer that, it's important to first note that there are two types of axis-aware metadata data: axis-aligned and grid-aligned. Axis-aligned is what we call it when there's a single value associated with each axis. So, an example is labels for each axis, e.g. The second type of metadata is grid-aligned. An example of this might be your corrected wavelength or radcal, which has a value at every pixel in the grid along a subset of axes. In this case, there is no general solution to how this metadata should be altered to represent the rebinning. So by default, In the specific case of the corrected wavelength, the "more philosophical correct" approach within the ndcube paradigm, would be to create a WCS that includes the corrected wavelength. However, if this is not smoothly varying, it might not be expressable as a FITS-WCS and so gWCS might be needed. If one of your requirements is that everything it writtable back to FITS files, this is not ideal. An alternative would be to extend |
ndcube
v2.3.0 is in the process of being released (a release candidate is already available). This includes some new features that could be very helpful to simplifying theeispac
code-base in a few places and make it easier to maintain:NDMeta
object that can be attached toNDCube
instead of a plaindict
, allows metadata to be associated with an axis/axes, which can be one, all, or a subset of the cube's axes. The metadata can have a value for each pixel along the associated axis/axes, or simply be a scalar per axis. Moreover, ifNDCube.meta
is anNDMeta
object, the metadata is automatically sliced by theNDCube
slicing infrastructure. This could help simplify the metadata tracking ineispac
.wavelength
and/orradcal
values into the metadata. ThenEISCube.wavelength
andEISCube.radcal
could simply be pointers to relevant key inEISCube.meta
. This meanseispac
wouldn't have to do the slicing of these attributes itself, as it would be done automatically in the meta byNDCube
. However, perhaps there are other considerations which means it's better to keep one or both of these separate from the metadata?NDCube.rebin
andEISCube.sum_spectra
: As ofndcube
v2.3.0,NDCube.rebin
now accepts-1
as a shortcut to sum over an entire axis. This could make the implementation ofEISCube.sum_spectra
much simpler and easier to maintain.NDCube.rebin
also enables summing (or averaging) over other axes, which could be used to sum over regions of the slit to increase signal-to-noise before performing spectral fits. If keeping the WCS as a FITS-WCS is a concern, see Role of"mod_index"
? #109, which discusses howndcube
can help do this foreispac
.NDCube
now supports arithmetic operations with scalars, arrays and astropy Quantities. This could help simplify the implementation ofEISCube.apply/remove_radcal
by performing the multiplication/division and doing the unit handling. Updating the uncertainties and"notes"
would still need to be done separately, so the methods would still be needed. But again, it may simplify the code-base, making it easier to maintain?The release candidate for ndcube v2.3.0 can be installed via pip:
pip install ndcube==2.3.0rc1
and a general release will be available via pip and conda in the near future.Hope this helpful info, even if not for the ideas I've suggested above.
The text was updated successfully, but these errors were encountered: