Inspector Tool: Display Lists of Values for Debugging
Particularly for debugging purposes in the context of the development of sophisticated simulations, we often need to inspect not only a single value, but a whole list of values. For example, we may have to inspect many components of an array in order to track down the origin of some unexpected results. Although one can always insert some debugging code into a script in order to make it produce additional outputs (for example in the Output area, into a diagram or into a text file), it is often preferable to produce such output spontaneously after script execution – particularly if the execution has taken a longer while, so that you are not keen to repeat it.
The new feature is found in the form of a new tab in the Inspectors window, which you can call in the main menu with View | Inspectors or by pressing F12. Basically, you just have to enter two things there:
- a loop, defining a loop variable and some range of values through which it should go, and
- a list of expressions, separated with commas, the values of which you would like to be displayed (nicely formatted if you like).
Then you see the results nicely presented in a list:
In the shown example, I have listed the intensity values of the fundamental mode of a fiber for two different wavelengths in order to see how much difference that makes. This would be very tedious if you could only display one value at a time.
Some other nice features:
- The range of loop values may depend on variable values, if you like.
- You are free to display mathematically processed data – for example, the absolute values and phases of some complex values.
- You may enter a condition such that only those rows are displayed where that condition is fulfilled. That way you can search for unusual values, e.g. for locations in a fiber where the signal gain becomes negative.
- The shown quantities may be numerical or text. For example, display the warning “negative!” where a certain value becomes negative.
- If the calculation takes too long, you can abort it.
- You can copy the results in text form to the Windows clipboard.
- Your inputs are stored in the desktop file of your project folder, so that you can later do the same tests again, even if you closed the program in the meantime.
Other examples of possible applications of the new feature:
- You can check how the optical powers evolve within a fiber, or how ASE powers vary with wavelength.
- As mentioned above, you can use it for inspecting array values.
Those who already have a user license of the latest version can get a free update to get the new feature. Others may purchase a version upgrade – which did not become more extensive due to the new addition.
Questions and Comments from Users
Here you can submit questions and comments. As far as they get accepted by the author, they will appear above this paragraph together with the author’s answer. The author will decide on acceptance based on certain criteria. Essentially, the issue must be of sufficiently broad interest.
Please do not enter personal data here; we would otherwise delete it soon. (See also our privacy declaration.) If you wish to receive personal feedback or consultancy from the author, please contact him, e.g. via e-mail.
By submitting the information, you give your consent to the potential publication of your inputs on our website according to our rules. (If you later retract your consent, we will delete those inputs.) As your inputs are first reviewed by the author, they may be published with some delay.