~t-w-/backtestground/packaging

« back to all changes in this revision

Viewing changes to backtestground-0.4-0ubuntu1/lib/backtestground/combine_per_resolution.py

  • Committer: Thorsten Wilms
  • Date: 2011-01-23 17:01:32 UTC
  • Revision ID: t_w_@freenet.de-20110123170132-f9ghojtxruz6pkme
Copy from trunk r163, prepare 0.4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from __future__ import division
24
24
from os import listdir
25
25
from os.path import isdir, isfile
26
 
from sys import stderr, stdout
 
26
from sys import stderr, stdout, exit
27
27
import imghdr
28
28
import Image
29
29
 
57
57
            path = ''.join([path, "/"])
58
58
 
59
59
        # Prepend path to item names
60
 
        candidates = [''.join([path, i]) for i in items]
 
60
        item_paths = [''.join([path, i]) for i in items]
 
61
 
 
62
        # Filter out directories
 
63
        candidates = filter(lambda path: isfile(path), item_paths)
61
64
 
62
65
        # Message to be used if this is later found to contain no image files
63
66
        if_issue = "%s does not contain image files." % (path)
171
174
        # At least one of the sets does not contain any valid image file,
172
175
        # so put out a message and stop.
173
176
        map(stderr.write, issues_n)
 
177
        exit(1)
174
178
    else:
175
179
        # Each set contains at least one image file to work with
176
180
        pairs = to_pairs(path_sets)
200
204
        for i in range(total):
201
205
            per_pair(path, names, pairs[i])
202
206
            # Indicate progress
203
 
            progress_n_of_m(total, i)
 
207
            progress_n_of_m(i, total)
204
208
 
205
209
        stdout.write("Saved results in %s.\n" % path)
 
210
 
 
211
        exit(0)