Skip to content

Conversation

viljarjf
Copy link
Contributor

@viljarjf viljarjf commented Sep 19, 2025

Simulation is now a single file, and requires no dependencies. It is quite performant, I can run for a million crystals with no stuttering on my desktop.
I tried commenting the maths, but it can be hard to follow some places.
Hopefully you can try this out, @Baharis! I find it strange that it did not work for you before. It should also work with real microscopes, but the way communication is established is not pretty..

Of course, if you still want to keep complete seperation of simulation, then this PR can be ignored. It simply collects the existing simulation into one file, with a slight rewrite of some parts for simplicity.

I have not checked how accurate the spot positions are when accounting for camera length calibration ect, nor did I try to change the unit cell much.

@viljarjf viljarjf marked this pull request as ready for review September 19, 2025 15:14
@Baharis
Copy link
Member

Baharis commented Sep 19, 2025

@viljarjf I would love to be convinced that it is fine to leave, but for the time being the simulation just does not work for me, which has an opposite effect. I get no errors no log messages, but neither do I get an image. Neither brightness nor dynamical range affects it. Maybe there are some special steps to set it up?

image

Edit: I played with it a bit and I DID see diffraction for a second or so, but it disappeared and I could never get it back. So it definitely does work, but given that I though it doesn't does means user might think so as well. It does not fill me with much confidence for the time being...

@viljarjf
Copy link
Contributor Author

viljarjf commented Sep 19, 2025

Strange. Perhaps there are no crystals in that area? Could you try changing to very low magnification and see if any show up?

A more user-friendly experience is necessary regardless, i agree

@Baharis
Copy link
Member

Baharis commented Sep 19, 2025

I played with it a bit and found a lot of issues. I started writing a structured response, but after a lot of writing and testing I realized that the behavior of Instamatic was changing for me as I kept writing and testing... I think some of the issues are due to some strange interaction with new implementation in #131. If you want to see what I am talking about, try change your display range to the new simulator default of 255 - oddly enough it does not matter whether Auto contrast is on or off. I must look into this code... This is not to say all problems are there – most of the time I still can't see any crystals/diffraction. May be an issue with zoom or the way simulated stage works. Will look later.

Edit: I cannot get an image consistently enough to test for issues. I spent 15 minutes trying to get image to no avail. With that I unfortunately have to pass debugging for the time being.

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.

2 participants