Skip to content

Commit

Permalink
add docstring to objective
Browse files Browse the repository at this point in the history
  • Loading branch information
rjmoerland committed Nov 4, 2024
1 parent 3e36aa1 commit 07eb6f3
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions src/lumicks/pyoptics/objective.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,32 @@ class BackFocalPlaneCoordinates:

class Objective:
"""
Class to describe the essential properties of an objective
Class to describe the essential properties of an objective.
"""

def __init__(self, NA: float, focal_length: float, n_bfp: float, n_medium: float):
"""Initialize the Objective class.
Parameters
----------
NA : float
Numerical aperture (NA) of the objective. Has to be strictly positive and less than the
refractive index of the medium `n_medium`.
focal_length : float
Focal length of the objective in meters. Has to be strictly positive.
n_bfp : float
Refractive index of the medium present at the back-focal plane (BFP) of the objective.
Has to be strictly positive.
n_medium : float
Refractive index of the immersion medium of the objective. Has to be strictly positive
and larger than the NA.
Raises
------
ValueError
Raised if `NA` > `n_medium`, if `n_medium < 0` or `n_bp < 0`, if `focal_length < 0` or
if `NA < 0`.
"""
if NA > n_medium:
raise ValueError("The NA of the objective cannot be larger than n_medium")

Expand All @@ -37,10 +59,10 @@ def __init__(self, NA: float, focal_length: float, n_bfp: float, n_medium: float
)

if focal_length <= 0:
raise ValueError("focal_length needs to be positive")
raise ValueError("focal_length needs to be strictly positive")

if NA <= 0:
raise ValueError("NA needs to be positive")
raise ValueError("NA needs to be strictly positive")

self.NA = NA
self.focal_length = focal_length
Expand Down

0 comments on commit 07eb6f3

Please sign in to comment.