Python-Write Data to hdf5 File -
i want write complex-data (6,31) dimensional dataset. in first column there should first complex-data first input-textfile, in secound there should data form secound input-textilfe...
import numpy,sys import h5py h5 ####################################################### def createh5(argv): f=h5.file("s12.h5","w") dset=f.create_dataset('s11',(6,31),dtype='complex128') arg in argv: s11f = numpy.loadtxt(arg,skiprows=3) s11fc=s11f[:,1]*numpy.exp(s11f[:,-1]*1j*(180./numpy.pi)) in range(dset): dset[i]=s11fc if __name__=='__main__': createh5(sys.argv[1:]) i dont know how handle for in range(dset):
i not sure trying forloop. understand have 6 files 31 complex values in each 1 , want values in dataset?
if so, enumerate loop on argv , put numpy array dataset:
for index, arg in enumerate(argv): s11f = numpy.loadtxt(arg,skiprows=3) s11fc=s11f[:,1]*numpy.exp(s11f[:,-1]*1j*(180./numpy.pi)) dset[index] = s11fc but why use hd5f instead of simple numpy array?
Comments
Post a Comment