Skip to content

Commit

Permalink
fix rename to integration_order
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Moerland committed Dec 29, 2024
1 parent b3c534b commit 3b37a3d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 18 deletions.
4 changes: 2 additions & 2 deletions examples/dipole_forces.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def dipole_force(alpha, z_pos, dim, numpoints):
small_bead,
bfp_sampling_n=bfp_sampling_n,
num_orders=None,
integration_orders=None,
integration_order=None,
)

Fz_mie = force_function(bead_center=[(0, 0, zz) for zz in z])[:, 2]
Expand Down Expand Up @@ -405,7 +405,7 @@ def dipole_force(alpha, z_pos, dim, numpoints):
medium_bead,
bfp_sampling_n=bfp_sampling_n,
num_orders=None,
integration_orders=None,
integration_order=None,
)
Fz_mie = force_function(bead_center=[(0, 0, zz) for zz in z])[:, 2]

Expand Down
6 changes: 3 additions & 3 deletions examples/trapping_forces.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def gaussian_beam(_, x_bfp, y_bfp, *args):
# %% [markdown]
# ## Convergence
# ### To check accuracy:
# 1. Increase the number of integration orders `integration_orders` and check the difference between the old and newly calculated forces
# 1. Increase the order of the integration `integration_order` and check the difference between the old and newly calculated forces
# 1. Increase the number of samples at the back focal plane `bfp_sampling_n` and check the difference between the old and newly calculated forces
# 1. Increase the number of Mie scattering orders and check the difference between the old and newly calculated forces

Expand All @@ -173,7 +173,7 @@ def gaussian_beam(_, x_bfp, y_bfp, *args):
bfp_sampling_n=bfp_sampling_n,
bead_center=[(0, 0, zz) for zz in z],
num_orders=None,
integration_orders=None,
integration_order=None,
)[:, 2]
Fz2 = trp.forces_focus(
gaussian_beam,
Expand All @@ -182,7 +182,7 @@ def gaussian_beam(_, x_bfp, y_bfp, *args):
bfp_sampling_n=bfp_sampling_n * 2,
bead_center=[(0, 0, zz) for zz in z],
num_orders=None,
integration_orders=None,
integration_order=None,
)[:, 2]

# %%
Expand Down
11 changes: 4 additions & 7 deletions src/lumicks/pyoptics/trapping/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ def force_factory(
# Find nearest integration order that is equal or greater than the user's
integration_order = get_nearest_order(integration_order)
else:
integration_order = determine_integration_order(integration_order, method, n_orders)
integration_order = determine_integration_order(method, n_orders)
x, y, z, w = get_integration_locations(integration_order, method)
xb, yb, zb = [c * bead.bead_diameter * 0.51 for c in (x, y, z)]

Expand Down Expand Up @@ -720,11 +720,8 @@ def absorbed_power_focus(
# Find nearest integration order that is equal or greater than the user's
integration_order = get_nearest_order(integration_order)
else:
integration_order = determine_integration_order(integration_order, method, n_orders)

# Enforce floats to ensure Numba has all floats when doing @ / np.matmul
x, y, z, w = [np.asarray(coord).astype(np.float64) for coord in (x, y, z, w)]

integration_order = determine_integration_order(method, n_orders)
x, y, z, w = get_integration_locations(integration_order, method)
xb, yb, zb = [
ax * bead.bead_diameter * 0.51 + bead_center[idx] for idx, ax in enumerate((x, y, z))
]
Expand Down Expand Up @@ -824,7 +821,7 @@ def scattered_power_focus(
# Find nearest integration order that is equal or greater than the user's
integration_order = get_nearest_order(integration_order)
else:
integration_order = determine_integration_order(integration_order, method, n_orders)
integration_order = determine_integration_order(method, n_orders)

x, y, z, w = get_integration_locations(integration_order, method)

Expand Down
4 changes: 2 additions & 2 deletions tests/trapping/test_force_focus_dipole.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def test_force_focus(z_pos):
bead=bead,
bfp_sampling_n=bfp_sampling_n,
num_orders=None,
integration_orders=None,
integration_order=None,
)
for p in range(numpoints):
for m in range(numpoints):
Expand All @@ -149,7 +149,7 @@ def test_force_focus(z_pos):
bead_center=bead_positions,
bfp_sampling_n=bfp_sampling_n,
num_orders=None,
integration_orders=None,
integration_order=None,
)
Fx_mie, Fy_mie, Fz_mie = [F[:, idx].reshape(numpoints, numpoints) for idx in range(3)]
[
Expand Down
4 changes: 0 additions & 4 deletions tests/trapping/test_scattering_absorption.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def input_field_Ephi(_, x_bfp, *args):
bead=bead,
bead_center=(0, 0, 0),
bfp_sampling_n=bfp_sampling_n,
verbose=False,
num_orders=num_orders,
)

Expand All @@ -107,7 +106,6 @@ def input_field_Ephi(_, x_bfp, *args):
bead=bead,
bead_center=(0, 0, 0),
bfp_sampling_n=bfp_sampling_n,
verbose=False,
num_orders=num_orders,
)

Expand All @@ -122,7 +120,6 @@ def input_field_Ephi(_, x_bfp, *args):
bead=bead,
bead_center=(0, 0, 0),
bfp_sampling_n=bfp_sampling_n,
verbose=False,
num_orders=num_orders,
)

Expand All @@ -132,7 +129,6 @@ def input_field_Ephi(_, x_bfp, *args):
bead=bead,
bead_center=(0, 0, 0),
bfp_sampling_n=bfp_sampling_n,
verbose=False,
num_orders=num_orders,
)

Expand Down

0 comments on commit 3b37a3d

Please sign in to comment.