Closed WilliamJamieson closed 7 months ago
Attention: 12 lines
in your changes are missing coverage. Please review.
Comparison is base (
fd2d6ce
) 85.98% compared to head (34e59dc
) 86.00%.
Files | Patch % | Lines |
---|---|---|
src/stcal/ramp_fitting/ols_cas22.py | 81.81% | 12 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I agree it's nice to keep this "pure python" from a maintainability perspective. This exactly reproduces the previous results, so no changes to regression tests, etc., are needed?
This code looks good to me and it's nice to be more pure-python-y. I think I understood once that this gives you literally the exact same results as before (i.e., no regression tests would need to change). Is that the case?
Is this PR still relevant?
Ah, we lost track of this one. I'm just going to close.
Cython 3+ supports compiling directly from annotated .py files instead of its own .pyx files. Indeed, Cython recommends doing this if there is no need to interface directly into C files, which is exactly the case for ramp fitting. This is because it enables the full suite of standard python tooling without the need to seek out tooling which specifically supports Cython. Moreover, it also reduces human context switching when reading the code as the "Cython" code now reads exactly like (verbose) python code.
In addition to this switch, I made several other small tweaks to ramp fitting which operationally make no difference (the code exactly reproduces the previous version's results). These tweaks net a modest ~20%-30% speed up over the current ramp fitting code. Other changes include some refactoring to make parts of the code more readable.
Note that when consulting the Cython docs, I discovered that code tends to be faster if all of it is contained within a single Cython module as the Cython C-transpiler can perform some optimizations such as inlining (i.e. Cython cannot inline a function, even if it is marked to be inlined, if the function is called from a different module). This makes the code slightly less readable but it did result in a small but noticeable performance gain.
Checklist
CHANGES.rst
(either inBug Fixes
orChanges to API
)