## 3 Results and Discussion
### Responses and Optimization
#### 3.1.2 Device Performance  
Sensitivity and figure of merit (FOM) are two important parameters used to quantify the optical sensor's performance and to allow comparison with other sensing technologies. The sensitivity is defined as the shift of the optical response with respect to the change in a given environmental parameter. The optical response, related to reflection, absorption and transmission, could be used to sense environmental parameters, as concentration, color or temperature. In this contribution, we aim to sense the change in refractive index of the medium in contact with the nanostructured grating and the metallic layer, for example due to exposure of a gas. If we use optical interrogation, the sensitivity is defined as the shift in the wavelength of the reflection dip caused by refractive index change [27; 28]:  
\[S_{B}=\frac{\Delta\lambda}{\Delta\eta}, \tag{2}\]  
Figure 4: (**a**) Effect of the period of the grating \(P\), on the wavelenght of resonance. The resonant wavelength is proportional to the period of the dielectric grating \(P\). (**b**) Effect of the thickness of the metal layer on the spectral relevance of the SPR. The optimum thickness, \(t_{\text{Ag}}=50\) nm, is plotted as a dashed line. where \(S_{B}\) is the sensitivity and \(\Delta\lambda\) is the wavelength shift due to refractive index change \(\Delta n\). The associated figure of merit (FOM) will be [27; 28]:  
\[\text{FOM}=\frac{S_{B}}{\text{FWHM}}, \tag{3}\]  
where FWHM is the full width at half maximum of the reflection response line. Our goal is to optoelectronically interrogate the device. Therefore, we need another opto-electrical term that is the responsivity, \(\mathcal{R}\), which is defined as [29]:  
\[\mathcal{R}_{S}(\lambda)=\frac{I_{\text{photo}}}{P_{\text{input}}(\lambda)}, \tag{4}\]  
where\(I_{\text{photo}}\) is the ideal photo-generated current, and \(P_{\text{input}}(\lambda)\) is the incident light power that is delivered by a tunable source. The ideal photo-generated current could be optically calculated as in our previous work [20; 21]. The sensitivity and FOM will be calculated using Equations (2) and (3), but the wavelength shift will be for the reponsivity dip instead of the reflectivity dip to replace the optical interrogation with an opto-electronic one. The responsivity of the optimized device is very narrow in wavelength due to the SPR resonance coupled to the absorption in the active layer, we plot the responsivity for different values of refractive index in Figure 5a, ranging from 1 to 1.1, which represents an air medium that is perturbed by some external mechanism (change in concentration, temperature, composition, etc.). The decrease in responsivity when \(n_{a}\) increases is caused by our optimization procedure that maximized the absorption at the perovskite active layer for a value of \(n_{a}=1.0\). Therefore, if the index of refraction of the analyte changes, the design is no longer optimum and the effect is a lower responsivity. Due to their origin as plasmonic resonances, the spectral responsivity can be fitted to Lorentzian lineshapes. An important result of this fitting is the FWHM of the resonance. We have found that FWHM varies from 0.54 nm to 0.68 nm, reaching its minimum value when \(n_{a}=1.1\). After evaluating these parameters we can obtain the Sensitivity, \(S_{B}\), and the FOM using Equations (2) and (3). These calculations provide a maximum sensitivity of \(S_{B,\text{max}}=546\) nm/RIU and a \(\text{FOM}_{\text{max}}=1005\) RIU\({}^{-1}\)obtaining both maxima for an index of refraction of \(n_{a}=1.1\). The minimum values of these parameters along the studied range of the index of refraction are \(S_{B,\text{min}}=490\) nm/RIU (at \(n_{a}=1.0\)), and \(\text{FOM}_{\text{min}}=715\) RIU\({}^{-1}\) (at \(n_{a}=1.03\)). The resonance wavelength, which shift when the refractive index change, is nearly linear as seen from Figure 5b and the linear fitting provides a value of \(S_{B,\text{linear}}=513\) nm/RIU.