Curiosity’s Mars Hand Lens Imager (MAHLI) Investigation

The Mars Science Laboratory (MSL) Mars Hand Lens Imager (MAHLI) investigation will use a 2-megapixel color camera with a focusable macro lens aboard the rover, Curiosity, to investigate the stratigraphy and grain-scale texture, structure, mineralogy, and morphology of geologic materials in northwestern Gale crater. Of particular interest is the stratigraphic record of a ∼5 km thick layered rock sequence exposed on the slopes of Aeolis Mons (also known as Mount Sharp). The instrument consists of three parts, a camera head mounted on the turret at the end of a robotic arm, an electronics and data storage assembly located inside the rover body, and a calibration target mounted on the robotic arm shoulder azimuth actuator housing. MAHLI can acquire in-focus images at working distances from ∼2.1 cm to infinity. At the minimum working distance, image pixel scale is ∼14 μm per pixel and very coarse silt grains can be resolved. At the working distance of the Mars Exploration Rover Microscopic Imager cameras aboard Spirit and Opportunity, MAHLI’s resolution is comparable at ∼30 μm per pixel. Onboard capabilities include autofocus, auto-exposure, sub-framing, video imaging, Bayer pattern color interpolation, lossy and lossless compression, focus merging of up to 8 focus stack images, white light and longwave ultraviolet (365 nm) illumination of nearby subjects, and 8 gigabytes of non-volatile memory data storage.

Location of MAHLI hardware aboard the Mars Science Laboratory rover, Curiosity, in the Spacecraft Assembly Facility, Jet Propulsion Laboratory, Pasadena, California, on 3 June 2011. This is a portion of NASA/JPL-Caltech photograph PIA14255. Note people for scale elements: a camera head, a digital electronics assembly (DEA), and a calibration target (Fig. 1). The camera head is mounted on the turret at the end of Curiosity's 2 meterslong robotic arm , the DEA is housed inside the rover's environmentcontrolled body (Bhandari et al. 2005), and the calibration target is mounted on the robotic arm shoulder azimuth actuator. Table 1 summarizes the characteristics of the MAHLI instrument. For reference, Table 2 lists Curiosity's instruments and tools. MAHLI can be focused on any target at which the robotic arm can point the camera, as long as the subject is more than ∼2.1 cm away. At the minimum working distance (the range between the camera's front lens element and the subject), a MAHLI image pixel covers an area of about 14 × 14 µm and a 1600 by 1200 pixels image covers about 2.24 cm by 1.68 cm.
Because of its focus capability, MAHLI can acquire images of a subject at multiple distances and resolutions. It can be used, for example, to acquire a suite of nested images by pointing the camera at the same location and collecting images at different distances by moving the robotic arm; such a suite provides context for the highest resolution views. Alternatively, the camera position can be fixed and the focus changed, inside the camera lens, to provide a stack of images that step through the subject's depth of field. Focused at infinity, the camera can be used to take pictures of the Martian landscape, even when the robotic arm is stowed. MAHLI data can be acquired during the day or at night. Night imaging uses white or longwave (365 nm) ultraviolet illumination. Mosaics and stereopairs of MAHLI images are obtained by moving the robotic arm to multiple, overlapping positions. Users have options for autofocus, auto-exposure, image sub-framing, image compression, onboard focus stack merging, and low frame rate high definition video (720p at ∼1.9 frames per second).   video acquisition description modes acquire and store single image frames or acquire and immediately compress into GOPs (Groups of Pictures) frame rate maximum limited by signal transmission rate between camera head and DEA to <2 Hz compression frames stored individually are treated the same as individual non-video images; GOPs are JPEG-compressed video Group of Pictures (GOP) JPEG-compressed color-interpolated GOPs, up to 2 megabyte file size and up to 16 frames per GOP; commandable color subsampling and compression quality deferred compression image stored onboard MAHLI uncompressed; specified compression performed at a later time for transmission to Earth stereo pair acquisition stereo pair acquisition requires use of software planning tools and robotic arm motion to position the camera head at two locations of user-selected stereo baseline (distance between the two overlapping images); a short rover drive could permit stereo acquisition for a distant target; choice of stereo baseline is dependent on science or engineering objective at a given target mosaic acquisition mosaic acquisition requires use of software planning tools and robotic arm motion to position the camera head at each image location; motion of the turret (only) or short rover drives could also be used to produce mosaics for a distant target or scene onboard focus merge description products best focus image (color) and range map (grayscale) maximum input image size 1600 × 1200 pixels; input images must be same size maximum number of input images 8 images of 1600 × 1200 pixels input image compression raw, uncompressed (no color interpolation) output image compression JPEG with user-specified compression quality processing options merge, registration (feature tracking + corner detection), blending (spline-based) image thumbnails description size approximately 1/8th the size of the parent image; size in whole number multiples of 16 (thus, a 1600 × 1200 pixels parent image yields a 192 × 144 pixels thumbnail) purpose provides an index of images acquired by and stored onboard instrument; returned to Earth, often in advance of parent image, for evaluation and decision-making about on-Mars event success, data downlink compression and priority compression commandable compressed or uncompressed; typical thumbnails from Mars will be 4:4:4 color JPEGs; commandable compression quality video Group of Pictures (GOP) one thumbnail per GOP, derived from first image in GOP  The main attraction at Gale is the ∼5 km high Aeolis Mons (Mount Sharp). This mountain is thought to be a remnant of a formerly more extensive geologic unit. Like the similarsized crater Miyamoto that is partly buried beneath the eolian sandstones of Meridiani Planum (Edgett 2005;, Gale is of the family of Martian craters that were filled and buried or partly filled, and later exhumed or partly exhumed (Malin and Edgett 2000).
Based on estimates of impact crater retention per unit area on terrain inside Gale and on its primary ejecta blanket, the Gale-forming impact was interpreted by Thomson et al. (2011) to have occurred ∼3.8 billion years ago, with strata comprising Mount Sharp perhaps deposited during the subsequent 200-300 million years. If this interpretation is correct, then strata in the lower part of the mountain would date to a time corresponding with the earliest-and sometimes disputed-records of life on Earth (Mojzsis et al. 1996;Altermann and Kazmierczak 2003;Brasier et al. 2006;Schopf 2006).
At the broadest scale, images acquired from orbit show Mount Sharp to be composed of at least two major stratal packages (with several subdivisions therein) separated by a distinct erosional unconformity (Malin and Edgett 2000;Anderson and Bell 2010). Layers in the lower unit are nearly flat lying and were likely once more extensive across the interior of Gale (Milliken et al. 2010). Canyon-forming fluvial processes eroded the lower package before materials of the upper package were deposited. Both the upper and lower units exhibit evidence of subsequent wind and mass movement erosion. Given that streams did not  • S, 222.7 • W, this is the area in which the rover is anticipated to spend considerable time examining rocks, regolith fines, and stratigraphic relations. The interpretations regarding clay-, sulfate-, and olivine-bearing materials are from Milliken et al. (2010). The interpretation of a filled stream channel is from Malin and Edgett (2000). Topography slopes downward by several kilometers from the lower right toward upper left. North is up erode the upper unit, it is possible that the stratigraphy of Mount Sharp records the ultimate transition of Mars from wetter to drier environments over time.
The lower and upper stratal packages appear to differ, as well, in terms of mineralogy, at least to within the limitations of what can be interpreted from orbiting spectrometer data. Observations from near-infrared imaging spectroscopy suggest that the lower package consists largely of sulfate-bearing rocks with some clay-bearing materials interbedded with them over a portion of the stratigraphic interval ( Fig. 3; Milliken et al. 2010). Additional observations from combined visible, near infrared, and thermal infrared spectra suggest that materials associated with the mound (e.g., strata in the mound, material shed from these strata, or alteration products) also include iron oxides and unaltered pyroxenebearing and olivine-bearing material (Rogers and Bandfield 2009;Milliken et al. 2010;Anderson and Bell 2010). Interpretation of the mineralogy of the upper stratal package is limited because either dust mantles the outcrops, the rocks are composed of lithified dust, the rocks are composed of another material that cannot be identified from infrared spectra, or some combination of these (Milliken et al. 2010). Because some of the material that may have been shed from Mount Sharp is pyroxene-bearing (Milliken et al. 2010;Anderson and Bell 2010), it is reasonable to speculate that some of the upper stratal package might include relatively unaltered, pyroxene-bearing rocks. The strata exposed in Mount Sharp are interpreted to be sedimentary, although this term is, necessarily, inclusive of primary tephra falls because they would not be distinguishable from sediments in images acquired from orbit (Malin and Edgett 2000). No definitive, unambiguous volcanic landforms occur in Gale; the nearest volcanic landforms are lava plains north of the dichotomy boundary. The volume of material comprising Mount Sharp far exceeds the likely volume of material eroded from the central peak, walls, and rim of Gale. Thus-like filled and buried impact craters on Earth (e.g., Puura and Suuroja 1992;Poag et al. 2002;Schieber and Over 2005)-the majority of these materials must be clasts that originated elsewhere (outside the crater) or formed in situ as precipitates from fluids (e.g., water) that came into the crater from elsewhere.
The presence of Mount Sharp and its 5 km of stratigraphic section tell us two very important things about this location: (1) Long ago, Gale was a net sediment sink.
(2) Later, Gale became (and might still be) a net sediment source.
After the Gale-forming impact occurred, there was a period of time during which this ∼5 km-deep basin was a net sedimentary sink. Assuming some or most of the material was clastic, some grains might have arrived by overland transport in streams or by eolian saltation and traction; some-perhaps the majority-would have settled out of atmospheric suspension. Minor amounts might have arrived as meteor falls or by ballistic emplacement of material ejected by impact events. When those clasts arrived, conditions in Gale were such that the grains did not leave. They accumulated and became cemented to form rock. Some time later, the situation changed. Gale went from having environments conducive to net trapping and retention of sediment to environments in which there was a net exodus of fragmented rock and liberated clasts. This change might have occurred more than once; the major erosional unconformity that separates the upper and lower stratal packages could correspond to an earlier time in which the layered rock in Gale underwent erosion and removal from the basin. Even today, material appears to be leaving (or has recently left) Gale in the form of a low albedo wind streak which emanates from the basin and mantles underlying terrain as much as 200 km south of the crater (Fig. 2).

Study Area
Curiosity will land on Aeolis Palus, somewhere between the northwest rim of Gale and the lower northwest slopes of Mount Sharp. The elevation at the landing site will be near −4.5 km relative to the Martian datum. Between the crater rim and the mountain lies a fan of alluvium transported through a channel that cut the northwest wall of Gale (Fig. 2). The fan exhibits narrow, discontinuous chains of mesas that Anderson and Bell (2010) interpreted to be the inverted remains of distributary streams. Their mesa-forming nature and the retention of small impact craters on the fan itself both suggest that these materials are lithified. The fan is sedimentary rock.
The rover might land on the fan, or it might land south of the fan, between it and the base of Mount Sharp. If so, then it will land on a different substrate of stratified, cliff-and mesa-forming rock that has been, at least in part, dubbed by Fergason et al. (2012, this issue) as a "high thermal inertia unit." Regardless of where it lands, as Curiosity approaches the lower strata on northwest Mount Sharp, it will first encounter a field of eolian dunes that have accumulated along the break in slope where Aeolis Palus meets Aeolis Mons (Fig. 3). The orientations of these dunes indicate sediment transport toward the southwest (Hobbs et al. 2010). They are presently active (Silvestro et al. 2012) and infrared spectra have been interpreted to suggest that they consist of mafic, olivine-bearing sand (Rogers and Bandfield 2009;Milliken et al. 2010).
Once Curiosity has been driven to Mount Sharp, the MSL team will begin investigating the lowermost stratigraphy preserved in this mountain. As illustrated in Fig. 3, these are the strata containing the sulfate-bearing and clay-bearing rocks described by Milliken et al. (2010). These materials, and the records of water-rich environments they might hold, motivated the selection of Gale for the MSL mission (Golombek et al. 2012, this issue).

Primary Objective
To address the National Aeronautics and Space Administration (NASA) objective for MSL-to determine whether Mars once had habitable environments-the primary objective of the MAHLI investigation in Gale is to acquire images that document textural, mineralogical, morphological, and bedding structure clues in sedimentary rock that help-especially when examined together with data from the other instruments and tools carried by Curiosity (Table 2)-to determine: (1) how clasts comprising the rocks of Aeolis Palus and Aeolis Mons (Mount Sharp) were created, transported into Gale, and what happened to them after they arrived; (2) the nature of the depositional and diagenetic environments recorded in these rocks; and (3) the properties of the sedimentary materials that are no longer present.
The latter is a matter of learning enough about the rocks still present in northwestern Gale to infer-or, at least, reasonably speculate upon-the nature of coeval materials that were removed from Gale to form and leave Mount Sharp behind.

Secondary Objectives
The secondary objectives of the MAHLI investigation center on: (1) examination of the clasts comprising regolith fines, particularly modern or recent eolian bed forms and materials derived from the erosion of Mount Sharp; (2) documentation of geological materials subjected to analysis by the other science instrument on the robotic arm turret, the Alpha Particle X-ray Spectrometer (APXS); (3) assistance, through imaging and analysis, with the selection of materials to be sampled by drilling or scooping; (4) pre-and post-sampling documentation of rock drilled, regolith scooped, and (as desired), materials examined using the ChemCam laser; (5) examination and documentation of sampled materials presented to the MAHLI on the rover's Observation Tray, Engineering Tray, or "Sample Playground" funnel; (6) documentation or verification of rover engineering tests and events, including delivery of samples to sample inlets and readiness to access a new drill bit; (7) documentation and monitoring of the cleanliness of the APXS calibration target and the REMS (Rover Environmental Monitoring Station) ultraviolet sensor; and (8) diagnosis of engineering concerns through close-up imaging or imaging of hardware invisible to other cameras aboard Curiosity (e.g., a problem that might occur beneath the rover).
Because the MAHLI can be focused at infinity, the instrument can also be used-even when the robotic arm is stowed-to monitor the landscape for eolian bed form change and dustraising events (i.e., dust devils, wind gusts).

Stratigraphy Investigation
The central focus of the investigation is to document the properties of strata, arranged in time-ordered succession, from the lowermost northwest slopes of Mount Sharp to the highest stratum the rover will reach before the end of its mission. This work will permit interpretation not only of distinct past environments, but also of how those environments changed through time. Ultimately, it is the progression of successive environments that will provide the greatest understanding of the evolution of the represented fraction of the geologic history of early Mars. The stratigraphic effort uses all of the capabilities of MAHLI and Curiosity's other instruments and tools (Table 2) to document rock mineralogy, texture, and structure, as well as outcrop physical properties and geomorphic expression. Additionally, MAHLI images will show details about the layers themselves, including their lateral continuity, lateral changes in thickness, and the nature of boundaries between successive layers. Furthermore, because of the flexibility to choose between resolution and field-of-view, MAHLI images will be critical for examination of bedding-scale features, such as laminae, cross-bedding, and internal reactivation surfaces that provides the linkage between stratigraphic-and grain-scale features.

Grain-Scale Observations
The stratigraphy investigation requires MAHLI to provide critical information at the scale of features observable with a geologist's hand lens to document attributes of the rock. At an appropriate range of scales-which is a "lumping versus splitting" exercise that depends on what is observed when the rover arrives at an outcrop-investigators will document the properties of stratified rocks. The objective is to characterize each stratum or stratal package with sufficient detail so as to inform the interpretation of depositional environment, diagenetic history, and the nature and transport history of clasts in the rock.

Mineralogy
High-resolution, full-color MAHLI images will provide critical observations regarding the shape, cleavage, color, fluorescence, and luster of grains within rocks and regolith. Orientation of crystal faces, cleavage, and twinning, for instance, are directly related the structure of the crystal lattice and, thus, can be diagnostic of mineralogy, as in the identification of olivine from Mars Exploration Rover (MER) Microscopic Imager (MI) data collected at the Spirit field site (McSween et al. 2004). Although color is not typically diagnostic of mineralogy, it is often helpful for shortening the list of candidates (e.g., green could be olivine). Furthermore, seeing colors permits rapid identification of populations of mineral or lithic fragments (e.g., Weitz et al. 2006). Color images also aid in identification of mineral luster (e.g., glints resulting from a metallic luster), which may assist in mineral identification.
MAHLI's white light illumination capabilities will be used to create glints, reduce shadows, create shadows, and thereby enhance observation of crystal faces, cleavage, twinning, and luster. MAHLI's UV illumination source can be used to seek detections of visible color emitted by materials that fluoresce or phosphoresce as a result of longwave UV stimulation. Luminescence in minerals usually results from the presence of a minor element substitution within the crystal lattice. Although UV-stimulated color and intensity are not by themselves diagnostic of mineralogy-minerals of the same major element composition, but with different substitutions, may or may not fluoresce and may or may not exhibit different colors-fluorescence can provide an additional constraint on mineralogy. Minerals that could fluoresce under longwave UV include (but are not limited to) calcite, aragonite, magnesite, dolomite, epsomite, anhydrite, gypsum, and some silicates. It is not known whether fluorescent materials will occur at the Curiosity site; there were no luminescent detections resulting from the Phoenix Optical Microscope (OM) longwave UV investigation of Martian regolith materials (Goetz et al. 2012).

Texture
In addition to identification of mineralogical components, MAHLI images will comprise the primary data from which the MSL team will interpret details of the texture of sediments and sedimentary rock (including pyroclastic rocks). At the grain scale, elements of texture include grain size, shape, and roundness, as well as the identification of surface features and the spatial juxtaposition of adjacent grains (i.e., grain size distribution, sorting, orientation, and other elements of depositional fabric).
In terms of sedimentary components, statistical studies of grain size and size distribution can provide evidence of transport mechanism, and thus depositional environment, through examination of central tendencies (mean, mode, median), maximum size, bimodality, sorting, skew, and kurtosis. Similarly, the shape and roundness of a grain can provide information about genesis and transport history. Roundness addresses duration and mode of transport (e.g., quartz sand grains under typical Earth conditions round faster in wind than in fluvial systems because of the higher kinetic energies involved, Kuenen 1960). Ultimately, these components combine to define the textural maturity of the material, from which investigators can infer both transport and depositional process.
Beyond information related to grain transport and deposition, MAHLI images will provide critical data for interpretation of post-depositional phases, such as intergranular cement or the in situ precipitation and/or dissolution of mineral components. MER MI observations of sedimentary rocks at the Opportunity field site, for example, revealed an abundance of lensoid vugs that were ultimately interpreted as molds after displacive growth of an evaporitic sulfate mineral . Similarly, detailed MI observation of the relationship between hematite-bearing spherules ("blueberries") and surrounding sedimentary grains provided the critical evidence that these spherules precipitated as concretions within a pre-existing sediment substrate . These two interpretations, combined with geochemical data from other instruments aboard Opportunity, proved critical to constraining the depositional story of the Meridiani Planum bedrock.
Similarly, identification of changes in rock texture between unweathered and weathered material (e.g., a weathering rind or crust), can provide critical constraints on environmental conditions during and after exhumation and exposure. MER MI images, for example, contributed visual evidence from which investigators inferred-in concert with other data and observations-the presence of coatings and rinds on some of the rocks examined by the Spirit and Opportunity rovers (McSween et al. 2004;Fleischer et al. 2008;Knoll et al. 2008).
Hand lens-scale views provide important data for the interpretation of igneous textures, as well. Within igneous rocks, textural features can be used to help determine composition, cooling rate, and volatile content. Cooling rate and history can be constrained by determining crystal size distributions, with coarse, fine, and porphyritic textures implying slow (intrusive), fast (extrusive), or 2-stage cooling histories, respectively. Additionally, diagnostic textures such as glass or glass alteration products, well-formed crystals (implying growth in a melt), crystallization sequence, and vesicularity all provide a means of direct inference regarding the nature of the melt from which igneous rocks were derived.

Structure
In addition to textural components that are identified on the scale of individual grains, imaging with MAHLI will be a means for interpreting bedding properties, diagenetic features (e.g., concretions, dissolution vugs), and climate-induced features (e.g., mud cracks, raindrop impressions, iceberg drop stones) in deposited materials. Such sedimentary structures provide vital environmental information that can be related to the chemistry and behavior of sedimentary fluids (including atmospheric gases, surficial liquids, and even high-viscosity solids, such as ice), both during and after deposition. For example, the combination of sedimentary texture and structures (e.g., cross-bedding and ripples) in the rocks observed at the Opportunity site permitted interpretation of both aqueous and eolian deposition . Similarly, in igneous rocks, structures such as vesicle elongation or crystal rotation can provide key observations regarding igneous emplacement.

Biogenicity
The search for present or past life on Mars has been of interest for more than a century. Even the earliest discussions of microscopic imaging of Martian materials and the earliest efforts to identify candidate field sites centered on the question of Martian biology (Lederberg 1960;Swan and Sagan 1965;Soffen 1969). Although the primary objective of the MSL mission is the search for habitable environments, the very nature of habitability-the potential for an environment to support or sustain life-lends itself to the discussion of whether the MAHLI investigation might directly address the question of biogenicity.
Based on the results of the previous robotic missions that have flown past, orbited, and landed on Mars, the likelihood of detecting a biosignature in a MAHLI image seems to be remote. MAHLI images cannot resolve features of microbe size (typically 1-30 microns for most prokaryotic organisms). The smallest grains that can be resolved in the highest resolution MAHLI images are of the order of 45-60 µm in size. Moreover, being resolved does not mean being identifiable. MAHLI images could certainly resolve macroscopic groupings of micro-organisms (e.g., patches of crustose lichen on a rock) if they occur, but no such features have been found in MER MI or Phoenix Robotic Arm Camera (RAC) images already acquired on Mars. In order to be readily resolved by MAHLI, biosignatures, such as body fossils or evidence of sediment bioturbation, would have to occur at a scales > 100 µm (Summons et al. 2011). Certain biofabrics-such as microbial laminae and composite microbial structures (e.g. stromatolites)-would certainly be detectable (Summons et al. 2011;Williams and Sumner 2012), although these are not without controversy, as abiogenic structures can mimic biofabric (e.g., McLoughlin et al. 2008).

Design Motivators
In the parlance of landed robotic spacecraft engineering, MAHLI is a contact instrument. It was designed, first and foremost, for a robotic arm to position the camera so that it can acquire macrophotographic views of geologic materials from close (centimeters) range. The "hand lens" nature of the Mars Hand Lens Imager derives from its main purpose. A geologist typically carries a hand lens on a cord worn around the neck like a pendant. This arrangement provides for easy field, laboratory, or classroom deployment and prevents loss of this vital tool during a day's work. The geologist will use a hand lens to observe small features (approximately 0.1 to 5 mm) that might help identify a rock, the minerals in a rock, or other attributes of a geologic material (e.g., grain size, shape, roundness, sorting). Depending on the task at hand, the geologist might seek a fresh, unweathered rock surface by using a hammer or some other means to break off a hand-sized sample. The geologist will lift the rock with one hand and hold the hand lens with the other, then examine some surfaces of the rock through the lens. The rock might be tilted slightly in several directions, this way and that, in an attempt to catch glints of light reflecting off of mineral crystal faces or cleavage planes. A similar approach is used on a handful of unconsolidated sand, silt, or granules.
In the mid-to late-1990s, the deployable hand lens concept was adapted for spacecraft headed to Mars in the form of the RAC aboard Mars Polar Lander and Phoenix (Keller et al. 2001(Keller et al. , 2008, and the MER MI cameras aboard the rovers Spirit and Opportunity . Arriving in January 2004, the MER MI cameras quickly revolutionized Mars science, ending a 30-year discussion (e.g., Sharp and Malin 1984) as to whether sand-sized, windblown particles actually occur on Mars (Herkenhoff et al. 2004a). In addition to direct observation of sand, the MI cameras revealed sand-sized clasts in bedrock ) and they helped settle debates regarding the presence of water-lain sediments, aqueously altered rocks, rock coatings, and phenocrysts in igneous extrusive rocks, among many other results (Herkenhoff et al. 2004b;Haskin et al. 2005).
The MAHLI concept was developed from observations regarding the manner in which a geologist uses a hand lens; RAC abilities to view materials in color, change focus, and acquire images of spacecraft hardware and landscapes (Yingst et al. 2001); and how the MER MI cameras were being used to obtain image mosaics and focus stacks during their first months on Mars. With these observations in mind, the MAHLI was required to have the following abilities: (1) Acquire color images to mimic the capability of the geologist's use of a hand lens to distinguish materials on the basis of color.
(2) Obtain images of spatial resolution higher than the MER MI 31 µm per pixel capability, to at least resolve grains throughout the sand size range (62.5-2000 µm), because much of the sand at the Opportunity site in 2004 was observed to be at the limit of MI resolution at ∼100 µm particle size. (3) Focus, so as to permit-like the RAC-imaging over a wider range of working distances than MER MI. With this capability, users could trade spatial coverage and resolution against the number of images and robotic arm movements needed to cover a given target and meet the target-specific scientific goals. This requirement came from observation, early in the mission, that the Opportunity team was limited to using the specific field of view and spatial resolution of the MI to cover a large portion of an outcrop in the informally-named Eagle crater (e.g., ).
(4) Acquire images with a larger format detector than MI and RAC to provide the option to cover a greater area at a spatial resolution similar to MI or RAC in a single image. (5) Illuminate targets from at least two different angles to mimic the geologist's ability to catch a glint off a crystal face or cleavage plane. (6) Perform an onboard focus merge and minimize rotation between images in a focus stack, so as to provide options for reduced downlink data volume and simplified registration between stacked images relative to the MER MI.
In addition to the above, when the MAHLI instrument was proposed to NASA, the intended latitude range for the rover's field site extended from 60 • N to 60 • S. If the rover were to be operated at these extreme latitudes for the MSL primary mission of 1 Mars year, the MAHLI would spend a large portion of autumn and winter in darkness, perhaps with seasonal frost obscuring rocks and regolith. Given this possibility, the MAHLI team included an ability to: (7) illuminate a subject with white light to permit imaging at night or in deep shadow.
To further aid in identification of minerals or other materials that might be present in a MAHLI image, the team also included an exploratory capability to: (8) illuminate a subject with a longwave ultraviolet source.

Roles and Responsibilities
The MAHLI team and Malin Space Science Systems (MSSS) developed the instrument under contract with NASA's Jet Propulsion Laboratory, a division of the California Institute of Technology (JPL-Caltech). JPL-Caltech manages the MSL Project for the NASA's Science Mission Directorate. JPL-Caltech built and operates Curiosity and its cruise stage and descent stage delivery elements. MSSS was responsible for development, integration, and testing of MAHLI hardware and flight software, including the optics. MSSS's major subcontracted partner for development of the MAHLI mechanical lens assembly was Alliance Spacesystems, Inc. (ASI), of Pasadena, California. ASI is now the Space Division of Mac-Donald Dettwiler and Associates' MDA Information Systems.   two Mastcams and MARDI, it was not delivered with the MAHLI camera head so that it could be used to complete Mastcam development and testing (the MARDI camera head had already been delivered in July 2008). The MAHLI calibration target did not exist when the camera head had to be tested, characterized, and delivered to JPL-Caltech; its design was finalized in September 2008, following updated inputs on accommodation provided by the rover engineering team at JPL-Caltech. Four calibration targets were assembled in July 2009. The Mastcams, DEAs for all four cameras, the MAHLI calibration target, and the Mastcam calibration target, were all delivered in March 2010.

Development Chronology
Owing to the 2-year launch delay, the flight MAHLI camera head was stored at JPL-Caltech until November 2010, when it was integrated for the first time with the rover. Tests involving MAHLI aboard Curiosity were conducted between November 2010 and August 2011 in Assembly, Test, and Launch Operations (ATLO) facilities at JPL-Caltech and at NASA's Kennedy Space Center in Florida. The camera head was removed from the rover and replaced several times during the November 2010-June 2011 period. Final inspection and cleaning of the camera head optics occurred in August 2011. MSL was launched on 26 November 2011.

Impact of De-Scope of the MSL Surface Removal Tool
When the MAHLI investigation was proposed in 2004, one of its objectives centered on examination of rock surfaces exposed by a grinding tool similar to the Rock Abrasion Tool (RAT) aboard the Spirit and Opportunity rovers (Gorevan et al. 2003). The RAT helped reveal rock coatings and rinds, the presence and crystal shape of phenocrysts in basalt, and the relationship between concretions and matrix in sandstone (e.g., McSween et al. 2004;Herkenhoff et al. 2004b).
The corresponding tool for MSL was to have been the Surface Removal Tool (SRT). It was required to be used for a Martian year (with an additional 1-2 Mars years of lifetime margin), whereas the Spirit and Opportunity RATs were designed for a 90-day mission. Owing to technical challenges, NASA decided during a cost-savings effort in August 2007 to de-scope the SRT from the MSL toolkit. The loss of this tool limits MAHLI imaging to natural, weathered surfaces. Some fresh rock surfaces might be produced by actions of the MSL drill or by motion of the rover wheels, but the RAT capability of the MERs is not available on Curiosity. Note that, although the SRT was de-scoped, the rover does have a Dirt Removal Tool (DRT). This is a wire brush designed to clear dust and regolith fines from rock surfaces and to clean the rover's sample observation tray , this issue). On a rock surface, the DRT sweeps a circular spot of at least 4.5 cm diameter so as to provide a relatively dust-free surface for APXS and MAHLI observation.

Camera Head
The MAHLI camera head (Figs. 4,5) consists of an optomechanical assembly, a focal plane assembly, and the camera head electronics assembly. The latter two share a common design with the corresponding elements of the MSL MARDI and Mastcams.

Focal Plane Assembly and Electronics
The focal plane assembly (FPA) is designed around a Kodak KAI-2020CM Charge-Coupled Device (CCD) without a cover glass. The sensor has 1640 by 1214 pixels of 7.4 µm by 7.4 µm size. The photoactive area is a 1600 by 1200 pixels area inside of 16 dark columns and 4 photoactive buffer pixel columns on either side of the detector, 2 dark rows at the top and 4 dark rows at the bottom, plus 4 photoactive buffer pixel rows at both the top and bottom of the detector. The CCD uses interline transfer to implement electronic shuttering. The sensor has red, green, blue (RGB) filtered microlenses arranged in a Bayer pattern.  LEDs are light emitting diodes, an FPGA is a field-programmable gate array, an EPROM is an erasable programmable read only memory, NAND is a type of non-volatile (flash) memory, GB is gigabytes, MB is megabytes, LVDS is low voltage differential signal, an ADC is an analog to digital converter, the Kodak KAI-2020CM is a charge-coupled device (CCD), DC-DC converters change a source of direct current from one voltage level to another, SDRAM is synchronous dynamic random access memory, I/F stands for interface, and S/C stands for spacecraft, which in this case is the rover, Curiosity The microlenses improve detector quantum efficiency, which is about 40 % on average for the three color channels. The "fast-dump" capability of the sensor is used to clear residual charge prior to integration and also allows vertical sub-framing of the final image. The output signal from the CCD is AC-coupled and then amplified. The amplified signal is digitized to 12 bits at a maximum rate of 10 megapixels per second. For each pixel, both reset and video levels are digitized and then subtracted in the digital domain to perform correlated double sampling (CDS), resulting in a typical 11 bits of dynamic range.
The camera head electronics are laid out as a single rigid-flex printed circuit board (PCB) with three rigid sections. The sections are sandwiched between housings that provide mechanical support and radiation shielding; the interconnecting flexible cables are enclosed in metal covers. Camera head functions are supervised by a single Actel RTSX field-programmable gate array (FPGA). In response to commands from the DEA, the FPGA generates the CCD clocks, reads samples from the analog-to-digital converter (ADC) and performs digital CDS, and transmits the pixels to the DEA. The FPGA is also responsible for operating the motor that drives the MAHLI focus and dust cover mechanisms. MAHLI uses a spare motor driver circuit to control the power for the three sets of light-emitting diodes (LEDs) mounted on a small PCB attached around the front window of the optics.
The MAHLI camera head operates using regulated 5 V and ±15 V power provided by the DEA. A platinum resistance thermometer (PRT) on the camera focal plane provides temperature knowledge for radiometric calibration. An additional pair of PRTs and redundant etched-foil heaters are attached to the outside of the camera head and thermostatically controlled by the rover to warm the mechanism for operation when needed. On Mars, the camera head will usually be operated at temperatures of −40°C to +40°C and has been verified (through testing on a non-flight unit) to be able to survive nearly 3 Mars years of diurnal temperature cycles (down to −130°C) without any heating.

Optomechanical Lens Assembly
The optomechanical lens assembly includes integrated optics, the LEDs, focus and dust cover mechanisms, and a single drive motor to adjust focus and move the dust cover. DiBiase and Laramee (2009) described the optomechanical design and manufacture; Ghaemi (2009Ghaemi ( , 2011 described the optics and their assembly. The optics are an all-refractive design consisting of a group of six stationary elements, a movable group of three elements, and the front element, a stationary sapphire window (Fig. 6). The lens was designed to be able to focus on subjects at working distances between 2.25 cm and infinity; the as-built lens can focus on targets as close as 2.05 cm. The effective focal length ranges from 18.4 mm at the minimum working distance to 21.4 mm for focus at infinity. Over that same range, the design focal ratio and field of view ranges from f/9.8 and 33.8 • to f/8.5 and 38.5 • . The lens design depth of field varies from about 1 mm at the minimum working distance to 1.2 cm at ∼12 cm and continues increasing toward infinity (Ghaemi 2009). Undesired near-infrared radiation is blocked by a coating deposited on the inside surface of the sapphire window. The combination of glass element transmission properties, the infrared cut-off filter, and the RGB microfilters provides a spectral throughput of 395-670 nm (Fig. 7).
MAHLI's four white light Avago Technologies HSMW-100 LEDs are arranged in groups of two; each pair is located on either side of the front lens element (Figs. 4,8). Each pair can be commanded to operate together or independently of the other. The two 365 nm ultraviolet (UV) Nichia model NSHU550B LEDs (Figs. 4,8) operate together. MAHLI users can run all three groups of LEDs simultaneously, two groups simultaneously, or one group at a time. In addition, the LEDs can be powered whether the camera is acquiring an image or not.
The optomechanical assembly includes the dust cover to protect the front optical element (the sapphire window) and the LEDs from dust contamination when the instrument is not in use. The cover has a window composed of clear, transparent Lexan® so that images can be acquired and the LEDs can illuminate targets when the cover is closed. The full range of focus positions is available whether the cover is open or closed.
The optics and all moving parts are sealed within the optomechanical lens housing to prevent dust contamination (DiBiase and Laramee 2009). A single MER flight-heritage Aeroflex 10 mm stepper motor drives the MAHLI lens focus group and the dust cover. The motor drives the integral gear of a cam tube, and the lens focus group moves along linear bearings under the control of a cam follower pin. End-of-travel sensing is accomplished using a Hall-effect sensor and magnet pairs on the cam. The MAHLI dust cover is actuated by the same motor using a worm gear driven by cam rotation. A separate Hall sensor indicates when the cover is fully open.

DEA Hardware
The MAHLI DEA (Figs. 5,9) is packaged with the MARDI and Mastcam DEAs to save mass. The electronics are laid out on a single rectangular PCB. The DEA interfaces the camera head with the rover avionics. All data interfaces are synchronous (dedicated clock and sync signals) and use LVDS (low-voltage differential signaling). Each (redundant) rover interface comprises two flow-controlled serial links, one running at 2 megabits per second from the rover to the DEA and another at 8 megabits per second from the DEA to the rover. The DEA transmits commands to MAHLI using a 2 megabits per second serial link and receives image data from the MAHLI camera head on a 30/60/120 megabits per second selectable rate 6-bit parallel link. The DEA is powered from the rover's 28 V power bus and Digital Electronics Assembly (DEA) package for Curiosity's MAHLI, two Mastcams, and MARDI. Each instrument DEA is a separate entity (they do not communicate with each other); they were packaged together to reduce volume and mass. The pocket knife is 88.9 mm long provides switched regulated power to the camera head. It also contains a PRT for temperature monitoring.
The core functionality of the DEA is implemented in a Xilinx Virtex-II FPGA. All interface, compression, and timing functions are implemented as logic peripherals of a Microblaze soft-processor core in the FPGA. The DEA provides an image-processing pipeline that includes 11-to-8-bit companding of input pixels, horizontal sub-framing, and optionally lossless predictive or lossy compression. The latter also requires the Bayer pattern raw image to be interpolated and reordered into luminance/chrominance block format. The onboard image-processing pipeline can run at the full speed of camera head input, writing the processed data stream directly into DEA memory.
The DEA memory subsystem contains 128 megabytes of SDRAM (synchronous dynamic random-access memory) and 8 gigabytes of non-volatile NAND flash memory. The flash is organized as a large image buffer, allowing images to be acquired without use of rover memory resources at the maximum camera data rate. The SDRAM is typically used as scratchpad space and to store file system information, but can also be used as a small image buffer.

Flight Software
DEA hardware functions are coordinated by the DEA flight software (FSW), which runs on the Microblaze. The FSW receives and executes commands, transmits commands generated on Earth from the rover, and transmits any resulting data. The FSW also implements autofocus and auto-exposure algorithms for image acquisition, performs error correction on the contents of flash memory, implements mechanism control and fault protection, and performs focus stack merges. The FSW consists of about 10,000 lines of ANSI C code (American National Standards Institute C programming language).
The FSW allows considerable flexibility for image acquisition. Images can be acquired in uncompressed form into the flash buffer and read out multiple times using different compression schemes. Alternatively, images can be compressed during acquisition to minimize the amount of buffer space they occupy; the latter capability is useful for video sequences. Reduced resolution "thumbnail" versions of each image can be generated on command. These thumbnails are generated in the FSW with some assistance from the DEA logic; in the case of images that are stored in compressed form, partial software decompression is required to produce the thumbnail.

Calibration Target
The MAHLI calibration target (Fig. 10) is used to characterize and monitor MAHLI camera performance on Mars throughout the mission. The target is composed of machined titanium to which are affixed eight elements: an opal glass bar target, three color swatches, two gray swatches, one fluorescent swatch, and a United States of America (USA) one cent coin. Machined elements include a stair-stepped target and surfaces that can be touched by the MAHLI contact sensor probes.

Opal Glass Bar Target
The centerpiece of the MAHLI calibration target is a bar target (Fig. 11) consisting of opaque features composed of blue chrome printed on a white field of opal glass. The glass and chrome permit specular reflection of light emitted by the MAHLI LEDs to provide image confirmation that they are functional on Mars.
The opal glass bar target is a custom product from Applied Image of Rochester, New York. The glass, blue chrome, bar and square targets are derived from one of their consumer products, a variant on the US Air Force 1951 Resolution Test Chart (Mil-Std-150A), product T-22. The printed features and their purposes are: (1) Bars. Twenty-one sets of horizontal and vertical bars serve as resolution targets. They are measured in cycles per millimeter, from 1.0 to 10.1, for which one cycle is one pair of black and white bars. These are used to monitor camera focus and resolution performance.
(2) Squares. The largest of ten squares is located in the upper left corner of the bar target; it is 8 × 8 mm in size and provides a sharp edge target for camera performance evaluation. The smaller squares are called finder squares, designed by Applied Image for ease in locating commonly used cycles. (3) Text and fine curved lines. Text and fine line features provide additional opportunities to confirm camera performance. These include an indicator that this is the MAHLI calibration target; text indicating cycles per millimeter; a 2.3 mm by 4.6 mm box containing an identifier of MSSS as the organization responsible for the development and operation of MAHLI; a group of very small Greek characters (0.42 mm height) located inside the 1.0 cycles per millimeter zero to provide fine-scale structure on the right side of the target; and a 2.3 mm by 1.96 mm drawing of a small character named "Joe the Martian." The Joe the Martian character, created by the MAHLI Principal Investigator in 1975 (Edgett 1998), is from a drawing by A.R. Kingsbury that was used in "Red Planet Connection," a mid-1990's children's science education product of the NASA-funded Arizona State University Mars Education Program (Dieck 1997;Edgett et al. 1997). Joe the Martian was included on the calibration target as a symbolic "thank you" to USA taxpayers for the opportunity to conduct the MAHLI investigation and as an invitation for children to follow the Curiosity mission and pursue their interests and dreams.

Gray and Color Swatch Targets
Five color (red, green, blue) and gray (40 % and 60 %) swatches provide an opportunity for reflectance calibration under Mars illumination conditions. Each consists of flight spare Each is composed of room temperature volcanized (RTV) silicone impregnated with a pigment: the red swatch contains powdered hematite, the green has chromium oxide, and the blue contains cobalt aluminate.  and  described the characterization of these swatches; the same materials are included on the MSL Mastcam calibration target (Malin et al. 2010), also aboard Curiosity. D.T. Britt manufactured the swatches following processes and procedures developed for calibration target materials used in the Imager for Mars Pathfinder (IMP) investigation (Smith et al. 1997).

Fluorescent Swatch Target
The fluorescent swatch is cream-colored under white light illumination (Fig. 12) and fluoresces red (626 nm) under MAHLI's UV LEDs (365 nm). The target consists of RTV silicone impregnated with SpectraFluor Red (product SFP-2800), an inorganic pigment donated by the manufacturer, Spectra Systems of Providence, Rhode Island. D.T. Britt manufactured the swatch in 2008 using the same process performed to fabricate the color and gray MER Pancam calibration target swatches. One exception to the similarity in manufacturing is that the fluorescent swatch aboard Curiosity did not undergo the 30-sol (a Martian day, a sol, is ∼1.027 Earth days in duration) laboratory irradiation described by ; this irradiation was performed on one sheet of MAHLI fluorescent swatch material, but this particular sheet was of an incorrect thickness. The fluorescent swatch sent to Mars was cut from a sheet that did not undergo the 30-sol irradiation; this will not interfere with its use to confirm UV LED operation on Mars.

Cent and Stair-Stepped Targets
The 1909 cent target is brass (95 % Cu, 3-4 % Zn, 1-2 % Sn, and a trace of S) and has a diameter of 19 mm. It provides an additional measure of scale and resolution performance while honoring an informal tradition in which geologists place a coin in close-up photographs of geologic features to indicate scale when a ruled target is unavailable. Donated by the MAHLI Principal Investigator, the cent also presents an opportunity for the public to watch for changes (discoloration, pitting by windblown sand, etc.) that might occur on a familiar object during Curiosity's mission. The stair-stepped target, located below the cent, consists of machined steps of 1 mm width and 0.3 mm height. These provide a feature of known relief that can be used to check focus merge range map and stereo pair performance.

Dust Accumulation Mitigation
The MAHLI calibration target is affixed vertically on the rover to minimize dust accumulation; this approach worked well for the Viking lander camera calibration targets (Guinness and Arvidson 1998). Ring-shaped "sweep" magnets (e.g., Leer et al. 2008) could not be incorporated into the MAHLI target because they would disrupt the performance of the Hall-effect sensors in the MAHLI camera head.

MAHLI Hardware Units
Two full-fidelity MAHLI camera heads were produced. The flight unit is aboard Curiosity. The Life Test Unit MAHLI (hereafter, testbed-MAHLI) was produced first and was used for life testing (the equivalent of 2-3 Mars years of thermal cycling and mechanism operation), pyroshock testing, and software and procedure validation. Owing to the commonality in lens mechanism design, the testbed-MAHLI also served as the life test unit for the MSL Mastcams. The testbed-MAHLI was then delivered to JPL-Caltech for use in the MSL testbeds, including a rover used to develop and test sequences and scenarios for operation of the flight rover on Mars. MSSS also produced DEAs to operate the MAHLI, Mastcams, and MARDI aboard Curiosity and aboard the testbed rover at JPL-Caltech.
Four flight-fidelity MAHLI calibration targets were produced. One of them is aboard Curiosity. Two others were delivered to JPL-Caltech; one for use in rover thermal vacuum testing in March 2011, the other for the MSL testbed rover. The fourth, a flight spare, is stored at MSSS. A prototype target, produced to a slightly different design, was also produced; this was used to test assembly procedures and for thermal cycle life testing.

Focus, Working Distance, Pixel Scale, and Example Geologic Materials
The MAHLI lens is focused by moving the lens focus group elements between the stationary group of elements and the CCD (Fig. 6). The stepper motor performs this action. The focus group position is therefore a function of motor steps, and both are directly related to working distance. When the MAHLI lens mechanism is in its launch restraint position, the motor count is 0, the dust cover is closed, and the camera is in focus for targets at the minimum working distance, ∼2.1 cm. As the motor is activated and steps increase, the lens focus group begins to move (Fig. 13). Between counts 0 and ∼1460, the lens is in focus at the minimum working distance and the dust cover remains closed. The cover stays closed until the motor reaches ∼5100; at that point, the cover begins to open. Between motor counts of ∼1460 and ∼4490, the lens moves focus across the entire range, from ∼2.1 cm working distance to infinity. When the dust cover is open, focus for working distances ∼2.1 cm to infinity occurs between motor counts ∼12570 (infinity) and ∼15600 (minimum working distance). Uncertainties are generally < ± 50 counts. Figure 14 shows the relation between working distance and pixel scale for targets from 2.1 cm to 300 cm. In this case, pixel scale refers to the area covered by a single square pixel on a planar target at the working distance. At the minimum in-focus working distance, a pixel covers about 14 by 14 µm and objects about 45-60 µm in size can be resolved (i.e., very coarse silt). Images of the same resolution as obtained by MER MI (∼31 µm/pixel) are acquired at about the same working distance as the MI (∼6.6 cm). Figures 15 and 16 show some of the images of geologic materials acquired by the flight MAHLI during development testing in September 2008. As these data were acquired in a cleanroom environment, the only geologic materials presented to the flight MAHLI were rocks that had been cleaned to remove loose particles. The testbed-MAHLI could be operated outside of the cleanroom environment, thus it has been tested with regolith fines (Fig. 17).

Hardware Locations on Rover
The DEA is located inside the rover's environment-controlled body and the MAHLI calibration target is affixed vertically to the housing of the rover's robotic arm shoulder azimuth actuator (Fig. 1). The MAHLI camera head is one of five instruments and tools mounted on The cover begins to open near motor count 5100. The camera is in focus at the minimum working distance (∼2.1 cm) between counts of 0 to ∼1460 (cover closed) and again starting at ∼15600 (cover open). Another Hall effect sensor (H) is detectable at the middle of the focus range when the cover is open; this is used as a reference point to confirm focus mechanism performance. Infinity focus is reached at motor counts ∼4490 (cover closed) and ∼12570 (cover open) the turret at the end of Curiosity's robotic arm ). The others (Table 2) include the DRT brush; the Powder Acquisition Drill System (PADS); the CHIMRA (Collection and Handling for In-situ Martian Rock Analysis) device for scooping, sieving, and portioning samples; and a science instrument, the APXS. When the robotic arm and turret are stowed (as in Fig. 1), the MAHLI points to the left (port) of the rover and the landscape orientation of the camera's CCD is rotated ∼210 • counter-clockwise relative to the horizontal plane defined by the rover deck (Fig. 18).

Camera Head to DEA Harness
The MAHLI camera head is connected to its DEA through a four-segment, impedancecontrolled cable harness. This intra-instrument cable provides regulated power and command/data interfaces to the camera head. The harness consists of four segments and uses both round and flex cables with a total length of about 12.7 meters. The cable supports a maximum data rate of 5 megabits per second per LVDS line and the camera head readout rate is limited to 2.5 megapixels per second (a quarter of the rate that the camera head elec- Fig. 14 Relationship between working distance and pixel scale, pixel scale (µm/pixel) = 6.9001 + (3.5201 * working distance (cm)). Gray points and error bars indicate observations measured from flight MAHLI images of bar and grid targets (the plotted points are larger than error bars on the left side of the graph) Fig. 15 Flight MAHLI image of crystalline zinc ore as viewed from ∼2.5 cm working distance (∼16 µm/pixel). The sample is from the Buckwheat Mine dump near Franklin, New Jersey. In the color version of this figure, the red mineral is zincite, the black is franklinite, and the white is calcite. The image was obtained on 3 September 2008 tronics are capable of) to avoid signal integrity issues in the cable. At this highest rate, full frame MAHLI images can be acquired at a rate of a little over 1 frame per second. Subframes can be acquired at higher rates; for example, 1280 by 720 pixels video frames (720p high definition video frames) can be acquired at about 1.9 frames per second. Surrounding the MAHLI camera head is a contact sensor assembly ( Fig. 19; Jandura et al. 2010). This is a two-probe (or pokers) device that provides contact information to the robotic arm when one or both of the probes touch a hard surface, such as a rock. The contact sensor package shares heritage with similar, single-poker devices used for the Spirit and Opportunity rover MI cameras (Dougherty 2003;. The contact sensor probes trigger a halt to robotic arm motion when the front element of the MAHLI lens is 17-18 mm from the target. At that distance, the camera is too close to the target to open its dust cover and it is too close to acquire an in-focus image (Fig. 20). The contact sensor will not be used to make contact with loose regolith, rock faces with protrusions that would contact the camera head before the sensor is triggered, or rocks with pits of a size in which a probe might become stuck.

Vibration Isolation
Two of the tools on Curiosity's robotic arm turret, the drill (PADS) and CHIMRA, create dynamic environments when they are operating. As described by Jandura (2010), the mechanical interface between the MAHLI camera head and the turret consists of a vibration isolation platform that connects to the turret through a wire rope system (Fig. 19). The vibration isolation platform protects the MAHLI lens mechanism from damage and wear by attenuating some of the motion induced by operating the drill and CHIMRA. Placement-also referred to as positioning-of the MAHLI camera head is accomplished by movements of the rover's robotic arm and turret. Of course, driving the rover to a new location also changes the position of the MAHLI camera head.
Software tools are used to plan robotic arm positioning of the MAHLI camera head. Software representations of the rover hardware and stereopair images of terrain acquired by Curiosity's engineering cameras , this issue) provide the rover science and engineering team with three-dimensional representations of the areas accessible to the robotic arm and turret. These tools are used to visualize MAHLI camera head placement and generate the necessary commands to position the camera and acquire images.
There are four main factors that can impact actual MAHLI camera head positioning relative to the desired position: (1) Uncertainty in software planning tools, such as fidelity of the simulation of rover position, robotic arm mechanical behavior, and the representations of terrain derived from engineering camera data.
(2) Mechanical backlash in robotic arm and turret motion at the end of a MAHLI camera head positioning event. Where MAHLI is positioned, relative to a target, depends on where it is located after vibrations induced during robotic arm and turret motion have damped out. (3) Relative to the gravity vector, the wire rope vibration isolation interface between the MAHLI camera head and turret might sag somewhat. (4) Positioning is improved if the robotic arm and turret have previously positioned MAHLI or another tool at the desired location. Use of the MAHLI contact sensor can also lead to improved subsequent placements of the camera head.  These are sub-frames of MAHLI images acquired on 28 and 29 July 2011 during testing at NASA's Kennedy Space Center, Florida. The "REMOVE BEFORE FLIGHT" item is a cover that protected one of the rover's Organic Check Materials (OCM) during ground testing. The diameter of this cover is 65.5 mm. MAHLI was positioned at a working distance of 30 cm on 28 July 2011. After that, the robotic arm and MAHLI were repositioned more than a dozen times before MAHLI was again placed at this target a day later. The working distance was repeated exactly. Repeatability in the x-and y-directions (parallel to the plane defined by the MAHLI CCD) differed by <2 pixels (the later image moved <2 pixels toward the lower right relative to the previous). The x-y difference was <0.15 mm. The MAHLI white light LEDs were illuminated during these acquisitions Initial studies suggest that MAHLI positioning uncertainties are likely to be better than 1-2 cm. Figure 21 shows an example of repeated MAHLI positioning from a test performed on Curiosity (under Earth gravity conditions) before launch. In this case, MAHLI was positioned on two different occasions at a distance of 30 cm from a "Remove Before Flight" cover over one of the rover's Organic Check Material (OCM) positions. Between acquisitions of these images, the robotic arm and turret were moved to more than a dozen other positions. The repeatability was remarkable, with <0.2 mm of measurable difference between the two positions. Figure 22 shows another example, this time performed on the testbed rover, again under Earth gravity conditions. This was the result of the first end-to-end test of methods that will be used on Mars: acquire images of the robotic arm workspace using the rover's front Fig. 22 This testbed-MAHLI image acquired by the center 480 by 480 pixels of the CCD is the result of an end-to-end test to use MSL rover engineering cameras, software planning tools, and the robotic arm/turret system to plan and position the MAHLI at a target on a rock in the rover's robotic arm workspace. The test was conducted on 13 October 2011 with flight-like hardware on a testbed rover at JPL-Caltech. The goal was to center the CCD on the cent. That the coin is not perfectly centered provides a visual representation of how well (albeit imperfectly) the camera was positioned relative to the plane defined by the MAHLI CCD. The cent diameter is 19 mm; centering is offset by ∼2 mm in the y direction and by 1 mm in the x direction. The working distance was ∼11.7 cm hazard cameras; create a digital three-dimensional model of the scene; select a target for the MAHLI using this scene; generate commands for the robotic arm to position MAHLI at the target; uplink the commands to the rover and, finally, have the rover perform the task. The objective in this test was to position MAHLI at a working distance of 11.9 cm from a USA cent such that it would be located at the center of the MAHLI field of view. The centering was off by <2 mm in one direction, 1 mm in the other; the working distance, too, was within 2 mm of expectation.

Full-Frame and Sub-Frame Imaging
MAHLI image size-the number of rows and columns of pixels-is nominally commanded in whole number multiples of 16. Full-frame images are 1600 by 1200 pixels in size or larger (the detector is 1640 by 1214 pixels in size; because of multiples of 16, the maximum number of columns is 1648 pixels). Sub-frames, if desired, are obtained at the time of photo acquisition. MAHLI cannot extract a sub-frame from a larger image after it is acquired. One important use of sub-framing is to couple it with an autofocus command to determine focus for a subsequently acquired full-frame (or larger sub-frame) image.

Manual Focus and Previous Focus
MAHLI can be focused "manually" or it can be autofocused. A manual focus is one in which the lens focus group is commanded to move to a specified motor count position. The camera can also be commanded to use the immediately previous focus position. To ensure Fig. 23 Example of the MAHLI autofocus technique. The picture shows an opal glass bar target imaged by MAHLI (with all 4 white light LEDs on) at a working distance of 3.4 cm. This is one of 10 images acquired of this target at this distance using different focus settings (different motor count/lens focus group positions). The dots show the motor count position and JPEG file size (for a compression quality of 60) for each of the 10 images. The images in best focus are near the top of this curve. A parabola fit to the highest three points (partial, solid curve) indicates the best focus position would be at a motor count of 14863. If this were an actual autofocus case, after completing the 10 autofocus steps and determining this position, the motor would move the lens focus group to position 14863 and acquire an autofocused image. These data were acquired by the flight MAHLI on 17 September 2008. The numerical markings in the MAHLI image indicate linepair cycles per millimeter success, manual focus is typically used only in cases for which the operators have a very good estimate of the working distance.

Autofocus
Autofocus is anticipated to be the primary method by which MAHLI is focused on Mars. The autofocus command instructs the camera to move to a specified starting motor count position and collect an image, move a specified number of steps and collect another image, and keep doing so until reaching a commanded total number of images, each separated by a specified motor count increment. Each of these images is JPEG compressed (Joint Photographic Experts Group; see CCITT (1993)) with the same compression quality factor applied. The file size of each compressed image is a measure of scene detail, which is in turn a function of focus (an in-focus image shows more detail than a blurry, out of focus view of the same scene). As illustrated in Fig. 23, the camera determines the relationship between JPEG file size and motor count and fits a parabola to the three neighboring maximum file sizes. The vertex of the parabola provides an estimate of the best focus motor count position. Having made this determination, MAHLI moves the lens focus group to the best motor Fig. 24 Illustration of MAHLI autofocus repeatability demonstrated during Curiosity's system thermal test. Between acquisition of each of the above MAHLI autofocus sub-frame images of the MAHLI calibration target, the robotic arm was moved to other positions, then returned to the MAHLI calibration target. In each case, the working distance was 10 cm and the MAHLI autofocus algorithm found focus at essentially the same motor count position (a difference of 3 counts is not significant). The large, dark square is 8 by 8 mm in size. The illumination source was different for the 24 March image, resulting in some portions of the image appearing brighter because light was reflecting off the MAHLI camera head position and acquires an image; this image is stored, the earlier images used to determine the autofocus position are not saved.
Autofocus can be performed over the entire MAHLI field of view, or it can be performed on a sub-frame that corresponds to the portion of the scene that includes the object(s) to be studied. Depending on the nature of the subject and knowledge of the uncertainties in robotic arm positioning of MAHLI, users might elect to acquire a centered autofocus sub-frame or they might select an off-center autofocus sub-frame if positioning knowledge is sufficient to determine where the sub-frame should be located. Use of sub-frames to perform autofocus is highly recommended because this usually results in the subject being in better focus than is the case when autofocus is applied to the full CCD; further, the resulting motor count position from autofocus using a sub-frame usually results in a more accurate determination of working distance from pixel scale.

Autofocus Repeatability
The MAHLI aboard Curiosity has been demonstrated to reliably repeat autofocus. Figure 24 shows an example from the rover system thermal test in March 2011. In this case, Curiosity was placed in a large thermal vacuum chamber and subjected to operations and thermal cycling over several weeks. During the test, the robotic arm positioned MAHLI at a working distance of 10 cm from the MAHLI calibration target and acquired images, then was moved to other positions, and later returned to the calibration target at 10 cm working distance. Slight differences in horizontal and vertical placement are registered in the positional differences between text and black square features seen in each image. Despite these changes, each time the camera was returned to the target, the working distance was the same. This is registered in the equal size of the features observed in each image as well as in the autofocus motor count for each; two of them were in focus at the same motor position, the other was different by an (insignificant) 3 counts.

Manual Exposure
The exposure duration for each MAHLI image can be commanded manually or by using a built-in auto-exposure capability. The exposure duration can range from 0 to 838.8 seconds (i.e., up to 13.98 minutes). Manual exposure times are commanded in units of 0.1 milliseconds and require the user to know something about the expected illumination conditions. Typical use of manual exposure on Mars includes acquisition of dark images (for dark current calibration) and images in which a subject is illuminated by the UV LEDs.

Auto-Exposure
The MAHLI auto-exposure capability is usually the best way to determine exposure duration for scenes illuminated by sunlight or MAHLI's white light LEDs. The MAHLI autoexposure capability is derived from the implementation of  for the MER engineering cameras. To command an auto-exposure, users specify a target maximum DN (digital number; the pixel value), the percentage of pixels permitted to exceed that DN, the number of iterations to be performed to close-in on the auto-exposure value, and an early termination percentage. The user also commands the starting exposure duration. The auto-exposure algorithm causes MAHLI to acquire up to the specified number of images, starting at the commanded exposure time and adjusting the time up or down so as to try to have no more than the specified percentage of the pixels to exceed the target maximum DN. The auto-exposure process is best used under well-illuminated conditions; running autoexposure will terminate when the exposure time exceeds 10 seconds so as to limit the period during which the camera cannot take action to abort its activity if necessary. The early termination parameter saves time because it specifies the point at which the automated process has arrived close enough to the exposure goal.

Previous Exposure
MAHLI can be commanded to acquire a new image with the immediately previous exposure setting. For example, if an auto-exposed image is acquired, and the user believes the next image can be taken with the same exposure, then use of the previous exposure is specified. One approach to commanding an auto-exposure for a large frame of varied illumination is to acquire a sub-frame image over the portion of the field of view for which exposure is important, then command subsequent larger images to use the resulting exposure time. If auto-exposure is commanded for a focus stack acquisition, only the first image is autoexposed; the subsequent images use that same exposure duration.

Video
Video was not a required MAHLI capability. It was required for the MARDI and Mastcam instruments and, because these cameras have the same electronics and flight software, MAHLI can be commanded in video mode. The camera can acquire video frames of 720p high definition format (1280 by 720 pixels); it can also run a video command that acquires larger or smaller format frames. However, because of the <1 full frame per second readout rate between the MAHLI camera head and DEA, the frame rate is substantially less than that which a user might experience watching 720p high definition television. For a 720p format video, the maximum rate is ∼1.9 frames per second. MAHLI video commanding involves specification of the number of images (video frames) to be obtained, a time period to elapse between the acquisition of each frame, and the pixel dimensions and location of the starting pixel for sub-framing (if desired).

Acquisition and Compression Plan
Acquired as 12-bit images, MAHLI data are converted onboard the instrument, without loss of information, to 8-bit images using a square-root companding look-up table. The companding table can be changed (post-launch) if necessary. Although it is possible to store MAHLI acquisitions in compressed form, the MAHLI team plans that the majority of images will be stored in the DEA flash in raw 8-bit form (without compression or Bayer pattern interpolation). Data sent to Earth will usually be a copy of the parent raw image that has been interpolated and compressed in the DEA. The raw parent images can be held in the DEA until such time that the MSL science team is satisfied with the products created from a given raw parent stored onboard. In other words, if the team is unsatisfied with the compression results for a received image, a new product with a more suitable compression quality can be generated and sent to Earth days, weeks, or months later-for as long as the raw parent image remains in the DEA.

Uncompressed Data and Lossless Compressed Data
A full-size raw, uncompressed MAHLI image is about 2 megabytes in size. Relay of uncompressed images from Mars is expected to be extremely rare. Even more rare, for calibration purposes, MAHLI 12-bit image data can be obtained by commanding the instrument to return a 16-bit image. This "calibration mode" is not intended for use on Mars because the data cannot be compressed and file size cannot exceed 1648 by 632 pixels (2 megabytes). Thus two 16-bit images (4 megabytes of uncompressed data) are necessary to cover the full CCD. The 8-bit data can be returned with lossless compression when scientific need requires and downlink data volume permits. Lossless data compression is approximately 1.7:1 and Bayer interpolation is not performed.

Lossy Compressed Data
Most MAHLI images will be downlinked as color JPEGs. The first step performed in DEA logic to create a JPEG from a raw image is to perform a Bayer pattern interpolation based on the method of Malvar et al. (2004). The interpolation kernels have been manipulated to directly produce luminance (Y) and chrominance (C R , C B ) components. Then, a color JPEG image is created using a commanded compression quality between 1 (most compression) and 100 (least compression) and a Y:C R :C B subsampling scheme, usually either 4:4:4 (no color subsampling) or 4:2:2 (chrominance horizontal subsampling by a factor of 2). It is also possible to create a grayscale JPEG (no chrominance). As data volume is reduced when 4:2:2 is used instead of 4:4:4, and the color difference is usually not noticeable; 4:2:2 is likely to be used most often.

Video Compression
The MAHLI video command can be used to acquire a series of individual images or it can be used to take short videos. If the video command states that the images are to be obtained and stored in raw uncompressed form or in lossless compressed form, then the command results in storing each individual video frame as a single image. If the video command states that the images are to be lossy compressed, however, then one data product is produced for every 16 images acquired. This is a JPEG-compressed GOP (Group of Pictures). Like other image acquisitions, commanding video products involves making decisions about trade-offs between image dimensions, compression quality and Y:C R :C B subsampling.

Description
Owing to the limited depth of field usually provided by a macro lens focused on a target at a small working distance, some percentage of a scene may be in focus while the rest is not. Sometimes a technical goal will require that all or most parts of an image are viewed in focus. A focus stack (also known as a z-stack, in which z refers to the camera's optic axis) is a composite of multiple images focused at different distances within a given scene.
Focus stack images are acquired at different focus distances that span a range greater than the depth of field of any one of the individual images. These images are then merged using software to form a single best-focus product. A byproduct of this technique is a second image, the range map, which identifies the portions of each image-acquired at a different z-axis distance-that were incorporated into the best-focus product.
On the MER Spirit and Opportunity rovers, acquisition of a focus stack required robotic arm movement of the fixed-focus MI camera toward or away from a target in small distance increments along the camera's optic axis. This movement usually resulted in small rotations of the focal plane, as well. The MI focus stacks usually consisted of three to seven images that were downlinked to Earth individually, at which point the focus merge was performed (e.g., Sargent et al. 2005).
With MAHLI, the focus distance is changed inside the lens; thus the robotic arm does not need to be moved to acquire a focus stack. This approach results in focus stacks for which the individual images are not rotated relative to each other. MAHLI focus stacks can be acquired and the individual images can be relayed to Earth (as with MER MI), or a focus merge can be performed in the MAHLI DEA. The latter serves as a form of data compression which can reduce as many as eight 1600 by 1200 pixels raw images to a single best-focus 1600 by 1200 color JPEG plus a grayscale JPEG range image. Figure 25 shows an example of a best-focus and range map product from the testbed-MAHLI. The DN values in a range map indicate the position of the best focus portions of each of the parent images used to compile the best focus product, with interpolation of the positions between them. A DN of 0 is assigned to the first image in the stack and a DN of 255 is assigned to the last. The scaling between these is linear such that intermediate DN values represent interpolated distances between the ranges represented by each of the parent images. After the data are received on Earth-and, as was performed to produce Fig. 25the motor count positions for each focus stack parent image can be related to these DNs to determine range or depth (in terms of working distance). Top: Best focus image. Bottom: Range map. These products were made from an 8-image focus stack acquired by the testbed-MAHLI in July 2010. The rock is an iron-rich carbonate from the ∼2.5 billion year old Gamohaan Formation in South Africa. The three large, semi-spherical protrusions are hematite concretions formed from oxidation of pyrite nodules. The sphere is a 2 mm diameter steel ball bearing placed on the rock to indicate scale

Focus Stack Commanding
Commanding a MAHLI focus stack can be a 1-step or 2-step process. If the focus merge will be performed on Earth, the camera is commanded to acquire the images and they are later sent to Earth. If the focus merge will be performed onboard MAHLI, the instrument is commanded to acquire the stack and then a separate command performs the merge.
The parent images for an onboard focus merge are acquired in raw form and stored in the DEA. Owing to data volume and processing limitations, only 2 to 8 images can be focus merged onboard MAHLI. Users can elect, however, to obtain >8 images (up to at least 32), return thumbnail versions of these, and select, from these, 2-8 consecutivelystored images for an onboard merge that will be performed some number of sols after the data were acquired.
To acquire a focus stack, the imaging command specifies a starting position (i.e., motor count) for the lens focus group, the number of images to be acquired, and the number of motor counts for the MAHLI focus mechanism actuator to step through between each image. The choices of starting motor count and number of motor count steps are based on knowledge of the relationship between motor count and working distance (Fig. 13) and knowledge or estimates (e.g., based on engineering camera observations of the rover workspace) of the range of distances that will be in view in the image. It is also possible to command MAHLI to determine autofocus and build the focus stack such that the autofocus position is captured in one of the focus stack images.

Onboard Focus Merge
When onboard focus merge processing begins, a Bayer color interpolation is performed on each of the images to be stacked. Then each is split into Y:C R :C B components. The focus merge and range map are generated on the Y:C R :C B data using a technique described by Nayar and Nakagawa (1994); a windowed Sum-Modified-Laplacian focus measure determines the areas of best focus and a Gaussian interpolation is used to produce the range map.
MAHLI users have four options to produce a focus merge product: merge-only, merge + registration, merge + blending, or merge + registration + blending. The merge-only case is the least computationally intensive and is accomplished most quickly. For an eightimage (1600 by 1200 pixels) stack, the merge-only option takes ∼5 minutes to run onboard MAHLI, merge + registration and merge + blending each take ∼10 minutes, and merge + registration + blending requires ∼15 minutes.
Nominally, most onboard focus merges will be performed using the "merge-only" option. The registration and blending options are available to mitigate the effects of small camera head movements that could occur during acquisition of a focus stack. While the robotic arm is to hold the MAHLI camera head in a single position when a stack is acquired, it was uncertain at the time the focus merge algorithm was developed in 2006-2007 whether vibration occurring elsewhere on the rover might cause the camera to move. Also uncertain is whether wind might cause camera movement during a focus stack acquisition. The question of rover-induced movement of the MAHLI camera head was explored during ground testing of Curiosity in 2010 and 2011 and no evidence of movement was observed. Whether a wind gust might occur while MAHLI is acquiring a focus stack-an event that, for eight images, would complete in less than ∼2 minutes-cannot be predicted.
If they are needed, the focus merge registration option is accomplished using multiresolution Kanade-Lucas-Tomasi (KLT) feature tracking based on the work of Lucas and Kanade (1981) and Shi and Tomasi (1994) with Harris corner detection (based on Harris and Stephens 1988) to identify feature points and track them between image pairs in the stack. The blending option combines the images using multi-resolution spline-based image blending (based on Burt and Adelson 1983). The few focus merge products produced with the testbed-MAHLI on the testbed rover on Earth (in the absence of Mars winds) using all of these options (merge-only, merge + registration, merge + blending, or merge + registration + blending) show no difference in the quality or resolution of the products (mainly because the camera did not move during focus stack acquisition).

Thumbnail Images
Thumbnail images are small color or grayscale versions of parent MAHLI images. Each is ∼8 times smaller than the parent. Their main purpose is to provide a visual index of data stored in the DEA flash memory and they are returned with information that describes the compressibility of the parent image. The latter can be helpful in determining the JPEG compression quality to assign to the future return of that image in lossy compressed form. Nominally, thumbnails sent from Mars will be 4:4:4 color JPEGs with a commanded compression quality.
As thumbnail images are usually JPEG-compressed color images, the number of pixel rows and columns are whole number multiples of 16. This means that the largest thumbnails, for parent images of 1600-1648 by 1200 pixels, are 192 by 144 pixels in size (i.e., slightly less than 8 times smaller than the parent). The MAHLI team recommends that parent images never be smaller than a 256 by 256 pixels sub-frame; this results in a thumbnail of 32 by 32 pixels.
Each image acquired as part of a focus stack is stored in the MAHLI DEA as an individual parent image. Thus, each image in a focus stack generates a thumbnail. Indeed, users can inspect these thumbnails before deciding how to proceed with downlinking the focus stack-do they want to choose a few frames and relay them to Earth, or do they want to select up to eight consecutive frames for an onboard focus merge? When created, focus merge products-a best-focus image and a range map-are immediately stored in the DEA. Each of these two products generates a thumbnail. When images acquired using the video command are stored individually, each parent produces a thumbnail. For video GOPs, only the first frame in a GOP produces a thumbnail image.

Roles and Responsibilities
MSSS staff operate MAHLI-in parallel with operating the MSL MARDI and Mastcamswith assistance of the co-investigators. MAHLI operations are conducted in partnership and close consultation with the MSL science team and MSL rover operations engineers at JPL-Caltech, who make most of the decisions regarding the targets and camera head positioning. Their decision-making process is based on considerations of scientific and engineering needs relative to resources available (e.g., power, schedule, onboard data storage, downlink data volume) on a given sol. This partnership is vital to ensure that the rover and its robotic arm can position the MAHLI camera head at the necessary locations so as to obtain the required images.
MSSS personnel also provide MAHLI data and status information to the MSL Project and science team on a tactical (daily) basis. Further, MAHLI operations personnel monitor the amount of data stored in the DEA and work with the Principal Investigator and the MSL science team to make decisions on when to delete data stored therein (deletion requires Principal Investigator authorization). Working with the Principal Investigator, MSSS personnel also ensure data validation and archiving with the NASA Planetary Data System (PDS).

Tactical and Strategic Release to MSL Team
MAHLI data are made available to the MSL engineering and science teams as quickly as possible after receipt from Mars. These data are used for tactical and strategic planning of future rover activities and initial scientific studies.

Nearly Immediate Release to Public
To facilitate public engagement in Curiosity's mission as the rover explores the Gale field site, all MAHLI images and thumbnails received from Mars will be made available through a public internet site within 24 hours of receipt. Viewers of these images will be notified that these products are not yet validated and are not considered to be appropriate for scientific data analysis.

Validated Release to Permanent NASA Archive
All MAHLI images received from Mars are to be permanently archived. This includes all thumbnails, even in cases (usually by choice) in which the parent image was not received on Earth. The validated data will be placed in the NASA PDS archives on a regular basis (approximately every 3 months), beginning about 6 months after the rover lands on Mars. Data validation is a process that involves human as well as machine verification; the work includes comparison of each version of the data received through different ground receiving stations and data storage devices and inspection and confirmation that the accompanying metadata are correct (or, at least, that uncertainties are identified and documented).

Dust Cover Motion
The MAHLI dust cover opens and closes within 2 minutes when driven at the nominal rate of 150 motor steps per second, regardless of camera head orientation. When in motion, the dust cover sweeps through a volume that extends 5 cm in front of the lens. To ensure avoidance of an obstruction when the cover is to be opened or closed, there should be at least 10 cm of clearance at the time and position that the dust cover will be operated.
Typical MAHLI operations are to be performed with the dust cover open. The exception occurs during the first sols on Mars. During terminal descent, dust might accumulate on the rover deck (Sengupta et al. 2009), perhaps even on the MAHLI camera head. The first time the dust cover is to be opened on Mars requires written authorization from the MAHLI Principal Investigator after an assessment of the camera head's appearance in engineering camera images. This decision will be based on visual inspection to ensure that there are no obstructions that could prevent motion of, or cause damage to, the dust cover. In addition, the engineering images will be used to assess the potential for early, accidental contamination of the lens with dust that might have settled on the MAHLI camera head, turret, or rover deck during the landing. It is possible (although not certain) that the first dust cover opening will not occur until the rover has been driven away from terrain disrupted during terminal descent.
The MAHLI dust cover should be closed and the focus mechanism placed in its home (launch restraint) position when the rover is going to drive or when the drill, DRT, or CHIMRA are to be used. The cover should be closed when a sample is to be delivered or rejected and deposited on the ground. Basically, any operation that could lead to dust contamination of the MAHLI lens is an operation during which the dust cover should be closed. To protect from eolian dust, the MAHLI dust cover should generally be closed when no operation of MAHLI is planned.

Camera Head Positions
MAHLI can take in-focus pictures of any subject at a working distance ≥2.1 cm. The subject of the image can be a rock, regolith, the landscape, the sky, or MSL hardware. Table 4 describes the types of imaging positions that MAHLI users might consider. For typical geologic targets, the MAHLI team recommends that the robotic arm should not be commanded to position the MAHLI camera head closer than a working distance of 3 cm. At 2.1-3 cm, any protrusion (micro-topographic element) that is closer to the lens than 2.05 cm will not Close-up Image Acquired at working distances 2.1 cm to ∼20 cm (MER MI was at ∼6.6 cm). Can be acquired in the robotic arm workspace or at accessible areas on the rover.
Context Image A lower-resolution image in which a close-up image is nested.
Nested Images A series of ≥2 images of the same target acquired at different resolutions from different working distances. This is a highly recommended alternative to acquiring mosaics at very high resolution.
Stereopairs 2-3 images of the same target acquired at different emission angles selected to provide a stereoscopic view.

Robotic Arm Teach Points
Locations on the rover for which the robotic arm has been "taught" to reach and for which MAHLI can be positioned to acquire images of rover hardware.
Landscape MAHLI image or mosaic focused at or near infinity that shows some portion of the terrain.
Sky MAHLI image of features in the sky or, more typically, a featureless image of the sky acquired for flat fielding purposes.
Dog's Eye View An oblique view of rocks and regolith acquired by positioning MAHLI in the robotic arm workspace to provide a view mimicking that of the vantage point of a small animal (e.g., camera 10-60 cm above the ground).
Periscope and Giraffe's Eye View MAHLI is positioned high above the rover; the robotic arm can place MAHLI at a height greater than that of the rover's Mastcam and ChemCam instruments. The image can look down on the rover or at geologic features; for a periscope view the camera provides a view looking up over a cliff face, crater rim, hill, etc.
be in focus and cannot be in focus even when acquiring a focus stack. The 3 cm recommendation allows for protrusions up to ∼0.9 cm; if there is knowledge that there will be protrusions >0.9 cm, a greater working distance is recommended.

Robotic Arm Workspace and Contact Surfaces
The robotic arm workspace is the volume in front of the rover that is reachable by one or more of the tools and instruments-including the MAHLI camera head-on the turret at the end of the robotic arm. MAHLI can also be positioned to document surfaces before and after Curiosity drills, scoops, or brushes them; it can also be positioned to examine areas studied using the APXS and, in some cases, pits of 200-450 µm diameter created by the ChemCam laser will be accessible in the robotic arm workspace. Drill (PADS) holes are about 1.6 cm in diameter and can extend to a depth of ∼6 cm. Brushed surfaces are circles of about 4.5 cm diameter and scooped surfaces are rectangular at about 4 cm by 10 cm. The APXS field of view has a 1.7 cm diameter (Gellert et al. 2009); if the instrument contacts the surface, the area disrupted is somewhat larger.

Robotic Arm Teach Points
Robotic arm teach points are locations in space near the rover at which the robotic arm was trained, during pre-launch testing on Earth, to position the turret tools and instruments. The teach points are listed in Table 5; each is a location at which the MAHLI camera head was positioned and acquired images during pre-launch testing. These images (Fig. 26) can be compared with pictures MAHLI will acquire at these positions on Mars to confirm and validate the positioning under Mars environmental conditions. These positions are taught to the robotic arm because they are locations that the arm and turret will return to frequently throughout the mission. Commands to position a robotic arm instrument or tool near a teach point are built from teach point knowledge. For example, one of the teach points is designed to position the MAHLI camera head at 5 cm working distance from the center of the MAHLI calibration target; from this location, the robotic arm can be commanded to move MAHLI closer or farther from the target or to center an image elsewhere on the calibration target.

Robotic Arm and Turret Stowed Position
When the robotic arm and turret are stowed, MAHLI can acquire in-focus images of the Martian landscape (Fig. 18). When the MAHLI camera head is stowed and the rover is stationary, repeated images of the same scene can be obtained to monitor changes in the scene (e.g., dust-raising events). When the rover is in motion, it can be stopped, repeatedly, after performing short drives so as to create a mosaic of overlapping images of the landscape.

Other Robotic Arm Positions
In addition to positioning MAHLI to acquire close-up images of geologic materials and rover hardware, the robotic arm can point MAHLI toward the sky for flat field calibration; it can point MAHLI to acquire mosaics, stereopairs, or single images of the landscape; or it can point the camera at the rover to provide "self portrait" views. MAHLI can also obtain images of terrain as viewed from any position at which the robotic arm is temporarily (e.g., a few hours, overnight, a few sols) stowed. Further, MAHLI can obtain "giraffe's eye views" of the rover and field site landscape, as the 2-meters-long robotic arm can lift the camera to a maximum of 2.73 meters above the ground and its wrist and turret can be moved to provide pan/tilt positioning.

Stereopairs and Mosaics
Mosaics of MAHLI images are typically obtained by moving Curiosity's robotic arm and/or turret to position the camera head for each image in the desired mosaic. Stereopairs are obtained by moving the robotic arm so as to position the MAHLI camera head for each of the images in the pair. The MSL science and engineering teams determine stereo baseline, stereo toe-in, or mosaic overlap as a function of the purpose of a given imaging activity; for example a typical stereopair intended for creation of an anaglyph would have no toe-in and a baseline of about 1/30th of the working distance.

Acquire and Store the Majority of Images Uncompressed
The highest-quality MAHLI images are those in which the subject matter is in focus and the image has not been compressed. As it is not likely that uncompressed MAHLI data will be routinely relayed from Curiosity, the data received on Earth will be compressed. As noted, most data will arrive as JPEG color images. However, suppose an image is received and the rover science and engineering teams are not satisfied with the way it was compressed.
Perhaps the compression quality was poor or perhaps something is observed in the image that compels a need to receive an image of higher quality. Data stored in uncompressed form in the DEA can be sent to Earth multiple times, using different compression schemes, until the team is satisfied with the result. Any given image could be re-queried days, months, even years after the image was acquired, as long as it has not yet been deleted from the DEA.

Acquire More Images than Can Be Relayed to Earth
The DEA 8 gigabyte flash memory can hold ∼4000 uncompressed 1600 by 1200 pixels images. The maximum number of images either of the MER rovers returned from a single sol (between January 2004 and May 2012) was 129. If MAHLI were to acquire and store 130 raw 1600 by 1200 pixels images every sol, the buffer would fill in a month. On most sols, however, MAHLI might not acquire any images (or very few) because the robotic arm will not be operated every sol. Given the large data storage capability, MAHLI users should always consider acquiring every image that might ever be desired at a given position of the camera head. For example, after going through the effort to drive the rover to a rock and maneuvering so that the rock is in the robotic arm workspace, then going through the effort to heat the mechanisms and deploy the robotic arm and position MAHLI at a location from which to acquire an image of the rock, the team will elect to obtain every picture that might ever be needed from that spot.
An example is as follows: The science team has identified a target on a rock for which they desire a MAHLI image to be acquired at the minimum working distance. This distance would be 2.1 cm, but it is recognized that robotic arm positioning is somewhat uncertain and the rock may have micro-relief of the order of 1 cm, so it is best to command the arm to place the MAHLI 3.1 cm from the target. Once MAHLI arrives at the commanded position, the following suite of acquisitions are made: (1) an autofocus sub-frame of 480 by 480 pixels at the center of the MAHLI CCD (used to determine focus for the next images to be acquired); (2) a full-size image (1600 by 1200 pixels) of the target; (3) a second, 1600 by 1200 pixels image, this time with the right side group of two white light LEDs illuminating the target; (4) a third full-size image with the left group of two white light LEDs illuminating the target; (5) a fourth full-size image with both groups of white light LEDs illuminating the target; and (6) an eight-image focus stack of 1600 by 1200 pixels images.
In this ideal example, a total of 13 images are acquired after a single positioning of the MAHLI. This sequence would typically execute in <3.5 minutes. Nominally, thumbnails of Testbed-MAHLI white light LED illumination of a rock target at ∼2.2 cm working distance by one group of LEDs, then the other. Top: LED illumination from the left. Bottom: LED illumination from the right. Note the difference in details seen in each image. These are sub-frames of 8-image (each) focus merge products acquired on 25 May 2010. The rock is a rhyolite clast weathered out of the nearshore Pliocene/Pleistocene Lindavista Formation conglomerate that caps mesa tops in the Mira Mesa suburb of San Diego, California all 13 images would be returned to Earth, along with one of the 1600 by 1200 pixels autofocused images. If a stereopair is desired, the camera would be repositioned at an appropriate location (e.g., translate it 1/30th of the working distance, in this case ∼0.1 cm to the right or left) and another 13 images would be acquired.
The science and engineering teams would then evaluate-over the coming days, weeks, or months-whether to return any of the other images. For example, perhaps there will be an interest in performing an onboard merge of the focus stack of 8 images and return those products; or, perhaps a team member has examined the returned image and thumbnails and concludes that it is desirable to see the target as illuminated by each of the right and left groupings of white LEDs in order to seek a glint off a mineral crystal face or cleavage plane (Fig. 27). Having the ability to acquire more images than can be returned to Earth ultimately enables a richer science return.

Thumbnail Use
Thumbnail images will usually be downlinked as soon as possible after they are acquired or focus merge products are produced. Depending on available downlink data volumes and the prioritization for the return of any given MAHLI image, thumbnails will typically arrive first. In many cases, thumbnails will be the only version of a MAHLI image that is transmitted to Earth.
Thumbnails are important. First, they are used to confirm that a commanded image was acquired (or produced, in the case of focus merge products). Second, they give an indication as to how well MAHLI was positioned-motor count is returned with the thumbnail, hence the working distance (z dimension) can be estimated and the thumbnail, itself, shows the positioning results relative to the camera's x and y dimensions. Third, metadata returned with the thumbnail will include information about the compressibility of the parent image. For images not yet returned to Earth, this knowledge will help the MAHLI team determine the optimal JPEG compression quality for an image to be downlinked another time. Fourth, examination of the thumbnails can help users make decisions about reprioritization to downlink images stored in the DEA and whether an image should be downlinked at all. Finally, for some purposes, only the thumbnail is needed. For example, if there is a desire to check whether the MAHLI LEDs are functional, position the camera head at the 5 cm working distance robotic arm teach point in front of the glass bar target on the MAHLI calibration target, take a picture with the LEDs illuminated, return the thumbnail, and see whether the reflection of the LEDs is evident.

Consider Image Scale and Area Coverage Trades
Whereas MAHLI can acquire images with spatial resolutions as high as 14-15 µm per pixel, doing so is not always necessary. Further, acquiring a mosaic of multiple ∼15 µm per pixel images might not often be necessary. Each movement of Curiosity's robotic arm expends energy and, because the field of view at maximum spatial resolution is so small, many images (and many arm moves) might be required to produce a mosaic covering a given area at that scale. However, rather than acquiring a large mosaic at 15 µm per pixel, users might acquire just a few images at 15 µm per pixel within a suite of nested context images that cover the full target area at lower resolution.

Focus Stack Acquisition
Focus stacks need not always be acquired. Whether to do so is a function of the depth of field anticipated for the subject, the science or engineering objectives for the image(s) to be acquired at a given position, and the resources (schedule, power, etc.) available to acquire, store, and downlink the data. Consider Fig. 28, a simulated MAHLI image obtained at a field site in which rock surfaces at the lower left and top/upper right are not in focus. In this case, acquisition of a focus stack would have permitted construction of focus merge products, but the added science value would be miniscule.
However, although the science return might only be incremental in some cases-and, in keeping with the philosophy that, once the effort and energy have been expended to position MAHLI at a given location every possible image that might be desired at that location should be acquired and stored in the DEA flash-if resources permit, then a focus stack should be acquired in addition to any other images (e.g., autofocused views, LED-illuminated images) of a target. In this case, the autofocused image might be the only one returned from Mars, Fig. 28 Simulated MAHLI image of a fluvial conglomerate with a sand matrix near Green River, Utah. The rock is part of an inverted paleo-stream channel system in the early Cretaceous Cedar Mesa Formation. Although portions of this 12 October 2010 image are out of focus at the lower left (near the camera) and top/upper right (far from the camera), the image contains all of the scientific information of interest at this location and at this scale. It was not necessary to acquire a stereopair or a suite of focus merge (z-stack) images to record the properties of the pebbles and the sandy matrix. The cent diameter is 19 mm and its thickness is ∼1.55 mm along with the thumbnails of the focus stack and any other images acquired at that position. If, upon examination on Earth, the science team finds that the autofocused image insufficiently addresses the science or engineering goal, then they can consider performing an onboard focus merge of some or all of the focus stack images or they can consider returning one or two of the images in the focus stack. Figure 29 shows an example of mineral fluorescence induced by illumination from the MAHLI UV LEDs. Use of the UV LEDs to search for fluorescent or phosphorescent materials on Mars should be performed in the dark of night. The approach will be to first illuminate the scene with the white light LEDs and find focus using the autofocus capability. Then acquire a full-frame image illuminated by the white light LEDs to document the materials present. Next, obtain a series of UV LED-illuminated images at different manually commanded exposure durations because it is unknown whether something will fluoresce and how long to expose for a successful acquisition. Each UV-illuminated image would be accompanied by a dark image of equal exposure duration for noise characterization (Goetz et al. 2012). Phosphorescence is sought by further illuminating the target with the UV LEDs for a period (e.g., 1 minute) followed by acquisition of an image with no LED illumination. The acquired images would be stored in uncompressed form in the DEA and their thumbnails sent to Earth. The thumbnails would be examined; if a luminescent material is present, it might be apparent in a thumbnail. If a potentially luminescent material is too small to be detected in a thumbnail image, an alternative approach is to acquire small sub-frames and return those to Earth for inspection.

Interplanetary Cruise
The MAHLI investigation does not collect scientific data during the interplanetary cruise phase of the mission. At this time, the rover and descent stage vehicle are inside the MSL cruise stage spacecraft for the journey from Cape Canaveral, Florida, Earth, to Aeolis Palus in Gale, Mars (Abilleira 2010). The robotic arm and turret are stowed during this period.
Three cruise phase instrument check-outs were planned for MAHLI. The first two occurred in March and April 2012, the third happened in mid-June 2012. These tests provide a confirmation of instrument functionality and health following the vigor of the launch vibration environment. The test sequence acquires two dark images and two images with the white light LEDs illuminated, each with an exposure of 2 seconds. To ensure that the instrument mechanism remains in its launch restraint for the entry, descent, and landing phase of the mission, the focus mechanism and dust cover are not moved. The tests confirmed the instrument is healthy; an example of one of the white light LED-illuminated images is shown in Fig. 30.  Fig. 30 MAHLI white light LED-illuminated image acquired during the cruise to Mars on 20 April 2012. The dust cover was closed and the focus mechanism was not operated, hence the rover hardware in this scene is not viewed in focus. The nearest object, the Curiosity rover's forward mobility bracket, was ∼19 cm from MAHLI. This hardware will not be visible to MAHLI from the stowed position after the August 2012 landing occurs

Mars Surface Commissioning Functional Tests
Very little MAHLI activity is anticipated for the first few sols after landing. Two tests of the MAHLI focus mechanism are planned; with the robotic arm and turret still in their stowed position, MAHLI is to acquire 1-2 in-focus color image(s) of the Martian landscape with its dust cover closed. The next phase of surface commissioning activities will occur some number of sols (possibly a few weeks) after landing. In this phase, the robotic arm and turret will undergo inspection and functional testing and MAHLI will acquire images at the robotic arm teach points (Table 5) to confirm positioning. MAHLI will also acquire its initial performance characterization images of the MAHLI calibration target and document any dust that has settled on the APXS calibration target and the REMS UV sensor.

Routine Instrument Performance Verification, Calibration, and Monitoring
Images of the MAHLI calibration target aboard Curiosity will be used to verify and monitor camera performance on the Martian surface. In particular, images of the bar target acquired from different distances will verify the relationship between pixel scale, motor count, and working distance. Images that show Martian terrain in the same scene as the gray and color swatches on the calibration target will be used to refine models for white balance in the Martian environment. The MAHLI calibration target will also be imaged routinely to verify or monitor LED functionality and three-dimensional (e.g., stereo, focus merge) performance as necessary. Imaging of the MAHLI calibration target need only occur occasionally, perhaps every 4-6 months. Lossless-compressed flat field data will be acquired on Mars by pointing MAHLI at the sky in a direction 180 • in azimuth away from the position of the sun when the sun is ∼45 • above the horizon and the camera is pointed ∼45 • above the opposite horizon. Calibration and performance monitoring data can be acquired with the dust cover open and closed, if necessary.

Concluding Statement
Walter Frederic Gale (1865Gale ( -1945, for whom the crater Gale is named, was credited to have been the first (or among the first) to identify, through telescopic observations, alignments of low-albedo features on Mars that were initially called "lakes" (Maunder 1894(Maunder , 1895 and, later, "oases" (Wood 1946). Curiosity will land at an elevation near −4.5 km on 6 August 2012. The rover will be used to explore sedimentary rocks presented in stratigraphic sections both on Aeolis Palus and Aeolis Mons (Mount Sharp). The investigation will include the search for evidence that Gale once (or more than once) actually hosted a lake-not the "lakes" mentioned in the 1890s, but a potentially habitable environment that could have occurred in Gale 3-4 billion years ago. The Mars Hand Lens Imager (MAHLI), a 2-megapixel color camera with a focusable macro lens, will be used in concert with Curiosity's other tools and instruments (Table 2) to investigate rock and regolith texture, structure, morphology, mineralogy, and stratigraphy in the field area. MAHLI will also be used to support engineering operations such as documentation of samples and problem diagnosis. As MAHLI can be focused on any target from about 2.1 cm to infinity, the camera can be positioned in a wide variety of ways to examine materials and features on the rover, in the robotic arm workspace, and in the landscape.
Open Access This article is distributed under the terms of the Creative Commons Attribution License which permits any use, distribution, and reproduction in any medium, provided the original author(s) and the source are credited.