Storing a Solution
The MccsCalibrationStore device is responsible for populating the calibration
database. A solution is passed to it as an argument and written to the calibration
database, which is the only place solutions live: nothing is read back from the
correlator files at application time.
Storing is not a single write. A solution for one channel means little on its own, so what is stored is a small hierarchy: the acquisition the data came from, the job that solved it, and then the per-channel solutions and the phase fit belonging to that job. The calibrator makes all of these writes as it goes.
The acquisition
StoreFrequencySweep describes the acquisition: the station, the channel range
requested, when it started, how many samples were correlated, and the static
delays in force at the time. It returns a sweep id, also readable as the
lastSweepID attribute. Once the acquisition finishes, the location of the data
is filled in with UpdateFrequencySweep, so the files behind a solution can be
found later.
The job
StoreCalibrationJob records one solve against that sweep, and is the parent of
everything that solve produces. It holds what is common to all of the solutions
from the sweep: the parameters the solve was run with, the antennas masked at the
outset, the name of the job and whether it is preferred. The per-channel solutions
and the phase fit then reference it, so anything true of the whole sweep is stored
once here rather than repeated on every channel.
It returns a job id, also readable as lastJobID. A job refers to a sweep
rather than owning it, so the same acquisition can be solved more than once, with
different parameters each time, giving a job each.
Writing the solutions
StoreSolution is called once per channel, and writes the gains for that
channel against the job, together with the metadata that varies channel by channel:
the correlation coefficient, the residuals, the masked antenna counts and the
conditions at the time of acquisition. It also records the path of the correlator
file the solution came from.
StorePhaseFitParams is called once, after the last channel, and writes the
result of the phase fit for the sweep: the offset and delay per antenna, the cost
and covariance of each fit, and the antennas that were masked in every channel of
the sweep. There is one such row per job. See Solving for a Gain for what the fit is and
Application of Solutions for how it is used.
Naming and preference
A job is identified by a unique name. GenerateCalibrationSolution accepts one
and generates a user_friendly_name if it is not given, and it rejects a name that is
already in use. CheckCalibrationId tests a name before it is used and
GetCalibrationIds lists the names already stored.
MarkCalibrationJobPreferred marks a job, by name, as the one to prefer for its
station, and GetLatestPreferredJobID reports the most recent such job. Whether
a read honours that mark depends on the policy in force, described in
Solution Selection.
Database schema
The schema a solution is written into is documented alongside the data products, see Data Products.