Skip to content

Commit

Permalink
Base class for optical elements
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiLehe committed Oct 20, 2023
1 parent 21c7be1 commit dfb1b4a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
Empty file.
38 changes: 38 additions & 0 deletions lasy/optical_elements/optical_element.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

class OpticalElement(object):
"""
Base class to model thin optical elements.
Any optical element should inherit from this class, and define its own
`amplitude_multiplier` method, using the same signature as the method below.
"""

def __init__(self):
pass

def amplitude_multiplier(self, x, y, omega):
"""
Return the complex number :math:`T` with which to multiply the
complex amplitude of the laser just before this thin element,
in order to obtain the complex amplitude output laser just
after this thin element:
.. math::
\tilde{\mathcal{E}}_{out}(x, y, \omega) = T(x, y, \omega)\tilde{\mathcal{E}}_{in}(x, y, \omega)
Parameters
----------
x, y, omega: ndarrays of floats
Define points on which to evaluate the multiplier.
These arrays need to all have the same shape.
Returns
-------
multiplier: ndarray of complex numbers
Contains the value of the multiplier at the specified points
This array has the same shape as the arrays x, y, omega
"""
# The base class only defines dummy multiplier
# (This should be replaced by any class that inherits from this one.)
return np.zeros_like(x, dtype="complex128")

0 comments on commit dfb1b4a

Please sign in to comment.