You are here

FocusMac Algorithms

Error message

  • Deprecated function: Return type of DatabaseStatementBase::execute($args = [], $options = []) should either be compatible with PDOStatement::execute(?array $params = null): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2244 of /home1/dhulse/public_html/_eqmac/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /home1/dhulse/public_html/_eqmac/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /home1/dhulse/public_html/_eqmac/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /home1/dhulse/public_html/_eqmac/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /home1/dhulse/public_html/_eqmac/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /home1/dhulse/public_html/_eqmac/includes/database/database.inc).
  • Deprecated function: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in drupal_random_bytes() (line 2268 of /home1/dhulse/public_html/_eqmac/includes/bootstrap.inc).
  • Deprecated function: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in url() (line 2349 of /home1/dhulse/public_html/_eqmac/includes/common.inc).
  • Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in url_is_external() (line 2393 of /home1/dhulse/public_html/_eqmac/includes/common.inc).
  • Deprecated function: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in url_is_external() (line 2395 of /home1/dhulse/public_html/_eqmac/includes/common.inc).
  • Deprecated function: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in url() (line 2311 of /home1/dhulse/public_html/_eqmac/includes/common.inc).
  • Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in url_is_external() (line 2393 of /home1/dhulse/public_html/_eqmac/includes/common.inc).
  • Deprecated function: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in url_is_external() (line 2395 of /home1/dhulse/public_html/_eqmac/includes/common.inc).
  • Deprecated function: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in url() (line 2311 of /home1/dhulse/public_html/_eqmac/includes/common.inc).
dave's picture

The past couple of days I have spent researching algorithms for use in FocusMac. The basis for the implementation comes from here:

http://users.bsdwebsolutions.com/~larryweber/ITSPaper.htm

Reading through this paper, the main concept that is required for focusing is a way to compute the Half Flux Diameter (HFD) of a star image. Searching the 'net, I came across a couple of simple algorithms for computing the HFD. However, these algorithms do not produce an accurate value when the star image gets very small (i.e. close to focus). This is because the algorithms do not perform the computation with subpixel accuracy. That is, a given pixel is effectively treated as being fully inside the HFD circle, or fully outside. In practice, an HFD of something like 2.36 pixels around the centroid of a star will clearly describe a circle that passes through a ring of pixels that lie partially inside and partially outside of the circle. To accurately compute the HFD, it is necessary to precisely account for how much of the area of each pixel falls within the HFD circle. Thus, I needed an algorithm to compute the area of overlap between a circle and an arbitrary rectangle. Googling for this turned up the following link:

http://idlastro.gsfc.nasa.gov/ftp/pro/idlphot/pixwt.pro

I have translated this algorithm into Objective C and done some basic tests and it seems to perform very well and produces quite a precise measurement of pixel weight. I will now be able to use this as the basis of another algorithm for computing the actual HFD using an iterative numerical method approach. The result should be a very accurate measure of the HFD of a star image.

Of course, having an algorithm to compute the HFD of a star isn't much good if you've just got an image from the camera and it's full of stars and you don't know where they are exactly. So another key set of algorithms will be needed to process raw images coming from the camera to identify all of the stars and find the brightest one, or perhaps allow the user to select one. This is the kind of thing that auto-guiders have to do and so it is no surprise that Google turned up this link:

http://www.mso.anu.edu.au/taros/DC-TAROS-03-AG003.pdf

Here there are a few different algorithms described for finding stars in an image and computing their centroids. From the tests described in the document, it seems that the most accurate algorithm for centroids was the ​Intensity Weighted Position​ algorithm. However, the testing described only referred to images containing one star and so the accuracy may vary with different images. This is something I plan to experiment with. Currently I am thinking of using a combination of techniques. It seems like the IWP algorithm is good for computing the centroid of a star, but it doesn't really offer a good way to find the stars in a larger image. The Bright Star algorithm seems better suited to this task. So my plan is to subtract the sky background using the first part of the IWP algorithm, then search for the rough position of stars using the Bright Star​ algorithm. Finally, I will compute the centroids of the stars found using the IWP algorithm and auto-select the star with the highest total flux as the one to use for focusing. At some point I will probably also provide a way for the user to override this automatic selection.

Once I have managed to implement and test all of these algorithms, I'll be able to start interfacing with my focuser and start trying to produce some V-curves as described in the FocusMax algorithms. I'm looking forward to this part, but the journey to get there will also be quite interesting!