In detecting presence of a gas, light passes through a photonic crystal
cavity configured to sample a gas and receive light. The light has a
wavelength that at least partially falls within a specific absorption
wavelength of the gas. At least one parameter of a band gap spectrum is
generated from at least a portion of the light passing through the
photonic crystal cavity. In generating the at least one parameter, a
numerical simulation is performed within a frequency range of the
photonic crystal cavity to generate a set of spectral response data
points, rational function interpolation is performed on the set of
spectral response data points to generate a spectral response, and at
least one parameter is determined from the spectral response. The at
least one parameter is compared with stored parameters of band gap
spectrums, wherein a match indicates a presence and/or concentration of
the gas.