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

Merge sim branch to main #52

Closed
wants to merge 37 commits into from
Closed

Merge sim branch to main #52

wants to merge 37 commits into from

Conversation

cpanuski
Copy link
Collaborator

Basic features implemented. Open to delaying merge to add in any other features you'd like to see.

@cpanuski cpanuski linked an issue Aug 21, 2023 that may be closed by this pull request
5 tasks
@cpanuski cpanuski mentioned this pull request Aug 21, 2023
5 tasks
img = img.get()
img = self.exposure * img

if plot:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plotting should probably either be removed or added to the superclass.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to a staticmethod under superclass. @ichristen Request your re-review.

slmsuite/hardware/slms/simulated.py Outdated Show resolved Hide resolved
self.write(None)

def _write_hw(self, phase):
"""Updates SLM.display to implement various physical artifacts of SLMs."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be interesting to add SLM blur. Should this be here or in the simulated camera?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Physical effects can be added as needed.

slmsuite/holography/toolbox/phase.py Outdated Show resolved Hide resolved
img = toolbox.unpad(img,self.shape)
if mp != np:
img = img.get()
img = self.exposure * img
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some slight formatting and variable name modifications to this file. My major comment is that this is probably a good opportunity to add in readout noise and dark current.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now added in 99b7c5b.

Defaults to 0 (i.e., aligned with the SLM).
offset : tuple
Lateral displacement (in `basis` units) of the camera center from `slm`'s
optical axis. If ``None``, defaults to 0 offset.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth considering making a helper function for constructing affine transformations with offset, rotation, and scale. I think simulated would be simpler and more general if it used an affine transformation, but user-friendliness can still be maintained with a helper function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ichristen Are you suggesting to feed in the same (M,b) from "kxy"->"ij" transformations, apply the inverse, and then do the interpolation in "kxy" space? Or to apply a forward affine transformation to map "ij" -> "xy"?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, probably the same {"M", "b"}, if that's the option that is most uniform with the rest of the package.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this more, the f_eff scale term is a bit of a pain for the user to deal with in the way I was thinking. I think your implementation is the right approach, with just handling everything inside.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Needs hardware testing and a digital twin method now

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completed; see simulation tutorial for sample uses.

slmsuite/hardware/slms/simulated.py Outdated Show resolved Hide resolved
This was referenced Aug 22, 2023
ichristen and others added 3 commits September 3, 2023 17:32
Now hardware tested.

Co-Authored-By: Chris Panuski <12805891+cpanuski@users.noreply.github.com>
Simplifies source setting, plotting, and tracking.

Need to debug documentation (probably added a few issues) and get autoformatters on same page.
@ichristen
Copy link
Collaborator

Also, is there a reason to use Hologram inside the simulated camera instead of computing the FFT directly? Using Hologram will result in some unnecessary overhead. Is the intent to use future plans for different propagation kernels?

@cpanuski
Copy link
Collaborator Author

Also, is there a reason to use Hologram inside the simulated camera instead of computing the FFT directly? Using Hologram will result in some unnecessary overhead. Is the intent to use future plans for different propagation kernels?

Almost all overhead is in the initialization; the Hologram wrapper cleans up the FFTs and allows expansion towards different kernels.

ichristen and others added 2 commits November 12, 2023 21:45
+ associated debugging of sim mode.

Need to check if I broke "fwd" mode of transform_grid

Co-Authored-By: Chris Panuski <12805891+cpanuski@users.noreply.github.com>
@cpanuski
Copy link
Collaborator Author

Hardware-integration (i.e. cloning from hardware to simulation) completed and all initial review comments addressed. @ichristen request review to merge PR.

@ichristen
Copy link
Collaborator

Closing in favor of #69.

@ichristen ichristen closed this May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CameraSLM simulation
2 participants