4 Commits

Author SHA1 Message Date
wendtalexander
0113e94625 [dataio/nix] adding comments 2024-11-04 08:04:20 +01:00
wendtalexander
cce7c55fe7 [daq] trying different channels 2024-10-25 18:03:43 +02:00
wendtalexander
6c49f19b43 [dataio/daq] updating log messages 2024-10-25 18:03:23 +02:00
wendtalexander
2ef018ef07 [dataio/daq] making the buffer bigger 2024-10-24 16:35:09 +02:00
3 changed files with 12 additions and 9 deletions

View File

@@ -21,7 +21,6 @@ class DaqProducer:
self.device = device
self.ai_device = self.device.get_ai_device()
self.channels = channels
self.stop = False
def read_analog_continously(
@@ -41,7 +40,7 @@ class DaqProducer:
)
# 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)
log.debug(f"Buffersize for daq {len(data_in)}")
@@ -84,7 +83,7 @@ class DaqProducer:
channel_samples = transfer_status.current_scan_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 new_data_count > len(data_in):
self.ai_device.scan_stop()
@@ -136,8 +135,6 @@ class DaqProducer:
data_second_channel = data_in[
prev_index + 1 : prev_index + chunk_size : 2
]
embed()
exit()
[
self.buffer.append(data_first_channel[i], channel=0)
for i in range(int(chunk_size / 2))
@@ -165,9 +162,11 @@ class DaqProducer:
log.debug(daq_status)
chunk_size = transfer_status.current_total_count - prev_count
log.debug(transfer_status.current_index)
log.debug(transfer_status.current_total_count)
log.debug(transfer_status.current_scan_count)
log.debug(f"DAQ current index {transfer_status.current_index}")
log.debug(f"DAQ total count {transfer_status.current_total_count}")
log.debug(
f"DAQ Samples per channel {transfer_status.current_scan_count}"
)
log.debug("Appending last chunk")
if prev_index + chunk_size > len(data_in) - 1:
@@ -223,6 +222,7 @@ class DaqProducer:
]
log.info("stopping")
log.debug(self.buffer.totalcount())
log.debug(self.ai_device.get_scan_status())
break
break

View File

@@ -68,6 +68,9 @@ class NixWriter:
log.debug(f"Samples written {index}")
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.block = self.nix_file.create_block("recording", "testfile")
self.data_array = self.block.create_data_array(

View File

@@ -100,7 +100,7 @@ class PyRelacs(QMainWindow):
if self.mccdaq:
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")
self.sinus_producer = SinProducer(self.buffer)