From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Modifying "Creating a Python DataPlugin" Example

Hopefully this has a simple answer.

 

I am modifying the Python DataPlugin example from the example, "Creating a Python DataPlugin" example, and would like to populate the tdm_tree with as many channels that are in the file, rather than a fixed number, how can I do this?

 

The example loads 6 data channels, and my file has a varying number.  

 

Thanks!

Julia

0 Kudos
Message 1 of 2
(879 Views)

The TDM tree is just a python dictionary where channels is just a python array. 

 

self.tdm_tree = {
            "author": "National Instruments",
            "description": "Example file",
            "groups": [{
                "name": "Example",
                "description": "The first group",
                "time": datetime.datetime(2020, 2, 11, 15, 31, 59, 342380),
                "channels": [{
                    "name": self.channelNames[0],
                    "description": "",
                    "values": [],
                    "info": "Time in seconds",
                    "type": "DataTypeChnFloat64"
                }]
            }]
        }

So you can work on the structure using standard python mechanisms to extend and modify it.

Message 2 of 2
(854 Views)