diff --git a/.gitignore b/.gitignore index 1c6dbea..69c640f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,9 @@ # Python compiled objects *.pyc -# Emacs backup files +# IDE files *~ +settings.json -# Configuration file -configuration.ini +# Configuration files +*.ini diff --git a/README.md b/README.md index 88076c4..29118ca 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,32 @@ # STVID -**stvid** is a set of *python* programs to detect and identify satellite tracks on video observations of the night sky, and measure the satellite positions to determine and/or update their orbits. +**stvid** is a set of *python* programs to detect and identify satellite tracks on observations of the night sky, and measure the satellite positions to determine and/or update their orbits. -This software will take over the satellite tracking functionality of my [sattools](https://github.com/cbassa/sattools). By porting the functionality to *python*, and using [astropy](https://github.com/astropy/astropy), and [opencv](https://opencv-python-tutroals.readthedocs.io/en/latest/), the software is easier to install and operate. +## Background +This software will take over the satellite tracking functionality of C.Bassa's [sattools](https://github.com/cbassa/sattools). By porting the functionality to *python*, and using [astropy](https://github.com/astropy/astropy), and [opencv](https://opencv-python-tutroals.readthedocs.io/en/latest/), the software is indented to be easier to install and operate. -This repository is currently used for development, and relies, for the moment, on programs from the [sattools](https://github.com/cbassa/sattools) repository. +This repository is currently used for development, and relies, for the moment, on programs from the [sattools](https://github.com/cbassa/sattools) repository (namely `satid`). ## Installation -**stvid** handles requirements using pip. You can install requirements by running `pip install -r requirements.txt`. You should consider using a VirtualEnv to run stvid on a separate python virtual environment. You will also need to download the [Tycho 2 catalog](https://www.dropbox.com/s/isbq1wsmfr24zx5/tyc2.fits?dl=0). +**stvid** handles requirements using pip. You can install requirements by running : -You will also need to build and install [Hough3dLines](https://gitlab.com/pierros/hough3d-code) code, and have sextractor installed in your system. +`pip install -r requirements.txt` + +Consider using a VirtualEnv to run stvid on a separate python virtual environment. + +### Additional requirements +* [Hough3dLines](https://gitlab.com/pierros/hough3d-code) + * `hough3dlines` needs to be executable in your path +* [Sextractor](https://github.com/astromatic/sextractor) + * `sextractor` needs to be executable in your path +* [Astromentry.net](https://github.com/dstndstn/astrometry.net) + * `solve-field` needs to be executable in your path, with index files appropriate for your FOV +* Download the [Tycho 2 catalog](https://www.dropbox.com/s/isbq1wsmfr24zx5/tyc2.fits?dl=0) and specify its path in configuration ## Configuration * Copy the `configuration.ini-dist` file to `configuration.ini` * Edit `configuration.ini` with your preferred settings +* Make sure ST_DATADIR is set as an env variable pointing to the /data folder of sattools ## Running TBD @@ -42,7 +55,7 @@ Features to be implemented. * Add user to video group (`sudo adduser video`). * Add video device to udev rules (add `SUBSYSTEM=="video1", GROUP="video", MODE="0660"` in `/etc/udev/rules.d/10-webcam.rules`). -* Create start up script in `/etc/init.d`. Call capture script as user with `su -c "capture_1.sh"`. +* Create start up script in `/etc/init.d`. Call capture script as user with `su -c "acquire.py"`. ## License © 2018-2019 Cees Bassa diff --git a/configuration.ini-dist b/configuration.ini-dist index ad0df32..cc74cfb 100644 --- a/configuration.ini-dist +++ b/configuration.ini-dist @@ -7,9 +7,10 @@ observer_lat = 19.8956 # Latitude of location in decimal degrees observer_lon = -155.2342 # Longitude of location in decimal degrees observer_el = 100 # Elevation of location in meters -observations_path = /path/to/obs/ -tle_path = /path/to/tle/ -results_path = /path/to/results +observations_path = /path/to/obs/ # Path for raw acquisitions +tle_path = /path/to/tle/ # Path where TLEs are stored (and updated) +results_path = /path/to/results # Path for results of processed obs +tyc2_path = ./tyc2.fits # Path to Tycho 2 catalogue [Credentials] st-username = username # Space-track.org username @@ -44,5 +45,5 @@ high_speed = 1 # High speed mode (0 for False, 1 for True) [Astrometry] sex_config = /path/to/solve.sex -low_app = 18 # Arcsec per pixel low scale -high_app = 20 # Arcsec per pixel high scale +low_app = 18 # Arcsec per pixel low scale - Resolution of camera +high_app = 20 # Arcsec per pixel high scale - Resolution of camera diff --git a/requirements.txt b/requirements.txt index 827273d..5bf8a36 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,6 @@ astropy numpy opencv-python scipy -git+https://github.com/haavee/ppgplot.git@master cycler==0.10.0 kiwisolver==1.0.1 matplotlib==2.2.2 @@ -13,3 +12,4 @@ six spacetrack==0.13.0 termcolor zwoasi +git+https://github.com/haavee/ppgplot.git@master diff --git a/stvid/astrometry.py b/stvid/astrometry.py index a46ad28..6154993 100644 --- a/stvid/astrometry.py +++ b/stvid/astrometry.py @@ -6,6 +6,7 @@ import numpy as np import subprocess import shutil import astropy.units as u +import configparser from astropy.io import fits from astropy import wcs from astropy.coordinates import SkyCoord, FK5, ICRS @@ -18,8 +19,10 @@ class tycho2_catalog: """Tycho2 catalog""" def __init__(self, maxmag=9.0): - hdu = fits.open(os.path.join(os.getenv("ST_DATADIR"), - "data/tyc2.fits")) + cfg = configparser.ConfigParser(inline_comment_prefixes=('#', ';')) + cfg.read('../configuration.ini') + tyc2 = cfg.get('Common', 'tyc2_path') + hdu = fits.open(tyc2) ra = hdu[1].data.field('RA')*u.deg dec = hdu[1].data.field('DEC')*u.deg @@ -220,6 +223,7 @@ def is_calibrated(ff): else: return True + def generate_reference_with_anet(fname, cmd_args, reffname="test.fits", tempfroot="cal"): # Copy file to generic name shutil.copy2(fname, tempfroot + ".fits") @@ -248,4 +252,3 @@ def generate_reference_with_anet(fname, cmd_args, reffname="test.fits", tempfroo pass return solved - diff --git a/stvid/stars.py b/stvid/stars.py index 12747f3..01c3e0e 100644 --- a/stvid/stars.py +++ b/stvid/stars.py @@ -29,6 +29,7 @@ class pixel_catalog: self.flag = None self.nstars = 0 + def generate_star_catalog(fname): # Skip if file already exists if not os.path.exists(os.path.join(fname, ".cat")):