11institutetext: Leiden Observatory, Leiden University, Niels Bohrweg 2, 2333
CA, Leiden, The Netherlands
11email<EMAIL_ADDRESS>
11email<EMAIL_ADDRESS>22institutetext: National Astronomical
Observatory of Japan, Subaru Telescope, National Institute of Natural
Sciences, Hilo, HI 96720, USA 33institutetext: Steward Observatory, University
of Arizona, 933 N. Cherry Ave, Tucson, AZ 85721, USA 44institutetext: College
of Optical Sciences, University of Arizona, 1630 E. University Blvd., Tucson,
AZ 85721, USA 55institutetext: Astrobiology Center, National Institutes of
Natural Sciences, 2-21-1 Osawa, Mitaka, Tokyo, Japan 66institutetext:
Department of Astronomy, California Institute of Technology, 1200 E.
California Blvd., Pasadena, CA 91125, USA 77institutetext: Observatoire de la
Cote d’Azur, Boulevard de l’Observatoire, Nice, 06304, France 88institutetext:
NASA-Ames Research Center, Moffett Blvd., Moffett Field, CA 94035, USA

# First on-sky demonstration of spatial Linear Dark Field Control with the
vector-Apodizing Phase Plate at Subaru/SCExAO††thanks: Based on data collected
at Subaru Telescope, which is operated by the National Astronomical
Observatory of Japan.

S.P. Bos, S.P. Bos and K.L. Miller have contributed equally to this work.11
K.L. Miller††footnotemark:  11 J. Lozi 22 O. Guyon 22334455 D.S. Doelman 11 S.
Vievard 22 A. Sahoo 22 V. Deo 22 N. Jovanovic 66 F. Martinache 77 T. Currie
2288 F. Snik 11

(Received December 15, 2020; accepted May 27, 2021)

###### Abstract

Context. One of the key noise sources that currently limits high-contrast
imaging observations for exoplanet detection is quasi-static speckles. Quasi-
static speckles originate from slowly evolving non-common path aberrations
(NCPA). These NCPA are related to the different optics encountered in the
wavefront sensing path and the science path, and they also exhibit a chromatic
component due to the difference in the wavelength between the science camera
and the main wavefront sensor. These speckles degrade the contrast in the
high-contrast region (or dark hole) generated by the coronagraph and make the
calibration in post-processing more challenging.

Aims.  The purpose of this work is to present a proof-of-concept on-sky
demonstration of spatial Linear Dark Field Control (LDFC). The ultimate goal
of LDFC is to stabilize the point spread function (PSF) by addressing NCPA
using the science image as additional wavefront sensor.

Methods.  We combined spatial LDFC with the Asymmetric Pupil vector-Apodizing
Phase Plate (APvAPP) on the Subaru Coronagraphic Extreme Adaptive Optics
system at the Subaru Telescope. To allow for rapid prototyping and easy
interfacing with the instrument, LDFC was implemented in Python. This limited
the speed of the correction loop to approximately 20 Hz. With the APvAPP, we
derive a high-contrast reference image to be utilized by LDFC. LDFC is then
deployed on-sky to stabilize the science image and maintain the high-contrast
achieved in the reference image.

Results. In this paper, we report the results of the first successful proof-
of-principle LDFC on-sky tests. We present results from two types of cases:
(1) correction of instrumental errors and atmospheric residuals plus
artificially induced static aberrations introduced on the deformable mirror
and (2) correction of only atmospheric residuals and instrumental aberrations.
When introducing artificial static wavefront aberrations on the DM, we find
that LDFC can improve the raw contrast by a factor of $3$–$7$ over the dark
hole. In these tests, the residual wavefront error decreased by $\sim$50 nm
RMS, from $\sim$90 nm to $\sim 40$ nm RMS. In the case with only residual
atmospheric wavefront errors and instrumental aberrations, we show that LDFC
is able to suppress evolving aberrations that have timescales of $<0.1$–$0.4$
Hz. We find that the power at $10^{-2}$ Hz is reduced by a factor of $\sim$20,
7, and 4 for spatial frequency bins at 2.5, 5.5, and 8.5 $\lambda/D$,
respectively.

Conclusions.  We have identified multiplied challenges that have to be
overcome before LDFC can become an integral part of science observations. The
results presented in this work show that LDFC is a promising technique for
enabling the high-contrast imaging goals of the upcoming generation of
extremely large telescopes.

###### Key Words.:

Astronomical instrumentation: methods and techniques, Instrumentation:
adaptive optics, Instrumentation: high angular resolution

##  1 Introduction

The direct imaging of exoplanets is an exciting and rapidly developing
research field, however there are many technical challenges that still need to
be solved to optimize its potential. Current ground-based high-contrast
imaging (HCI) systems, such as Subaru/SCExAO (Jovanovic et al., 2015),
VLT/SPHERE (Beuzit et al., 2019), Gemini/GPI (Macintosh et al., 2014), and
Magellan Clay/MagAO-X (Males et al., 2018), are complex instruments that
deploy extreme adaptive optics (XAO) systems to correct wavefront aberrations
from the Earth’s atmosphere and advanced coronagraphs to suppress star light.
The goal of these systems is to reveal exoplanets at small angular separations
($<1"$) and high contrast ($<10^{-4}$). An XAO system consists of a primary
wavefront sensor (WFS), such as the Shack-Hartman (Platt & Shack, 2001) or
Pyramid (Ragazzoni, 1996) WFS, and a deformable mirror (DM) with high actuator
count for wavefront correction. The current state-of-the-art performance in
the near-infrared (NIR) is a post-processed contrast of $\sim 10^{-6}$ at 200
milliarcseconds by VLT/SPHERE (Vigan et al., 2015). The current HCI systems
are capable of imaging young jovian planets on outer solar system-like scales
around nearby stars (Marois et al., 2008; Macintosh et al., 2015; Chauvin et
al., 2017).

However, one of the limitations of these systems are aberrations that
originate from manufacturing limitations and misalignments in the optics
downstream of the main WFS and cannot therefore be sensed by this WFS. We
refer to these aberrations as non-common path aberrations (NCPA). During
observations, the temperature, humidity, and gravitational vector slowly
change, and with them the NCPA slowly evolve, resulting in quasi-static
speckles in the science image (Martinez et al., 2012, 2013; Milli et al.,
2016). These quasi-static speckles are a noise source (referred to as speckle
noise; Racine et al. 1999) that prevent HCI instruments from reaching their
full contrast at small angular separations as current observation strategies
and post-processing methods are not capable of fully removing them.
Furthermore, as the wavelength of the science observations is generally
different from the sensing wavelength of the main WFS, the residual wavefront
error can also have a chromatic component (Guyon et al., 2018a). The ideal
solution is to utilize the science image as a focal plane wavefront sensor
(FPWFS) to measure the NCPA. Many different FPWFSs have been developed, and an
overview is presented in Jovanovic et al. (2018).

In this work, we present the first on-sky proof-of-principle demonstration of
such a focal-plane wavefront sensing algorithm: spatial Linear Dark Field
Control (LDFC; Miller et al. 2017, 2019, 2021). There is also a spectral LDFC
variant (Guyon et al., 2017), which is not considered here, thus we only refer
to the spatial variant as LDFC. It is a point spread function (PSF)
stabilization technique that aims to lock the wavefront and maintain the
deepest possible contrast achieved within the dark hole (DH; the region in
which star light is suppressed by the coronagraph and XAO system) of a
reference image. One major advantage is that speckle noise, which is the
current limiting noise source in HCI, is suppressed, potentially leading to
tremendous gains in post-processed contrasts. Generally, LDFC monitors the
light outside of the DH in the area we refer to as the bright field (BF) and
uses intensity variations in the BF to derive corrections that remove the
wavefront aberrations that would otherwise pollute the DH. It has several
benefits over other techniques such as pair-wise probing (Give’on et al.,
2011) and speckle nulling (Bordé & Traub, 2006). Namely, it is: 1) more time
efficient, as it does not require multiple DM commands to derive the
appropriate correction, and 2) it only monitors the BF and does not need to
perturb the DH to derive a wavefront estimate (contrary to pair-wise probing
and speckle nulling). For example, Currie et al. (2020b) demonstrated in lab
experiments, under circumstances that are representative for space-based
observatories, the ability of LDFC to recover the initial contrast in 2-5
fewer iterations and 20-50 less DM commands compared to classical speckle
nulling.

Figure 1: Schematic of the vAPP coronagraph. A pupil-plane optic that
manipulates phase to generate two coronagraphic PSFs with opposite dark holes.
Due to manufacturing errors, an extra, on-axis, non-coronagraphic leakage PSF
is generated as well. Figure adapted from Bos et al. (2019).

We implemented LDFC with the vector-Apodizing Phase Plate coronagraph (vAPP;
Snik et al. 2012) installed on SCExAO (Doelman et al., 2017). The vAPP is a
pupil-plane coronagraph that manipulates phase to generate one-sided dark
holes in the PSF and retains the BF, as shown in Figure 1. It is implemented
as a liquid crystal half-wave retarder optic that has a varying fast-axis
orientation that introduces the apodizing phase by means of the achromatic
geometric phase (Pancharatnam 1956; Berry 1987). Due to the geometric phase,
the opposite circular polarization states receive the opposite phases (Kim et
al., 2015), and therefore the vAPP will generate two PSFs that have DHs on
opposite sides, which are separated by integrating polarization sensitive
gratings in the design (Otten et al., 2014). We note that the two
coronagraphic PSFs have opposite circular polarization, and that when the
degree of circular polarization is non-zero, these two PSFs do not have the
same brightness. Due to inevitable retardance errors in the half-wave retarder
design, a third, albeit small, non-coronagraphic, on-axis PSF is generated,
which is generally referred to as the leakage PSF. To enable FPWFS, we use the
Asymmetric Pupil vAPP (APvAPP) variant that integrates a pupil-plane amplitude
asymmetry in the design (Bos et al., 2019). The pupil-plane amplitude
asymmetry (Martinache, 2013) lifts the well-known sign ambiguity of even
pupil-plane phase aberrations (Gonsalves, 1982; Paxman et al., 1992) and,
therefore, allows LDFC to do in-focus measurements of both odd and even pupil-
plane phase aberrations.

The outline of this paper is as follows. In section 2, we present a short
introduction to LDFC and how it is implemented on SCExAO. In section 3, we
present and analyze the first proof-of-principle on-sky results. We discuss
the results and our conclusions in section 4. All the important variables used
in this article are summarized in Table 1.

##  2 LDFC at SCExAO

Table 1: Variables presented in section 2. Variable | Description
---|---
$E_{foc}$ | Focal-plane electric field.
$E_{0}$ | Nominal coronagraph focal-plane electric field.
$E_{ab}$ | Aberrated focal-plane electric field.
$I_{BF}$ | Bright field intensity.
$I_{DH}$ | Dark hole intensity.
$I_{0}$ | Nominal focal-plane intensity.
$\Delta I$ | LDFC intensity signal.
$G_{eigen}$ | Eigen mode control matrix.
$M_{had}$ | Hadamard mode basis.
$M_{eigen}$ | Eigenmode mode basis.
$R_{Had}$ | Hadammard focal plane response matrix.
$R_{eigen}$ | Eigen mode focal plane response matrix.
$S_{\gamma}$ | Tikhonov regularization matrix.
$\gamma$ | Regularization value.
$s_{i}$ | Singular value of mode $i$.

###  2.1 Principle

LDFC relies on the linear response of the focal-plane intensity to phase
aberrations in the pupil over a finite range of amplitudes to build a closed-
loop control system. Specifically, it focuses on maintaining contrast within
the entire DH, which requires LDFC to measure a response over the spatial
frequencies that cover the DH. Here, we show, in short, which regions in the
focal-plane have been selected by LDFC. A more extensive discussion is
presented in Miller et al. (2021). In the small aberration regime (phase $\ll
1$ radian), we can write the focal-plane intensity $I_{foc}$ as:

$I_{foc}=I_{0}+I_{ab}+2\Re\\{{E}_{0}{E}_{\text{ab}}^{*}\\},$ (1)

with $E_{0}$ and $I_{0}=|E_{0}|^{2}$ the nominal focal-plane electric field
and intensity respectively, $E_{ab}$ and $I_{ab}=|E_{ab}|^{2}$ the electric
field and intensity generated by the aberrations, and $\Re\\{E\\}$ the real
part of $E$. Note that $E_{0}$ and $E_{ab}$ are complex quantities. As in the
DH the nominal focal-plane electric field is strongly suppressed by the
coronagraph, we can assume that $E_{ab}\gg E_{0}$, and therefore the intensity
$I_{DH}$ is given by:

$I_{DH}=|E_{ab}|^{2}+2\Re\\{{E}_{0}{E}_{\text{ab}}^{*}\\},$ (2)

which has a quadratic response to aberrations and is therefore unsuitable to
be used by LDFC. In the BF, which is the region outside of the DH, we can
assume that $E_{0}\gg E_{ab}$, resulting in the intensity $I_{BF}$:

$I_{BF}=I_{0}+2\Re\\{{E}_{0}{E}_{\text{ab}}^{*}\\},$ (3)

which has a linear response to changes in $E_{ab}$. Subtracting an unaberrated
reference image $I_{0}$ from Equation 3 gives the signal that can be used to
build a closed-loop control system:

$\displaystyle\Delta I$ $\displaystyle=I_{BF}-I_{0}$ (4)
$\displaystyle=2\Re\\{{E}_{0}{E}_{\text{ab}}^{*}\\}.$ (5)

However, as discussed in Bos et al. (2019) and Miller et al. (2021), Equation
5 will only give a response to both odd and even wavefront aberrations when
$E_{0}$ has real and imaginary components. The APvAPP integrates a pupil-plane
amplitude asymmetry in its design (Bos et al., 2019), therefore it has a
$E_{0}$ with real and imaginary components, and it is one of the most suitable
coronagraphs to be used with LDFC.

###  2.2 SCExAO

We implemented LDFC on the Subaru Coronagraphic Extreme Adaptive Optics
(SCExAO; Jovanovic et al. 2015) system, a HCI instrument located on the
Nasmyth platform of the 8.2 meter Subaru telescope. It operates downstream of
the AO188 system (Minowa et al., 2010), which provides an initial, low-order
correction to the incoming wavefront. The main WFS of SCExAO is a visible
Pyramid wavefront with an operational wavelength range of 600-900 nm (Lozi et
al., 2019). SCExAO’s DM is a Boston Micromachines DM with 45 actuators across
the pupil, giving the instrument the ability to correct at separations up to
$22.5\lambda/D$ ($\sim 1"$ at 1.65 $\mu$m) in the focal plane. SCExAO can
reach residual root-mean-square (RMS) wavefront errors (as reported by the AO
telemetry) as good as $\sim$70 nm (Currie et al., 2018). The real-time control
is handled by the Compute and Control for Adaptive Optics (CACAO; Guyon et al.
2018b) package. It has 12 software channels to write DM commands to, which can
be used by additional WFSs (like LDFC) or to apply static wavefront
aberrations for testing purposes. CACAO automatically calculates reference
offsets at high speed ($\sim 2$ kHz) to prevent the Pyramid WFS from
correcting the additional DM commands.

In addition to enabling high-contrast science (e.g., Goebel et al. 2018;
Lawson et al. 2020; Currie et al. 2020a), SCExAO is serving as a technology
demonstration testbed and it has tested many different FPWFSs on-sky
(Martinache et al. 2014; Martinache et al. 2016; N’Diaye et al. 2018; Bos et
al. 2019; Vievard et al. 2019; Bos et al. 2020).

We use the vAPP coronagraph (Doelman et al. 2017; Miller et al. 2021) for the
tests presented in this work. It was designed to provide a raw contrast of
$10^{-5}$ between 2 and 11 $\lambda/D$ for J-, H-, and K-band. To prevent
spectral smearing by the polarization grating in the design, the vAPP can only
operate with narrowband filters or an integral-field spectrograph (IFS). For
FPWFS tests, we use the narrowband filter ($\lambda=1550$ nm;
$\Delta\lambda=25$ nm), and science observations use the IFS CHARIS (Groff et
al., 2014), which operates in J- to K-band. FPWFS with this vAPP is enabled by
two phase diversity holograms encoded in the design, as well as the pupil-
plane amplitude asymmetry that was added to block a dead actuator (Bos et al.,
2019).

The camera used for LDFC was the internal NIR camera (C-RED 2; Feautrier et
al. 2017) and was set to provide images with a size of 128$\times$128 pixels.
The pixel scale of the detector is 15.6 milliarcseconds per pixel and,
therefore, the PSF was sampled at $\sim$2.6 pixels per $\lambda/D$. The images
are aligned with a numerical reference PSF to eliminate tip and tilt errors.
LDFC is implemented in Python, which allows for rapid prototyping and easy
interfacing with the instrument, and uses the HCIPy package (Por et al.,
2018). The current implementation of LDFC runs at approximately 20 Hz, limited
by the speed of the algorithm used for co-aligning each image and the matrix-
vector multiplication in the wavefront control loop. This speed is still
sufficient for on-sky demonstration and stabilization of slowly evolving
aberrations. The control loop is implemented with a leaky integrator (Hardy,
1998).

Figure 2: Calibrating static wavefront errors in SCExAO during on-sky
observations: a) PSF after calibration; b) Derived DM command that corrects
low-order statics.

###  2.3 Static wavefront error calibration

Before starting our LDFC tests, we measured and corrected any static wavefront
errors that exist in the system. Reducing the static aberrations present in
the system is important for two reasons. Firstly, as the reference image is
derived on-sky, it is imperative that static aberrations be removed before the
reference is built. Secondly, the equations in subsection 2.1 only hold in the
linear regime (wavefront error ¡ 100 nm RMS for H-band). Without reducing
static aberrations, LDFC operation would be forced outside the linear regime,
thereby affecting the performance and stability of the wavefront control loop.

As LDFC does not provide absolute wavefront measurements, another algorithm is
required to measure the static aberrations in the system. We used a non-
linear, model-based wavefront sensing algorithm (Bos et al., 2019) that
measures and corrects the 30 lowest Zernike modes. The results of this
calibration, performed on-sky immediately before the results presented in
section 3, is shown in Figure 2. As shown by the leakage PSF in Figure 2a the
low order aberrations are aptly corrected, but there are still some higher
order wavefront aberrations that remain uncorrected, as seen by the speckle
structure in the DH hole of the upper coronagraphic PSF. The low-order
wavefront correction derived by the algorithm is shown in Figure 2b, and has a
42 nm root-mean-square (RMS) and 250 nm peak-to-valley (PtV) wavefront error
(WFE). The DM command has a notable structure, namely a relatively strong
increase in phase at the edge of the pupil. This structure has been observed
during other tests as well, and is thought to be a real structure that
originates from the upstream AO188 system (Bos et al., 2019).

###  2.4 Reference image and bright pixel selection

Figure 3: Reference images derived by various methods. All images are plotted
with the same colorbar, which is shown on the right. The orange box denotes
the reference that was used for the on-sky tests: a) Reference image
calculated by taking the mean of 40 short exposure images taken in quick
succession; b) Reference image measured by the calculating the mean of all
images used for deriving the on-sky RM; c) Reference image calculated by
taking the mean of 4000 short exposure images taken over $\sim 5$ min.

The $\Delta I$ measurement in Equation 4 that drives the LDFC loop is
calculated by subtracting a reference image $I_{0}$ from each aberrated
science image, resulting in an image containing only the term
$2\Re\\{{E}_{0}{E}_{\text{ab}}^{*}\\}$ (Equation 5). The goal of LDFC is to
drive this term to zero and, thus, by extension, the aberrated image back to
the reference image $I_{0}$. It is then clear that the deepest recoverable
contrast by LDFC is set by the contrast in the reference image. For tests on
the bench using only the internal source and aberrations artificially
introduced by the DM, it is trivial to acquire a good reference image after
removing the static aberrations, as only a few co-added short exposure images
are sufficient. For on-sky tests, it is not possible to use this reference
image. This is due to the non-zero degree of circular polarization of the
light emitted by the internal source, which can lead to a difference in
intensity between the two coronagraphic PSFs of up to $\sim$10-20%. This
difference in intensity between the PSFs does not exist during on-sky
observations due to the unpolarized nature of stellar light and, thus, a
reference image utilizing both coronagraphic PSFs derived with the internal
source will lead the LDFC loop to diverge if used on-sky. An obvious solution
would be to individually normalize the coronagraphic PSFs. However, as the
bright fields of the two coronagraphic PSFs partly overlap, it might not be as
trivial as it seems. During the design process of a vAPP there is a constraint
preventing the bright field of one coronagraphic PSF polluting the dark hole
of the other. However, there is not (yet) any constraint that prevents the two
bright fields of the two coronagraphic PSFs from overlapping. Adding this
constraint for future vAPP designs would not be an issue. To prevent possible
issues during normalization of the individual PSFs we did not pursue this
solution yet. Therefore, we decided that the reference image used for on-sky
implementation must also be measured during the observations. Other solutions
to this problem are discussed in section 4.

The derivation of this on-sky reference image is non-trivial. During the
internal source tests presented in Miller et al. (2021), it was sufficient to
average a few short exposure images taken in a short timespan. This method
will not work for on-sky operation because XAO residual wavefront aberrations
will be present and distort the PSF. Figure 3a shows a reference image that
consists of the mean of 40 short exposure images ($t_{int}\sim 1$ millisecond)
that were taken in quick succession within one or two seconds. If this
reference image were to be used by LDFC, it would drive the PSF back to this
state, which is an undesirable effect.

To properly average out the effects of XAO residuals in the reference image,
it should be calculated as the mean of hundreds to thousands images taken over
the time span of a few minutes. We want to keep this process and the process
of acquiring the response matrix (RM; detailed in subsection 2.5) as efficient
as possible to maximize the time available for science observations. The RM
maps the DM commands to WFS measurements and is required for the LDFC
wavefront control system. It is measured by poking many different DM modes and
recording their focal-plane response. It would be most efficient if the RM and
the reference image could be acquired simultaneously, especially because the
RM acquisition process takes a few minutes and that would be sufficient time
to average out XAO residuals. In Figure 3b, we show a reference image that is
the average of all of the images that were taken during the response matrix
acquisition process. As shown in this figure, this method leads to a strong
halo in the reference image because the individual images are distorted by DM
pokes. This halo strongly degrades the contrast, also making this method
unsuitable .

To mitigate a strong halo in the reference image due to DM pokes, we came up
with the following solution. During the RM acquisition process, there is for
every DM mode a positive and negative poke (subsection 2.5). Between these
opposite pokes, we add a short break (a few tens of milliseconds) when we do
not poke the DM for LDFC, and during this time we record an image of the PSF.
This will allow us to record thousands of images that are not (or minimally)
distorted by DM pokes, over a timespan of a few minutes without significantly
interrupting the RM acquisition process. Figure 3c shows a reference image
acquired in this way by averaging 4000 images taken over the span of $\sim 5$
min. The resulting reference image shows two well-defined DHs, with only a
faint halo visible. The brightness of this halo is directly related to the
level of XAO residuals, which means that (as we show in section 3) when the
XAO correction improves compared to when the reference image was measured, the
performance of LDFC will be affected. At the time of these tests, this was the
best method to generate a reference image and, therefore, this was the method
we used.

Figure 4: Bright pixel map used for on-sky tests. The white region shows the
pixels that are monitored by LDFC. The cores of the coronagraphic and leakage
PSFs are blocked as they are saturated. The DHs are blocked as these pixels do
not have a linear response to wavefront aberrations. Furthermore, we select
only pixels that lie within the control radius ($22.5\lambda/D$) and have a
normalized intensity of $\geq 10^{-3}$.

After measuring the reference image, we derive the bright pixel map that
selects the regions within the image that will be used by LDFC. Specifically,
it will select pixels that have: 1) a linear response, and 2) have a
sufficient signal-to-noise ratio (S/N). The first step is to select pixels
within the BF that have a linear response and lie within the control radius
($22.5\lambda/D$) of the DM. To boost the S/N at higher spatial frequencies,
the PSF cores are strongly saturated and are subsequently not selected.
Furthermore, we only select the pixels that are sufficiently bright, and for
this work have a normalized intensity of $\geq 10^{-3}$ with respect to the
peak flux of the unsaturated PSF core. This threshold was empirically
determined to work well for on-sky tests during various observation runs. The
resulting bright pixel map used for the results presented in section 3 is
shown in Figure 4.

###  2.5 Response and control matrix

Figure 5: Process of acquiring the response matrix for on-sky operation. It is
divided into a part that is done with the internal source before observations,
and a part that is done during observations. Figure 6: DM and WFS eigenmodes
derived from $R_{eigen}$, which was acquired on-sky. The colorbars of the DM
and WFS eigenmodes are the same for all subfigures. We note that for the WFS
eigenmodes, the bright pixel map of Figure 4 is applied.

The empirical relationship between changes in the focal plane intensity
$\Delta I$ and DM shape is measured and stored as the response matrix (RM).
The process of acquiring the RM for on-sky operation still relies on
measurements taken with the internal source to derive the modal basis set to
be used in closed-loop control on-sky (Miller et al., 2021). The full process
for deriving the LDFC RM is shown in Figure 5.

The first step in RM acquisition process is to derive the LDFC modal basis set
using the internal source and the DM, where we probe all the DM’s degrees of
freedom (DoF) at high S/N using the Hadamard mode basis ($M_{had}$; Kasper et
al. 2004) to measure the Hadamard RM. The main advantage of using the Hadamard
modes is that they have a high variance-to-peak ratio. This is important
because the $\Delta I$ response strength scales with variance, and LDFC’s
linearity limits the peak value that can be applied. Each mode in the basis is
poked with a 40 nm RMS amplitude ($a_{p}$). The Hadamard RM ($R_{had}$) is
measured as:

(6) (7) (8) (9) ,

with $I_{i}^{+}$ and $I_{i}^{-}$, the focal-plane intensities for the positive
and negative actuations of mode $i$, multiplied with the binary bright pixel
map (subsection 2.4). $\Delta I_{i}$ is the focal-plane response, and is
reshaped from a 2D image to a 1D vector, and subsequent measurements form the
columns of $R_{had}$. To improve the S/N of the focal-plane images $I_{i}^{+}$
and $I_{i}^{-}$, we average ten images. Measuring a high S/N Hadamard RM with
the internal source, probing every mode once, takes around 20-25 minutes with
the current implementation.

The modal basis set used by LDFC, which we refer to as eigenmodes
($M_{eigen}$), is then derived by taking the singular value decomposition
(SVD) of $R_{had}$ such that:

$\displaystyle R_{Had}$ $\displaystyle=U_{Had}S_{Had}V_{Had}^{*},$ (10)
$\displaystyle M_{eigen}$ $\displaystyle=M_{Had}V_{Had}^{*},$ (11)

with $U_{Had}$ the WFS eigenmodes, $S_{Had}$ a diagonal matrix with the
singular values of the eigenmodes, and $V_{Had}$ the DM eigenmodes. The
eigenmodes form an orthogonal basis set that is ordered from high to low
sensitivity, which also corresponds to a sorting from low to high spatial
frequency that follows the structure of the PSF. An example of the eigenmodes,
derived with the internal source and the resulting focal plane response on-
sky, is shown in Figure 6 and also clearly shows the ordering by spatial
frequency.

Building the on-sky RM is more challenging due to the added noise by the post-
XAO wavefront error residuals. To average out these effects, we probe every
mode twenty times in quick succession. To do this for all DoF in the DM would
put the total RM acquisition time well above one hour. This would be
unacceptably long as it would take away time for science observations and
increase the chance that different modes are measured under different post-XAO
residuals, adding more noise to the RM. Therefore, we decided to limit the
modes in our modal basis set to the first 200 modes in $M_{eigen}$. This
reduces the on-sky RM acquisition time to approximately 5 min. We chose the
first 200 modes because: 1) these are the most sensitive modes in the mode
basis, and 2) we found during tests with the internal source that this number
of modes gives a good balance between acquisition speed and coverage of the
dark hole. With this selected subset of eigenmodes, we then build the on-sky
RM ($R_{eigen}$) via the same process as in Equation 6 and subsection 2.5
using $M_{eigen}$. This RM is then used for the LDFC control loop. Before any
RM acquisition process, for either the Hadamard modes with the internal source
or for the eigenmodes on-sky, we calibrate the static wavefront aberration
with the method discussed in subsection 2.3.

Figure 7: Singular value decomposition curve for the on-sky measured RM
($R_{eigen}$) showing the modal suppression and attenuation thresholds
implemented by both Tikhonov regularization and modal gain.

For the wavefront control, we calculate the control matrix ($G_{eigen}$)
through a numerical pseudo-inversion of $R_{eigen}$. We invert the matrix by a
SVD with Tikhonov regularization, which suppresses noise from the more noisy
high-order modes. The SVD of $R_{eigen}$ is:

$R_{eigen}=U_{eigen}S_{eigen}V_{eigen}^{*},$ (12)

with $U_{eigen}$ the WFS eigenmodes, $S_{eigen}$ a diagonal matrix with the
singular values, and $V_{eigen}$ the DM eigenmodes. The pseudo-inverse is
therefore:

$R_{eigen}^{\dagger}=V_{eigen}S_{\gamma}U_{eigen}^{*},$ (13)

with $S_{\gamma}$ the Tikhonov regularization term. This term is written as:

$S_{\gamma}=diag\Bigg{\\{}\frac{s_{i}^{2}}{s_{i}^{2}+\gamma}\frac{1}{s_{i}}\Bigg{\\}},$
(14)

with $s_{i}$ the singular value of mode $i$, and $\gamma$ the regularization
value. By studying the singular value curve as plotted in Figure 7 (e.g., by
looking at the point where the singular values steeply drop), and observing
the stability of the LDFC control loop, we determine an appropriate value for
$\gamma$. For the results presented in section 3, we set $\gamma=0.1$.

As an additional measure to ensure loop stability, we also implemented a modal
gain. Higher order modes applied in the pupil plane correspond to higher
spatial frequencies in the focal plane, as shown in Figure 6, and therefore
have a lower S/N than the lower order modes. To counter this effect, we gave
full weighting to the first 80 modes, and the other 120 modes had a weighting
of 0.1. This is also plotted in Figure 7. We note that the modal gain is not
the final gain; the modal gain is also multiplied by a loop gain. More
appropriate weightings and a smoother modal gain function, instead of a step
function, would likely improve the loop stability even more. This is left for
future work.

##  3 On-sky demonstration

In the early morning of 17 September 2020, we tested LDFC on-sky during a
SCExAO engineering night. We observed the bright star Mirach ($m_{H}=-1.65$)
in medium to good atmospheric conditions (seeing was reported to be $\sim
0.5"-0.8"$). As the target is very bright in H band, the exposure time of the
NIR camera was set to 0.996 milliseconds. No other modules besides the NIR
camera were used. The purpose of these tests was to demonstrate LDFC’s
performance in two specific cases: (1) in the presence of a static aberration
consisting of random linear combinations of eigenmodes (Figure 6), and (2) in
the presence of only atmospheric residual wavefront errors and naturally
evolving NCPA. We present here the results of four different tests: two tests
with different static aberrations induced on the DM (test A and B) and two
tests with only on-sky atmospheric residuals to investigate the DH
stabilization capabilities of the current implementation of LDFC (test C and
D).

Figure 8: Mean PSF of open and closed-loop LDFC datasets with a static
aberration introduced on the DM, and quantification of the raw contrast and
residual wavefront error improvements: a) Open-loop PSF; b) Closed-loop PSF;
c) Aberration introduced by the DM; d) $1\sigma$ raw contrasts as a function
of spatial frequency in the DH of the reference PSF, and the mean of the open
and closed-loop LDFC dataset; e) Gain in raw contrast over the spatial
frequencies in the DH; f) Residual wavefront error, calculated by adding the
introduced aberration to the derived LDFC correction.  Figure 9: Mean PSF of
open and closed-loop LDFC datasets with a static aberration introduced on the
DM, and quantification of the raw contrast and residual wavefront error
improvements. We note that a different aberration has been injected by the DM
compared to Figure 8: a) Open-loop PSFl b) Closed-loop PSFl c) Aberration
introduced by the DM; d) $1\sigma$ raw contrasts as a function of spatial
frequency in the DH of the reference PSF, and the mean of the open and closed-
loop LDFC dataset; e) Gain in raw contrast over the spatial frequencies in the
DH; f) Residual wavefront error, calculated by adding the introduced
aberration to the derived LDFC correction.

###  3.1 Static eigenmode aberration

First, we demonstrate the ability of LDFC to correct for a static aberrations
that are introduced on the DM. The introduced aberrations are much stronger
than what generally occurs in HCI instruments and, therefore, these tests
should be considered to be a proof-of-concept for LDFC. They consist of a
random linear combination of the eigenmodes following a flat power spectrum,
and have a RMS WFE of $\sim$90 nm. This RMS WFE is close to the non-linear
regime for LDFC, which starts at $\sim 100$ nm RMS, and, therefore, we ran
LDFC during these tests with a relatively low gain of 0.01. We chose for test
A a duration of 2000 iterations ($\sim$110 sec) for both the open- and closed-
loop datasets. For tests B we increased the number of iterations to 3000
($\sim$160 sec) to investigate whether or not LDFC would converge towards a
lower residual wavefront error compared to test A. There was an interval of
approximately 15 min between the start of test A and B.

Here we present the results of two tests (test A and test B). Each test
consists of a LDFC closed-loop dataset and an open-loop dataset, which were
taken right after each other. Figure 8 and Figure 9 plot the mean open- and
closed-loop PSF during the tests, and the introduced aberration. In both
cases, LDFC dramatically improves the quality of the PSF, but does not
completely bring it back to the reference state, which is shown in Figure 3c.
LDFC is correcting low-order aberrations, as is clearly seen by comparing the
leakage PSF for open- and closed-loop results. Control of the mid- and high-
order spatial frequencies is shown by the removal of speckles throughout the
DH.

Figure 8d and Figure 9d plot the raw contrast of the reference PSF, the mean
open-loop PSF and the mean closed-loop PSF, and shows that LDFC is able to
greatly increase the raw contrast. We define the raw contrast as the spatial
variations in intensity in the DH by determining at a given distance from the
star the standard deviation of the intensity inside 1 $\lambda/D$ wide annuli
covering the DHs of both coronagraphic PSFs. We note that the contrast metric
adopted here provides optimistic contrast estimates at small distances from
the star as the small sample statistics are not properly taken into account
(Mawet et al., 2014; Jensen-Clem et al., 2017). The contrast gain is estimated
between a factor of 3 and 7 and is plotted per spatial frequency in Figure 8e
and Figure 9e. In particular, Figure 9d shows that LDFC is able to almost
return the PSF to its initial raw contrast.

Figure 8f and Figure 9f show the residual wavefront error, which was
calculated by summing the DM channel with the introduced aberration and the DM
channel with the derived correction. These graphs show that LDFC is clearly
correcting the aberration and is able to reduce the RMS WFE from $\sim$90 nm
RMS to $\sim$40 nm RMS, which seems to be approximately the convergence point
of both tests. It is likely that the reason for the convergence point is the
noise caused by fast changing XAO residuals. In short exposure images, as were
used in these tests, the XAO residuals do not average out and change too
quickly for LDFC to correct, which makes it hard for LDFC to measure the
artificially injected static WFE by the DM. In future on-sky tests this
interpretation can be tested by performing similar tests under different
levels of XAO correction to see if the convergence point changes as well. The
slight difference in convergence speed can be explained by changes in the XAO
correction in the 15 min between the two tests.

###  3.2 On-sky atmospheric residuals

Figure 10: Raw contrast in the DH for the reference PSF, and the mean PSF of
the open- and closed-loop LDFC data for the two sets of tests. No static
aberration was introduced on the DM.  Figure 11: Power spectral density (PSD)
of the PSF stability during the open- and closed-loop LDFC tests in three
different spatial frequency bins in the DH. Subfigure a) shows the results for
tests C and b) for tests D.

The stability of the PSF during observations is important for the post-
processed contrast. An ultra-stable, temporally well correlated PSF enables
more accurate removal using post-processing (e.g., Soummer et al. 2011). Here,
we show the ability of the current LDFC implementation to stabilize the PSF
with atmospheric turbulence and evolving NCPA (so no artificially induced
wavefront error). We present two tests (test C and D); each test consists of
an open- and closed-loop LDFC dataset that were each conducted successively in
the same atmospheric conditions. Test C was done ten minutes after measuring
the reference image, and the open- and closed-loop dataset each have a
duration of $110$ seconds. Test D was done approximately twenty minutes later
(thirty minutes after acquiring the reference image) with the open- and
closed-loop dataset each spanning a duration of $\sim$210 seconds. This allows
us to evaluate the effect of a closed LDFC loop on the PSF stability. The gain
for these tests was set to 0.1.

First, we compare the average PSF computed over the entire open- and closed-
loop datasets to the reference PSF. In Figure 10, the $1\sigma$ raw contrast
in the DH is plotted for the reference PSF, and the mean of the LDFC open- and
closed-loop data. The results for test C are shown in Figure 10a. It shows
that the open-loop data is slightly worse than the reference PSF and that when
the LDFC loop is closed the raw contrast slightly improves compared to the
open-loop data. In Figure 10b we show the results of test D. During these
tests (twenty minutes later), the XAO correction improved compared to test C,
making the mean of the open-loop data slightly better than the reference PSF.
When the LDFC loop closed, the raw contrast slightly degraded, because LDFC
tried to drive the image back to the reference image which was more aberrated
than the open-loop images.

Table 2: Average and $1\sigma$ standard deviation of the normalized mean intensity time series during the tests with on-sky atmospheric residuals.  | Test C |  | Test D |
---|---|---|---|---
Spatial frequency bin | Open loop | Closed loop | Open loop | Closed loop
$2.5$ $\lambda/D$ | $4.64\cdot 10^{-3}\pm 6.7\cdot 10^{-4}$ | $4.31\cdot 10^{-3}\pm 3.0\cdot 10^{-4}$ | $2.95\cdot 10^{-3}\pm 3.6\cdot 10^{-4}$ | $4.00\cdot 10^{-3}\pm 2.4\cdot 10^{-4}$
$5.5$ $\lambda/D$ | $1.75\cdot 10^{-3}\pm 2.0\cdot 10^{-4}$ | $1.64\cdot 10^{-3}\pm 1.3\cdot 10^{-4}$ | $1.03\cdot 10^{-3}\pm 1.1\cdot 10^{-4}$ | $1.38\cdot 10^{-3}\pm 9\cdot 10^{-5}$
$8.5$ $\lambda/D$ | $1.18\cdot 10^{-3}\pm 1.3\cdot 10^{-4}$ | $1.11\cdot 10^{-3}\pm 9\cdot 10^{-5}$ | $7.2\cdot 10^{-4}\pm 7\cdot 10^{-5}$ | $9.4\cdot 10^{-4}\pm 6\cdot 10^{-5}$

As LDFC is meant to be a stabilization technique, it is also interesting to
analyze the temporal stability of the DH. To this end, we calculated the
normalized mean intensity of three different spatial frequency bins
($2.5,5.5,8.5$ $\lambda/D$) in the DH throughout these tests. It is calculated
for every individual iteration and the resulting values are subsequently
averaged over 50 iterations to reduce the effect of high temporal frequency
variations. Table 2 shows the average and $1\sigma$ standard deviation of
these time series (specifically, using the 50 iteration averages). In test C,
the table shows that both the average and the $1\sigma$ standard deviation
improved when the LDFC loop closed. This means that not only the intensity in
DH improved, but also the temporal stability (i.e., less variability). The
values presented in Table 2 for test D were calculated using only the values
in the second half of the open- and closed-loop datasets. This is because when
the LDFC loop closed it took roughly half the dataset to converge to a stable
correction (determined by analyzing the LDFC DM telemetry). The table shows
that for test D, the mean of the time series degraded when the LDFC loop
closed, but that the $1\sigma$ deviation improved. This means that the
intensity in the DH degraded, because LDFC tried to drive the image back to
the reference image (which has a higher intensity in the DH), but that the
stability improved. These tests show that LDFC is able to stabilize the mean
intensity in the DH and that a good reference image is very important to also
improve the intensity in the DH.

However, it is most relevant to analyze the PSF variations during these tests.
This is because these variations are hard to calibrate in post-processing, and
therefore will determine the eventual post-processed raw contrast. To this
end, we plot the Power Spectral Density (PSD) in the same spatial frequency
bins as above for the open- and closed-loop LDFC data in Figure 11. These
curves were calculated as follows: the mean PSF was subtracted from all images
in the data set; then, for every pixel, the PSD was calculated using the Welch
method (Welch, 1967). These PSDs where subsequently averaged per spatial
frequency bin to reduce the effects of noise. For tests C (Figure 11a) the
results are quite clear: LDFC successfully removes power in the lower temporal
frequencies (¡ 0.2 Hz for $5.5$ and $8.5$ $\lambda/D$, and ¡ 0.4 Hz for 2.5
$\lambda/D$). Specifically, the power at $\sim 10^{-2}$ Hz decreased by a
factor of $\sim$20, 7, and 4 at 2.5, 5.5, and 8.5 $\lambda/D$, respectively.
This decrease in performance for higher spatial frequencies can be explained
by the lower S/N at these positions in the focal plane. Again, for test D we
only include the second half of the dataset because in the first half LDFC is
still converging. The results for test D (Figure 11b) are less straightforward
than what we found for test C. The low temporal frequencies were not as
dominant, so only in the 2.5 $\lambda/D$ bin do we observe that LDFC reduces
the power at frequencies ¡0.05 Hz. Also, for the 2.5 $\lambda/D$ bin there are
peaks at 0.1, 0.2, and 0.3 Hz, which are suppressed by LDFC. For all spatial
frequency bins there is more power in high temporal frequencies (¿0.5 Hz) for
the closed-loop data compared to the open-loop data. The current hypothesis to
explain this is that LDFC added intensity to the DH to match the reference
image. This leads to an increase in speckle noise because the atmospheric
speckles end up interfering with a higher-intensity structure in the DH.

We did not experience any events where the XAO correction degraded in
comparison to test C. In such a case, we expect that there would be a slight
improvement in contrast for the closed-loop data compared to the open-loop
data because the LDFC loop would suppress slowly evolving variations. A result
similar to the results presented in test C. However, in the current
implementation of LDFC the loop speed is limited to 20 Hz and therefore not
capable of lowering the high temporal frequency XAO residuals. That would mean
that the contrast in the closed-loop data would still be (much) worse compared
to the reference image.

##  4 Discussion and conclusions

The work presented in this paper concludes the first successful proof-of-
concept on-sky demonstration of spatial LDFC with the APvAPP at Subaru/SCExAO.
The results demonstrate that LDFC is a promising technique for correcting
NCPA, stabilizing the PSF, and maintaining raw contrast during HCI
observations, which will dramatically improve the post-processed contrast. In
this paper, we present a new, faster process to efficiently acquire a high-S/N
RM for on-sky operation in which we build our eigenmodes first with the
internal source. Integrated into this process is the simultaneous measurement
of a long-exposure reference image. The current LDFC implementation at SCExAO
uses the narrowband filter at 1550 nm ($\Delta\lambda=25$ nm) and is coded in
Python, running at $\sim$20 Hz in a closed loop.

We have demonstrated that LDFC can partially correct static aberrations
introduced with the DM while on-sky. We have shown, for the examples presented
here, that the raw contrast increases by a factor of $3$ – $7$ over the dark
hole (DH), and that the RMS WFE decreases by $\sim$50 nm from 90 nm to 40 nm.
The reason that LDFC converged to a WFE of 40 nm RMS is likely the noise
caused by fast changing XAO residuals. In short-exposure images, as those used
in these tests, the XAO residuals do not average out and change too quickly
for LDFC to correct. This makes it hard for the current implementation of LDFC
to measure and correct the artificially injected aberrations. Singh et al.
(2019) studied this effect in simulation and their results qualitatively match
with what we find here.

Furthermore, we tested LDFC with just residual atmospheric aberrations and
naturally evolving NCPA. We have shown that the current LDFC implementation is
able to stabilize the mean intensity in the DH. We also showed, when analyzing
the PSF stability, that LDFC suppresses evolving aberrations that have
timescales of $<0.1$–$0.4$ Hz, which is expected when considering the 20 Hz
loop speed. In the situation that XAO residuals were comparable to when the
reference image was measured, closing the LDFC loop reduced the power at
$10^{-2}$ Hz by a factor of $\sim$20, 7, and 4 for spatial frequency bins at
2.5, 5.5, and 8.5 $\lambda/D$, respectively. When the XAO correction improved
in comparison to the reference image measurement, we found smaller power
improvements for temporal frequencies $<0.4$ Hz. In this case, the LDFC loop
degraded the contrast in the DH, because it tried to drive the image back
towards the reference image. This led to an increase in power for temporal
frequencies $>0.4$ Hz. Due to the limited durations of these tests ($\sim 100$
– $200$ seconds) we could not conclusively determine if we succeeded in the
stabilization of quasi-static speckles caused by NCPA as our measurements are
dominated by XAO residuals. Therefore, open- and closed-loop tests of longer
duration (tens of minutes) are required to fully understand to what extent
LDFC can stabilize NCPA.

We refined our methods during multiple SCExAO engineering nights, with the
latest results presented in this work, and we have identified the following
challenges that have to be overcome before LDFC can be offered as observing
mode for SCExAO. The tests that corrected static, injected wavefront
aberrations were limited by the effect of XAO residuals on short exposure
images. We conclude that there are two solutions to overcome this problem:

(1) Instead of using single, short exposure images in the LDFC control loop,
it is better to use the average of hundreds to thousands of images measured
over timescales of tens of seconds to minutes to average out the XAO
residuals. This would significantly lower the control loop speed, but to a
level that should still be sufficient to control quasi-static aberrations. The
current implementation of LDFC can be used to test this solution.

(2) Improve the loop speed to several hundred to a thousand Hz to allow LDFC
to directly control the XAO residuals. This would enable LDFC to
simultaneously address chromatic residual wavefront errors from the XAO
system. The current limiting factors in loop speed are the matrix-vector
multiplication of $G_{eigen}$ and $\Delta I$, and the image alignment. The
matrix-vector multiplication is currently processed on the CPU, and we plan to
move this to the GPU. For the image alignment, we currently compare the entire
image (128$\times$128 pixels) to a centered, reference image to determine the
offset. It is actually not required to use all information in the image to
determine this, and moving forward we plan to select only the leakage PSF in a
32$\times$32 pixel window. Together, we hope that these upgrades allow for a
loop speed of $\sim$200 Hz. Further improvements of the loop speed would
require more optimization of the code and full integration into the real-time
control software CACAO (Guyon et al., 2020).

As discussed in subsection 2.4, a good reference image is of utmost
importance. It sets the contrast levels to which LDFC will converge, and
determines the stability of the loop. Ideally, it would be best to match the
reference image to the images used in the LDFC control loop, which depends on
the speed of the LDFC control loop as discussed above. In the case of a fast (
$>0.1$ – $1$ kHz) LDFC loop using short exposure images, the best solution is
an internal source reference image as that will not contain the XAO halo and
thus provide the best possible contrast. As discussed in subsection 2.4, this
is currently problematic as there is an intensity imbalance between the two
coronagraphic PSFs of the vAPP due to a non-zero degree of circular
polarization with internal source measurements. This can be resolved by either
using an unpolarized light source, a new vAPP design that is not sensitive to
the degree of circular polarization (Bos et al., 2020), or more sophisticated
PSF normalization methods that correct for this. Another solution is to run
LDFC on a single coronagraphic PSF. The major disadvantage of this solution is
that it increases the null space of the algorithm by allowing for a subset of
aberrations (cross-talk between amplitude and phase aberrations) that pollute
the dark hole and are not measurable in the BF of a single PSF (Sun, 2019).
Whether this increased null space will have a significant impact on on-sky
operations will have to be further explored. A slow ($<$1 Hz) LDFC loop that
uses long exposure images is best combined with a long exposure reference
image as both contain a XAO halo. In this work we have found, when atmospheric
conditions change and the reference PSF becomes worse than the LDFC open-loop
PSF, that LDFC degrades the DH to match the reference PSF, and in the worst
cases leads to loop divergence. This means that we need a reference PSF that
is always better than the open-loop LDFC PSF. A promising solution for re-
measuring the reference PSF is the Direct Reinforcement Wavefront Heuristic
Optimization algorithm (DR WHO; Vievard et al. 2020). DR WHO continuously
monitors the PSF quality, and selects from continuous image streams the most
suitable reference image update by evaluating a performance metric of choice.
In the case of LDFC this performance metric could be the contrast in the DH.
In this work, we show that when practical reasons prevent the use of either of
the above-described ideal solutions, a mix of both solutions can also work. We
combined a long exposure reference image with short exposure images in a
relatively slow control loop. As discussed above, this reference image will
also have to be continuously updated when the XAO residuals change. The extend
to which such a combined solution degrades the best possible performance of
LDFC will have to be investigated in future work.

Besides a mitigation of the major challenges posed by the XAO residuals noise
and reference images, there are also other, more minor upgrades that we have
identified for the current LDFC implementation. During SCExAO engineering
nights we regularly encounter “low-wind effect” events (Sauvage et al. 2015;
Milli et al. 2018), that heavily distort the PSF. In its current form, LDFC is
not able to fully sense and correct these effects as they appear as piston,
tip, and tilt aberrations across the four quadrants of the telescope pupil
separated by the spiders. These modes are not currently included in our
eigenmode basis set. In order to operate during such events we will test two
solutions: (a) include the appropriate modes (piston, tip, and tilt modes for
the segments in the telescope pupil) in the mode basis that LDFC controls, and
(b) run the Fast and Furious (Bos et al., 2020) focal-plane wavefront sensing
algorithm on the leakage PSF simultaneously with LDFC.

Results presented in this work were obtained with the C-RED 2 camera
(Feautrier et al., 2017). Recently, SCExAO acquired a C-RED One as an
additional NIR camera, which is particularly exciting for FPWFS as it offers
strongly reduced read-out noise ($<1$ e- versus $<30$ e-) and dark current (80
e-/pixel/sec versus 600 e-/pixel/sec) compared to the C-RED 2. SCExAO also
feeds the z- to J-bands (800 - 1400 nm) to the MKID Exoplanet Camera (MEC;
Walter et al. 2020), which utilizes the Microwave Kinetic Inductance Detector
(MKID) technology for high-contrast imaging. This camera provides read noise
free, and fast time domain images at a spectral resolution of 5-7. Future LDFC
tests will therefore either use the C-RED One or MEC.

As soon as we have addressed the above mentioned challenges and upgrades, we
intend to offer LDFC as an observing mode for SCExAO. We foresee two possible
observing modes: (a) the C-RED One as the science camera and FPWFS, which
limits the observations to narrow bandwidths to prevent spectral smearing by
the polarization grating integrated in the vAPP design. This solution would
completely eliminate the non-common path and thus, in theory, it should be
able to provide the best wavefront correction; (b) C-RED One as the FPWFS and
the IFS CHARIS (Groff et al., 2014) as the science camera. Both cameras would
share the light, with the C-RED One providing wavefront sensing and control
with LDFC, while CHARIS would do simultaneous science observations in J-, H-,
and K-band. This solution would strongly reduce the non-common path, but not
completely eliminate it. The improvement in contrast in this mode would depend
on the number and specifications of the optical elements in both paths. We did
not consider using CHARIS for focal-plane wavefront sensing, because of the
long readout times of its HAWAII-2RG detector.

In this paper, we show via proof-of-concept on-sky tests that spatial LDFC
combined with an APvAPP is a promising focal-plane wavefront sensor for high-
contrast imaging instruments to directly image exoplanets. We have identified
and provided solutions to multiple challenges that have to be overcome before
LDFC can effectively detect NCPA, suppress quasi-static speckles, and
stabilize the PSF. We are currently working towards offering LDFC as an
observing mode on SCExAO which would enable FPWFS to be used regularly during
observations and result in gains in the post-processed contrast.

###### Acknowledgements.

The authors thank the referee for comments on the manuscript that improved
this work. The research of S.P. Bos and F. Snik leading to these results has
received funding from the European Research Council under ERC Starting Grant
agreement 678194 (FALCONER). The development of SCExAO was supported by the
Japan Society for the Promotion of Science (Grant-in-Aid for Research
#23340051, #26220704, #23103002, #19H00703 & #19H00695), the Astrobiology
Center of the National Institutes of Natural Sciences, Japan, the Mt Cuba
Foundation and the director’s contingency fund at Subaru Telescope. LDFC
development at SCExAO was supported by the NASA Strategic Astrophysics
Technology (SAT) Program grant #80NSSC19K0121. The authors wish to recognize
and acknowledge the very significant cultural role and reverence that the
summit of Maunakea has always had within the indigenous Hawaiian community. We
are very fortunate to have the opportunity to conduct observations from this
mountain. This research made use of HCIPy, an open-source object-oriented
framework written in Python for performing end-to-end simulations of high-
contrast imaging instruments (Por et al., 2018). This research used the
following Python libraries: Scipy (Jones et al., 2014), Numpy (Walt et al.,
2011), and Matplotlib (Hunter, 2007).

## References

  * Berry (1987) Berry, M. V. 1987, Journal of Modern Optics, 34, 1401
  * Beuzit et al. (2019) Beuzit, J.-L., Vigan, A., Mouillet, D., et al. 2019, arXiv preprint arXiv:1902.04080
  * Bordé & Traub (2006) Bordé, P. J. & Traub, W. A. 2006, The Astrophysical Journal, 638, 488
  * Bos et al. (2019) Bos, S. P., Doelman, D. S., Lozi, J., et al. 2019, Astronomy & Astrophysics, 632, A48
  * Bos et al. (2020) Bos, S. P., Doelman, D. S., Miller, K. L., & Snik, F. 2020, in Adaptive Optics Systems VII, Vol. 11448, International Society for Optics and Photonics, 114483W
  * Bos et al. (2020) Bos, S. P., Vievard, S., Wilby, M. J., et al. 2020, A&A, 639, A52
  * Chauvin et al. (2017) Chauvin, G., Desidera, S., Lagrange, A.-M., et al. 2017, Astronomy & Astrophysics, 605, L9
  * Currie et al. (2020a) Currie, T., Brandt, T. D., Kuzuhara, M., et al. 2020a, The Astrophysical Journal Letters, 904, L25
  * Currie et al. (2018) Currie, T., Brandt, T. D., Uyama, T., et al. 2018, The Astronomical Journal, 156, 291
  * Currie et al. (2020b) Currie, T., Pluzhnik, E., Guyon, O., et al. 2020b, Publications of the Astronomical Society of the Pacific, 132, 104502
  * Doelman et al. (2017) Doelman, D. S., Snik, F., Warriner, N. Z., & Escuti, M. J. 2017, in Techniques and Instrumentation for Detection of Exoplanets VIII, Vol. 10400, International Society for Optics and Photonics, 104000U
  * Feautrier et al. (2017) Feautrier, P., Gach, J.-L., Greffe, T., et al. 2017, in Image Sensing Technologies: Materials, Devices, Systems, and Applications IV, Vol. 10209, International Society for Optics and Photonics, 102090G
  * Give’on et al. (2011) Give’on, A., Kern, B. D., & Shaklan, S. 2011, in Techniques and Instrumentation for Detection of Exoplanets V, Vol. 8151, International Society for Optics and Photonics, 815110
  * Goebel et al. (2018) Goebel, S., Currie, T., Guyon, O., et al. 2018, The Astronomical Journal, 156, 279
  * Gonsalves (1982) Gonsalves, R. A. 1982, Optical Engineering, 21, 215829
  * Groff et al. (2014) Groff, T. D., Kasdin, N. J., Limbach, M. A., et al. 2014, in Ground-based and Airborne Instrumentation for Astronomy V, Vol. 9147, International Society for Optics and Photonics, 91471W
  * Guyon et al. (2018a) Guyon, O., Mazin, B., Fitzgerald, M., et al. 2018a, in Adaptive Optics Systems VI, Vol. 10703, International Society for Optics and Photonics, 107030Z
  * Guyon et al. (2017) Guyon, O., Miller, K., Males, J., Belikov, R., & Kern, B. 2017, arXiv preprint arXiv:1706.07377
  * Guyon et al. (2020) Guyon, O., Sevin, A., Ferreira, F., et al. 2020, in Adaptive Optics Systems VII, Vol. 11448, International Society for Optics and Photonics, 114482N
  * Guyon et al. (2018b) Guyon, O., Sevin, A., Ltaief, H., et al. 2018b, in Adaptive Optics Systems VI, Vol. 10703, International Society for Optics and Photonics, 107031E
  * Hardy (1998) Hardy, J. W. 1998, Adaptive optics for astronomical telescopes, Vol. 16 (Oxford University Press on Demand)
  * Hunter (2007) Hunter, J. D. 2007, Computing In Science & Engineering, 9, 90
  * Jensen-Clem et al. (2017) Jensen-Clem, R., Mawet, D., Gonzalez, C. A. G., et al. 2017, The Astronomical Journal, 155, 19
  * Jones et al. (2014) Jones, E., Oliphant, T., & Peterson, P. 2014
  * Jovanovic et al. (2018) Jovanovic, N., Absil, O., Baudoz, P., et al. 2018, in Proc. SPIE, Vol. 10703, Adaptive Optics Systems VI
  * Jovanovic et al. (2015) Jovanovic, N., Martinache, F., Guyon, O., et al. 2015, Publications of the Astronomical Society of the Pacific, 127, 890
  * Kasper et al. (2004) Kasper, M., Fedrigo, E., Looze, D. P., et al. 2004, JOSA A, 21, 1004
  * Kim et al. (2015) Kim, J., Li, Y., Miskiewicz, M. N., et al. 2015, Optica, 2, 958
  * Lawson et al. (2020) Lawson, K., Currie, T., Wisniewski, J. P., et al. 2020, The Astronomical Journal, 160, 163
  * Lozi et al. (2019) Lozi, J., Jovanovic, N., Guyon, O., et al. 2019, Publications of the Astronomical Society of the Pacific, 131, 044503
  * Macintosh et al. (2015) Macintosh, B., Graham, J., Barman, T., et al. 2015, Science, 350, 64
  * Macintosh et al. (2014) Macintosh, B., Graham, J. R., Ingraham, P., et al. 2014, Proceedings of the National Academy of Sciences, 111, 12661
  * Males et al. (2018) Males, J. R., Close, L. M., Miller, K., et al. 2018, in Adaptive Optics Systems VI, Vol. 10703, International Society for Optics and Photonics, 1070309
  * Marois et al. (2008) Marois, C., Macintosh, B., Barman, T., et al. 2008, science, 322, 1348
  * Martinache (2013) Martinache, F. 2013, Publications of the Astronomical Society of the Pacific, 125, 422
  * Martinache et al. (2014) Martinache, F., Guyon, O., Jovanovic, N., et al. 2014, Publications of the Astronomical Society of the Pacific, 126, 565
  * Martinache et al. (2016) Martinache, F., Jovanovic, N., & Guyon, O. 2016, Astronomy & Astrophysics, 593, A33
  * Martinez et al. (2013) Martinez, P., Kasper, M., Costille, A., et al. 2013, Astronomy & Astrophysics, 554, A41
  * Martinez et al. (2012) Martinez, P., Loose, C., Carpentier, E. A., & Kasper, M. 2012, Astronomy & Astrophysics, 541, A136
  * Mawet et al. (2014) Mawet, D., Milli, J., Wahhaj, Z., et al. 2014, The Astrophysical Journal, 792, 97
  * Miller et al. (2021) Miller, K., Bos, S., Lozi, J., et al. 2021, Astronomy & Astrophysics, 646, A145
  * Miller et al. (2017) Miller, K., Guyon, O., & Males, J. 2017, Journal of Astronomical Telescopes, Instruments, and Systems, 3, 049002
  * Miller et al. (2019) Miller, K. L., Males, J. R., Guyon, O., et al. 2019, Journal of Astronomical Telescopes, Instruments, and Systems, 5, 1
  * Milli et al. (2016) Milli, J., Banas, T., Mouillet, D., et al. 2016, in Adaptive Optics Systems V, Vol. 9909, International Society for Optics and Photonics, 99094Z
  * Milli et al. (2018) Milli, J., Kasper, M., Bourget, P., et al. 2018, in Adaptive Optics Systems VI, Vol. 10703, International Society for Optics and Photonics, 107032A
  * Minowa et al. (2010) Minowa, Y., Hayano, Y., Oya, S., et al. 2010, in Adaptive Optics Systems II, Vol. 7736, International Society for Optics and Photonics, 77363N
  * N’Diaye et al. (2018) N’Diaye, M., Martinache, F., Jovanovic, N., et al. 2018, Astronomy & Astrophysics, 610, A18
  * Otten et al. (2014) Otten, G. P., Snik, F., Kenworthy, M. A., et al. 2014, in Advances in Optical and Mechanical Technologies for Telescopes and Instrumentation, Vol. 9151, International Society for Optics and Photonics, 91511R
  * Pancharatnam (1956) Pancharatnam, S. 1956, in Proceedings of the Indian Academy of Sciences-Section A, Vol. 44, Springer, 398–417
  * Paxman et al. (1992) Paxman, R. G., Schulz, T. J., & Fienup, J. R. 1992, JOSA A, 9, 1072
  * Platt & Shack (2001) Platt, B. C. & Shack, R. 2001, Journal of refractive surgery, 17, S573
  * Por et al. (2018) Por, E. H., Haffert, S. Y., Radhakrishnan, V. M., et al. 2018, in Proc. SPIE, Vol. 10703, Adaptive Optics Systems VI
  * Racine et al. (1999) Racine, R., Walker, G. A., Nadeau, D., Doyon, R., & Marois, C. 1999, Publications of the Astronomical Society of the Pacific, 111, 587
  * Ragazzoni (1996) Ragazzoni, R. 1996, Journal of modern optics, 43, 289
  * Sauvage et al. (2015) Sauvage, J.-F., Fusco, T., Guesalaga, A., et al. 2015, in Adaptive Optics for Extremely Large Telescopes 4–Conference Proceedings, Vol. 1
  * Singh et al. (2019) Singh, G., Galicher, R., Baudoz, P., et al. 2019, Astronomy & Astrophysics, 631, A106
  * Snik et al. (2012) Snik, F., Otten, G., Kenworthy, M., et al. 2012, in Modern Technologies in Space-and Ground-based Telescopes and Instrumentation II, Vol. 8450, International Society for Optics and Photonics, 84500M
  * Soummer et al. (2011) Soummer, R., Hagan, J. B., Pueyo, L., et al. 2011, The Astrophysical Journal, 741, 55
  * Sun (2019) Sun, H. 2019, PhD thesis, Princeton University
  * Vievard et al. (2019) Vievard, S., Bos, S., Cassaing, F., et al. 2019, arXiv preprint arXiv:1912.10179
  * Vievard et al. (2020) Vievard, S., Bos, S. P., Cassaing, F., et al. 2020, in Adaptive Optics Systems VII, Vol. 11448, International Society for Optics and Photonics, 114486D
  * Vigan et al. (2015) Vigan, A., Gry, C., Salter, G., et al. 2015, Monthly Notices of the Royal Astronomical Society, 454, 129
  * Walt et al. (2011) Walt, S. v. d., Colbert, S. C., & Varoquaux, G. 2011, Computing in Science & Engineering, 13, 22
  * Walter et al. (2020) Walter, A. B., Fruitwala, N., Steiger, S., et al. 2020, Publications of the Astronomical Society of the Pacific, 132, 125005
  * Welch (1967) Welch, P. 1967, IEEE Transactions on audio and electroacoustics, 15, 70


# DiaTrend: A dataset from advanced diabetes technology to enable development
of novel analytic solutions

Temiloluwa Prioleau  Dartmouth College, Department of Computer Science,
Hanover, 03755, USA  Dartmouth College, Center for Technology and Behavioral
Health, Lebanon, 03766, USA  corresponding author(s): Temiloluwa Prioleau
<EMAIL_ADDRESS> Abigail Bartolome  Dartmouth College, Department of
Computer Science, Hanover, 03755, USA  Richard Comi  Dartmouth Health, Geisel
School of Medicine, Lebanon, 03766, USA  Catherine Stanger  Dartmouth College,
Center for Technology and Behavioral Health, Lebanon, 03766, USA

###### Abstract

Objective digital data is scarce yet needed in many domains to enable research
that can transform the standard of healthcare. While data from consumer-grade
wearables and smartphones is more accessible, there is critical need for
similar data from clinical-grade devices used by patients with a diagnosed
condition. The prevalence of wearable medical devices in the diabetes domain
sets the stage for unique research and development within this field and
beyond. However, the scarcity of open-source datasets presents a major barrier
to progress. To facilitate broader research on diabetes-relevant problems and
accelerate development of robust computational solutions, we provide the
DiaTrend dataset. The DiaTrend dataset is composed of intensive longitudinal
data from wearable medical devices, including a total of 27,561 days of
continuous glucose monitor data and 8,220 days of insulin pump data from 54
patients with diabetes. This dataset is useful for developing novel analytic
solutions that can reduce the disease burden for people living with diabetes
and increase knowledge on chronic condition management in outpatient settings.

## Background & Summary

Advanced technologies like continuous glucose monitors (CGMs) and insulin
pumps are transforming the standard of care for diabetes management [1, 2, 3].
The ubiquitous nature of these devices enables real-time monitoring and
treatment in daily living; this is a huge advantage over single point-in-time
alternatives like glucose meters and insulin pens. Research shows that many
patients with diabetes achieve better outcomes with CGMs and insulin pumps [4,
5]. However, research also shows that digital data from these devices is
significantly underutilized to optimize outcomes [6, 7]. Meanwhile, the next
generation of solutions needed to advance diabetes care, such as the hybrid
and fully closed-loop artificial pancreas [8, 9], depend substantially on
continuous data from CGMs and insulin pumps. A major barrier to progress in
this field centers around access to rich datasets that facilitate the
development of novel analytic solutions. In addition, there is a large amount
of related but disconnected data streams that is not often reviewed or
analyzed together, which further limits our understanding of diabetes
management and even prevention [10, 11]. To advance research and development
of robust analytic solutions for the growing population of people with
diabetes, there is a critical need for open datasets to understand outpatient
management, develop interventions, and build clinically-relevant decision-
support solutions.

Despite the recognized need for open datasets to enable research [12], there
are limited datasets for data-driven research in the diabetes domain. One is
the OhioT1DM dataset [13], which consists of eight weeks of CGM, insulin pump,
physiological sensor, and self-reported events from 12 people with type 1
diabetes, while another is an N-of-1 dataset, which consists of two weeks of
blood glucose, insulin, and carbohydrate intake logs [14]. To broaden the
scope of research on diabetes and chronic conditions in general, and
accelerate development of robust computational solutions, we provide the
DiaTrend dataset. The DiaTrend dataset includes CGM and insulin pump data from
54 patients with type 1 diabetes. This dataset is created from a subset of two
larger studies focused on: 1) developing computational tools for self-
management of diabetes [6], and 2) evaluating a digital intervention for young
adults with type 1 diabetes [15]. The provided dataset includes time-aligned
blood glucose samples recorded on average every 5 minutes with FDA-approved
CGMs by Dexcom [16], Abbott [17], and Medtronic [18], and insulin pump data
comprising basal and bolus insulin doses, carbohydrate intake logs, and other
pump settings such as insulin-carb ratio and more. Figure 1 presents an
overview of the data collection process and data provided.

The DiaTrend dataset is useful for several research directions including more
common tasks like blood glucose prediction [19, 20, 21, 22, 23, 24, 25, 26],
prediction of adverse glycemic events (i.e., hypoglycemia and hyperglycemia)
[27, 28, 29, 30], detection of unannounced meals [31, 32, 33, 34, 35], and
algorithm development for insulin delivery [36, 37]. However, this dataset is
also useful to support further research on less studied topics like
discovering digital biomarkers of glycemic control [7], mining patterns/trends
in diabetes management [38, 6, 39], understanding adherence to wearable
medical devices and patterns of missing data [40, 41], developing novel visual
analytic and data visualization solutions [42], and designing decision-support
tools through user-centered studies [43, 44, 45, 46]. Additionally,
prospective researchers can find more opportunities for artificial
intelligence in the diabetes domain through recent reviews in literature [47,
48, 49].

Figure 1: Overview of the data collection process and data provided in the
DiaTrend dataset.

## Methods

### Participants

The DiaTrend dataset includes CGM and insulin pump data from a total of 54
patients with type 1 diabetes (age: 19 - 74 years, gender: 17 males, 37
females). Table 1 provides an overview of the demographic and clinical
characteristics of patients in this dataset, including the distribution across
age groups, gender, race, diabetes type, and hemoglobin A1C. Participants were
recruited through two independent studies. Study 1 (also known as Digital SMD)
recruited patients from Dartmouth Health in 2019, while study 2 (also known as
SweetGoals [15]) is an ongoing randomized control trial that recruits patients
through social media and online platforms. Both studies were approved by the
Committee for Protection of Human Subjects at Dartmouth College and all
participants provided verbal and written consent prior to joining either
study. In addition, participants provided consent to share their data openly
to the broader research community.

Cohort 1 (n=17), from the Digital SMD study [6], includes persons with type 1
diabetes between the ages of 25 to 74 years old who use a CGM and insulin pump
for daily management of their condition and consented to share their
retrospective device data for research. Meanwhile, cohort 2 (n=37), from the
SweetGoals study [15], includes persons with type 1 diabetes for longer than
18 months between the ages of 19 to 29 years old who use a Glooko compatible
glucometer or CGM, reported a clinical visit within the previous 6 months from
the recruitment date, and self-reported their most recent Hemoglobin A1C
(HA1C) value as >7.5%. It is important to note that all device data included
in the DiaTrend dataset was collected at baseline (i.e., prior to any
intervention). Additionally, each individual’s dataset spans varying time
periods based on the available retrospective data at the time of recruitment.
Given our focus on advanced diabetes technology for novel analytic solutions,
only participants who use CGMs (with <30% missing data) and insulin pumps for
daily management are included in the provided dataset.

Characteristics | Count (n=54) | %Dist
---|---|---
Age |  |
19 - 24 yrs | 24 | 44.4%
25 - 34 yrs | 14 | 25.9%
35 - 44 yrs | 4 | 7.4%
45 - 54 yrs | 3 | 5.6%
55 - 74 yrs | 9 | 16.7%
Gender |  |
Female | 37 | 68.5%
Male | 17 | 31.5%
Race |  |
White/Caucasian | 48 | 88.9%
Asian or Pacific Islander | 2 | 3.7%
Black/African American | 1 | 1.9%
Black/African American & White | 1 | 1.9%
Other | 1 | 1.9%
Not Reported | 1 | 1.9%
Diagnosis |  |
Type 1 Diabetes | 54 | 100%
Hemoglobin A1C |  |
6.0-6.9 | 8 | 14.8%
7.0-7.9 | 23 | 42.6%
8.0-8.9 | 17 | 31.5%
9.0-11.0 | 3 | 5.6%
Not Reported | 3 | 5.6%
Table 1: DiaTrend dataset: Demographic and clinical characteristics of
patients with diabetes.

### Dataset Description

The DiaTrend dataset includes a total of 27,561 days of CGM data and 8,220
days of insulin pump data from 54 patients with type 1 diabetes. In addition,
the DiaTrend dataset includes demographic and clinical characteristics for
each subject, including metrics such as age, gender, race, diabetes type and
HA1C - see Table 1. There is an average of 510 days (range: 31 - 1885 days) of
CGM data per subject, and an average of 152 days (range: 31 - 780 days) of
insulin pump data per subject - see Fig. 2. Within the insulin pump data,
there is an average of 993 total bolus doses per subject (range: 132 - 4939
doses) and an average of 438 total carb inputs per subject (range: 1 - 2310
input) - see Fig. 3. These data were collected as part of the Digital SMD [6]
and SweetGoals [15] studies during which each patient’s retrospective CGM and
insulin pump data was downloaded through a third-party application (i.e.,
Tidepool [50] and Glooko [51]). It is important to note that since the
SweetGoals study is a randomized control trial, only retrospective baseline
data collected during the initial screening is included as part of the
DiaTrend dataset (i.e., the provided data does not include sensor data from
the intervention period of that study). In addition, HA1C - the primary
clinically-validated metric for accessing glycemic control - was collected via
the patient’s electronic health record (i.e., the most recent HA1C) in the
Digital SMD study and via a mail-in home test in the SweetGoals study at the
time of the baseline assessment (approximately the endpoint of the device
data).

Figure 2: Overview of the number of days of sensor data per patient in the
DiaTrend dataset. Figure 3: Overview of the total number of bolus and carb
input data per patient in the DiaTrend dataset.

## Data Records

All data records in the DiaTrend dataset are stored and accessible via the
Synapse platform [52]. The deposited data consists of 54 Excel files— one file
for each subject. Each file has a CGM sheet that provides blood glucose data
that was collected by the CGM. The CGM sheet includes 2 columns, namely, date
and mg/dL. In addition, each subjects’ file also has a Bolus sheet, which
describes bolus insulin doses and meal announcements (i.e., user-entered
estimates of carbohydrate content in meals logged to calculate bolus insulin
needed to metabolize glucose from the meal consumed [53]). The Bolus sheet
includes the following 7 columns: date, normal, carbInput, insulinCarbRatio,
bgInput, recommended.carb, and recommended.net. It is important to note that
37 (out of 54) Bolus sheets include 4 more columns, namely,
recommended.correction, insulinSensitivityFactor, targetBloodGlucose, and
insulinOnBoard. Additionally, there are only 17 subject files that have a
Basal sheet, which describes the subject’s basal infusions in 3 columns,
namely, date, duration, and rate. Each row in all three of the Excel sheets
refers to one record collected at a given timestamp in the column titled
‘date’. Excluding the date column, the rest of the data can be read as
floating point numbers. Table 2 provides a detailed breakdown of each data
record, the format, and a description.

Sheet Name |  Column Name |  Format |  Description
---|---|---|---
CGM |  date |  datetime (yyyy-mm-dd HH:MM:SS) |  Date and time that glucose reading was recorded
mg/dL |  Float64 |  Blood glucose reading in mg/dL
Bolus |  date |  datetime (yyyy-mm-dd HH:MM:SS) |  Date and time that bolus was administered
normal |  Float64 |  Amount of bolus insulin delivered (units)
carbInput |  Float64 |  Total carbs announced for bolus (grams)
insulinCarbRatio |  Float64 |  Patient setting for grams of carbs covered per one unit of insulin
bgInput |  Float64 |  Blood glucose reading at time of bolus (mg/dL)
recommended.carb |  Float64 |  Amount of insulin recommended to cover carb intake for normal bolus
recommended.net |  Float64 |  Amount of insulin recommended for bolus delivery
recommended.correction |  Float64 |  Amount of insulin recommended for correction component of normal bolus
insulinSensitivityFactor |  Float64 |  Patient setting for how one unit of insulin lowers blood glucose level
targetBloodGlucose |  Float64 |  Target blood glucose value for after bolus delivery
insulinOnBoard |  Float64 |  Amount of active insulin remaining from prior insulin doses
Basal |  date |  datetime (yyyy-mm-dd HH:MM:SS) |  Date and time of basal infusion
duration |  Float64 |  Duration of basal infusion (ms)
|  rate |  Float64 |  Rate of basal infusion (units/hr)
Table 2: Overview of the data records, format, and description in the DiaTrend
dataset.

## Technical Validation

For each patient included in the DiaTrend dataset, we provide an overview of
their blood glucose data using clinically-validated metrics for assessing
glycemic control [54, 55]. This includes the percentage of all blood glucose
readings in 5 clinically-relevant categories, namely, very low (< 54 mg/dL),
low (54 - 69 mg/dL), target range (70 - 180 mg/dL), high (181 - 250 mg/dL),
and very high (> 250 mg/dL). From Fig. 4(a), we can observe that blood glucose
is highly variable and only a minority of patients living with diabetes (less
than 10% in our dataset) meet the clinical target of maintaining blood glucose
within the target range of 70 - 180 mg/dL for more than 70% of the time [54].
Fig. 4(b) presents histograms for daily mean blood glucose (mean = 187 mg/dL),
daily glycemic variability (mean = 0.33), and daily time in range (mean =
47%). From this figure, we can observe a normal distribution for each
clinically-relevant metric in the DiaTrend dataset.

(a)

(b)

Figure 4: Descriptive summary of CGM data in the DiaTrend dataset. (a) The
percent of blood glucose samples in 5 clinically-relevant categories. (b) The
distributions of daily mean blood glucose, daily glycemic variability, and
daily time in [target] range.

Similarly, we provide an overview of each patient’s insulin pump data using
box plots and histograms. Fig. 5(a) and 5(b) show box plots with descriptive
statistics associated with bolus insulin doses and carb inputs, respectively,
for each subject. Additionally, Fig. 5(c) shows the distributions of total
daily bolus insulin doses (units) and total daily carb inputs (g),
respectively. From this figure, we can observe a mean total daily bolus of 24
units and a mean total daily carb input of 115 g, both with a positively
skewed distribution. In particular, we observe a high number of days
($\sim$1400 days) with very low carb inputs ($\sim$0g); this could be
indicative of missed mealtime boluses (i.e., no bolus insulin used during
mealtimes) — this is a common contributor to poor glycemic outcomes [56, 57,
58].

(a)

(b)

(c)

Figure 5: Descriptive summary of insulin pump data in the DiaTrend dataset.
(a) A box plot of all bolus insulin doses per subject. (b) A box plot of all
carb input entries per subject. (c) The distributions of total daily bolus
insulin and total daily carb inputs across all subjects.

### Limitations

There are some important considerations and limitations associated with the
DiaTrend dataset provided in this paper. First, there is imbalance in the
representation of subjects across the dimensions of race, gender, and age.
More specifically, majority of patients whose CGM and insulin pump data is
provided (i.e., 48 out of 54 or 89%) are non-Hispanic White/Caucasian. Also,
this dataset includes a lower representation of males (n=17 out of 54 or 32%)
compared to females, and a lower representation of older adults (e.g., for age
$\geq$ 45 years old, n=12 or 22%). The limitation with regards to race (i.e.,
low representation of participants from non-White/Caucasian races including
Asian and Black/African Americans) is partly due to the geographical location
(i.e., New Hampshire) from which some participants were recruited. However,
the imbalance in representation also underscores racial disparities which have
been identified in prior literature relating to access and use of advanced
diabetes technologies [59], particularly CGMs and insulin pumps. Additionally,
the limitation with regards to age (i.e., low representation of older adults
and higher representation of young adults) is primarily due to the targeted
focus on young adults with type 1 diabetes in the SweetGoals study [15]. A
second limitation of the DiaTrend dataset is that it lacks full temporal
alignment in the CGM and insulin pump data for each participant. This
difference is apparent from Fig. 2 which shows more CGM data than insulin pump
data for a number of subjects. While the reason for this is unknown, we
suspect that it is primarily due lower data storage capacity on insulin pumps
compared to CGMs, which in turn limits the amount of retrospective data
available for download from insulin pumps. Third, basal insulin data is not
available for subjects from cohort 2 (37 out of 54). This missing data stream
might limit research efforts that require basal rate for analysis. However,
despite the aforementioned limitations, the DiaTrend dataset represents one of
the largest open-source datasets currently available in the diabetes domain.
This critical resource provides a unique opportunity to advance development of
novel data-driven solutions that can improve the lives of people living with
diabetes. In addition, this dataset provides a necessary benchmark to evaluate
the generalizability of numerous diabetes-relevant algorithms in literature
[19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 24, 36, 35].

## Usage Notes

The DiaTrend dataset is provided for research and educational purposes that
support the development of novel data-driven solutions for the diabetes
community and beyond. Consistent with exemplar studies [13, 60, 61], we have
set governance structures in place to balance the need for open datasets that
advance research and protect the privacy of participants.

Researchers interested in accessing the DiaTrend dataset should complete the
following steps:

  1. 1.

Register for a Synapse account (www.synapse.org).

  2. 2.

Become a Synapse Certified User with a validated user profile.

  3. 3.

Submit an Intended Data Use statement.

  4. 4.

Agree to the Conditions of Use.

The conditions of use are as follows:

  * •

You confirm that you will not attempt to re-identify research participants for
any reason, including for re-identification theory research.

  * •

You commit to keeping the DiaTrend dataset confidential and secure.

  * •

You understand that these data may not be used for commercial advertisement or
to re-contact research participants.

  * •

You agree to acknowledge the research participants as data contributors, study
investigators, and this paper on all publications or presentations which
results from using the DiaTrend dataset.

## Code availability

Python was used for all data processing described in this paper. The Python
code used to generate all figures in this paper is available on the Augmented
Health Lab’s Github: https://github.com/Augmented-Health-Lab/Diatrend.

## References

  * [1] Beck, R. W., Bergenstal, R. M., Laffel, L. M. & Pickup, J. C.  Advances in technology for management of type 1 diabetes.  _The Lancet_ 394, 1265–1273 (2019).
  * [2] American Diabetes Association and others.  7\. diabetes technology: standards of medical care in diabetes-2021.  _Diabetes Care_ 44, S85–S99 (2021).
  * [3] Cappon, G., Vettoretti, M., Sparacino, G. & Facchinetti, A.  Continuous glucose monitoring sensors for diabetes management: a review of technologies and applications.  _Diabetes & Metabolism Journal_ 43, 383–397 (2019).
  * [4] Rodbard, D.  Continuous glucose monitoring: a review of recent studies demonstrating improved glycemic outcomes.  _Diabetes Technology & Therapeutics_ 19, S–25 (2017).
  * [5] Taylor, P. J., Thompson, C. H. & Brinkworth, G. D.  Effectiveness and acceptability of continuous glucose monitoring for type 2 diabetes management: a narrative review.  _Journal of Diabetes Investigation_ 9, 713–725 (2018).
  * [6] Bartolome, A., Shah, S. & Prioleau, T.  Glucomine: A case for improving the use of wearable device data in diabetes management.  _Proceedings of the ACM on Interactive, Mobile, Wearable and Ubiquitous Technologies_ 5, 1–24 (2021).
  * [7] Bartolome, A. & Prioleau, T.  A computational framework for discovering digital biomarkers of glycemic control.  _npj Digital Medicine_ 5, 1–9 (2022).
  * [8] Thabit, H. & Hovorka, R.  Coming of age: the artificial pancreas for type 1 diabetes.  _Diabetologia_ 59, 1795–1805 (2016).
  * [9] Doyle III, F. J., Huyett, L. M., Lee, J. B., Zisser, H. C. & Dassau, E.  Closed-loop artificial pancreas systems: Engineering the algorithms.  _Diabetes Care_ 37, 1191–1197 (2014).
  * [10] Walsh, J., Roberts, R., Morris, R. & Heinemann, L.  Device connectivity: The next big wave in diabetes.  _Journal of Diabetes Science and Technology_ 9, 701–705 (2015).
  * [11] Iyengar, V., Wolf, A., Brown, A. & Close, K.  Challenges in diabetes care: Can digital health help address them?  _Clinical Diabetes_ 34, 133–141 (2016).
  * [12] Bietz, M. J. _et al._ Opportunities and challenges in the use of personal health data for health research.  _Journal of the American Medical Informatics Association_ 23, e42–e48 (2016).
  * [13] Marling, C. & Bunescu, R.  The ohiot1dm dataset for blood glucose level prediction: Update 2020.  In _CEUR workshop proceedings_ , vol. 2675, 71 (NIH Public Access, 2020).
  * [14] Katz, D. & Price, B.  Two week diabetes data set.  https://doi.org/10.21954/ou.rd.5756379.v1.  Accessed: August 2022.
  * [15] Stanger, C. _et al._ A digital health intervention (sweetgoals) for young adults with type 1 diabetes: protocol for a factorial randomized trial.  _JMIR Research Protocols_ 10, e27109 (2021).
  * [16] Dexcom.  Dexcom continuous glucose monitoring.  https://www.dexcom.com/.  Accessed: March 2023.
  * [17] Abbott.  Freestyle libre continuous glucose monitor.  https://www.abbott.com/freestyle-libre-2-continuous-glucose-monitor-cgm.html.  Accessed: March 2023.
  * [18] Medtronic.  The guardian connect system.  https://www.medtronicdiabetes.com/products/guardian-connect-continuous-glucose-monitoring-system.  Accessed: March 2023.
  * [19] Gu, K., Dang, R. & Prioleau, T.  Neural physiological model: A simple module for blood glucose prediction.  In _2020 42nd Annual International Conference of the IEEE Engineering in Medicine & Biology Society (EMBC)_, 5476–5481 (IEEE, 2020).
  * [20] Li, K., Daniels, J., Liu, C., Herrero, P. & Georgiou, P.  Convolutional recurrent neural networks for glucose prediction.  _IEEE Journal of Biomedical and Health Informatics_ 24, 603–613 (2019).
  * [21] Deng, Y. _et al._ Deep transfer learning and data augmentation improve glucose levels prediction in type 2 diabetes patients.  _npj Digital Medicine_ 4, 1–13 (2021).
  * [22] Zhu, T., Li, K., Herrero, P., Chen, J. & Georgiou, P.  A deep learning algorithm for personalized blood glucose prediction.  In _KHD@ IJCAI_ , 64–78 (2018).
  * [23] Li, K., Liu, C., Zhu, T., Herrero, P. & Georgiou, P.  Glunet: A deep learning framework for accurate glucose forecasting.  _IEEE Journal of Biomedical and health informatics_ 24, 414–423 (2019).
  * [24] Martinsson, J. _et al._ Automatic blood glucose prediction with confidence using recurrent neural networks.  In _Khd@ ijcai_ (2018).
  * [25] Woldaregay, A. Z. _et al._ Data-driven modeling and prediction of blood glucose dynamics: Machine learning applications in type 1 diabetes.  _Artificial Intelligence in Medicine_ 98, 109–134 (2019).
  * [26] Zaidi, S. M. A. _et al._ Multi-step ahead predictive model for blood glucose concentrations of type-1 diabetic patients.  _Scientific Reports_ 11, 24332 (2021).
  * [27] Gadaleta, M., Facchinetti, A., Grisan, E. & Rossi, M.  Prediction of adverse glycemic events from continuous glucose monitoring signal.  _IEEE Journal of Biomedical and Health Informatics_ 23, 650–659 (2018).
  * [28] Mosquera-Lopez, C., Dodier, R., Tyler, N., Resalat, N. & Jacobs, P.  Leveraging a big dataset to develop a recurrent neural network to predict adverse glycemic events in type 1 diabetes.  _IEEE Journal of Biomedical and Health Informatics_ (2019).
  * [29] Seo, W., Lee, Y.-B., Lee, S., Jin, S.-M. & Park, S.-M.  A machine-learning approach to predict postprandial hypoglycemia.  _BMC Medical Informatics and Decision Making_ 19, 1–13 (2019).
  * [30] Dave, D. _et al._ Feature-based machine learning model for real-time hypoglycemia prediction.  _Journal of Diabetes Science and Technology_ 15, 842–855 (2021).
  * [31] Zheng, M., Ni, B. & Kleinberg, S.  Automated meal detection from continuous glucose monitor data through simulation and explanation.  _Journal of the American Medical Informatics Association_ 26, 1592–1599 (2019).
  * [32] Ramkissoon, C. M., Herrero, P., Bondia, J. & Vehi, J.  Unannounced meals in the artificial pancreas: detection using continuous glucose monitoring.  _Sensors_ 18, 884 (2018).
  * [33] Xie, J. & Wang, Q.  A variable state dimension approach to meal detection and meal size estimation: in silico evaluation through basal-bolus insulin therapy for type 1 diabetes.  _IEEE Transactions on Biomedical Engineering_ 64, 1249–1260 (2016).
  * [34] Samadi, S. _et al._ Automatic detection and estimation of unannounced meals for multivariable artificial pancreas system.  _Diabetes Technology & Therapeutics_ 20, 235–246 (2018).
  * [35] Kölle, K., Biester, T., Christiansen, S., Fougner, A. L. & Stavdahl, Ø.  Pattern recognition reveals characteristic postprandial glucose changes: Non-individualized meal detection in diabetes mellitus type 1.  _IEEE Journal of Biomedical and Health Informatics_ 24, 594–602 (2019).
  * [36] Vettoretti, M. & Facchinetti, A.  Combining continuous glucose monitoring and insulin pumps to automatically tune the basal insulin infusion in diabetes therapy: a review.  _Biomedical Engineering Online_ 18, 1–17 (2019).
  * [37] Mosquera-Lopez, C. _et al._ Enabling fully automated insulin delivery through meal detection and size estimation using artificial intelligence.  _npj Digital Medicine_ 6, 39 (2023).
  * [38] Morton, S., Li, R., Dibbo, S. & Prioleau, T.  Data-driven insights on behavioral factors that affect diabetes management.  In _2020 42nd Annual International Conference of the IEEE Engineering in Medicine & Biology Society (EMBC)_, 5557–5562 (IEEE, 2020).
  * [39] Belsare, P., Lu, B., Bartolome, A. & Prioleau, T.  Investigating temporal patterns of glycemic control around holidays.  In _2022 44th Annual International Conference of the IEEE Engineering in Medicine & Biology Society (EMBC)_ (2022).
  * [40] Vhaduri, S. & Prioleau, T.  Adherence to personal health devices: A case study in diabetes management.  In _Proceedings of the 14th EAI International Conference on Pervasive Computing Technologies for Healthcare_ , 62–72 (2020).
  * [41] Drecogna, M., Vettoretti, M., Del Favero, S., Facchinetti, A. & Sparacino, G.  Data gap modeling in continuous glucose monitoring sensor data.  In _2021 43rd Annual International Conference of the IEEE Engineering in Medicine & Biology Society (EMBC)_, 4379–4382 (IEEE, 2021).
  * [42] Zhang, Y., Chanana, K. & Dunne, C.  Idmvis: Temporal event sequence visualization for type 1 diabetes treatment decision support.  _IEEE Transactions on Visualization and Computer Graphics_ 25, 512–522 (2018).
  * [43] Prioleau, T., Sabharwal, A. & Vasudevan, M. M.  Understanding reflection needs for personal health data in diabetes.  In _Proceedings of the 14th EAI International Conference on Pervasive Computing Technologies for Healthcare_ , 263–273 (2020).
  * [44] Katz, D. S., Price, B. A., Holland, S. & Dalton, N. S.  Data, data everywhere, and still too hard to link: Insights from user interactions with diabetes apps.  In _Proceedings of the 2018 CHI Conference on Human Factors in Computing Systems_ , 1–12 (2018).
  * [45] Raj, S., Lee, J. M., Garrity, A. & Newman, M. W.  Clinical data in context: towards sensemaking tools for interpreting personal health data.  _Proceedings of the ACM on Interactive, Mobile, Wearable and Ubiquitous Technologies_ 3, 1–20 (2019).
  * [46] Raj, S., Toporski, K., Garrity, A., Lee, J. M. & Newman, M. W.  "my blood sugar is higher on the weekends" finding a role for context and context-awareness in the design of health self-management technology.  In _Proceedings of the 2019 CHI Conference on Human Factors in Computing Systems_ , 1–13 (2019).
  * [47] Contreras, I., Vehi, J. _et al._ Artificial intelligence for diabetes management and decision support: literature review.  _Journal of Medical Internet Research_ 20, e10775 (2018).
  * [48] Ellahham, S.  Artificial intelligence: The future for diabetes care.  _The American Journal of Medicine_ 133, 895–900 (2020).
  * [49] Tyler, N. S. & Jacobs, P. G.  Artificial intelligence in decision support systems for type 1 diabetes.  _Sensors_ 20, 3214 (2020).
  * [50] Tidepool.  https://www.tidepool.org/.  Accessed: March 2023.
  * [51] Glooko.  Glooko: Remote monitoring for diabetes and related conditions.  https://glooko.com/.  Accessed: March 2023.
  * [52] Prioleau, T., Bartolome, A., Comi, R. & Stanger, C.  Diatrend: A dataset from advanced diabetes technology.  https://doi.org/10.7303/syn38187184.  Accessed: March 2023.
  * [53] Sora, N. D., Shashpal, F., Bond, E. A. & Jenkins, A. J.  Insulin pumps: Review of technological advancement in diabetes management.  _The American Journal of the Medical Sciences_ 358, 326–331 (2019).
  * [54] Battelino, T. _et al._ Clinical targets for continuous glucose monitoring data interpretation: recommendations from the international consensus on time in range.  _Diabetes Care_ 42, 1593–1603 (2019).
  * [55] Danne, T. _et al._ International consensus on use of continuous glucose monitoring.  _Diabetes Care_ 40, 1631–1640 (2017).
  * [56] Burdick, J. _et al._ Missed insulin meal boluses and elevated hemoglobin a1c levels in children receiving insulin pump therapy.  _Pediatrics_ 113, e221–e224 (2004).
  * [57] Deeb, A. _et al._ Important determinants of diabetes control in insulin pump therapy in patients with type 1 diabetes mellitus.  _Diabetes Technology & Therapeutics_ 17, 166–170 (2015).
  * [58] Patton, S. R. _et al._ Frequency of mealtime insulin bolus predicts glycated hemoglobin in youths with type 1 diabetes.  _Diabetes Technology & Therapeutics_ 16, 519–523 (2014).
  * [59] Foster, N. C. _et al._ State of type 1 diabetes management and outcomes from the t1d exchange in 2016–2018.  _Diabetes Technology & Therapeutics_ 21, 66–72 (2019).
  * [60] Bot, B. M. _et al._ The mpower study, parkinson disease mobile data collected using researchkit.  _Scientific Data_ 3, 1–9 (2016).
  * [61] Hershman, S. G. _et al._ Physical activity, sleep and cardiovascular health data for 50,000 individuals from the myheart counts study.  _Scientific Data_ 6, 1–10 (2019).

## Acknowledgements

C.S. acknowledges funding from the National Institute of Diabetes and
Digestive and Kidney Diseases (R01DK124428).

## Author contributions statement

T.P. conceived the Digital SMD study for cohort 1. T.P, A.B., and R.C. led
efforts for data collection from cohort 1. C.S. conceived and led the
SweetGoals study and data collection for cohort 2. A.B. cleaned and organized
both datasets. T.P. and A.B. wrote the manuscript, and prepared figures &
tables. All authors reviewed and contributed to the final approval of the
manuscript.

## Competing interests

The authors declare no completing interest.