Author Topic: PJSR: Batch linear fit  (Read 7738 times)

Offline mickut

  • Newcomer
  • Posts: 3
PJSR: Batch linear fit
« on: 2013 October 02 14:13:10 »
Hi all,

Here's my first attempt at creating a script for PixInsight, it is a batch linear fit script created by shamelessly copy-pasting and hacking together something that seems to work.

The script was born from a need to fit mosaic frames better together, as I didn't get quite the results I wanted by any other means. The mosaic frames I have have wildly varying sky brightness levels, I also have a decent amount of data with a different camera orientation and framing, so I made this to automate the most boring part of guaranteeing data compatibility of mosaic frames before stacking.

After several variations my intended flow for a mosaic is to approach it thinking in layers, so:
  • build a master reference mosaic for alignment from a layer of good quality images,
  • align all images based on the master reference mosaic (without frame adaptation).
  • Then linear fit images, merge and stack layers for each filter separately:
    • linear fit a single exposure layer of images with each other and use GradientMergeMosaic to a create a per filter reference mosaic,
    • verify that the result has a reasonably uniform, seamless background, redo if necessary
    • use this script to linear fit all images to the corresponding filter reference mosaic,
    • (write a script to) use GMM and merge each exposure layer into new mosaic-size subexposure images,
    • stack the GMM'd results as with any normal, calibrated, registered set of images to make the final per-filter stacks.
  • Combine stacks into a perfect result as with any other image.

This processing flow should allow using mosaic data from various mosaic layouts and instruments with a fairly good reliability, as GMM is applied separately for each layer.

-Antti

Updated: v0.2.0 with option for resetting image minimum value back to zero.
« Last Edit: 2013 November 26 00:02:23 by mickut »

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: PJSR: Batch linear fit
« Reply #1 on: 2013 November 06 04:14:29 »
Hi Antti,

Very nice! Welcome to PixInsight development, and sorry for not having seen your post earlier.

This script is very useful, and it works perfectly with the latest development version of PixInsight 1.8.0. Can I include it in the official 1.8.0 distribution?
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline mickut

  • Newcomer
  • Posts: 3
Re: PJSR: Batch linear fit
« Reply #2 on: 2013 November 21 03:38:32 »
This script is very useful, and it works perfectly with the latest development version of PixInsight 1.8.0. Can I include it in the official 1.8.0 distribution?

Hi,

Sure. It has a slight bug, which I've fixed but haven't uploaded here yet. When fitting registered images with areas of zero, those are lifted up by the linear fit offset constant, so I added an option reset the image smallest value back to zero.

-Antti

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: PJSR: Batch linear fit
« Reply #3 on: 2013 November 21 03:44:16 »
Great! Please upload the fixed version as soon as possible. Anyway I'm going to include your script in the version that I'll upload later today.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/