**Prologue**:
The guildline herein is based on Ubuntu 20.04 in the environment of Windows Subsystem for Linux (WSL)
**Acknowledgement**:
Many thanks to my mentor (Chia-Yu) in Liscotech for helping me to build the environment for Astrometry.net.
## Enable the WSL Environment
To be completed...
## Install Ubuntu 20.04 in WSL and Build a Anaconda Environment for Astrometry.net
Install Ubuntu with the distribution of 20.04.
```
wsl --install -d Ubuntu-20.04
```
Update apt with the adminstrator privilege
```
sudo apt update
```
Download Anaconda
```
sudo curl -O https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh
```
Install Anaconda
```
sudo bash Anaconda3-2019.10-Linux-x86_64.sh
```
Type yes to accept the policy from Anaconda.
Specify the installation location (it is recommended to install in "/home/anaconda3")
```
/home/anaconda3
```
After the installation of Anaconda, it is recommended to set the environmental variable to call the command "conda" everywhere. To achive this, we open the file ~/.bashrc with vim,
```
vim ~/.bashrc
```
, add the following line
```
export PATH="/home/anaconda3/bin":$PATH
```
and reactivate the file
```
source ~/.bashrc
```
To activate the base environment of Anaconda in the first time, use
```
source activate
```
## Download the Source-Code Package of Astrometry.net
Download the package
```
wget https://astrometry.net/downloads/astrometry.net-latest.tar.gz
```
Unzip the file
```
tar -xvzf astrometry.net0lastest.tar.gz
```
Change the directory to astrometry.net-*
```
cd astrometry.net-*
```
## Build a conda environment for Astrometry.net
Create a new environment named "StarTracker" with a specified Python 3.7
```
conda create -n StarTracker python=3.7
```
(Note: it has been reported that restarting a terminal is required if there occurs problems.)
Enter the environment
```
conda activate StarTracker
```
Install the required packages
```
sudo apt install build-essential curl git file pkg-config swig libcairo2-dev
sudo apt install libnetpbm10-dev netpbm libpng-dev libjpeg-dev zlib1g-dev
sudo apt install libbz2-dev libcfitsio-dev wcslib-dev
sudo apt install python3 python3-pip python3-distutils python3-dev
sudo apt install python3-numpy python3-scipy python3-pil
```
## Compile the Astrometry.net
Instruction can be found in http://astrometry.net/doc/build.html#build
```
sudo make
sudo make extra
sudo make install
```
To call the command “conda” everywhere, we add the path
```
vim ./~bashrc
export PATH="$PATH:/usr/local/astrometry/bin"
source ./~bashrc
```
Check the path of "solve-field"
```
which solve-field
```
The path should be "/usr/local/astrometry/bin/solve-field" if you follow the above steps.
Create a file at "/usr/local/astrometry/data" to store .fits files
```
make install-indexes
```
Add path to locate the .fits files
```
vim etc/astrometry.cfg
(in line -> add_path) /usr/local/astrometry/data
```
## Start a Calculation
Further instruction can be found in http://astrometry.net/doc/readme.html#installing
Download the test image
https://drive.google.com/file/d/1TOuuM9bdS0J4NnqjdLugcmFpeEWMiKjs/view?usp=sharing
and the index file (.fits)
https://drive.google.com/file/d/1E1fdLi1cDP3-XTjZnNrc4Rep54ogZmaN/view?usp=sharing
Put the above two files to corresponding paths
index-4216.fits -> /usr/local/astrometry/data
IMG_9560.png -> /home/"user name"/astrometry.net-*/demo (or where you want)
These operation can be achieved in Windows by typing the path at the file explorer
```
\\wsl$
```
Try a calculation
```
solve-field demo/IMG_9560.png
```
If the calculation is successful, you can see the following logs on the terminal
```
Reading input file 1 of 1: "demo/IMG_9560.png"...
Read file stdin: 828 x 1250 pixels x 1 color(s); maxval 255
Using 8-bit output
Extracting sources...
simplexy: found 17 sources.
Solving...
Reading field "demo/IMG_9560.axy"...
log-odds ratio 28.4009 (2.15946e+12), 9 match, 0 conflict, 5 distractors, 104 index.
RA,Dec = (13.4365,-11.8528), pixel scale 95.3107 arcsec/pix.
Hit/miss: Hit/miss: +++++++---+--+(best)+++
Field 1: solved with index index-4216.fits.
Field 1 solved: writing to file demo/IMG_9560.solved to indicate this.
Field: demo/IMG_9560.png
Field center: (RA,Dec) = (13.341913, -11.808647) deg.
Field center: (RA H:M:S, Dec D:M:S) = (00:53:22.059, -11:48:31.130).
Field size: 21.435 x 31.9883 degrees
Field rotation angle: up is -111.122 degrees E of N
Field parity: neg
Creating new FITS file "demo/IMG_9560.new"...
Creating index object overlay plot...
Creating annotation plot...
Your field contains:
Part of the constellation Cetus (Cet)
The star Diphda / Deneb Kaitos (β Cet / 16 Cet)
The star Baten Kaitos (ζ Cet / 55 Cet)
The star Dheneb / Deneb Algenubi (η Cet / 31 Cet)
The star Deneb Kaitos Shemali / Schemali / Deneb Kaitos (ι Cet / 8 Cet)
The star Al Naymat I (θ Cet / 45 Cet)
The star Al Naymat II (τ Cet / 52 Cet)
The star Alnitham I (φ1 Cet / 17 Cet)
The star Alnitham II (φ2 Cet / 19 Cet)
The star Alnitham III (φ3 Cet / 22 Cet)
The star Alnitham IV (φ4 Cet / 23 Cet)
The star χ Cet / 53 Cet
The star 1 Cet
The star 2 Cet
The star 3 Cet
The star 6 Cet
The star 7 Cet
The star 9 Cet
The star 12 Cet
The star 13 Cet
The star 18 Cet
The star 20 Cet
The star 21 Cet
The star 25 Cet
The star 27 Cet
The star 28 Cet
The star 30 Cet
The star 32 Cet
The star 34 Cet
The star 37 Cet
The star 38 Cet
The star 39 Cet
The star 42 Cet
The star 43 Cet
The star 44 Cet
The star 46 Cet
The star 47 Cet
The star 49 Cet
The star 50 Cet
The star 30 Psc
The star 33 Psc
```