Skip to content

Commit

Permalink
define paraxial na to be ref index * slope, in keeping with OSLO and …
Browse files Browse the repository at this point in the history
…the literature. Fixes issue #154
  • Loading branch information
mjhoptics committed Sep 1, 2024
1 parent 5252de3 commit 0561a04
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/rayoptics/parax/etendue.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ def create_etendue_dict():
return dict2D(fld_ape_set, obj_img_set)


def na2slp(na, n=1.0):
def na2slp(na: float, n=1.0) -> float:
""" convert numerical aperture to slope """
return n*math.tan(math.asin(na/n))
return na/n


def slp2na(slp, n=1.0):
def slp2na(slp: float, n=1.0) -> float:
""" convert a ray slope to numerical aperture """
return n*math.sin(math.atan(slp/n))
return n*slp


def ang2slp(ang):
def ang2slp(ang: float) -> float:
""" convert an angle in degrees to a slope """
return math.tan(math.radians(ang))


def slp2ang(slp):
def slp2ang(slp: float) -> float:
""" convert a slope to an angle in degrees """
return math.degrees(math.atan(slp))

Expand Down
8 changes: 4 additions & 4 deletions src/rayoptics/parax/firstorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def compute_first_order(opt_model, stop, wvl, src_model=None):
elif pupil_key == 'f/#':
slp0 = -1./(2.0*pupil.value)
elif pupil_key == 'NA':
slp0 = n_0*math.tan(math.asin(pupil.value/n_0))
slp0 = pupil.value/n_0
elif pupil_oi_key == 'image':
if pupil_key == 'height':
slpk = pupil_value/obj2enp_dist
Expand All @@ -286,7 +286,7 @@ def compute_first_order(opt_model, stop, wvl, src_model=None):
elif pupil_key == 'f/#':
slpk = -1./(2.0*pupil.value)
elif pupil_key == 'NA':
slpk = n_k*math.tan(math.asin(pupil.value/n_k))
slpk = pupil.value/n_k
slp0 = slpk/red
yu = [0., slp0]

Expand Down Expand Up @@ -364,8 +364,8 @@ def compute_first_order(opt_model, stop, wvl, src_model=None):
fod.exp_radius = 1e10

# compute object and image space numerical apertures
fod.obj_na = n_0*math.sin(math.atan(sm.z_dir[0]*ax_ray[0][slp]))
fod.img_na = n_k*math.sin(math.atan(sm.z_dir[-1]*ax_ray[-1][slp]))
fod.obj_na = n_0*sm.z_dir[0]*ax_ray[0][slp]
fod.img_na = n_k*sm.z_dir[-1]*ax_ray[-1][slp]

return ParaxData(ax_ray, pr_ray, fod)

Expand Down
6 changes: 3 additions & 3 deletions src/rayoptics/parax/specsheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def get_parax_start_data(self, thi_0, n_0, n_k):
slpk = -1./(2.0*value)
slp0 = slpk*imager.f
elif value_key == 'NA':
slpk = n_k*math.tan(math.asin(value/n_k))
slpk = value/n_k
slp0 = slpk*imager.f
yu = [0., slp0]

Expand All @@ -342,13 +342,13 @@ def get_parax_start_data(self, thi_0, n_0, n_k):
elif value_key == 'f/#':
slp0 = -1./(2.0*value)
elif value_key == 'NA':
slp0 = n_0*math.tan(math.asin(value/n_0))
slp0 = value/n_0
elif obj_img_key == 'image':
if value_key == 'f/#':
slpk = -1./(2.0*value)
slp0 = slpk*imager.m
elif value_key == 'NA':
slpk = n_k*math.tan(math.asin(value/n_k))
slpk = value/n_k
slp0 = slpk*imager.m
yu = [0., slp0]

Expand Down

0 comments on commit 0561a04

Please sign in to comment.