(kind, prec, synth)
| 17 | |
| 18 | |
| 19 | def create_file(kind, prec, synth): |
| 20 | prefix_orig = "cellzome/cellzome-" |
| 21 | iname = dirname + prefix_orig + "none-" + prec + ".h5" |
| 22 | f = tb.open_file(iname, "r") |
| 23 | |
| 24 | if prec == "single": |
| 25 | type_ = tb.Float32Atom() |
| 26 | else: |
| 27 | type_ = tb.Float64Atom() |
| 28 | |
| 29 | if synth: |
| 30 | prefix = "synth/synth-" |
| 31 | else: |
| 32 | prefix = "cellzome/cellzome-" |
| 33 | |
| 34 | for clevel in range(10): |
| 35 | oname = "%s/%s-%s%d-%s.h5" % (dirname, prefix, kind, clevel, prec) |
| 36 | # print "creating...", iname |
| 37 | f2 = tb.open_file(oname, "w") |
| 38 | |
| 39 | if kind in ["none", "numpy"]: |
| 40 | filters = None |
| 41 | else: |
| 42 | filters = tb.Filters( |
| 43 | complib=kind, complevel=clevel, shuffle=shuffle |
| 44 | ) |
| 45 | |
| 46 | for name in ["maxarea", "mascotscore"]: |
| 47 | col = f.get_node("/", name) |
| 48 | r = f2.create_carray("/", name, type_, col.shape, filters=filters) |
| 49 | if synth: |
| 50 | r[:] = np.arange(col.nrows, dtype=type_.dtype) |
| 51 | else: |
| 52 | r[:] = col[:] |
| 53 | f2.close() |
| 54 | if clevel == 0: |
| 55 | size = 1.5 * Path(oname).stat().st_size |
| 56 | f.close() |
| 57 | return size |
| 58 | |
| 59 | |
| 60 | def create_synth(kind, prec): |
no test coverage detected