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

Don't write invalid JSON when no valid burst is found #809

Merged
merged 2 commits into from
Oct 30, 2022

Conversation

atsampson
Copy link
Collaborator

On the SFTP, in adamsampson/Faults/issue809, there's the first few frames of Easy Rider (LD10005) side 2.

Decoding this causes FieldPAL.calc_burstmedian to return NaN. This appears to be because the disc's mastered a bit hot - in the first field, all the lines trip the test for excessive burst amplitude in get_burstlevel.

The NaN eventually gets written to burstMedianIre in the JSON file... but Python's json.dump writes it as NaN, which isn't permitted by the JSON spec.

These two commits pass allow_nan=False to json.dump, and fix the test in calc_burstmedian so it returns 0 when no burst is found. It might be worth looking at the get_burstlevel heuristic to see if there's a better way of handling discs like this, though?

By default, Python will encode NaN as "NaN" in JSON output, but this
isn't permitted by the JSON standard. A NaN being present in the output
indicates that something has gone wrong anyway (and the tools won't know
what to do with it), so it's better to blow up here rather than writing
unparseable output.
@atsampson atsampson added bug ld-decode An issue only affecting the ld-decode[r] becausetechnidisc (or other dodgy mastering issues) labels Oct 30, 2022
@happycube happycube merged commit 93576d9 into happycube:master Oct 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
becausetechnidisc (or other dodgy mastering issues) bug ld-decode An issue only affecting the ld-decode[r]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants