Commit 2ce66c1b05d by Pierre Augier

Bug corrections by Clement Savaro

parent 8b6a2e1824c
Pipeline #3720 passed with stage
in 2 minutes 55 seconds
......@@ -66,7 +66,7 @@ class T7:
)
)
def split_data_in_buffer(data):
def split_data_in_buffer(self, data):
MAX_BUFFER_SIZE = 512
BYTES_PER_VALUE = 2
buffer_size = []
......@@ -84,7 +84,7 @@ class T7:
buffer_size.append(buff_size)
data_splited.append([d])
else:
NUMBER_SAMPLE = data_byte_size // MAX_BUFFER_SIZE + 1
NUMBER_SAMPLE = 2 * (data_byte_size // MAX_BUFFER_SIZE + 1)
data_splited.append(np.split(d, NUMBER_SAMPLE))
buffer_size.append(MAX_BUFFER_SIZE)
return buffer_size, data_splited
......@@ -138,7 +138,9 @@ class T7:
ljm.eWriteName(handle, f"STREAM_OUT{indout}_ENABLE", 0)
ljm.eWriteName(handle, f"STREAM_OUT{indout}_TARGET", outAddress)
ljm.eWriteName(handle, f"STREAM_OUT{indout}_BUFFER_SIZE", buffer_size)
ljm.eWriteName(
handle, f"STREAM_OUT{indout}_BUFFER_SIZE", buffer_size[indout]
)
ljm.eWriteName(handle, f"STREAM_OUT{indout}_ENABLE", 1)
......
......@@ -198,7 +198,7 @@ class PIVScan:
t7 = self.t7
handle = t7.handle
aScanList, volt_splitted = t7.prepare_stream_loopV2(
aScanList, volt_splitted = t7.prepare_stream_loop(
IN_NAMES=IN_NAMES, OUT_NAMES=OUT_NAMES, volt=volt
)
......@@ -229,7 +229,7 @@ class PIVScan:
print("Stream started")
t7.wait_before_stop(
nb_couples * time_between_pairs, time_between_frames
nb_couples * time_between_pairs, time_between_pairs
)
else:
try:
......@@ -248,9 +248,7 @@ class PIVScan:
else:
iteration = 0
while iteration < NUM_BUFFER_UPDATES:
bs = ljm.eReadName(
handle, f"STREAM_OUT{OUT_NAMES[0]}_BUFFER_STATUS"
)
bs = ljm.eReadName(handle, f"STREAM_OUT{0}_BUFFER_STATUS")
if bs >= STAT_SIZE:
for indout, out in enumerate(OUT_NAMES):
ljm.eWriteName(
......@@ -260,7 +258,7 @@ class PIVScan:
)
t7.write_out_buffer(
f"STREAM_OUT{indout}_BUFFER_F32",
volt[indout][iteration],
volt_splitted[indout][iteration],
)
ljm.eWriteName(
handle, f"STREAM_OUT{indout}_SET_LOOP", 1
......@@ -656,21 +654,23 @@ def double_saw_tooth2(
# t = np.linspace(0, (N+1)/freq, 2 * N+1)[0:volt0.size]
pylab.plot(t, volt0_loop, "+")
pylab.plot(t, volt[1], "r+")
for i in range(int(t.size / 2 - 1)):
pylab.plot(
t[i * 2 : i * 2 + 3],
np.hstack([volt[0][i * 2 : i * 2 + 2], volt[0][i * 2 + 1]]),
"b-",
)
pylab.plot(
t[i * 2 : i * 2 + 2],
np.hstack([volt[1][i * 2 : i * 2 + 1], volt[1][i * 2]]),
"r-",
)
pylab.step(t, volt[0], "b-", where="post")
pylab.step(t, volt[1], "r-", where="post")
# for i in range(int(t.size / 2 - 1)):
# pylab.plot(
# t[i * 2 : i * 2 + 3],
# np.hstack([volt[0][i * 2 : i * 2 + 2], volt[0][i * 2 + 1]]),
# "b-",
# )
# pylab.plot(
# t[i * 2 : i * 2 + 2],
# np.hstack([volt[1][i * 2 : i * 2 + 1], volt[1][i * 2]]),
# "r-",
# )
pylab.ylim([-1, 6])
pylab.xlabel("t (s)")
pylab.ylabel("voltage (V)")
time_between_frames = t[np.argwhere(volt0_loop == vmin)][2]
time_between_frames = t[np.argwhere(volt0_loop == vmin)].squeeze()[2]
pylab.plot(time_between_frames * np.ones(2), [0, 5], "k")
pylab.show()
print(f"time_between_frames is set to {time_between_frames}s")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment