Get all waves in all data folders.
_sk
I am wondering what is the appropriate way to get all variables in all data folders through an XOP. Right now the only way that I understand something like this could be done is to traverse through the datafolder tree and issue
WaveList
as traversing.Further, is there a public hook that will get called after a numeric or string variable, wave, or datafolder is created, i.e. something like
AfterCompiledHook
but for data, AfterDataAddedHook
(?) or something like that?Thanks!
best,
_sk
I don't believe there's any hook that matches what you're looking for. Even the Igor 7 data browser (which is built-in) has to go to somewhat great lengths to get this information.
March 20, 2017 at 11:21 am - Permalink
Can dependency formulas help in getting notified? I've only ever used them for getting notified if a wave changes, but maybe the same is also possible for getting a notifcation on a datafolder content change.
Alternatively if the check is quick you might be able to cheat and do the check regularly in the IDLE_EVENT.
March 20, 2017 at 04:40 pm - Permalink
Thanks. I don't know how Igor is written, but there has to be heap allocation for all of these variables (read, generic code, as in: variables, strings, waves, datafolders, functions, operations). The moment of allocation may be a good point to put a hook. Another good point would be on refcount clean or general garbage collection. Admittedly, I don't have an idea how other platforms do it (i.e. matlab).
This sounds interesting. Thanks for mentioning it. Otherwise, I am just trying to collect the data of a folder and sub-datafolders for an experiment and check when it updates.
best,
_sk
March 21, 2017 at 01:50 am - Permalink
Otherwise, I am just trying to collect the data of a folder and sub-datafolders for an experiment and check when it updates.
Is it your code which updates the experiment data? If yes, the easiest thing would be to just call a XOP function passing the folder with new data, or?
March 21, 2017 at 05:08 am - Permalink
I wanted to be able to combine the changes to a datafolder made in Igor with the changes made in an XOP. That's why I wanted to know the state of the datafolder and the data in Igor and expose this state in the XOP. But with no way of knowing when data updates/gets created it will be pretty hard.
March 21, 2017 at 07:50 am - Permalink
There's no documented way for an XOP to monitor whether the contents of a data folder have changed.
On a related point, if you happen to figure out a way to do this, make sure that you store a data folder ID number, not a DataFolderHandle. See GetDataFolderByIDNumber and GetDataFolderIDNumber in the XOP toolkit.
March 21, 2017 at 09:05 am - Permalink
I figured out how to do it. Thanks for the help ;-)
March 22, 2017 at 01:23 am - Permalink
Sure thing. Just remember that sometimes things are undocumented for a reason!
March 22, 2017 at 08:04 am - Permalink
What reason do you have in mind for not documenting this feature?
best,
_sk
March 22, 2017 at 01:21 pm - Permalink
It was added specifically for the Data Browser, which prior to Igor 7 was an XOP. Starting with Igor 7, the Data Browser is built in, so there is no need for this and therefore it is entirely untested and unused.
It's quite difficult for XOP code to handle changes to objects correctly and keep themselves updated without crashing or negatively affecting performance (or both). We'd prefer to keep Igor stable and performant vs. supporting a feature like this that has very little demand.
March 22, 2017 at 01:38 pm - Permalink
I understand. Thank you very much for sharing this.
best,
_sk
March 22, 2017 at 01:45 pm - Permalink