Animating FRED Results

Many FRED analysis tasks involve some sort of parameterized scan through a set of system configurations and I have found that compiling FRED results as an animated image set is particularly useful for conveying the dynamic behavior of the system output. At the time of this writing, FRED doesn’t have the capability to save analysis data directly to image files, so I will describe a series of steps that I use to convert calculations performed in FRED into animated GIF files that can be used in presentations. This series of steps is not performed entirely within FRED, however, so you may need to substitute what is described with equivalent capability.

Step 1.

Using FRED’s BASIC scripting language the analysis script is written so that on each iteration of the scan, the commands IrradianceToARN and ARNWriteToFile are used to write the calculation result to an *.fgd file. Note that you should replace IrradianceToARN with the equivalent command of whatever calculation you are attempting to run. The *.fgd file format is ASCII, which means that you can open it in another program for parsing. Generally, I will structure my FRED script so that the *.fgd files are all written to a unique directory where there are no other files present.

Step 2.

Using another scripting language, such as Python, which has access to functionality that can take a grid of data values and convert them to image files, we process all of the *.fgd files in the directory from Step 1 and write them back out as PNG files. This could be done just as easily in a program like Matlab if you have access to it. For Python aficionados, I have been using NumPy and Matplotlib (which, combined, behave in a Matlab-esque manner) for the implementation.

Step 3.

Lastly, I use ImageMagick to take the listing of PNG files from Step 2 and convert them into an animated GIF with a custom frame delay.  The call to ImageMagick can be rolled into Step 2 or can be called from the command line using the format below as long as you are in the current directory of your FGD files.

<path to imagemagick>\convert.exe -delay 25 *.png output.gif

For those interested in taking the Python approach, I have attached the Python script below.

Still need help? Contact Us Contact Us