# Cosmic evolution early release science survey (CEERS): multiclassing galactic dwarf stars in the deep JWST/NIRCam

B. W. Holwerda, Chih-Chun Hsu, Nimish Hathi, Laura Bisigello, Alexander de la Vega, Pablo Arrabal Haro, Micaela Bagley, Mark Dickinson, Steven L. Finkelstein, Jeyhan S. Kartaltepe, et al.

<figure><img src="image_1.png" /></figure>

To cite this version:

B. W. Holwerda, Chih-Chun Hsu, Nimish Hathi, Laura Bisigello, Alexander de la Vega, et al. Cos-
mic evolution early release science survey (CEERS): multiclassing galactic dwarf stars in the deep
JWST/NIRCam. Monthly Notices of the Royal Astronomical Society, 2024, 529, pp.1067-1081.
10.1093/mnras/stae316 . insu-04846508

HAL Id: insu-04846508

https://insu.hal.science/insu-04846508v1

Submitted on 18 Dec 2024

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Cosmic evolution early release science survey (CEERS): multiclassing galactic dwarf stars in the deep JWST/NIRCam

B. W. Holwerda<sup>1,★</sup> Chih-Chun Hsu<sup>2</sup> Nimish Hathi<sup>3</sup> Laura Bisigello<sup>4,5</sup> Alexander de la Vega,<sup>6</sup> Pablo Arrabal Haro<sup>7</sup> Micaela Bagley<sup>8</sup> Mark Dickinson<sup>9,7</sup> Steven L. Finkelstein<sup>10,8</sup> Jeyhan S. Kartaltepe<sup>9</sup> Anton M. Koekemoer<sup>3</sup> Casey Papovich<sup>10,11</sup> Nor Pirzkal<sup>3</sup> Kyle Cook,<sup>1</sup> Clayton Robertson<sup>1</sup> Caitlin M. Casey,<sup>8</sup> Christian Aganze,<sup>12</sup> Pablo G. Pérez-González<sup>13</sup> Ray A. Lucas<sup>3</sup> Shardha Jogee<sup>8</sup> Stephen Wilkins<sup>14</sup> Denis Burgarella<sup>15</sup> and Allison Kirkpatrick<sup>16</sup>

*Affiliations are listed at the end of the paper*

Accepted 2024 January 23. Received 2024 January 22; in original form 2023 August 7

## ABSTRACT

Low-mass (sub)stellar objects represent the low end of the initial mass function, the transition to free-floating planets and a prominent interloper population in the search for high-redshift galaxies. To what accuracy can photometry only classify these? JWST/NIRCam has several advantages over Hubble Space Telescope (HST)/WFC3 near-infrared (NIR): more filters, a greater wavelength range, and greater spatial resolution. Here, we present a catalogue of (sub)stellar dwarfs identified in the cosmic evolution early release science survey (CEERS). We identify 518 stellar objects down to mF200W 28 using half-light radius, a full three magnitudes deeper than typical HST/WFC3 images. A k-means nearest neighbour (kNN) algorithm identifies and types these sources, using four HST/WFC3 and four NIRCam filters, trained on IRTF/SPEX spectra of nearby brown dwarfs. The kNN with four neighbours classifies well within two subtypes: e.g. M2±2, achieving ~95 per cent precision and recall. In CEERS, we find 9 M8±2, 2 L6±2, 1 T4±2, and 15 T8±2. We compare the observed long wavelength NIRCam colours – not used in the kNN – to those expected for brown dwarf atmospheric models. The NIRCam F356W–F444W and F410M–F444W colours are redder by a magnitude for the type assigned by the kNN, hinting at a wider variety of atmospheres for these objects. We find a 300–350 pc scale height for M6±2 dwarfs plus a second structural component and a 150–200 pc scale height for T6±2 type dwarfs, consistent with literature values. A single M8±2 dwarf is spectroscopically confirmed at 4 kpc distance.

**Key words:** brown dwarfs – subdwarfs – Galaxy: disc – Galaxy: stellar content – Galaxy: structure – infrared: stars.

## 1 INTRODUCTION

With the successful start of operations of the National Air & Space Administration, European Space Agency and Canadian Space Agency (NASA/ESA/CSA's) JWST a new window has opened up on the lowest mass stars of our Milky Way. These near-infrared stellar objects are interlopers in the new, deep extragalactic observations, but low-mass (sub)stellar members of the Milky Way also encode information on the shape and history of our Galaxy. Here, we report the numbers of such low-mass (sub)stellar objects found in the cosmic evolution early release science survey (CEERS, Finkelstein et al. 2022a) collaborations first NIRCam observations (Bagley et al. 2024).

Counting stars to infer the morphology and scales of the Milky Way is a classic experiment in Astronomy. This was the original motivation behind mapping the night sky, begun initially with photographic plates, moving to wide-field charged coupled devices

(CCDs), and now space-based imaging with missions such as the Hubble Space Telescope (HST) and JWST.

However, counting stars is also an approach that can easily fall into conceptual problems and incomplete information (e.g. Herschel 1785; Kapteyn 1922). The disc of the Milky Way was eventually measured and mapped using giant stars with ever increasing precision (Gilmore & Reid 1983; Gilmore 1984; Siegel et al. 2002). The statistics are now such that individual stellar kinematic populations can be tracked (e.g. Hsu et al. 2021) and a link between the scales of the disc and metallicity is evident (e.g. Bovy et al. 2012).

Near-infrared mapping of the sky has revealed dwarf galaxy populations in the local solar neighbourhood (Reid et al. 2001; Cruz et al. 2004). Thanks to the Wide-field Infrared Survey Explorer (WISE) satellite (Wright et al. 2010), a near-complete census of the nearest 20 pc around our Sun, the numbers of these brown dwarfs are now known, adding a spectral class in the process (Reid et al. 2008; Kirkpatrick et al. 2021). Other nearby searches have increased our knowledge of brown dwarf physics, using e.g. Gaia (Stevenson et al. 2023).

These lower mass stars have gained attention as a nuisance population in the search with the HST and now JWST for high-

<footnote>*E-mail: benne.holwerda@gmail.com</footnote>
<figure><img src="image_3.png" /><figcaption>**Figure 1.** Small black dots denote all objects in the CEERS photometric catalogue used for this work. The red dots denote the positions of stellar objects identified in Fig. 2.</figcaption></figure>

<figure><img src="image_4.png" /><figcaption>**Figure 2.** The apparent magnitude of objects in the CEERS photometric catalogue in the F200W detection filter (AB magnitude) and the effective radius computed by SOURCE EXTRACTOR in the same filter. The green dashed lines delineate the locus of unresolved sources. We identify the red objects as unresolved stellar candidates.</figcaption></figure>

redshift ($z > > 6$) galaxies as both populations overlap in colour space (Caballero, Burgasser & Klement 2008; Wilkins, Stanway & Bremer 2014; Finkelstein 2015), or in searches for Active Galactic Nucleus (AGN) (Hewett et al. 2006) or as a background population in direct planet imaging (Kenworthy et al. 2009). This provides a completely independent scientific motivation to characterize the number of ultracool dwarfs in the Milky Way.

Deep HST observations have constrained the size of the Milky Way disc thanks to the unambiguous identifications of stars as point sources as even high-redshift galaxies are resolved and enough colours or grism spectra exist for type identification. Brown dwarfs have been identified in the HST Deep Field (Pirzkal et al. 2005), Great Observatories Origins Deep Survey (GOODS)/Cosmic Assembly Near-infrared Deep Extragalactic Legacy Survey (CANDELS) fields (Stanway et al. 2008; Pirzkal et al. 2009), and individual parallel fields (Ryan et al. 2005, 2011; Holwerda et al. 2014b; van Vledder et al. 2016). But with low statistics and only a few lines-of-sight out

of our Milky Way, these studies remain uncertain on the scale height, especially as a function of brown dwarf (sub)type.

Ryan et al. (2017) introduces a new concept to model the scale height for different subtypes of brown dwarfs: it implies that as brown dwarf's atmospheres cool (i.e. these objects age and thus become a later type), their population scatters and kinematically heats up, resulting in a greater Galactic scale height. Depending on the star-formation history of the Milky Way, this cooling/aging effect with kinematic heating of the population as a whole, should be clear in the brown dwarf type–scale height relation. Ryan et al. (2022) refined the above model and included the kinematic tracers showing direct evidence for the vertical mixing of this population (Aganze et al. 2022a, b). Additional prior constraints can come from the local initial mass function (Kirkpatrick et al. 2021, 2023), local 3D T-dwarf kinematics (Hsu et al. 2021), and the previous determined scale heights (Aganze et al. 2022a, b) from the WFC3 infrared spectroscopic parallel survey WISPS grism observations. This HST searches for brown dwarfs are limited to $m_J = 24AB$ for pure-parallel photometry and grism observations.

The challenge is therefore to type M/L/T/Y dwarf objects sufficiently accurately to map their distances photometrically. The broad filters typically employed on JWST/NIRCam deep observations such as CEERS (Finkelstein et al. 2022a) and Prime Extragalactic Areas for Reionization and Lensing Science (PEARLS) (Windhorst et al. 2023) programmes may hold enough information to do so (Holwerda et al. 2018). The CEERS NIRCam observations were in a large part designed to identify sources for follow-up with the other JWST instruments to characterize their nature (see NIRCam key papers Finkelstein et al. 2023; Kartaltepe et al. 2023; Kocevski et al. 2023). Our aim here is to evaluate how suitable such JWST/NIRCam observations are for Galactic science, specifically low-mass (sub)stellar objects.

Here, we explore the use of the colour space of the early CEERS NIRCam observations to identify (sub)stellar objects in these fields. We classify them using the templates of nearby examples using k-nearest neighbours. And finally we constrain the scale height of the Milky Way using the identified (sub)stellar populations in the CEERS field, and compare these with existing estimates.

## 2 CEERS

The CEERS (PI: S. Finkelstein; Finkelstein et al. 2017) is a JWST early release science project to explore the early Universe and the early evolution of galaxies using a variety of instrument modes, shortly after telescope commissioning (Rigby et al. 2023a, b).

CEERS has covered ~90 sq. arcmin of the EGS field with JWST (Gardner et al. 2023; McElwain et al. 2023; Menzel et al. 2023) imaging (and a portion with spectroscopy) using NIRCam (Rieke et al. 2023) described in Bagley et al. (2023), MIRI (Wright et al. 2023) described in Yang et al. (in preparation), and NIRSpec (Jakobsen et al. 2022; Böker et al. 2023) described in Arrabal Haro et al. (in preparation). CEERS demonstrates, tests, and validates efficient extragalactic surveys with coordinated, overlapping parallel observations in a field supported by a rich set of HST/CANDELS multiwavelength imaging (Grogin et al. 2011; Koekemoer et al. 2011). The CEERS NIRCam data were obtained in two epochs, in June and December 2022.

The CEERS science goals include the identification of high-redshift galaxies through NIRCam colours (Finkelstein et al. 2022b, 2023; Akins et al. 2023), confirming candidate high-redshift sources with NIRSpec or ground-based follow-up (e.g. Fujimoto et al. 2022, 2023), and probe the physical conditions in these early galaxies using
<figure><img src="image_5.png" /><figcaption>**Figure 3.** The F115W–F150 and F200W–F277W, F200W–F277W and F356W–F444W colour–colour space for the stellar objects identified in Fig. 2 with the brown dwarf standard stars overplot as tracks in increasing type. With the intrinsic variation in colour with brown dwarf type, this shows it is plausible a majority of the stellar sources are possibly brown dwarf type objects. No F410M filter information is available for the standard brown dwarfs.</figcaption></figure>

<figure><img src="image_6.png" /><figcaption>**Figure 4.** An example of a Y-dwarf from Leggett et al. (2021) with some of the absorbing molecule species marked and the CEERS NIRCam filters used annotated at the bottom. The JWST/NIRCam blue filters (F115W, F150W, F200W, and F277W) are sensitive to the molecular absorption features that define the classes. The longer wavelength filters (F356W, F410M, and F444W) are more sensitive to overall temperature and different molecular absorption features.</figcaption></figure>

<caption>**Figure 5.** The distribution of standard types for the SPLAT training set. The training set is dominated by late M- and early L-dwarfs.</caption>

emission line diagnostics and mid-infrared emission (Jung et al. 2022, 2023; Arrabal Haro et al. 2023a, b; Tang et al. 2023; Zavala et al. 2023). Key for these science aims is the NIRCam imaging for source discovery and characterization. The NIRCam filters are sensitive to rest-frame optical emission and thus ideal to probe the evolution of structure starting at a much earlier epoch than ever before (Guo et al. 2023; Huertas-Company et al. 2023; Kartaltepe et al. 2023; Long et al. 2023; Magnelli et al. 2023; Papovich et al. 2023; Shen et al. 2023; Vega-Ferrero et al. 2024). These two science topics, the identification for follow-up of high-redshift targets and the structure of earlier epoch galaxies were the main drivers of the observational design. These two science drivers mean the selection of broad filters to optimize throughput. A single medium or narrow-band filter in the 1–3 micron range would already improve brown dwarf classification performance using a colour significantly (see Holwerda et al. 2018).

## 3 DATA

The JWST/NIRCam images used are the pixel-aligned mosaics described in Bagley et al. (2023), v0.6 on the CEERS website. Empirical Point Spread Functions (PSFs) were created by stacking stars for the entire mosaic in the case of HST and NIRCam.

We make use of the internal CEERS photometry catalogue. This will be discussed in Finkelstein et al. (in preparation), but the methodology is summarized here. The PSF of F606W, F814W, F115W, F150W, and F200W is matched to that of F277W. For bands with larger PSFs, the redder NIRCam filters, F356W and F444W, and all other HST/WFC3 filters, they calculated correction factors by convolving the shorter wavelength images to the larger PSF of the F444W, and measuring the flux ratio in the native image to that in the convolved image. By applying this correction factor the fluxes measured in the images with larger PSFs, this corrects for the missing flux under the assumption that the morphology does not change significantly. This is especially useful for small high-redshift sources or faint stellar photometry as it is used here. The photometry using SOURCE EXTRACTOR (v2.25.0 Bertin & Arnouts 1996; Holwerda 2005) is described in Finkelstein et al. (in preparation).
<figure><img src="image_7.png" /><figcaption>**Figure 6.** The distribution of *HST/WFC3* colours for the standard types for the training set. The colour–colour selections from Ryan et al. (2011) and Holwerda et al. (2014b) for M-, L-, and T-dwarfs are indicated with coloured boxes. This illustrates the issue with hard cuts: in a two-dimensional space like this, there is still ample mixing of types. A photometric classifier based on proximity in this space is expected to perform better than these initial colour–colour cuts.</figcaption></figure>

The fits catalogue contains photometry in units of nJy. We made use of the fiducial flux and flux error columns, which were corrected to total, and with flux errors calculated empirically from the images. Fluxes were converted to AB magnitudes using a conversion of $m_{AB}$(FILTER) = -2.5 × log₁₀(FLUX_FILTER) + 31.4. The F277W+F356W image was the detection image with the other filters run in dual-image mode to obtain photometry (see Finkelstein et al. 2022a; Finkelstein in preparation, for details). The half-light radius from SOURCE EXTRACTOR for the F200W filter image is included in this catalogue. The position of all the sources in the catalogue is shown in Fig. 1.

## 3.1 Stellar catalogue

We use the effective radius measured in the F200W image of the two-image SOURCE EXTRACTOR run described above to identify unresolved objects in the stellar locus. Fig. 2 shows the effective radius as a function of the F200W AB magnitude. The green dashed lines show the limits of the stellar locus, similar to the approach in Ryan et al. (2011) and Holwerda et al. (2014b). The unresolved stars’ half-light radius (50 per cent of flux size) is less than 0.1 and declines slightly with fainter objects. This is a known effect in *HST* imaging because the growth curve from which SOURCE EXTRACTOR derives the half-light radius loses the lower surface brightness pixels which make a larger fraction for the flux for fainter sources. The red marks in Fig. 2 are the stellar candidates marked in Fig. 1 as well. The utility of the half-light radius measured by SOURCE EXTRACTOR translates well from *HST* to *JWST* with a slightly different dependence between the half-light radius and magnitude. We empirically determine that this stellar identification works well to $m_{AB} \sim 28$ for the CEERS field.

We use AB magnitudes derived to determine colours for the three feature spaces, *JWST/NIRCam*, *HST+JWST* combined, or either ranked by filter wavelength or colours based on only *HST* and *JWST* filter pairs.

Fig. 3 shows the NIRCam colours space with the SPEX prism library analysis toolkit (SPLAT) template stellar colours overplot

of increasing type (Burgasser & Splat Development Team 2017; Holwerda et al. 2018). A majority of the stellar objects have colours similar to brown dwarf templates.

## 4 CLASSIFYING M-L-T-Y-TYPE DWARFS WITH NIRCAM COLOURS

A problem in identifying M-L-T-Y-dwarf stars from just photometry is that, while there are some clear absorption features in their spectra in the 0.5–2 micron range, these easily become a somewhat degenerate space when observed with wide filters of current and near-future near-infrared imaging space observatories (Holwerda et al. 2018). This has been a known challenge in photometric surveys since 2-Micron All-Sky Survey (2MASS) (cf Kirkpatrick et al. 1999; Burgasser et al. 2003a, 2004; Burgasser, McElwain & Kirkpatrick 2003c; Mainzer et al. 2004; Aberasturi, Solano & Martín 2011; Bhavana et al. 2019). Fig. 4 shows an example of a Y-dwarf spectrum from Leggett et al. (2021) with the CEERS NIRCam filter curves to illustrate. Depending on the atmospheric composition of the brown dwarf, one can expect very different NIRCam colours.

The challenge is now to classify as well as possible with just NIRCam broad colours. Previous work (Ryan et al. 2011; Holwerda et al. 2014b) solved this with colour–colour spaces defined in *HST* filters. The issue is that these are hard cuts in colour space and the problem of broad classification is not as clear-cut as that.

Here, we use the *JWST/NIRCam* colour predictions based on *SPLAT* spectral library from Holwerda et al. (2018) to classify unresolved sources in CEERS. To do so, we tried k-means nearest neighbour (kNN), a support vector machine, and a random forest (an average of decision trees) on the bluest colours. Because the *SPLAT* spectra only extend to 2.5 µm, the longest NIRCam wavelengths cannot be included for the training of the Machine Learning (ML) algorithms but we can compare the resulting type predictions to the standard stars for each type, for which there is analogue *WISE* satellite W1–W2 colour available.

Because the colour space of brown dwarfs represents a space with steep gradients and a mixture of physical parameters that drive the observed NIR spectra, we prefer this approach over fitting templates to each Spectral Energy Distribution (SED) with assuming the lowest $\chi^2$ is the optimal fit. By using *SPLAT* observed spectra rather than model templates, the kNN fit allows for observed but still unexplained variance in each type.

### 4.1 Training sample

The full *JWST/NIRCam* colour sample available based on *SPLAT* spectroscopy (Burgasser & Splat Development Team 2017) is available from Holwerda et al. (2018). Briefly, there are *JWST/NIRCam* photometry estimates for the 30 standard stars which define the spectral type and for all the *SPLAT* spectra which capture the intermediate types and variance within spectral types. We use the latter full sample as a training set. The photometry from Holwerda et al. (2018) is reported in Vega magnitude and we converted these to AB magnitudes first using the conversions from Calamida et al. (2022) for the *HST/WFC3* and JDox for *JWST/NIRCam*.<fnref n="1" /> There are NIR colours in both *HST/WFC3* and *JWST/NIRCam* filters for this training set. We use three colour feature spaces, a NIRCam-only, a NIRCam and *HST* one with colours separated by instrument, and a

<footnote n="1">¹Specifically this conversion table: https://jwst-docs.stsci.edu/files/182256933/182256934/1/1669487685625/NRC_ZPs_0995pmap.txt</footnote>
<figure><img src="image_8.png" /><figcaption>**Figure 7.** The full feature space of the photometric catalogue generated from SPLAT spectra of nearby brown dwarfs for the JWST/NIRCam filters in CEERS. Some parts of the colour–colour space are well-suited to broadly classify these objects but the space is degenerate, an ideal scenario to maximize return with a machine learning approach.</figcaption></figure>

third where colours use filters in wavelength order, mixing HST and JWST filters.

For the labels one can employ index type or standard type from the SPLAT catalogue (Burgasser & Splat Development Team 2017). The index type is based on the absorption features (e.g. H~2~O, Reid et al. 2001; Testi et al. 2001; Allers et al. 2007; Burgasser 2007), i.e. a classification by the spectral index. The standard type is a classification based on which standard star resembles the object’s spectrum the closest (e.g. Kirkpatrick, Henry & McCarthy 1991; Kirkpatrick et al. 1999; Burgasser et al., for M-, L-, and T-type, respectively). The index type has fewer stars classified as intermediate type than the standard type does. The standard type appears to be more internally consistent and therefore apt for use as a training set. We adopt the standard type throughout. We assign a numerical type as follows: M-types are 0–0.9, L-types 1.0–1.9, T-types 2.0–2.9, and Y-types 3 and above. Later, when applying these labels to the kNN multiclassing, we multiply these by 10 because the kNN can only handle integer classes. Late M- and early L-types are much more represented in the SPLAT training set compared to the later

types because their relative luminosity. But all types and subtypes are present in the training set with reasonable sampling (Fig. 5). The training set is based on local brown dwarfs, i.e. mostly nearby and with Solar metallicity.

Ryan et al. (2011) and Holwerda et al. (2014b) used the near-infrared colour–colour space to broadly type the M-L-T-dwarfs in parallel HST/WFC3 fields. Fig. 6 shows the original HST/WFC3 colour–colour space used for broad photometric typing of these objects. Broad classes are still mixed in this colour space and subtyping using hard cuts in colour–colour space remains impossible.

Fig. 7 shows a NIRCam equivalent of a colour–colour plot of the SPLAT catalogue. A similar separation of objects could conceivably be used. Rather than picking a particular colour–colour combination for broad classification and hoping to subclass these objects with the remaining information, we opt to subclass directly, varying the spectral subtype resolving power ($\Delta T$). As said above, we use three feature spaces: the bluer NIRCam colours, and two iterations of the CEERS HST+JWST complete photometry, one using only instrument specific colours (inst), i.e. only combining HST filters into
<figure><img src="image_9.png" /><figcaption>**Figure 8.** The full feature space of the photometric catalogue generated from SPLAT spectra of nearby brown dwarfs for the *HST/WFC3* filters in CEERS. Some parts of the colour–colour space are well-suited to broadly classify these objects but the space is degenerate, an ideal scenario to maximize return with a machine learning approach.</figcaption></figure>

a colour, and one with the colours arranged by wavelength (wav). For example, in the latter, we combine *HST*'s F160W and NIRCam's F150W into a single colour.

Figs 7, 8, and 9 show the parameter space and the classification into broad types as the colour coding. Colour–colour space has already proven itself to work well on broad type (e.g. M, L, T or Y?) but now we will attempt to refine the classification down to subclasses.

We start to classify based on 1271 SPLAT (Burgasser & Splat Development Team 2017; Holwerda et al. 2018) spectra from which photometry can be derived in Holwerda et al. (2018) with spectral classifications (standard type). There are 40 classes in this training set.

## 4.2 kNN classifications

K-nearest neighbour classifies objects using the N nearest neighbours in the feature space. Historically, kNN classifies in to two classes (0 or 1). Multiclass classification can be defined as the classifying instances into one of three or more classes. Multiclassing is possible

MNRAS 529, 1067–1081 (2024)

with the SKLEARN implementation of kNN and this is what we employ here. kNN classification has successfully been used on brown dwarf photometry in Marengo & Sanchez (2009). Splitting the SPLAT sample into the typical 80/20 per cent split between training and test set, we classify into the 40 classes of standard type. We initially use the *HST+JWST*(wav) feature space where colours are computed going from longest to shortest wavelength of the filter, regardless of instrument used.

We want to know a few different classification specific questions: (1) how many neighbours are optimal for classification in this feature space?; (2) to what degree of accuracy can one classify within 0.1 of a subtype, 0.2, 0.5 or just the full type?; and (3) how well does it still perform if only *JWST* or *HST* information is used?

## 4.3 Number of neighbours

Fig. 10 shows the dependence of the kNN performance trained on the full *HST+JWST*(wav) feature space as a function of the number
<figure><img src="image_10.png" /><figcaption>**Figure 9.** The full *JWST+HST* feature space of the photometric catalogue generated from SPLAT spectra of nearby brown dwarfs for the *HST/WFC3* and *JWST/NIRCam* filters in the CEERS catalogue, sorted by wavelength. This extensive colour feature space may well be suited to classify sources in deep *HST+JWST* data but mixing instruments for the colours may be susceptible to systematics.</figcaption></figure>

of neighbours used, the key hyperparameter for kNN classifiers. Metrics are calculated based on the number of true and false positives and negatives (TP, FP, TN, and FN) in case of two classes. Our metrics are accuracy (TP+TN / (TP+TN+FP+FN)), precision (TP/TP+FP), recall (TP/TP+FN), and F1 (2× precision × recall / precision + recall). A good classifier strikes a balance between accuracy (fraction of accurate classifications), the accuracy of positive identification (precision), and the completeness of the identified sample (recall) or a metric of the balance of the previous two (F1). The optimal performance in terms of accuracy occurs between $n = 3$ and $n = 7$. Precision and F1 peak at $n = 4$. We use $n = 4$ for the remainder of our applications of kNN on these data sets as the optimal number of neighbours to determine subtype with kNN. This is comparable to $k = 3$ adopted

for *Spitzer* colour classification adopted by Marengo & Sanchez (2009).

## 4.4 Performance and type accuracy

Fig. 11 shows the confusion matrix over all 40 types of standard type classes in the training set $\Delta T = 0.1$, the highest type accuracy possible. Accuracy was 66 percent and the other metrics are in Table 1. The same feature space using the index type as the label performed notably worse. This level of performance is not useful in classification but the confusion matrix in Fig. 11 is encouraging in that it may improve with a somewhat coarser type resolution.

Secondly, we explore if just broad class (M/L/T or 0/1/2) classifications can be done with this feature space. Accuracy dramatically
<figure><img src="image_11.png" /><figcaption>**Figure 10.** The precision, recall, F1, and accuracy, each expressed as a dimensionless fraction, as a function of number of neighbours (n) of the test set of the kNN classifier on the SPLAT photometry using the HST+JWST(wav) feature space.</figcaption></figure>

<figure><img src="image_12.png" /><figcaption>**Figure 11.** The confusion matrix of the kNN classification into individual subtypes of M, L, T-dwarfs using the HST+JWST(wav) feature space shown in Fig. 9. The overall metrics can be found in Table 1 for a type resolution of $\Delta T = 0.1$.</figcaption></figure>

<table><caption>**Table 1.** The metrics for the different binning in type for the kNN algorithm. An optimal resolution is $\Delta T = 0.5$ for this colour-space.</caption><thead><tr><th>Instance<br>kNN ΔT</th><th>Accuracy<br>(per cent)</th><th>Precision<br>(per cent)</th><th>Recall<br>(per cent)</th><th>F1<br>(per cent)</th></tr></thead><tbody><tr><td>0.1</td><td>0.60</td><td>0.46</td><td>0.49</td><td>0.46</td></tr><tr><td>0.2</td><td>0.77</td><td>0.62</td><td>0.62</td><td>0.61</td></tr><tr><td>0.3</td><td>0.77</td><td>0.78</td><td>0.79</td><td>0.78</td></tr><tr><td>0.4</td><td>0.83</td><td>0.83</td><td>0.82</td><td>0.82</td></tr><tr><td>0.5</td><td>0.83</td><td>0.70</td><td>0.70</td><td>0.70</td></tr><tr><td>0.6</td><td>0.83</td><td>0.68</td><td>0.68</td><td>0.68</td></tr><tr><td>0.7</td><td>0.86</td><td>0.82</td><td>0.82</td><td>0.82</td></tr><tr><td>0.8</td><td>0.91</td><td>0.69</td><td>0.71</td><td>0.69</td></tr><tr><td>0.9</td><td>0.89</td><td>0.88</td><td>0.91</td><td>0.89</td></tr><tr><td>1.0</td><td>0.89</td><td>0.92</td><td>0.93</td><td>0.92</td></tr></tbody></table>

<figure><img src="image_13.png" /><figcaption>**Figure 12.** The broad ($\Delta T = 1$) kNN classification confusion matrix.</figcaption></figure>

<figure><img src="image_14.png" /><figcaption>**Figure 13.** The kNN classification confusion matrix on the HST+JWST(wav) feature space with a much lower type resolution of $\Delta T = 0.5$.</figcaption></figure>

improves to 85 per cent with equally good precision and recall scores. These values were even higher for index type, probably because it does not contain M-type which is somewhat featureless in the NIR at the spectral resolution of these filters. Fig. 12 shows the confusion matrix for standard type class for just the broad class for classification. Broad types one can do very well with these four broad JWST/NIRCam filters. There is a slight tendency of kNN algorithm to class brown dwarfs as later type (below the diagonal).

Our question is now how much better the classification can do than broad class? First, we classify within half a class, within $\Delta T = 0.5$, where the integer is the broad M, L, or T class and then we shall explore 0.4 and 0.2 of a class. Because kNN algorithm does not allow for fractional classes, we multiply the class by 10 (e.g. L1 thus becomes 11 and we divide by 10 afterwards).

Figs 12 and 13 show the confusion matrices for the different resolutions in spectral type for the test set. Fig. 14 shows the metrics
<figure><img src="image_15.png" /><figcaption>**Figure 14.** The metrics of the kNN classification, each expressed as a dimensionless fraction, as a function of the type resolution ($\Delta T$) for the full *HST+JWST/NIRCam*. All metrics climb steadily with coarser type resolution. If one wants to classify within a type ($\Delta T = 0.5$), the metrics are ~85 per cent. Notably, $\Delta T = 0.3$ would perform almost equally well.</figcaption></figure>

<figure><img src="image_16.png" /><figcaption>**Figure 15.** The kNN classification confusion matrix on the *HST+JWST*(wav) feature space with the optimal type resolution of $\Delta T = 0.4$. This is the kNN classifier used on the CEERS photometry.</figcaption></figure>

of the test set for kNNs trained with different spectral type resolution and these metrics for each kNN run are listed in Table 1.

Fig. 15 shows the optimal type resolution of $\Delta T = 4$ with $k = 4$. This is the optimum we can achieve with the mix of filters available in CEERS. We note that *HST* or *JWST* filter combinations alone also perform optimally with this spectral type resolution but with lower overall metrics (Fig. 16).

We varied the number of neighbours for each classification scheme (e.g. *n* = 2 to *n* = 20) but this made no real difference in the metrics. Just under half a type ($\Delta T = 0.4$) clearly is the optimal resolution for the *HST* three-colour feature space to classify in. This is a substantial improvement the hard colour cuts into broad type by Ryan et al. (2011) and Holwerda et al. (2014b) but falls just short of grism

spectroscopy classification which can discriminate between subtypes (Aganze et al. 2022a, b).

Fig. 16 shows the type resolution of *HST*-only and *JWST/NIRCam*-only colour feature spaces. Surprisingly, the *HST* filter combination performs almost as well as *HST+JWST/NIRCam* in classification accuracy with type resolution (Fig. 14). In effect, it appears that kNN classification can be almost as accurate if the *HST* NIR imaging is sufficiently deep enough to identify the relevant stars. This will be an inherently smaller volume than *JWST/NIRCam* can reach.

# 5 RESULTS

We will now examine the use of the kNN classification on the NIRCam observations of CEERS described in Section 3.

## 5.1 Application to CEERS

We now apply the kNN classification on the CEERS photometry of unresolved sources identified in Fig. 2. Fig. 1 shows the distribution of unresolved sources in the ten CEERS fields. We identified a total of 518 stars with a classification ($P_{kNN} > 0.5$) with the majority of probabilities at 0.8 (Table 2). These classifications are based on the colours using the F115W, F150W, F200W, and F277W filters. We can now verify these kNN type predictions with the red NIRCam colours.

## 5.2 NIRCam red colours

Fig. 17 shows the kNN type versus the F444W–F356W and F444W–F410M colours. These colours are not included in the SPLAT derived filters as these wavelengths are outside the *IRTF/SPEX* spectrograph bandwidth. However, *WISE* W1–W2 colours are available for the standard stars for each type from Pecaut & Mamajek (2013) and these are close stand-ins for the F444W–F356W colour. These colours can be computed for the models of Saumon et al. (2012) and Morley et al. (2012) L/T/Y atmospheric models as well. The standard stars agree well with these atmospheric models, specifically those of Saumon et al. (2012). We note that there is almost a magnitude of variance in colour in the models of Morley et al. (2012), reflecting a wider range of parameters.

The CEERS kNN identified late brown dwarf types ($T > 2.5$, T5 dwarf or later) appear to be bluer in the NIRCam reddest filters, the ones not used in the kNN classification. These are some 7 high-confidence brown dwarfs [*P(T) > 80 per cent*] that do not line up in the redward colour space. The discrepancy is as much as a magnitude in F444W–F356W colour. The remaining late-M and late-T types are much more consistent with the NIRCam long filters.

There are some possible reasons why a classification based on optical red and near-infrared colours does not agree with a longer wavelength class for brown dwarfs: brown dwarfs can be variable, spectral typing can differ by wavelength regime, interstellar dust will redden along some lines-of-sight, and stellar metallicities are expected to change with Galactic radius and in the stellar halo.

It has been known for some time that brown dwarfs are variable in shorter – optical and near infrared – wavelengths (Bailer-Jones 2008; Goldman et al. 2008; Biller et al. 2013; Robinson & Marley 2014), most recently using Gaia and TESS (e.g. Kumbhakar et al. 2023; Sarro et al. 2023). Variability at these longer wavelengths appears to be rare (Brooks et al. 2023). Optical and near-infrared spectral classifications have often disagreed for these objects (cf Burgasser et al. 2010; Cruz et al. 2018). Optical and near-infrared colours can be influenced by inherent properties such as magnetic
<figure><img src="image_17.png" /><figcaption>**Figure 16.** The metrics of the kNN classification, each expressed as a dimensionless fraction, as a function of the type resolution ($\Delta T$) for the HST-only filter colour-space (left) and the JWST-only filter colour-space (right). For HST, all metrics climb steadily with coarser type resolution. If one wants to classify within a type ($\Delta T = 0.5$), the metrics are ~85 per cent. Notably, $\Delta T = 0.4$ would perform almost equally well. For JWST-only, the blue NIRCam filers perform poorer than in combination with HST (Fig. 14) or HST-only (left) until almost full type resolution $\Delta T \sim 1$.</figcaption></figure>

<table><caption>**Table 2.** The numbers of stellar objects identified in the NIRCam fields and the respective classifications by the kNN. Both M4 and T8 may include types that are hotter and more massive or colder, respectively (e.g. K-start in the M0 or Y3-dwarfs in the T8 category).</caption><thead><tr><th>Stars</th><th>M4</th><th>M8</th><th>L2</th><th>L6</th><th>T0</th><th>T4</th><th>T8</th></tr></thead><tbody><tr><td>518</td><td>491</td><td>9</td><td>0</td><td>2</td><td>0</td><td>1</td><td>15</td></tr></tbody></table>

field activity and age (Kiman et al. 2019). The atmospheres of these objects is cool enough for dust to be present (Allard et al. 2001; Lee, Blecic & Helling 2018; Sorahana, Kobayashi & Tanaka 2021), a reddening effect independent of interstellar dust reddening. This could explain reddening in individual objects along the single line-of-sight. It remains a possibility that some of these objects are free-floating planets at a much closer distance but with a very similar spectral signature to brown dwarfs (Filippazzo et al. 2015; Faherty et al. 2016; Deacon 2018; Leggett et al. 2019).

Fig. 4 gives a hint to the discrepancy between the classification based on the short wavelength filters and the colours observed in the long NIRCam filters. The F410M and F444W both cover a wavelength range where a sulfur and a phosphorus molecule is influencing absorption (Leggett et al. 2021). If these are T/Y dwarfs with relatively more of such compounds, perhaps it could skew the reddest NIRCam colours towards redder values? Metallicity and age (Kiman et al. 2019) could well explain some of the variation in the discrepancy between short and long wavelength classification.

The Saumon et al. (2012) and Morley et al. (2012) models are for Solar metallicity brown dwarfs only. This explains why they align with the standards for brown dwarfs and hints at lower metallicity as a possible explanation for the red colours of these late-type brown dwarfs. Future infrared spectroscopy of these could confirm this.

## 5.3 NIRSpec prism observations

Two of the kNN brown dwarf candidates were observed with CEERS NIRSpec multishutter assembly (MSA) spectroscopy (Arrabal Haro

et al. in preparation; Arrabal Haro et al. 2023b) using the low-resolution ($R = 30–300$) prism disperser (Fig. 19). These targets were not originally selected to be stars, but as candidates for distant extragalactic objects. For a description on the extraction and reduction of the MSA spectra of these objects we refer the reader to Arrabal Haro et al. (in preparation) and Arrabal Haro et al. (2023b).

CEERS object 53250 (NIRSpec MSA ID 1558) was originally selected as a NIRSpec target from HST CANDELS data as candidate for a galaxy with photometric redshift $z > 6$. Fitting galaxy spectral energy distribution models to the NIRCam and HST photometry yields a photometric redshift sharply peaked at $z \sim 8$ due to the flux discontinuity at $\sim 1 \mu m$. However, this photometric redshift goodness-of-fit is very poor ($\chi^2 = 240$), and there is a very significant detection in the HST F814W filter, which is inconsistent with a Ly$\alpha$ break at $z \sim 8$. The stellar kNN classification for is $T = 0.4$ (M4) and $T = 0.8$ (M8) with 50 per cent probability [$P(T = 0.4) = 50$ per cent and $P(T = 0.8) = 50$ per cent]. The spectrum shows the characteristic absorption features at 1.5 and 2.5 microns typical of later brown dwarfs (M4–L7), compare to Holwerda et al. (2018), their Fig. 1. Until final spectral reduction is complete, we limit ourselves here to a visual classification. The two clear, broad absorption features at 1.5 and 2 micron means this object is later than M4. The lack of a clear absorption feature at 1.1 micron means it is earlier than L7 and the depth of the visible absorption features precludes later types. The depth of the absorption features and the slope at 1–1.5 micron suggest late M rather than early L.

This is mostly consistent with the confusion matrix of the kNNs (Fig. 12) where later types are more commonly misclassified as early-type brown dwarfs. Fig. 20 shows the prism spectrum of CEERS MSA ID 1558 (Fig. 19 left) with the molecular absorption features highlighted in Fig. 4. The dominant species appears to be water. Assuming the kNN M8 classification (absolute magnitude $M_K = 11.77AB$) the inferred distance to this object is close to 4 kpc, well into the stellar halo.

CEERS object 22148, with apparent magnitude $m_{F200W} = 26.09AB$ and half-light radius $r_{\text{eff}} = 0.08$, sits just below the stellar locus identified in Fig. 2. Although it was not included
<figure><img src="image_18.png" /><figcaption>**Figure 17.** The kNN assigned brown dwarf type against the F444W–F356W and F444W–F410M colours. The dark red line is the W1–W2 *WISE* colour of standard stars as a function of type.</figcaption></figure>

<figure><img src="image_19.png" /><figcaption>**Figure 18.** The cumulative histogram of apparent magnitude in F200W for the kNN identified types $T = M6 \pm 2$ and $T = T6 \pm 2$ and the expected distribution assuming this type and different Galactic vertical scale heights.</figcaption></figure>

in the 'stellar' object catalogue in Table A1, we investigated it because it was observed with *NIRSpec*. The kNN classification for this object is M4/8 with 75/25 per cent probability [$P(T = 0.4) = 75$ per cent and $P(T = 0.8) = 25$ per cent]. It was selected as a *NIRSpec* target (*NIRSpec* MSA ID 20821) from *HST* CANDELS data as a candidate galaxy with photometric redshift $z \approx 1.92$. That identification is confirmed by the *NIRSpec* spectrum, which shows strong emission lines at $z = 1.94$ from the Hydrogen Balmer and Paschen series, [O III]4960,5008, [S III]9533, and He I 10833. The emission lines contribute significantly to fluxes measured through the *NIRCam* filters, perturbing the colours and leading to the photometric misclassification as a cool star. This object serves as an important reminder that individual kNN identified objects are primarily *candidates* until spectroscopically confirmed, and that careful selection of unresolved objects can aid in the precision of the selected sample. Fortunately, a probabilistic Milky Way model can cope with a certain amount of contamination. For example, the Monte-Carlo Markov Chains (MCMC) model from van Vledder et al. (2016) accounted for 40 per cent misclassification.

## 5.4 Scale height of brown dwarfs

To model the scale height of the Galactic disc along the one line-of-sight of the CEERS field, we use the cumulative count of brown dwarfs as a function of apparent magnitude (similar to Pirzkal et al. 2005, 2009). Assuming a brown dwarf type and the local density within 20 pc from Reid et al. (2008) and Kirkpatrick et al. (2021) and a scale height, one can compute the numbers of brown dwarfs along the line-of-sight. This works best with a single brown dwarf type, a cleanly selected sample, and only the thin disc of the Milky Way considered.

Fig. 18 shows two cumulative histograms of the brown dwarf candidates identified in CEERS. The early types ($T = 0.6$, i.e. M6) show an overdensity compared to the thin disc. At the lower apparent luminosities, there is a clear overdensity that cannot be explained by a Galactic thin disc alone. This is similar to what Holwerda et al. (2014a) and van Vledder et al. (2016) found for M-dwarfs in the *HST* pure-parallel fields. For M-dwarfs, Sarro et al. (2023) uses a value of 365 pc for the scale height to infer the luminosity function with *Gaia*. Bardalez Gagliuffi et al. (2019) uses a canonical scale
<figure><img src="image_20.png" /><figcaption>**Figure 19.** NIRSpec prism spectra of two of the unresolved objects identified by the kNN classification method. The 2D spectra are shown above, with the extraction window marked with a white border. The 1D extracted spectra are shown below. Left: CEERS *NIRSpec* MSA ID #1558 shows broad absorption bands at 1.5, 2, and 2.5 microns typical of later type brown dwarfs (see Fig. 4). Right: CEERS *NIRSpec* MSA ID #20821 is a galaxy at *z* = 1.94 with strong emission lines that perturb the *NIRCam* photometry, leading to misclassification as a brown dwarf.</figcaption></figure>

<figure><img src="image_21.png" /><figcaption>**Figure 20.** The spectrum of CEERS MSA ID 1558 extracted spectrum compared against the molecular features shown in Fig. 4. The majority of the absorption features appear to be due to water absorption. Five reference spectra from Burgasser et al. (2004) and Burgasser et al. (2008) are shown for the type range given by the kNN (M6–L0), converted to AB zeropoints. Later (M8–L0) appears to be the better match. The lack of sensitivity of *IRTF/SPEX* does not allow for a good comparison above 2 micron.</figcaption></figure>

height of 300 pc for a spectroscopic sample with Gaia distances to infer the luminosity function. Warren, Ahmed & Laithwaite (2021) find 222 pc based on their fit to a photometric data base using Sloan Digital Sky Survey (SDSS), 2MASS, and WISE. van Vledder et al. (2016) found 300 pc for all M-dwarfs in WFC3 fields, weighted towards early-type M-dwarfs, and Aganze et al. (2022b) found 250 pc for mostly later M-dwarfs. The cumulative histogram is consistent with a thin disc with a scale height of $z_0$ = 250–300 pc, similar to the scale heights found before (Pirzkal et al. 2005, 2009; Ryan et al. 2005, 2011; Holwerda et al. 2014b; van Vledder et al. 2016; Bardalez Gagliuffi et al. 2019; Warren, Ahmed & Laithwaite 2021; Aganze et al. 2022b; Sarro et al. 2023). We note that early M-dwarfs scale heights are most consistent with the canonical 300 pc value (see van Vledder et al. 2016) while later type M-dwarfs are consistent with a value closer to 250 pc (Aganze et al. 2022b). A second Galactic

structural component is needed to explain the numbers of M-dwarfs in deep JWST/NIRCam fields above $m_{F200W} > 24AB$.

The second panel of Fig. 18 shows the distribution of late dwarfs ($T = 2.6$, i.e. T6±2). Their distribution is mostly consistent with a thin disc alone as they are intrinsically much fainter ($M_J = 17.06AB$). A second component is not fully evident from the counts in CEERS. The cumulative histogram is consistent with a thin disc with a scale height of $z_0 = 150–200$ pc, similar to the scale height of 150/175 pc found before (Ryan et al. 2011; Aganze et al. 2022b).

There is the matter of types in-between the early and late brown dwarfs apparently missing in this field. There are two L-dwarfs and one early T-dwarf in this field with reasonably high confidences. This is not yet enough statistics to infer a scale height with much confidence. To infer scale heights accurately, one will need many more lines-of-sight though the Milky Way disc.

## 6 DISCUSSION

JWST opens up a new parameter space in the near-infrared, thanks to both more collecting area and much improved efficiency compared to other NIR observatories. CEERS is meant to demonstrate this potential, especially in extragalactic science. However, the depth and colour resolution that benefits extragalactic science can benefit science examining our own Milky Way’s stellar population just as much.

Fig. 2 illustrates the first improvement: the identification of stellar objects in drizzled NIRCam images increases from HST (~25) to ~28AB mag using otherwise identical techniques. This alone opens a wide volume of the Galaxy for low-mass stellar objects.

The much greater filter suite available onboard *NIRCam* is a second capability that expands our discovery space over *HST/WFC3*. The bluest *NIRCam* filters combine into a similar feature space (Fig. 7 compared to Fig. 8) but the addition of longer wavelength information with *NIRCam* immediately allows us to check kNN classifications. For these colours atmosphere models can stand in for the SPLAT observations [see Appendix A (online supplemental material)] but performance is not quite as reliable as SPLAT. This can be attributed to the much larger training sample in SPLAT (~1200) over these models (~300) which captures the range of characteristics inherent in the population. The models however extend to later types of brown dwarfs and cover longer wavelengths, opening up the possibility to
<figure><img src="image_22.png" /><figcaption>**Figure 21.** A comparison to fig. 4 of Bisigello et al. (2023) and fig. 1 from Pérez-González et al. (2023) for the kNN classified stellar objects. Marker size is indicative of the kNN probability assigned to each object's classification. The dashed lines are the lower limits for the selection criteria for dusty dwarfs (left) or HST-dark galaxies (right). Both populations can suffer from contamination from brown dwarfs.</figcaption></figure>

<figure><img src="image_23.png" /><figcaption>**Figure 22.** The F115W–F150W and the F150W–F200W versus F200W–F277W colours of the brown dwarf candidates identified in this paper and the same colours of the Finkelstein et al. (2023) selection of high ($z > 8$) redshift galaxies.</figcaption></figure>

train on models and then use the full *NIRCam* wavelength range to classify stellar objects. The classifications in Table 2 illustrate the limitations of the training sample: it comprises only of M0–Y3 type stars with varying densities. Larger and wider ranging training sets can be expected to have improved performance, especially in the limit classes.

The late-type candidates for example appear to have too blue colours in the reddest *NIRCam* filters (Fig. 17). This could be misidentification or an issue with calibration of the kNN. The effect is quite pronounced and could speculatively be explained by more sulfur and phosphorus compounds in these substellar objects (Fig. 4).

The F444W–F356W colours of the brown dwarfs are very similar to the F200W dropout galaxies identified in Bisigello et al. (2023), their fig. 4 (see Fig. 21) but with F200W and bluer detections. The accurate identification of brown dwarfs is therefore critical in the removal of potential interlopers in the identification of new (low redshift) dwarf galaxy populations ($z < 2$). Similarly, some kNN identified late-type ultracool dwarfs reside in the HST-dark section of the colour space identified in Pérez-González et al. (2023). These authors took care to select these samples using other colour cuts and SED fits. Fig. 21 illustrates the possibility that brown dwarfs could be

included without such precautions. In such cases, a high probability assigned by the kNN classifier that the unresolved object is a brown dwarf may be a good reason to remove an object from a selection.

A major consideration in the successful identification of brown dwarfs in extragalactic *JWST* data is to remove them as contaminant in searches for high-redshift sources ($z > 8$).<fnref n="2" />

Fig. 22 illustrates that a colour-cut in F115W–F150W can separate the two populations well but that the redder *NIRCam* colours are very similar for brown dwarfs and high-redshift galaxies alike.

Photometric identification of brown dwarfs in *JWST* data is ongoing (Beiler et al. 2023; Hainline et al. 2023; Nonino et al. 2023; Wang et al. 2023). Like all photometric identifications, the kNN

<footnote n="2">²The definition of the term ‘high redshift’ has changed in the era of *JWST* but this is the one we adopt here. Fig. 22 shows the bluer *NIRCam* colours of the brown dwarfs identified with kNN and the high-redshift sources from Finkelstein et al. (2023). The $z > 12$ sources are dropouts in the F115W and therefore not shown in the bluest colour F115W–F150W. Both the high-redshift sample and the brown dwarf kNN selection do not rely on hard colour criteria but instead on good SED fits to a template and redshift or a close set of kNN templates in colour space.</footnote>
classifications here would benefit from spectroscopic confirmation using *NIRSpec*. Fig. 19 shows a first such spectroscopic confirmation with a low-resolution *NIRSpec* prism spectrum. Spectroscopic identification and confirmation of such sources is happening in a number of extragalactic programmes (Beiler et al. 2023; Burgasser et al. 2023; Langeroodi & Hjorth 2023).

Wang et al. (2023) identify a T-dwarf in the public CEERS data. This object is not in our kNN classified sample as it too faint to be included ($m_{F200W}$ = 28.45AB, see Fig. 2). However, a kNN classification trained on just the blue JWST/NIRCam filters (F115W, F150W, F200W, and F277W) predicts an L7-dwarf ($T_{eff}$ = 1530 K, $P_{kNN}$(*Type*) = 100 per cent), a higher effective temperature than ($T_{eff}$ = 1300, T0 as classified by Wang et al. 2023). The reported F444W–F356W colour (−0.14) is consistent with the kNN classification as well as the Wang et al. (2023) one (Fig. 17). We note here that L7 and T0 are less than 4 subtypes apart.

The difference between kNN classification and spectroscopic classification for individual sources highlights the statistical nature of the kNN classifications. It shows that kNN classifications are good enough for a population of sources to be used in a statistical manner to infer the shape of the Milky Way. An MCMC model such as employed by van Vledder et al. (2016) has the benefit of explicitly dealing with a fraction of the data as bad as a fit parameter.

The inferred vertical profiles of M and T-dwarfs is 300–350 pc for the $M6\pm2$ dwarf candidates in the CEERS field with a clear second component starting at $m_{F200W}$ ~ 24 in Fig. 18. This is consistent with what van Vledder et al. (2016) found for HST/WFC3 pure-parallel fields (300 pc). The scale height of the candidate T-dwarfs is more consistent with 150–200 pc. This is remarkably consistent with what Aganze et al. (2022b) found from HST grism observations (175 pc).

The photometric identification of M-L-T-Y-dwarf stars in deep extragalactic observations such as CEERS has a success rate (85 per cent or better) with existing photometry. It seems only a matter of time before enough sightlines through the Milky Way will be available for an accurate assessment of their distribution and total numbers.

## 7 CONCLUSIONS

We have applied kNN identification of brown dwarf types on the unresolved sources in the stellar locus of CEERS photometry with the aim of identifying this Galactic population.

Broad filters onboard JWST/NIRCam are sufficient to identify brown dwarfs photometrically to within 2 subtypes using k-nearest neighbour classification using the four nearest neighbours. We only use the four bluest filters for this (F115W, F150W, F200W, and F277W). The SPLAT library is optimal as a training set with sufficient size and coverage of type. Conceivably atmospheric models of M-L-T-Y-dwarfs may replace these as the training set.

The late-type brown dwarfs identified in CEERS are bluer in the NIRCam red filters than expected on the kNN classification based on NIR blue filters. This remains unexplained by standard stars or atmospheric models.

The scale height of the MW disc is consistent with the 350 pc for type M-types, similar to what van Vledder et al. (2016) found. The vertical distribution of later T-types is consistent with a scale height of 150–200 pc, in line with the value from Aganze et al. (2022b).

## ACKNOWLEDGEMENTS

The first author would like to thank the CEERS team for their hard work making the final exquisite data available for all to use and the

University of Louisville for the sabbatical that allowed the time to complete this project.

## DATA AVAILABILITY

CEERS is committed to data releases. This work is based on the data released in the first public data release. See the CEERS website for details: https://ceers.github.io/releases.html.

## REFERENCES

* Aberasturi M., Solano E., Martín E. L., 2011, A&A, 534, L7

* Aganze C. et al., 2022a, ApJ, 924, 114

* Aganze C. et al., 2022b, ApJ, 934, 73

* Akins H. B. et al., 2023, ApJ, 956, 61

* Allard F., Hauschildt P. H., Alexander D. R., Tamanai A., Schweitzer A., 2001, ApJ, 556, 357

* Allers K. N. et al., 2007, ApJ, 657, 511

* Arrabal Haro P. et al., 2023a, Nature, 622, 707

* Arrabal Haro P. et al., 2023b, ApJ, 951, L22

* Bagley M. B. et al., 2023, ApJ, 946, L12

* Bagley M. B. et al., 2024, ApJ, 961, 209

* Bailer-Jones C. A. L., 2008, MNRAS, 384, 1145

* Bardalez Gagliuffi D. C. et al., 2019, ApJ, 883, 205

* Beiler S. A., Cushing M. C., Kirkpatrick J. D., Schneider A. C., Mukherjee S., Marley M. S., 2023, ApJ, 951, L48

* Bertin E., Arnouts S., 1996, A&AS, 117, 393

* Bhavana D., Vig S., Ghosh S. K., Gorthi R. K. S. S., 2019, MNRAS, 488, 2263

* Biller B. A. et al., 2013, ApJ, 778, L10

* Bisigello L. et al., 2023, A&A, 676, A76

* Böker T. et al., 2023, PASP, 135, 038001

* Bovy J., Rix H.-W., Hogg D. W., Beers T. C., Lee Y. S., Zhang L., 2012, ApJ, 755, 115

* Brooks H. et al., 2023, AJ, 165, 232

* Burgasser A. J. et al., 2023, preprint (arXiv:2308.12107)

* Burgasser A. J., 2007, ApJ, 658, 617

* Burgasser A. J., Cruz K. L., Cushing M., Gelino C. R., Looper D. L., Faherty J. K., Kirkpatrick J. D., Reid I. N., 2010, ApJ, 710, 1142

* Burgasser A. J., Development Splat, 2017, in Coelho P., Martins L., Griffin E., eds, Astron. Soc. India Conf. Ser., The SpeX Prism Library Analysis Toolkit (SPLAT): a Data Curation Model. p. 7

* Burgasser A. J., Kirkpatrick J. D., McElwain M. W., Cutri R. M., Burgasser A. J., Skrutskie M. F., 2003a, AJ, 125, 850

* Burgasser A. J., Liu M. C., Ireland M. J., Cruz K. L., Dupuy T. J., 2008, ApJ, 681, 579

* Burgasser A. J., McElwain M. W., Kirkpatrick J. D., 2003c, AJ, 126, 2487

* Burgasser A. J., McElwain M. W., Kirkpatrick J. D., Cruz K. L., Tinney C. G., Reid I. N., 2004, AJ, 127, 2856

* Caballero J. A., Burgasser A. J., Klement R., 2008, A&A, 488, 181

* Calamida A. et al., 2022, AJ, 164, 32

* Cruz K. L., Burgasser A. J., Reid I. N., Liebert J., 2004, ApJ, 604, L61

* Cruz K. L., Núñez A., Burgasser A. J., Abrahams E., Rice E. L., Reid I. N., Looper D., 2018, AJ, 155, 34

* Deacon N. R., 2018, MNRAS, 481, 447

* Faherty J. K. et al., 2016, ApJS, 225, 10

* Filippazzo J. C., Rice E. L., Faherty J., Cruz K. L., Van Gordon M. M., Looper D. L., 2015, ApJ, 810, 158

* Finkelstein S. L. et al., 2015, ApJ, 810, 71

* Finkelstein S. L. et al., 2017, The Cosmic Evolution Early Release Science (CEERS) Survey. JWST Proposal ID 1345. Cycle 0 Early Release Science

* Finkelstein S. L. et al., 2022a, ApJ, 940, L55

* Finkelstein S. L. et al., 2022b, ApJ, 938, 25

* Finkelstein S. L. et al., 2023, ApJ, 946, L13

* Fujimoto S. et al., 2022, Nature, 604, 261

* Fujimoto S. et al., 2023, ApJ, 949, L25

* Gardner J. P. et al., 2023, PASP, 135, 068001
Gilmore G., 1984, MNRAS, 207, 223

Gilmore G., Reid N., 1983, MNRAS, 202, 1025

Goldman B. et al., 2008, A&A, 487, 277

Grogin N. A. et al., 2011, ApJS, 197, 35

Guo Y. et al., 2023, ApJ, 945, L10

Hainline K. N. et al., 2023, preprint (arXiv:2309.03250)

Herschel W. 1785, Philosophical Transactions of the Royal Society of London, 75, 213

Hewett P. C., Warren S. J., Leggett S. K., Hodgkin S. T., 2006, MNRAS, 367, 454

Holwerda B. W. et al., 2014a, ApJ, 781, 12

Holwerda B. W. et al., 2014b, ApJ, 788, 77

Holwerda B. W. et al., 2018, A&A, 620, A132

Holwerda B. W., 2005, preprint(astro-ph/0512139)

Hsu C.-C. et al., 2021, ApJS, 257, 45

Huertas-Company M. et al., 2023, preprint (arXiv:2305.02478)

Jakobsen P. et al., 2022, A&A, 661, A80

Jung I. et al., 2022, preprint (arXiv:2212.09850)

Jung I. et al., 2023, preprint (arXiv:2304.05385)

Kapteyn J. C., 1922, ApJ, 55, 302

Kartaltepe J. S. et al., 2023, ApJ, 946, L15

Kenworthy M. A., Mamajek E. E., Hinz P. M., Meyer M. R., Heinze A. N., Miller D. L., Sivanandam S., Freed M., 2009, ApJ, 697, 1928

Kiman R., Schmidt S. J., Angus R., Cruz K. L., Faherty J. K., Rice E., 2019, AJ, 157, 231

Kirkpatrick J. D. et al., 1999, ApJ, 519, 802

Kirkpatrick J. D. et al., 2021, ApJS, 253, 7

Kirkpatrick J. D. et al., 2023, preprint (arXiv:2312.03639)

Kirkpatrick J. D., Henry T. J., McCarthy Donald W. J., 1991, ApJS, 77, 417

Kocevski D. D. et al., 2023, ApJ, 946, L14

Koekemoer A. M. et al., 2011, ApJS, 197, 36

Kumbhakar R., Mondal S., Ghosh S., Ram D., 2023, ApJ, 955, 18

Langeroodi D., Hjorth J., 2023, ApJ, 957, L27

Lee E. K. H., Blecic J., Helling C., 2018, A&A, 614, A126

Leggett S. et al., 2019, BAAS, 51, 95

Leggett S. K. et al., 2021, ApJ, 918, 11

Long A. S. et al., 2023, preprint (arXiv:2305.04662)

Magnelli B. et al., 2023, A&A, 678, A83

Mainzer A. K., McLean I. S., Sievers J. L., Young E. T., 2004, ApJ, 604, 832

Marengo M., Sanchez M. C., 2009, AJ, 138, 63

McElwain M. W. et al., 2023, PASP, 135, 058001

Menzel M. et al., 2023, PASP, 135, 058002

Morley C. V., Fortney J. J., Marley M. S., Visscher C., Saumon D., Leggett S. K., 2012, ApJ, 756, 172

Nonino M. et al., 2023, ApJ, 942, L29

Papovich C. et al., 2023, ApJ, 949, L18

Pecaut M. J., Mamajek E. E., 2013, ApJS, 208, 9

Pérez-González P. G. et al., 2023, ApJ, 946, L16

Pirzkal N. et al., 2005, ApJ, 622, 319

Pirzkal N. et al., 2009, ApJ, 695, 1591

Reid I. N., Burgasser A. J., Cruz K. L., Kirkpatrick J. D., Gizis J. E., 2001, AJ, 121, 1710

Reid I. N., Cruz K. L., Kirkpatrick J. D., Allen P. R., Mungall F., Liebert J., Lowrance P., Sweet A., 2008, AJ, 136, 1290

Rieke M. J. et al., 2023, PASP, 135, 028001

Rigby J. et al., 2023a, PASP, 135, 048001

Rigby J. R. et al., 2023b, PASP, 135, 048002

Robinson T. D., Marley M. S., 2014, ApJ, 785, 158

Ryan R. E. et al., 2011, ApJ, 739, 83

Ryan R. E. et al., 2022, ApJ, 932, 96

Ryan R. E., Jr et al., 2017, ApJ, 847, 53

Ryan R. E., Jr, Hathi N. P., Cohen S. H., Windhorst R. A., 2005, ApJ, 631, L159

Sarro L. M. et al., 2023, A&A, 669, A139

Saumon D., Marley M. S., Abel M., Frommhold L., Freedman R. S., 2012, ApJ, 750, 74

Shen L. et al., 2023, ApJ, 950, 7

Siegel M. H., Majewski S. R., Reid I. N., Thompson I. B., 2002, ApJ, 578, 151

Sorahana S., Kobayashi H., Tanaka K. K., 2021, ApJ, 919, 117

Stanway E. R., Bremer M. N., Lehnert M. D., Eldridge J. J., 2008, MNRAS, 384, 348

Stevenson A. T., Haswell C. A., Barnes J. R., Barstow J. K., 2023, MNRAS, 526, 5155

Tang M. et al., 2023, MNRAS, 526, 1657

Testi L. et al., 2001, ApJ, 552, L147

van Vledder I., van der Vlugt D., Holwerda B. W., Kenworthy M. A., Bouwens R. J., Trenti M., 2016, MNRAS, 458, 425

Vega-Ferrero J. et al., 2024, ApJ, 961, 51

Wang P.-Y. et al., 2023, MNRAS, 523, 4534

Warren S. J., Ahmed S., Laithwaite R. C., 2021, Open J. Astrophys., 4, 4

Wilkins S. M., Stanway E. R., Bremer M. N., 2014, MNRAS, 439, 1038

Windhorst R. A. et al., 2023, AJ, 165, 13

Wright E. L. et al., 2010, AJ, 140, 1868

Wright G. S. et al., 2023, PASP, 135, 048003

Zavala J. A. et al., 2023, ApJ, 943, L9

## SUPPORTING INFORMATION

Supplementary data are available at MNRAS online.

### suppl.data

Please note: Oxford University Press is not responsible for the content or functionality of any supporting materials supplied by the authors. Any queries (other than missing material) should be directed to the corresponding author for the article.

<footnote n="1">¹Department of Physics and Astronomy, University of Louisville, Natural Science Building 102, 40292 KY Louisville, USA</footnote>

<footnote n="2">²Center for Interdisciplinary Exploration and Research in Astrophysics (CIERA), Northwestern University, 1800 Sherman, Evanston IL 60201, USA</footnote>

<footnote n="3">³Space Telescope Science Institute (STSCI), 3700 San Martin Dr., Baltimore 21218 MD, USA</footnote>

<footnote n="4">⁴Dipartimento di Fisica e Astronomia 'G.Galilei', Università di Padova, Via Marzolo 8, I-35131 Padova, Italy</footnote>

<footnote n="5">⁵INAF - Osservatorio Astronomico di Padova, Vicolo dell'Osservatorio 5, I-35122 Padova, Italy</footnote>

<footnote n="6">⁶Department of Physics and Astronomy, University of California, 900 University Ave, Riverside, CA 92521, USA</footnote>

<footnote n="7">⁷NSF's National Optical-Infrared Astronomy Research Laboratory, 950 N. Cherry Ave., Tucson, AZ 85719, USA</footnote>

<footnote n="8">⁸Department of Astronomy, The University of Texas at Austin, Austin TX 78712, USA</footnote>

<footnote n="9">⁹Laboratory for Multiwavelength Astrophysics, School of Physics and Astronomy, Rochester Institute of Technology, 84 Lomb Memorial Drive, Rochester, NY 14623, USA</footnote>

<footnote n="10">¹⁰Department of Physics and Astronomy, Texas A&M University, College Station TX 77843-4242, USA</footnote>

<footnote n="11">¹¹George P. and Cynthia Woods Mitchell Institute for Fundamental Physics and Astronomy, Texas A&M University, College Station TX 77843-4242 USA</footnote>

<footnote n="12">¹²Department of Physics & Astronomy, University of California, San Diego, CA 92093, USA</footnote>

<footnote n="13">¹³Centro de Astrobiología (CAB), CSIC-INTA, Ctra. de Ajalvir km 4, Torrejón de Ardoz, E-28850 Madrid, Spain</footnote>

<footnote n="14">¹⁴Department of Physics and Astronomy, University of Sussex, Brighton BN1 9QH, UK</footnote>

<footnote n="15">¹⁵Laboratoire d'Astrophysique de Marseille, Aix-Marseille Université, CNRS Technopole de Chateau-Gombert 38, rue Frederic Joliot-Curie, F-13013 Marseille, France</footnote>

<footnote n="16">¹⁶Department of Physics and Astronomy, University of Kansas, Lawrence, KS 66045, USA</footnote>