This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_segments(weights, threshold=80): | |
marker_list = [True if i >= threshold else False for i in weights] | |
i = 0 | |
final_pairs = [] | |
while i < len(weights): | |
if marker_list[i]: | |
start = i | |
while i < len(weights) and marker_list[i]: | |
i = i + 1 | |
end = i - 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# taken from here: http://web.archive.org/web/20110527163743/https://svn.enthought.com/enthought/browser/sandbox/docs/coding_standard.py | |
""" This module is an example of the Enthought Python coding standards. | |
It was adapted from the Python Enhancement Proposal 8 (aka PEP 8) titled | |
'Style Guide for Python Code' (http://www.python.org/peps/pep-0008.html). | |
The first item in a module must be a documentation string (docstring). The | |
first line of the docstring should be a one line summary. If a more | |
detailed description is required, put an empty line before it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
logger = logging.getLogger(__name__) | |
handler = logging.StreamHandler() | |
logging_format = logging.Formatter('%(asctime)s %(name)s %(levelname)s - %(message)s') | |
handler.setFormatter(logging_format) | |
logger.setLevel(logging.DEBUG). # Do not use handler.setLevel(logging.DEBUG) | |
logger.addHandler(handler) |