Add convenience constructors for SkyCube
See original GitHub issue@leajouvin is presenting the cube tutorial, where she introduced a helper function to create an empty SkyCube, see here.
This was confusing to some people, Gammapy itself should make it easy to create empty sky cubes in common ways. I think we should add one or two classmethods to SkyCube to help with that.
Here’s what we have now:
We do have separate classes / convenience constructors to set up sky images and energy grids already:
Since it’s orthogonal, maybe we should just say that to define an empty cube one always makes an empty sky image, and empty energy or energy bounds object, and then the SkyCube, i.e. like this:
image = SkyImage<some method and parameters>
energy = Energy<some method and parameters>
cube = SkyCube.empty(image, energy)
or if you want to avoid the local variables of image and energy, you could do this:
cube = SkyCube.empty(
image=SkyImage<some method and parameters>
energy=Energy<some method and parameters>
)
@kosack @JouvinLea @adonath @registerrier - Thoughts on what API we should put?
Anyone has time to implement something here in the coming days?
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (8 by maintainers)

Top Related StackOverflow Question
Some further thoughts:
I would keep the
.empty()method as is. I.e. it just takes a set of float/string parameters to create an empty cube. This is equivalent toSkyImage.empty(). In addition we could addSkyCube.empty_like_skyimage(image, energies), which allows creation with aSkyImageandEnergy,EnergyBoundsorQuantityobject.Resolved by #935 . Thanks for all your suggestions!