Index: trunk/tools/wsor/editor_lifecycle/comppeak |
— | — | @@ -20,7 +20,10 @@ |
21 | 21 | |
22 | 22 | parser = ArgumentParser(description=__doc__) |
23 | 23 | 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') |
25 | 28 | parser.add_argument('-o', '--output', dest='output_path', metavar='FILE') |
26 | 29 | parser.add_argument('-i', '--iter', type=int, metavar='NUM', |
27 | 30 | dest='bootstrap_iter', default=10000, |
— | — | @@ -46,6 +49,11 @@ |
47 | 50 | |
48 | 51 | # load data and check if fittable |
49 | 52 | 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 | + |
50 | 58 | idx = (n > ns.min_size) * (ye > 0) |
51 | 59 | x = x[idx] |
52 | 60 | y = y[idx] |
Index: trunk/tools/wsor/editor_lifecycle/fitting |
— | — | @@ -33,6 +33,8 @@ |
34 | 34 | parent.add_argument('-batch', action='store_true', help='do not show graphics') |
35 | 35 | parent.add_argument('-force', action='store_true', help='force overwrite') |
36 | 36 | 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') |
37 | 39 | |
38 | 40 | parser = ArgumentParser(description=__doc__) |
39 | 41 | subparsers = parser.add_subparsers(help='Parametric models supported') |
— | — | @@ -123,6 +125,10 @@ |
124 | 126 | * both : A = y[0] and C = y[-1] |
125 | 127 | ''' |
126 | 128 | 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] |
127 | 133 | idx = ye > 0 |
128 | 134 | if minsize: |
129 | 135 | idx = idx * (n > minsize) |