Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The Command Shell

You’ve pointed the mount at a few dozen stars and saved the run as an INDAT file. Now you want to know which pointing terms the data supports, how well they fit, and which stars don’t belong. pointing is a command shell for that job. It reads the observations, fits the terms you ask for, lets you look at the residuals, and writes the model as an OUTMOD file.

Pointing models here are for equatorial mounts. Alt-azimuth mounts aren’t supported yet, and INDAT files marked :ALTAZ or :GIMBAL are rejected.

Build the shell with the cli feature:

cargo install --path celestial-pointing --features cli

Starting the Shell

CommandReads commands from
pointingthe terminal, in the full-screen UI
pointing --plainthe terminal, one line at a time after a * prompt
pointing run.txtthe file run.txt
pointing < run.txtstandard input

pointing opens the full-screen UI (see The Full-Screen UI) when both standard input and standard output are terminals. Otherwise, and with --plain, it runs in line mode, which prints exactly what a script prints.

In a script, the shell prints each line after a * before it runs it. A failing line prints Error: ... and the script goes on to the next line, so one typo doesn’t throw away the rest of the run. The exit status is 1 when any line failed.

*foo
Error: unknown command: foo

Line Editing and Completion

In line mode at a terminal, the shell edits lines with the usual readline keys: the arrow keys, Ctrl-A and Ctrl-E, Ctrl-R to search the history. History is saved in ~/.celestial_pointing_history, read from the HOME environment variable. Without HOME, the shell says so once and keeps no history. Ctrl-C drops the line being typed, and Ctrl-D leaves the shell.

Tab completes the word before the cursor. A second Tab lists the choices when there is more than one.

AfterTab completes
the promptcommand names, in any case
.procedure names
USE, LOSE, FIX, UNFIXterm names, and the terms in the model
CALLprocedure names
INDAT, INMOD, OUTMOD, FLIST, INPRO, GC P, GC Bfile and directory names

Harmonic terms complete one factor at a time. HD and Tab lists HDSH, HDCH, HDSD and the other sine and cosine factors, and HDSH and Tab lists the second factors. Type the multiple, such as 2 or %, by hand.

A path that starts with " stays quoted, so file names with spaces work:

*INDAT "runs/april n<Tab>
*INDAT "runs/april night.dat"

Scripts and piped input are read as plain text, with no editing.

The Full-Screen UI

The full-screen UI runs every line exactly as line mode does. The session pane on the left shows the same text a script prints, with each line after a *, and the input line is under it. The sidebar on the right shows plots and tables of the current fit. The status bar at the bottom shows the INDAT caption, the observation, mask and term counts, and the Sky RMS and PSD of the last fit.

┌ Session ─────────────────────────────────┐┌──────────────────────────────────┐
│*USE IH ID CH ME MA                       ││ GSCAT   G D H   GDIST   Model   O│
│*FIT                                      ││dD north-south (arcsec)           │
│                                          ││+2 ┤      ⢀⡠⠴⠒⠊⠉⠉⠍⠉⠑⠒⠦⢄⡀          │
│       coeff       change     value    sig││   │   ⢀⡠⠚⠁      ⠅•    ⠈⠓⢄⡀       │
│                                          ││   │  ⣠⠊         ⠅    •   ⠑⣄      │
│  1     IH       +299.786   +299.79    0.7││   │ ⡰⠁      ⣠⠴⠒⠒⠗⠒⠦⣄      ⠈⢆     │
│  2     ID       -200.299   -200.30    0.7││   │⢰⠃     ⣠⠋  ⢀•⣅⡀  ⠙⣄     ⠘⡆    │
│  3     CH       +100.232   +100.23    0.5││   │⡎     •⠃ ⢀⡔⠉•⠅⠉⢢⡀ ⠘⡆     ⢱    │
│  4     ME        -79.899    -79.90    0.6││ 0 ┤⡇⠄⠄⠄⠄⠄⢼⠄⠄⢼⠄⠄⠄⡥⠠⠠⡧⠠⠠⡧⠠⠠⠠⠠⠠⢸    │
│  5     MA         +1.423     +1.42    0.9││   │⢇     ⠸⡄ ⠈⠣⣀ ⡂⣀⠜⠁ ⢠⠇     ⡸    │
│                                          ││   │⠸⡄     ⠙⣄  ⠈⠉⡋⠁  ⣠⠋     ⢠⠇    │
│Sky RMS =   1.28                          ││   │ ⠱⡀      ⠙⠲⠤⠤⡦⠤⠖⠋      ⢀⠎     │
│Popn SD =   2.39                          ││   │  ⠙⢄     •   ⡂        ⡠⠋      │
│                                          ││   │   ⠈⠑⢤⡀   •  ⡂     ⢀⡤⠊⠁       │
│Observation #1 is a very weak outlier cand││-2 ┤      ⠈⠑⠲⠤⢄⣀⣀⣂⣀⡠⠤⠖⠊⠁          │
│                                          ││   └┬────────────┬───────────┬    │
│Sky RMS 1.28                              ││   -2            0          +2    │
│                                          ││    dX east-west (arcsec)         │
├──────────────────────────────────────────┤│circles at 0.5, 1, 2 arcsec       │
│*                                         ││7 observations, radial RMS 1.28 ar│
│F1 help · Tab completes · F6 sidebar      ││Arrows or a click select a point. │
└──────────────────────────────────────────┘└──────────────────────────────────┘
 probe: M… · 7 obs · 0 masked · 5 terms, 0 fixed · Sky 1.28 · PSD 2.39 · F1 help

The status bar uses the INDAT file name when the caption is blank, and leaves out the PSD when the last fit has none.

The input line edits and completes as line mode does and shares its history file. Tab opens a list of the choices, with each command’s description; Tab or the arrow keys move through it and Enter takes one. The line under the input shows the arguments of the command being typed.

KeyDoes
F1, or ? on an empty lineshow the keys and every command’s description
PgUp, PgDn, mouse wheelscroll the session pane
Ctrl-Cclear the line
Ctrl-D on an empty lineleave, as END does
F6move the focus between the input line and the sidebar
[ and ]narrow or widen the sidebar, on an empty line or in the sidebar
F7zoom the sidebar to the full width and back
F9turn mouse capture off, so the terminal selects text, and on again

Drag the divider between the panes with the mouse to resize the sidebar. While mouse capture is on, most terminals still select text with Shift-drag. Set NO_COLOR to draw without colors.

The sidebar has five tabs. Each is recomputed after every command line, so it follows FIT, MASK, USE and INDAT. A tab that needs a fit says so until there is one.

TabShows
GSCATthe scatter diagram of GSCAT, square, with its circles
Gthe residual plot of the last G line, G D H until there is one
GDISTthe histograms of GDIST
Modeleach term’s value and sigma, and a bar one cell per sigma of strength; terms below 2 sigma are dimmed, fixed terms are marked
Obsthe rows of SLIST, masked rows dimmed and marked M

Typing G, GSCAT or GDIST switches to its tab with the line’s arguments and still prints the plot in the session pane, so GC P and GC B write it as before.

Key, in the sidebarDoes
Tab, Shift-Tab, 1 to 5switch tabs; a click on a title does the same
arrow keys on G and GSCATselect the nearest point in the arrow’s direction; a click selects the point nearest to it
Up, Down, Home, Endmove the selection in Obs and Model
PgUp, PgDnmove the selection in Obs by a page
s, rsort Obs by the next column, reverse the order; a click on a heading sorts by it
m, u on G, GSCAT and Obsrun MASK n or UNMASK n for the selected observation, then FIT
Enter on Obsmask or unmask the selected row, then FIT
f, u, d or Delete on Modelrun FIX, UNFIX or LOSE for the selected term, then FIT
Escreturn to the input line

The plots and the Obs tab share one selected observation. The line under a plot gives its hour angle, declination and residuals.

Every key that changes the session runs command lines, which show in the session pane and go into the history as if typed:

*MASK 3
*FIT
...
Sky RMS 1.28 -> 1.37

After each FIT the session pane gives the Sky RMS of the fit before and of this one.

Long Searches

An automodel search can take several seconds, and you don’t want the screen to freeze while it runs. Lines run in the background, so the screen keeps drawing. While FAUTO searches, the session pane shows its log as it is written, a spinner and the seconds taken. Here it runs on paramount.dat:

*FAUTO 8
start IH ID CH NP ME MA psd 85.173
fix at zero NP (0.8 sigma); psd 85.112
add DAF +397.72+-29.41; psd 85.112 -> 62.963
⠙ FAUTO 8 · 2 s · Esc cancels

Esc or Ctrl-C cancels. FAUTO stops between steps with the error the search was cancelled, and leaves the model, the mask and the last fit as they were. Lines not yet run are skipped. You can keep typing while a line runs, and Enter waits until it ends. Line mode prints the log with the result.

A Session

This session fits the six basic equatorial terms to warp-astron.dat, 98 observations from one night, then asks MVET whether every term earns its place. The data files are in celestial-pointing/tests/data.

*INDAT warp-astron.dat
...
*USE IH ID NP CH ME MA
*FIT

       coeff       change     value    sigma

  1     IH      +8512.559  +8512.56   14.883
  2     ID      +7206.960  +7206.96   18.313
  3     NP        -22.682    -22.68   30.817
  4     CH      -1234.764  -1234.76   16.706
  5     ME       -133.523   -133.52   14.296
  6     MA        +64.384    +64.38   25.283

Sky RMS = 109.11
Popn SD = 112.61

Observation #61 is a weak outlier candidate.

*MVET 1

Model terms, strongest first:

  IH
  ID
  CH
  ME
  MA
| NP

Model term NP is the weakest, and has been removed.

  IH
  ID
  CH
  ME
  MA

No weak terms detected.

INDAT prints the file it reads, and clears the mask and the last fit. FIT prints each term’s change in this fit, its value and its sigma, all in arcseconds. A fixed term has no sigma. The population SD is printed only when there are more observations than floating terms.

The outlier line names the observation least like the others. The grade comes from the probability of a residual that large if the observation were typical:

ProbabilityGrade
0.05 or morevery weak
0.01 to 0.05weak
0.001 to 0.01possible
below 0.001strong

MVET ranks the floating terms and marks weak ones with |. MVET n removes the weakest term, refits and ranks again, up to n times. With no n, it fits and ranks without removing anything. Here MVET removes NP and finds no weak terms among the five left.

Procedures

Procedures save typing when you run the same steps on night after night of data. A library file holds procedures between PROC <name> and RETURN. Lines outside a procedure are ignored. ! starts a comment, and a line that ends with \ continues on the next line.

! ramp.pro
PROC STEP
INDAT $1
USE IH ID
FIT
RETURN
*INPRO ramp.pro
Reading procedures from file ramp.pro ...
The library now contains 5 lines.
*CALL STEP april.dat

.STEP april.dat is short for CALL STEP april.dat. $1, $2 and so on are replaced by the arguments. A procedure stops at its first error. Procedure names match in any case. Reading a library replaces any procedure of the same name, and INPRO with no path empties the library.

Echo is off at the start. ECHO or ECHO ON makes the shell print each command a procedure runs after a >, and ECHO OFF stops it.

Commands

HELP lists every command with its arguments. Command names match in any case. The model and fitting commands are:

CommandDoes
INDAT <path>read observations, clearing the mask and the last fit
APPEND [ON|OFF]add the next INDAT file’s observations to those already read
USE [<term>...]add terms at zero and set them floating, keeping the values of terms already present; with no terms, float every term
LOSE [<term>...]remove terms; with no terms, remove them all
FIX / UNFIX <term>...hold terms at their values, or let them float
MASK <n>...leave observations out of the fit, numbered among those kept on reading
UNMASK [<n>...]return observations to the fit; with no numbers, all of them
REFRACT <A> <B>set the refraction constants in arcseconds
REFMODEL [CIDDOR|HS|CLOSED]choose how refraction is computed from the INDAT weather when REFRACT has not set it (default CIDDOR); with no argument, report the model and the constants in use
FITfit the floating terms
MVET [<n>]rank the terms and remove up to n weak ones
SLIST [<r>] [P]residuals of each observation, leaving out those below r arcseconds
LOOleave-one-out residuals and the jackknife PSD
FAUTO [<max harmonic> [<significance>]] [CROSS]build an automodel; see below
G <ydata> <xdata> [<scale>]plot one residual component against one coordinate
GSCAT [E|A] [<radius>]plot the residuals as a scatter diagram
GDISTplot histograms of the residuals
GC [C|P|B] [<path>]forget the last graph, or write it as an SVG file
INMOD / OUTMOD <path>read or write the model
FLIST <path>write the residuals of the unmasked observations to a file
END, QUIT, QU, Qleave

The shell’s own commands are INPRO, CALL, ECHO (see Procedures), GC (see Writing a graph as SVG) and HELP.

FAUTO searches for the terms the unmasked observations support. It starts from a basic model whose size grows with the number of observations. Then it offers harmonics up to <max harmonic> (default 8), and adds terms of at least <significance> sigma (default 2). CROSS also offers single cross harmonics such as HDCH3CD8. FAUTO replaces the model, and adds the outliers it masks to the mask. Its log names each step:

*INDAT warp-astron.dat
...
*FAUTO
start IH ID CH NP ME MA psd 112.609
fix at zero NP (0.7 sigma); psd 112.311
add HDSD -172.64+-20.53, HDCD -110.74+-18.31; psd 112.311 -> 76.659
add DAF +254.46+-37.15; psd 76.659 -> 63.400
...
fix at zero ME (0.0 sigma); psd 53.075
mask obs 98; psd 49.031
Masked observations: 98

The fitted model follows, in the same layout as FIT prints.

Listing the Residuals

SLIST prints the residuals of every observation at the current coefficients, with the RMS of dX, dD and dR over the unmasked observations. Here it lists cgx-l-data.dat against the model in outmods/cgxl-outmod.dat:

*INDAT cgx-l-data.dat
...
*REFMODEL HS
*INMOD outmods/cgxl-outmod.dat
*MASK 14
*SLIST

   #   HA          Dec            Az     ZD       dX       dD       dS       dZ       dR

   1b  -05 19 56.7 +72 29 13   22.71  50.14    90.19   -47.50   -54.43   -86.23   101.97
  ...
  14 M +01 12 37.7 +54 39 51  327.96  19.86   114.38  -429.37   387.60  -218.38   444.39
  ...

RMS of 147 unmasked observations              160.22   172.16                     235.17

Each row has the star’s hour angle and declination, its azimuth (north through east) and zenith distance in degrees, then the residuals in arcseconds. b marks a mount reading beyond the pole and M a masked observation. SLIST 300 leaves out the observations whose radial error dR is below 300 arcseconds. Masked observations count as zero, so they appear only without a threshold. A P (paged output) before or after the threshold is accepted and ignored.

FLIST <path> writes the same residuals to a file at higher resolution, one record per unmasked observation and a closing END. The first record of the session above is:

   1b -05 19 56.6945 +72 29 13.382   22.709  50.141   90.192  -47.500  -54.428  -86.229  101.965

A residual whose text takes 9 characters or more, such as -1798.640, joins the field before it, with no space between them.

Graphs

The graph commands plot the residuals of the last fit, so run FIT first. Masked observations are left out. The examples below fit five terms to the 218 observations of paramount.dat:

*INDAT paramount.dat
*USE IH ID CH ME MA
*FIT

Residuals are in arcseconds, in the sense telescope minus star, as SLIST prints them. The terminal plots use braille characters, so the terminal font needs them.

G: one residual component against one coordinate

G <ydata> <xdata> [<scale>] plots the residual component ydata against the coordinate xdata. The scale is the largest residual the vertical axis shows. By default it is the largest residual rounded up to 1, 2 or 5 times a power of ten. Points beyond the scale are left out and counted.

ydataResidual
Hin hour angle
Xeast-west: the hour-angle residual times cos(dec)
Din declination
Ain azimuth, increasing from south through east, so that S is A times cos(elevation)
Sleft-right
Zin zenith distance
Ein elevation, minus Z
Rtotal
xdataCoordinate of the star
Hhour angle, -12 to +12 h
Ddeclination
Aazimuth, north through east
Zzenith distance
Eelevation, 90 degrees minus Z
Qparallactic angle
Nobservation number

Pointing is equatorial-only, so E and Z describe the same direction. P and V, the residuals that correspond to HA/Dec and Az/El nonperpendicularity, are not supported.

*G D H

G D H
dD declination (arcsec)
+200 ┤
     │
     │
     │                              ⠠
     │                       ⡀⠠⠄⠒⡐ ⠁  ⠐  ⠂ ⠂  ⠄
+100 ┤                      ⠰⢀ ⡂  ⠂⡀     ⠤
     │                          ⠁⠐⡀⢠   ⢀⡀ ⢀⠱⠠⡈⡀  ⠂
     │                     ⢠⠉⡀⠆⠠⠵⡨⠅⠜⡈  ⠈  ⠉⠈⠈⠂ ⡀ ⠁
     │                    ⠠⡂   ⠄⠒⠐  ⠁
     │                     ⠤⢀  ⠠⠁⠅⠄⠨ ⠘  ⠠⢀    ⠄⠠⠢⠂⠆⠂ ⢀
   0 ┤⠁ ⠁ ⠁ ⠁ ⠁ ⠁ ⠁ ⠁ ⠁ ⠁ ⠅ ⠁ ⠁⠄⠡ ⠁⢀⠩⠂⡁ ⠁ ⠁⡠⠉⠰⠹⡉⠉⠁⠁⢀⠅ ⠁ ⠁ ⠁ ⠁ ⠁ ⠁ ⠁ ⠁ ⠁
     │                 ⠐ ⢀⢀⠄⣀   ⡐⢰⠠⠂⠐⢀ ⢀      ⠂⠂⢂⠈⠑ ⢀
     │                 ⠈⠄⠄ ⠠ ⠈  ⠐⠉⠔  ⢂   ⢀⠄  ⠠⠐⢉⡠ ⠠⠁
     │                     ⠢⠐⣀⠐⠠⠁ ⠠         ⠐⠘⡀⢀
     │                  ⠂⢀ ⢂  ⢄⠐⢀    ⠂       ⠊
-100 ┤                      ⠐⠈⢠⠈    ⠠
     │                         ⠈  ⠐
     │
     │
     │
-200 ┤
     └┬───────────────┬───────────────┬───────────────┬───────────────┬
     -12             -6               0               6              12
                            hour angle (h)
218 observations, scale 200 arcsec

GSCAT: scatter diagram

GSCAT [E|A] [<radius>] plots each observation’s residual as a point, like shots on a target. E, the default, plots east-west against north-south. A plots left-right against up-down, where up-down is the elevation residual. The radius is 0.1 to 9999.9 arcsec. By default it is the largest residual rounded up to 1, 2 or 5 times a power of ten. The circles are at the 1, 2 and 5 steps between a tenth of the radius and the radius.

*GSCAT

GSCAT
dD north-south (arcsec)
+200 ┤            ⢀⠠⠐⠐⠐⠈⠈⠈⠍⠈⠈⠐⠐⠐⠠⢀
     │         ⠄⠂⠁⠁       ⠅       ⠁⠁⠂⠄
     │      ⡀⠔⠈           ⠅          ⠈⠐⠄⡀
     │    ⠠⠐            • ⠅             ⠐⠠
     │   ⡐⠁           ••••⠅   •  •   •    ⠑⡀
     │  ⡐         •  ⡀⠄⠂⠂•⠍••••••          ⠐⡀
     │ ⠌          ⠠•••  • ⠅• •••⠁⢄••••      ⠈⠄
     │⠠⠁         ⡠•••  •••••⡀•••• •••        ⠡
     │⠌         ⢐   ••⠔⠁• ⠅ •⠑• •• ⠡         ⠈⠄
     │⠅      •  ⡂• ••••  •⠅ •••⠄••• •         ⠅
   0 ┤⠅⠁⠁⠁⠁⠁⠁⠁⠁⠁•••••⠅•••••••••⠅⠁•⠁⠁⠅⠁⠁⠁•⠁⠁⠁⠁⠁⠅
     │⠅        •••••••••  •••⢀• •••⠠⠁•        ⠅
     │⠨         ••• •••••••••⠁••• ⢀⠅••       ⠨
     │ ⠅          ⠡• •••• ••••• •⠔ •         ⠅
     │ ⠈⢂       •  ••⠂⠄⡀• ⠅•⢀⢀⠠•• • •      ⢀⠊
     │   ⢂          •    ⠁⠍• •••          ⢀⠂
     │    ⠡⢀         •    •             ⢀⠠⠁
     │      ⠂⢄            ⠅           ⢀⠄⠂
     │        ⠈⠄⡀         ⠅         ⡀⠌
     │           ⠁⠑⠠⢀⢀⢀   ⠅  ⢀⢀⢀⠠⠐⠁⠁
-200 ┤                 ⠈⠈⠈⠉⠈⠈
     └┬───────────────────┬───────────────────┬
    -200                  0                 +200
             dX east-west (arcsec)
circles at 50, 100, 200 arcsec
218 observations, radial RMS 84.13 arcsec

GDIST: histograms

GDIST draws one histogram for each of the east-west (X), north-south (D), left-right (S), up-down (Z) and total (R) residuals, with the mean m and the standard deviation sd. The number of bins is ceil(log2 n) + 1 for n observations, at most 12. All five histograms share one range, the largest residual rounded up to 1, 2 or 5 times a power of ten, and one count scale.

*GDIST

GDIST
    X             D             S             Z             R
   ⣤             ⣀             ⣶ ⣀           ⣿             ⣀
   ⣿⣤⣶           ⣿⣤⣶           ⣿⣿⣿           ⣿            ⣤⣿
   ⣿⣿⣿           ⣿⣿⣿           ⣿⣿⣿          ⣶⣿            ⣿⣿⣿
   ⣿⣿⣿           ⣿⣿⣿           ⣿⣿⣿          ⣿⣿⣿⣿          ⣿⣿⣿
  ⣀⣿⣿⣿           ⣿⣿⣿           ⣿⣿⣿          ⣿⣿⣿⣿          ⣿⣿⣿⣤
  ⣿⣿⣿⣿⣤         ⣤⣿⣿⣿⣀         ⣀⣿⣿⣿          ⣿⣿⣿⣿⣶        ⣀⣿⣿⣿⣿
  ⣿⣿⣿⣿⣿         ⣿⣿⣿⣿⣿         ⣿⣿⣿⣿⣿         ⣿⣿⣿⣿⣿        ⣿⣿⣿⣿⣿
  ⣿⣿⣿⣿⣿         ⣿⣿⣿⣿⣿         ⣿⣿⣿⣿⣿         ⣿⣿⣿⣿⣿        ⣿⣿⣿⣿⣿
  ⣿⣿⣿⣿⣿         ⣿⣿⣿⣿⣿⣶        ⣿⣿⣿⣿⣿         ⣿⣿⣿⣿⣿       ⣀⣿⣿⣿⣿⣿
 ⣀⣿⣿⣿⣿⣿⣶       ⣤⣿⣿⣿⣿⣿⣿       ⣿⣿⣿⣿⣿⣿⣀       ⣶⣿⣿⣿⣿⣿⣀      ⣿⣿⣿⣿⣿⣿⣤⣀
────┴────     ────┴────     ────┴────     ────┴────     ┴────────
-200 +200     -200 +200     -200 +200     -200 +200     0    +200
m +0.83       m +5.34       m -3.78       m -13.05      m +78.32
sd 58.62      sd 60.10      sd 56.86      sd 60.50      sd 30.72
X east-west, D north-south, S left-right, Z up-down, R total, in arcsec
218 observations, 9 bins, tallest bin 58

Writing a graph as SVG

GC P [<path>] writes the last graph drawn as an SVG file with colored pens, and GC B [<path>] with black pens only. The path defaults to pointing.svg in the current directory. In the SVG file, open markers are observations whose mount reading is beyond the pole, and each marker shows its observation number as a tooltip. GC or GC C forgets the last graph.

*GSCAT A
...
*GC P scatter.svg
Graph written to scatter.svg