Skip to content

Fix inverted ratio in residual table; plot against distance, as scatter - #94

Open
Athanaseus wants to merge 1 commit into
src-statsfrom
res-plot
Open

Athanaseus wants to merge 1 commit into
src-statsfrom
res-plot

Conversation

@Athanaseus

Copy link
Copy Markdown
Owner

Before / after

Screenshot 2026-09-15 211000 Screenshot 2026-09-15 211031

Same image pair and catalogue in both. (The pair is an intrinsic vs an apparent residual, so the radial trend is mostly primary-beam normalisation — it's here to show the axis working, not as a calibration result.)

Bugs fixed

  • The table's Res1-to-Res2 was inverted. It computed mean(res2)/mean(res1) under that label — the inverse of the per-source rms_ratio and of the series drawn from it. On this pair it read 0.3375 while the plot showed 2.96.
  • Hover showed ??? on the res1 and res2 series. They were drawn from raw arrays while the tooltip fields come from the shared ColumnDataSource. All series now draw from it, and hover also shows distance.
  • The right-hand axis lost its tick labels once the ratio axis went log: an extra range inherits the figure's scale. Both axes are now log.
  • Tick labels were 6pt against 14pt axis titles. Default is now 12pt. This affects every aimfast plot, not only this one.
  • Legend click-to-hide was missing here; the flux, overlay and position plots already had it.

Changes

  • x axis is distance from the phase centre, in degrees, instead of catalogue order. Catalogue order is arbitrary, so any trend with radius was scattered and read as noise. --sort-sources also takes flux (model flux in Jy) or none (the old behaviour). The random-positions path has no flux and falls back to the index.
  • Ratio on a log axis, with a line at 1.0. On a linear axis "twice as bad" (2.0) sits twice as far from no-change as "twice as good" (0.5).
  • Scatter instead of lines, with a distinct marker per series. These are independent measurements at scattered positions; a line between neighbours implies a continuity that only reflects the sort order.
  • The table reports the signed statistics from the previous PR, plus tail counts, and formats its values (they rendered as 0.00018758542137220502):
stat value
Res1-to-Res2 2.9629
Mean deepest negative res1 / res2 (Jy) −3.653e-04 / −7.275e-05
Sources with hole > 10% of flux, res1 / res2 1256 / 649 (of 1694)
Ratio > 5 / < 1/5 181 / 267
Ratio > 10 / < 1/10 84 / 6

The tail counts matter because a mean ratio barely moves when a few sources are wrecked. Here 5× favours res1, while 10× strongly favours res2 — invisible in the mean.

The table row labelled Res1-to-Res2 computed mean(res2)/mean(res1) - the inverse
of the per-source rms_ratio column and of the series drawn from it. On the DI/DD
pair it read 0.3375 where the plot showed 2.96.

The x axis was catalogue order, which is arbitrary, so a trend with off-axis
distance or brightness scattered across the plot and read as noise. Order by
distance from the phase centre by default and plot that distance in degrees.
--sort-sources also takes flux (model flux in Jy) or none (source index, the old
behaviour). The random path has no flux column and falls back to the index.

Put both y axes on a log scale, with a line at 1.0. On a linear axis
twice-as-bad (2.0) sits twice as far from no-change as twice-as-good (0.5), so
equal changes looked unequal; and the residuals themselves span several decades.
The right-hand axis needs it too: an extra range inherits the figure's scale, so
a linear range there lost its tick labels.

Draw the series as scatter rather than line - these are independent measurements
at scattered sky positions, and a line between neighbours implies a continuity
that only reflects the ordering. Distinct markers per series.

Hover reported "???" on res1 and res2: they were drawn from raw arrays while the
tooltip fields come from the shared ColumnDataSource. Draw them from it, and add
distance to the tooltip.

Report the signed statistics beside the sign-blind std, count sources whose hole
exceeds 10% of model flux, and count the ratio tails at 5x and 10x each way - a
mean ratio barely moves when a few sources are wrecked. Format the values, which
previously rendered as 0.00018758542137220502.

Tick labels were 6pt against 14pt axis titles, less than half the size of the
text beside them; default them to 12pt. This affects every plot, not only this
one. Also set legend click_policy, which the other three plots already had.
@Athanaseus
Athanaseus added this pull request to stack #92 September 15, 2026 19:11

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant