Hello,
I'm trying to combine multiple streamed matrix outputs (1 dimensional classifier probabilities outputs) into a single stream to process them all from a python scripting box.
I'm actually using a Streamed matrix multiplexer box with 10 inputs, and all the probability matrices are received at the exact same date.
I wonder if there is a guarantee that, in this case, the streamed matrices coming out the multiplexer will be sent in an order that depends on the input numbers they come from ... maybe that's the case (this would make sense) but I didn't fully understand the documentation ?
My intention is rather to concatenate them than to treat them in sequence, but the Signal merger doesn't take streamed matrices as input, so I'd like to rely on the multiplexer's output order to know where each matrix comes from.
If that's not the case, I could eventually create a python box with 10 inputs instead of just 1 and deal with this from the script, but I'd rather use native boxes, so any insight is welcome !
Cheers,
Joseph
Streamed matrix multiplexer output order
Re: Streamed matrix multiplexer output order
Hi,
The streamed matrix multiplexer sends your multiple inputs in a single stream. The only limitation is the dimension of your streams which must be identical. If you have several inputs on the same date, they will come out in the order of the inputs on N lines (you can see with a csv).
Thibaut
The streamed matrix multiplexer sends your multiple inputs in a single stream. The only limitation is the dimension of your streams which must be identical. If you have several inputs on the same date, they will come out in the order of the inputs on N lines (you can see with a csv).
Thibaut
Re: Streamed matrix multiplexer output order
Hello Thibaut,
Thanks for the confirmation !
I asked this because I'm mostly used to Pure Data and Max/MSP visual programming paradigms, where there is always an order of arrival in an object's inputs, even if they occur on the same clock tick.
As all my signals that trigger classifier outputs originate from a single source dispatched on multiple channel selectors, I was thinking that maybe the ordering would depend on something in there, or maybe on the order of creation of the Time based epoching boxes (Pure Data and Max have some ordering policies for this kind of use cases, and provide dedicated objects to disambiguate them)
Glad to hear the Streamed matrix multiplexer box works as I need it to
Cheers,
Joseph
Thanks for the confirmation !
I asked this because I'm mostly used to Pure Data and Max/MSP visual programming paradigms, where there is always an order of arrival in an object's inputs, even if they occur on the same clock tick.
As all my signals that trigger classifier outputs originate from a single source dispatched on multiple channel selectors, I was thinking that maybe the ordering would depend on something in there, or maybe on the order of creation of the Time based epoching boxes (Pure Data and Max have some ordering policies for this kind of use cases, and provide dedicated objects to disambiguate them)
Glad to hear the Streamed matrix multiplexer box works as I need it to
Cheers,
Joseph
Re: Streamed matrix multiplexer output order
Hi again,
So I've been using the streamed matrix multiplexer with success, but after giving a closer look back at the output, it seems that one of the input streams is always one output late, maybe because it has a slightly different date and gets buffered for the next output ...
Anyway I ended up writing a python script to handle it differently : when each input has received one matrix, everything is sent to the output in the right order, regardless of the chunk dates. This approach is very specific to my use case, but it fixes my delayed input problem.
Here it is :
So I've been using the streamed matrix multiplexer with success, but after giving a closer look back at the output, it seems that one of the input streams is always one output late, maybe because it has a slightly different date and gets buffered for the next output ...
Anyway I ended up writing a python script to handle it differently : when each input has received one matrix, everything is sent to the output in the right order, regardless of the chunk dates. This approach is very specific to my use case, but it fixes my delayed input problem.
Here it is :
Code: Select all
class MyOVBox(OVBox):
def __init__(self):
OVBox.__init__(self)
def initialize(self):
self.inputCopy = [0 for _ in range(len(self.input))]
self.count = 0
def process(self):
for i in range(len(self.input)):
for j in range(len(self.input[i])):
chunk = self.input[i].pop()
if type(chunk) == OVStreamedMatrixHeader:
self.inputCopy[i] = chunk
self.count = self.count + 1
elif type(chunk) == OVStreamedMatrixBuffer:
self.inputCopy[i] = chunk
self.count = self.count + 1
if self.count == len(self.input):
self.count = 0
for i in range(len(self.input)):
self.output[0].append(self.inputCopy[i])
def uninitialize(self):
pass
box = MyOVBox()
Re: Streamed matrix multiplexer output order
Hi Joseph,
Thanks for keeping us updated and sharing you code!
Cheers,
Thomas
Thanks for keeping us updated and sharing you code!
Cheers,
Thomas