Siril Writes its own FITS Headers wrong when processing manually?

I have had this issue across multiple versions of Siril including the latest version as of a few weeks ago. I don’t use scripts because I just find them overly finicky, and I don’t always take darks and bias frames or name my folders how it wants. However when I don’t debayer my images at the Conversion step, If I then try to use any calibration frames it will debayer the images WRONG when saving them after that step either with the “Debayer before saving” checkbox in calibration, or by bringing the .ser into a new sequence and debayering that way. This is fixed by Forcing Siril to use the RGGB bayer pattern and asking it to ignore information from the file’s header… BUT SIRIL WROTE THE HEADER BECAUSE SIRIL GENERATED THE SEQUENCE. The wild thing is that siril has always correctly identified what pattern I am using regardless of camera IF I just give it the raw images in the conversion tab, but for some reason when I feed it its own .ser sequencees it consistently debayeers them incorrectly. Here are pictures of the issue:

https://drive.google.com/drive/folders/1Yu0XEAPOR6cvXiWS7Ykzh6GSOn_DS9CG?usp=sharing

I feel Like I must be doing something wrong, because its insane siril cant read its own headers correctly, but I cant fathom what It is.

This is my process:

  1. Bring the light frames into a .SER sequence without debayering in the conversion tab
  2. do the same with the flats, and bias, if I took new bias frames
  3. stack the flats and bias into master flats
  4. link those master files to the use bias and use flat buttons in the calibration tab
  5. select my lights sequence, check debayer before saving, and start calibration

If I do this without forcing RGGB in settings, I will get the wrong output. If however, I debayer everything in steps one and two, before I do the calibration, there are ZERO ISSUES with letting it read the bayer info from file header. This is a fresh install of siril 1.4.4, on a windows computer, I changed no settings from default. My camera is an asi 585 mc pro shooting on the asi air (although again it debayers those files fine, only when siril generates its own files does it have problems). Can someone tell my why on earth this happens? Ive had this problem for a long time since at least last year, and I think I’ve also had this issue on my macbook too, although I don’t remember.

Additionally, when avoiding the demosaicing step until registration, this same issue appears except that simply forcing it to pick the same bayer pattern does not appear to fix it? I have less information about this issue, as I just tried this way of doing things today and encountered the issue.

First, a word on tone: writing in caps and calling things “insane” doesn’t make anyone want to dig into your problem faster. Siril is built by a few volunteers in their spare time. A plain description and a FITS header would have got you to the answer just as fast.

That said, you didn’t do anything wrong. Here is what’s going on.

The root of this is that the ASIAIR doesn’t write the ROWORDER keyword. FITS has no fixed row order: some programs store images top-down, others bottom-up. Most capture software writes ROWORDER to say which, and the ASIAIR doesn’t. Without it a file is ambiguous, and no software can know for sure how to read it. Siril handles that with the “Row-order preference” setting, which assumes top-down by default. That’s why debayering at conversion works for you.

SER files are always top-down, so when converting to SER without debayering, Siril flips the rows and has to adjust the Bayer pattern to match. That adjustment only happens when ROWORDER is actually in the header: Siril doesn’t apply the preference there. So with ASIAIR files, the SER gets the right data with a pattern off by one row (RGGB instead of GBRG). Everything that debayers that SER afterwards gets it wrong: “Debayer before saving” in calibration, debayer at registration, and so on. That part is on us, and we’ll fix it. Forcing RGGB doesn’t really solve it either, since the right value for those SER files would be GBRG.

Until it’s fixed, any of these works:

  • Convert to a FITS sequence (or FITS cube) instead of SER. That path doesn’t flip anything and gives correct results.
  • Or debayer at the conversion step, as you already do.

Asking ZWO to write ROWORDER like most capture software does wouldn’t hurt either.

1 Like

I appreciate you working on a fix for the issue. Apologies for the use of caps, I have spent many hours across different projects trying to figure out this issue and eventually receded back to the strategy of just debayering everything at the beginning, even though I have been snarkily told by people online that especially for cfa drizzling this is suboptimal. Many hours of troubleshooting had me very frustrated, and frankly I was expecting to receive a response that told me I was wrong and it wasn’t an issue, because thats been my experience on many forums. Thank you, i really do appreciate that you identified the issue and are fixing it.

Also, I think I recall having a similar issue with images generated by NINA as well in the past (everything else in my process was the same), perhaps I was not setting the FITS file settings correctly in that program, and thats why I had issues there as well, but the issue you described where the .SER file doesn’t follow the same convention as .FITS, and therefore there can be certain settings that get assumed in one step but not picked up in another seems like it could be broader than the ZWO roworder bug as well, and might be why I remember debayering problems with NINA images too. Are there potentially other issues there?

I don’t think so. NINA is using the ROWORDER keyword.