Compare commits
4 Commits
3ab7a33b52
...
datastream
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0113e94625 | ||
|
|
cce7c55fe7 | ||
|
|
6c49f19b43 | ||
|
|
2ef018ef07 |
@@ -21,7 +21,6 @@ class DaqProducer:
|
|||||||
self.device = device
|
self.device = device
|
||||||
self.ai_device = self.device.get_ai_device()
|
self.ai_device = self.device.get_ai_device()
|
||||||
self.channels = channels
|
self.channels = channels
|
||||||
|
|
||||||
self.stop = False
|
self.stop = False
|
||||||
|
|
||||||
def read_analog_continously(
|
def read_analog_continously(
|
||||||
@@ -41,7 +40,7 @@ class DaqProducer:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# let the buffer for the daq device hold 5 seconds of data
|
# let the buffer for the daq device hold 5 seconds of data
|
||||||
daq_buffer_size = int(self.buffer.samplerate * 5)
|
daq_buffer_size = int(self.buffer.samplerate * 30)
|
||||||
|
|
||||||
data_in = uldaq.create_float_buffer(channel_range.size, daq_buffer_size)
|
data_in = uldaq.create_float_buffer(channel_range.size, daq_buffer_size)
|
||||||
log.debug(f"Buffersize for daq {len(data_in)}")
|
log.debug(f"Buffersize for daq {len(data_in)}")
|
||||||
@@ -84,7 +83,7 @@ class DaqProducer:
|
|||||||
channel_samples = transfer_status.current_scan_count
|
channel_samples = transfer_status.current_scan_count
|
||||||
|
|
||||||
new_data_count = total_samples - prev_count
|
new_data_count = total_samples - prev_count
|
||||||
# check if counts if new data is bigger than the buffer
|
# check if new data is bigger than the buffer
|
||||||
# if that happends stop the acquisition
|
# if that happends stop the acquisition
|
||||||
if new_data_count > len(data_in):
|
if new_data_count > len(data_in):
|
||||||
self.ai_device.scan_stop()
|
self.ai_device.scan_stop()
|
||||||
@@ -136,8 +135,6 @@ class DaqProducer:
|
|||||||
data_second_channel = data_in[
|
data_second_channel = data_in[
|
||||||
prev_index + 1 : prev_index + chunk_size : 2
|
prev_index + 1 : prev_index + chunk_size : 2
|
||||||
]
|
]
|
||||||
embed()
|
|
||||||
exit()
|
|
||||||
[
|
[
|
||||||
self.buffer.append(data_first_channel[i], channel=0)
|
self.buffer.append(data_first_channel[i], channel=0)
|
||||||
for i in range(int(chunk_size / 2))
|
for i in range(int(chunk_size / 2))
|
||||||
@@ -165,9 +162,11 @@ class DaqProducer:
|
|||||||
log.debug(daq_status)
|
log.debug(daq_status)
|
||||||
chunk_size = transfer_status.current_total_count - prev_count
|
chunk_size = transfer_status.current_total_count - prev_count
|
||||||
|
|
||||||
log.debug(transfer_status.current_index)
|
log.debug(f"DAQ current index {transfer_status.current_index}")
|
||||||
log.debug(transfer_status.current_total_count)
|
log.debug(f"DAQ total count {transfer_status.current_total_count}")
|
||||||
log.debug(transfer_status.current_scan_count)
|
log.debug(
|
||||||
|
f"DAQ Samples per channel {transfer_status.current_scan_count}"
|
||||||
|
)
|
||||||
log.debug("Appending last chunk")
|
log.debug("Appending last chunk")
|
||||||
|
|
||||||
if prev_index + chunk_size > len(data_in) - 1:
|
if prev_index + chunk_size > len(data_in) - 1:
|
||||||
@@ -223,6 +222,7 @@ class DaqProducer:
|
|||||||
]
|
]
|
||||||
log.info("stopping")
|
log.info("stopping")
|
||||||
log.debug(self.buffer.totalcount())
|
log.debug(self.buffer.totalcount())
|
||||||
|
log.debug(self.ai_device.get_scan_status())
|
||||||
|
|
||||||
break
|
break
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ class NixWriter:
|
|||||||
log.debug(f"Samples written {index}")
|
log.debug(f"Samples written {index}")
|
||||||
|
|
||||||
def _write_header(self):
|
def _write_header(self):
|
||||||
|
"""
|
||||||
|
Writing the header of the nix file
|
||||||
|
"""
|
||||||
self.nix_file = nixio.File.open(path="data.nix", mode=nixio.FileMode.Overwrite)
|
self.nix_file = nixio.File.open(path="data.nix", mode=nixio.FileMode.Overwrite)
|
||||||
self.block = self.nix_file.create_block("recording", "testfile")
|
self.block = self.nix_file.create_block("recording", "testfile")
|
||||||
self.data_array = self.block.create_data_array(
|
self.data_array = self.block.create_data_array(
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class PyRelacs(QMainWindow):
|
|||||||
|
|
||||||
if self.mccdaq:
|
if self.mccdaq:
|
||||||
log.debug("Creating Daq Generator")
|
log.debug("Creating Daq Generator")
|
||||||
self.daq_producer = DaqProducer(self.buffer, self.mccdaq.daq_device, [1, 2])
|
self.daq_producer = DaqProducer(self.buffer, self.mccdaq.daq_device, [4, 5])
|
||||||
log.debug("Creating Sinus Generator")
|
log.debug("Creating Sinus Generator")
|
||||||
self.sinus_producer = SinProducer(self.buffer)
|
self.sinus_producer = SinProducer(self.buffer)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user