fmsoftware.dev PixInsight script

Sub-exposure planning from your own frames

SubExposureCalculator

A guided PixInsight script that measures your camera and your sky directly from raw frames, then suggests how long your sub-exposures should be, and shows you why.

The main window of SubExposureCalculator in PixInsight. Step 1 shows a camera chosen from a list, with its read noise and gain. Step 2 lists one raw light frame. Step 3 holds the options. The results begin with a suggested sub-exposure of about 5 to 8 minutes for an HaO3 filter.
The main window after one calculation: choose a camera, add light frames, press Calculate. A real session with a ZWO ASI2600MC Pro on the Heart Nebula.

The idea

Read noise stops mattering at some length

Every sub carries the same read noise, whatever its length. A longer sub lets the sky signal grow until the read noise is a small part of the total. The ratio m tells you where you are. There is no single optimum, and total integration time matters far more than sub length.

  • m = S / R²S is the sky signal per sub and R the read noise, both in electrons.
  • efficiency = √( m / (m + 1) )Compared with one single long exposure.
  • t = m × R² / PSub length for a chosen m, where P is the sky rate in electrons per second.
Stack efficiency against m A curve rising steeply and then flattening. Efficiency is 87 percent at m equals 3, 91 percent at m equals 5 and 95 percent at m equals 10. 100% 75% 50% 25% 0 0 5 10 15 20 3 m = sky signal per sub ÷ read noise² stack efficiency 87% 91% 95%
Figure 1Stack efficiency against m. It is 87% at m = 3, 91% at m = 5 and 95% at m = 10. The curve flattens quickly, so doubling a sub that is already well past m = 5 gains little.

What it does

It measures instead of asking you to type numbers

Works for mono cameras and for one-shot-colour cameras, where red, green and blue are measured separately.

01

Your camera, once

Read noise, bias level and conversion gain, measured from raw bias and flat frames and saved in a camera list. Later runs only read your light frames.

02

Your sky

The background rate in electrons per second, through each filter, from your own light frames. Exposure time and filter come from the FITS header.

03

A sub length to use

One suggestion per filter, rounded to a sub length you would actually set. A colour camera gets a single exposure that serves red, green and blue.

FramesHow manyNotes
Bias2 or moreSingle frames at the shortest exposure, sensor covered. Not a master bias.
Flats2 or more, optionalTaken back to back, through any filters. Used to measure e⁻/ADU. Without flats you type the value.
Lights1 or moreOrdinary subs of any target.

All frames must be raw: straight from the camera, not calibrated, not debayered and not stacked, and all at the same gain, offset and binning.

A closer look

It shows what each number rests on

A suggestion is only useful if you can see where it comes from. Three windows do that. The pictures are real captures from PixInsight.

The graph window. Three curves, for red, green and blue, show stack efficiency rising with sub-exposure time. A gold band marks the suggested range from 5 to 8 minutes, a dotted line marks the 5 minute exposure of the measured frame, and a table lists each channel's efficiency at both ends.
Graph

A suggestion, as an honest range

The time depends on the read noise squared, and a sensor has two read noise figures: that of a typical pixel and that of all pixels, noisy ones included. The script works out both and shows the range between them.

  • One curve per channel: how much of the ideal signal-to-noise ratio a stack keeps at each sub length.
  • The gold band is the suggestion. Where the curves flatten, longer subs stop paying.
  • For a colour camera the channel with the weakest sky sets the time.
The sky background map. A light frame is cut into 16 by 16 tiles, each labelled with its sky level and shaded from dark blue for the darkest to pale yellow for the brightest. The nebula shows as a bright area in the middle and one tile near the bottom left is outlined as the one that set the background.
Map

Where the background was read

The sky background decides everything else, so the script shows it across the frame, tile by tile, with the tile that set the reading outlined.

  • By default it finds empty sky on its own, even when a nebula fills much of the frame.
  • Or draw a preview on a patch of sky you trust and use that instead. The map then shows your rectangle next to what the tiles would have read.
  • You see where the nebula lies and how much the corners darken.
The window that measures a camera. It has a name field, a list of raw bias frames, a list of raw flat frames with a choice between measuring the gain and typing it, a sensor choice, and a Measure and save button.
Camera list

Measure a camera once, from as many frames as you like

Bias level, read noise and gain belong to a camera at one gain, offset and binning, not to a night. Measure them once and pick the camera from a list afterwards.

  • Frames are used in pairs and the median is taken, so one bad frame or a cosmic ray hit cannot move the result.
  • Flats through any mix of filters count towards one gain, and the gain per filter is shown as a check.
  • A camera can be exported to a small file and imported on another computer.
  • 12 and 14 bit cameras. Data stored scaled to 16 bit is detected and measured in the camera's own steps, which keeps faint sky rates accurate.
  • Moon and Sun. Every frame is logged with the Moon's phase, its altitude and its distance from the target, so you can build your own table of sky brightness.
  • CSV export. Every measured value per frame and channel, including how the background was found.
  • Nothing leaves your computer. The script makes no network connections. It writes only the files you ask for, and keeps its settings and camera list inside PixInsight.

Install

Add the repository, then check for updates

  1. In PixInsight choose RESOURCES > Updates > Manage Repositories, click Add and paste this address, including the final slash:
    https://pixinsight.fmsoftware.dev/
  2. Choose RESOURCES > Updates > Check for Updates and apply the update.
  3. Restart PixInsight. The script is now at SCRIPT > Utilities > SubExposureCalculator, and later versions arrive through the same update check.

The repository is not signed yet, so PixInsight may show a warning before installing. To run it without the update system, download the script file and use SCRIPT > Execute Script File….

Status

Version 1.0.2: new, and still gathering field testing

The calculations are tested against simulated frames with known read noise, gain and sky rate. The script has been run in PixInsight on macOS with a ZWO ASI2600MC Pro. Other cameras and platforms have had little use so far. If something does not work, please open an issue.