Propagating updated value of Filename Property Source

72 views
Skip to first unread message

Vincent Prevosto

unread,
Oct 24, 2019, 4:19:18 PM10/24/19
to Bonsai Users
Hi,
I'm looking for some documentation on Property Source created from a node. The most detailed explanation I found is here but doesn't help the issue I have.
When creating a Filename Property Source node, by default it keeps the initial filename it was were created with.
To update and propagate that value, one can connect it upstream of the source node, e.g.:
My issue is how to propagate the updated name to other nodes. When connecting it to a CSVwriter via an externalized property node, the output .csv file may retain the old filename, even though the Fieldname field shows the proper filename! I don't know where the aberrant behavior comes from, but it's quite puzzling.
For the moment, I'll keep on using a ReplaySubject node to perform this function, but I think a Property Source would be simpler, if it works.
Thanks

Gonçalo Lopes

unread,
Oct 31, 2019, 9:59:40 PM10/31/19
to Vincent Prevosto, Bonsai Users
Hi Vincent,

If I understand the context of the question correctly, the behavior you are seeing is due to the behavior of branching in Bonsai, and not because of the PropertySource. To clarify, if you need to initialize the FileName of multiple CsvWriters and other nodes, you need to provide the name right at the beginning when they are initialized. By branching, propagation gets delayed until everyone is subscribed to the source, which is already too late for some of the inputs.

Using the ReplaySubject or AsyncSubject is fine for this, and even allows you to transform file names as they get propagated to their multiple targets.

The reason for the PropertySource is really to have a way to explicitly construct values that would fit into specific properties, while deciding exactly when / if they will be propagated. To explain, when you externalize a property, the only thing you can do is you either write to it or not. You can feed multiple inputs to create an ROI for the Crop node for example, but you can't just create the Rect structure somehow, hold on to it, and then propagate it later.

The PropertySource was created to solve this problem. Basically it allows you to feed input to it exactly as you would do to an externalized property, but then you actually have a value, which you can use to do whatever you want. The applications are quite broad, and it gets very useful in situations where for example you would need to create an ROI for Crop, but then also send it somewhere for further processing.

Let me know if the explanation makes sense. I'm hoping to write all these new features down in the near future.

--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/328bb661-0d51-4a4e-ba93-b6a368cbaff6%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages