Astropy and color images (data cubes) and getting started

I thought getting started would be fairly easy with the CCD Data Reduction guidebook. It’s very nice.

Until I found that many things kept giving me errors - seemingly because the images I am working with are in color and thus are data cubes.
I’ve managed to start figuring out that I need the right shape and sometimes need to transpose or move the axes around.
But even that isn’t always sufficient. For example, ccdp.combine seems to be expecting 2D images.

Yet many top of the line sensors are color.

I’m not foreign to complexity but getting started here is not for the faint of heart. If only there were some tutorials for data processing of your image data that “just worked” (LOL) With my images.

Loaded question: What are best practices with something like an ASI2600 MC PRO?

I’m getting started finally and find that I need to learn a bit of everything just to get things off the ground, but finding some end to end examples or best practices would be super helpful.

Like, do I need to extract the red/green/blue parts of my images and then do stacking separately? (Seems a bit unlikely, but who knows.)

I’ve been experimenting first with my digital camera on my telescope just to start learning the processing pipeline.

And I want to learn to do this with python directly - I’m not planning on PixInsight, etc. At least not yet.

And thanks.

1 Like

Data from cameras like the ASI2600 are not data cubes, they’re Bayer filter arrays. Each pixel has its own filter. For a variety of reasons, professional astronomy cameras rarely use this approach, instead using a filter changer that covers the whole detector. As far as I know, astropy has never developed tools for working directly with Bayer array data: it’s tricky to work with directly, because you can’t just align and stack the images, since adjacent pixels have different filters.

I think you’ll have to de-Bayer the data before sending it through astropy; here’s a stackoverflow post with a suggestion on that.

Tools like PixInsight are aimed at amateur astronomers who use Bayer filter array cameras, so they have built-in tools for dealing with that kind of data.

1 Like

Just to add a bit more to this, once you have de-Bayered the data then you ought to be able to work with the three colors separately. There are some science cameras that have Bayer-like filters on their sensors, though they aren’t the usual RGB filters on less expensive cameras.

On the telescope at my university the camera is black and white, and to make a color image we take three pictures one through a red filter, one through a green , and one through a blue filter.

I also on the side do a little bit of astrophotography (only wide-field on a tripod, not through a telescope) – my take away from that is that it easy to make a color picture but very much harder to make a color picture that looks spectacular like the ones I see on twitted from folks like you!

I paid for AstroPixelProcessor (not better than PixInsight, about the same price) because that person’s experience with astrophotography as expressed in their software was worth it to me. They calibrate image color by building a color-color diagram of the stars to make sure most of the stars are red, there are tools for removing (or processing separately) the stars and any nebulosity in the image, and more.

Though in principle all of the tools exist in Python for doing that stuff, I don’t know of any open source python effort to really compete with things like PixInsight.

One question, though: Would it be helpful to add a paragraph somewhere near the beginning of the guide alerting folks to the fact that if they have a color camera they will need to do something different, and perhaps point them towards some resources on de-Bayering?

I appreciate the comments and confess I muddled my question, partly due to misunderstanding.
I’m currently playing with raw images from Olympus EM-5. These, I believe, are RGB and are the main source of my question.
I had, wrongly, assumed that the ASI 2600 was the same thing (oof). Good to know there’s a lot more involved than what I naively assumed.

I’m looking at AstroPixelProcessor too. My workhorse computer is only 17 years old… so I’m having some difficulty yet (ya think?!?). Currently upgrading the ram in it to 24 GB (max it can go) to see if I can complete some analysis (processing, stacking, etc.). I want to have a complete processing example working before I consider a real computer for this purpose.


EM-5 raws are also Bayer arrays, like the ASI-2600, so you would have to do the same de-Bayering to work with them with astropy.

Yes, I think this would be useful, since amateur astronomers to come looking for python astronomy resources periodically. I don’t know which debayer library we should recommend (I’v never tried any of them), and it may be difficult with some proprietary formats.