-
Notifications
You must be signed in to change notification settings - Fork 0
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
Implement fast centroid fit to sky camera spots #16
base: main
Are you sure you want to change the base?
Conversation
The current implementation consists of:
I suspect most of the time is spent calculated shifted profiles 2 x (10 x 10 + 10) = 220 times, but I need to confirm this. |
My estimate (270) of the number of times shifted profiles are calculated was low because shifts are also used to estimate partial derivatives and there is some branching logic so the number of calls varies each time. It looks like the average number of calls is around 731. Each call to |
The basic outline of a faster implementation is to:
Note that chisquare values are computed assuming a global (dx,dy) shift for all spots, instead of first optimizing chisquare separately for each fiber, then using their average for a final fit. With this approach, the best fit model at each (dx,dy) on the grid can be computed in one step with just linear algebra using the existing |
The Specifically, there are 3 modes to compare (w/o temp corrections), depending on the options passed to
The fast implementation takes ~1.0s per pair of SkyCam exposures, based on initial tests, compared with 8-9s for the original implementation. |
The centroid fit implemented by @HenriCoquinot in PR #13 significantly improves the sky background estimates but requires 8-9s (on perlmutter) to fit each new SkyCam exposure, compared with ~120ms without the centroid fit. The nominal SkyCam cadence is 60s but the GFA cadence is 5s, so processing a new SkyCam exposure disrupts the processing of GFA images. This PR is to re-implement the centroid fit to run in less than 1s while obtaining essentially the same results.