As per my own experience and Issue #77, I believe that the ability to save an npz file is a significant missing feature to this otherwise great tool! So I went and implemented it! The user can simply specify the --save-stats flag and the stats of the first path will be generated and saved in the location of the second path.
Changes
Add the argument --save-stats to the argument parser
Implement save_fid_stats using calcualte_fid_given_paths as a guide and making use of np.savez_compressed
In __main__, if the --save-stats flag has been specified, run save_fid_stats and exit early. This design makes it clear that the --save-stats flag is the option and the original workflow is still the primary workflow.
Update README.md to document the changes
My editor strips trailing whitespace. I believe that this is best practice so I have kept these changes in this PR.
Test Plan
I have manually tested the new workflow and the original and they behave exactly as expected. By logical inspection of the changes I've made, I believe no errors will have been introduced, however, I failed to run the included test suite due to an error that is present on master - prior to my changes. The error I am receiving is:
TypeError: compute_statistics_of_path() got an unexpected keyword argument 'num_workers'
Please advise how to fix this and I can rerun the test suite.
Code formatting
I have done my best to copy the style in which the existing code is written. I could not find a linter that is in use - if there is one, please make me aware of it.
Summary
As per my own experience and Issue #77, I believe that the ability to save an npz file is a significant missing feature to this otherwise great tool! So I went and implemented it! The user can simply specify the
--save-stats
flag and the stats of the first path will be generated and saved in the location of the second path.Changes
--save-stats
to the argument parsersave_fid_stats
usingcalcualte_fid_given_paths
as a guide and making use ofnp.savez_compressed
__main__
, if the--save-stats
flag has been specified, runsave_fid_stats
and exit early. This design makes it clear that the--save-stats
flag is the option and the original workflow is still the primary workflow.README.md
to document the changesTest Plan
I have manually tested the new workflow and the original and they behave exactly as expected. By logical inspection of the changes I've made, I believe no errors will have been introduced, however, I failed to run the included test suite due to an error that is present on master - prior to my changes. The error I am receiving is:
Please advise how to fix this and I can rerun the test suite.
Code formatting
I have done my best to copy the style in which the existing code is written. I could not find a linter that is in use - if there is one, please make me aware of it.