import mir.ndslice : iota, sliced, map; auto endianMark = endian == Endian.littleEndian ? "<" : ">"; string descrS, fortranS, shapeS; auto a1 = iota(1).map!(to!int); auto h1 = a1.npyHeader; formattedRead(h1, npyfmt, descrS, fortranS, shapeS); assert(descrS == endianMark ~ "i4"); assert(fortranS == "False"); assert(shapeS == "1,"); auto a23 = iota(2, 3).map!(to!double); auto h23 = a23.npyHeader; formattedRead(h23, npyfmt, descrS, fortranS, shapeS); assert(descrS == endianMark ~ "f8"); assert(fortranS == "False"); assert(shapeS == "2, 3");
create numpy format header from mir.ndslice.Slice