<sect2 id="ekos-align">
    <title>Align</title>
    <indexterm>
        <primary>Tools</primary>
        <secondary>Ekos</secondary>
        <tertiary>Align</tertiary>
    </indexterm>
    <sect3 id="ekos-align-introduction">
        <title>Introduction</title>
        <screenshot>
            <screeninfo>
                Ekos Align Module
            </screeninfo>
            <mediaobject>
                <imageobject>
                    <imagedata fileref="ekos_astrometry.png" format="PNG"/>
                </imageobject>
                <textobject>
                    <phrase>Ekos Align Module</phrase>
                </textobject>
            </mediaobject>
        </screenshot>
        <para>
            Ekos Alignment Module enables highly accurate GOTOs to within sub-arcseconds accuracy and can measure and correct polar alignment errors. This is possible thanks to the astrometry.net solver. Ekos begins by capturing an image of a star field, feeding that image to <ulink url="https://astrometry.net">astrometry.net</ulink> solver, and getting the central coordinates (RA, DEC) of the image. The solver essentially performs a pattern recognition against a catalog of millions of stars. Once the coordinates are determined, the true pointing of the telescope is known.
        </para>
        <para>
            Often, there is a discrepancy between where the telescope thinks it is looking at and where it is truly pointing. The magnitude of this discrepancy can range from a few arcminutes to a couple of degrees. Ekos can then correct the discrepancy by either syncing to the new coordinates, or by slewing the mount to the desired target originally requested.
        </para>
        <para>
            Furthermore, Ekos provides two tools to measure and correct polar alignment errors:
        </para>
        <itemizedlist>
            <listitem>
                <para>
                    <guilabel>Polar Alignment Assistant Tool</guilabel>: A very easy tool to measure and correct polar errors. It takes three images near the celestial pole (Close to Polaris for Northern Hemisphere) and then calculates the offset between the mount axis and polar axis.
                </para>
            </listitem>
            <listitem>
                <para>
                    <guilabel>Legacy Polar Alignment Tool</guilabel>: If Polaris is not visible, this tool can be used to measure and correct polar alignment errors. It captures a couple of images near the meridian and east/west of the meridian. This will enable the user to adjust the mount until the misalignment is minimized.
                </para>
            </listitem>
        </itemizedlist>
        <para>
            At a minimum, you need a CCD/Webcam and a telescope that supports Slew &amp; Sync commands. Most popular commercial telescope nowadays support such commands.
        </para>
        <para>
            For the Ekos Alignment Module to work, you have an option of either utilizing the <emphasis>online</emphasis> astrometry.net solver, <emphasis>offline</emphasis>, or <emphasis>remote</emphasis> solver:
        </para>
        <itemizedlist>
            <listitem>
                <para>
                    <guilabel>Online Solver</guilabel>: The online solver requires no configuration, and depending on your Internet bandwidth, it might take a while to upload and solve the image.
                </para>
            </listitem>
            <listitem>
                <para>
                    <guilabel>Offline Solver</guilabel>: The offline solver can be faster and requires no Internet connection. In order to use the offline solver, you must install astrometry.net in addition to the necessary index files.
                </para>
            </listitem>
            <listitem>
                <para>
                    <guilabel>Remote Solver</guilabel>: The remote solver is an offline solver the resides on a different machine (for example, you can use Astrometry solver on StellarMate). Captured images are solved on the remote machine.
                </para>
            </listitem>
        </itemizedlist>
    </sect3>

    <sect3 id="ekos-align-get-astrometry">
        <title>Get astrometry.net</title>

        <para>
            If you are planning to use <emphasis>Offline</emphasis> astrometry then you need to download astrometry.net application.
        </para>
        <note>
            <para>
                Astrometry.net is already shipped with StellarMate so there is no need to install it. Index files from 16 arcminutes and above (4206 to 4019) are included with StellarMate. For any additional index files, you need to install them as necessary. To use Astrometry in StellarMate from a remote Ekos on &Linux;/&Windows;/&MacOS;, make sure to select <guimenuitem>Remote</guimenuitem> option in Ekos Alignment Module. Furthermore, make sure that the <guimenuitem>Astrometry</guimenuitem> driver is selected in your equipment profile.
            </para>
        </note>
        <screenshot>
            <screeninfo>
                Ekos Remote Astrometry
            </screeninfo>
            <mediaobject>
                <imageobject>
                    <imagedata fileref="ekos_remote_astrometry.png" format="PNG"/>
                </imageobject>
                <textobject>
                    <phrase>Ekos Remote Astrometry</phrase>
                </textobject>
            </mediaobject>
        </screenshot>
        <variablelist>
            <varlistentry>
                <term>&Windows;</term>
                <listitem>
                    <para>
                        To use astrometry.net under &Windows;, you need to download and install the <ulink url="https://adgsoftware.com/ansvr/">ANSVR Local Astrometry.net solver</ulink>. The ANSVR mimics the astrometry.net online server on your local computer; thus the internet not required for any astrometry queries.
                    </para>
                    <para>
                        After installing the ANSVR server and downloading the appropriate index files for your setup, make sure ANSVR server is up and running and then go to Ekos Alignment options where you can simply change the <guilabel>API URL</guilabel> to use the ANSVR server as illustrated below:
                    </para>
                    <screenshot>
                        <screeninfo>
                            ANSVR Parameters
                        </screeninfo>
                        <mediaobject>
                            <imageobject>
                                <imagedata fileref="astrometry_windows_ansvr.png" format="PNG"/>
                            </imageobject>
                            <textobject>
                                <phrase>ANSVR Parameters</phrase>
                            </textobject>
                        </mediaobject>
                    </screenshot>
                    <para>
                        In Ekos Align module, you must set the solver type to <guimenuitem>Online</guimenuitem> so that it uses the local ANSVR server for all astrometry queries. Then you can use the align module as you would normally do.
                    </para>
                    <para>
                        Remember as indicated above that StellarMate <emphasis>already</emphasis> includes astrometry.net. Therefore, if you would like to use StellarMate remotely to solve your images, simply change solver type to <guimenuitem>Remote</guimenuitem> and ensure that your equipment profile includes <emphasis role="bold">Astrometry</emphasis> driver which can be selected under the <guilabel>Auxiliary</guilabel> dropdown. This is applicable to all operating systems and not just &Windows;.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>&MacOS;</term>
                <listitem>
                    <para>
                        Astrometry.net is already included with &kstars; for &MacOS;, so no need to install it.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>&Linux;</term>
                <listitem>
                    <para>
                        Astrometry.net is already included with &kstars; bleeding version. But if astrometry is not installed, then you can install it by running the following command under &ubuntu;:
                    </para>
                    <para>
                        <command>sudo apt-get install astrometry.net</command>
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </sect3>

    <sect3 id="ekos-align-download-index-files">
        <title>Download Index Files</title>
        <para>
            For offline (and remote) solvers, index files are necessary for the solver to work. The complete collection of index files is huge (over 30 GB), but you only need to download what is necessary for your equipment setup. Index files are sorted by the Field-Of-View (FOV) range they cover. There are two methods to fetch the necessary index files: The new download support in Align module, and the old manual way.
        </para>
        <sect4 id="ekos-align-automatic-download">
            <title>Automatic Download</title>
            <screenshot>
                <screeninfo>
                    Astrometry.net Indexes Download
                </screeninfo>
                <mediaobject>
                    <imageobject>
                        <imagedata fileref="astrometry_indexes_settings.png" format="PNG"/>
                    </imageobject>
                    <textobject>
                        <phrase>Astrometry.net Indexes Download</phrase>
                    </textobject>
                </mediaobject>
            </screenshot>
            <para>
                Automatic download is only available for Ekos users on &Linux; &amp; &MacOS;. For &Windows; users, please download ANSVR solver.
            </para>
            <para>
                To access the download page, click the <guibutton>Options</guibutton> button in the <link linkend="ekos-align">Align module</link> and then select <guilabel>Astrometry Index Files</guilabel> tab. The page displays the current FOV of your current setup and below it a list of available and installed index files. Three icons are used to designate the importance of index files given your current setup as follows:
            </para>
            <itemizedlist>
                <listitem>
                    <para>
                        <inlinemediaobject><imageobject><imagedata fileref="security-high.png" format="PNG"/></imageobject></inlinemediaobject> <guilabel>Required</guilabel>
                    </para>
                </listitem>
                <listitem>
                    <para>
                        <inlinemediaobject><imageobject><imagedata fileref="security-medium.png" format="PNG"/></imageobject></inlinemediaobject> <guilabel>Recommended</guilabel>
                    </para>
                </listitem>
                <listitem>
                    <para>
                        <inlinemediaobject><imageobject><imagedata fileref="security-low.png" format="PNG"/></imageobject></inlinemediaobject> <guilabel>Optional</guilabel>
                    </para>
                </listitem>
            </itemizedlist>
            <para>
                You must download all the required files, and if you have plenty of hard drive space left, you can also download the recommended indexes. If an index file is installed, the checkmark shall be checked, otherwise check it to download the relevant index file. Please only download one file at a time, especially for larger files. You might be prompted to enter the administrator password (default in StellarMate is <userinput>smate</userinput>) to install the files. Once you installed all the required files, you can begin using the offline astrometry.net solver immediately.
            </para>
        </sect4>
        <sect4 id="ekos-align-manual-download">
                <title>Manual Download</title>
                <para>
                    You need to <ulink url="http://data.astrometry.net">download</ulink> and install the necessary index files suitable for your telescope+CCD field of view (FOV). You need to install index files covering 100% to 10% of your FOV. For example, if your FOV is 60 arcminutes, you need to install index files covering skymarks from 6 arcminutes (10%) to 60 arcminutes (100%). There are many online tools to calculate FOVs, such as <ulink url="http://starizona.com/acb/ccd/calc_pixel.aspx">Starizona Field of View Calculator</ulink>.
                </para>
                <table frame="all">
                    <title>Index Files</title>
                    <tgroup cols='3' align='left' colsep='1' rowsep='1'>
                        <thead>
                            <row>
                                <entry>Index Filename</entry>
                                <entry>FOV (arcminutes)</entry>
                                <entry>Debian Package</entry>
                            </row>
                        </thead>
                        <tbody>
                            <row>
                                <entry>index-4219.fits</entry>
                                <entry>1400 - 2000</entry>
                                <entry morerows="11" valign="middle"><ulink url="http://data.astrometry.net/debian/astrometry-data-4208-4219_0.45_all.deb">astrometry-data-4208-4219</ulink></entry>
                            </row>
                            <row>
                                <entry>index-4218.fits</entry>
                                <entry>1000 - 1400</entry>
                            </row>
                            <row>
                                <entry>index-4217.fits</entry>
                                <entry>680 - 1000</entry>
                            </row>
                            <row>
                                <entry>index-4216.fits</entry>
                                <entry>480 - 680</entry>
                            </row>
                            <row>
                                <entry>index-4215.fits</entry>
                                <entry>340 - 480</entry>
                            </row>
                            <row>
                                <entry>index-4214.fits</entry>
                                <entry>240 - 340</entry>
                            </row>
                            <row>
                                <entry>index-4213.fits</entry>
                                <entry>170 - 240</entry>
                            </row>
                            <row>
                                <entry>index-4212.fits</entry>
                                <entry>120 - 170</entry>
                            </row>
                            <row>
                                <entry>index-4211.fits</entry>
                                <entry>85 - 120</entry>
                            </row>
                            <row>
                                <entry>index-4210.fits</entry>
                                <entry>60 - 85</entry>
                            </row>
                            <row>
                                <entry>index-4209.fits</entry>
                                <entry>42 - 60</entry>
                            </row>
                            <row>
                                <entry>index-4208.fits</entry>
                                <entry>30 - 42</entry>
                            </row>
                            <row>
                                <entry>index-4207-*.fits</entry>
                                <entry>22 - 30</entry>
                                <entry><ulink url="http://data.astrometry.net/debian/astrometry-data-4207_0.45_all.deb">astrometry-data-4207</ulink></entry>
                            </row>
                            <row>
                                <entry>index-4206-*.fits</entry>
                                <entry>16 - 22</entry>
                                <entry><ulink url="http://data.astrometry.net/debian/astrometry-data-4206_0.45_all.deb">astrometry-data-4206</ulink></entry>
                            </row>
                            <row>
                                <entry>index-4205-*.fits</entry>
                                <entry>11 - 16</entry>
                                <entry><ulink url="http://data.astrometry.net/debian/astrometry-data-4205_0.45_all.deb">astrometry-data-4205</ulink></entry>
                            </row>
                            <row>
                                <entry>index-4204-*.fits</entry>
                                <entry>8 - 11</entry>
                                <entry><ulink url="http://data.astrometry.net/debian/astrometry-data-4204_0.45_all.deb">astrometry-data-4204</ulink></entry>
                            </row>
                            <row>
                                <entry>index-4203-*.fits</entry>
                                <entry>5.6 - 8.0</entry>
                                <entry><ulink url="http://data.astrometry.net/debian/astrometry-data-4203_0.45_all.deb">astrometry-data-4203</ulink></entry>
                            </row>
                            <row>
                                <entry>index-4202-*.fits</entry>
                                <entry>4.0 - 5.6</entry>
                                <entry><ulink url="http://data.astrometry.net/debian/astrometry-data-4202_0.45_all.deb">astrometry-data-4202</ulink></entry>
                            </row>
                            <row>
                                <entry>index-4201-*.fits</entry>
                                <entry>2.8 - 4.0</entry>
                                <entry><ulink url="http://data.astrometry.net/debian/astrometry-data-4201-1_0.45_all.deb">astrometry-data-4201-1</ulink> <ulink url="http://data.astrometry.net/debian/astrometry-data-4201-2_0.45_all.deb">astrometry-data-4201-2</ulink> <ulink url="http://data.astrometry.net/debian/astrometry-data-4201-3_0.45_all.deb">astrometry-data-4201-3</ulink> <ulink url="http://data.astrometry.net/debian/astrometry-data-4201-4_0.45_all.deb">astrometry-data-4201-4</ulink></entry>
                            </row>
                            <row>
                                <entry>index-4200-*.fits</entry>
                                <entry>2.0 - 2.8</entry>
                                <entry><ulink url="http://data.astrometry.net/debian/astrometry-data-4200-1_0.45_all.deb">astrometry-data-4200-1</ulink> <ulink url="http://data.astrometry.net/debian/astrometry-data-4200-2_0.45_all.deb">astrometry-data-4200-2</ulink> <ulink url="http://data.astrometry.net/debian/astrometry-data-4200-3_0.45_all.deb">astrometry-data-4200-3</ulink> <ulink url="http://data.astrometry.net/debian/astrometry-data-4200-4_0.45_all.deb">astrometry-data-4200-4</ulink></entry>
                            </row>
                        </tbody>
                    </tgroup>
                </table>
                <para>
                    The Debian packages are suitable for any Debian-based distribution (Ubuntu, Mint, &etc;). If you downloaded the Debian Packages above for your FOV range, you can install them from your favorite package manager, or via the following command:
                </para>
                <para>
                    <command>sudo dpkg -i astrometry-data-*.deb</command>
                </para>
                <para>
                    On the other hand, if you downloaded the FITS index files directly, copy them to <filename role="directory">/usr/share/astrometry</filename> directory.
                </para>
                <note>
                    <para>
                        It is recommended to use a download manager as such <ulink url="https://addons.mozilla.org/en-US/firefox/addon/downthemall/">DownThemAll!</ulink> for &firefox; to download the Debian packages as browsers' built-in download manager may have problems with download large packages.
                    </para>
                </note>
            </sect4>
        </sect3>

        <sect3 id="ekos-align-how-to-use">
            <title>How to Use?</title>
            <para>
                Ekos Align Module offers multiple functions to aid you in achieving accurate GOTOs. Start with your mount in home position with the telescope tube looking directly at the celestial pole. For users in Northern Hemisphere, point the telescope as close as possible to Polaris. It is not necessary to perform 2 or 3 star alignments, but it can be useful for some mount types. Make sure your camera is focused and stars are resolved.
            </para>
            <itemizedlist>
                <listitem>
                    <para>
                        <guilabel>Capture &amp; Solve</guilabel>: Capture an image and determine what region in the sky the telescope is exactly looking at. The astrometry results include the equatorial coordinates (RA &amp; DEC) of the center of the captured image in addition to pixel scale and field rotation. Depending on the Solver Action settings, the results can be used to Sync the mount or Sync and then Slew to the target location. For example, suppose you slewed the mount to Vega then used <emphasis>Capture &amp; Solve</emphasis>. If the actual telescope location is different from Vega, it will be first synced to the solved coordinate and then Ekos shall command the mount to slew to Vega. After slew is complete, the Alignment module will repeat Capture &amp; Solve process again until the error between reported and actual position falls below the accuracy thresholds (30 arcseconds by default).
                    </para>
                </listitem>
                <listitem>
                    <para>
                        <guilabel>Load &amp; Slew</guilabel>: Load a FITS or JPEG file, solve it, and then slew to it.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        <guilabel>Polar Alignment Assistant</guilabel>: A simple tool to aid in polar alignment of German Equatorial Mounts.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        <guilabel>Legacy Polar Alignment Tool</guilabel>: Measure polar alignment error when a view of the celestial pole (&eg; Polaris for Northern Hemisphere) is not available.
                    </para>
                </listitem>
            </itemizedlist>
            <warning>
                <para>
                    <emphasis role="bold">Never</emphasis> solve an image at or near the celestial pole (unless Ekos Polar Alignment Assistant Tool is used). Slew at least 20 degrees away from the celestial pole before solving the first image. Solving very close to the poles will make your mount pointing worse so avoid it.
                </para>
            </warning>
        </sect3>

        <sect3 id="ekos-align-alignment-settings">
            <title>Alignment Settings</title>
            <screenshot>
                <screeninfo>
                    Astrometry.net Settings
                </screeninfo>
                <mediaobject>
                    <imageobject>
                        <imagedata fileref="astrometry_settings.png" format="PNG"/>
                    </imageobject>
                    <textobject>
                        <phrase>Astrometry.net Settings</phrase>
                    </textobject>
                </mediaobject>
            </screenshot>
            <para>
                Before you begin the alignment process, select the desired CCD &amp; Telescope. You can explore astrometry.net options that are passed to the astrometry.net solver each time an image is captured:
            </para>
            <itemizedlist>
                <listitem>
                    <para>
                        <guilabel>CCD</guilabel>: Select CCD to capture from.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        <guilabel>Exposure</guilabel>: Exposure duration in seconds.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        <guilabel>Accuracy</guilabel>: Acceptable difference between reported telescope coordinate and actually solved coordinate.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        <guilabel>Bin X</guilabel>: Set horizontal binning of the CCD.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        <guilabel>Bin Y</guilabel>: Set vertical binning of the CCD.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        <guilabel>Scope</guilabel>: Set the active telescope in case you have different Primary and Guide scopes. FOV is re-calculated when selecting a different telescope.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        <guilabel>Options</guilabel>: Options that are passed to the astrometry.net solver. Click the edit button <inlinemediaobject><imageobject><imagedata fileref="document-edit.png" format="PNG"/></imageobject></inlinemediaobject> to explore the options in detail.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        <guilabel>Solver</guilabel>: Select solver type (Online, Offline, Remote). The remote solver is only available when connecting to a remote device.
                    </para>
                </listitem>
            </itemizedlist>
            <para>
                By default, the solver will search all over the sky to determine the coordinates of the captured image. This can <emphasis>take a lot of time</emphasis>; therefore, in order to speed up the solver, you can restrict it to only search within a specified area in the sky designated by the <guilabel>RA</guilabel>, <guilabel>DEC</guilabel>, and <guilabel>Radius</guilabel> options above.
            </para>
        </sect3>

        <sect3 id="ekos-align-astrometry-net-settings">
            <title>Astrometry.net Options</title>
            <para>
                Options for offline and online solvers.
            </para>
            <screenshot>
                <screeninfo>
                    Astrometry.net Options
                </screeninfo>
                <mediaobject>
                    <imageobject>
                        <imagedata fileref="astrometry_settings.png" format="PNG"/>
                    </imageobject>
                    <textobject>
                        <phrase>Astrometry.net Options</phrase>
                    </textobject>
                </mediaobject>
            </screenshot>
            <para>
                Most of the options are sufficient by default. If you have astrometry.net installed in a non-standard location, you can change the paths as necessary.
            </para>
            <itemizedlist>
                <listitem>
                    <para>
                        <guilabel>WCS</guilabel>: World-Coordinate-System is a system for embedding equatorial coordinate information within the image. Therefore, when you view the image, you can hover it and view the coordinate for each pixel. You can also click anywhere in the image and command to the telescope to slew there. It is highly recommended to keep this option on.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        <guilabel>Verbose</guilabel>: If the solver repeatedly fails to solve, check this option to enable <emphasis>verbose</emphasis> output of the solver to help you identify any problems.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        <guilabel>Overlay</guilabel>: Overlay captured images unto the sky map of &kstars;.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        <guilabel>Upload JPG</guilabel>: When using online astrometry.net, upload all images are JPEGs to save bandwidth as FITS images can be large.
                    </para>
                </listitem>
            </itemizedlist>
        </sect3>

        <sect3 id="ekos-align-solver-options">
            <title>Solver Options</title>
            <para>
                Ekos selects and updates the optimal options by default to accelerate the performance of the solver. You may opt to change the options that are passed to the solver in case the default options are not sufficient.
            </para>
            <screenshot>
                <screeninfo>
                    Solver Settings
                </screeninfo>
                <mediaobject>
                    <imageobject>
                        <imagedata fileref="solver_settings.png" format="PNG"/>
                    </imageobject>
                    <textobject>
                        <phrase>Solver Settings</phrase>
                    </textobject>
                </mediaobject>
            </screenshot>
        </sect3>

        <sect3 id="ekos-align-capture-and-solve">
            <title>Capture &amp; Solve</title>
            <para>
                Using Ekos Alignment Module, aligning your mount using the controller's 1, 2, or 3 star alignment is <emphasis>not</emphasis> strictly necessary, though for some mounts it is recommended to perform a rough 1 or 2 star alignment before using Ekos alignment module. If you are using EQMod, you can start using Ekos alignment module right away. A typical workflow for GOTO alignment involves the following steps:
            </para>
            <orderedlist>
                <listitem>
                    <para>
                        Set your mount to its home position (usually the NCP for equatorial mounts).
                    </para>
                </listitem>
                <listitem>
                    <para>
                        Select <guilabel>Slew to Target</guilabel> in the <guilabel>Solver Action</guilabel>.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        Slew to a nearby bright star.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        After slew is complete, click <guibutton>Capture &amp; Solve</guibutton>.
                    </para>
                </listitem>
            </orderedlist>
            <para>
                If the solver is successful, Ekos will sync and then slew to the star. The results are displayed in the <guilabel>Solution Results</guilabel> tab along with a bullseye diagram that shows the offset the reported telescope coordinates (&ie; where the telescope <emphasis>thinks</emphasis> it is looking at) vs. its actual position in the sky as determined by the solver.
            </para>
            <para>
                Each time the solver is executed and returns successful results, Ekos can run on the following actions:
            </para>
            <itemizedlist>
                <listitem>
                    <para>
                        <guilabel>Sync</guilabel>: Syncs the telescope coordinates to the solution coordinates.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        <guilabel>Slew to Target</guilabel>: Syncs the telescope coordinates to the solution coordinates and then slew to the target.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        <guilabel>Nothing</guilabel>: Just solve the image and display the solution coordinates.
                    </para>
                </listitem>
            </itemizedlist>
        </sect3>

        <sect3 id="ekos-align-polaralignment">
            <title>Polar Alignment</title>
            <sect4 id="ekos-align-plar-alignment-assistant">
                <title>Polar Alignment Assistant</title>
                <para>
                    When setting up a German Equatorial Mount (GEM) for imaging, a critical aspect of capturing long-exposure images is to ensure proper polar alignment. A GEM mount has two axis: Right Ascension (RA) axis and Declination (DE) axis. Ideally, the RA axis should be aligned with the celestial sphere polar axis. A mount's job is to track the star's motion around the sky, from the moment they rise at the eastern horizon, all the way up across the median, and westward until they set.
                </para>

                <mediaobject>
                    <videoobject>
                        <videodata contentdepth="595" contentwidth="800" fileref="https://www.stellarmate.com/images/videos/polar_align.webm"/>
                    </videoobject>
                    <caption>
                        <para>
                            <phrase>Polar Alignment Assistant</phrase>
                        </para>
                    </caption>
                </mediaobject>

                <para>
                    In long exposure imaging, a camera is attached to the telescope where the image sensor captures incoming photons from a particular area in the sky. The incident photons have to strike the same photo-site over and over again if we are to gather a clear and crisp image. Of course, actual photons do not behave in this way: optics, atmosphere, seeing quality all scatter and refract photons in one way or another. Furthermore, photons do not arrive uniformly but follow a Poisson distribution. For point-like sources like stars, a point spread function describes how photons are spatially distributed across the pixels. Nevertheless, the <emphasis>overall</emphasis> idea we want to keep the source photons hitting the same pixels. Otherwise, we might end up with an image plagued with various trail artifacts.
                </para>
                <screenshot>
                    <screeninfo>
                        Polar Alignment
                    </screeninfo>
                    <mediaobject>
                        <imageobject>
                            <imagedata fileref="alignment_polaris.png" format="PNG"/>
                        </imageobject>
                        <textobject>
                            <phrase>Polar Alignment</phrase>
                        </textobject>
                    </mediaobject>
                </screenshot>
                <para>
                    Since mounts are not perfect, they cannot perfectly keep track of object as it transits across the sky. This can stem from many factors, one of which is the misalignment of the mount's Right Ascension axis with respect to the celestial pole axis. Polar alignment removes one of the biggest sources of tracking errors in the mount, but other sources of error still play a factor. If properly aligned, some mounts can track an object for a few minutes with the only deviation of 1-2 arcsec RMS.
                </para>
                <para>
                    However, unless you have a top of the line mount, then you'd probably want to use an autoguider to keep the same star locked in the same position over time. Despite all of this, if the axis of the mount is not properly aligned with the celestial pole, then even a mechanically-perfect mount would lose tracking with time. Tracking errors are proportional to the magnitude of the misalignment. It is therefore very important for long exposure imaging to get the mount polar aligned to reduce any residual errors as it spans across the sky.
                </para>
                <para>
                    Before starting the process, point the mount as close as possible to the celestial pole. If you are living in the Northern Hemisphere, point it as close as possible to Polaris.
                </para>
                <para>
                    The tool works by capturing and solving three images. After capturing each, the mount rotates by a fixed amount and another image is captured and solved.
                </para>
                <screenshot>
                    <screeninfo>
                        Polar Alignment Assistant
                    </screeninfo>
                    <mediaobject>
                        <imageobject>
                            <imagedata fileref="polar_assistant_main.png" format="PNG"/>
                        </imageobject>
                        <textobject>
                            <phrase>Polar Alignment Assistant</phrase>
                        </textobject>
                    </mediaobject>
                </screenshot>
                <para>
                    After the first capture, you can rotate the mount by a specific amount (default 30 degrees) either West or East. After selecting the magnitude and direction, click <guibutton>Next</guibutton> to continue and the mount will be rotated. Once the rotation is complete you shall be asked to take another capture, unless you have checked <guilabel>Auto Mode</guilabel>. In Automated mode, the rest of the process will continue with the same settings and direction until a total of three images are captured.
                </para>
                <para>
                    Since the mount's true RA/DE are resolved by astrometry, we can construct a unique circle from the three centers found in the astrometry solutions. The circle's center is where the mount rotates about (RA Axis) and ideally, this point should coincide with the celestial pole. However, if there is a misalignment, then Ekos draws a correction vector. This correction vector can be placed anywhere in the image. Next, <emphasis>refresh</emphasis> the camera feed and make corrections to the mount's Altitude and Azimuth knobs until the star is located in the designated cross-hair. To make it easy to make corrections, expand the view by clicking on the Fullscreen button <inlinemediaobject><imageobject><imagedata fileref="view-fullscreen.png" format="PNG"/></imageobject></inlinemediaobject>.
                </para>
                <screenshot>
                    <screeninfo>
                        Polar Alignment Result
                    </screeninfo>
                    <mediaobject>
                        <imageobject>
                            <imagedata fileref="polar_alignment_result.png" format="PNG"/>
                        </imageobject>
                        <textobject>
                            <phrase>Polar Alignment Result</phrase>
                        </textobject>
                    </mediaobject>
                </screenshot>
                <para>
                    If you are away from StellarMate or PC, you can use your Tablet to monitor the camera feed while making corrections. Use the <link linkend="ekos-tutorials-viewer">StellarMate's web-based VNC viewer</link> or use any VNC Client on your tablet to access StellarMate. If Ekos is running on your PC, you can use applications like TeamViewer to achieve the same results. The following is a video demonstrating how to utilize the Polar Alignment Assistant tool.
                </para>
                <mediaobject>
                    <videoobject>
                        <videodata contentdepth="315" contentwidth="560" fileref="https://www.youtube.com/embed/sx6Zz9lNd5Q"/>
                    </videoobject>
                    <caption>
                        <para>
                            <phrase>Polar Alignment</phrase>
                        </para>
                    </caption>
                </mediaobject>
            </sect4>
            <sect4 id="ekos-align-legacy-polar-alignment-workflow">
                <title>Legacy Polar Alignment Workflow</title>
                <para>
                    Using the Polar Alignment mode, Ekos can measure and correct the polar alignment errors. To measure Azimuth error, point your mount to a star close to the meridian. If you live in the northern hemisphere, you will point the mount toward the southern meridian. Click on <guibutton>Measure Az Error</guibutton> to begin the process. Ekos will try to measure the drift between two images and calculates the error accordingly. You can ask Ekos to correct Azimuth error by clicking on the <guibutton>Correct Az Error</guibutton> button. Ekos will slew to a new location and asks you to adjust the mount's azimuth knobs until the star is in the center of the Field of View. You can use the Focus Module's <link linkend="focus-focuser-group">Framing feature</link> to take a look at the image as you make your adjustments.
                </para>
                <para>
                    Similarly, to measure Altitude error, click on the <guibutton>Measure Alt Error</guibutton> button. You need to point your mount either east or west and set the <guilabel>Altitude Direction</guilabel> combo box accordingly. Ekos will take two images and calculates the error. You can ask Ekos to correct Altitude error by clicking on the <guibutton>Correct Alt Error</guibutton> button. As with Azimuth correction, Ekos will slew to a new location and asks you to adjust the mount's altitude knobs until the star is in the center of the FOV.
                </para>
                <para>
                    After making a correction, it is recommended to measure the Azimuth and Altitude errors again and gauge the difference. You may need to perform the correction more than once to obtain optimal results.
                </para>
                <para>
                    Before starting the Polar Alignment tool, you must complete the GOTO Workflow above for at least one point in the sky. Once your mount is aligned, proceed with the following (assuming you live in the northern hemisphere):
                </para>
                <orderedlist>
                    <listitem>
                        <para>
                            Slew to a <emphasis role="bold">bright</emphasis> star (4th magnitude or below) near the southern meridian (Azimuth 180). Make sure <guilabel>Slew to Target</guilabel> is selected. Capture and solve. The star should be exactly centered in your CCD field of view.
                        </para>
                    </listitem>
                    <listitem>
                        <para>
                            Switch mode to <guilabel>Polar Alignment</guilabel>. Click <guibutton>Measure Az Error</guibutton>. It will ask you to slew to a star at the southern meridian which we already done. Click <guibutton>Continue</guibutton>. Ekos will now perform the error calculation.
                        </para>
                    </listitem>
                    <listitem>
                        <para>
                            If all goes well, the error is displayed in the output boxes. To correct for the error, click <guibutton>Correct Az Error</guibutton>. Ekos will now slew to a different point in the sky, and you will be required to <emphasis role="bold">ONLY</emphasis> adjust the mount's azimuth knobs to center the star in the field of view. The most convenient way of monitoring the star field is by going to the <guilabel>Focus</guilabel> module and clicking <guibutton>Start Framing</guibutton>. If the azimuth error is great, the star might not be visible in the CCD field of view, and therefore you have to make <emphasis>blind</emphasis> adjustments (or simply look through the finderscope) until the star enters the CCD FOV.
                        </para>
                    </listitem>
                    <listitem>
                        <para>
                            Begin your azimuth adjustments until the bright star you slewed to initially is as close to center as you can get it.
                        </para>
                    </listitem>
                    <listitem>
                        <para>
                            <guibutton>Stop Framing</guibutton> in the <link linkend="focus-focuser-group">Focus module</link>.
                        </para>
                    </listitem>
                    <listitem>
                        <para>
                            Repeat the <guibutton>Measure Az Error</guibutton> to ensure we indeed corrected the error. You might have to run it more than once to ensure the results are valid.
                        </para>
                    </listitem>
                    <listitem>
                        <para>
                            Switch mode to <guilabel>GOTO</guilabel>.
                        </para>
                    </listitem>
                    <listitem>
                        <para>
                            Now slew to a <emphasis role="bold">bright</emphasis> star either on the eastern or western horizon, preferably above 20 degrees of altitude. It has to be as close as possible to the eastern (90 azimuth) or western (270) cardinal points.
                        </para>
                    </listitem>
                    <listitem>
                        <para>
                            After slew is complete, capture and solve. The star should be dead center in the CCD FOV now.
                        </para>
                    </listitem>
                    <listitem>
                        <para>
                            Switch mode to <guilabel>Polar Alignment</guilabel>.
                        </para>
                    </listitem>
                    <listitem>
                        <para>
                            Click <guibutton>Measure Alt Error</guibutton>. It will ask you to slew to a star at either the eastern (Azimuth 90) or western (Azimuth 270) horizon which we already done. Click <guibutton>Continue</guibutton>. Ekos will now perform the error calculation.
                        </para>
                    </listitem>
                    <listitem>
                        <para>
                            To correct for the error, click <guibutton>Correct Alt Error</guibutton>. Ekos will now slew to a different point in the sky, and you will be required to <emphasis role="bold">ONLY</emphasis> adjust the mount's altitude knobs to center the star in the field of view. Start framing as done before in the <link linkend="focus-focuser-group">focus module</link> to help you with the centering.
                        </para>
                    </listitem>
                    <listitem>
                        <para>
                            After centering is complete, stop framing.
                        </para>
                    </listitem>
                    <listitem>
                        <para>
                            Repeat the <guibutton>Measure Alt Error</guibutton> to ensure we indeed corrected the error. You might have to run it more than once to ensure the results are valid.
                        </para>
                    </listitem>
                    <listitem>
                        <para>
                            Polar alignment is now complete!</para>
                    </listitem>
                </orderedlist>
                <warning>
                    <para>
                        The mount may slew to a dangerous position and you might risk hitting the tripod and/or other equipment. Carefully monitor the mount's motion. Use at your own risk.
                    </para>
                </warning>
            </sect4>
        </sect3>
    </sect2>
