Saturday, July 18, 2015

New Horizons: more than a fly by!


Findings of the New Horizons probe, as it flew by Pluto and its moons, has surprised some and confirmed the predictions of others.

This wonderful feat of engineering, a vehicle of discovery, is a remote messenger contributing to the inevitable debate about origins.

As some seek to prove the universe old, and say “no God,” its youth becomes more apparent, and the probability of a happenstance universe realised for what it is - wishful thinking.

Friday, June 12, 2015

PixInsight DSLR_RAW PreProcessing Work Flow - Non-Linear Data: long hand


When first using PixInsight, I found that DSLR preprocessing was not easily facilitated. Following several forum discussions scripts became available smoothing the way for DSLR preprocessing tasks. There was however, no documented workflow and it was up to the user to work it out, with help from other users in the same boat.

The original DSLR RAW workflow created more problems than it solved. The traditional workflow and scaling algorithms used by PI are ideal and very flexible for linear data, but, DSLR RAW data is not strictly linear and resulted in a number of seemingly unsolved issues, and particularly, data loss.

Unfortunately, experience differed among PI DSLR users and results were inconsistent. There was a lot of head scratching, which I put down to the use of a linear data style workflow and unsuccessful attempts at dark scaling.

It is a moot point whether dark scaling is appropriate for DSLR RAW data, and rather than address the complexity here, the following workflow does not involve scaling, and makes every attempt to keep the data as intact as possible.

It cannot be overemphasized, that if the following workflow is not successful there is most likely a problem with acquisition of the frames. Acquisition is an aspect that doesn’t get enough attention - time spent getting acquisition right is time well spent and will avoid complications down stream.

Conventions - Menu toolbar selections; e.g., > View > Explorer Windows > Format Explorer > DSLR_RAW - this is first settings dialogue.

What follows is my method (long hand for illustration) of preprocessing DSLR_RAW data in PixInsight. It should be no problem to plug the same values into the BatchPreprocessing script, with the caveat that the master bias, dark and flat frames are created long hand. We can then load our master dark, master flat and light frames, tick the master dark and master flat boxes and press [ Run ]

Note: If this method doesn’t produce good results in the final image, first check the quality of darks and / or flats. This method has been tested over and again.

1. > View > Explorer Windows > Format Explorer > DSLR_RAW
As with all the windows set the parameters as shown

2. > Scripts > Batch Processing > BatchFormatConversion
Convert all files to 16 bit integer tiff

3. > Process > ImageIntegration
Integrate Bias and Dark frames to create Master Bias and Master Dark frames

4. > Process > ImageCalibration
Calibrate Flat frames with Master Bias

5. > Process > Image Integration
Integrate calibrated flat frames to create Master Flat

6. Calibrate Light Frames with Master Dark and Master Flat and debayer calibrated lights.
This shows light raw frames loaded for calibration - that’s OK, but it’s just as well to convert to tiff first.
Note: the optimize dark box is now NOT TICKED - this is NOT default. It is recommended to clear this box. However, try it both ways if you have time and compare the results.

7. > Process > StarAlignment
Register debayered images

8. Integrate light registered/aligned images
Here pixel rejection is set according to the size of the image set

The result is a PixInsight .xisf file. The output format can be changed in the BatchPreProcessing script.

In summary, the DSLR RAW calibration has been simplified by subtracting the bias from the flats only - note: the bias is not subtracted from the dark or light frames. Next the master dark is subtracted from the lights and divided the result by the master flat. The calibrated/reduced light frames are debayered, registered and integrated to produce an integrated image for post processing.

A good set of frames properly acquired is essential. Dodgy frames will mess very badly with DSLR RAW data.

Here is the BatchPreProcessing script set up once bias, dark and flat master frames have been created long hand.

Master Dark

Master Flat

LIght Frames debayer selections - again this shows RAW files - or convert to tiff beforehand

Light Frames registration selections

Light Frames integration selections

Light frames can be loaded RAW as shown. Alternatively, convert all files to 16bit .tiff

Saturday, October 25, 2014


To put things in perspective. After what seems a lifetime subscribing to scientific naturalism - evolution - and upon examining the arguments about origins, I conclude that the universe must (by way of reason and probability) be a work of intelligent creation - The Creator and His creation, Man, the epicentre of its purpose.

Further concluding, that all arguments about origins can be categorised as Creator, no Creator (God, no God), worldview - there being no middle ground. Speculation about natural origins is, as I eventually discovered, wishful thinking - a calculated diversion from reality. An “escape from reason.” There is, I am convinced, no sound argument to the contrary, however well constructed.

Friday, October 24, 2014



Thursday, May 1, 2014

Astrophotography DSLR RAW Data Calibration: preprocessing


This post has been rewritten substantially, and has its origins in an article by Craig Stark on DSLR RAW data non-linearity.

Please note: There has been a lot of updates to the software package further down the page. If you have used/are using the utility it has seen a lot of refinement and readers may wish to check occasionally. The latest version is mainly cosmetic fixes.

Corrections applied to DSLR RAW data, before it leaves the camera, in particular, long exposures such as dark and light frames (irrespective of user selectable camera options), affects the linearity of the RAW files. As a result DSLR RAW data does not approach that of dedicated CCD/scientific cameras.

Differences show up during preprocessing, where the results obtained from DSLR RAW data, to which linear processing tecniques have been applied, may not be consistent. This often amounts to data loss, and consequently, dissapointment, frustratingly poor results and hours spent unecessarily looking for solutions.

There are useful strategies to avoid data loss when working with DSLR RAW data, as there are one or two complications. As a rule DSLR RAW data reduction benefits from consistent temperature across the data set. In particular light and dark frames.

Temperature reduction overnight can be significant, and 5C is touted as an acceptable variation. Obviously, larger temperature variations require modification to image acquisition strategies. Dark scaling is not discussed here.

Jim Solomon provides a recipe for DLSR RAW data acquisition, and without going into a lot of unnecessary detail, providing lights and darks are taken at a reasonably consistent temperature the following strategy is safe and effective.

I have tested this procedure in AstroArt, Nebulosity, Pixinsight, Regim, and a bash script that uses DCRAW and ImageMagick to perform the data reduction process. In every case the results were nearly identical. The script is available for download for Linux and Mac users, further down the page.

I recommend reading the blog on dithering… which is DSLR salvation, in my view.

Please note, the term flat dark is interchangeable with bias, where flats are taken at shutter speeds of less than a second or two, as opposed to longer flat exposures where dark current may be a consideration.

The formula that relates these physical phenomenon, and the actual frames we’ll collect over a night of imaging, are as follows:

(1) Light = (Signal * Flat Signal) + Dark + Offset

where Signal is the image of the target object we wish we could collect under ideal circumstances, and Light is the image we actually captured. Rearranging the terms, we have:

(2) Signal = Light - (Dark + Offset)/Flat Signal

But realize that the Flats we capture with the camera will, in turn, be “polluted” by Darks and Offsets in their own right, and so we must subtract Flat Darks and Flat Offsets from the Flat Lights as follows:

(3) Flat Signal = Flat Light - (Flat Dark + Flat Offset)

So, plugging equation (3) into equation (2), yields this general formula:

(4) Signal = Light - (Dark + Offset)/Flat Light - (Flat Dark + Flat Offset)

Here, “Dark” refers to the thermal noise signal of the imaging camera; i.e., the noise signal that varies in proportion to temperature, ISO, and exposure length. Note, however, that any exposure we take with a digital camera contains the Offset, and “Darks” are no exception. So, if we define Dark’ to be an exposure of some length with the body cap in place, then Dark’ = Dark + Offset, and, similarly, Flat Dark’ = Flat Dark + Offset. Plugging these values into Equation 4 yields the following simplified form:

(5) Signal = Light - Dark’/Flat Light - Flat Dark’

And just to make things even simpler, let’s drop the prime indicators (the apostrophes) that we stuck on “Dark” and “Flat Dark”, and just remember that by “Dark” and “Flat Dark” we mean frames captured with the body cap in place but with the same ISO and exposure length as the Lights and Flat Lights, respectively. That gives us our final form:

(6) Signal = Light - Dark/Flat Light - Flat Dark (bias) - editor’s comment

Equation 6 gives us our marching orders for astrophotography, providing us with a set of Frames that must be captured for each imaging session. The actual order in which I choose to capture these frames is as follows, the reasons for which will be made clear in the acquisition section below:

Flat Darks (bias) editor’s comment
Flat Lights

RAWPREPRO - DSLR RAW file conversion and data reduction/calibration script

RAWPREPRO is a Linux based DSLR RAW image conversion and data reduction/calibration script. It was originally intended to be nothing more than a means of converting DSLR RAW images to 16bit integer tiff (CFA monochrome, no flip/rotation) files for use in programs such as DSS.

RAWPREPRO has grown into a GUI based conversion and image calibration utility and uses DCRAW for conversion and ImageMagick to perform the image calibration/reduction/preprocessing steps - DCRAW and ImageMagick must be installed to take advantage of all preprocessing options.

Besides data conversion and calibration, RAWPREPRO orders the image preprocessing task through a folder structure, placing files in predictable places for easy access. It keeps things in one place, under a project name, renaming files accordingly. All DSLR RAW data files are preserved. Files can be added or removed, and the project run over and again, as required. Temporary files are deleted at the end of the script saving disk space.

The 3 main functions are as follows;

1. RAWPREPRO uses dcraw to convert DSLR RAW files to 16bit integer CFA monochrome tiff files (no flip) for calibration in RAWPREPRO, itself, or an external preprocessing program - Regim, DSS and others.

2. RAWPREPRO uses ImageMagick to perform the mathematical functions for the creation of master frames, which may be imported into an external preprocessing program.

3.RAWPREPRO uses ImageMagick for the calibration/reduction of light frames, using the safe and effective, bias-in-the-dark method of data reduction.

Note: RAWPREPRO does not perform cosmetic correction or pixel rejection.

Installation and Operation - very quick start:
Following extraction of the zip files, rawprepro may be installed by clicking the script - this will also create a desktop link if desired - if not run rawprepro from command line by typing rawprepro at the prompt.

Alternatively, rawprepro may be run, without installation, within the extracted folder by clicking the rawprepro file or by command line, typing ./rawprepro at the prompt.

The older command line version may be updated for MacOS users. Presently, it is not as flexible as the Linux GUI version, but is reported to work. It performs the same main functions as the GUI version, but requires the user to load files into the respective folders manually. A cocoadialog version would be nice - anyone?

rawprepro_2.2 - cosmetic fixes - option to launch PixInsight for debayer, alignment and stacking.

rawprepro 0.8208 - old version - command line -

RAWPREPRO Quick Start Guide - smaller download
RAWPREPRO Quick Start Guide - slightly bigger download - refresh PDF if displayed in browser.

Acquisition notes:

I borrowed this crop from here. I thought it was worth including. While it may be amp glow, first check that the view finder is not the culprit. This artifact looks suspiciously like light leaking through the viewfinder. Tape up the view finder before imaging.