Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization: roughly 40% of a call to ols_ramp_fit_single is consumed by 2 lines #170

Open
braingram opened this issue May 22, 2023 · 2 comments

Comments

@braingram
Copy link
Collaborator

https://github.com/spacetelescope/stcal/blob/main/src/stcal/ramp_fitting/ols_fit.py#L1657-L1658

These appear to be iterating through pixels. Is there a way to convert this to a vector operation or some other optimization?

Here is a plot of the time taken to run ols_ramp_fit_single generated with snakeviz (note the 40% number was calculated using line_profiler as snakeviz times don't always make sense, note that calc_slope contains a block for calc_slope with an equal measurement of time).
Screen Shot 2023-05-22 at 5 15 10 PM

@zacharyburnett
Copy link
Collaborator

zacharyburnett commented Jul 1, 2024

the link in the discussion is not pinned to a specific commit, so the line numbers have changed since original posting:

# Reset the initial False groups to be True so that the first False is now either a jump or sat
# Because start was set to be the first True, the initial False values will not be included
for pixel in range(npix):
mask_2d[: start[pixel], pixel] = True

@braingram
Copy link
Collaborator Author

This can likely be closed since there is now a c version (and the python version will likely be removed).

I'm leaving it open for now but if anyone feels like it should be closed feel free to close it.

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

No branches or pull requests

2 participants