radio-astro-tools / spectral-cube

Library for reading and analyzing astrophysical spectral data cubes
http://spectral-cube.rtfd.org
BSD 3-Clause "New" or "Revised" License
95 stars 61 forks source link

VaryingResolutionSpectralCube.beam? #888

Open keflavich opened 10 months ago

keflavich commented 10 months ago

Idea: what if we add a .beam attribute to VaryingResolutionSpectralCube that points to the beams.common_beam()?

I've encountered a lot of cases where I load a bunch of different cubes, and some are VRSCs, while others are just SCs. I then try to loop over them and grab their beams and the code crashes. It would be nice to avoid this situation.

I think the best way to enable this would be with a context manager, since there are some operations that have to be different for the different cube types. But, for example, if you're just going to convolve the cube to a common beam anyway, this might be useful.

I'm not implementing it now because the local workaround will be much quicker at the moment, but this is a spot to brainstorm about it.