def main(self, input_ring):
"""Initiate the writing to filename
@param[in] input_rings First ring in this list will be used for
data
@param[out] output_rings This list of rings won't be used."""
span_generator = self.iterate_ring_read(input_ring)
data_accumulate = None
for span in span_generator:
if self.nbit < 8:
unpacked_data = unpack(span.data_view(self.dtype), self.nbit)
else:
if self.dtype == np.complex64:
unpacked_data = span.data_view(self.dtype).view(np.float32)
elif self.dtype == np.complex128:
unpacked_data = span.data_view(self.dtype).view(np.float64)
else:
unpacked_data = span.data_view(self.dtype)
if data_accumulate is not None:
data_accumulate = np.concatenate((data_accumulate, unpacked_data[0]))
else:
data_accumulate = unpacked_data[0]
text_file = open(self.filename, 'a')
np.savetxt(text_file, data_accumulate.reshape((1, -1)))
评论列表
文章目录