Main

JWST has demonstrated the necessary precision and wavelength coverage to make bulk characterization of hot exoplanet atmospheres routine7. The JWST director’s discretionary Early Release Science (ERS) programme provides the scientific community with observations of typical targets quickly enough to inform planning for the telescope’s second cycle of scheduled observations. The primary goals of the Transiting Exoplanet Community ERS programme (ERS 1366, led by N. M. Batalha, J. L. Bean and K. B. Stevenson) are to demonstrate instrument capabilities, quickly build community experience and seed initial discovery in transiting exoplanetary science8,9. The Panchromatic Transmission programme observed a single exoplanet, WASP-39b, in transmission using four different instrument modes. It included overlapping wavelength coverage to cross-compare and validate all three near-infrared instruments for time-series observations. The observations presented here form one-quarter of this programme, demonstrating the capacity of the JWST Near-InfraRed Camera (NIRCam) for transiting exoplanet atmospheric characterization.

WASP-39b is a highly inflated exoplanet of roughly Saturn mass, orbiting its G7 main-sequence star with a 4.05-day period10. We selected WASP-39b for its inactive host star and prominent spectroscopic features, which trace the atmospheric composition of the planet. We confirmed the star’s relative inactivity through a photometric monitoring campaign using the Next-Generation Transit Survey (NGTS)11 and Transiting Exoplanet Survey Satellite (TESS)12 (Methods). Reported atmospheric metallicities span a range of possible values (0.003–300× solar)13,14,15,16,17,18 owing to limits on wavelength coverage, lower signal-to-noise ratio data and/or differences between analyses19,20,21,22. If the Solar System trend for gas giants23,24 also applies to exoplanets, WASP-39b should have an atmospheric metallicity comparable to that of Saturn (10× solar25) and other Saturn-mass exoplanets.

We observed a single transit of WASP-39b with JWST’s NIRCam instrument on 22–23 July 2022 (19:28–03:40 ut). The Grism R and F322W2 filter in the long-wavelength (LW) channel dispersed light from 2.420–4.025 µm at a spectral resolution R of 1,570–2,594 over 1,023 resolution elements. The short-wavelength (SW) channel allowed the simultaneous measurement of light, that is photometry, spanning 2.0–2.2 µm using the WLP8 weak lens and F210M filter. See Methods for more details.

The team conducted three independent reductions of the NIRCam LW spectroscopic data and four independent fits and analyses of the reduced data. We also performed two independent analyses of the SW photometric data. For both data reductions (LW and SW), customizing the JWST Science Calibration Pipeline (jwst) to allow for minor adaptations to default steps and values worked best (Methods). The wavelength solution available with the reference files provided by the JWST Calibration Reference Data System at the time of our analysis was inaccurate (particularly for the blue edge of the LW channel), so we redefined our wavelength values using a polynomial wavelength calibration derived from a planetary nebula observed as part of commissioning (programme 1076).

We found no large systematic structures affecting the LW light curves and a minuscule ramp at the start of the SW light curve, see Fig. 1. The only other systematic identified was 1/f noise (or pink noise; where f is frequency), which describes the detector’s correlated read noise26. For NIRCam, this manifests as weak structures in the dispersion direction, as shown in Fig. 1c. We did not correct for 1/f noise in the final LW reduction because it did not impact the precision reached by individual spectroscopic light curves (compare tshirt and Eureka! in Fig. 2 for analyses with and without 1/f noise corrections). We removed structures due to 1/f noise in the SW reduction (Methods). We found that a linear model in time was sufficient to detrend the data, which produced uncertainties 1.18× the photon noise limit (median of 135 ppm for the transit depths) at a binned spectral resolution of 15 nm (about 15 pixels). Similarly, the photometric transit-depth precision was 1.35× the noise limit at 53 ppm. The residuals are Gaussian (Extended Data Fig. 5).

Fig. 1: The relative brightness of the WASP-39 planetary system as a function of time and wavelength, as measured by NIRCam.
figure 1

af, Spectroscopic data (ac) and the photometric (SW) channel (df) for the extracted flux normalized by the median stellar spectrum (a,d), the best-fit transit and systematic models (b,e) and the residuals (c,f). The flux decrease results from the transit of exoplanet WASP-39b in front of its star. The subtle variation in transit depth around 2.8 µm is due primarily to water vapour in the planet’s atmosphere. The vertical striping in the residuals is due to 1/f noise.

Fig. 2: The transit spectrum of WASP-39b as measured from JWST’s NIRCam instrument.
figure 2

The coloured points with 1σ uncertainties depict our independent analyses of the spectroscopic LW channel (2.420–4.025 µm) and photometric SW channel (2.0–2.2 µm) with their respective throughputs shown in grey. All analyses agree with the broadband Spitzer point (black circle, 3.2–4.0 µm). The broad feature centred at 2.8 µm spans 2.5 scale heights (2,000 km) and is due primarily to water vapour within WASP-39b’s atmosphere. We note the consistency between analyses in the fine structure.

Source data

Figure 2 shows the independently derived transit spectra and photometry. Each reduction is consistent with our selected reduction (Eureka!) to better than 1σ, as is the broadband 3.6-µm Spitzer point13. The overall shape of the spectrum is due primarily to absorption of water vapour (feature centred at 2.8 µm). The right-axis scale is in equivalent scale heights, where one scale height is approximately 800 km.

To interpret the presence of other molecules within the planetary atmosphere, we compared the Eureka! transit spectrum with a set of independently computed atmospheric model grids that spanned a range of cloud properties, metallicity values and carbon-to-oxygen (C/O) ratios (Methods). Figure 3 shows a representative best-fit model highlighting the contributions of major molecular absorbers.

Fig. 3: Contributions of key absorbers impacting the spectrum.
figure 3

Top: the best-fit PICASO 3.0 equilibrium model (10× solar, C/O = 0.229, moderate grey clouds with cloud optical depth of 2.5 × 10−3) is shown compared with the Eureka! reduction, along with models with individual molecular species removed to show its contribution to the spectrum. Each model is normalized to the data for illustration by offsetting each model to have the same transit depth at 2.8 µm. Water predominately sets the shape of the spectrum, followed by the influence of clouds. The grey dashed line shows a cloudy solar-metallicity and stellar-C/O atmospheric model, illustrating the lack of a strong CH4 peak seen in the data. Bottom: the opacities of the dominant molecular species at an optical depth (τ) of 1 in the atmosphere. In the single best-fit model shown in the bottom panel, the CH4 peak at 3.3 µm is blended out by water absorption. However, manual scaling of CH4 gives an upper limit of CH4 abundance (blue line) for the single best-fit model shown in the top panel.

Source data

Our spectroscopic wavelength range covered by NIRCam/F322W2 includes absorption features due to prominent atmospheric molecules such as water (H2O), carbon dioxide (CO2) and methane (CH4). From our model grid search, we definitively confirm the presence of H2O at nearly 16σ. Water vapour was previously identified in the atmosphere of WASP-39b using the Hubble Space Telescope (HST) Wide Field Camera 3 (WFC3) observations taken at shorter wavelengths ([H2O] = \(-{1.37}_{-0.13}^{+0.05}\))13. We also see weak evidence for CO2 absorption, previously seen with high confidence using the PRISM mode on the Near InfraRed Spectrograph (NIRSpec) at 4.3 µm (ref. 7), but the overlap between the CO2 feature at 2.8 µm and the broad H2O feature (illustrated in Fig. 3) leads to a more tentative identification here. Each forward model grid prefers significant cloud coverage, which impacts the spectrum at approximately millibar pressures, despite differing cloud parameterizations between grids with varying levels of physical complexity (Methods).

In a hot (about 1,000 K) solar-metallicity atmosphere with a stellar C/O ratio, CH4 would be visible as a strong peak at 3.3 µm (grey dashed line in Fig. 3, and Extended Data Fig. 7) under thermochemical equilibrium. Such a peak is absent in the reduced spectrum. We quantified this using a residual fitting test (Methods). In a higher-metallicity and/or lower-C/O atmosphere, carbon is increasingly partitioned into CO and CO2, and the CH4 peak at 3.3 µm disappears. Therefore, the absence of a strong CH4 peak at 3.3 µm in our data drives the metallicity to higher values and the C/O ratio to lower values. We scaled the CH4 volume mixing ratio within our single best-fit Planetary Intensity Code for Atmospheric Spectroscopy Observations (PICASO) version 3.0 model (10× solar metallicity; C/O ratio of 0.229) to determine an upper limit on the abundance of CH4 at 1 mbar, where it contributes most strongly to the spectrum. Within our single best-fit model scaling, we find an upper limit on CH4 abundance at 1 mbar of 5.5 × 10−5 (or 55 ppm) volume mixing ratio, above which the goodness of fit per free parameter, \({\chi }_{\nu }^{2}\), gets increasingly worse (that is, \({\chi }_{\nu }^{2} > 2\)). We also tested whether other data reductions favoured best-fit models with stronger CH4 abundances, but found they did not have any statistical significance.

Driven by this CH4 upper limit, the single best fit from each grid favours the lowest C/O ratio (0.229, 0.3 and 0.35 for PICASO 3.0, PHOENIX and ATMO, respectively) within that grid. These best-fit point values for C/O from the three grids agree well with the value of \({0.31}_{-0.05}^{+0.08}\) found by ref. 13. We examined the effect of an even lower C/O grid point by computing the best-fit PICASO 3.0 model with a C/O of 0.115, but found no discernible difference in the transit spectrum. Comparing our inferred C/O ratio for WASP-39b’s atmosphere with that of its host star, we see that it is substellar (≤0.35, whereas WASP-39 is 0.46 ± 0.09 (ref. 23)). We also note that the C/O ratio shown here represents the C/O fraction of the planet’s upper atmosphere rather than that of the whole atmosphere, as these NIRCam observations probe approximately the 0.1–10 mbar pressure range. WASP-39b’s temperature–pressure profile is cool enough for the formation of silicate (that is, Obearing) cloud species at depth, which would deplete oxygen from the upper atmosphere and actually increase the C/O ratio aloft compared with the bulk planetary envelope27,28.

Figure 4 compares our best-fit metallicity values, shown as separate O and C abundances, and C/O ratios to previous studies using HST data, as well as results for exoplanets observed at high resolution and Solar System gas giants. The JWST/NIRCam data rule out a super-stellar C/O ratio for WASP-39b. In addition, Fig. 4 demonstrates the capability of JWST to measure the C/O ratios of giant planet atmospheres by observing both O- and C-bearing species, which until now has only been achieved through high-resolution exoplanet observations (for example, refs. 29,30). Similar measurements have been difficult to achieve from HST alone. Even in the Solar System gas giants, such constraints have proved difficult from both remote sensing and in situ missions, as the low temperatures of Jupiter, Saturn, Uranus and Neptune lead to condensation of most O-bearing species (for example, H2O and CO2) at high altitudes, prohibiting accurate measurement of the O abundance (for example, refs. 31,32).

Fig. 4: Trends in elemental abundances and C/O ratio with planet mass.
figure 4

ac, The abundances of O (a), C (b) and net volatiles (O + C) (c) scaled to stellar values (O* and C*). The grey points in a show HST constraints based on ≥2σ H2O detections, with the grey dashed line showing the best-fit trend from ref. 18. The blue points show all previous estimates of the metallicity of WASP-39b from HST data, offset in mass for clarity13,15,16,17,18. The black points and dashed line in b show a fit based on CH4 abundances of Solar System giant planets46,47,48,49. Of the Solar System planets, only Jupiter has a constrained O abundance (from Juno observations of H2O (ref. 32)). The gold points indicate high-resolution observations of H2O and CO in exoplanets29,30, and the red stars show the best-fit values for WASP-39b as measured by JWST/NIRCam for each of the three model grids described in this paper. d, The black dashed line depicts the solar C/O ratio of 0.55 (ref. 50) and the blue dotted line with a shaded 1σ uncertainty region indicates the measured C/O ratio of the star WASP-3923. Our results for WASP-39b favour a super-stellar volatile abundance and substellar C/O ratio. However, we emphasize that a full retrieval will be necessary to determine accurate means and 1σ error bars for the NIRCam results.

Source data

The apparent substellar C/O ratio inferred from chemical equilibrium models may trace photochemical processes in the planet’s upper atmosphere. For example, photochemical destruction of CH4 in the upper atmosphere could explain the absence of a CH4 peak at 3.3 µm (for example, refs. 6,33). The most likely immediate products of CH4 photolysis, such as hydrogen cyanide (HCN) or acetylene (C2H2), would be produced in abundances too small (less than or approximately equal to a few parts per million6,33) to be robustly detected with a single NIRCam transit, even from complete CH4 conversion. Alternatively, much of the C available from CH4 photolysis could have been oxidized by photodissociated H2O to form carbon monoxide (CO) and CO2 (refs. 6,33,34,35), although the absolute abundances of these two C reservoirs would not have been meaningfully altered as their abundances under chemical equilibrium are already higher than that of CH4. Other proposed disequilibrium chemistry processes could reduce the CH4 abundance at the terminator without also decreasing the C/O ratio5,36,37,38,39. We defer the exploration of complex disequilibrium models to atmospheric retrieval analyses using the full set of data provided by the Transiting Exoplanet Community ERS programme. That dataset will also constrain the presence of additional O- and C-bearing species to provide a more robust constraint on the C/O ratio than we can obtain here. However, the C/O ratio estimate we report from NIRCam is broadly consistent with the C/O ratio found from the other individual ERS WASP-39b datasets, which range from best fits that are subsolar (Near InfraRed Imager and Slitless Spectrograph (NIRISS)/Single Object Slitless Spectroscopy (SOSS)40; NIRSpec/PRISM 3.0–5.0 µm (ref. 7); NIRSpec/G39541) to a slightly super-solar upper limit (NIRSpec/PRISM 0.5–5.5 µm (ref. 42)).

If disequilibrium chemistry is not prevalent in the planet’s upper atmosphere, the inferred high metallicity and low C/O ratio can be tied back to the formation of WASP-39b. The most prominent scenario is that WASP-39b formed by core accretion exterior to the water-ice line and accreted low-C/O solid material in situ and/or while migrating inwards within the protoplanetary disk4,43,44. Taken as such, JWST observations could offer important clues regarding the degree to which hot-Jupiter atmospheres undergo solid accretion during their early evolution.

Here we have demonstrated the excellent performance of NIRCam for exoplanet transmission spectroscopy. With the first JWST exoplanet spectra now comparable to the first near-infrared Jupiter spectra45, the future promises many exciting discoveries and major advancements in the formation, evolution and atmospheric chemistry of hot Jupiters.

Methods

As part of this article’s Reproducible Research Compendium, located on Zenodo at https://doi.org/10.5281/zenodo.7101283, we provide saved outputs from various pipeline stages and the data used to generate relevant figures, as well as a Jupyter Notebook with step-by-step data reduction instructions replicating our chosen analysis (https://doi.org/10.5281/zenodo.7510106).

Photometric monitoring of host star

To confirm that WASP-39 is a relatively inactive star, and that the JWST observations were not adversely affected by stellar activity, we carried out photometric monitoring with the ground-based NGTS11. Monitoring began at the end of April 2022 and continued until late August, spanning the JWST ERS transit observations of WASP-39b in July. We used one camera on most photometric nights to take a series of 10-s images lasting on average for 2 h. The resulting monitoring light curve is plotted in Extended Data Fig. 1 (top), showing one binned point for each night. Also included is the TESS sector 51 Pre-search Data Conditioned Simple Aperture Photometry (PDCSAP) light curve of WASP-3912, which is binned to 2 h to be comparable to NGTS. Both light curves have been detrended against sky brightness. They show evidence for stellar activity, but only with a low amplitude of 0.06% in NGTS.

Also plotted in Extended Data Fig. 1 (bottom) are individual transit observations of WASP-39b with NGTS and TESS (the times of which are indicated on the monitoring light curve). For four of the NGTS transits, we employed multiple cameras. This significantly improves the photometric precision51, which is otherwise limited by atmospheric scintillation52. The transit models were generated from the system parameters listed in Extended Data Table 1. We fit only the transit times and the mutual depth of the TESS transits, which is slightly shallower than expected.

The transit observations in Extended Data Fig. 1 show no evidence for starspot-crossing events, which would be visible as bumps in the transit light curve. The absence of such events across multiple high-precision transits provides additional evidence that WASP-39 is a quiet star and that the JWST ERS transit observations are unlikely to be adversely affected by stellar variability.

JWST NIRCam observation

JWST observed the 2.8-h transit of WASP-39b over a span of 8.2 h, providing a baseline before and after transit to measure transit depths accurately. A dichroic beam splitter allows NIRCam to simultaneously observe a target in both SW and LW channels53,54. The LW channel used the Grism R + F322W2 filter to observe a wavelength range of 2.420–4.025 µm with a spectroscopic resolving power of R ≈ 1,600 at 4 µm (Extended Data Fig. 1, top). The SW imaging channel used the WLP8 weak lens and F210M filter (2.0–2.2 µm) to produce the hexagonal pattern shown in Extended Data Fig. 2 (bottom). Spreading the light prevents saturation, reduces variability owing to image motion over an imperfect flat field and allows monitoring of mirror-segment alignment. Both SW and LW channels used the SUBGRISM256 subarray mode with four output amplifiers and the SHALLOW4 readout pattern to minimize data volume. With 12 groups per integration (82.17 s total), we acquired 366 integrations for this transit observation.

Data reduction and calibration

We conducted independent data analyses using multiple pipelines and fitting tools to ensure that we obtained the same transmission spectrum using different reduction pipelines. We also varied the fitting methods within a given data reduction pipeline.

Many of the reductions presented below used intermediate data products from or made minor edits to the JWST Science Calibration Pipeline (jwst; https://jwst-pipeline.readthedocs.io/), which we briefly summarize here. jwst is a Python software suite for processing data from all JWST instruments and observing modes, and is organized into three stages. Stage 1 takes in uncal.fits files and performs detector-level corrections and ramp fitting for individual exposures (that is, ramps-to-slopes conversion; these ramps are the flux increases during an exposure, not to be confused with baseline ramps over the course of the entire transit). Stage 2 takes in slope images (ramps) from Stage 1 and performs an assignment of the world coordinate system, flat fielding and assignment of a wavelength solution. Stage 3 takes in calibrated two-dimensional images from Stage 2 and extracts a time series of one-dimensional spectra. The default pipeline settings include a flux calibration step at Stage 2. In all data reductions presented below, we skipped that step, as it introduced scatter in the extracted spectral time series. This is justified because the transit depths we compute are relative, rather than absolute, flux measurements.

Below we describe the independent data reductions applied to the SW photometry and LW spectroscopy, respectively. In each case, we note where data reductions deviated from the standard jwst pipeline.

SW photometry

We performed two independent SW data reductions using the open-source Eureka! and tshirt pipelines.

Eureka! SW reduction

Eureka! is an open-source pipeline designed to perform spectral extraction and fitting for JWST exoplanet time-series observations55. The Eureka! SW data reduction used the default jwst settings for stages 1 and 2, with the exception of increasing the rejection threshold during jump detection to 10σ, which improved the quality of the resulting light curve.

In Stage 3, we first masked all pixels for which the ‘DO_NOT_USE’ data quality flag was raised by the jwst pipeline. We then performed an outlier rejection along the time axis for each individual pixel in a segment using a 7σ threshold, repeating this process twice. Next, we corrected for the 1/f noise in each of the four amplifier regions by subtracting the median flux in each row calculated without pixels containing the star. We interpolated over flagged pixels using a cubic function. Finally, we determined the image centre and performed aperture photometry on the target. We explored different target apertures and background annuli, and chose the combination that minimized the root-mean-square variations, leading to a target aperture radius of 65 pixels and a background annulus from 70 pixels to 90 pixels relative to the centre.

tshirt SW reduction

tshirt is an open-source pipeline (https://tshirt.readthedocs.io/en/latest/) that has tools to modify the jwst pipeline and performs  photometric and optimal spectral extraction of light curves.

In the stage 1 SW analysis, tshirt applied a row-by-row, odd/even-by-amplifier (ROEBA) subtraction algorithm that used background pixels to reduce the 1/f noise. In this procedure, background pixels are used to correct each group in a similar fashion to reference pixel correction (https://jwst-pipeline.readthedocs.io/en/latest/jwst/refpix/index.html). The ROEBA correction happens after the bias subtraction step. First, the median of all even columns’ background rates is subtracted from all even columns and the median of all odd columns’ background rates is subtracted from all odd columns to remove most pre-amp reset offsets and odd/even pixel effects. Next, the median of each column’s background rate is subtracted from each row to remove the 1/f noise for timescales longer than a row read time (5.24 ms). The correction was applied to each group so that 1/f noise would not be detected as spurious jumps or cosmic rays by the pipeline. We used all pixels more than 201 pixels from the source to estimate the background and 1/f noise, then subtracted the median of each row from all pixels in that row. Stage 2 of jwst was skipped, as it only changes the rates from analogue-to-digital units (ADU) per second to physical units and conducts flat fielding. This does not affect the relative measurements of the light curve (due to the high pointing precision) and allows for comparison with detector-level effects.

For the photometric extraction, we used a source radius of 79 pixels and a background annulus of 79 pixels to 100 pixels. We performed a two-dimensional Gaussian fit to determine the centre of the aperture.

LW spectroscopy

We performed three independent LW data reductions, using the Eureka!, Atmospheric Transmission Spectroscopy Analysis Code (HANSOLO) and tshirt pipelines.

The reference files in the Calibration Reference Data System at the time of our analysis included a linear solution for wavelength as a function of x coordinate (the dispersion direction), but this is not strictly accurate at the blue end. For all methods, we use commissioning programme 1076 to derive a third-degree polynomial wavelength solution that uses the Pfund and Bracket hydrogen series in the planetary nebula IRAS 05248−7007. The residuals in this solution are 0.1 nm and the stellar absorption lines in WASP-39 agree with the solution to within 1 nm. The difference between the corrected wavelengths and the original wavelength solution is almost zero at the red end of the spectrum, but increases to about 50 nm at the blue end.

Eureka! LW reduction

We investigated several variations of the Eureka! LW data reduction to minimize the median absolute deviation (MAD) of the final extracted light curves, with different settings for cosmic-ray jump detection, identifying the spectral trace, the aperture size for spectral extraction, the region for background subtraction and limits for outlier rejection. Here we present details of the data reduction that produced the spectrum shown in the main body of the paper.

Stages 1 and 2 were identical to the jwst pipeline, with the exception of increasing the rejection threshold during jump detection to 6σ. In Stage 3, we first trimmed the data to a subarray extending from pixels 4–64 in the cross-dispersion direction and 4–1,704 in the spectral direction. We then masked any pixels with not a number (NaN) values for the flux or error. We fit the spectral trace with a Gaussian profile and corrected for the curvature of the trace to the nearest integer pixel. We excluded a 14-pixels-wide region on either side of the spectral trace from the background calculation and performed a column-by-column linear fit to subtract the background. We used a double-iteration 7σ threshold for outlier rejection of the sky background along the time axis during background subtraction. In addition, we used a 7σ threshold for outlier rejection during the polynomial fit to the background. To obtain the spectrum, we constructed a normalized spatial profile using the median of all data frames, then used optimal extraction56 on an aperture with a half-width of 9 pixels. For the optimal extraction, we rejected outliers above a 10σ threshold. Extended Data Fig. 3 shows the curvature-corrected, background-subtracted median frame with indicated background and aperture regions.

HANSOLO LW reduction

The HANSOLO pipeline was originally developed to analyse ground-based transmission spectra observed with 8-m-class telescopes57,58 and was adapted to enable its use on NIRCam data. HANSOLO begins with the calibrated rateints.fits outputs of jwst Stage 1.

We used the LACOSMIC algorithm59 to remove cosmic-ray effects from the two-dimensional images and identified the spectral trace using a Moffat function fit to each column. To remove the sky, we fitted and subtracted a linear trend from each column, excluding from the fit a region of 20 pixels on either side of the trace centre. We then extracted the spectrum by summing over an aperture with a half-width of 3 pixels. The spectra from different images were aligned with each other using cross-correlation. To correct outlier pixels, each spectrum was normalized to account for the effect of the transit on the time series. Outliers >3σ away from the mean were removed from the time series of each wavelength point in the normalized spectra and replaced with the median value over time. We then rescaled the spectra to their original amplitudes.

tshirt LW reduction

As with the SW reduction, a few modifications were made to the Stage 1 jwst ramps-to-slopes pipeline. ROEBA subtraction reduced 1/f noise (described above for photometry); however, only pixels 1,847 to 2,044, which are on the rightmost amplifier, are available as low-illumination background.

For Stage 3, tshirt performed optimal spectral extraction weighted by the covariance between pixels26. We used a spectral aperture centred at pixel 34 in the spatial direction with a half-width of 5 pixels. We selected the background region to extend between pixels 5–24 and 44–65 in the spatial direction. The background was fit with a column-by-column linear trend with 3σ clipping. For the spectral extraction, we fit the spatial profile with a cubic spline with 20 knots and an outlier rejection threshold of 30σ. If a pixel was deemed an outlier either by the ‘DO_NOT_USE’ data quality flag or by the spatial profile outlier detection, the rest of the spatial profile was weighted by the reference profile to ensure that the flux was conserved. For the covariance weighting, a correlation of 8% was assumed between pixels as measured by background pixels’ noise properties.

Data analysis and fitting

We used both Eureka! and tshirt to fit the SW light curves. In both cases, the light curves were fit with models that included both the transit and the systematic noise. However, to investigate the effect of different systematic models on the resulting spectra, each fit used a slightly different noise model. Extended Data Table 1 summarizes the systematics models that were used in each SW fit.

For the LW fits, we summed the data into 15 nm bins (about 15 pixels). We experimented with bins as small as 10 nm, but found that reducing the bin size below 15 nm led to poor constraints on the limb darkening and added additional scatter to the resulting spectrum. Extended Data Fig. 4 shows that the noise is primarily Gaussian out to long timescales of order the length of ingress/egress. In addition, we created a white-light curve by summing the extracted spectra over the entire 2.420–4.025 µm wavelength region. We experimented with different wavelength cut-offs but chose to extract spectra in this wavelength region because the low instrument throughput affected the quality of the extracted light curves beyond this region. Extended Data Fig. 5 shows all reduced transmission spectra with one bin added on the blue end and two added on the red end, as well as the relative throughput at the wavelengths of these bins. This figure shows the large error bars derived from data near the edges of the NIRCam/F322W2 bandpass. Therefore, we recommend that future works limit extracted spectra to the wavelength region between 2.420 µm and 4.025 µm.

We fit the LW light curves using four independent pipelines: chromatic-fitting, Eureka!, HANSOLO and tshirt. chromatic-fitting is an open-source (https://github.com/catrionamurray/chromatic_fitting/) Python tool to perform light-curve fitting, built on the data visualizer chromatic (Z. K. Berta-Thompson, manuscript in preparation; https://github.com/zkbt/chromatic/). For this work, chromatic-fitting light-curve fitting was applied to a Eureka! data reduction. As with the SW fits, we fit the LW light curves with models that include different noise parameterizations. Extended Data Table 2 summarizes the systematics models that were used in each LW fit.

For all fits, the parameters were estimated with a Markov chain Monte Carlo fit, using either the emcee Python package60 (for fits performed with Eureka!), the pymc3 Python package61 (implemented through the Exoplanet code62,63, for fits performed with chromatic-fitting or tshirt) or the CONAN Python package57,58 (for fits performed with HANSOLO). The number of free parameters and the resulting differential MADs of the light curves from each fit are also listed in Extended Data Tables 1 and 2. The best-fit parameters from the white-light-curve fits are given in Extended Data Table 3.

In the process of performing the fits to the LW data, we regularly found that the best-fit transmission spectra were shifted vertically for different limb-darkening parameterizations and, for some reductions, exhibited changes in the apparent size of the water feature. In particular, we found that light-curve fits with all limb-darkening coefficients fixed to outputs from ExoTiC-LD64,65,66 could result in a biased planet spectrum and might present a higher level of time-correlated noise in the residuals. We attribute this to a combination of JWST’s high-precision light curves and deficiencies in the stellar limb-darkening models to accurately represent WASP-3967,68. Therefore, the results presented here use the quadratic limb-darkening law, in its classical form or reparameterized by ref. 69, with one or both coefficients as free parameters. We confirmed that these parameterizations produce transmission spectra that are consistent both with each other and with the spectra resulting from using more complex limb-darkening parameterizations, such as a four-parameter law with either fixed or free parameters70. We therefore recommend that future transmission spectrum analyses with NIRCam use similar methods. Limb-darkening conclusions from the full Transiting Exoplanet Community ERS programme will be discussed further by N. Espinoza et al. (manuscript in preparation).

The final fitted light curves are shown in Extended Data Fig. 6 and the final transmission spectra are shown in Fig. 2. Both the SW and LW datasets are also available in our Reproducible Research Compendium on Zenodo at https://doi.org/10.5281/zenodo.7101283. The median difference between each transmission spectrum and the Eureka! spectrum is 0.87σ (using the maximum error at each point), which demonstrates a remarkable level of agreement. In addition, the residuals showed no evidence for time-correlated noise, as shown in Extended Data Fig. 5.

For ease of interpretation, we compared our atmospheric models with only one transmission spectrum. We selected the Eureka! spectrum, as it was on average nearest the median spectrum (the median transit depth at each bin).

Atmospheric forward modelling

To interpret the LW data from NIRCAM/F322W2, we performed χ2 fits to the transmission spectra using three grids of radiative–convective equilibrium models: ATMO71,72,73, PHOENIX74,75,76 and PICASO 3.077,78. All models used a common set of planetary parameters, but had differing opacity sources, cloud treatments and grid points, described in detail below. Each model was binned to the resolution of the data to perform the χ2 fitting. We performed these three independent model grid fits to fully vet our inferences about the atmospheric metallicity and the presence of specific molecular features within the data.

The PICASO 3.0, Vulcan and Virga model grid

Our primary atmospheric model grid is built from the open-source radiative–convective equilibrium code PICASO77, version 3.078, which was developed from the Fortran-based Extrasolar Giant Planet (EGP) model79,80,81. We used PICASO 3.0 to generate one-dimensional temperature–pressure profiles in thermochemical equilibrium. The base PICASO 3.0 forward model grid computes atmospheric mixing ratios using variations of planetary intrinsic temperatures (Tint) of 100 K, 200 K and 300 K; C/O ratios of 0.229, 0.458, 0.687 and 0.916; and atmospheric solar metallicity values of 0.1×, 0.316×, 1.0×, 3.162×, 10.0×, 31.623×, 50.119× and 100× solar. The PICASO grid assumes full day–night energy redistribution. To compute model transmission spectra from the atmospheric profiles, we used opacities described by ref. 81 (see in particular Extended Data Table 2), which sources H2O from refs. 82,83, CH4 from refs. 84,85,86, CO2 from ref. 87 and hydrogen sulfide (H2S) from refs. 84,88,89.

We then used the one-dimensional CHON-based chemical kinetics code VULCAN33 and the cloud modelling code Virga90, which is the Python implementation of the Eddysed cloud code91, to post-process disequilibrium chemistry from mixing and photochemical products as well as the effect of clouds. These additional post-processed grids also include vertically constant eddy diffusivities (Kzz) of 105–1011 cm2 s−1 in steps of 2 dex, and both clear and cloudy models. For the Vulcan disequilibrium runs, we computed model grid points for only a select subset of metallicity values (1×, 10×, 50× and 100× solar) and C/O ratios (0.229, 0.458 and 0.687). We found that neither the cloudy nor the clear disequilibrium grids from VULCAN offered an improvement in the \({\chi }_{\nu }^{2}\) value. Given the sparseness of these pre-computed disequilibrium grid models, we left rigorous quantification of self-consistent disequilibrium chemistry in the atmosphere of WASP-39b to future work.

Within PICASO, clouds are implemented both as grey absorbers and as Mie scatterers using temperature-relevant cloud condensate species from Virga. For the grey clouds, the grid specified a cloud optical depth (τcloud) between 1 bar and 0.1 bar ranging from τcloud = 3.2 × 10−6 to 1 in steps of 0.1 dex across all wavelengths. For clouds of specific condensates, we used Virga to compute log-normal particle size distributions using sedimentation efficiency (fsed) values of 0.6 to 10 for MnS, Na2S and MgSiO3 along the range of Kzz. Smaller sedimentation efficiencies, fsed, with larger eddy diffusivities, Kzz, generated more extended cloud decks and stronger cloud opacity.

The PHOENIX model grid

We also used a grid of atmosphere models from the PHOENIX radiative–convective equilibrium code to fit the data74,75,76. Similar to the PICASO 3.0 grid, parameters including the day–night energy redistribution factors, interior temperature (200 K and 400 K), bulk atmospheric metallicity (0.1×, 1×, 10× and 100× solar) and C/O ratio (136 grid points from 0.3 to 1) were varied. Aerosol properties were parameterized through a haze factor (0 and 10× multi-gas Rayleigh scattering) and a grey-cloud-deck pressure level (0.3 mbar, 3 mbar and 10 mbar). Models with molecular abundances quenched at 1 bar to simulate vertical mixing were also calculated. The grid also included rainout to account for species sequestered as condensates in the deep atmosphere. Opacities are described by refs. 76,92 and taken from ref. 88.

The ATMO model grid

Similar to the model grids described above, we compared the data to a grid of models from the ATMO radiative–convective–thermochemical equilibrium code71,72,73,93. The ATMO grid used similar atmospheric and aerosol parameterizations to those used in the PHOENIX grid and also included rainout that accounts for species condensed in the deep atmosphere. Also included are day–night energy redistribution factors (0.25, 0.5, 0.75 and 1; with 1 as full redistribution), atmospheric metallicity (0.1×, 1×, 10× and 100× solar), interior temperature (100 K, 200 K, 300 K and 400 K), C/O ratio (0.35, 0.55, 0.7, 0.75, 1.0 and 1.5), cloud scattering factor (0, 0.5×, 1×, 5×, 10×, 30× and 50× H2 Rayleigh scattering at 350 nm between 1 mbar and 50 mbar pressure levels) and a haze scattering factor (1× and 10× multi-gas Rayleigh scattering). Opacities for H2O, CO2 and CH4 are taken from refs. 83,84,85,86 and for H2S from ref. 88.

Grid fits to JWST/NIRCam data

We applied each of our three grids—ATMO, PHOENIX and PICASO 3.0—to fitting the NIRCam F322W2 spectrum (2.4–4.0 µm). In doing so, we found that the models strongly favoured a solar- or super-solar-metallicity atmosphere (1–100× solar), a substellar C/O ratio (≤0.35) and substantial contribution from clouds, which are parameterized differently by each model grid (see each grid description above). We show the best fits from each model grid in Extended Data Fig. 7. This interpretation is in agreement with the results using JWST’s NIRSpec/PRISM instrument from 3.0–5.0 µm (ref. 7), improving on the wider spread from previous HST-only13,14,15,17,18,94 or HST and ground-based optical interpretations16.

For the NIRCam-only fit, the PICASO grey-cloud scheme produced a slightly better best fit (\({\chi }_{\nu }^{2}\) = 1.16) than the PICASO + Virga more realistic clouds (\({\chi }_{\nu }^{2}\) = 1.23), both of which were preferred to the clear-model best fit (100× solar) with \({\chi }_{\nu }^{2}\) = 1.53. The Virga best-fit grid resulted in an atmosphere of 1× solar metallicity, C/O = 0.229, fsed = 0.6 and Kzz = 109 cm s−2. This Virga best-fit model consists of clouds of MnS and MgSiO3 with deep (≥100 bar) cloud bases and diminishing optical depth up to approximately millibar pressures.

The best-fit equilibrium model from the PHOENIX grid had 100× solar metallicity, a C/O ratio of 0.3 and a cloud deck at 3 mbar. Cloudy models were generally preferred over clear models, but not with statistical significance (\({\chi }_{\nu }^{2}\) of 1.25 compared with 1.22). The PHOENIX grid finds best fits with very high metallicity (100× solar), so this low confidence regarding clouds reflects the cloud-metallicity degeneracy inherent in data restricted to narrow wavelengths (for example, ref. 95), as well as potentially the sparseness of the model grid.

For the ATMO grid, the best-fit equilibrium model to the NIRCam spectrum was 1× solar metallicity, a C/O ratio of 0.35, a cloud factor of 5 and a haze factor of 1. As with the other two grids, strongly cloudy models (cloud factor of ≥5) were preferred to clear models (\({\chi }_{\nu }^{2}\) of 1.1 versus 1.2).

HST + NIRCam

In Extended Data Fig. 8, we show the comparison between the spectra of HST/WFC3 (G141 and G102, covering 0.8–1.65 µm) and JWST/NIRCam (F210M + F322W2, 2.0–4.0 µm). We chose to show only WFC3 observations from HST, as these are of higher precision than observations from the Space Telescope Imaging Spectrograph or ground-based data13. In addition, as HST/WFC3 has the most archival exoplanet data of any instrument on HST, the future JWST exoplanet programme will primarily rely on this HST instrument for inter-telescope comparisons or extending the wavelength coverage of JWST data. For example, the addition of optical and shorter wavelength near-infrared data can help break metallicity degeneracies by better constraining the presence and extent of clouds13 (for example, ref. 95). High-altitude clouds or hazes can be inferred from their particle sizes, where small particles scatter shorter wavelengths more efficiently (for example, refs. 96,97), thus enabling the disentanglement of a very cloudy, low-metallicity atmosphere from a less cloudy, high-metallicity atmosphere17.

Molecular detections

Once we found the ‘single best fit’ for the PICASO grid to the NIRCam spectrum (10× solar, C/O = 0.229, grey-cloud optical depth = 2.6 × 10−3 from 1 bar to 0.1 bar), we used this as a base model to explore the significance of specific molecular detections. First, we tested whether we could improve the best fit in the presence or absence of H2O, CO2, CH4 or H2S. We re-ran the best-fit base model by zeroing out each of these species in turn, shown in Fig. 3, and then repeating our χ2 analysis.

We found that although the presence of H2O, H2S and CH4 resulted in a better \({\chi }_{\nu }^{2}\) value, only H2O and H2S did so in a statistically meaningful way. As H2S does not contain strong molecular features within the NIRCam wavelength range, the Gaussian residual fitting we perform for the detection significance of other molecules is not applicable, and we left its further quantification to more rigorous atmospheric retrieval analyses. Increasing the CH4 abundance beyond that of the best-fit model also improved the \({\chi }_{\nu }^{2}\), although again not to high statistical significance.

With the best fit in hand, we investigated the presence of individual molecular species. For molecular detection significances, we performed the same Gaussian residual fitting, shown in Extended Data Fig. 9, as for the detection of CO2 in the NIRSpec/PRISM 3.0–5.0 µm analysis7. We find a Bayes factor, ln(B), of 123.2 between the Gaussian residual and constant models for H2O over the whole NIRCam wavelength range, corresponding to 15.9σ, a strong detection. For CO2, we find ln(B) of 0.82 between the Gaussian residual and constant models between 2.4 µm and 2.9 µm, or 1.9σ, which is a weak or non-detection98. CO2 is strongly detected at 4.3 µm in the NIRSpec data for WASP-39b7,41,42, but the strong overlapping H2O band at 2.8 µm prevents NIRCam from making a significant CO2 detection. Given our upper limit on CH4 abundance, we also performed the same Gaussian residual fitting for CH4 and find a weak or non-detection at approximately 2σ.

Both WASP-39b NIRSpec datasets7,41,42 observed evidence for a molecular feature near 4.0 µm, which is currently best explained by sulfur dioxide. The reddest data points (>4.025 µm) from NIRCam also show an increase that is consistent with this feature seen in the NIRSpec data. However, as shown in Extended Data Fig. 5, these NIRCam data points have very large error bars because the detector throughput drops off dramatically past 4.0 µm. Future investigations to thoroughly explore the physicochemical likelihood of sulfur dioxide in the atmosphere of WASP-39b must rely on wavelengths that can fully capture the complete absorption feature, which is beyond the reach of high-fidelity NIRCam/F322W2 measurements.