r95378 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95377‎ | r95378 | r95379 >
Date:06:40, 24 August 2011
Author:giovanni
Status:deferred
Tags:
Comment:
added -c/--chop-tail to fitting and comppeak
Modified paths:
  • /trunk/tools/wsor/editor_lifecycle/comppeak (modified) (history)
  • /trunk/tools/wsor/editor_lifecycle/fitting (modified) (history)

Diff [purge]

Index: trunk/tools/wsor/editor_lifecycle/comppeak
@@ -20,7 +20,10 @@
2121
2222 parser = ArgumentParser(description=__doc__)
2323 parser.add_argument('data_paths', metavar='data', nargs='+')
24 -parser.add_argument('-m', '--min-size', type=int, default=0)
 24+parser.add_argument('-c', '--chop-tail', type=int, default=0, metavar='NUM',
 25+ help='remove %(metavar)s tail observations')
 26+parser.add_argument('-m', '--min-size', type=int, default=0, metavar='SIZE',
 27+ help='filter out observations with size <= %(metavar)s')
2528 parser.add_argument('-o', '--output', dest='output_path', metavar='FILE')
2629 parser.add_argument('-i', '--iter', type=int, metavar='NUM',
2730 dest='bootstrap_iter', default=10000,
@@ -46,6 +49,11 @@
4750
4851 # load data and check if fittable
4952 x, y, ye, n = map(np.atleast_1d, np.loadtxt(path, unpack=1))
 53+ x = x[:-ns.chop_tail]
 54+ y = y[:-ns.chop_tail]
 55+ ye = ye[:-ns.chop_tail]
 56+ n = n[:-ns.chop_tail]
 57+
5058 idx = (n > ns.min_size) * (ye > 0)
5159 x = x[idx]
5260 y = y[idx]
Index: trunk/tools/wsor/editor_lifecycle/fitting
@@ -33,6 +33,8 @@
3434 parent.add_argument('-batch', action='store_true', help='do not show graphics')
3535 parent.add_argument('-force', action='store_true', help='force overwrite')
3636 parent.add_argument('-minsize', type=int)
 37+parent.add_argument('-c', '--chop-tail', type=int, default=0, metavar='NUM',
 38+ help='remove %(metavar)s tail observations')
3739
3840 parser = ArgumentParser(description=__doc__)
3941 subparsers = parser.add_subparsers(help='Parametric models supported')
@@ -123,6 +125,10 @@
124126 * both : A = y[0] and C = y[-1]
125127 '''
126128 x, y, ye, n = np.loadtxt(data_file, unpack=True)
 129+ x = x[:-ns.chop_tail]
 130+ y = y[:-ns.chop_tail]
 131+ ye = ye[:-ns.chop_tail]
 132+ n = n[:-ns.chop_tail]
127133 idx = ye > 0
128134 if minsize:
129135 idx = idx * (n > minsize)

Status & tagging log