command line in a Panel
supra
My main interest is for arithmetic expression as I would love to use the parsing that igor does for such expression and execute afterthat.
I am curious to know how igor accept the command line input and process it ..is there any ipf file associated with this process or it is done completely internally.
One way that I handled something like this is to preface the command with an "escape code". For example, within a text field in a panel, typing %wave2 = wave1 + 5" calls the command via the Execute operation ... the code expands to Execute "wave2 = wave1 + 5"
You can find an example in the LogBook package ... http://www.igorexchange.com/project/LogBook
The code required is rather complicated and long. I suggest to start with a simple panel and input field, learn to capture the input, and learn to parse it to run via Execute.
I am curious though, since the command line is always readily available, where you might be going with this idea in the long run.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
July 12, 2012 at 07:29 pm - Permalink
(a) How actually after typing %wave2 = wave1 + 5" in a textbox I execute ( by Button) the code.
(b) For a existing XY data ( wave0 and wave1..) if I want to do wave3=wave1+wave2 where wave3 column till don’t exist yet and rather will be created by the operation..how I do that ?..usually as wave3 does not exist ...Igor gives error (wave does not exist) if I try this from command line.
July 17, 2012 at 07:34 pm - Permalink
Just like the curve fitting and smoothing dialog boxes, you will want a Destination control. Populate the control with the current waves (option to overwrite an existing wave) and add "New Wave" to the list. Whether you use a listbox or popup menu is up to you.
When the user selects "New Wave" you have two choices how to proceed. You can automatically name the wave based on existing wave names (be careful not to use an existing name). Alternatively you can use a SetVariable to allow the user to enter the name of the new wave (again checking to make sure the new name does not match an existing wave).
For simplicity, create the wave by using Duplicate (to ensure the correct number of data points).
July 18, 2012 at 04:55 am - Permalink
Perhaps then what you would want is to build something starting from this example experiment. It has a panel to do allow you to do simple math functions on traces in a graph. The result is returned directly to the trace selected. It makes use of shorthand notations "wave += X" ,"wave -= X", "wave *= X", or "wave /= X" to do the math operations.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
July 18, 2012 at 05:42 am - Permalink
I will try to incorporate this in my code and will come back later to say how it works...Thank you so much to both of you.
July 18, 2012 at 07:36 pm - Permalink
FWIW, the File : Example Experiments : Analysis : Wave Arithmetic Panel Demo may also contain much of what you want.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
July 19, 2012 at 07:53 am - Permalink