Inspector Tool: Display Lists Of Values For Debugging
I have just implemented a nice user interface feature in the Inspectors window, which you find in the latest versions of our products RP Fiber Power, RP Resonator, RP Coating and RP ProPulse.
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.
This article is a posting of the RP Photonics Software News, authored by Dr. Rüdiger Paschotta. You may link to this page, because its location is permanent.
Note that you can also receive the articles in the form of a newsletter or with an RSS feed.
Share this with your friends and colleagues, e.g. via social media:
These sharing buttons are implemented in a privacy-friendly way!