Saturday, October 20, 2012

M42 with Ekos & PixInsight

A few days ago, I used Ekos to take a 100-seconds exposure for M42, the Orion's Nebula, using Orion EON 120mm scope and QSI 583wsg CCD.

Initially, I processed the image using KStars FITSViewer histogram tool to bring out the contrast, then I used GIMP to crop and fine tune the image using the curves tool. Only the light frame was captured, no Dark, Bias, or Flat frames were taken, and hence no pre-processing was performed. The outcome was the following:

M42 with minimal processing

You can immediately notice that the M42 core is over exposed, as it can get quite tricky to balance long exposures to bring out the nebula details without saturating the core. Therefore, I decided to process the image under PixInsight, a multi-platform advanced image processing tool tailored for astrophotography. Using Dynamic Background Extraction (DBE), HDR transforms, and ACDNR noise reduction tool, the results were quite impressive:

M42 after PixInsight processing
With Ekos & PixInsight, I finally have everything I need for astrophotography under Linux!

Tuesday, October 9, 2012

First image with Ekos!

For the past few weeks, Ekos, KStars Astrophotography tool, went thought a lot of updates and testing. Today I was able to use Ekos to take my first astrophotography image of M33, the Triangulum Galaxy using QSI 583wsg CCD.

M33 - 5 minutes exposure

During the course of the night, and after setting up my Orion EON 120mm refractor, Loadstar autoguider, and Robofocus at the roof of my house, I began with using Ekos Autofocus tool to get the CCD focused, then used the autoguiding tool to keep the M 33 field of view centered during the 5 minute exposure run. This is a raw image with no filters and no dark or flat frames taken to perform post-processing and calibration. It was processed by GIMP by adjusting levels to bring out the contrast. Unfortunately, GIMP does not handle 16bit depth images as of now, which limits its capability in processing astrophotography images.

It is very exciting to finally use 100% based Linux software to perform astrophotography tasks. Ekos is still under heavy development, and is slated for release in the next KDE 4.10 release.

Sunday, September 9, 2012

Autoguiding in KStars

In a previous post, I briefly talked about developing the Autoguide feature in KStars. Guiding is process by which a star field is kept stationary within the field of view of a telescope when performing long exposure astronomical imaging. The telescope mount must keep tracking the selected celestial object during the imaging process as it transit the sky. Due to imperfections in the mechanics of the mount and periodic errors, the star field may drift with time. If the drift is not corrected, the resulting image may contain star trails among other deformities. The guiding process depends on selecting a reference star in the frame and correcting the telescope motion by detecting drifts in the telescope axes, and issuing correction commands accordingly.

Guiding under Ekos
Autoguiding feature was once a GSoC 2012 project, but students who got accepted were selected for other projects in KStars, so I decided to implement the feature myself. KStars supports INDI which can operate and control numerous astronomical devices. The goal of the GSoC project is to add autoguiding support to KStars Ekos tool. Ekos is a tool to aid amateur astronomers in astrophotography. It enables focusing, guiding, and capture of astronomical images using INDI.

So instead of reinventing the wheel, I decided to base the autoguiding code on existing open source software. Under Linux, the primary tools are OpenPHD and Lin Guider.  After researching both options, Andrew Stepanenko lin_guider was selected because it was battle tested, and especially since it is based on Qt and hence, import will be easier. After a couple of weeks of importing the code and rewritings part of it to fit KStars and INDI framework, the autoguider tool was complete, at least under simulation. The autoguiding tool, in addition to the autofocus tool previously developed should now complete the basic stack of tools required by astrophotography. The next step is to field test all those features!

The following is a video illustrating the autoguide feature in KStars:

Tuesday, August 21, 2012

New filters for KStars FITSViewer

In preparation for my first astrophotography trial using 100% Linux based software, I added a couple of important filters to KStars FITSViewer tool. The first filter Equalize performs histogram equalization which enhances the contrast of an image. The filter works quite well with images of diffuse continuous flux such as nebulae or galaxies. For star fields, the filter actually significantly raises the background noise level, and stars become buried within the noise. Here is an example of applying the Equalize filter to M42. As you can see, the contrast of the image is greatly enhanced.

M42 before Equalize filter
M42 after Equalize filter
The second filter is a simple low pass filter that brings out the details of an image without adding too much noise. The filter calculates a cutoff point in the image histogram, and rescales the image after chopping off the high flux pixels. The filter is demonstrated in the example below:

Star field before Low Filter Pass

Star field after Low Filter Pass

Monday, August 20, 2012

Getting Focused with KStars

KStars Ekos tool

The excitement of discovery is not confined within the realm of professional astronomy only, amateur astronomers have contributed to many significant discoveries including spotting Supernova 1987A, several comets, and even exo-planets! As the hardware used to observe the night sky gets more sophisticated, affordable, and sensitive, so does the sophistication and variety of the software. One of the primary issues for amateur astronomers utilizing Linux is not the lack of hardware support as it was often the case a few years ago. Nowadays most astronomical hardware is well supported under Linux, with the exception of a few cameras and auxiliary devices. However, what is severely lacking is a complete software suite that caters to the needs of amateur astronomers. As it stands now, you have a plethora of astronomy and control applications in Linux that cater to different stages of the amateur astronomer astrophotography train: You can use App X to control the telescope and camera, App Y to perform guiding, App Z to focus, and none of these applications talk to each other! If you want to perform stacking, you have to find another program, and list just goes on. This can be incredibly frustrating for amateur astronomers new to Linux, and even those with experience. Last year, I purchased a 120mm aprochromatic refractor telescope, Quantum Scientific Imaging (QSI) CCD camera , Starlight Xpress Lodestar autoguider, and RoboFocus. There, I was set for astrophotography!

Star detection in KStars

After working a bit on INDI drivers, I was able to control these devices directly under KStars, but it was not enough. I needed tools to aid me in alignment, focusing, and guiding. The INDI interface in KStars was designed for generic control, and not to serve the particularities of astrophtography. Hence, Ekos was born, a complete tool in KStars to cater for all those requirements in one intuitive easy to use interface.

Ekos plans to support alignment, focusing, guiding, capture, and stacking of images using the telescope, CCD (and guider), filter wheel, and focuser. This required almost a complete rewrite of the KStars INDI engine in order to support the features required by Ekos. Currently, the capture and focusing modules were developed.

Focusing has to be of the most daunting, and dreadful, processes for an amateur astronomer. If you are looking to get one of those crisp images that you see in Sky & Telescope or Astronomy Picture of the Day, be prepared for long hours of trial, error, and disappointment. Microfocusers emerged to aid in the fine focusing required for super crisp CCD images. Due to the lack of any general purpose focusing tool in Linux, I decided to develop my own. It works with all CCDs and Focusers supported by INDI. In order to focus an image, you need to establish a numerical method for gauging how good your focus is. It's easy when you look at an image and can see it as unfocused, as the human is very good at detecting that, but how can a program possibly know that?

Initial focus condition

There are multiple methods. One is to calculate the Full Width at Half Maximum (FHWM) of a star profile within an image, and then adjust the focus until an optimal (narrower) FWHM is reached. The problem with FWHM is that it assumes the initial focus position to be close to the critical focus. Additionally, FWHM does not perform very well under low intensity fluxes. An Alternative method is Half-Flux-Radius (HFR), which is a measure of the width in pixels counting from the center of the stars until the accumulated intensity is half of the total flux of the star. HFR proved to be much more stable in conditions where you might have unfavorable sky conditions, when the brightness profile of the stars is low, and when the starting position of the focus is far from the optimal focus.

Final focus condition

After Ekos processes an image to find the center of stars, it measures the HFR for each star, and the average HFR for the image overall. It then asks the focuser to focus in or out, and re-measures the HFR. This establishes a V curve in which the sweet spot of optimal focus is at the center of the V curve, and the slope of which depends on the properties of the telescope and camera in use. Because the HFR varies linearly with focus distance, it is possible to calculate the optimal focus point. In practice, Ekos performs several large iterations to until it get closer to the optimal focus where the gears change and smaller, finer moves are now made to reach the optimal focus. Ekos let the user set a configurable tolerance parameter, or how good is good enough. Under simulation, the Ekos Autofocus tool runs very well, taking only about 25 seconds to reach focus, even with added extra noise and sky glow thrown in to confuse the algorithm. But of course this never prepares you for the challenges faced under real sky conditions. This is what I plan to do in the next few days: put Ekos to the test! By field testing Ekos, the tool can better adjust to the variable real sky conditions.

In addition to Ekos Autofocus tool, we are also working on a guiding module that should keep the telescope synced with a guide star. This along with other exciting features should make Ekos along with KStars powerful features very attractive to amateur astronomers.

Friday, April 27, 2012


It's been a while since I last posted here. I'm going to continue covering KNRO progress, which is now live and operational!