Skip to content

fix buffer_npix method in gs#128

Merged
sneakers-the-rat merged 19 commits into
MSUSfrom
MSUS_fixbuffernpix
Aug 2, 2025
Merged

fix buffer_npix method in gs#128
sneakers-the-rat merged 19 commits into
MSUSfrom
MSUS_fixbuffernpix

Conversation

@sneakers-the-rat
Copy link
Copy Markdown
Collaborator

@sneakers-the-rat sneakers-the-rat commented Aug 2, 2025

man what even am i looking at


📚 Documentation preview 📚: https://miniscope-io--128.org.readthedocs.build/en/128/

hsemwal and others added 16 commits July 28, 2025 12:49
Back to the original problem
Back to the original problem
Tests: npix, buffers
Checking max pixels per buffer
Changed the payload size to ignore the final 12 dummy index values, which are (for some reason) getting into the frame
Comments for test to check for correct frame size.
Fixed size of buffer issue (buffer to array was taking wrong size, because it was taking in 384 bytes, not bits)
looking for read length fix, likely parent/child class not called correctly
comments to merge
start of bugfix to ensure that npix is being properly calculated
Read length should be good, and also adding test for image verification
Copy link
Copy Markdown
Collaborator Author

@sneakers-the-rat sneakers-the-rat left a comment

Choose a reason for hiding this comment

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

cool. so this should both merge the buffer_npix fixes as well as get the base branch partially back to a state it can be worked on. if we clean up as we go then we avoid piling a bunch of broken code on broken code and can actually make progress. if we just keep jamming our shit with a bunch of comments, tweaking things in a nonsystematic way, then that's how we get this project which should have taken a week, tops, taking >8 months.

Comment thread mio/devices/gs/daq.py
Convert a list of 1D pixel arrays into a full frame, stripping the leading "training" pixels
"""
pixels = np.concatenate(frame_data) # concatenates to 1xn
print(len(pixels))
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

no print statements in code. no commented out blocks of code

Comment thread mio/devices/gs/header.py Outdated
print(len(header_array), len(buffer[header_end:]))
# breakpoint()
payload = buffer_to_array(
buffer[header_end:-48]
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this is not very robust and should be calculated based on the number of dummy words

Comment thread tests/test_gs/test_daq.py
print(f"First few values of buffer 0: {full_buffers[0][:5]}")
print(f"First few values of partial buffer: {partial_buffer[:5]}")

from mio.devices.gs.config import GSDevConfig
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

put imports at the top. you only ever need to import something once per module. this is super cluttery

Comment on lines +57 to +73
def test_buffer_npix(gs_raw_buffers):
format = GSBufferHeaderFormat.from_id("gs-buffer-header")
config = GSDevConfig.from_id("MSUS")
frame_buffers = defaultdict(list)

for i, buffer in enumerate(gs_raw_buffers):
header, pixels = GSBufferHeader.from_buffer(buffer, header_fmt=format, config=config)
frame_buffers[header.frame_num].append(pixels)

# discard first and last which may be incomplete in the sample
frames = list(frame_buffers.keys())
del frame_buffers[frames[0]]
del frame_buffers[frames[-1]]

for frame_num, pixels in frame_buffers.items():
pixel_lengths = [len(p) for p in pixels]
assert pixel_lengths == config.buffer_npix
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this is the only thing that this PR is about really, the rest is just getting the code to run again

@sneakers-the-rat sneakers-the-rat merged commit 6250292 into MSUS Aug 2, 2025
22 checks passed
@sneakers-the-rat sneakers-the-rat deleted the MSUS_fixbuffernpix branch August 2, 2025 04:37
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