Method for analyzing a sample, the sample being liable to comprise an analyte, the sample lying on a resonant holder, the resonant holder comprising a surface on which lie a plurality of photonic crystals (16 k, 16 k+1), which are separate from one another, such that the sample lies between a light source and the photonic crystals, the photonic crystals being such that: - one resonant wavelength (λ k) is associated with each photonic crystal (16 k), the resonant wavelengths of the photonic crystals defining a spectral range of resonance (Δλ r), lying between 2 μm and 20 μm; - the transmission or reflection of light by each photonic crystal is maximum at the resonant wavelength associated with it; the method comprising the following steps: a) illuminating the resonant holder with the light source, the light source emitting an illuminating light wave that defines a spectral band of illumination (Δλ) that at least partially covers the spectral band of resonance (Δλ r), such that a plurality of photonic crystals are simultaneously illuminated; b) acquiring, with an image sensor, an image of the resonant holder, which image is referred to as the measurement image, the image comprising different regions of interest (ROI k), each region of interest being optically coupled to one photonic crystal (16 k) such that each region of interest represents an intensity transmitted or reflected by each photonic crystal (16 k), while the resonant holder is illuminated; then determining whether the analyte is present in the sample on the basis of the measurement image; the method being characterized in that each photonic crystal comprises: - first holes (23 1) that are formed in a thin layer and that have a first dimension (R 1), the first dimension being a radius or a diagonal, the first holes defining a first periodic pattern; - second holes (23 2) that are formed in the thin layer and that have a second dimension (R 2), the second dimension being strictly smaller than the first dimension, the second holes defining a second periodic pattern; - the second pattern and the first pattern are offset with respect to each other, parallel to the surface of the resonant holder, by a spatial offset (δ), the spatial offset being variable between at least two different photonic crystals; such that the resonant wavelength (λ k) associated with each photonic crystal (16 k) depends on the first dimension, on the second dimension, and on the spatial offset. - one resonant wavelength (λ k) is associated with each photonic crystal (16 k), the resonant wavelengths of the photonic crystals defining a spectral range of resonance (Δλ r), lying between 2 μm and 20 μm; - the transmission or reflection of light by each photonic crystal is maximum at the resonant wavelength associated with it; the method comprising the following steps: a) illuminating the resonant holder with the light source, the light source emitting an illuminating light wave that defines a spectral band of illumination (Δλ) that at least partially covers the spectral band of resonance (Δλ r), such that a plurality of photonic crystals are simultaneously illuminated; b) acquiring, with an image sensor, an image of the resonant holder, which image is referred to as the measurement image, the image comprising different regions of interest (ROI k), each region of interest being optically coupled to one photonic crystal (16 k) such that each region of interest represents an intensity transmitted or reflected by each photonic crystal (16 k), while the resonant holder is illuminated; a) illuminating the resonant holder with the light source, the light source emitting an illuminating light wave that defines a spectral band of illumination (Δλ) that at least partially covers the spectral band of resonance (Δλ r), such that a plurality of photonic crystals are simultaneously illuminated; b) acquiring, with an image sensor, an image of the resonant holder, which image is referred to as the measurement image, the image comprising different regions of interest (ROI k), each region of interest being optically coupled to one photonic crystal (16 k) such that each region of interest represents an intensity transmitted or reflected by each photonic crystal (16 k), while the resonant holder is illuminated; then determining whether the analyte is present in the sample on the basis of the measurement image; the method being characterized in that - first holes (23 1) that are formed in a thin layer and that have a first dimension (R 1), the first dimension being a radius or a diagonal, the first holes defining a first periodic pattern; - second holes (23 2) that are formed in the thin layer and that have a second dimension (R 2), the second dimension being strictly smaller than the first dimension, the second holes defining a second periodic pattern; - the second pattern and the first pattern are offset with respect to each other, parallel to the surface of the resonant holder, by a spatial offset (δ), the spatial offset being variable between at least two different photonic crystals;