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.