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
98 stars 65 forks source link

StokesSpectralCube access #750

Closed keflavich closed 3 years ago

keflavich commented 3 years ago

To access the components of a StokesSpectralCube, you presently need to access a private attribute, for example:

cube_I = cube._stokes_data['I']

That's not good! We should probably implement at least a public access like:

cube_I = cube.stokes_data['I']

and better still,

cube_I = cube['I']

@Kitchi, what do you think?

A PR would be welcome!

Kitchi commented 3 years ago

I've got a PR ready with the first suggestion, but I like the second one a lot more. Both @preshanth and I can work on implementing that for the Stokes cubes.

preshanth commented 3 years ago

I agree that we should implement something along the second style of cube_I = cube['I']. This will allow for internal conversion functions between the different stokes say. You have a cube that contains ['I','Q','U','V'] then when a user asks for cube_P=cube['P'] we can perform the stokes conversion internally.

keflavich commented 3 years ago

closed by #751