Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Nicer console output while enhancing #70

Open
wants to merge 1 commit into
base: v0.4
Choose a base branch
from

Conversation

vi
Copy link

@vi vi commented Nov 11, 2016

file.png (tile    4 of    9)

instead of just printing dots

@alexjc
Copy link
Owner

alexjc commented Nov 12, 2016

Quick review for this if you're keen to listen:

  • Can you compute the itertools.product only once and put it in a list (DRY principle).
  • You can determine its length using Python's len rather than a counter.
  • Also, in the main loop you can use enumerate rather than another counter.

This should simplify the code and make it more Pythonic. I'd welcome the change afterwards.

@thomasbarwanitz
Copy link

Nice

1 similar comment
@thomasbarwanitz
Copy link

Nice

@scribblemaniac
Copy link

scribblemaniac commented Nov 12, 2016

Based on the changes in this PR, it seems like numtiles would just be equal to math.ceil(original.shape[0] / s) * math.ceil(original.shape[1] / s), which would be faster and cleaner than itertools.product.

@vi vi force-pushed the nicer_console_output branch from 689aacd to 6de7f71 Compare November 12, 2016 23:30
@vi
Copy link
Author

vi commented Nov 12, 2016

  • Rebased against master
  • Implemented mentioned refactorings
  • Printing numer of tiles before (for user to abort earlier if it one specifies wrong too big image) and after (to make image size obvious from the log after enhancing and avoid clumsy "(tile 27 of 28)") processing of each file
  • Nicer output, usage of better working \r instead of hackier \x7f.

@vi
Copy link
Author

vi commented Nov 12, 2016

Can it process tiles in parallel BTW? Currently it looks like using only one core.

@vi
Copy link
Author

vi commented Dec 10, 2016

I'd welcome the change afterwards.

@alexjc, So, is the change welcome now?

file.png (tile 4 of 9)

instead of just printing dots
@vi vi force-pushed the nicer_console_output branch from 6de7f71 to d4b6e6c Compare February 6, 2017 14:44
@vi vi changed the base branch from master to v0.4 February 6, 2017 14:45
@vi
Copy link
Author

vi commented Feb 6, 2017

Rebased against v0.4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants