Skip to content

kernels: use an odd, centred pixel output window - #4

Open
kvtsang wants to merge 1 commit into
DeepLearnPhysics:mainfrom
kvtsang:pr/pixel-odd-window
Open

kvtsang wants to merge 1 commit into
DeepLearnPhysics:mainfrom
kvtsang:pr/pixel-odd-window

Conversation

@kvtsang

@kvtsang kvtsang commented Nov 11, 2026

Copy link
Copy Markdown

load_pixel_response_kernel set the output window to int((Hpy - 1) / bins_per_pix) pixels per axis. For the 45-bin tables at 10 bins per pitch that is 4 pixels, offsets [-2, -1, 0, 1]: the +2 neighbour was never filled, and the response was not mirror-symmetric under a deposit offset u -> -u.

Use 2 * (int((Hpy - 1) / bins_per_pix) // 2) + 1 pixels, offsets [-h..h]. The reach on the negative side is unchanged (2 pitches for 45 bins). The furthest lookup, (h + 1/2) pitch, stays inside the table. Callers already index output pixel i as offset i - py_zero_bin, and compute_box_dims derives the box from kernel_py, so no other code changes.

Cost: 5x5 instead of 4x4 response entries per deposit (1.56x). Hand-set box_bpy/box_bpz values tuned for the 4-wide kernel (for example, profiler outputs) need +1.

Adds tests/test_pixel_kernel_window.py: waveforms at u and -u match under the pixel mirror m -> -m. It fails before this change.

load_pixel_response_kernel set the output window to
int((Hpy - 1) / bins_per_pix) pixels per axis. For the 45-bin tables at
10 bins per pitch that is 4 pixels, offsets [-2, -1, 0, 1]: the +2
neighbour was never filled, and the response was not mirror-symmetric
under a deposit offset u -> -u.

Use 2 * (int((Hpy - 1) / bins_per_pix) // 2) + 1 pixels, offsets
[-h..h]. The reach on the negative side is unchanged (2 pitches for 45
bins). The furthest lookup, (h + 1/2) pitch, stays inside the table.
Callers already index output pixel i as offset i - py_zero_bin, and
compute_box_dims derives the box from kernel_py, so no other code
changes.

Cost: 5x5 instead of 4x4 response entries per deposit (1.56x).
Hand-set box_bpy/box_bpz values tuned for the 4-wide kernel (for
example, profiler outputs) need +1.

Adds tests/test_pixel_kernel_window.py: waveforms at u and -u match
under the pixel mirror m -> -m. It fails before this change.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant