DiamondLightSource / Opt-ID

Code for the Optimisation of ID's using Python and Opt-AI
Apache License 2.0
7 stars 6 forks source link

Bug in create_genome functionality in process_genome.py does not consider HT (type 5) magnets #56

Closed JossWhittle closed 4 years ago

JossWhittle commented 4 years ago

In process_genome.py the create_genome flag has the functionality of taking in a human readable genome file and creating a machine readable version of the same data. However, it does not consider HT (type 5) magnets.

https://github.com/DiamondLightSource/Opt-ID/blob/5eae8f15642c98cf762d889715f960801f36258e/IDSort/src/process_genome.py#L194-L233

The human readable input file provided for testing in process_genome_test::test_process_create_genome() does contain HT magnets, but the expected output file was originally generated with code that also had this bug and so does not contain HT magnets for comparison.

Fixing the bug paradoxically causes the test to fail because it now correctly includes HT magnets.


In practice during real world usage, the create_genome flag is never used as we never end up with human readable .genome.inp files that we need to convert back into machine readable .genomes during normal operation.

During testing, dedicated files of .genome.inp type are converted to .genome.inp.genome files which erroneously do not contain the HT data. But these files are fundamentally separate from legitimate .genome and .genome.inp files used elsewhere. The bug and erroneous data are therefore isolated to the create_genome flag usage and test case and specifically to process_genome_test::test_process_create_genome().

JossWhittle commented 4 years ago

Commit https://github.com/JossWhittle/Opt-ID/commit/3b588371f3f766bcc087971d5458064a872e07ed on fork fixes the bug and corrects the expected output file used for the test.

https://github.com/JossWhittle/Opt-ID/blob/3b588371f3f766bcc087971d5458064a872e07ed/IDSort/src/process_genome.py#L154-L173

To ensure this new expected output file is correct the following procedure was followed:

The PR that merges this fix from the fork will close the issue.

markbasham commented 4 years ago

@eddrial what are HT magnets again, and are they important? Cheers, Mark

JossWhittle commented 4 years ago

Closed by #57