Mars Reconnaissance Orbiter Context Camera Updated In‐Flight Calibration

The image data of the Context Camera (CTX) of the Mars Reconnaissance Orbiter require a flat‐field correction that is currently available as a plain text file in the Planetary Data System “Calib” folders for all CTX Enhanced Data Record releases or automatically implemented as part of the ctxcal application of the Integrated Software for Images and Spectrometers (ISIS). We noticed (a) differences between these two flat‐fields and (b) residual edge darkening (vignetting) after applying ctxcal. This work examines in detail the edge‐darkening effect over time and creates a new improved flat‐field calibration file to be implemented into the ISIS ctxcal application as a new default. We introduce a method to quantify the vignetting effect and its residuals after regular ISIS calibration. With the old calibration, the amount of residual edge‐darkening is about eight percent. We prove that the new calibration does remove the effect completely, does not introduce any artifacts and qualitatively and quantitatively validate newly calibrated images. Mosaics produced with images that have been calibrated with our new flatfield show immediately less striping issues, without the application of any standard mosaicking‐related tone‐matching techniques.


Introduction
The Context Camera (CTX) onboard NASA's Mars Reconnaissance Orbiter (MRO) (Malin et al., 2007) has been in orbit since 2007 and has so far (as of December 2023) acquired more than 145,000 images that have been transmitted back to Earth.The images are one of the most popular data sets for planetary geologists.They offer extensive planetary coverage and excellent radiometric resolution for enhanced contrast and represent a unique resource for interpreting surface features.Although the accompanying camera High Resolution Imaging Science Experiment (HiRISE) currently has the highest ground sampling dimension of all scientific cameras sent to space (up to 30 cm per pixel, McEwen et al., 2007), it will not reach the complete surface coverage in the foreseeable future.The spatial sampling of CTX with approximately six m per pixel (mpp) is ideal for the interpretation of the most common surface processes, and it is still in the range of more recent cameras sent to Mars, such as the Colour and Stereo Surface Imaging System (CaSSIS) instrument onboard the Trace Gas Orbiter (TGO).
The Integrated Software for Imagers and Spectrometers (ISIS) is a software library and set of tools to support ingestion, processing, and analysis of planetary science data (Laura et al., 2023) and is the standard processing framework for CTX images.Since the beginning of its mission, images of the CTX instrument have exhibited a subtle darkening effect, from the center of an image toward the edges of the sensor (i.e., across-track).Such effects are usually caused by lens vignetting and should be corrected by the flat-field correction provided by ISIS.Although it might not always be visible by looking at a single image as the surface variations often overprint the darkening effect, the problem manifests as visible seam lines at the image borders when multiple images are mosaicked together and, of course, also affects albedo measurements from the camera's calibrated values.Due to its typical shape when plotted as a profile, the effect is sometimes called the "frown" effect, analog to the spectral smile effect in hyperspectral image processing (see Figure 1).Some authors have addressed this darkening effect and its correction in their work, primarily based on their activities related to image mosaicking of CTX.Robbins et al. (2020aRobbins et al. ( , 2020bRobbins et al. ( , 2023) ) mention the appearance of darkening across the line scan camera and explain it by the pixels at the edges of the detector being less sensitive than those in the middle.They claim that the amount of the effect had changed during the camera's lifetime and explain it with the aging of the hardware.Their successful correction of the edge-darkening effect is based on applying empirical flat-fields on top of the already calibrated images.In particular, they use the ISIS routine makeflat first to build an additional flat-field for a distinct set of images that have already been calibrated with ctxcal and then use ratio to apply the supplementary multiplicative correction.A separate flat-field for each configuration of different image widths is applied, and the temporal changes are addressed by using images of the same mission month for each respective flat-field.Presumably, due to limited stochastic variety in their pool of images for each configuration, the authors describe brightness differences inherent in the flat-field being imprinted on other images.They solve this problem by visual examination and re-processing of the "faulty" images with "different" (unpublished) parameters (Robbins et al., 2020a).Dickson et al. (2018Dickson et al. ( , 2020Dickson et al. ( , 2023) ) describe the effect as "smile" artifacts being a disturbing factor in their image blending process during the creation of the "Murray Lab's Global CTX Mosaic."As a solution, they apply a column-based normalization on the single images using the ISIS program cubenorm, which works on one image to create normalized values in line direction and performs a multiplicative correction for each pixel in a single step.According to the authors, this method has the drawback of introducing vertical striping artifacts for low signal-to-noise images.While using only one image for the column-based normalization curve might successfully normalize the images in a visually pleasant way, the risk of introducing artifacts by systematic surface-related brightness variations (see Section 2.3 and Figure 4) seems to be very high and homogenization of the natural reflectance variations might be the consequence.The global CTX mosaic presented by the authors shows a highpass filter effect which becomes visible by zooming out to planet-scale resolution-the planet appears as a "flat" single gray value, which does not represent Mars as we know it.A systematic removal of the residual edgedarkening effect of the single images would require less drastical tone-matching methods and would therefore improve the low-frequency component of the mosaic.
The public does not have access to any of the aforementioned work-arounds for eliminating the residual edgedarkening effect following nominal calibration.Even more individual solutions for creating mosaics for scientific publications seem to exist, but the methods are not mentioned in the respective papers.In this work, we aim to develop a new solution to correct the residual edge-darkening effect that goes beyond the limitations of current methods.We are investigating whether the problem exhibits any temporal variations and provide insights into how it might change over time.We present a new empirical flat-field calibration file for ISIS which removes the residual edge-darkening effect and ensure that it does not introduce any artifacts, and provide it to the public.Additionally, we perform in-depth quantitative and qualitative validation of calibrated images to show the significance and validity of the improvements.

Materials and Methods
To thoroughly explore the impact of the CTX camera's edge-darkening effect, we have to first gain a comprehensive understanding of the camera itself and the standard data processing pipeline, with a particular emphasis on the calibration procedures.We then describe our methods for creating a custom flat-field calibration to eliminate the darkening effect from the images.

CTX Camera and Data Summary
The CTX instrument is built around a Kodak KLI-5001G charge-coupled device (CCD) image sensor with a nominal length of 5,056 pixels (px).In the camera setup, only 5,000 px are in active use, while 38 px at the beginning and 18 px at the end of the sensor are masked and serve as reference pixels to determine the dark currents.The radiometric resolution of the sensor is 12 bit, and the delivered digital numbers (DNs) in the range of 0-4,095 are compressed to 8-bit by internally storing the values in a square-root-based lookup table.The signal processing consists of two separate analog chains with odd (A) and even (B) pixels alternatively processed by each channel.The value of the temperature sensor of the focal plane assembly (FPA) is stored in the binary header of every recorded image line (Malin et al., 2007).
At the time of this writing (December 2023), the Planetary Data System (PDS) data release No. 67 from 1 December 2023 added the latest CTX images up until May 2023 for a total number of 145,086 images containing 15.59 TiB of data in compressed PDS format.From the 139,071 images marked as not erroneous in their label, 139,027 were pointed to the surface of Mars.Most of this subset (137,657 images) have been commanded without pixel summing and with an entire 5,056 sample image width, 1,370 with a binning mode of two, leading to half the image width.In a special windowing mode with a sample_first_pixel setting other than zero 20,025 images have been taken.
The CTX file naming in the PDS follows a scheme where the first character corresponds to the Martian year followed by two digits representing the Earth month.for example, the images from the first month of the nominal mission start with P01, a month later change to P02, and so on.They are followed by a 6-digit number for the MRO orbit and a 4-digit number representing the center latitude of the image relative to the descending equator crossing on the planet's dark side.While this first part of the file name provides a unique identifier for the respective image, the other characters are used for categorization and spatial localization on the planet.Two letters state the initial commanding of the image, followed by a combined code of center latitude, hemisphere, center longitude, and a final "W," denoting the western longitude direction.Underscores separate all of the mentioned elements.Further details about the file naming scheme are given in Bell et al. (2013, Appendix A).

CTX Data Calibration
The intensity measured by the CCD is affected by three main instrument-dependent components: The bias and dark-current levels and the pixel-to-pixel responsivity variations of the sensor line.Bias and dark current are additive components to the signal and mainly depend on the signal chain.While they can be considered as constant for all pixels of the respective odd (A) or even (B) channel (Bell et al., 2013), pixel-to-pixel variations are an independent multiplicative factor for each CCD element individually.

Pre-Flight Flat-Field Calibration
Pre-flight modeling of the dark current proved an exponential dependence on the temperature of the FPA and predicted "essentially zero" dark-current contributions at typical CTX flight operating temperatures, with the temperatures depending on solar distance and orbital geometry.The geometric characteristics of the optics contribute to uneven illumination across the sensor.Together with variations in the quantum efficiency of the CCD, they lead to intensity variations along the CCD line.Pre-flight calibration measurements in the laboratory with the camera mounted on a rotation stage allowed the construction of a flat-field, a common technique to eliminate these variational effects in a multiplicative operation.For each angular position, a 1-dimensional flatfield array was created.First, the dark reference pixels were subtracted from each line of data.To improve the signal-to-noise ratio, all 128 lines of data were summed, and the data from all positions were combined into a new 5,056 px flat-field array by choosing the maximum value for each pixel in the array.The flat-field array was normalized to produce an average value of 1.0 (excluding the masked reference pixels) (Bell et al., 2013).The general shape of the flat-field is a curve with its maximum in the middle and a distinct negative peak around the center representing a single cold pixel with lower sensitivity than its neighbors (see Figure 2, red line).

In-Flight Calibration
Regular in-flight performance and calibration monitoring and validation have confirmed stable and consistent camera performance regarding bias, dark current level, and flat-field behavior after orbit insertion.The flatfield validation consisted of an in-flight calibration using dedicated observation maneuvers where the spacecraft's attitude was rotated by 90°during flight, leading to a CCD orientation parallel to the direction of the spacecraft's motion.The resultant smearing effect allows the reduction of terrain-induced intensity variations related to the recorded surface, and averaging the smeared line-averaged pixels from 15 such images recorded between 2006 and 2008 led to an updated in-flight flat-field data set.It was considered very similar to the preflight calibration, and it was decided to keep the pre-flight calibration as the default CTX flat-field for the PDS archive (Bell et al., 2013).

Calibration Pipeline as Described in the PDS
Extensive documentation about the data calibration is available in the "Calib" directory of every CTX image release at the PDS, for example, at the PDS Imaging Node.This directory contains a file with instructions for the calibration algorithm, the table for converting the compressed 8-bit data back to 12-bit, and the pre-flight flat-field values as a table, all in plain text format.During the decompanding of the data, a 12-bit value is determined for every 8-bit value from a static table.For bias and dark current subtraction, the background signals of both the A and B channels are determined by averaging the DN values of their respective masked-off reference pixels and subtracting these values from the respective (odd or even) unmasked pixels.The flat-fielding is performed by dividing every pixel value by the corresponding value from the "ctxflat.txt"flattening table, also located in the "Calib" directory (see red line in Figure 2).If the respective image sequence was commanded using spatial binning or window mode, the flattening table has to be appropriately aligned with the image.The mean difference between even and odd pixels is added or subtracted (summing mode one only) to equalize possible small differences between the A and B channels.In a subsequent step, the data may be converted to I/F or radiance values (Bell et al., 2013).

Calibration Pipeline as Implemented in ISIS
The CTX calibration pipeline is implemented in the ISIS software following the description in the PDS release folders in general but with a few differences.The tasks of the calibration pipeline in ISIS are split into three executables: 1. mroctx2isis for the conversion of the PDS format into the ISIS cube format.During this task, the dark pixels are moved to an internal ISIS table in the cube file referenced by the cube's label.Usually, this command is followed by a call to spiceinit to store the spacecraft position, attitude, and planetary constants in the label.2. ctxcal performs the bias and dark current correction as described in the PDS workflow document, together with the division of the pixel data by the normalized flat-field values.The data can be converted to I/F values as a consecutive step.3. ctxevenodd removes any remaining systematic offset between the even and odd pixels (appearing as stripes along the sample direction) by adding or subtracting half of the average difference of all even and odd pixels (only for the images taken with summing mode set to 1, i.e. no binning).
The current standard flat-field file used in ISIS is stored in the calibration directory of the mro subfolder in the IsisData area, in the form of the one-dimensional cube file ctxFlat_0002.cub(see Figure 2) together with a description file "ctxFlat.txt,"which lists all images used for the flat-fielding process.When using the ISIS ctxcal tool, if no explicit flat-field file is assigned using the flatfile parameter, the calibration file with the highest version number in its file name is automatically used.It should be mentioned here that we could not reproduce an identical flat-field file from the list of images, which might be caused by using a unique set of parameters we are not aware of.

Frown Factor
The overall shape of the CTX flat-field is a curve as shown in Figure 2 for the PDS or ISIS flat-fields, where the difference between the center and the edges of the detector represent a quantifiable strength of the darkening effect caused by vignetting.To quantify the amount of this edge darkening correction by a flat-field, we introduce the concept of the frown factor.Similar to the band depth feature quantification in spectral analysis, the amount of darkening correction by a flat-field can be expressed by building the ratio of the mean values of the central area of the flat-field over the mean of its edges.We determine the arithmetic mean of a range of pixels over the central maximum of the flat-field and divide it by the mean value of some pixels from the minimal values at both edges.Using 800 pixels from the center and 50 pixels on both edges with a distance of 50 px to the borders proved to be a reliable calculation of the frown factor (see Figure 3).

Earth and Space Science
10.1029/2023EA003491 WALTER ET AL.
The same measure can be calculated from images.To assess the impact of the residual edge darkening effect in an image, we compute the arithmetic mean values for each pixel across all lines and determine the ratio accordingly.This factor is useful to quantify the initial darkening effect caused by vignetting if derived from images without flat-field calibration.Although a single image's frown factor could be utilized to quantify the individual amount of edge darkening in the image, it may not consistently capture the genuine magnitude of the camera's edge darkening.Depending on the image (or, in the case of a flat-field, the images used to derive it), it might be strongly influenced by the recorded topography or reflectance in the images.Thus, the frown factor is not strictly tied to the edge darkening effect, especially when the images exhibit a natural brightness distribution systematically increasing toward the borders, attributed to surface reflectance or topography (refer to Figure 4).Non-uniform spatial distribution of surface reflectance or topography-induced illumination can overprint the real vignetting effect and influence the frown factor.Following the central limit theorem, we assume that the influences of topography and brightness should equalize for a high number of images.We will find the frown factor as a measure of the camera's vignetting effect for all images if the distribution is symmetric around its mean and tends toward a normal distribution.If not, we don't have a reliable source for the quantification.The same assumption is made when choosing many images for building a flat-field for the calibration.

Custom CTX Flat-Field in ISIS
A custom flat-field can be created by the ISIS tool makeflat, which accepts two input parameters stdev and numlines together with a list of cube files used as input images for the flat-field creation.The two parameters are intended to exclude certain areas from the flat-fielding process due to extreme surface variations.The makeflat algorithm averages a patch of numlines number of lines and normalizes it by dividing it by the arithmetic mean of all pixels of that patch.If the standard deviation of the patch is larger than the user-entered stdev parameter value, the patch is excluded from the calculation.The arithmetic means of the 5,000 pixels are calculated and stored in a cube file as a one-dimensional vector for all remaining patches from the complete list of input images.
Instead of correcting the edge-darkening effect after the nominal ISIS ctxcal calibration, we aim to replace the existing flat-field and update it with a suitable new version.If the CTX camera degrades or changes its calibration-dependent properties over time, we might end up with several flat-fields, each valid only for a specific time range.Before building a flat-field from a pool of input images, we correct the input data from bias and dark-current effects without any initial flat-field correction.As the ISIS ctxcal command combines these two corrections, we turn off the flat-field correction in ctxcal by providing a custom flat-field file where all values are set to one.The resulting pre-processed bias/dark-current corrected files are provided for calculating one or several new flat-fields.At this stage, we could also include using ctxevenodd for A/B channel equalization in the pre-processing, but for a first-order correction and validation, we leave out this step for the time being.Later we thoroughly compare the two cases and discuss them in Section 4.
The selection of appropriate images for the flat-fielding process is vital for a good quality flat-field.We base this selection on attributes existing in the PDS index files, which accompany every official CTX data release.We use the planetarypy package (pypi.org/project/planetarypy) to access the index, which provides it in the form of a Pandas table in Python, including automatic checks for updates in the index table.For additional selection criteria, we compute image statistics using ISIS' stats on each image and join the results with the PDS index.
Images that met our specified selection criteria (as described in the following section) underwent processing in parallel using Bash scripts, with each image assigned as an independent task.For validating the created flat-fields and the various variables as time series, we store the data in xarray objects in Python and use the holoview library for plotting.Pre-processing of the CTX data has been performed on the High Performance Computing (HPC) system of Freie Universitaet Berlin (Bennett et al., 2020).

Results
In the following paragraphs, we describe our results of the flat-field calibration, presented in the sequential order of our self-conducted process.The following sections describe our learning process while developing the best criteria for image selection to optimize the flat-field correction.

Monthly Flat-Fields
Following the work of Robbins et al. (2020aRobbins et al. ( , 2020bRobbins et al. ( , 2023)), we initially created separate flat-fields for every mission month.In a first attempt, we include all available images for every month and exclude images labeled as erroneous and images with a sample length smaller than the full CCD width of 5,000 px (caused by either binning or windowing).The result is a set of 196 single independent flat-fields.Our first observation is that many of these flat-fields differ only marginally.By dividing each flat-field by the flat-field of the first month of the nominal mission (P01) and plotting the resulting curve, we can visualize the deviation of the respective flatfield from the first mission month (see Figure 5).During the first 140 mission months until month K12 the plots follow a more or less horizontal line around the value one, meaning a good agreement with the first month.
After that time, we observe two effects appearing in the data: pixel number 1357 becomes unstable, and the curvature of the ratio curve starts to increase, which would mean an increasing edge darkening effect over time.

The Unstable Pixel #1357
Appearing at around mission month P10, we observe a noticeable new single peak line at pixel number 1357, which often changes its amplitude and, therefore, does not behave consistently over time; partly, its signal is below the neighboring pixels, sometimes above (see Figure 5).To understand the distribution of the unstable pixel 1357, we perform a closer investigation on the exemplary mission month J17 and its specific images forming the flat-field.For J17, we calculate the column average for every image to get a mean value for all pixels in the sample direction.However, for more insight, this time, we do not average over all images but keep the profile for every image as an additional dimension.By now plotting a profile for a given pixel across all images of the mission month (see Figure 6), the extreme average pixel values reveal as originating in some few individual outlying images.By inspecting the responsible images, we find two causes for this behavior of the pixel: 1. Occurrences of overexposure in images lead to a high increase of the DN signal for pixel 1357.This effect lasts for several imaging scenes, so subsequent images show higher signals on those pixels.2. Very low overall image signal (dark images) taken for calibration purposes or other reasons show a significantly higher signal for the 1357 pixel.This effect is greatly enlarged because the flat-field is normalized, so a high pixel value is divided by a very low average of all pixels.This can lead to very high peaks in the final flatfield.
Both effects can be detected by looking at the statistics of the images.The overexposed images contain Not a Number (NaN) values-which are found in the ISIS statistics of the images (labeled as "Null").The very dark images usually contain negative pixel values, presumably created during the dark-current subtraction.If we exclude images containing Null values and negative values, we can significantly improve the flat-field consistency.

Temporal Variations
Starting with mission month K13, the former straight line of the ratio with mission month P01 shows a decrease of the values toward the sides, meaning an increasing edge darkening effect (see Figure 5).This trend continues, becomes more robust, and peaks around mission month K15.Then, over the mission time, it gets weaker until it fades out before mission month N04, where the ratio curve transitions again into a more or less straight line.In mission months N11 and N12, we observed extreme high-frequency alterations (noise) in the signal with high peaks of pixel 1357 in alternating directions.During the rest of Martian Year 36 ("N") until the current Martian Year 37 ("U"), the curve follows the previous trend of a more or less straight horizontal line (±2%).
The temporal evolution of the distribution of the frown factor, that is, the amount of darkening toward the detector edges, across all images is illustrated in Figure 7.The frown factor remains relatively consistent around its mean of 1.55 until the end of 2018, followed by a subsequent rise until early 2020.Throughout this interval, the average frown factor for all images rises to approximately 1.6, and throughout 2020, it reverts to the value observed before the mentioned change.
Let us investigate further the distribution of the frown factor of all images excluding the problematic year 2019 (Figure 8).We observe that the mean and median values are very close together, and the data is more or less symmetrically distributed around their means (see kernel density estimation plot in Figure 8 left).In contrast, if we plot the density of the frown factors of all images from 2019, we see a skewed data distribution (Figure 8 right).As the frown factor outside the irregular time interval from 2019 until early 2020 appears very stable, we can safely assume that the edge-darkening effect is stable over time.The deviation from its mean during the period in question is not representative, as the aforementioned central limit theorem is not fulfilled, which we observe in its non-symmetrical distribution.A separate flat-field for the exceptional period seems inconsistent with the skewness of the data, and the same flat-field of the stable period should also be applied to this data.

Single Flat-Field for the Whole Mission
As the frown factor outside the irregular period starting in 2019 and ending in early 2020 appears very stable, we can replace the monthly flat-fields with a single flat-field.Additional detailed investigations of the skewness of different years reveal the most symmetric distributions from 2010 to 2014.We choose a random subset of 10,000 images from this period (excluding images containing Null values or negative values) and build a single global flat-field using makeflat.A global flat-field versus multiple separate monthly flat-fields has two crucial benefits.
First, the number of images for the averaging is very high; some single months contain only a few hundred images, leading to unequal signal homogenization for that respective month (such as the observed high-frequency alterations mentioned above).Second, the handling of a single file during processing is much easier.A single flatfield calibration file can be added with a subsequent version number in the CTX calibration directory so that the ctxcal command will then automatically use this new calibration.Automatically using monthly files would require additional programming inside ctxcal or by the calling routines.
We observe an excellent agreement of the single global flat-field with the initial laboratory flat-field measurements of the camera (see Figure 9 below, and Figure 5 from Bell et al., 2013).The discrepancies mostly fall within the range of ±2%, affirming the general stability of the CTX CCD's pixel-to-pixel response variations over the nearly 20-year period encompassing the laboratory and in-flight assessments.

Evaluation and Discussion
One of the main advantages of the improved calibration is better in-image stability for image mosaicking, which leads to homogeneous mosaics.An example of this is provided in Figure 10.The seams between adjacent images are strongly visible in the left mosaic, processed with the nominal flat-field in ISIS.Using our new flat-field calibration file, most seams are no longer visible.They provide a highly improved base data set for subsequent brightness normalization techniques such as described in Michael et al. (2016).For a quantitative evaluation, we randomly chose 10,000 images over the full mission timespan and calibrated them with the standard ISIS calibration pipeline, but providing our new flat-field file when using ctxcal.The arithmetic mean of the frown factor of these corrected images is then 1.00, which proves a very good correction result and  confirms the frown factor as a good quantification of the edge-darkening effect.Next, we randomly reduced the subset to 1000 images and performed a systematic visual inspection for qualitative evaluation.We could not find any signs of a remaining edge-darkening effect during the visual investigation.Using the new findings, the absolute amount of the residual edge-darkening effects can now be determined.We get an average residual frown factor of 1.079 by calculating the arithmetic mean over the individual factors of all images from the validation data set calibrated with the previous flat-field file.This means, a surface reflectance measurement taken at the edge of a CTX image appears 8% darker than in the center, when calibrated with the currently available flat-field file (version 0002).
For the image data from 2019 until March 2020, we could expect some remaining edge-darkening effects, according to the development of the frown factor over time.We have calibrated an additional subset of 200 images from only that period and inspected the data visually-no apparent sign of residual edge-darkening effect was observed.Eventually, the effect might just not be visible due to the slightly higher mean frown factor of 1.6 versus the overall mean of 1.55.But the skewness of the frown factor in the temporal subset of the data reveals that the topography and ground properties were not equally distributed during that time.This is a strong indication that the mean frown factors in that timespan do not represent the true edge-darkening effect.Therefore we do not believe that a correction using individual flat-fields from a particular snapshot during that time would improve the correction, but instead would introduce surface-induced brightness variations as artifacts in the calibration.The single flat-field serves as the best correction option for the full mission timespan including the period between 2019 and early 2020, and we can assume a stable camera behavior over the full mission timeline.
During the pre-processing stage of image calibration for flat-field building, we have a choice between two options, as mentioned in Subsection 2.4.We can create the flat-field from bias and dark-current corrected images as received from ctxcal, using a special flat-field file with all values set to one.However, these images could still retain the imprint of the analog signal processing chain, leading to alternating signal additions or subtractions for every second pixel.The ctxevenodd program is typically used to equalize this effect after ctxcal.Therefore, as an alternative to prevent the correction of the even/odd effect by the flat-field division, ctxevenodd can be applied after ctxcal on each image before the flat-field calculation.This approach would eliminate the signal-chainrelated striping effects before flat-fielding.A test was conducted to calibrate 100 images with flat-fields created with or without even/odd correction.When visualized using a strong stretch, the images calibrated with the flat-field created with ctxevenodd in the pipeline showed apparent even/odd striping effects.After applying the ctxevenodd program as a standard step in the processing pipeline, the striping effect was no longer visible.While the processed images generally appear similar, a detailed analysis of the line averages for all pixels reveals some differences.Figure 11 clearly shows fewer pixel-to-pixel variations when applying the flat-field, which was created without adding the ctxevenodd to the pre-processing pipeline of the images that were used to build the flat-field.That means that the flat-field division already corrects the pixel-to-pixel striping effect, and the subsequent application of even/odd normalization reduces the variations even further.After all, the differences are minimal-the variations are within 2‰ of the data.As an additional aspect of the different processing chains the ctxevenodd program uses all pixels for the average calculation, including hot and cold pixels.These peaks will imprint artificial offsets on all other pixels.For these reasons we decide using the version without even/ odd correction in the pre-processing stage and publish it with this article.

Conclusion
The current (version 0002) ISIS-internal flat-field calibration file should be replaced by the new file delivered with this publication (version 0003).It provides a highly optimized correction of the detector's darkening toward its edges and better individual pixel correction than the current flat-field file.It will significantly improve all subsequent higher-level image products based on the ISIS pipeline.It produces very robust results for all images from the entire mission so far.The CTX camera and its calibration-relevant parameters behave stable over the entire mission.

Data Availability Statement
The new flat-field calibration file (as described in Section 4) together with a list of the used images and sample scripts of the pre-processing pipeline and the full set of preview images used for validation are available from this data repository: http://dx.doi.org/10.17169/refubium-41645.The flat-field file has been provided to the ISIS development team in order to publish it as an update to the existing version in their default data directory.The level 0 Experiment Data Records of the CTX instrument are available from NASA's PDS Cartography and Imaging Node (https://pds-imaging.jpl.nasa.gov/volumes/mro.html,Malin et al., 2007).The ISIS software is available under its software repository at Laura et al. (2023).

Figure 1 .
Figure 1.Subset of CTX image G09_021566_1800_XN_00S191W after nominal ISIS calibration (top) together with a plot of the image's reflectance values averaged over all lines (bottom).As the surface reflectance is relatively homogeneous, the image clearly shows typical darkening toward the along-track image borders, and the average plot of the samples shows an apparent edge-darkening effect.

Figure 3 .
Figure 3. Elements for the composition of the frown factor of a flat-field.ā1 stands for the mean of 50 pixels taken at position a1, ā2 for the mean of the 50 pixels taken at position a2.b stands for the mean taken over 800 pixels starting at CCD pixel 2100.The frown factor is then calculated as the ratio between b and the total mean of ā1 and ā2 .

Figure 4 .
Figure 4. Three CTX images with different brightness variations and their respective profile plots of the pixel average values over all lines.Left: homogeneous albedo distribution of the surface leads to a profile plot exhibiting the edge darkening effect.Middle: Low Sun angle illumination on a surface with high topography leads to brightness variations over the scene.The edge darkening is barely visible in the image and is overprinted in the profile plot.Right: The image shows polar layered deposits with large brightness differences in line direction, and a black feature in the middle leads to a central minimum in the profile, which overprints any indicator for an edge-darkening effect.

Figure 5 .
Figure 5.Comparison of selected flat-field ratio plots during the mission time, denominator is always the first nominal mission month (P01); the mission months count excludes months without data.

Figure 6 .
Figure 6.Plot of pixel 1357 and its neighbors along all normalized line means of all images from mission month J17.

Figure 8 .
Figure 8. Kernel density plot of the frown factor of all images except the ones from the year 2019 (left) compared with the density plot of the frown factor from the year 2019 (right).Median (red) and arithmetic mean (blue) as vertical lines.

Figure 7 .
Figure 7. Top: Scatter plot of the frown factor over time.Bottom: mean monthly frown factor over time.

Figure 9 .
Figure 9. Ratio of single global flat-field and lab calibration.

Figure 10 .
Figure 10.Example CTX mosaic of the Oxia Planum region, ExoMars Rosalind Franklin Rover landing site.Images were chosen from Martian Year 33.(a) A mosaic of single images calibrated with the nominal ISIS internal flat-field calibration-the edge darkening is strongly visible.(b) The same images mosaicked in the same sorting, calibrated with the new global flat-field calibration.All images were processed in 16-bit and then stretched to 8-bit using a min/max stretch.No further radiometric equalization was applied, which would additionally reduce the seams.

Figure 11 .
Figure 11.Sample-based arithmetic mean values of two classes of 100 images each, calibrated with two different flat-fields.In one class, the images were used for flat-fielding directly after bias and dark current correction (red); in the other class, the images were additionally pre-processed with the ctxevenodd application (blue).After the calibration with their respective flat-field, each of the 200 images was even/odd equalized by applying ctxevenodd to the individual image.