Atmospheric refraction is the deviation of light or other electromagnetic wave from a straight line as it passes through the atmosphere due to the variation in air density as a function of height. This refraction is due to the velocity of light through air decreasing (the refractive index increases) with increased density. Atmospheric refraction near the ground produces mirages. Such refraction can also raise or lower, or stretch or shorten, the images of distant objects without involving mirages. Turbulent air can make distant objects appear to twinkle or shimmer. The term also applies to the refraction of sound. Atmospheric refraction is considered in measuring the position of both celestial and terrestrial objects. Astronomical or celestial refraction causes astronomical objects to appear higher above the horizon than they actually are. Terrestrial refraction usually causes terrestrial objects to appear higher than they actually are, although in the afternoon when the air near the ground is heated, the rays can curve upward making objects appear lower than they actually are. Refraction not only affects visible light rays, but all electromagnetic radiation, although in varying degrees. For example, in the visible spectrum, blue is more affected than red. This may cause astronomical objects to appear dispersed into a spectrum in high-resolution images. Whenever possible, astronomers will schedule their observations around the times of culmination, when celestial objects are highest in the sky. Likewise, sailors will not shoot a star below 20° above the horizon. If observations of objects near the horizon cannot be avoided, it is possible to equip an optical telescope with control systems to compensate for the shift caused by the refraction. If the dispersion is also a problem (in case of broadband high-resolution observations), atmospheric refraction correctors (made from pairs of rotating glass prisms) can be employed as well. Since the amount of atmospheric refraction is a function of the temperature gradient, temperature, pressure, and humidity (the amount of water vapor, which is especially important at mid-infrared wavelengths), the amount of effort needed for a successful compensation can be prohibitive. Surveyors, on the other hand, will often schedule their observations in the afternoon, when the magnitude of refraction is minimum. Atmospheric refraction becomes more severe when temperature gradients are strong, and refraction is not uniform when the atmosphere is heterogeneous, as when turbulence occurs in the air. This causes suboptimal seeing conditions, such as the twinkling of stars and various deformations