python - Using PyTables from a cython module -
i solving set of coupled odes , facing 2 problems: speed , memory storage. such use cython_gsl
create module solves odes. until had written data .txt
file think more useful use pytables
.
as such define in .pyx
file
from cython_gsl cimport * tables import * def main (parameters run ): class vector(isdescription): name= stringcol(16) # 16-character string = int32col() # 32-bit integer j = int32col() # 32-bit integer k = int32col() # 32-bit integer h5file = tables.openfile("tutorial1.h5", mode = "r", title = "test file") group = h5file.creategroup("/", 'spin_vectors',"spin vectors of crust , core") table = h5file.createtable(group, 'shellvector', vector, " ") ... setup odes ... while (t < t1): status = gsl_odeiv_evolve_apply (e, c, s, &sys, &t, t1, &h, y) if (status != gsl_success): break #write_file.write("%.16e %.16e %.16e %.16e %.16e %.16e %.16e\n" %(t, y[0], y[1],y[2],y[3], y[4],y[5]) ) shell_table.row['i']=y[0] shell_table.row['j']=y[1] shell_table.row['k']=y[2] shell_table.row.append() shell_table.flush()
i compile using setup.py
file outputs (successfully) .so
file. unfortunately upon importing ipython error
nameerror: int32
which believe pytables thing. seems not being imported correctly? while think way if has better suggestions on how handle data python/cython happy hear..google has nothing!
unfortunately there not enough information here able answer question. trying should work. however, don't think error coming pytables (which doesn't have lone "int32" classes, though have "int32atom" , "int32col"). suspect instead cythongsl. there way please post full traceback -- rather last error -- can know sure?
Comments
Post a Comment