Banner

NormalizeScaleGradient (NSG)

For the most accurate results from NormalizeScaleGradient, you need to purchase a license for the C++ module NSGXnml. This runs in the background and enables all of NSG's extra capabilities. See the Purchase page.


Customer Reviews (NSG)

Sky at Night magazine, October 2023, p78

Mathew Ludgate, Astronomy Photographer of the year shortlisted entrant in the 'Stars and Nebulae' category:

... After using the WBPP script in PixInsight to perform image calibration and registration, I utilised the Normalize Scale Gradient (NSG) script by John Murphy. This corrects the brightness and gradient of your subs using differential photometry to model the relative scales and gradients. I image at a dark site but I still find NSG very useful as a first step...

Paul Denny, 2023

... thank you for writing this script [NSG] and making it available to the astrophotography community. I am quite new to this and still on a steep learning curve, but I do know enough to see what a great tool this is, as is your excellent documentation and YouTube videos. I feel as though I understand and have control over this part of the processing flow for the first time.

AdamBlockStudios, 2022

... I helped (with some advice and ideas) the brilliant John Murphy as he crafted NormalizeScaleGradient (NSG). The normalization and weighting of data is a fundamental and critical component of image processing.

www.adamblockstudios.com


An introduction to NSG


NormalizeScaleGradient (NSG) normalizes the scale and gradient to that of the reference image. Differential stellar photometry is used to determine the scale, and a surface spline to model the relative gradient. It is designed to achieve the following goals:

Scaling the target images: This involves multiplying each target image by a factor to make its (brightness) scale match that of the reference image. This has to be done before gradient removal.

Relative gradient removal: After normalization, all the target frames will only contain the gradient present in the reference image. By choosing the reference image carefully, the overall gradient is reduced and simplified.

Image weights: Calculate image weights using the scientifically correct formula (signal to noise ratio)²

Accurate normalization is crucial for good data rejection while stacking.

Finding the best reference image

PixInsight already includes a blink tool, but for judging gradients, the displayed images can be misleading. The reason for this is it's difficult to display all the images in a completely fair way; The STF and Histogram functions do not accurately normalize the images. An image with a large gradient is likely to be scaled differently to an image without light pollution. This makes it difficult to determine how the image gradients compare.

The NSG blink dialog is specialized for finding the best reference image:


NSG Blink

Accurate scale factor

Photometry is used to determine a very accurate (brightness) scale factor. Great care is taken to ensure that exactly the same stars are used in the reference and target images.

Photometry

Gradient correction: What you see is what you get.

Mouse over the image to display the gradient correction. This simulates the user toggling the 'Gradient corrected target' checkbox. If the reference checkbox is not selected (as in this example), it blinks between the uncorrected and corrected target image.

If the reference checkbox is selected, it blinks between the reference image and corrected target image. Modify the 'Gradient smoothness' until the correction is excellent. What you see is what you get, making it easy to achieve optimum results.

Uncorrected / corrected image

It is important to understand that NSG is designed to make the target image's gradient match the reference image. Any gradient in the reference image will remain and must be removed after stacking with a process such as DynamicBackgroundExtraction.

Transmission graph: Detect the clouds!

A sudden dip indicates a reduction in the astronomical signal (this graph ignores variations in light pollution). A sudden dip indicates clouds, or a partially obscured telescope aperture (for example, by the dome).

Clouded images are always worth removing because they can introduce complex gradients that are difficult to remove. We want our image to faithfully represent the astronomical object, and not the local weather conditions!

Transmission graph

Weight graph: Specify image weight cut off.

The image weight is calculated from the (signal to noise ratio)². This is affected by transmission, light pollution and camera noise.

Weight graph

ImageIntegration: Displayed on NSG exit.

On NSG's exit, ImageIntegration is invoked, configured to use NSG's results.

The Normalization is set to 'Local normalization' (In hindsight, I should probably have called NSG 'PhotometricLocalNormalization', but it's probably too late to change its name now). ImageIntegration will use the *.xnml local normalization files that NSG created. These files contain the (brightness) scale factor and gradient correction; ImageIntegration will apply them to the target images.

The 'Weights' is set to 'PSF Scale SNR'. This instructs ImageIntegration to use the weights that NSG calculated and stored within the *.xnml local normalization files.

The target files are added to ImageIntegration in order of decreasing weight. Images that failed either the transmission or weight cutoff criteria are disabled with a 'x'.

ImageIntegration