예제 #1
0
파일: m8r.py 프로젝트: AtilaSaraiva/src
 def write(self, data):
     if _swig_:
         if self.type == 'float':
             c_rsf.sf_floatwrite(
                 np.reshape(data.astype(np.float32), (data.size, )),
                 self.file)
         elif self.type == 'complex':
             c_rsf.sf_complexwrite(np.reshape(data, (data.size, )),
                                   self.file)
         elif self.type == 'int':
             c_rsf.sf_intwrite(
                 np.reshape(data.astype(np.int32), (data.size, )),
                 self.file)
         elif self.type == 'uchar':
             c_rsf.sf_ucharwrite(
                 np.reshape(data.astype(np.uint8), (data.size, )),
                 self.file)
         else:
             raise TypeError('Unsupported file type %s' % self.type)
     else:
         if self.type == 'float':
             self.file.floatwrite(
                 np.reshape(data.astype(np.float32), (data.size, )))
         elif self.type == 'int':
             self.file.intwrite(
                 np.reshape(data.astype(np.int32), (data.size, )))
         elif self.type == 'uchar':
             self.file.ucharwrite(
                 np.reshape(data.astype(np.uint8), (data.size, )))
         else:
             raise TypeError('Unsupported file type %s' % self.type)
예제 #2
0
파일: m8r.py 프로젝트: 1014511134/src
 def write(self,data):
     if self.type == 'float':
         c_rsf.sf_floatwrite(numpy.reshape(data.astype('f'),(data.size,)),self.file)
     elif self.type == 'complex':
         c_rsf.sf_complexwrite(numpy.reshape(data,(data.size,)),
                               self.file)
     else:
         raise TypeError, 'Unsupported file type %s' % self.type
예제 #3
0
 def write(self,data):
     if self.type == 'float':
         c_rsf.sf_floatwrite(numpy.reshape(data.astype('f'),(data.size,)),self.file)
     elif self.type == 'complex':
         c_rsf.sf_complexwrite(numpy.reshape(data,(data.size,)),
                               self.file)
     else:
         raise TypeError, 'Unsupported file type %s' % self.type