-
Notifications
You must be signed in to change notification settings - Fork 0
BUGFIXES: handling filenames, reading float values, and event annotation #6
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
Conversation
hi @drammock |
I can review tomorrow (Thursday). No objection to bumping version after that |
thanks! no pressure :) |
curryreader.py
Outdated
elif text.replace('.','',1).isnumeric() : # BUG (float not recognized) FIXED | ||
a[i] = float(text) # assign if it was a number |
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.
Since there's nothing else after this elif
block, I think it's a bit cleaner to do the try-except method (even if it's a tad slower). This isn't a performance bottleneck (the loop only runs 16 times). Also the .replace(...).isnumeric()
method won't handle negative numbers (probably that won't matter given the names of the fields above, they all appear to be strictly positive quantities, but better safe than sorry?)
elif text.replace('.','',1).isnumeric() : # BUG (float not recognized) FIXED | |
a[i] = float(text) # assign if it was a number | |
try: | |
a[i] = float(text) | |
except ValueError: | |
pass |
curryreader.py
Outdated
|
||
if fFrequency == 0 or fSampleTime != 0: | ||
if fFrequency == 0. or fSampleTime != 0.: # BUG (order) FIXED |
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.
Just so I'm clear, the bug here was adjusting fFrequency
after it was entered into the datainfo
dict, right? If so, let's avoid changes to this line, as there wasn't anything broken about it before, and we should try to minimize the diff with upstream so it's easier to pull in any upstream changes down the road.
if fFrequency == 0. or fSampleTime != 0.: # BUG (order) FIXED | |
if fFrequency == 0 or fSampleTime != 0: |
curryreader.py
Outdated
@@ -426,7 +426,7 @@ def read(inputfilename='', plotdata = 1, verbosity = 2): | |||
tixstop = contents.find('REMARK_LIST END_LIST') | |||
|
|||
if tixstart != -1 and tixstop != 1 : | |||
annotations = contents[tixstart:tixstop - 1].splitlines() | |||
annotations = contents[tixstart+1:tixstop].splitlines() # BUG (does not read correct lines) FIXED |
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.
[nitpick] I'm unsure if the comment will still be helpful in 6 months. On the assumption that we only make changes to the reader if there was a demonstrable bug (i.e., no new features), the diff will tell us where the bugfixes were, and "does not read correct lines" seems (to me at least) inferrable from the change of indices in the slice. Feel free to disregard though, if you disagree.
annotations = contents[tixstart+1:tixstop].splitlines() # BUG (does not read correct lines) FIXED | |
annotations = contents[tixstart+1:tixstop].splitlines() |
thanks for the suggestions @drammock - all make sense, all accepted |
I've updated the PR's description to describe the 4 bugs addressed here. That should hopefully make it easier in future if we need to revisit / rebase / whatever. Thanks @dominikwelke |
fixed some bugs in the reader:
.
characters in file pathsfFrequency=0
case before addingfFrequency
todatainfo
dict