Prerequisites
=============
 python3(.5)
 # Ubuntu 16.04:
 apt install  python3-watchdog (maybe disappears)
              python3-pyinotify	(has all events)
              python3-requests
	      python3-pandas
	      python3-bcrypt
              yale # bright star catalog
	           # http://tdc-www.harvard.edu/catalogs/bsc5.html
	      libnova-dev
	      telnet
	      saods9
	      
 pip3 install astropy (1.3)
              confuse
              numpy
	      scipy
	      matplotlib
              pyds9
	      pyfits
	      pyephem
	      if --transform-class u_pyephem
	      ref_index:
	      if --refractive-index-method  (ciddor|edlen)
              skyfield
	      only used in test_coordinates_altaz.py
	      astroquery

Install ref_index with

 git clone https://github.com/phn/ref_index.git

in the main u_point directory. According to

https://oneau.wordpress.com/2011/10/12/ref-index/

NIST adopted the methods for their refractive index
calculator.

libnova needs to be on LD_PATH as libnova.so

Do a:
 wget http://maia.usno.navy.mil/ser7/finals2000A.all  

astrometry.net:
For the default CCD pixel size (862,655 or 24.4x18.56 arcmin2)
chose packages:
 
  astrometry-data-2mass-05 (11'-16')
  astrometry-data-2mass-06 (16'-22')
  astrometry-data-2mass-07 (22'-30')

Presentation Hackaton, Aosta 2017:
http://azug.minpet.unibas.ch/~wildi/2017-03-aosta.pdf


Use cases
=========

u_point's use cases are:

- unattended data acquisition, analysis and fit
  of a configurable mount/telescope pointing model.

- if the CCD FoV is too small for astrometry.net
  to work reliably then the mount can be driven
  interactively.
  As targets serve objects from Yale's Bright Star
  Catalog which are identified by SExtractor as
  brightest object on an CCD image.

- u_point can be used together with Yale's Bright Star
  Catalog during day time. The mount never points to
  a location within a configurable radius around the
  sun (see README_demo).
  
- u_point is written in a way, that indilib or
  ASCOM users can easily extend it (contact
  wildi.markus@bluewin.ch or have a look at
  u_point/devices.py)

For quick introduction see section: Very quick
tour: do_it_all_dss.sh

Verification and simulation
===========================

Start script (needs Internet)

./do_it_all_dss.sh -a

for a full data acquisition, analysis and fitting the
model parameters. The result will be comparable with

transformation done with: AP astropy
-------------------------------------------------------------
fitted values:
IH : ha index error                 :     -1.2614 [arcsec]
ID : delta index error              :     +0.1989 [arcsec]
CH : collimation error              :     +4.5304 [arcsec]
NP : ha/delta non-perpendicularity  :     +3.9076 [arcsec]
MA : polar axis left-right alignment:     -0.4807 [arcsec]
ME : polar axis vertical alignment  :     +0.0382 [arcsec]
TF : tube flexure                   :     -0.1469 [arcsec]
FO : fork flexure                   :     -0.3330 [arcsec]
DAF: dec axis flexure               :     -0.0600 [arcsec]

Since images are fetched from http://archive.eso.org/dss/dss/
and refraction has been turned off all the above values must
be close to zero.

The gallery of plots:
http://azug.minpet.unibas.ch/~wildi/verification/

Test EQ mount model: create simulated data HA/Dec with

./u_simulate.py --toc  --sigma 0. --pressure 0. --model point
model loaded: point
values:
IH : ha index error                 :    -60.0000 [arcsec]
ID : delta index error              :    +12.0000 [arcsec]
CH : collimation error              :    -60.0000 [arcsec]
NP : ha/delta non-perpendicularity  :    +60.0000 [arcsec]
MA : polar axis left-right alignment:    +30.0000 [arcsec]
ME : polar axis vertical alignment  :    +12.0000 [arcsec]
TF : tube flexure                   :    -12.0000 [arcsec]
FO : fork flexure                   :    +60.0000 [arcsec]
DAF: dec axis flexure               :    -60.0000 [arcsec]

./u_model.py --plot --toc  --base-path ./ \
 --analyzed-positions simulation_data.txt \
 --model point
transformation done with: u_astropy
-------------------------------------------------------------
values:
IH : ha index error                 :    -60.0000 [arcsec]
ID : delta index error              :    +12.0000 [arcsec]
CH : collimation error              :    -60.0000 [arcsec]
NP : ha/delta non-perpendicularity  :    +60.0000 [arcsec]
MA : polar axis left-right alignment:    +30.0000 [arcsec]
ME : polar axis vertical alignment  :    +12.0000 [arcsec]
TF : tube flexure                   :    -12.0000 [arcsec]
FO : fork flexure                   :    +60.0000 [arcsec]
DAF: dec axis flexure               :    -60.0000 [arcsec]

The gallery of plots:
http://azug.minpet.unibas.ch/~wildi/simulation/

Test AltAz mount model: create simulated data AltAz with

./u_simulate.py --toc  --sigma 0. --pressure 0.
model loaded: altaz
values:
C1: horizontal telescope collimation:  -60.0000 [arcsec]
C2: constant azimuth offset         : +120.0000 [arcsec]
C3: tipping-mount collimation       :  -60.0000 [arcsec]
C4: azimuth axis tilt West          :  +60.0000 [arcsec]
C5: azimuth axis tilt North         :  -60.0000 [arcsec]
C6: vertical telescope collimation  : +120.0000 [arcsec]
C7: gravitational tube bending      : -120.0000 [arcsec]

and analyze them with

./u_model.py --plot --toc  --base-path ./ \
 --analyzed-positions simulation_data.txt \
 --model altaz

model loaded: altaz
transformation done with: u_astropy
--------------------------------------------------------
fit converged with status: 2
values:
C1: horizontal telescope collimation:  -60.0000 [arcsec]
C2: constant azimuth offset         : +120.0000 [arcsec]
C3: tipping-mount collimation       :  -60.0000 [arcsec]
C4: azimuth axis tilt West          :  +60.0000 [arcsec]
C5: azimuth axis tilt North         :  -60.0000 [arcsec]
C6: vertical telescope collimation  : +120.0000 [arcsec]
C7: gravitational tube bending      : -120.0000 [arcsec]
fit projection not converged, status: 3

with residues in

 azimuth:  mu=0. arcsec, sigma=1. arcsec
 altitude: mu=0. arcsec, sigma=1. arcsec


Assumption about the mount
==========================
A mount comprises a driver and a "silly" hardware controller
which turns both axes by an angle defined by the driver. ICRS
coordinates are delivered to the driver. The driver provides
apparent and after u_point succeeded mount coordinates. 


Transformation
==============
Guided by Standards of Fundamental Astronomy (http://www.iausofa.org)
I wrote transform/u_sofa.py to interface SOFA's iauAtco13 routine.
A comparison between astropy and iauAtco13 showed that results are
in good agreement (e.g. below 1...2 arcsec, see test_coordinates_altaz.py).

RTS2 uses SOFA/ERFA libraries after

 apt-get install liberfa-dev
 make distclean
 ./autogen.sh
 configure ...
 make


Deprecated transformations
==========================
u_point uses astropy as default for transformations, hence a call
to 

./u_analyze.py  --transform-with-class TRANSFORM

where TRANSFORM is one of the following options

 u_libnova
 u_pyephem
 u_skyfiel
 u_taki_san

is deprecated. 


Refraction calculation
======================
From astropy:docs, section AltAz, Notes:
"The refraction model is based on that implemented in ERFA, which 
is fast but becomes inaccurate for altitudes below about 5 degrees."

The following refraction calculations are available:

 bennett     (Jean Meeus)
 saemundsson (Jean Meeus)
 stone       recommended (Ronald C. Stone)

and for stone the refractive index can be calculated
with one of

 owens
 ciddor recommended (ref_index.py)
 edlen  recommended (ref_index.py)


Coordinates
===========
E.g. RTS2 provides corrections for

 precession
 nutation
 aberration
 refraction

and can be considered as "apparent" coordinates as long as the
resulting pointing error is greater than 10 arcsec. SOFA/ERFA's
calculation of refraction needs to be revisited. 

Grid coordinates:
-----------------
nml_ic: nominal position "ICRS".
nml_aa: nominal position AltAz

If not Yale Bright Star Catalog coordinates are used
a "nominal" grid used to set coordinates.

Catalog coordinates:
------------------
To ease programming coordinates containing '_ll_' are generic.
'll' stands for longitude,latitude and can be either HA/Dec
or AltAz coordinates.

cat_ic: catalog position ICRS, RA/Dec
cat_ll_ap: apparent position either HA/Dec or AltAz 

Mount coordinates:
----------------	
mnt_ic_set: input to the driver, value: cat_ic

for cross checking/redundancy, if available:
mnt_ra_rdb: RA/Dec read back from driver
mnt_ha_rdb: HA/Dec read back from driver
mnt_aa_rdb: AltAz read back from driver

Observed mount coordinates:
--------------------------
The term "observed" denotes coordinates read at the mount's setting
circle after the object has been centered. Since there are no setting
circles these coordinates are derived from the CCD image using either
SExtractor or astrometry.net.

mnt_ll_sxtr: RA,Dec or AltAz, derived from SExtractor 
mnt_ll_astr: RA,Dec or AltAz, derived from astrometry.net

The center coordinates defined by astrometry.net are ICRS. These
coordinates have to be transformed to apparent.

In case of a SEXtractor measurement cat_ic (ICRS) is transformed
to apparent. The relative offset of the star to the center is added
to the apparent center coordinates.

Measurement and Optimization
============================
Coordinates set at the mount must be apparent. Depending on the
desired accuracy local pressure (QFE), temperature and humidity
need to measured.

In case of RTS2, compiled with SOFA/ERFA, ICRS coordinates are set
in field T0:ORI and the transformation to apparent can be switched
on with e.g. T0:CAL_ABER etc. The hardware controller just turns
the axis without doing further calculations like e.g. refraction.

In case a mount controller does not behave like this the apparent
coordinates need to be calculated based on SOFA/ERFA routines (e.g.
with astropy).

Two types of measurements
-------------------------
A) If the coordinates denote a point like object, that could be a star,
its center offset is the measurand.

B) Output of astrometry.net (center) coordinates are ICRS which need to
be transformed to apparent either to HA or AltAz. The difference
between the set and measured center coordinates, both transformed to
apparent, is the measurand.

u_point supports both measurement types. SExtractor is used to carry
out measurement A). 

As of 2017-03-05: when ever possible use astrometry.net (default).

u_model.py uses per default results from astrometry.net, but specifying
--fit-sextr SExtractor derived positions are used as input.

cat_ic is set at the mount, assuming the driver transforms to apparent.
The differences

 d_az  = cat_ll_ap.az -  X.az
 d_alt = cat_ll_ap.alt - X.alt

where X is either mnt_ll_sxtr or mnt_ll_astr, resp., or

 d_ha  = cat_ll_ap.ha - X.ha
 d_dec = cat_ll_ap.dec - X.dec

are minimized simultaneously. 

Model selection
===============

There are several optimization models available:

 u_model.py --model-class MODEL

where MODEL is one of the following options

 model/altaz

for AltAz and for HA/Dec

 model/buie
 model/point

Module MODEL is loaded at run time.

Apparent coordinates
====================

According to http://www.iausofa.org/publications/sofa_pn.pdf
the following steps are between ICRS and apparent/observed AltAz:
 step                                              target system
 space motion                                      BCRS
 prallax (0".8)                                    astrometric RA,Dec
 light deflection (<0".003,dist sun>15deg)
 and aberration                                    GCRS
  a) frame bias, equinox based precession-nutation geocentric apparent
  b) frame bias, CIO based precession-nutation     CIRS
  a) Greenwich apparent sidereal time              TIRS
  b) Earth rotation angle                          TIRS
 polar motion (0".1)                               ITRS
 longitude                                         loacal apparent HA,Dec
 diurnal aberration (0".3), paralax                topocentric HA,Dec
 latitude                                          topocentric Az,Alt
 refraction                                        observed Az,Alt
And in addition 
 latitude                                          observed HA,Dec


Very quick tour: do_it_all_dss.sh
=================================
NOTE:
- do_it_all_dss.sh is solely used for demonstration.
- check the log file in /tmp/
- be patient, even in simulation mode it takes time
  to set up

Script do_it_all_dss.sh needs only optionally a running
installation of RTS2 and after the above mentioned packages
have been installed, it is ready to use.

 cd $HOME/rts2/scripts
 ./do_it_all_dss.sh

If astrometry.net should be used, start with option '-a'

 ./do_it_all_dss.sh -a

Although u_analyze.py uses all but one CPUs, it is slower
even if search radius, pixel scale and image center are
specified. do_it_all_dss.sh limits astrometry.net's
execution time to 30 sec.

This script performs all necessary steps to get
a pointing model fit. Steps:

1) selecting objects from Yale Bright Star Catalog
visible at observatory's latitude.

2) creating a grid of nominal AltAz positions

3) for every grid positions acquire  an image from DSS

4) analyzing the obtained images with SExtractor
(optionally with astrometry.net).

5) performing the fit of the catalog and mount
positions, finally plot the results.

The script provides additional information and
comments about how to use these u_* scripts.

do_it_all_dss.sh fetches images from DSS if
option --fetch-dss-image is specified and the
mount device is purely software (see devices.py).

To use RTS2 without a real mount, use it's dummy
devices.

Remove in /etc/rts2/devices all but

  camd    dummy   C0      --width 862 --height 655 --frame-transfer --localhost localhost
  teld    dummy   T0      --move fast --localhost localhost
  # optionally let T0 run at 2deg/sec:
  #teld    dummy   T0      --localhost localhost

start RTS2 and then start

 ./do_it_all_dss.sh -r

Being able to communicate with RTS2 the scripts are
started differently:

 acq_script="$HOME/rts2/scripts/u_point/u_acquire_fetch_dss_continuous.sh"
 rts2-scriptexec -d C0 -s " exe $acq_script "

where u_acquire_fetch_dss_continuous.sh is a
(bash) script executing u_acquire.py. The same
thing if a progress plot is displayed:

 plt_script="$HOME/rts2/scripts/u_point/u_acquire_plot.sh"
 rts2-scriptexec -d C0 -s " exe $plt_script" 

NOTE: if u_acquire.py is executed through rts2-scriptexec
log information is only available with command

 tail -f /tmp/u_acquire.log

rts2-scriptexec reads/writes to STDOUT/STDIN of the
executed script, hence logging to console is read
by rts2-scriptexec (and confuses it) Read the --help
texts for more options.

NOTE: if you are using do_it_all_dss.sh may be there are
processes hanging around in the background, do

 ps aux | grep python3
 killall python3

if no other python3 process is hit but u_point.

Advanced quick tour: something went bad
=======================================

Cases:
- real mount crashed
- bad measurements
- statistical outliers
- ...
No problem as long as the data in the base path
is available. u_acquire.py and u_analyze.py check 
the relevant files and continue there where they
got stuck.

Once the analysis is complete and the plot windows
labeled "progress..." are still open. Arrange them
on screen that both are visible side by side.

Deleting acquired positions on progress plots
---------------------------------------------
Options --animate and --delte have to specified to
watch the following behavior.

Choose plot "analyzed positions" and click on a
data point. The annotation appers and DS9 will
open and display the FITS image. Then press <Delete>
on the keyboard. The blue data point disappears
indicating that this position has been deleted. The
red or ev. yellow dot represent an analysis (SExtractor,
astrometry.net) and remain.

If there are to many annotations on the plot, press
<c> to clear them.

On plot "acquired positions" the same thing happened
the nominal position is shown in red indicating that
the measurement was deleted if removed on plot
"analyzed positions".

Deleting measurements is available on plot "acquired 
positions" too, updating plot "analyzed positions"
(takes some time). With this feature an efficient
cleaning of the data is possible.

Having deleted several acquired data points, how
about a redo of the data acquisition. u_acquire.py
and u_analysis.py can be interrupted at any time.

Close all open matplotlib windows

 killall python3 # if appropriate

and restart the process with argument '-p':

 ./do_it_all_dss.sh -p

In this case the data in base path, usually /tmp/u_point,
is not deleted.

Again u_acquire.py tries to make measurements on all
missing locations (red on plot acquired positions). 
u_analysis.py completes as well the missing points.

This scenario is very likely to happen. Using a real
telescope, u_acquire.py may fail for many reasons.
Just restart the process.


Deleting analyzed positions on u_model.py plots
-----------------------------------------------
Once the analysis has been finished the u_model.py
result plots are displayed.

Click a point and it's annotation appears as well as
on all other plots. This feature allows a quick
identification of interesting or bad measurements.
Those analyzed positions can be dropped from the file

 analyzed_positions.anl

by hitting key <Delete>.

Having cleaned the data restart u_model.py with
e.g.

 ./u_model.py --base-path /tmp/u_point\
 --plot  --ds9-display --delete --toconsole

to see the effect.

If there are to many annotations on the plot, press
<c> to clear them.

NOTE: if the CPUs are loaded the annotations do not
make it to the plot, nevertheless DS9 is updated. In
these cases start the scripts with option --toconsole
and see the annotations on the console.

Scripts
=======
Only scripts named u_*.py are interesting from a user's
perspective (at first). All other are part of the
supporting infrastructure.

u_point is a silent system with sensible default
values with exception of

 --obs-longitude (all)
 --obs-latitude  (all)
 --obs-height    (all)
 --pixel-scale   (u_acquire.py,u_analyze.py)
 --ccd-size      (u_acquire.py,u_analyze.py)
 --ccd-angle     (u_acquire.py,u_analyze.py)

The last three options need only be specified
if SExtractor is used (see u_model.py). 

 --use-bright-stars (u_acquire.py)
 --fetch-dss-image  (u_acquire.py)
 --device-class     (u_acquire.py)
 --meteo-class      (u_acquire.py)

If option --use-bright-stars is specified then
the nearest Yale Bright Star Catalog is selected
as target. The default, suitable for any reasonable
telescope/mount configuration, uses the nominal
grid positions to take an FITS image.

If --fetch-dss-image is specified images are
always fetched from DSS (see devices.py) even

 --device-class DeviceRts2

is specified. Default of option --meteo-class
is the dummy meteo device. Most likely you
want to write your own.

Options

 --animate
 --delete
 --ds9_display
 
modifying --plot are disabled be default.

Common features
---------------
All scripts read and write best to a common
subdirectory. Set --base-path (/tmp/u_point)
for all scripts identically and do not change
the defaults of the file names.

The log files are written to /tmp/<script_name>.log
Logging to console is enabled with --toconsole. If
specified the level is set to DEBUG. Default is
INFO which means the scripts are almost silent.
If in trouble enable --toconsole.

Scripts u_acqurie.py and u_analyze.py can be
interrupted and resumed at any time, or while
u_acquire.py is still running, u_analyze.py
can be started several times, saving time -
use script do_loop_analize.sh or an adapted
version.


If options --plot and --animate are specified
u_acqurie.py and u_analyze.py show an updated
(animated) plot e.g. where the mount actually
points to or which position is currently
analyzed. If --ds9-display is specified then
FITS images will be displayed through DS9.
u_model.py behaves in the same way but has no
progress report.

At the beginning it is a good idea to use option
--toconsole which enables --level DEBUG and logs
to console.

Study --help of the following scripts since their options
will provide more flexibility than described in this
README.

- u_select.py
- u_acquire.py
- u_analyze.py
- u_model.py
- u_simulate.py

RTS2 rts2-scriptexec
--------------------
These scripts need your attention if you steer
a RTS2 mount, it is likely that you have to
adapt them: 

- rts2_script/u_acquire.sh
- rts2_script/u_acquire_plot.sh
- rts2_script/u_acquire_fetch_dss_continuous.sh

Data files
==========
The structure of the following files ins described
in file u_point/sutructures.py.


observable.cat
--------------
Created  by u_select.py contains the at latitude visible
bright stars.

nominal_positions.nml
---------------------
Created by u_acquire.py --create contains a grid of to
be observed sky locations. 

acquired_positions.acq
----------------------
Created by u_acquire.py contains the book keeping of all
measured positions.

analyzed_positions.anl
----------------------
Created by u_analyze.py contains the book keeping of all
SExtracted and astrometry position information.


Status u_point as of 2016-11-23
===============================
I just completed the first release. Missing are:

- proper documentation
- EQ mount analysis
- Python unit tests

Please feel free to contact me (wildi.markus@bluewin.ch)


Status u_acquire.py as of 2017-03-15
====================================
I dry tested u_acquire.py in simulation mode and
together with RTS2 dummy devices. I do not expect
any major failures if a real AltAz mount is used.

u_acquire.py is suitable for AltAz mounts but
soon EQ mounts can be used too.


Pointing Model
==============
Not satisfied with the existing models:

 model/buie.py
 model/point.py
 model/altaz.py

create your own. Create class Model(ModelBase) and
implement three methods (see e.g. model_altaz.py):

  def d_lon(self,cat_lons,cat_lats,d_lons):
  def d_lat(self,cat_lons,cat_lats,d_lats):
  def fit_model(self,cats=None,mnts=None,selected=None,**kwargs):

where cat_* are apparent and d_* are the differences
between cat_* - mnt_*, where mnt_* are the coordinates
read at the setting circles of the mount. If method fit_model()
is implemented for a EQ style fit (see model/point.py), 
observatory's latitude has to be passed:

  def fit_model(self,cats=None,mnts=None,selected=None,**kwargs):
    if kwargs is None:
      self.lg.error('expected key word: obs, exiting'.format(name, value))
      sys.exit(1)

    for name, value in kwargs.items():
      if 'obs' in name:
        self.phi=value.latitude.radian
        break
      else:
        self.lg.error('got unexpected key word: {0}={1}, exiting'.format(name, value))
        sys.exit(1)

Meteo
=====
Often meteo data are acquired from a separate
system. Either provided by RTS2 or an external
source. See classes Meteo() in meteo.py (dummy)
or e.g. meteo/meteo_dome_c.py for a real implementation.

As default Meteo() from meteo/meteo.py is used if not
specified with --meteo-class.

meteo.py is a dummy device while meteo_dome_c.py is
an example querying a weather station's web page.


Preparation: u_select.py, u_acquire.py
======================================
This step is required in case one can not
use astrometry.net. From SExtractor's list
only the brightest star is retrieved and that
should be Yale Bright Star Catalog object..

Script u_select.py  filters objects which are
visible at a given latitude

 u_select.py --obs-latitude m75.1 --plot

and writes it to a file. The default can be
replaced with option --observable-catalog.
For further options use u_select.py --help.

The to be observed grid of nominal AltAz
positions is created by

 u_acquire.py --create-nominal --plot

and the result is written to nominal_positions.nml
if not specified differently. Check the plot and if
not satisfied see options --altitude-interval,
--azimuth-interval, --az-step and --alt-step for
further refinements.


Data acquisition: u_acquire.py
==============================
The data acquisition can be interrupted and resumed
at any time.

Two modes of operations exist:

1) non continuous mode (--mode-user)
2) continuous mode (default)

If operated in default mode, no user interaction
is required.
To watch the mount acquiring data, in case of
--device-class DeviceDss (default), use

./u_acquire.py --base-path $BASE_PATH --plot \
  --ds9-display --animate  --toconcsole

with option --device-class DeviceRts2 (adapt
u_acquire_plot.sh to your needs)

 plt_script="$HOME/rts2/scripts/u_point/u_acquire_plot.sh"
 rts2-scriptexec -d C0 -s " exe $plt_script" 

If operated in user  mode, user interaction is
required and it is done via telnet 127.0.0.1 usually
on port 9999 (see /tmp/u_acquire.log for the actual
setting). Allowed commands are setting a different
exposure time or redo a given nominal position ev.
with a different exposure time.

The mount is operated through, e.g. DeviceRts2 (see
devices.py). The 'ORI' (see rts2-mon, T0) coordinates
are set by u_acquire.py. Once u_acquire.py waits for
user input, the mount can be commanded using 'OFFS'
(see rts2-mon, T0) to center the object on the CCD.

If the CCD can not be driven by RTS2 or it is not
suitable, a watch dog can be set to monitor the
directory where the FITS images are written, see
options

   --mode-watchdog
   --watchdog-directory

The final output of u_acquire.py is a book keeping
file, usually named acquired_positions.acq (see
option --acquired-position) where all necessary
information is stored.


Image analysis: u_analyze.py
============================
u_acquire.py does not analyze the images, that is the
task of u_analyze.py. 

u_analyze.py writes RA/Dec coordinates of the
brightest star and the field center, obtained by
astrometry.net, to a second file, usually named:

 analyzed_positions.anl

This is the input to u_model.py.

In case the analysis was interrupted, analyzed
positions are read back from analyzed_positions.anl
and dropped if the measurement is complete. In
case SExtractor and astrometry.net are used both
results must be present.

If process u_acquire.py is still in progress, you may
analyze the already acquired data. 


Pointing model: u_model.py
==========================
The file analyzed_positions.anl, prepared in the
previous step, is read by

 ./u_model.py --base-path /tmp/u_point --plot 

and the plots will show the result of the fitted
parameters as well as the raw data.

All plots have a call back function. If a data point
is clicked, it is annotated on all other plots.


Walk through with RTS2 dummy devices
====================================

The following description walks you through a simulated
data acquisition with DSS image retrieval for an easy
comparison with the "real" sky.

Configure RTS2 with dummy devices (/etc/rts2/devices):

 #RTS2 devices configuration
 #device type    device_name     options
 camd    dummy   C0      --width 862 --height 655 --frame-transfer --localhost localhost
 teld    dummy   T0      --move fast --localhost localhost
 
u_point is not yet installed on the system's PYTHON path.

 cd $HOME/rts2/scripts/u_point
 
Create the site specific observable star catalog based on
Yale Bright Star catalog, see help for e.g. observatory
specific options

 ./u_select.py --plot --brightness-interval "6.0 7.0" --minimum-separation 1.5
 ls -l observable.cat
 -rw-rw-r-- 1 wildi wildi 108813 Nov  6 10:38 observable.cat

Start simulated data acquisition:

 sudo bash
 systemctl start rts2 # Ubuntu 16.04, see $HOME/rts2/conf/rts2.service
 rts2-scriptexec -d C0 -s " exe ./u_acquire_fetch_dss_continuous.sh "

In a separate terminal:

 tail -f /tmp/u_acquire.log 

or at any time for a progress report plot (check option
--base-path)

 ./u_acquire.py --plot --animate --ds9-display

Red dots are remaining nominal and blue dots are acquired positions
To see DSS catalog FITS images, click on a blue point.

Recommended terminal set up
---------------------------

For each listed command open a terminal which can be
viewed "in parallel":

 tail -f /tmp/u_acquire.log 
 telnet 127.0.0.1 9999
 ./u_acquire.py --plot;ds9 -zscale dss*fits
 rts2-scriptexec -d C0 -s " exe ./u_acquire_fetch_dss_continuous.sh "
