I can see the finish line. Send help, or snacks, or both.
The unit_list_proxy.c Exorcism
unit_list_proxy.c is in review. That circular dependency on astropy.units.UnitBase was a nightmare: it kept re-importing the entire units module at runtime just to check if something looked vaguely unit-shaped. So I ripped out PyImport_ImportModule completely and built a proper Dependency Injection bridge instead: astropy.units.Unit now gets handed straight to the C-layer during module init [no more knocking on Python's door mid-runtime, it just lives there now]. setitem uses that injected class to enforce FITS formatting, and it's smarter than a blunt gatekeeper about it. Feed it something like "bananas // sekonds" and it doesn't slam the TypeError hammer down; it shrugs, emits a UnitsWarning, and keeps the string around for backward compatibility [petty tolerance for legacy nonsense, but tolerance nonetheless]. It only throws a hard TypeError when the input is genuinely un-parseable garbage. And getitem, this is the actual win, stopped handing back plain strings altogether. It now returns real Unit objects, like CompositeUnit, straight across the C boundary, which is what fixed the sequence math bug that started this whole mess. Tests skip the astropy.wcs wrappers entirely and hit _wcs.Wcsprm's C-slots directly to prove the whole thing is airtight.
The bls Extension, Numerically Unbothered
Also finished the Box Least Squares (bls) extension, feeding typed np.float64 buffers straight into bls_impl/run_bls and bypassing the high-level API entirely. Built a SyntheticTransit fixture with a fake star, a fake dip, a fake planet doing exactly what it's told, and confirmed the C engine recovers period, depth, duration correctly. First pass, I hit some phase-binning drift and figured I'd just loosen rtol to 5e-2 and call it a day [the coward's tolerance]. Mentor feedback said otherwise. Cranked the fixture to 10,000 points, hunted down a sneaky np.linspace grid-spacing bug, and tightened rtol all the way to a genuinely crisp 1e-4. Turns out the drift was never the model's fault, it was mine. Also confirmed the early-exit flags (1 and 2) raise real ValueErrors instead of just disappearing without a word.
On Being a Translator at the Cython Border
This Cython boundary work is basically being a translator between two people who are both right and also both furious. C doesn't warn you before it breaks. Python will forgive almost anything. I'm just standing in the middle going "she just needs a float64, please don't segfault."
What's Left
One thing left: lombscargle. Then I'm done.
Tired. Wired. Diving back in for one more compile.
Top comments (0)