-
Notifications
You must be signed in to change notification settings - Fork 68
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
Fixed read_seq
for reading v1.3.1 sequence files
#162
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the fix @FrankZijlstra
I reviewed the code and tested it with several old sequences and it seems to work as expected.
However, IMO it should also work without the lines 257-260, no ?! We override this temp value anyway and it shouldn't matter if we overwrite a temporary delay value or just 0, does it?
In general, the types in event_lib are not all correct and the employed update() method doesn't require old data
, which you just consequently set to None
here , but this is something we can discuss during the code refactoring process and not here I guess.
if delay_ind_temp[block_counter] > 0: | ||
block.delay = SimpleNamespace() | ||
block.delay.type = "delay" | ||
block.delay.delay = temp_delay_library.data[ | ||
delay_ind_temp[block_counter] | ||
] | ||
self.block_durations[block_counter] = temp_delay_library.data[ | ||
delay_ind_temp[block_counter] | ||
][0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is needed. In the old format, delay events were explicitly defined in the event table. In the new format, only the block duration is stored in the event table. However, to calculate the duration, we need the maximum of the stored delay and the actual duration of the block events (determined with calc_duration
). get_block
gives us the stored block duration (where you previously got an error), i.e. the delay, which is used by calc_duration
(but the output of calc_duration
might be larger depending on the events).
I do feel the whole handling of the delay event is a bit messy in the new format. We define a delay event with make_delay
, and can use it in calc_duration
. But as soon as we add it to the sequence, the delay event disappears. Instead, get_block
will just give us a block_duration
field, which is a special case in calc_duration
(isinstance(event, (float, int))
). As a consequence, the only reason calc_duration
can determine the duration in this case, is because the duration was already stored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thanks for the nice explanation. Wasn't aware that the delay event is gone after adding it to a block.
When I removed the use of |
lengths
field inevent_lib
. I removed this field in previous PRs because it was completely unused, but missed these uses.read_seq
.Should fix #161