Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Holoeye #26

Open
ichristen opened this issue Jan 31, 2023 · 14 comments
Open

Holoeye #26

ichristen opened this issue Jan 31, 2023 · 14 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@ichristen
Copy link
Collaborator

Add a Holoeye interface for their SDK. Interestingly, this appears to have GPU functionality; it might be interesting to try to connect this with CUDA/cupy.

@ichristen ichristen added enhancement New feature or request good first issue Good for newcomers labels Jan 31, 2023
@Shuyun1247
Copy link

Do you mean there's also a function for Holoeye SLM's? I haven't seen it in the hardware folder.

@ichristen
Copy link
Collaborator Author

Hi @Shuyun1247 ,

This is an issue on our roadmap. Holoeye support is not currently added to the package, but we welcome contributions to add it! This amounts to using our template to wrap Holoeye functions. You can modify this on a personal branch and then pull request to add it to the main repo.

Unfortunately, we don't physically have a Holoeye SLM, so it's difficult for us to add and bugtest a wrapper. It would be ideal if some other group with Holoeye hardware could add this. Alternatively, if you have working code for Holoeye, we can adapt this code to work in slmsuite. However, we would need a group to test this on hardware to make sure things are working before adding it to the main repo.

Best,
Ian

@Shuyun1247
Copy link

Shuyun1247 commented Mar 7, 2024

Hi ichristen,

Will you consider adding a hamamatsu slm? Our lab is using this and I think they also have python SDK. If so, I can provide the working codes and sdk for you and we can the test the codes very soon.

Best,
Shuyun

@ichristen
Copy link
Collaborator Author

Hi @Shuyun1247 ,

I'm unaware of a python SDK for Hamamatsu SLMs. I cannot find a reference to this on their website. Could you point me to this?

We have a Hamamatsu SLM and use the ScreenMirrrored SLM interface to project data onto it's virtual screen. You should be able to use this (although there might still be a versioning issue (#7 ). We also use this interface for Thorlabs SLMs.

  • I think in the next release we should explicitly state in the docs which SLMs are supported under ScreenMirrored (Hamamatsu, Thorlabs, ...)

Best,
Ian

@Shuyun1247
Copy link

Shuyun1247 commented Mar 8, 2024 via email

@ichristen
Copy link
Collaborator Author

ichristen commented Mar 8, 2024

Hi Shuyun,

Thank you for sharing this code. Was the .dll provided by Hamamatsu or was it written by a colleague?

To me, it looks like the .dll (and python interface) serves to only display an image on the virtual display and does not provide other functionality (apart from a bit of analytic pattern generation). This operation is similar to ScreenMirrored.

In contrast, the Santec or Meadowlark interfaces use SDKs provided by the respective companies with more functionality than displaying. Specifically:

  • Setting 'wavelength tables' or 'LUT' which customize the voltage outputs corresponding to each discrete integer setpoint.
  • Diagnostics such as temperatures or voltages of various components.
  • Information about the SLM .info().

If Hamamatsu provides similar functionality beyond displaying, then it is worthwhile to make a new interface beyond ScreenMirrored. However, I don't think their hardware is compatible with this. Whatever the case, next release we should make it more clear that Thorlabs and Hamamatsu SLMs should use ScreenMirrored.

Best,
Ian

@Shuyun1247
Copy link

Shuyun1247 commented Mar 12, 2024 via email

@ichristen
Copy link
Collaborator Author

ichristen commented Mar 12, 2024

Hi @Shuyun1247 ,

ScreenMirrored Issues

I just tested ScreenMirrored on a Windows 11 computer with pyglet==1.5.27. It works fine. We've also been using ScreenMirrored on various Windows computer (7, 10, 11). I'm very interested in why this isn't working on your system (we, of course, want every interface to be easy to immediately use), so here's a list of things to check:

  • Do you detect the proper monitors with the .info() command? (see below image)
  • Are you loading the proper monitor in the constructor? (1 in the case of the below image)
Screen Shot 2024-03-12 at 4 12 18 PM
  • Once the monitor is loaded (with "success" noted in the console), do you see a blank application icon pop up in the bar? If you hover over the icon, you should see the qp-slm logo and an image of whatever is currently written to the SLM. (see below image)
  • You can also use a remote screen viewer such as VNC (the program that I'm using) to see the current contents of all the screens. I think you can also use Snipping Tool or PrintScreen into Paint to see the status of the virtual screen. In this case, the 0 screen is our main screen and the 1 screen is the SLM's virtual screen. (see below image)
Screen Shot 2024-03-12 at 4 14 41 PM
  • If you're seeing a pyglet window like the above image, but things are still not being displayed to the SLM, it might be a hardware issue. In that case, you should check to make sure that your .dll code is causing the SLM to display as desired.
  • If the .dll code is working, but pyglet is displaying properly in Windows but not working on the SLM, then something very odd is going on. In that case, or in any other case where you still are not able to resolve things, could you send more detailed information about your system (hardware, OS, python environment) so we can try to replicate this odd behavior.

load_vendor_phase_correction () Questions

We don't currently have load_vendor_phase_correction () in ScreenMirrored because vendors use a variety of formats (some non-intuitive) to encode their correction data. I suppose it might be worthwhile to add a generic bitmap/csv loader to cover most of the common formats, but there are sometimes are subtleties. In the meantime, if you load the correction into python as a numpy array, you can set slm.phase_correction = correction to manually load it in.

Best,
Ian

@ichristen
Copy link
Collaborator Author

Oh, and setting dx_um, dy_um is very important for all the calibrations to work properly. I think these should actually be required arguments for ScreenMirrored in v0.0.2.

@Shuyun1247
Copy link

Hi @ichristen ,

Thank you for your detailed instructions. I've followed your troubleshooting steps and believe I've narrowed down the problem to the scenario where the pyglet window is visible but nothing is displayed on the SLM, suggesting a potential hardware issue.

I've attached a screenshot showing the pyglet window with the message "SLM(未响应)," which translates to "SLM (no response)"(which is shown in 1.png). After using your method to inspect the SLM's screen output, it appears blank(2.png). Additionally, I encountered an error soon stating that "python could not be stored. (3.png)"

Our system operates on Windows 10, and we're using Python version 3.9.13. Regarding the .dll code for our hardware, my experience is primarily with Santec’s SLM, where the process involved dragging the .dll file into the program's folder. However, we are currently using a Hamamatsu SLM, and I just ran the codes for screenmirrored (which is the same in your provided image).

Could you offer any further guidance on addressing this issue, particularly with regards to the .dll code for Hamamatsu SLMs? Any additional assistance would be greatly appreciated.

Best,
Shuyun

1
2
3

@Shuyun1247
Copy link

Hi @ichristen,
I've made a breakthrough in troubleshooting our issue. It appears the root cause was a pyglet error stating, "Cannot change thread mode after it is set." By downgrading the pyglet package to version 1.4.10, I've successfully resolved the problem, and the SLM is now functioning correctly!
Thank you once again for your guidance and support throughout this process.
Best,
Shuyun

@ichristen
Copy link
Collaborator Author

Hi @Shuyun1247

Awesome! Great to hear that you got it working. I'm also adding a note about this issue in #7 . At some point, we'll update the interface to pyglet 2, but this has been lower priority.

One more thing: it looks like you're loading .0125 into dx_um and dy_um. Do you perhaps mean 12.5? These numbers are in microns and 12.5 nm is very small.

Best,
Ian

@Shuyun1247
Copy link

Shuyun1247 commented Mar 13, 2024 via email

@ichristen ichristen mentioned this issue Jul 4, 2024
21 tasks
@ichristen
Copy link
Collaborator Author

Skeleton for the Holoeye SDK implemented in 8df517a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants