I hereby claim:
- I am stevenchowell on github.
- I am stevenchowell (https://keybase.io/stevenchowell) on keybase.
- I have a public key ASCBr41CfrpBRhlx4ksx9Uw6FV-OCypKVNU9ohbFm9RQtgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| """Demo performing parallel tasks with a queue for logging progress.""" | |
| import datetime | |
| import multiprocessing as mp | |
| import time | |
| from collections import namedtuple | |
| from xml.dom import minidom | |
| import psutil | |
| from lxml import etree |
| # Adapted from Thadeus Burgess' Python 2 code | |
| # http://thadeusb.com/weblog/2010/10/10/python_scale_hex_color/ | |
| def clamp(val, minimum=0, maximum=255): | |
| if val < minimum: | |
| return minimum | |
| if val > maximum: | |
| return maximum | |
| return val |
| #---------------------------------------------------------------------- | |
| def find_non_zero(row, small=1e-5): | |
| n = len(row) | |
| for i_col in range(n): | |
| if abs(row[i_col]) > small: | |
| return row[i_col] | |
| def normalize(row): |