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

Automodel and Vetting

Picking terms by hand means fitting, plotting, adding a pair of harmonics, fitting again and deciding whether the new terms are real. That’s fine for one night. For a run with a hundred stars and a dozen candidate harmonics, you want the program to try them and tell you what it found. Two commands do that:

  • MVET ranks the terms you already have and removes the weak ones.
  • FAUTO builds a model from scratch. It adds the terms the data supports, removes the ones it doesn’t, and masks outliers. The search is called automodel.

Both use the same test for a weak term: its value is under the significance threshold, two sigma by default, or removing it doesn’t raise the PSD. A term that fails the second test isn’t paying for itself, because the fit is as good without it.

Rank the terms with MVET

Fit the six basic terms to warp-astron.dat, then ask MVET to remove at most one term:

*INDAT warp-astron.dat
...
*USE IH ID NP CH ME MA
*FIT
...
*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.

The | marks a weak term. MVET removed NP, refitted the other five and ranked them again. With no number, MVET ranks the terms without removing anything, which is a quick way to check a model you built by hand. MVET leaves fixed terms alone.

Build a model with FAUTO

FAUTO starts from the basic terms and searches from there. Its log has one line per decision:

*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
add HHSD -110.15+-27.93, HHCD -0.71+-24.56; psd 63.400 -> 59.385
remove HHCD (0.0 sigma); psd 59.050
add HDSH4 -17.43+-8.65, HDCH4 -27.69+-8.27; psd 59.050 -> 55.590
fix at zero MA (1.9 sigma); psd 56.319
add HDSD6 -1.65+-7.43, HDCD6 +20.70+-7.75; psd 56.319 -> 55.004
remove HDSD6 (0.2 sigma); psd 54.701
add TF -58.40+-23.65; psd 54.701 -> 53.382
fix at zero ME (0.0 sigma); psd 53.075
mask obs 98; psd 49.031
Masked observations: 98

       coeff       change     value    sigma

  1     IH                 +8521.26    7.655
  2     ID                 +7298.46    7.269
  3     CH                 -1016.47   25.291
  4     NP                    +0.00
  5     ME                    +0.00
  6     MA                    +0.00
  7     HDSD                -124.72   12.539
  8     HDCD                -161.97    9.388
  9     DAF                 +325.76   29.809
 10     HHSD                -172.32   18.083
 11     HDSH4                -31.08    7.143
 12     HDCH4                -29.79    6.847
 13     HDCD6                +27.78    7.079
 14     TF                   -55.74   15.502

Sky RMS =  46.17
Popn SD =  49.03

Read the log top to bottom:

  • start fits the basic model. Its size depends on the number of stars: two terms for one or two stars, up to all six from six stars on.
  • add scores every candidate with a quick estimate of its significance, fits the five best in full, and adds the most promising one whose fit lowers the PSD and reaches the significance threshold. The line gives each new term’s value and sigma. The candidates are TF, TX10, DAF and sine/cosine harmonic pairs in hour angle and declination. A harmonic comes in as a pair, and a weak half can be removed later, as HHCD was here.
  • remove drops a term that turned weak after another term came in.
  • fix at zero drops a basic term but leaves it in the model, fixed at zero, so you can see it was tried. IH and ID are never dropped.
  • mask obs runs when nothing more can be added or removed. If the star with the largest leave-one-out residual is further out than chance allows, the search masks it and carries on with the candidates not yet tried.

Over the search, the PSD went from 112.6 to 49.0 arcseconds, and star 98 was masked. The search tries each candidate at most once, so it always ends.

FAUTO 4 offers harmonics up to the fourth instead of the eighth, and FAUTO 8 3 keeps only terms of 3 sigma or more. FAUTO CROSS also offers single cross harmonics such as HDCH3CD8, which multiply an hour-angle factor by a declination factor. CROSS multiplies the number of candidates, so the search takes longer.

Check the result

A search that adds terms until the PSD stops falling can fit noise. LOO checks for that. For each star it estimates the fit without that star and measures how far the star lands from that fit’s prediction. The RMS of those misses is the jackknife PSD:

*LOO
...
Jackknife PSD =  49.11

The jackknife PSD of 49.11 is close to the PSD of 49.03, so the model predicts stars it wasn’t fitted to about as well as the ones it was. A jackknife PSD well above the PSD means some terms describe this night’s noise and won’t help tomorrow.

Automodel and the physical terms

FAUTO fixed ME and MA at zero on this data. That doesn’t mean the polar axis is aligned: the six-term fit measured ME at more than 9 sigma. Over these stars the harmonics overlap with ME and MA, and once they were in, ME and MA fell below two sigma. The model points as well, but its ME and MA no longer measure the polar axis. Read polar alignment from a basic fit, as Polar Alignment does.

From Rust

automodel runs the same search on a reduced observation set:

use std::path::Path;

use celestial_pointing::astrometry::{RefractionModelKind, RunRefraction};
use celestial_pointing::automodel::{automodel, AutomodelOptions};
use celestial_pointing::observation::ObservationSet;
use celestial_pointing::progress::NoProgress;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let observations = ObservationSet::read_indat(
        Path::new("warp-astron.dat"),
        RunRefraction::FromWeather(RefractionModelKind::Ciddor),
    )?;
    let result = automodel(
        &observations.reduce()?,
        &AutomodelOptions::default(),
        &mut NoProgress,
    )?;

    let names: Vec<&str> = result.fit.model.terms().iter().map(|t| t.name.as_str()).collect();
    println!("terms:  {}", names.join(" "));
    println!("masked: {:?}", result.masked);
    println!("Sky RMS {:.2}, PSD {:.2}", result.fit.rms, result.fit.psd);
    Ok(())
}
terms:  IH ID CH NP ME MA HDSD HDCD DAF HHSD HDSH4 HDCH4 HDCD6 TF
masked: [ObsId(98)]
Sky RMS 46.17, PSD 49.03

result.log holds the log lines. To watch them as the search writes them, or to cancel a long search, pass your own Progress instead of NoProgress. Its line method receives each log line, and the search stops with Error::Cancelled when cancelled returns true.

MVET has no function of its own. Run it, or any other shell command, on a Session with commands::execute:

use celestial_pointing::commands::{execute, CommandOutput};
use celestial_pointing::progress::NoProgress;
use celestial_pointing::session::Session;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut session = Session::default();
    execute(&mut session, "INDAT", &["warp-astron.dat"], &mut NoProgress)?;
    execute(&mut session, "USE", &["IH", "ID", "NP", "CH", "ME", "MA"], &mut NoProgress)?;
    execute(&mut session, "FIT", &[], &mut NoProgress)?;

    if let CommandOutput::Mvet(report) = execute(&mut session, "MVET", &["1"], &mut NoProgress)? {
        println!("removed {:?}", report.removed);
        for term in &report.rankings[0] {
            println!("{:4} {:5.1} sigma{}", term.name, term.strength, if term.weak { "  weak" } else { "" });
        }
    }
    Ok(())
}
removed ["NP"]
IH   572.0 sigma
ID   393.5 sigma
CH    73.9 sigma
ME     9.3 sigma
MA     2.5 sigma
NP     0.7 sigma  weak

Next steps