Closed jaredmales closed 5 months ago
Recording my investigation here:
Inspecting http://weather.lco.cl/clima/weather/Magellan/JS/seeingCalPlotFunc.js shows the fetching and pre-processing. The mapping of sources to numbers is here:
// initial data PHP script
seeingPlot.initialphp1 = "PHP/grabCalMag1.php";
seeingPlot.initialphp2 = "PHP/grabCalMag2.php";
seeingPlot.initialphp3 = "PHP/grabCalDimm.php";
After fetching from those endpoints, we have on line 143:
// main drawing function. Gets the data, parses and draws all
// plot elements.
seeingPlot.initialData = function () {
d3.json(seeingPlot.initialphp1, function(error1, data1) {
// after getting the data it's parsed into array
data1.forEach(function(d){
d.tm = seeingPlot.parseDate(d.tm);
d.el = 1.0/Math.cos((90-d.el)*Math.PI/180.0);
d.fw = d.fw / Math.pow(d.el, 0.6); // treating elevation as airmass!
seeingPlot.jsondata1.push(d);
})
d3.json(seeingPlot.initialphp2, function(error2, data2) {
// after getting the data it's parsed into array
data2.forEach(function(d){
d.tm = seeingPlot.parseDate(d.tm);
d.el = 1.0/Math.cos((90-d.el)*Math.PI/180.0);
d.fw = d.fw / Math.pow(d.el, 0.6);
seeingPlot.jsondata2.push(d);
})
d3.json(seeingPlot.initialphp3, function(error3, data3) {
// after getting the data it's parsed into array
data3.forEach(function(d){
d.tm = seeingPlot.parseDate(d.tm);
d.el = 1.0/Math.cos((90-d.el)*Math.PI/180.0);
//d.fw = d.fw / Math.pow(d.el, 0.6); //if its not unscaled
d.fw = +d.fw;
seeingPlot.jsondata3.push(d);
})
// ... rest omitted ...
If Apache is to be believed, this file is unchanged since Dec 29 2015, so I don't think the formulae have changed in recent memory.
To summarize:
fw
elements for mag1 and mag2 data but the dimm fw
data is used as-isel
, which is then used to compute zenith angle (90-d.el
), converted to radians (*Math.PI/180.0
), and used to compute the secant (1/Math.cos(...)
). So, after that conversion, d.el
is sec(z).MagAO-X automates collection of seeing information by launching a short Python script at regular intervals.
This script hits the PHP script endpoints to retrieve recent/current seeing measurements and writes them to files in /tmp
.
$ cat /tmp/*.tsv
datetime fwhm elevation
2023-05-25 00:25:21 0.68 52.84
datetime fwhm elevation
2023-05-25 00:25:05 0.9 52.48
datetime fwhm elevation
2023-05-25 00:25:05 0.81 35.02
$ ls /tmp/*.tsv
/tmp/dimm.tsv /tmp/mag1.tsv /tmp/mag2.tsv
This script gets called by tcsi
(the TCS interface app/device):
not more often than
The formulae are applied to mag1: https://github.com/magao-x/MagAOX/blob/ea799436921200e84ca1229ecd9f8e19c332e4e7/apps/tcsInterface/tcsInterface.hpp#L1579
and, it appears, erroneously, to dimm: https://github.com/magao-x/MagAOX/blob/ea799436921200e84ca1229ecd9f8e19c332e4e7/apps/tcsInterface/tcsInterface.hpp#L1543
The takeaway is that we should ignore the dimm_fwhm_corr
element in historical data because it's been double-corrected
Going forwards the historical data will call the usable dimm data dimm_fwhm_corr
and the unusable data dimm_fwhm_bad
. See https://github.com/magao-x/MagAOX/commit/b2e7918ca9bdd4b79d0c3209f2e1a62bf1dd9faa
tcsi mag1_fwhm_corr matches what is plotted. dimm_fwhm matches what is plotted, not _corr. similarly, the web ui presents the numbers that match the plot.
is the dimm corrected on the plot / in the data stream that get seeting is using?