-
Notifications
You must be signed in to change notification settings - Fork 162
/
Copy path_in_stream.py
1265 lines (1046 loc) · 48.6 KB
/
_in_stream.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Do not edit this file; it was automatically generated.
from typing import Type, Optional, Union
import numpy
import numpy.typing
import deprecation
import pathlib
from nidaqmx.task.channels import Channel
from nidaqmx.utils import unflatten_channel_string
from nidaqmx.constants import (
AcquisitionType, LoggingMode, LoggingOperation, OverwriteMode,
READ_ALL_AVAILABLE, ReadRelativeTo, WaitMode)
class InStream:
"""
Exposes an input data stream on a DAQmx task.
The input data stream be used to control reading behavior and can be
used in conjunction with reader classes to read samples from an
NI-DAQmx task.
"""
__slots__ = ('_task', '_handle', '_interpreter', '_timeout')
def __init__(self, task, interpreter):
self._task = task
self._handle = task._handle
self._interpreter = interpreter
self._timeout = 10.0
super().__init__()
def __eq__(self, other):
if isinstance(other, self.__class__):
return (self._handle == other._handle and
self._timeout == other._timeout)
return False
def __hash__(self):
return self._interpreter.hash_task_handle(self._handle) ^ hash(self._timeout)
def __ne__(self, other):
return not self.__eq__(other)
def __repr__(self):
return f'InStream(task={self._task.name})'
@property
def timeout(self):
"""
float: Specifies the amount of time in seconds to wait for
samples to become available. If the time elapses, the read
method returns an error and any samples read before the
timeout elapsed. The default timeout is 10 seconds. If you
set timeout to nidaqmx.WAIT_INFINITELY, the read method
waits indefinitely. If you set timeout to 0, the read method
tries once to read the requested samples and returns an error
if it is unable to.
"""
return self._timeout
@timeout.setter
def timeout(self, val):
self._timeout = val
@timeout.deleter
def timeout(self):
self._timeout = 10.0
@property
def accessory_insertion_or_removal_detected(self):
"""
bool: Indicates if any device(s) in the task detected the
insertion or removal of an accessory since the task started.
Reading this property clears the accessory change status for
all channels in the task. You must read this property before
you read **devs_with_inserted_or_removed_accessories**.
Otherwise, you will receive an error.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x2f70)
return val
@property
def auto_start(self):
"""
bool: Specifies if DAQmx Read automatically starts the task if
you did not start the task explicitly by using DAQmx Start.
The default value is True. When DAQmx Read starts a finite
acquisition task, it also stops the task after reading the
last sample.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x1826)
return val
@auto_start.setter
def auto_start(self, val):
self._interpreter.set_read_attribute_bool(self._handle, 0x1826, val)
@auto_start.deleter
def auto_start(self):
self._interpreter.reset_read_attribute(self._handle, 0x1826)
@property
def aux_power_error_chans(self):
"""
List[str]: Indicates a list of names of any virtual channels in
the task for which an auxiliary power supply error condition
has been detected. You must read the Aux Power Error
Channels Exist property before you read this property.
Otherwise, you will receive an error.
"""
buffer_size = self.get_channels_buffer_size()
val = self._interpreter.get_read_attribute_string(self._handle, 0x31e0, buffer_size)
return unflatten_channel_string(val)
@property
def aux_power_error_chans_exist(self):
"""
bool: Indicates if the device(s) detected an auxiliary power
supply error condition for any channel in the task. Reading
this property clears the error condition status for all
channels in the task. You must read this property before you
read the Aux Power Error Channels property. Otherwise, you
will receive an error.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x31df)
return val
@property
def avail_samp_per_chan(self):
"""
int: Indicates the number of samples available to read per
channel. This value is the same for all channels in the
task.
"""
val = self._interpreter.get_read_attribute_uint32(self._handle, 0x1223)
return val
@property
def change_detect_overflowed(self):
"""
bool: Indicates if samples were missed because change detection
events occurred faster than the device could handle them.
Some devices detect overflows differently than others.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x2194)
return val
@property
def channels_to_read(self):
"""
:class:`nidaqmx.task.channels.Channel`: Specifies a subset of
channels in the task from which to read.
"""
val = self._interpreter.get_read_attribute_string(self._handle, 0x1823)
return Channel._factory(self._handle, val, self._interpreter)
@channels_to_read.setter
def channels_to_read(self, val):
val = val.name
self._interpreter.set_read_attribute_string(self._handle, 0x1823, val)
@channels_to_read.deleter
def channels_to_read(self):
self._interpreter.reset_read_attribute(self._handle, 0x1823)
@property
def common_mode_range_error_chans(self):
"""
List[str]: Indicates a list of names of any virtual channels in
the task for which the device(s) detected a common mode
range violation. You must read
**common_mode_range_error_chans_exist** before you read this
property. Otherwise, you will receive an error.
"""
buffer_size = self.get_channels_buffer_size()
val = self._interpreter.get_read_attribute_string(self._handle, 0x2a99, buffer_size)
return unflatten_channel_string(val)
@property
def common_mode_range_error_chans_exist(self):
"""
bool: Indicates if the device(s) detected a common mode range
violation for any virtual channel in the task. Common mode
range violation occurs when the voltage of either the
positive terminal or negative terminal to ground are out of
range. Reading this property clears the common mode range
violation status for all channels in the task. You must read
this property before you read
**common_mode_range_error_chans**. Otherwise, you will
receive an error.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x2a98)
return val
@property
def curr_read_pos(self):
"""
int: Indicates in samples per channel the current position in
the buffer.
"""
val = self._interpreter.get_read_attribute_uint64(self._handle, 0x1221)
return val
@property
def devs_with_inserted_or_removed_accessories(self):
"""
List[str]: Indicates the names of any devices that detected the
insertion or removal of an accessory since the task started.
You must read **accessory_insertion_or_removal_detected**
before you read this property. Otherwise, you will receive
an error.
"""
buffer_size = self.get_channels_buffer_size()
val = self._interpreter.get_read_attribute_string(self._handle, 0x2f71, buffer_size)
return unflatten_channel_string(val)
@property
def di_num_booleans_per_chan(self):
"""
int: Indicates the number of booleans per channel that NI-DAQmx
returns in a sample for line-based reads. If a channel has
fewer lines than this number, the extra booleans are False.
"""
val = self._interpreter.get_read_attribute_uint32(self._handle, 0x217c)
return val
@property
def excit_fault_chans(self):
"""
List[str]: Indicates a list of names of any virtual channels in
the task for which the device(s) detected an excitation
fault condition. You must read **excit_fault_chans_exist**
before you read this property. Otherwise, you will receive
an error.
"""
buffer_size = self.get_channels_buffer_size()
val = self._interpreter.get_read_attribute_string(self._handle, 0x3089, buffer_size)
return unflatten_channel_string(val)
@property
def excit_fault_chans_exist(self):
"""
bool: Indicates if the device(s) detected an excitation fault
condition for any virtual channel in the task. Reading this
property clears the excitation fault status for all channels
in the task. You must read this property before you read
**excit_fault_chans**. Otherwise, you will receive an error.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x3088)
return val
@property
def input_buf_size(self):
"""
int: Specifies the number of samples the input buffer can hold
for each channel in the task. Zero indicates to allocate no
buffer. Use a buffer size of 0 to perform a hardware-timed
operation without using a buffer. Setting this property
overrides the automatic input buffer allocation that NI-
DAQmx performs.
"""
val = self._interpreter.get_buffer_attribute_uint32(self._handle, 0x186c)
return val
@input_buf_size.setter
def input_buf_size(self, val):
self._interpreter.set_buffer_attribute_uint32(self._handle, 0x186c, val)
@input_buf_size.deleter
def input_buf_size(self):
self._interpreter.reset_buffer_attribute(self._handle, 0x186c)
@property
def input_limits_fault_chans(self):
"""
List[str]: Indicates the virtual channels that have detected
samples outside the upper or lower limits configured for
each channel in the task. You must read
**input_limits_fault_chans_exist** before you read this
property. Otherwise, you will receive an error.
"""
buffer_size = self.get_channels_buffer_size()
val = self._interpreter.get_read_attribute_string(self._handle, 0x3190, buffer_size)
return unflatten_channel_string(val)
@property
def input_limits_fault_chans_exist(self):
"""
bool: Indicates if the device or devices detected a sample that
was outside the upper or lower limits configured for each
channel in the task. Reading this property clears the input
limits fault channel status for all channels in the task.
You must read this property before you read
**input_limits_fault_chans**. Otherwise, you will receive an
error. Note: Fault detection applies to both positive and
negative inputs. For instance, if you specify a lower limit
of 2 mA and an upper limit of 12 mA, NI-DAQmx detects a
fault at 15 mA and -15 mA, but not at -6 mA because it is in
the range of -12 mA to -2 mA.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x318f)
return val
@property
def input_onbrd_buf_size(self):
"""
int: Indicates in samples per channel the size of the onboard
input buffer of the device.
"""
val = self._interpreter.get_buffer_attribute_uint32(self._handle, 0x230a)
return val
@property
def logging_file_path(self) -> Optional[pathlib.Path]:
"""
pathlib.Path: Specifies the path to the TDMS file to which you
want to log data. If the file path is changed while the
task is running, this takes effect on the next sample
interval (if Logging.SampsPerFile has been set) or when
DAQmx Start New File is called. New file paths can be
specified by ending with "\\" or "/". Files created after
specifying a new file path retain the same name and
numbering sequence.
"""
val = self._interpreter.get_read_attribute_string(self._handle, 0x2ec4)
return pathlib.Path(val) if val else None
@logging_file_path.setter
def logging_file_path(self, val: Optional[Union[str, pathlib.PurePath]]):
if val is None:
val = ""
val = str(val)
self._interpreter.set_read_attribute_string(self._handle, 0x2ec4, val)
@logging_file_path.deleter
def logging_file_path(self):
self._interpreter.reset_read_attribute(self._handle, 0x2ec4)
@property
def logging_file_preallocation_size(self):
"""
int: Specifies a size in samples to be used to pre-allocate
space on disk. Pre-allocation can improve file I/O
performance, especially in situations where multiple files
are being written to disk. For finite tasks, the default
behavior is to pre-allocate the file based on the number of
samples you configure the task to acquire.
"""
val = self._interpreter.get_read_attribute_uint64(self._handle, 0x2fc6)
return val
@logging_file_preallocation_size.setter
def logging_file_preallocation_size(self, val):
self._interpreter.set_read_attribute_uint64(self._handle, 0x2fc6, val)
@logging_file_preallocation_size.deleter
def logging_file_preallocation_size(self):
self._interpreter.reset_read_attribute(self._handle, 0x2fc6)
@property
def logging_file_write_size(self):
"""
int: Specifies the size, in samples, in which data will be
written to disk. The size must be evenly divisible by the
volume sector size, in bytes.
"""
val = self._interpreter.get_read_attribute_uint32(self._handle, 0x2fc3)
return val
@logging_file_write_size.setter
def logging_file_write_size(self, val):
self._interpreter.set_read_attribute_uint32(self._handle, 0x2fc3, val)
@logging_file_write_size.deleter
def logging_file_write_size(self):
self._interpreter.reset_read_attribute(self._handle, 0x2fc3)
@property
def logging_mode(self):
"""
:class:`nidaqmx.constants.LoggingMode`: Specifies whether to
enable logging and whether to allow reading data while
logging. Log mode allows for the best performance. However,
you cannot read data while logging if you specify this mode.
If you want to read data while logging, specify Log and Read
mode.
"""
val = self._interpreter.get_read_attribute_int32(self._handle, 0x2ec5)
return LoggingMode(val)
@logging_mode.setter
def logging_mode(self, val):
val = val.value
self._interpreter.set_read_attribute_int32(self._handle, 0x2ec5, val)
@logging_mode.deleter
def logging_mode(self):
self._interpreter.reset_read_attribute(self._handle, 0x2ec5)
@property
def logging_pause(self):
"""
bool: Specifies whether logging is paused while a task is
executing. If **logging_mode** is set to Log and Read mode,
this value is taken into consideration on the next call to
DAQmx Read, where data is written to disk. If
**logging_mode** is set to Log Only mode, this value is
taken into consideration the next time that data is written
to disk. A new TDMS group is written when logging is resumed
from a paused state.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x2fe3)
return val
@logging_pause.setter
def logging_pause(self, val):
self._interpreter.set_read_attribute_bool(self._handle, 0x2fe3, val)
@logging_pause.deleter
def logging_pause(self):
self._interpreter.reset_read_attribute(self._handle, 0x2fe3)
@property
def logging_samps_per_file(self):
"""
int: Specifies how many samples to write to each file. When the
file reaches the number of samples specified, a new file is
created with the naming convention of <filename>_####.tdms,
where #### starts at 0001 and increments automatically with
each new file. For example, if the file specified is
C:\\data.tdms, the next file name used is
C:\\data_0001.tdms. To disable file spanning behavior, set
this attribute to 0. If **logging_file_path** is changed
while this attribute is set, the new file path takes effect
on the next file created.
"""
val = self._interpreter.get_read_attribute_uint64(self._handle, 0x2fe4)
return val
@logging_samps_per_file.setter
def logging_samps_per_file(self, val):
self._interpreter.set_read_attribute_uint64(self._handle, 0x2fe4, val)
@logging_samps_per_file.deleter
def logging_samps_per_file(self):
self._interpreter.reset_read_attribute(self._handle, 0x2fe4)
@property
def logging_tdms_group_name(self):
"""
str: Specifies the name of the group to create within the TDMS
file for data from this task. If you append data to an
existing file and the specified group already exists, NI-
DAQmx appends a number symbol and a number to the group
name, incrementing that number until finding a group name
that does not exist. For example, if you specify a group
name of Voltage Task, and that group already exists, NI-
DAQmx assigns the group name Voltage Task #1, then Voltage
Task #2.
"""
val = self._interpreter.get_read_attribute_string(self._handle, 0x2ec6)
return val
@logging_tdms_group_name.setter
def logging_tdms_group_name(self, val):
self._interpreter.set_read_attribute_string(self._handle, 0x2ec6, val)
@logging_tdms_group_name.deleter
def logging_tdms_group_name(self):
self._interpreter.reset_read_attribute(self._handle, 0x2ec6)
@property
def logging_tdms_operation(self):
"""
:class:`nidaqmx.constants.LoggingOperation`: Specifies how to
open the TDMS file.
"""
val = self._interpreter.get_read_attribute_int32(self._handle, 0x2ec7)
return LoggingOperation(val)
@logging_tdms_operation.setter
def logging_tdms_operation(self, val):
val = val.value
self._interpreter.set_read_attribute_int32(self._handle, 0x2ec7, val)
@logging_tdms_operation.deleter
def logging_tdms_operation(self):
self._interpreter.reset_read_attribute(self._handle, 0x2ec7)
@property
def num_chans(self):
"""
int: Indicates the number of channels that DAQmx Read reads from
the task. This value is the number of channels in the task
or the number of channels you specify with
**channels_to_read**.
"""
val = self._interpreter.get_read_attribute_uint32(self._handle, 0x217b)
return val
@property
def offset(self):
"""
int: Specifies an offset in samples per channel at which to
begin a read operation. This offset is relative to the
location you specify with **relative_to**.
"""
val = self._interpreter.get_read_attribute_int32(self._handle, 0x190b)
return val
@offset.setter
def offset(self, val):
self._interpreter.set_read_attribute_int32(self._handle, 0x190b, val)
@offset.deleter
def offset(self):
self._interpreter.reset_read_attribute(self._handle, 0x190b)
@property
def open_chans(self):
"""
List[str]: Indicates a list of names of any open virtual
channels. You must read **open_chans_exist** before you read
this property. Otherwise you will receive an error.
"""
buffer_size = self.get_channels_buffer_size()
val = self._interpreter.get_read_attribute_string(self._handle, 0x3101, buffer_size)
return unflatten_channel_string(val)
@property
def open_chans_details(self):
"""
List[str]: Indicates a list of details of any open virtual
channels. You must read **open_chans_exist** before you read
this property. Otherwise you will receive an error.
"""
buffer_size = self.get_channels_buffer_size()
val = self._interpreter.get_read_attribute_string(self._handle, 0x3102, buffer_size)
return unflatten_channel_string(val)
@property
def open_chans_exist(self):
"""
bool: Indicates if the device or devices detected an open
channel condition in any virtual channel in the task.
Reading this property clears the open channel status for all
channels in this task. You must read this property before
you read **open_chans**. Otherwise, you will receive an
error.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x3100)
return val
@property
def open_current_loop_chans(self):
"""
List[str]: Indicates a list of names of any virtual channels in
the task for which the device(s) detected an open current
loop. You must read **open_current_loop_chans_exist** before
you read this property. Otherwise, you will receive an
error.
"""
buffer_size = self.get_channels_buffer_size()
val = self._interpreter.get_read_attribute_string(self._handle, 0x2a0a, buffer_size)
return unflatten_channel_string(val)
@property
def open_current_loop_chans_exist(self):
"""
bool: Indicates if the device(s) detected an open current loop
for any virtual channel in the task. Reading this property
clears the open current loop status for all channels in the
task. You must read this property before you read
**open_current_loop_chans**. Otherwise, you will receive an
error.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x2a09)
return val
@property
def open_thrmcpl_chans(self):
"""
List[str]: Indicates a list of names of any virtual channels in
the task for which the device(s) detected an open
thermcouple. You must read **open_thrmcpl_chans_exist**
before you read this property. Otherwise, you will receive
an error.
"""
buffer_size = self.get_channels_buffer_size()
val = self._interpreter.get_read_attribute_string(self._handle, 0x2a97, buffer_size)
return unflatten_channel_string(val)
@property
def open_thrmcpl_chans_exist(self):
"""
bool: Indicates if the device(s) detected an open thermocouple
connected to any virtual channel in the task. Reading this
property clears the open thermocouple status for all
channels in the task. You must read this property before you
read **open_thrmcpl_chans**. Otherwise, you will receive an
error.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x2a96)
return val
@property
def overcurrent_chans(self):
"""
List[str]: Indicates a list of names of any virtual channels in
the task for which the device(s) detected an overcurrent
condition. You must read **overcurrent_chans_exist** before
you read this property. Otherwise, you will receive an
error. On some devices, you must restart the task for all
overcurrent channels to recover.
"""
buffer_size = self.get_channels_buffer_size()
val = self._interpreter.get_read_attribute_string(self._handle, 0x29e7, buffer_size)
return unflatten_channel_string(val)
@property
def overcurrent_chans_exist(self):
"""
bool: Indicates if the device(s) detected an overcurrent
condition for any virtual channel in the task. Reading this
property clears the overcurrent status for all channels in
the task. You must read this property before you read
**overcurrent_chans**. Otherwise, you will receive an error.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x29e6)
return val
@property
def overloaded_chans(self):
"""
List[str]: Indicates a list of names of any overloaded virtual
channels in the task. You must read
**overloaded_chans_exist** before you read this property.
Otherwise, you will receive an error.
"""
buffer_size = self.get_channels_buffer_size()
val = self._interpreter.get_read_attribute_string(self._handle, 0x2175, buffer_size)
return unflatten_channel_string(val)
@property
def overloaded_chans_exist(self):
"""
bool: Indicates if the device(s) detected an overload in any
virtual channel in the task. Reading this property clears
the overload status for all channels in the task. You must
read this property before you read **overloaded_chans**.
Otherwise, you will receive an error.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x2174)
return val
@property
def overtemperature_chans(self):
"""
List[str]: Indicates a list of names of any overtemperature
virtual channels. You must read
**overtemperature_chans_exist** before you read this
property. Otherwise, you will receive an error.
"""
buffer_size = self.get_channels_buffer_size()
val = self._interpreter.get_read_attribute_string(self._handle, 0x3082, buffer_size)
return unflatten_channel_string(val)
@property
def overtemperature_chans_exist(self):
"""
bool: Indicates if the device(s) detected an overtemperature
condition in any virtual channel in the task. Reading this
property clears the overtemperature status for all channels
in the task. You must read this property before you read
**overtemperature_chans**. Otherwise, you will receive an
error.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x3081)
return val
@property
def overwrite(self):
"""
:class:`nidaqmx.constants.OverwriteMode`: Specifies whether to
overwrite samples in the buffer that you have not yet read.
"""
val = self._interpreter.get_read_attribute_int32(self._handle, 0x1211)
return OverwriteMode(val)
@overwrite.setter
def overwrite(self, val):
val = val.value
self._interpreter.set_read_attribute_int32(self._handle, 0x1211, val)
@overwrite.deleter
def overwrite(self):
self._interpreter.reset_read_attribute(self._handle, 0x1211)
@property
def pll_unlocked_chans(self):
"""
List[str]: Indicates the channels that had their PLLs unlock.
"""
buffer_size = self.get_channels_buffer_size()
val = self._interpreter.get_read_attribute_string(self._handle, 0x3119, buffer_size)
return unflatten_channel_string(val)
@property
def pll_unlocked_chans_exist(self):
"""
bool: Indicates whether the PLL is currently locked, or whether
it became unlocked during the previous acquisition. Devices
may report PLL Unlock either during acquisition or after
acquisition.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x3118)
return val
@property
def power_supply_fault_chans(self):
"""
List[str]: Indicates the virtual channels that have detected a
power supply fault. You must read
**power_supply_fault_chans_exist** before you read this
property. Otherwise, you will receive an error.
"""
buffer_size = self.get_channels_buffer_size()
val = self._interpreter.get_read_attribute_string(self._handle, 0x3193, buffer_size)
return unflatten_channel_string(val)
@property
def power_supply_fault_chans_exist(self):
"""
bool: Indicates if the device or devices detected a power supply
fault condition in any virtual channel in the task. Reading
this property clears the power supply fault status for all
channels in this task. You must read this property before
you read **power_supply_fault_chans**. Otherwise, you will
receive an error.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x3192)
return val
@property
def raw_data_width(self):
"""
int: Indicates in bytes the size of a raw sample from the task.
"""
val = self._interpreter.get_read_attribute_uint32(self._handle, 0x217a)
return val
@property
def read_all_avail_samp(self):
"""
bool: Specifies whether subsequent read operations read all
samples currently available in the buffer or wait for the
buffer to become full before reading. NI-DAQmx uses this
setting for finite acquisitions and only when the number of
samples to read is -1. For continuous acquisitions when the
number of samples to read is -1, a read operation always
reads all samples currently available in the buffer.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x1215)
return val
@read_all_avail_samp.setter
def read_all_avail_samp(self, val):
self._interpreter.set_read_attribute_bool(self._handle, 0x1215, val)
@read_all_avail_samp.deleter
def read_all_avail_samp(self):
self._interpreter.reset_read_attribute(self._handle, 0x1215)
@property
def relative_to(self):
"""
:class:`nidaqmx.constants.ReadRelativeTo`: Specifies the point
in the buffer at which to begin a read operation. If you
also specify an offset with **offset**, the read operation
begins at that offset relative to the point you select with
this property. The default value is
**ReadRelativeTo.CURRENT_READ_POSITION** unless you
configure a Reference Trigger for the task. If you configure
a Reference Trigger, the default value is
**ReadRelativeTo.FIRST_PRETRIGGER_SAMPLE**.
"""
val = self._interpreter.get_read_attribute_int32(self._handle, 0x190a)
return ReadRelativeTo(val)
@relative_to.setter
def relative_to(self, val):
val = val.value
self._interpreter.set_read_attribute_int32(self._handle, 0x190a, val)
@relative_to.deleter
def relative_to(self):
self._interpreter.reset_read_attribute(self._handle, 0x190a)
@property
def remote_sense_error_chans(self):
"""
List[str]: Indicates a list of names of any virtual channels in
the task for which a remote sense connection error condition
has been detected. You must read Remote Sense Error Channels
Exist before you read this property. Otherwise, you will
receive an error.
"""
buffer_size = self.get_channels_buffer_size()
val = self._interpreter.get_read_attribute_string(self._handle, 0x31de, buffer_size)
return unflatten_channel_string(val)
@property
def remote_sense_error_chans_exist(self):
"""
bool: Indicates if the device(s) detected an error condition of
the remote sense connection for any channel in the task. You
must disable the output and resolve the hardware connection
issue to clear the error condition. You must read this
property before you read the Remote Sense Error Channels
property. Otherwise, you will receive an error.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x31dd)
return val
@property
def reverse_voltage_error_chans(self):
"""
List[str]: Indicates a list of names of all virtual channels in
the task for which reverse voltage error condition has been
detected. You must read the Reverse Voltage Error Channels
Exist property before you read this property. Otherwise, you
will receive an error.
"""
buffer_size = self.get_channels_buffer_size()
val = self._interpreter.get_read_attribute_string(self._handle, 0x31e7, buffer_size)
return unflatten_channel_string(val)
@property
def reverse_voltage_error_chans_exist(self):
"""
bool: Indicates if the device(s) detected reverse voltage error
for any of the channels in the task. Reverse voltage error
occurs if the local voltage is equal to the negative
saturated voltage. Reading this property clears the error
condition status for all channels in the task. You must read
this property before you read the Reverse Voltage Error
Channels property. Otherwise, you will receive an error.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x31e6)
return val
@property
def sleep_time(self):
"""
float: Specifies in seconds the amount of time to sleep after
checking for available samples if **wait_mode** is
**WaitMode.SLEEP**.
"""
val = self._interpreter.get_read_attribute_double(self._handle, 0x22b0)
return val
@sleep_time.setter
def sleep_time(self, val):
self._interpreter.set_read_attribute_double(self._handle, 0x22b0, val)
@sleep_time.deleter
def sleep_time(self):
self._interpreter.reset_read_attribute(self._handle, 0x22b0)
@property
def sync_unlocked_chans(self):
"""
List[str]: Indicates the channels from devices in an unlocked
target.
"""
buffer_size = self.get_channels_buffer_size()
val = self._interpreter.get_read_attribute_string(self._handle, 0x313e, buffer_size)
return unflatten_channel_string(val)
@property
def sync_unlocked_chans_exist(self):
"""
bool: Indicates whether the target is currently locked to the
grand master. Devices may report PLL Unlock either during
acquisition or after acquisition.
"""
val = self._interpreter.get_read_attribute_bool(self._handle, 0x313d)
return val
@property
def total_samp_per_chan_acquired(self):
"""
int: Indicates the total number of samples acquired by each
channel. NI-DAQmx returns a single value because this value
is the same for all channels. For retriggered acquisitions,
this value is the cumulative number of samples across all
retriggered acquisitions.
"""
val = self._interpreter.get_read_attribute_uint64(self._handle, 0x192a)
return val
@property
def wait_mode(self):
"""
:class:`nidaqmx.constants.WaitMode`: Specifies how DAQmx Read
waits for samples to become available.
"""
val = self._interpreter.get_read_attribute_int32(self._handle, 0x2232)
return WaitMode(val)
@wait_mode.setter
def wait_mode(self, val):
val = val.value
self._interpreter.set_read_attribute_int32(self._handle, 0x2232, val)
@wait_mode.deleter
def wait_mode(self):
self._interpreter.reset_read_attribute(self._handle, 0x2232)
def get_channels_buffer_size(self):
channel_names = self._task.channel_names
total_size = sum(len(name) + 2 for name in channel_names) + 1
return total_size
def _calculate_num_samps_per_chan(self, num_samps_per_chan):
if num_samps_per_chan == -1:
acq_type = self._task.timing.samp_quant_samp_mode
if (acq_type == AcquisitionType.FINITE and
not self.read_all_avail_samp):
return self._task.timing.samp_quant_samp_per_chan
else:
return self.avail_samp_per_chan
else:
return num_samps_per_chan
def configure_logging(
self, file_path: Union[str, pathlib.PurePath], logging_mode=LoggingMode.LOG_AND_READ,
group_name="", operation=LoggingOperation.OPEN_OR_CREATE):