(kind, prec, clevel, synth)
| 97 | |
| 98 | |
| 99 | def process_file(kind, prec, clevel, synth): |
| 100 | |
| 101 | if kind == "numpy": |
| 102 | lib = "none" |
| 103 | else: |
| 104 | lib = kind |
| 105 | if synth: |
| 106 | prefix = "synth/synth-" |
| 107 | else: |
| 108 | prefix = "cellzome/cellzome-" |
| 109 | iname = "%s/%s-%s%d-%s.h5" % (dirname, prefix, kind, clevel, prec) |
| 110 | f = tb.open_file(iname, "r") |
| 111 | a_ = f.root.maxarea |
| 112 | b_ = f.root.mascotscore |
| 113 | |
| 114 | oname = "%s/%s-%s%d-%s-r.h5" % (dirname, prefix, kind, clevel, prec) |
| 115 | f2 = tb.open_file(oname, "w") |
| 116 | if lib == "none": |
| 117 | filters = None |
| 118 | else: |
| 119 | filters = tb.Filters(complib=lib, complevel=clevel, shuffle=shuffle) |
| 120 | if prec == "single": |
| 121 | type_ = tb.Float32Atom() |
| 122 | else: |
| 123 | type_ = tb.Float64Atom() |
| 124 | r = f2.create_carray("/", "r", type_, a_.shape, filters=filters) |
| 125 | |
| 126 | if kind == "numpy": |
| 127 | a2, b2 = a_[:], b_[:] |
| 128 | t0 = clock() |
| 129 | r = eval(expression, {"a": a2, "b": b2}) |
| 130 | print(f"{clock() - t0:5.2f}") |
| 131 | else: |
| 132 | expr = tb.Expr(expression, {"a": a_, "b": b_}) |
| 133 | expr.set_output(r) |
| 134 | expr.eval() |
| 135 | f.close() |
| 136 | f2.close() |
| 137 | size = Path(iname).stat().st_size + Path(oname).stat().st_size |
| 138 | return size |
| 139 | |
| 140 | |
| 141 | if __name__ == "__main__": |
no test coverage detected