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 bug when µMUX data has no number of rows stored in LJH file #300

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

joefowler
Copy link
Member

No description provided.

self.column_number = None
self.subframe_divisions = None
self.subframe_offset = None
self.number_of_rows = 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

This set of changes seems totally uneccesary and actually bad. We found this error because mass crashed when something went wrong, by giving default values instead of None values to all these parameters, we increase the likelyhood mass will do something silently wrong instead of crashing. These changes aren't needed to fix the bug at hand.

if "Abaco" in self.source:
# The external trigger file can override this, but assume 64 divisions at first.
default_divisions = 64
default_offset = 0
self.subframe_divisions = int(header_dict.get(b"Subframe divisions", default_divisions))
self.subframe_offset = int(header_dict.get(b"Subframe offset", default_offset))
if self.subframe_divisions <= 0:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a redundant fix, if the above fix works, this isn't necessary. So future readers will have a hard time understanding why this exists and it will make reading the code harder without adding any value.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The issue title says that the issue happane when no number of rows is stored in the LJH file. But we have a line should make number_of_rows=1 in that case, which should prevent the divide by zero. So I also don't understand from this how the issue ever happens.

default_offset = self.row_number
default_divisions = self.number_of_rows
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this is the only place we should have a fix, and it should have a comment explaining why it works the way it does, and probably print a warning about what is wrong that is making it need the fix. Perhaps "warning: malformed ljh filed with number_of_rows = 0 detected, doing x instead".

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