Skip to content

Replace the RV engine with ravex - #35

Merged
martindevora merged 7 commits into
masterfrom
issue-34-ravex-rv-engine
Nov 6, 2026
Merged

martindevora merged 7 commits into
masterfrom
issue-34-ravex-rv-engine

Conversation

@martindevora

Copy link
Copy Markdown
Collaborator

Closes #34.

Replaces the RV injection and recovery engine with ravex v0.1.0, added as a git submodule at tkmatrix/ravex. The RV: block, the MATRIX RV methods and the output files keep working as before, except for the changes listed below.

Changes for users

  • found now follows the ravex period+fap rule: the peak must match the injected period and have a false alarm probability below RV.FAP_THRESHOLD (0.01 by default, a value above 1 disables it).
  • New optional settings: RV.MIN_PERIOD_SEARCH and RV.PERIOD_MATCH_TOLERANCE, which default to the global values.
  • a_rv_report.csv has a new last column, fap. recover_signal and recover_strongest_signal return it as a new last tuple element.
  • The periodogram search is weighted by rv_err, so recovery rates can differ from earlier versions.
  • The default RV search floor is now 0.5 d (it was a fixed 0.4 d).
  • The report is saved every 60 seconds during recovery, and finished rows survive an interruption.

Plot fixes

plot_results and plot_diff misplaced cells and contours on log grids and merged the last two grid values. They now draw one cell per grid value. yticks were also applied to the x axis, and planet markers could leave an empty strip at the plot edge.

Known differences from ravex

  • MATRIX rounds grid values to 2 decimals in inject_rv, which accounts for most of the remaining gap on the worst nb08 cells. This was not tested on nb09.
  • With the same settings, the ravex example notebooks agree closely, and recovery times are similar on the GJ 724 maps.

Setup

Git checkouts need git submodule update --init --recursive. Do not add an unqualified PyPI ravex dependency: that name belongs to an unrelated package.

🤖 Generated with Claude Code

martindevora and others added 7 commits November 5, 2026 10:34
Unit, integration and end-to-end coverage of the RV contract, using
independent oracles. These fail on the current engine and pipeline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add ravex as a submodule pinned to v0.1.0 and build RvFitter on it. The
adapter keeps the transit epoch with omega = 0 and the SNR and SDE scale
with the root of the GLS power. The sine fit gains a free offset.

Fix the defects that stopped RV runs outside the engine: the undefined
inject_dir, the missing MIN_MASS, the injected file pattern, star_info,
the semi-major axis call, RV-only runs, the light curve load when
reusing a directory and the MIN_PERIOD_SEARCH default.

Refs #34

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Validate RV files fully before any other work, and run recovery in a
pool. Failed scenarios are now logged and counted, and if all of them
fail the cause is raised while the injected files are kept. Fit the
phase properly when a mask fixes the amplitude, and explain how to get
a missing ravex submodule.

Refs #34

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the pool with an executor that raises if a worker dies, and
save the report during the run so interruptions keep finished scenarios
and progress stays visible. Load whole-number RV errors as floats, which
mass masks need, and test that fit errors are formal.

Refs #34

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Save the rows already received and log the stop in matrix.log before
re-raising, so a dead worker or Ctrl-C does not lose them.

Refs #34

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add RV.MIN_PERIOD_SEARCH and RV.PERIOD_MATCH_TOLERANCE, falling back to
the global search floor and a 1% match. The search floor now reaches the
period grid, the lightkurve search and the recovery, replacing the fixed
floor in rv.py.

Save the RV report every 60 seconds instead of every 50 rows, since the
row-based rewrite grew quadratically with the report size.

Draw the result maps with pcolormesh on real cell edges, so log grids
place cells and contours where the values are, and the last grid values
are no longer merged. Apply yticks to the y axis and keep planet markers
from widening the plot limits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow the ravex period+fap criterion: a signal counts as found when the
peak matches the injected period and its Baluev false alarm probability
is below RV.FAP_THRESHOLD, 0.01 by default. ravex already computes the
probability, so the search costs the same.

Report it in a new last fap column, and as a new last element of the
recover_signal and recover_strongest_signal tuples. A matching peak above
the threshold ends the scenario, because going on would subtract the
injected signal itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@martindevora
martindevora merged commit a8dc62f into master Nov 6, 2026
1 check passed
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.

Replace the RV injection and recovery engine with ravex, keeping the current contract

1 participant