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

Fix incorrect framerate when loading bidirectional SBX files #1452

Merged
merged 4 commits into from
Jan 18, 2025

Conversation

ethanbb
Copy link
Contributor

@ethanbb ethanbb commented Jan 18, 2025

Description

I realized that the frame rate when loading a bidirectional SBX file was half of what it should be. This is because in sbx_meta_data, I assumed that info['recordsPerBuffer'] would be half for bidirectional files, so dividing by it when computing the frame rate would give 2X the rate for these files, as it should be. But I must have forgotten I was doing this, because in sbx_shape (which is called first) I modify info[recordsPerBuffer] to match the X size. This is unnecessary since I already have the X size in info['sz'][0].

Along the way, I also made a few miscellaneous changes to eliminate type errors according to pyright (some important for documentation, such as the requirement that subindices be sequences, not just iterables).

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Has your PR been tested?

Yes, I added a test to test_sbx.py that loads a new bidirectional test movie and ensures the sample rate is correct. I also added checks for the sample rates of the other test movies.

@ethanbb
Copy link
Contributor Author

ethanbb commented Jan 18, 2025

My bad, I added a return value check that was in my branch thinking it was just for safety, but I didn't realize that the return value was expected to be None unless I passed a specific option (returnoffset for tifffile.imwrite). Will undo that.

@pgunn pgunn merged commit 86ed5ab into flatironinstitute:dev Jan 18, 2025
3 checks passed
@ethanbb ethanbb deleted the sbx-framerate-fix branch January 19, 2025 07:22
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