Skip to content

Commit c1c30cd

Browse files
committed
set tdms file path
1 parent f018e92 commit c1c30cd

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

examples/synchronization/multi_function/cont_ai_ci_tdms_sync.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def consumer(
8282
task_data[0], (list, tuple, np.ndarray)
8383
):
8484
for chan_idx, chan_data in enumerate(task_data):
85-
chan_data = np.array(chan_data).flatten()
85+
chan_data = np.array(chan_data).flatten()
8686
channel = ChannelObject(
8787
group_names[task_idx],
8888
channel_names[task_idx][chan_idx],
@@ -91,7 +91,7 @@ def consumer(
9191
)
9292
objects_to_write.append(channel)
9393
else:
94-
task_data = np.array(task_data).flatten()
94+
task_data = np.array(task_data).flatten()
9595
channel = ChannelObject(
9696
group_names[task_idx],
9797
channel_names[task_idx][0],
@@ -128,6 +128,9 @@ def main():
128128
ci1_task = nidaqmx.Task()
129129
clk_task = nidaqmx.Task()
130130

131+
script_dir = os.path.dirname(os.path.abspath(__file__))
132+
tdms_filepath = os.path.join(script_dir, "multi_task_data.tdms")
133+
131134
try:
132135
clk_task.co_channels.add_co_pulse_chan_freq(
133136
counter="Dev1/ctr1",
@@ -160,7 +163,7 @@ def main():
160163
target=consumer,
161164
args=(
162165
data_queue,
163-
"multi_task_data.tdms",
166+
tdms_filepath,
164167
["AI_Task", "CI_Task"],
165168
[["Torque01", "Torque02"], ["Rotations01"]],
166169
stop_event,
@@ -193,7 +196,7 @@ def main():
193196
if os.path.exists("multi_task_data.tdms_index"):
194197
os.remove("multi_task_data.tdms_index")
195198

196-
with TdmsFile.open("multi_task_data.tdms") as tdms_file:
199+
with TdmsFile.open(tdms_filepath) as tdms_file:
197200
for group in tdms_file.groups():
198201
for channel in group.channels():
199202
data = channel[:]

0 commit comments

Comments
 (0)