DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Data post-processing with Python in DIAdem 2021

Solved!
Go to solution

Hello everyone, 

 

I am currently trying to understand in which way I could automate the post-processing of some data comig from a test bench, with which I also need to do some calculations. I have been using DIAdem for only one month now and was looking into the possibility of writing a Python code to do this.

 

Unfortunately, I find it extremely hard to find documentation about it and cannot understand where to start, as I lack the knowledge of how I can make the Python script communicate with the data that are uploaded in DIAdeml, all I can find are examples in VBS, whihc does not really work for me.

 

Does anyone have any document or link to guides that explain about this?

 

Thanks a lot in advance

0 Kudos
Message 1 of 3
(864 Views)
Solution
Accepted by topic author ndrvzz

Hello ndrvzz,

 

In DIAdem 2021 version, Python was still very new, so not all the conveniences we know from VBScript were available, such as Intellisense in the SCRIPT module or support for user commands.

 

You can find information about Python in DIAdem in the help via the Index tab if you enter Python there.

 

In version 2021, events are not yet supported in Python, so the Navigator.Events.OnLoaded event can only be implemented in VBS. From DIAdem 2022 Q4, this is also possible with Python. This event could be used to implement post-processing of loaded data. In 2021, you can write a script that you call manually after loading data. This could look like this, for example.

 

def check_loaded_data():
    for group in dd.Data.Root.ChannelGroups:
        if group.Name == "Example" and not group.Channels.Exists("New channel"):
            chn = group.Channels.Add("New channel", dd.DataTypeChnFloat64)
            chn.Values[1] = 4711
            
check_loaded_data()
Message 2 of 3
(785 Views)

Hello,

 

First of all thanlks for the reply. I started looking a little bit into the help tab as you suggested and there are a lot of useful examples.

For me it also works to launch it manually, unfortunately my company only provides DIAdem 2021. What I was trying to have is exactly what is shown in the examples in the help tab, so thanks a lot 🙂

0 Kudos
Message 3 of 3
(756 Views)