-
Notifications
You must be signed in to change notification settings - Fork 12
Constrained scan update #44
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
base: develop
Are you sure you want to change the base?
Conversation
|
Sorry, I think this needs another rebase. LMK if you need help with it. Also, can you fix the tests? It should be as simple as changing the scan access. We should probably also take a look at the conventional engines before merge, shouldn't be too difficult. |
| # cast = to_real_dtype(sim.object.data.dtype) | ||
| xp = get_array_module(sim.scan.data) | ||
| update = xp.zeros_like(sim.scan.data, dtype=sim.scan.data.dtype) | ||
| for kind, weight in self.constraints.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this deterministic? It seems like it could apply the updates in arbitrary order, we may want to add sorted() if it matters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be deterministic, since the updates are summed and applied after each kind * weight is calculated from the common unconstrained update and previous scan state. Example:
update += scan_affine(sim.scan.data, state.previous) * weight
|
|
||
| cost = xp.sum(xp.abs(sim.object.data - 1.0)) | ||
| cost_scale = xp.array(group.shape[-1] / prod(sim.scan.shape[:-1]), dtype=cost.dtype) | ||
| cost_scale = xp.array(group.shape[-1] / prod(sim.scan.data.shape[:-1]), dtype=cost.dtype) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe unnecessary for this PR, but we could probably make n_pos() a method of sim.scan to avoid this repetition
|
|
||
| ## FIXME: output to Tuple? importance of array number types | ||
|
|
||
| @t.overload |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love this API, not sure what would be better. Maybe output ScanState directly? Or maybe better, keep make_raster_scan clean and include the metadata in the hook only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favor of outputting to ScanState directly.
The grid would need to be re-calculated if not included here, but maybe it would be fine.
77911c3 to
ef9f35e
Compare
breaking with all previous h5 files, since they do not contain scan object
ef9f35e to
3bca912
Compare
This has been rebased on latest probe aberration merge. Still need to update and test conventional solvers
Example: affine-only updates after 800 iterations for an experiment:
