Structuring Data Analyses
The most important task when analyzing data using FlexPro is to structure the analysis correctly, which means that the analysis problem should ideally be broken down into a network of analysis objects and formulas. Provided that you are working exclusively with the analysis objects provided by FlexPro, this structure is automatic. Just select the data set to be analyzed and choose an analysis object to obtain the relevant result. For instance, if you want to display the signal minimum and maximum in your document, create two analysis objects Statistical Quantity, one for the maximum and one for the minimum.
If, however, you use your own algorithms, i.e. formulas that you would like to program in FPScript, you should carefully plan this structure. The following elements are available to help you build your analysis network:
Analysis Object: If an analysis object is available for your analysis, it is recommended that you use it. Analysis objects have an advantage over conventional FPScript formulas in that you can set parameters via a dialog box.
Formula: Calculates a result that you would like to display or that you need for further calculations.
FPScript Function: Calculates a result for one or more arguments returned when calling the function.
To structure the analysis, use the following procedures:
1.First plan an analysis object or a formula per result that you would like to display.
2.Analyze each formula that you planned for multiple instances of code elements, which are completely identical and which calculate a single result in one of the FPScript data structures. For these types of code elements, create additional formulas whose results you then access in the formulas already present.
3.Now you can analyze your code for recurring elements that use different data, but otherwise have the same structure and calculate a single result in one of the FPScript data structures. For these types of elements, create FPScript functions that you call from existing formulas and that return the data to be included as arguments.
A carefully planned analysis should be as efficient as possible and should not have redundant code elements. Avoid redundant code elements by "outsourcing" them in separate formulas or FPScript functions. You can also achieve efficiency by avoiding unnecessary loops in the FPScript code.
Using the list data structure correctly
As described above, each formula should return as its result exactly one of the final results to be displayed. In rare cases, however, it is impossible to separate calculation of several results without considerable loss of efficiency. If an algorithm returns, for instance, several results, then in principle it is always possible to separate the calculation of the individual results by using the same algorithm in one formula for each result. However, this leads to repeated processing of the algorithm.
In the List data structure you can bundle any number of calculation results. The most frequent use of the list is for multichannel analyses. The same calculation is carried out for n channels and the result is a list with n elements. But you can also use lists for the case mentioned above:
1.Create a formula using the appropriate algorithm to calculate the results.
2.Return all results as a list data structure.
3.Name the elements of the list according to the calculated partial results.