Giter Club home page Giter Club logo

Comments (8)

ehpor avatar ehpor commented on August 11, 2024

I did a quick look through git history. It seems that this function got accidentally removed three years ago during a refactor. I'll work on this today, and fix some other issues with that part of the code base (it looks very outdated).

from hcipy.

syhaffert avatar syhaffert commented on August 11, 2024

That part of the code base was developed early on when we wanted to do photometry with a single-mode fiber. This part of the code is almost never used. I actually think we might want to rethink the fiber detectors. I think they are a bit awkward to work with and they do not represent actual optical systems. It is probably better to replace them with an simplified single mode fiber optic and a normal detector class.

from hcipy.

syhaffert avatar syhaffert commented on August 11, 2024

Btw @sylacour if you need to make a gaussian mode you can use newer code. We have implemented square and circular Gaussian mode basis (Guassian Hermite and Gaussian Laguerre) https://docs.hcipy.org/dev/api/hcipy.mode_basis.gaussian_hermite.html#hcipy.mode_basis.gaussian_hermite . The typical Gaussian mode is the fundamental mode for both basis sets. E.g. you could create it by using:

gaussian = hcipy.mode_basis.gaussian_hermite(0, 0, mode_field_diameter=mfd, grid=evaluation_grid)

from hcipy.

sylacour avatar sylacour commented on August 11, 2024

from hcipy.

syhaffert avatar syhaffert commented on August 11, 2024

So you want access to the complex mode coefficient of the Gaussian mode?

from hcipy.

ehpor avatar ehpor commented on August 11, 2024

@syhaffert

It is probably better to replace them with an simplified single mode fiber optic and a normal detector class.

I'm underway with exactly this. A pull request will appear soon (= today). The single mode fiber will be an optical element, with the outgoing wavefront just a complex amplitude.

from hcipy.

sylacour avatar sylacour commented on August 11, 2024

from hcipy.

ehpor avatar ehpor commented on August 11, 2024

As soon as #192 gets approved, you should be able to do something like:

from hcipy import *
import numpy as np
import matplotlib.pyplot as plt

mode_field_diameter = 1.5  # mode field diameter of the fiber in units of your focal grid
fiber_position = [5, 0]  # position of the fiber in units of your focal grid

fiber_mode = make_gaussian_fiber_mode(mode_field_diameter)

pupil_grid = make_pupil_grid(512)
focal_grid = make_focal_grid(16, mode_field_diameter * 2).shifted(fiber_position)
prop = FraunhoferPropagator(pupil_grid, focal_grid)

aperture = make_circular_aperture(1)(pupil_grid)
wf = Wavefront(aperture)
wf.total_power = 1

smf = SingleModeFiberInjection(focal_grid, fiber_mode, fiber_position)

img = prop(wf)  # focal-plane wavefront
fiber_output = smf(img)
complex_amplitude = fiber_output.electric_field[0]
coupling_percentage = fiber_output.total_power * 100

plt.suptitle(f'{complex_amplitude=:.2g}; {coupling_percentage=:.2g}%')
plt.subplot(1,2,1)
plt.title('Input electric field')
imshow_field(img.electric_field)
plt.subplot(1,2,2)
plt.title('Fiber mode')
imshow_field(smf.mode)
plt.show()

Output:
image

from hcipy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.