Example #1
0
 def __init__(self, fname):
     self.f = minnow.create(fname)
     self.f.header(struct.pack("<qqq", MAGIC, VERSION, _basic_file_type))
     self.blocks = 0
     self.cols = None
     self.block_sizes = []
     self.cells, self.L, self.boundary = 0, 0, 0
Example #2
0
def create_int_record(fname, text, xs):
    f = minnow.create(fname)

    f.header(struct.pack("<qq", 0xdeadbeef, len(xs)))
    f.header(text)
    for i in range(len(xs)):
        f.fixed_size_group(np.int64, len(xs[i]))
        f.data(xs[i])
    f.header(np.array([len(x) for x in xs], dtype=np.int64))

    f.close()
Example #3
0
def create_q_float_record(fname, limit, dx1, dx2, x1, x2):
    f = minnow.create(fname)

    f.header(
        struct.pack("<ffffqq", dx1, dx2, limit[0], limit[1], len(x1), len(x2)))
    f.float_group(len(x1[0]), limit, dx1)
    for i in range(len(x1)):
        f.data(x1[i])
    f.float_group(len(x2[0]), limit, dx2)
    for i in range(len(x2)):
        f.data(x2[i])

    f.close()
Example #4
0
def write_bit_int_record(fname, x1, x2, x3):
    f = minnow.create(fname)

    f.int_group(len(x1))
    f.data(x1)

    f.header(struct.pack("<q", len(x2)))
    f.int_group(len(x2[0]))
    for i in range(len(x2)):
        f.data(x2[i])

    f.int_group(len(x3))
    f.data(x3)

    f.close()
Example #5
0
def create_group_record(fname, ix, fx, text):
    f = minnow.create(fname)

    ni, nf = len(ix) // 4, len(fx) // 2
    f.header(struct.pack("<qq", 4, ni))
    f.fixed_size_group(np.int32, ni)
    for i in range(4):
        f.data(ix[i * ni:(i + 1) * ni])

    f.header(struct.pack("<qq", 2, nf))
    f.fixed_size_group(np.float64, nf)
    for i in range(2):
        f.data(fx[i * nf:(i + 1) * nf])

    f.header(text)

    f.close()