CSV methodology

Peter Otten __peter__ at web.de
Mon Sep 15 09:29:02 CEST 2014


jayte wrote:

> Sorry, I neglected to mention the values' significance.  The MXP program
> uses the "distance estimate" algorithm in its fractal data generation. 
> The values are thus, for each point in a 1778 x 1000 image:
> 
> Distance,   (an extended double)
> Iterations,  (a 16 bit int)
> zc_x,        (a 16 bit int)
> zc_y         (a 16 bit int)
> 

Probably a bit too early in your "Python career", but you can read raw data 
with numpy. Something like

with open(filename, "rb") as f:
    a = numpy.fromfile(f, dtype=[
        ("distance", "f16"),
        ("iterations", "i2"), 
        ("zc_x", "i2"),
        ("zc_y", "i2"),
    ]).reshape(1778, 1000)

might do, assuming "extended double" takes 16 bytes.




More information about the Python-list mailing list