sigmf / sigmf-python

Easily interact with Signal Metadata Format (SigMF) recordings.
https://sigmf.org
GNU Lesser General Public License v3.0
44 stars 17 forks source link

Fix Key Error #30

Closed kalmanchapman closed 1 year ago

kalmanchapman commented 1 year ago

fixes keyerror to allow graceful warning if annotation does not include optional keys

Teque5 commented 1 year ago

They core:sample_count (LENGTH_INDEX_KEY) and core:sample_start (START_INDEX_KEY) are both required keys for each annotation, so this change doesn't make sense to me.

Maybe this particular section of code that checks for nonsensical information should be it's own function within the validator called at this location. I believe the current reason for these warning is that the sample count returned is bogus if these checks are failed.

kalmanchapman commented 1 year ago

fair enough - I think your argument makes sense, although I also agree that having this requirement throw in this manner at this location in the flow is not ideal. Or at least reach the warning rather than throwing a key error.

I can close this PR