Add more comments and logging for better readability #44
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
When reading the code, sometimes it's hard to know the data types or the meaning of variables. For example, what's the type of
rectangleMatches
? One would need to first go todepix.py
and found that it was generated fromfindRectangleMatches()
. After that, he or she knew it was of typedict
, but what was the key and values?Another motivation is that, when I tried out this tool the first time, the target image I used was inappropriate. Within that image, each 14x14 block was supposed to be of same color, but due to some lossy compression, each were instead composed of tiny little blocks as shown below:
I got stuck on this screen for over an hour:
Therefore, I think it would be better if the program could detect that there was too many variants on block size, which is what I added in
depix.py
line 47. The additional logging feature in line 109 and line 147 were also for addressing this problem by including more verbosity.Feel free to edit if you think it's too verbose or redundant.