diff --git a/doc/source/examples/fresnel_diffraction_example.rst b/doc/source/examples/fresnel_diffraction_example.rst new file mode 100644 index 0000000..173cf48 --- /dev/null +++ b/doc/source/examples/fresnel_diffraction_example.rst @@ -0,0 +1,19 @@ +Fresnel Diffraction From A BeamStop +=================================== + +We simply invert an aperture to create a beam-stop. Placing this the path of a collimated beam +created interesting Fresnel-diffraction effects, including a bright spot at the centre of the blocked path, +known as the Spot of Arago. + +.. literalinclude:: /../../examples/fresnel_diffraction.py + +The model looks as follows: + +.. image:: ../images/inverted_aperture.png + +However, the seem the detail in the Fresnel diffraction pattern, you need lots of Gausslets. Turn up the +source resolution to at least 40. + +.. image:: ../images/fresnel_diffraction.png + +.. image:: ../images/spot_of_arago.png diff --git a/doc/source/examples/index.rst b/doc/source/examples/index.rst index 40ec82b..fea5cbe 100644 --- a/doc/source/examples/index.rst +++ b/doc/source/examples/index.rst @@ -5,4 +5,5 @@ Examples .. toctree:: - bessel_beam_example \ No newline at end of file + bessel_beam_example + fresnel_diffraction_example \ No newline at end of file diff --git a/doc/source/images/fresnel_diffraction.png b/doc/source/images/fresnel_diffraction.png new file mode 100644 index 0000000..3c22da5 Binary files /dev/null and b/doc/source/images/fresnel_diffraction.png differ diff --git a/doc/source/images/inverted_aperture.png b/doc/source/images/inverted_aperture.png new file mode 100644 index 0000000..e784799 Binary files /dev/null and b/doc/source/images/inverted_aperture.png differ diff --git a/doc/source/images/spot_of_arago.png b/doc/source/images/spot_of_arago.png new file mode 100644 index 0000000..3137033 Binary files /dev/null and b/doc/source/images/spot_of_arago.png differ diff --git a/examples/aperture_demo.py b/examples/aperture_demo.py index 83c0cdb..b9d638a 100644 --- a/examples/aperture_demo.py +++ b/examples/aperture_demo.py @@ -1,10 +1,6 @@ -from raypier.apertures import CircularAperture - -from raypier.tracer import RayTraceModel - -from raypier.sources import ConfocalRayFieldSource +from raypier.api import CircularAperture, ConfocalRayFieldSource, RayTraceModel src = ConfocalRayFieldSource(centre=(0,0,0), diff --git a/examples/fresnel_diffraction.py b/examples/fresnel_diffraction.py new file mode 100644 index 0000000..7b85d5c --- /dev/null +++ b/examples/fresnel_diffraction.py @@ -0,0 +1,56 @@ + +from raypier.tracer import RayTraceModel +from raypier.sources import HexagonalRayFieldSource, ConfocalRayFieldSource +from raypier.lenses import PlanoConvexLens +from raypier.apertures import CircularAperture +from raypier.fields import EFieldPlane +from raypier.constraints import BaseConstraint +from raypier.intensity_image import IntensityImageView +from raypier.intensity_surface import IntensitySurface + +from traits.api import Range, on_trait_change +from traitsui.api import View, Item + + +aperture = CircularAperture(centre=(0,0,10), direction=(0,0,1), + hole_diameter = 0.5, edge_width=0.001, invert=True) + +src = HexagonalRayFieldSource(resolution=10.0, direction=(0,0,1), + radius=2.0, + wavelength=1.0) + +probe = EFieldPlane(source=src, + centre=(0,0,50), + direction=(0,1,0), + exit_pupil_offset=100., + width=2.0, + height=100.0, + size=100) + +img = IntensityImageView(field_probe=probe) +surf = IntensitySurface(field_probe=probe) + + +class FocalPlane(BaseConstraint): + z_pos = Range(50.0,130.0, 57.73) + + traits_view = View(Item("z_pos")) + + def __init__(self, *args, **kwds): + super().__init__(*args, **kwds) + self.on_change_z_pos() + + @on_trait_change("z_pos") + def on_change_z_pos(self): + probe.centre = (0,0,self.z_pos) + + + +model = RayTraceModel(sources=[src], optics=[aperture], + probes=[probe], constraints=[FocalPlane()], + results=[img, surf]) + + + +model.configure_traits() + diff --git a/examples/test_hexagonal_ray_field.py b/examples/test_hexagonal_ray_field.py index cb0cb36..7b85d5c 100644 --- a/examples/test_hexagonal_ray_field.py +++ b/examples/test_hexagonal_ray_field.py @@ -19,8 +19,6 @@ radius=2.0, wavelength=1.0) -src.InputRays - probe = EFieldPlane(source=src, centre=(0,0,50), direction=(0,1,0), diff --git a/raypier/api.py b/raypier/api.py index 3ea904b..c7722ab 100644 --- a/raypier/api.py +++ b/raypier/api.py @@ -21,4 +21,6 @@ from .probes import RayCapturePlace, GaussletCapturePlane +from .apertures import CircularAperture, RectangularAperture + from .intensity_surface import IntensitySurface