-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Hi @tobias-liaudat,
There seems to be a dimensional analysis issue in the code you originally wrote. Since you're most familiar with the intended physics here, could you take a look?
In the code snippet below, the function takes arctan() of a quantity with units [1/m], which is dimensionally incorrect:
wf-psf/src/wf_psf/utils/preprocessing.py
Lines 39 to 44 in 7c4b515
| return ( | |
| zernike_norm_factor | |
| * (tel_diameter / 2) | |
| * np.sin(np.arctan((dxy / reference_pix_sampling) / tel_focal_length)) | |
| * 3.0 | |
| ) |
Moreover, this function is called incompute_zernike_tip_tilt. There, the arg passed in is the displacement pixel shift multiplied by pixel_sampling=12e-6 m, which will do the conversion from the [pixel] units to [m].
wf-psf/src/wf_psf/utils/centroids.py
Line 87 in 7c4b515
| zk1_2_array = shift_x_y_to_zk1_2_wavediff(displacements_swapped.flatten() * pixel_sampling ) # vectorized call |
But, then this is undone by division by reference_pix_sampling = 12e-6 in shift_x_y_to_zk1_2_wavediff in the arctan function above. Both values are the same, making this conversion roundtrip unnecessary.
Just to add: this pattern also appears in the original code from last year:
current_shifts = centroid_calc.return_shifts() # In [pixel]
dx = reference_shifts[1] - current_shifts[1] # In [pixel]
dy = reference_shifts[0] - current_shifts[0] # In [pixel]
z1_wavediff = shift_x_y_to_zk1_2_wavediff(dx * pixel_sampling) # Input in [m]
z2_wavediff = shift_x_y_to_zk1_2_wavediff(dy * pixel_sampling) # Input in [m]
return (
z1_wavediff,
z2_wavediff,
) # Output in Zernike coefficients in wavediff convention
Could you help clarify the intended physics and suggest how to make this dimensionally consistent? I can think of a couple of approaches, but you're the expert and so I'd value your input. Thanks!
Sub-issues
Metadata
Metadata
Assignees
Labels
Type
Projects
Status