# Polynomial Modeling of Noise Figure in Erbium-Doped Fiber Amplifiers
## 4 Results and Discussion
### Computational Efficiency and Memory Usage of the Model
#### 4.7.1 Computational Efficiency  
A primary objective of the model is to ensure high time efficiency. As previously mentioned, this model is designed for integration into larger, more comprehensive EDFA models, rather than for standalone use. A fast model is less likely to become a performance bottleneck when incorporated into such systems. The time analysis is conducted using the timeit module, part of the standard Python 3 library. The first test involves the instantiation of the class and the initialization of the model:  
e = EDFA_NF() e.init_model(\"EDFA17_LOW_38\")  
The first line creates an instance of the class and calls the constructor, which initializes the internal attributes to their default values. The init_model function performs the following operations:  
1. checks if the models folder exists in the working directory; if not, an exception is raised;
2. attempts to retrieve the model file, using the name provided as a parameter, from the models folder, raising an exception if the file is not found;
3. uses the Pandas library to open the model's.parquet file and saves the model name and polynomial coefficients in two internal attributes. The next function to be tested is the single-value noise figure calculation method:  
nf = e.estimate_NF(p, g, t, f) where p, g, t, and f are four floating-point variables corresponding to the input parameters. This function performs the following operations:  
1. checks if the init_model function has been called and raises an exception if it has not;
2. calls the private __warnings method, which ensures that the input parameters are within the amplifier's operating limits, clamping the values if the corresponding flag is set; otherwise, it raises a warning;
3. runs the polynomial evaluation function. It is important to note that this calculation involves some overhead due to the input parameter checks, which may affect execution speed. Lastly, the performance of the function responsible for computing the noise figure across multiple values simultaneously is evaluated:  
nf = e.estimate_NF_array(p, g, t, f)Here, p, g, t, and f are NumPy ndarray objects, all of the same length. The calculation is performed element-wise, ensuring that all four input arrays are processed simultaneously while maintaining their respective dimensions. This function extends the operations of the single-value noise figure computation to an entire array, enabling efficient batch processing. The execution times, measured in ms, \(\mu\)s, and ns, are reported in Table 3. To facilitate a direct comparison with the single-value evaluation case, the execution times for array processing are normalized by the array length. It is immediately evident that the init_model method is significantly slower than the evaluation methods, primarily due to its file-reading operations. As a result, it is more efficient to use a single EDFA model for all computations and switch models only when necessary to estimate the noise figure for different devices. In scenarios requiring access to multiple models simultaneously, modifications to the library can be considered, such as storing several models within the class instance. This change would speed up operations but increase the memory footprint of the class instance. The init_model method takes approximately the same amount of time as 856 calls to the estimate_NF function, or a single call to the estimate_NF_array function with an array of roughly \(6.6\times 10^{4}\) elements. It is also noteworthy that the estimate_NF_array method is approximately 80 times faster than the estimate_NF method when evaluating per-element computation time with a large array length (in this case, the length was about \(2\times 10^{4}\)). On the other hand, the estimate_NF method is faster for single-element computations. Table 4 explores the threshold, determining the number of elements beyond which estimate_NF_array becomes faster than repeated calls to estimate_NF. Based on these results, we can conclude that the estimate_NF method is faster for array lengths up to approximately 33.