01-30-2019 10:47 AM
Hi,
I am stuck by a certain problem, I do not know how to solve it and I would like to ask you what is the best way to solve it.
I have a script which evaluates data but needs a visual check from a user (because of huge variations of data by data). Attached figure shows two curves: red and green. Red represents el. signal and green should show where the rise of the red curve ends (by a value of 1, otherwise it is 0). The green curve position needs to be visually checked by the user and if the green curve is at wrong position (like it is at the attached figure), the user should be able to input a value by how much the green curve needs to be shifted from the perspective of x-axis. The process of shifting the green curve needs to repeat till the user is satisfied with the green curve position.
Do you know any way how to solve this?
Thank you for any help
With regards
Radomir Kalinay
Solved! Go to Solution.
01-30-2019 12:45 PM
Have you tried creating a GUI in DIAdem? You can plot the 2 curves in a dialog box, have a control for the user to shift the green curve and replot the curves until satisfied. I could potentially help you get started on that if you never made dialog boxes before and you are interested in this solution.
01-31-2019 03:48 AM
Hi,
thanks for reply.
If you would be willing to help me with that I would very appreciate it. Do you have any example you can share?
I actually tried to create a GUI, but wasn't really successful. I was not able to transfer variables by using GetArgument and I was not able to change the range of x axis of a plot. Do you know how to solve this issues?
Thanks
Radomir
02-01-2019 09:48 AM
I attached an example SUD and an example tdms file that you can potentially build on. You can select the time, signal, and digital channels and use the "-1" and "+1" keys to shift the digital channel
02-07-2019 05:43 AM
Hi,
thank you very much for your effort, appreciate it. However, I can't open it, a dialog window saying that the file is invalid pops out.
My version of DIAdem is 2015, can this be a problem?
Thanks
Radomir
02-07-2019 12:06 PM
I use version 2017. I will paste the code of the SUD so you can copy it. You will have to create a new dialog box with the same elements and rename a few of them:
Curve2DPreview: PlotArea
Button: MinusOne
Button: PlusOne
ChnListBox: DigitalChannelSelect
ChnListBox: SignalChannelSelect
ChnListBox: TimeChannelSelect
Option Explicit 'Forces the explicit declaration of all the variables in a script. 'Note: In this area area you can program auxiliary variables and functions that you can use in the entire dialog box. Sub SignalChannelSelect_EventChange(ByRef This) 'Created Event Handler Call PLOT() End Sub Sub DigitalChannelSelect_EventChange(ByRef This) 'Created Event Handler Call PLOT() End Sub Sub TimeChannelSelect_EventChange(ByRef This) 'Created Event Handler Call PLOT() End Sub Sub PLOT() If Not SignalChannelSelect.Selection = -1 And Not DigitalChannelSelect.Selection = -1 And Not TimeChannelSelect.Selection = -1 Then Call PlotArea.Curves.RemoveAll() Set signalChnl = Data.GetChannel(SignalChannelSelect.Items().Item(SignalChannelSelect.Selection).Text) Set digitalChnl = Data.GetChannel(DigitalChannelSelect.Items().Item(DigitalChannelSelect.Selection).Text) Set timeChnl = Data.GetChannel(TimeChannelSelect.Items().Item(TimeChannelSelect.Selection).Text) Call PlotArea.Curves.Add(timeChnl.GetReference(eRefTypeIndexIndex), signalChnl.GetReference(eRefTypeIndexIndex)) Call PlotArea.Curves.Add(timeChnl.GetReference(eRefTypeIndexIndex), digitalChnl.GetReference(eRefTypeIndexIndex)) Call PlotArea.Refresh() End If End Sub Dim signalChnl, digitalChnl, timeChnl Sub Dialog_EventInitialize(ByRef This) 'Created Event Handler TimeChannelSelect.Selection = 1 SignalChannelSelect.Selection = 2 DigitalChannelSelect.Selection = 3 Set signalChnl = Data.GetChannel(SignalChannelSelect.Items().Item(SignalChannelSelect.Selection).Text) Set digitalChnl = Data.GetChannel(DigitalChannelSelect.Items().Item(DigitalChannelSelect.Selection).Text) Set timeChnl = Data.GetChannel(TimeChannelSelect.Items().Item(TimeChannelSelect.Selection).Text) Call PLOT() End Sub Sub PlusOne_EventClick(ByRef This) 'Created Event Handler Call digitalChnl.SetValues(0, 1, 1, eValueBlockValueInsert) Call PLOT() End Sub Sub MinusOne_EventClick(ByRef This) 'Created Event Handler Call DataBlDel(digitalChnl, 1, 1) Call PLOT() End Sub
02-08-2019 02:59 AM
Hi,
thank you very much for sharing the script with me. It helps me a lot.
With regards
Radomir