An optical sensor comprises at least two planar Bragg gratings defined on
a single substrate and arranged to receive light from a light source,
each grating having a wavelength filtering response that varies with an
effective modal index experienced by light propagating in the Bragg
grating and a Bragg wavelength different to those of the other gratings,
and at least one sample window overlying one or more of the gratings that
can receive a sample of fluid that affects the effective modal index and
response of the grating, the gratings filtering the light and outputting
the filtered light for spectral analysis, from which the refractive index
and related properties of the fluid can be determined. One or more of the
gratings can be a reference grating used to compensate for temperature
and other disturbances to the sensors. Gratings may have individual
sample windows for testing separate fluid samples, or may share a common
window so that a single fluid can be tested using several gratings.