In [1]:
%autosave 2
%matplotlib inline
import numpy as np
import pandas


Autosaving every 2 seconds

In [2]:
?np.loadtxt

In [17]:
filename = 'freddi.dat'
with open(filename) as f:
    print(f.readline())
table = np.genfromtxt(filename, names=True, usecols=(0,5))
print(table.shape)
print(table.dtype)
print(table[0])
print(table['t'][:5])


#t    Mdot Mdisk Rhot Cirrout H2R   Teffout Tirrout Qiir2Qvisout Lx    mU  mB  mV  mR  mI  mJ 

(201,)
[('t', '<f8'), ('H2R', '<f8')]
( 0.,  0.0990702)
[ 0.    0.25  0.5   0.75  1.  ]

In [31]:
table = np.genfromtxt(
    filename,
    usecols=(0,5),
    skip_header=10,
    skip_footer=100,
    comments='#',
    dtype=[('a', np.float), ('b', '|U10')],
    converters={5: lambda s: s.replace(b'0', b'U')}
)
print(table.shape)
print(table.dtype)
print(table[:5])


(101,)
[('a', '<f8'), ('b', '<U10')]
[( 0.  , 'U.U99U7U2') ( 0.25, 'U.U939382') ( 0.5 , 'U.U916451')
 ( 0.75, 'U.U9UU89') ( 1.  , 'U.U888923')]

In [ ]: