You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am in the process of fixing up any easy yet impactful issues with the Instamatic TEM emulator. When fixing today's issue (instamatic-dev/instamatic-TEM-emulator#3), I noticed that get_movie is not handled correctly when using shared memory. This PR fixes fixes the following two actions that caused an unpacking error when using shared memory:
calling get_movie at any point - tried to receive a generator from shared memory;
calling __next__ on an exhausted get_movie generator - returned None which _eval_dct was then attempting to unpack in order to pull the next, non-existent, image from shared memory.
Added a third one-line change to this branch. While I found it completely independently, it also fixes a bug with shared memory, where instead of returning the raw data, get_data_from_shared_memory returned a reference to the shared memory buffer instead, leading to unintended behavior. Therefore, I decided to add it here.
The exact nature of the bug comes from the thin lining between object and reference in Python. Displayed frame ALWAYS shown the most recently received image, even if display of a temporary_image is requested. This happens because the image provided to temporary function is a reference to the shared memory buffer rather than a raw independent image, so whenever the buffer is updated, the temporary (image) will be as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I am in the process of fixing up any easy yet impactful issues with the Instamatic TEM emulator. When fixing today's issue (instamatic-dev/instamatic-TEM-emulator#3), I noticed that
get_movieis not handled correctly when using shared memory. This PR fixes fixes the following two actions that caused an unpacking error when using shared memory:get_movieat any point - tried to receive a generator from shared memory;__next__on an exhaustedget_moviegenerator - returned None which_eval_dctwas then attempting to unpack in order to pull the next, non-existent, image from shared memory.With this fix and instamatic-dev/instamatic-TEM-emulator#3 in place, Instamatic can run really cute cRED experiments on the Instamatic TEM emulator:
