Dataset Preview
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code: DatasetGenerationError
Exception: ArrowInvalid
Message: JSON parse error: Missing a closing quotation mark in string. in row 21
Traceback: Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 145, in _generate_tables
dataset = json.load(f)
File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 52772)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1995, in _prepare_split_single
for _, table in generator:
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 148, in _generate_tables
raise e
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 122, in _generate_tables
pa_table = paj.read_json(
File "pyarrow/_json.pyx", line 308, in pyarrow._json.read_json
File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: JSON parse error: Missing a closing quotation mark in string. in row 21
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
parquet_operations = convert_to_parquet(builder)
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
builder.download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
self._download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
text
string | meta
dict |
|---|---|
\section{Introduction}
The Event Horizon Telescope Collaboration (EHTC) has recently published the first polarized image of the supermassive black hole (SMBH) at the center of giant elliptical galaxy Messier 87 \citep[hereafter M87*;][]{PaperI,PaperII,PaperIII,PaperIV,PaperV,PaperVI,PaperVII,PaperVIII}. These results feature
resolved linear polarization with a diffraction-limited resolution corresponding to approximately 5~$GM/c^2$, where $M$ is the mass of the SMBH, $G$ is the gravitational constant, and $c$ is the speed of light. The image reveals an asymmetric ring-like structure with a bright region at its Southern edge, attributed to the Doppler effect and the bending of light originating from the synchrotron emission of orbiting relativistic electrons in the vicinity of the event horizon.
The polarimetric image of M87* BH
presented in \citet{PaperVII, PaperVIII} provides information on
both the degree and the directionality of linear polarization where the latter is determined by the electric vector position angle (hereafter EVPA). Quantifying the twistiness of the polarized images, defined as the smooth azimuthal change of the EVPA within the ring pattern, offers us new insights into the structure of magnetic field, putting strong constraints on the nature of the ring and the emission region.
The observed image of M87* from EHTC reveals an azimuthally spiraling pattern of the EVPA. Motivated by this, \cite{Palumbo_2020} used a particular decomposition of linear polarization to azimuthal modes identified with complex coefficients $\beta_m$. They found that the rotationally symmetric mode of a Fourier decomposition of a linear polarization pattern can distinguish between theoretical models.
It was shown in \cite{PaperVIII} and \cite{Palumbo_2020} that $m=2$ (i.e. $\beta_2$) is the dominant contribution in the characterization of the magnetized accretion model. Furthermore, the $\beta_2$ phase matches very well with the theoretically expected behavior of the polarized map \citep[see][ for more details]{PaperVIII}. Finally, both the amplitude and the phase of $\beta_2$ are sensitive to the magnetic field geometry and the black hole spin. However, a detailed characterization of their correlation to the plasma astrophysics and the spacetime geometry remains elusive.
\cite{Narayan_2021} modeled the polarimetric image of a BH using a simple toy model comprising of a magnetized ring of emission located near the Schwarzschild event horizon. The model comprises of an equatorial emission and fluid velocity with an arbitrary emission radius, magnetic field structure and observer's inclination. \citet{Gelles_2021} further extended this toy model to include the effect of BH spin by moving from the Schwarzschild spacetime to the Kerr geometry. The simplicity of the aforementioned
toy models make them remarkably useful to do extensive
exploration of different emission models and magnetic field structure. Such an investigation is computationally very expensive using the general relativistic magnetohydrodynamical simulations (GRMHD). Yet, the validity of the assumptions made in such toy models remains elusive. Furthermore, it is not very clear what drives the $\beta_2$ in the simple ring model.
Positron effects on polarized emission, including EVPA patterns, have been found to be dependent on plasma thermodynamics in \cite{Anantua2020a,emami2021positron}. The linearly polarized portion of ray-traced images therein are supported on bilaterally asymmetric jet regions along with emitting rings around the Kerr magnetosphere. The global EVPA structure ranges from radial to spiral based on thermodynamic parameters and their interaction with the positron fraction of the plasma.
In this work, we perform a comprehensive study of the driving sources of $\beta_2$ in simulated models of M87*. We utilize the same GRMHD simulations used in \citet{PaperV,PaperVIII} generated with the PATOKA pipeline \citep{2022ApJS..259...64W},
with a variety of different accretion states, BH spins and emission physics. To model the polarized images of M87*, we make use of the general relativistic radiative transfer (GRRT) framework implemented in code {\sc ipole} \citep{Moscibrodzka&Gammie2018}. We find the emission radius and link the magnetic field structure and velocity field at the emission location to the pattern of the EVPA. We investigate many effects which might contribute to the signal, including the spatial origin of the emission, Faraday rotation and relativistic effects. We find out that the signal strongly depends on the magnetic field geometry along with the BH spin. Our analysis show that while the ring model works reasonably good for the case of a magnetically arrested disk (MAD) \citep{1974Ap&SS..28...45B, 2003ApJ...592.1042I, 2003PASJ...55L..69N}, it has some limitations to fully capture the case of the standard and normal evolution (SANE) \citep{2003ApJ...599.1238D,GammieIHARM2003, 2012MNRAS.426.3241N}. Furthermore, the overall consistency reduces when we consider cooler electrons. We conclude that the phase of the $\beta_2$ indirectly probes the magnetic field geometry. Consequently, trends in $\beta_2$ are fundamentally linked to different magnetic field structures.
The paper is organized as follows. Section~\ref{method} describes our methodology, including the GRMHD simulation~\ref{grmhd-sim}, the actual ray-tracing \ref{imaging-ipole}, the geometrical ring model \ref{geometric-ring} and azimuthally expanded polarized mode ($\beta_2$) \ref{polarization}. Section~\ref{resul} focuses on the polarimetric analysis, including the time averaged polarized images \ref{time-averages}, the locus of emission \ref{emission-location}, the correlation between the phase of the $\beta_2$ and the BH spin \ref{phase-beta2-spin}, drivers of the $\beta_2$ \ref{driver-beta2}, tracking the BH spin from the trends in plasma quantities \ref{B-V-spin-BH} and the influence of Faraday rotation \ref{FR-impact}. The conclusion is provided in Section~\ref{conclusion}.
\section{Methodology} \label{method}
In this section, we describe how we produce the polarized images of M87*. More details about the simulation procedure and codes used can be found in \citet{2022ApJS..259...64W}.
\subsection{GRMHD Simulations} \label{grmhd-sim}
We use {\sc iharm} simulations by \cite{GammieIHARM2003,2021JOSS....6.3336P} from the standard library of 3D time-dependent GRMHD simulations performed in \citet{PaperV,PaperVIII}. These ideal GRMHD simulations are initialized with a weakly magnetized torus of plasma orbiting in the equatorial plane around a BH. Instabilities like the magnetorotational instability \citep{BalbusHowley1991} drive the torus into a turbulent state, which enables angular momentum transport and inward accretion of the matter onto the central black hole. The system tends toward a state with a mildly magnetized midplane, a coronal component where the gas to magnetic pressure $\beta \equiv P_g/P_B \simeq 1$ with a very strongly magnetized funnel region near the BH poles. The details of the outcome also depends on the strength and the geometry of the initial magnetic field.
Due to the initial condition, the first part of each simulation is dominated by a transient state as as a turbulent accretion develops . During this transient state, the accretion rate grows, and the infalling plasma heats up and begins to emit radiation. In order to ensure that this artificial initial transient state does not influence our results, we run each simulation until at least t =$ 10^4\,GM/c^2$,
by which point the accretion flow close to the BH, which produces vast majority of the signal at $230\,$GHz, reaches a
steady state. GRMHD fluid snapshots are saved every $5\,GM/c^2$
over the duration of the simulation; the time range of the initial transient state is found by analyzing the fluid snapshot data so that the ``steady-state'' epoch of the simulation can be identified.
For GRMHD simulations with non-zero BH angular momentum, we study the cases where the BH angular momentum $J$ is aligned (parallel or anti-parallel) with the angular momentum of the accretion flow.
Ideal GRMHD simulations are invariant under mass rescaling and thus our (anti-)aligned systems are effectively described by just two parameters: the BH angular momentum (spin) and the near horizon magnetic flux $\Phi_B$. The dimensionless BH spin, hereafter $a \equiv Jc/GM^2$, is limited to $ -1 \leqslant a \leqslant 1$. The dimensionless magnetic flux at the horizon is $\phi \equiv \Phi \left( \dot{M} r^2_g c \right)^{-1/2}$ (where $r_g \equiv GM/c^2$ refers to the gravitational radius) determines if the accretion is in a SANE ($\phi \simeq 5 $) or MAD ($\phi \gtrsim $50) state.
\subsection{Imaging} \label{imaging-ipole}
In order to generate polarized images of M87*, we use the GRRT code {\sc ipole} \citep{Moscibrodzka&Gammie2018}. Each image is produced with a 160 $\mu$as field of view (FOV) and a resolution of 320 $\times$ 320 pixels, with each image containing the 4 Stokes parameters, I, Q, U and V. {\sc ipole} first solves for the null geodesic equations from the camera through the source, then the polarized radiative transfer equations forward along with the geodesic. Polarized synchrotron emission, self-absorption, Faraday rotation, and Faraday conversion are also taken into account in making the polarized images. For each set of model parameters (see below), images are produced over the entire steady-state time range identified in the GRMHD simulations.
Unlike in the GRMHD simulations, the GRRT calculation, which relies on the emission, absorption, and rotation transfer coefficients, is not scale-invariant. Thus, while performing the ray-tracing, we must set two physical scales for the system. The first scale is the characteristic system length, which is computed as $L = GM/c^2$.
The second scale is determined by the simulation mass-density parameter, which is set by the observed flux density at 230 GHz which is chosen to be $F_{\nu} \simeq 0.5$ Jy \citep{PaperIV}. Following \citet{PaperV}, we have also fixed the inclination of the source to be 17 deg for retrograde and 163 deg for the prograde spins.
Next, to set the plasma temperature, we choose a different strategy than the one usually adapted in GRMHD simulations. In particular, we replace the thermal equilibrium approximation with a collisionless plasma in which electrons and ions most likely reach two different temperatures \citep{Shapiro+1976,Narayan+1995}. Hence, as in previous work \citep[e.g.,][]{PaperV,PaperVIII}, we modulate the ion-to-electron temperature ratio via the prescription of \citet{Monika+2016}:
\begin{equation}
\frac{T_i}{T_e} = R_\mathrm{high} \frac{\beta^2}{1+\beta^2} + R_\mathrm{low} \frac{1}{1+\beta^2}.
\end{equation}
Here, $\beta$ is the ratio of gas to magnetic pressure, and $R_\mathrm{high}$ and $R_\mathrm{low}$ are free parameters, allowed to vary with guidance from simulations that include electron heating. In our ``Fiducial'' set of models, we set $R_\mathrm{low}=1$ and $R_\mathrm{high}=20$, values favored by recent simulations \citep{Chael+2018,Mizuno+2021}. In our ``Faraday Thick'' set of models, on the other hand, we set $R_\mathrm{low}=10$ and $R_\mathrm{high}=160$, considered large values for each parameter. The electrons are colder in the Faraday Thick models, requiring increased mass density to match the observed flux of M87*. Both the lower temperature and the increased density makes this model much thicker to Faraday rotation than the Fiducial case, which plays an important role in decreasing the linear polarization fraction and modifying the EVPAs of a given region. A significant variation of the Faraday depth toward M87* has been reported by \citet{Goddi2021}, motivating us to address both regimes.
The version of {\sc ipole} that we use has been modified to record the spatial distribution of the emission that contributes to an image. Notice that this value depends on the location of the observer, due to both absorption (which occurs as light travels along the geodesic) and the anistropy of synchrotron emission (which makes the relevant emission a function of the line of sight through any particular points in space). In practice, we compute the observed emission for each pixel in an image and then sum over the pixels. For the geodesic corresponding to any image pixel, it is trivial to compute the effects of absorption along the geodesic by evaluating the optical depth between each point along that pixel's geodesic and the camera at infinity. The local (angle-dependent) emissivity can be directly computed at each event along the geodesic and multiplied into the optical depth extinction to calculate the local contribution to the final observed flux density. After repeating this procedure for each image's pixel, a histogram of all local contributions to the final image can be computed. This histogram represents the origin of all observed emission. More detail can be found in \S~3.2.1 of \cite{2022ApJS..259...64W}.
\subsection{Magnetic Field Polarity}
The equations of ideal GRMHD are invariant under a sign flip of the magnetic field direction. Previous EHTC studies have considered only the case where the overall magnetic field polarity is parallel to that of the disk angular momentum. As we shall show however, this choice impacts the linear polarization structure in the images because of the Faraday rotation which is in place when the linear polarization passes through a magnetized plasma. Consequently, in generating images, we consider two distinct cases: one set with the magnetic field vector aligned with the disk angular momentum and the other is anti-aligned. Below, we examine both of these cases, calling them FR$_1$ and FR$_2$, respectively.
\subsection{Geometric Ring Model} \label{geometric-ring}
To build intuition for the polarized images of the M87* accretion flow produced by the EHT \citep{PaperVIII}, \citet{Narayan_2021} constructed a toy model for the synchroton emission from a thin ring of magnetized fluid orbiting a Schwarzschild black hole. This model assumes an optically thin ring of fluid at a single Boyer-Lindquist radius with an axisymmetric magnetic field and fluid velocity. Predictions for the observed polarization pattern on the viewing screen take the shape of a lensed ring of polarization vectors.
\citet{Gelles_2021} extended the ring model to address equatorial emission in a Kerr spacetime and also specified the emission from highly lensed sub-images for which geodesics complete one or more half-orbits around the black hole. The Gelles model found that, assuming all other fluid parameters are equivalent, the effect of spin on the direct image polarization is very weak; therefore, the difference in polarization patterns that trend with spin are being driven indirectly, likely through modification of the underlying velocity and magnetic field directions, as we will show.
As shown in the GRMHD comparison paper by \citet{Narayan_2021}, these toy models can be used to produce non-infinitesimal rings by evaluating them over a range of radii and applying an envelope function to the underlying emissivity. \citet{Palumbo_KerrBAM} applied this procedure to the \citet{Gelles_2021} model in Kerr metric to produce the image generation and model-fitting code ``Kerr Bayesian Accretion Modeling'' (\texttt{KerrBAM}), which we use to generate toy model images throughout the paper. \texttt{KerrBAM} generates model image by semi-analytically ray-tracing backwards from the observer screen to an arbitrarily inclined equatorial plane in Boyer-Lindquist coordinate, producing grids of radii and azimuthal angles. Given an axisymmetric prescription for the fluid velocity and magnetic field penetrating the plane, in addition to an envelope function $\mathcal{J}$, the synchrotron emissivity can be predicted for a given spectral index, which we take it to be 1 at 230 GHz (see the discussion in subsection 2.2 of \citet{Narayan_2021}). Throughout this paper, we use an axisymmetric ring profile given by:
\begin{align}
\label{eqn:profile}
\mathcal{J}_{\rm ring}(r) &= \exp{\left(-4 \ln2 \frac{(r-R)^2}{w^2}\right)},
\end{align}
where $R$ is the peak radius and $w$ is the full width of half maximum of the intensity profile. Note that the true emissivity also depends on the details of lensing, Doppler boosting, and the angle between geodesics and the local magnetic field, all of which are accounted for in \texttt{KerrBAM} for arbitrary photon winding numbers. However, the model does not contain any Faraday effects and thus does not meaningfully predict fractional polarization. Consequently, the ring model is most useful in the context of our paper as a predictor of the resolved structure of the EVPA.
\begin{figure*}
\center
\includegraphics[width=0.99\textwidth]{MAD1_NEW.pdf}
\includegraphics[width=0.99\textwidth]{MAD1_NEW_F2.pdf}
\includegraphics[width=0.99\textwidth]{NFR_MAD1_NEW.pdf}
\includegraphics[width=0.99\textwidth]{RING_MADs_NEW3.pdf}
\caption{Time averaged images of MAD models for the Fiducial case with $R_{\mathrm{high}} = 20$ and $R_\mathrm{low}=1$ with different BH spins, $a=(-0.94, -0.5, 0.0, +0.5, +0.94)$. The first two rows plot polarimetric images computed using the complete radiative transfer equation, with two orientations of the magnetic field polarity, either aligned with the disk angular momentum on large scales (FR$_1$) or anti-aligned (FR$_2$). In the third row, we switch off Faraday rotation in this calculation to study its impact on the linear polarization pattern, which is not very significant for these models. Finally, in the fourth row, we plot images derived from an analytic ring model with parameters chosen to match the GRMHD. This ring model reproduces the evolution of the twisty morphology as a function of spin by including evolution in the magnetic field structure, velocity field, and emission location (but not Faraday rotation) as input from GRMHD.}
\label{Mad-averaged-fiducial}
\end{figure*}
\begin{figure*}
\center
\includegraphics[width=0.99\textwidth]{SANE1_NEW.pdf}
\includegraphics[width=0.99\textwidth]{SANE1_NEW_F2.pdf}
\includegraphics[width=0.99\textwidth]{NFR_SANE1_NEW.pdf}
\includegraphics[width=0.99\textwidth]{RING_SANES_NEW3.pdf}
\caption{As \autoref{Mad-averaged-fiducial}, but for our Fiducial SANE models. The impact of Faraday rotation is more significant due to their larger Faraday depths. While a ring model can broadly reproduce the nature of the morphology evolution as a function of spin, more deviations occur for our SANE models due to their more complicated emission geometries. \label{Sane-averaged-fiducial}}
\end{figure*}
\subsection{Polarization Spirals and \texorpdfstring{$\beta_2$}{beta-2}} \label{polarization}
\citet{Palumbo_2020} found that the magnetization state in simulations of the M87* accretion flow was strongly encoded in the spiraling structure of the EVPA, with more radially directed EVPA corresponding the SANE models and more spiraling or circular EVPA patterns corresponding to MADs. To differentiate between the MAD and SANE models more quantitatively, they proposed an azimuthal decomposition of the polarized image to isolate symmetric patterns in the EVPA with respect to the image azimuthal angle $\varphi$, when averaged over image radius $\rho$:
\begin{align}
\beta_m &=\dfrac{1}{I_{\rm tot}} \int\limits_{0}^{\infty} \int\limits_0^{2 \pi} P(\rho, \varphi) \, e^{- i m \varphi} \; \rho \mathop{\mathrm{d}\varphi} \mathop{\mathrm{d}\rho},\\
I_{\rm tot} &= \int\limits_{0}^{\infty} \int\limits_0^{2 \pi} I(\rho, \varphi) \; \rho \mathop{\mathrm{d}\varphi} \mathop{\mathrm{d}\rho}.
\end{align}
Here, each coefficient $\beta_m$, which is normalized by the total image flux, is a complex coefficient with a phase that encodes the orientation of the spiral and an amplitude that is proportional to the average linear fractional polarization. Crucially, the $m=2$ mode is rotationally symmetric; intuitively, a nearly axisymmetric flow viewed at nearly face-on inclination (as is the case for M87*) would produce a nearly rotationally symmetric image on the observer screen. \citet{Palumbo_2020} found that, as expected, the $\beta_2$ mode is indeed the most informative coefficient for discriminating the accretion states, as the phase directly relates to the underlying magnetic field orientation in the limit of weak Faraday effects. Furthermore, \citet{PaperVIII} found that the phase of $\beta_2$ was more constraining than any other polarized image metric when comparing images from EHT data to GRMHD simulations. Of interest in this work is how strongly the $\beta_2$ phase can be related to the magnetic field in GRMHD simulations in two regimes of Faraday effect strength, as well as investigating the cause of the strong dependence on spin in the $\beta_2$ phase identified in \citet{Palumbo_2020}.
\subsection{From GRMHD simulation to the geometrical Ring model} \label{connection}
Having introduced the GRMHD models and the geometrical ring model, here we briefly discuss on how to make the connection between the two. This is essential as the ring model chooses an arbitrary value for the magnetic and the velocity fields. Consequently, to make a direct link between the $\beta_2$ phase from the GRMHD and the ring model, we shall make use of the B/V fields from the GRMHD simulations which requires some coordinate transformations. More appropriately, while the GRMHD snapshots are given in the Kerr-Schild coordinate, the Ring model is based on the Boyer-Lindquist coordinate.
Comparison between GRMHD and the ring model requires establishing a suitable mapping that relates a given simulation to a ring model product. We created this mapping for each simulation by first selecting the radius of emission in the ring model to be the same as the peak emission radius of the chosen simulation, (see \autoref{MAD-Emission}). We then azimuthally extracted the equatorial magnetic fields and fluid velocities from the simulation.
\newline A series of coordinate transformations were performed to convert the GRMHD output into a suitable ring model input. The fluid velocity is reported in a local inertial frame oriented along the FMKS coordinate axis, (see Appendix F of \cite{2022ApJS..259...64W} for a definition), while the magnetic field is extracted from GRMHD as a 3-vector in the fluid frame. These quantities were used to construct a four-velocity and magnetic field four-vector as defined in \cite{GammieIHARM2003}, which were transformed to Boyer-Lindquist coordinates.
Finally, we constructed the necessary four vector quantities for the ring model by transforming from Boyer-Lindquist to the equatorial ZAMO frame with the appropriate tetrads defined in \cite{Gelles_2021}, and performing the required Lorentz boost to retrieve the magnetic field vector in the fluid frame.
\begin{figure*}
\center
\includegraphics[width=0.99\textwidth]{Emission_MAD_N.pdf}
\includegraphics[width=0.99\textwidth]{Emission_MAD_160N.pdf}
\caption{Azimuthal and time-averaged emissivity densities for our Fiducial (top) and Faraday Thick (bottom) MAD simulations. The white contour surrounds the region within which the top 30\% of the emission is localized, while the gold star marks to the single chosen emission location used for extracting the magnetic and velocity fields for the ring model. In each row, from the left to right we increase the BH spin in the interval $a=(-0.94, -0.5, 0.0, +0.5, +0.94)$. Our MAD models, even those with large $R_\mathrm{high}$ and $R_\mathrm{low}$ are characterized by a ring of emission in the mid-plane.}
\label{MAD-Emission}
\end{figure*}
\section{Polarimetric Analysis and results} \label{resul}
In order to determine the origin of the linear polarization structure in our images, we perform an in-depth analysis of the GRMHD simulations at the location of peak emission. First, we locate the emissivity peak and sample the magnetic fields and velocity fields there. We input this information in an analytic ring model that treats Doppler boosting and lensing self-consistently (but does not include Faraday effects). We use this methodology to identify the mechanisms that determine $\angle \beta_2$ which describes the argument of $\beta_2$.
\subsection{Time averaged polarized images} \label{time-averages}
Throughout our analysis, we mainly focus on the time averaged images from different snapshots of a GRMHD simulations. That is, we are assuming that the turbulent character of the flow is stationary, and the source morphology may be characterized with a well-defined mean image. This notion appears to be consistent with the results of the multi-year M87* total intensity monitoring \citep{Wielgus2020}. Figures \ref{Mad-averaged-fiducial} and \ref{Sane-averaged-fiducial} present the time averaged images of the GRMHD simulations and the geometrical ring model for the Fiducial case of MAD and SANE simulations, respectively. In each figure, the first two rows present images with aligned and anti-aligned magnetic fields (referred to as FR$_1$ and FR$_2$ respectively), followed by the case with no Faraday rotation (referred to as NFR) and the ring model (named as RING). Since the ring model does not include Faraday rotation, we are mostly concerned with comparing the NFR row with the RING row. In each row, from the left to right, we increase the BH spin in the interval $a=(-0.94, -0.5, 0.0, +0.5, +0.94)$.
From these plots, it is evident that the linear polarization pattern is not strongly affected by Faraday rotation. This itself is an important finding, since Faraday rotation and depolarization could have potentially randomized $\angle \beta_2$ in our models. Moreover, despite the abundance of simplifying assumptions made in constructing the ring models, they are remarkably successful at reproducing the overall handedness of the twisty polarization pattern especially in MAD simulations. SANE models, on the contrary, exhibit less agreement with the simple ring model. Consequently, the linear polarization pattern in MAD simulations can be explained by the magnetic field and velocity field at the emission peak, as input parameters in ring model, while its spin evolution can be attributed to frame dragging. This is explored in much greater detail in the following sections.
The azimuthally oriented EVPAs in low BH spins in MAD simulations are getting converted to radial ticks for high BH spins (both retrograde and the prograde spins) with more radial EVPAs for the prograde spins. Consequently, it is inferred that the ticks of the EVPAs might be directly linked to the BH spin and can be used to infer the spin. The azimuthal/radial pattern in MAD is getting slightly distorted in SANEs owing to the extra scrambling induced from the Faraday rotation. The radially oriented EVPAs in SANE prograde spins is also reflected in the ring model, though it is absent in the retrograde spins.
Since the electron-to-ion temperature ratio remains an important uncertainty in our models, this need not generically be the case. As constructed, Faraday rotation has a more significant effect in our Faraday Thick models. Their images are discussed in more detail in Appendix \ref{Image-Faraday-Thick}.
\begin{figure*}
\center
\includegraphics[width=0.99\textwidth]{Emission_SANE_N.pdf}
\includegraphics[width=0.99\textwidth]{Emission_SANE_160N.pdf}
\caption{As \autoref{MAD-Emission}, but for our SANE simulations. Our SANE models have more complicated emission geometries and in some cases clearly exhibit multiple peaks of emission. Since we pick a single emission location to input into our ring model, we expect greater disagreement between GRMHD and analytic rings for our SANE models than their MAD counterparts. In each row, from the left to right we increase the BH spin in the interval $a=(-0.94, -0.5, 0.0, +0.5, +0.94)$.}
\label{SANE-Emission}
\end{figure*}
\begin{figure*}
\center
\includegraphics[width=0.99\textwidth]{phase_New_20_160.pdf}
\caption{$\angle \beta_2$ for different GRMHD simulations and the ring model. FR$_1$, FR$_2$, NFR and the ring model are marked with red-circle, yellow-diamond, blue-cross and green-stars, respectively. The top row plots our Fiducial models, while the bottom row plots our Faraday Thick models. The left column plots our MAD models, while the right column plots our SANE models. A simple analytic ring given the appropriate velocity and magnetic fields does a remarkable job at reproducing $\angle \beta_2$ of our Fiducial MAD models. In other models, the differences between the NFR and FR$_{1,2}$ points reveal a stronger impact of Faraday rotation.
}
\label{Phase_Comparison}
\end{figure*}
\subsection{Quantifying the emission location in GRMHD simulations}
\label{emission-location}
As described in Section \ref{imaging-ipole}, we construct for each snapshot a three-dimensional map of the emission location, which is then averaged over time and azimuth to identify the $r$ and $z$ coordinates of the emission peak. In Figures \ref{MAD-Emission} and \ref{SANE-Emission}, we plot the azimuthal and the time averages (see Section \ref{time-averages} for more details). Specifically, we identify the region containing the top 30\% of the emission, outlined in white. Marked with gold star, we also present the chosen emission location as appropriate in the ring model. Where as already mentioned above, the emission place is fixed such that the inferred $\angle \beta_2$ from the ring model matches as well as possible with the results of the GRMHD models.
We find that the emission of our Fiducial MAD models is concentrated in the mid-plane. Meanwhile, SANE simulations reveal a more complicated emission geometry \citep[see also][]{PaperV}. In the Fiducial case, the emission of prograde models is mostly located in the mid plane, but emission becomes more jet dominated in the other cases. Several of the SANE models are clearly not well described by a single ring. In the Faraday Thick SANE case, disk emission is further suppressed, moving more emission into the jet sheath. In conclusion, while the emission location is robust in MADs against changing the electron temperature, it depend on the details of the electron distribution in SANE simulations.
\subsection{\texorpdfstring{$\angle \beta_2$}{The Angle of beta-2} as a Function of Spin} \label{phase-beta2-spin}
\begin{figure*}
\center
\includegraphics[width=0.99\textwidth]{beta2Distributions.pdf}
\caption{Distributions of $\angle \beta_2$ in our models. Fiducial models are shown in blue while Faraday Thick models are shown in red. At the top of each panel, we write the average amplitude of the $\beta_2$ mode as well. For models with $\langle |\beta_2| \rangle \gtrsim 0.1$, we find that these peaks are generally well-localized. For some SANE models with scrambled $|\beta_2|$, $\angle \beta_2$ is randomized and carries little information.}
\label{fig:beta_distributions}
\end{figure*}
In analyzing distributions of the complex $\beta$ coefficients of GRMHD simulations, \citet{Palumbo_2020} point out an interesting dependence of $\angle \beta_2$ on the SMBH spin. We reproduce this result and plot both the Fiducial and Faraday Thick models (with magnetic fields aligned with the disk angular momentum; FR$_1$) in \autoref{fig:beta_distributions}. The differences in these distributions between aligned and anti-aligned magnetic fields are discussed in \autoref{sec:flip_b}. We find that most models exhibit relatively localized peaks of $\angle\beta_2$, even among our Faraday Thick models. Fortunately, Faraday rotation does {\it not} randomize $\angle \beta_2$ for a given snapshot. We find that our prograde SANE models are poorly localized however. This is because they exhibit very low $|\beta_2|$ as written at the top right of each panel, and thus their $\angle \beta_2$ is not very meaningful. As discussed in \citet{PaperVIII}, even though the retrograde SANEs exhibit a high Faraday depth, this Faraday depth does not affect forward-jet emission that is in front of the Faraday screen. Finally, while outside the scope of this paper, it is clear that the width of these distributions varies in interesting ways among these different models, which can be constrained by continued monitoring of M87*.
Here we compute the $\angle \beta_2$ in various GRMHD simulations, comparing them against the geometrical ring model. From the GRMHD part, we infer the phase of $\beta_2$ for FR$_1$, FR$_2$ and NFR, while from the ring side, we compute the $\angle \beta_2$ by choosing few different locations with high percentage of emission, fixing the magnetic and velocity fields in one final location where the inferred $\angle \beta_2$ from the ring model is the closest to the NFR case. The chosen place is then marked with gold stars in Figures \ref{MAD-Emission} and \ref{SANE-Emission}.
Figure \ref{Phase_Comparison} and \ref{Ring-Comparison} present the $\angle \beta_2$ and the Error in $\angle \beta_2$ in different GRMHD simulations and the ring model, respectively. In the top panel, we present the Fiducial case while in the bottom, we show the Faraday Thick case. In each row, the left/right panel, presents the MAD/SANE case. From the plots, it is inferred that:
$\bullet$ Overall, MAD simulations establish better agreement with the ring model than the SANE simulations.
$\bullet$ The level of the model agreements is higher in the Fiducial case compared with the Faraday Thick scenario. Furthermore, FR$_1$ and FR$_2$ are more similar in the former case than the latter one. This is expected as the Faraday rotation is more prominent in the Faraday Thick case than the Fiducial one.
$\bullet$ In the Faraday Thick case, the anti-aligned magnetic field, FR$_2$, gets closer to the NFR case than the aligned magnetic field.
$\bullet$ Finally, it is seen that the $\angle \beta_2$ is directly linked to the BH spin. Consequently, we argue that the $\angle \beta_2$ in MAD and SANE simulations can be used to infer the BH spin.
\begin{figure*}
\center
\includegraphics[width=0.99\textwidth]{Combine_Phsse_Change.pdf}
\caption{The error in the $\angle \beta_2$ for different GRMHD simulations compared with the ring model. FR$_1$, FR$_2$ and NFR are marked with red-circle, yellow-diamond and blue-cross , respectively. The top/bottom panels show the Fiducial/Faraday Thick cases, respectively. The left(right) panel show the MAD(SANE) simulations. Since Faraday rotation is not included in our simple ring model, it naturally produces the smallest errors when compared to the NFR cases.
}
\label{Ring-Comparison}
\end{figure*}
\subsection{Main drivers of \texorpdfstring{$\beta_2$}{beta-2} } \label{driver-beta2}
Here we explore different drivers of the ticks in EVPAs. The most key drivers of the EVPAs include plasma boost, gravitational lensing and the magnetic field geometry. While the first two players are easier to probe individually, we may not turn off the magnetic field as it washes out the $\beta_2$ entirely. Owing to this, in what follows, we directly explore the impact of the plasma boost as well as the gravitational lensing, while indirectly estimating the importance of the magnetic field based on the deviations of EVPA ticks from their original values when we turn off the boost or the gravitational lensing.
\subsubsection{Influence of plasma boost on \texorpdfstring{$\beta_2$}{beta-2}}
The main role of the plasma boost factor can be traced by turning off the $\beta$ in the ring model. The blue-crossed-dashed lines in figure \ref{Ring-Deboosting-Delensing} presents the $\angle \beta_2$ in the absence of the boost factor. From the plot, it is inferred that in MAD simulations the deboosted lines generally follow the main trends in the $\angle \beta_2$, as is shown with green-star-dashed lines. SANEs on the other hand deviate slightly from the main trend at low-retrograde spins, while they show a more reasonable behavior at higher spin cases.
In conclusion, while the plasma boost is one of the players in driving the $\angle \beta_2$, it is not the key driver!
\begin{figure*}
\center
\includegraphics[width=0.99\textwidth]{phase_Combined_Deboost_Delens.pdf}
\caption{The impact of the plasma boost and the lensing on the phase of \texorpdfstring{$\beta_2$}{beta-2}. Doppler boosting and lensing both have mild effects on $\angle \beta_2$, but do not drive its evolution with spin. }
\label{Ring-Deboosting-Delensing}
\end{figure*}
\subsubsection{Impact of gravitational lensing on \texorpdfstring{$\beta_2$}{beta-2}}
Next, we analyze the influence of the gravitational lensing on the EVPA ticks by scaling the mass down by a large factor, in our case by a factor of 1000, and scaling up all of coordinates by the same factor in order to preserve the angular size of the image. By placing emission at large radii in gravitational units, the impact of lensing is removed completely, altering the observed intensity and polarization by changing the angle of emission of geodesics that ultimately land at the observer screen. The impact of lensing is necessarily greatest in high-inclination models, while here we consider only nearly face-on models. Among these low inclination models, these changes will have greater impact in models with large fluid velocities (where Doppler effects increase angular dependence of emitted intensity) and in models with larger variation in $\vec{k} \times \vec{B}$ across the image.
The plus-grey-dashed line in Figure \ref{Ring-Deboosting-Delensing} illustrates the impact of delensing on $\angle \beta_2$. From the plot one can infer that, in MAD retrograde and low prograde spins, the delensed lines lie very close to the full ring models while the high spin prograde cases show a substantial deviation from the original ring model. Furthermore, the delensed cases in SANE simulations follow the same trends as in deboosted ones meaning that both of these effects are not the main drivers in $\angle \beta_2$.
\subsubsection{Influence of magnetic field geometry on the \texorpdfstring{$\beta_2$}{beta-2}}
Having quantified the impact of the plasma boost and the gravitational lensing, here we briefly mention the role of the magnetic field geometry in driving the ticks of the EVPAs. As already stated above, although we can not turn off the magnetic field, the small deviation seen in $\angle \beta_2$ from its true value in the deboosted and delensed cases demonstrates that the magnetic field plays an important role in driving the ticks of the EVPAs.
\begin{figure*}
\center
\includegraphics[width=0.99\textwidth]{Bi-B_20-160.pdf}
\includegraphics[width=0.99\textwidth]{Vi-V_20-160.pdf}
\caption{(Top) the $|B_{i}/B|$ vs the BH spin, (bottom) $|V_{i}/V|$ as a function of the BH spin for MAD vs the SANE simulation at the location of the emission for $R_{\mathrm{high}}=20$ (filled-solid lines) as well as $R_{\mathrm{high}}=160$ (empty-dashed lines). Evidently, the $r$ and $\phi$ field's components are dominant over the $\theta$ components for MAD simulations and are nearly the case for SANE simulations as well. }
\label{B-V-field-amp}
\end{figure*}
\begin{figure*}
\center
\includegraphics[width=0.99\textwidth]{Br-Bi_20-160.pdf}
\includegraphics[width=0.99\textwidth]{Vr-Vi_20-160.pdf}
\caption{(Top) the $\angle{(|B_{i}/B_{r}|)} \equiv \arctan{(|B_{i}/B_{r}|)}$
vs the BH spin, (bottom) $\angle{(|V_{i}/V_{r}|)} \equiv \arctan{(|V_{i}/V_{r}|)}$ with $i = (\phi, \theta)$ as a function of the BH spin for MAD vs the SANE simulation at the location of the emission. }
\label{B-V-field-angle}
\end{figure*}
\subsection{Probing BH spin from plasma quantities} \label{B-V-spin-BH}
Having inferred the peak location of the emission, here we infer the magnetic and the velocity fields at the emission location and look for any possible trends with the BH spin. The choice of the B and V fields is owing to the fact that these are potential observables. Therefore, it is informative to connect their behavior to the BH spin in a hope that futuristic observations, such as the next generation of the EHT(ngEHT), might measure them.
Figure \ref{B-V-field-amp} presents the absolute value of the normalized components of the magnetic field (top row) as well as the velocity field (bottom row) for our Fiducial model (solid-lines) as well as the Faraday Thick case (dashed-lines). From the plot, it is evident that the radial and azimuthal components of the B and V fields show a clear trend with the BH spin. On the contrary, the polar component shows a much smoother behavior. Furthermore, in MAD simulations, this trend is not sensitive at all to the electron temperature, while in SANE simulations there is a very little dependence on the electron temperature in prograde spins. Consequently, we conclude that the combination of the B and V fields at the emission location might be very informative in constraining the BH spin.
Figure \ref{B-V-field-angle} presents the $\angle{(|B_{i}/B_{r}|)}$ (top row) and $\angle{(|V_{i}/V_{r}|)}$ (bottom row) with $i = (\theta, \phi)$ as a function of the BH spin. In each row, the left(right) panel shows the MAD(SANE) models. The solid (dashed) lines show the Fiducial (Faraday thick) cases. There is a clear trend of the aforementioned quantities with the BH spin. The trend is clearer for the azimuthal component than the polar one. Both MAD and SANE simulations show similar behavior for each of the above quantities. For instance, in both cases $\angle{(|B_{\phi}/B_{r}|)}$ has a turn over behavior in which the angle is first decreasing and then is enhancing in the prograde regime, though the exact turn over point is not the same in MAD and SANE simulations. $\angle{(|V_{\phi}/V_{r}|)}$, on the other hand, establishes an enhancing pattern in both cases, though the slope of the enhancement is not the same in MAD and SANE.
\subsection{Impact of Faraday Rotation} \label{FR-impact}
As linear polarization travels through a magnetized plasma, Faraday rotation shifts the EVPA by an amount depending on the intervening density, temperature, and magnetic field. This effect could significantly impact $\angle \beta_2$ for two reasons. First, Faraday rotation imprints the line-of-sight direction of the magnetic field, rotating ticks counterclockwise if the field is pointed towards the observer and clockwise if the field is pointed away, which directly impacts $\angle \beta_2$. Second, large Faraday depths can lead to depolarization/scrambling, both along the line-of-sight and between neighboring regions. Our analytic ring model does not incorporate Faraday rotation, and thus it is important to determine to what extent it can impact our results.
To directly assess the affects of Faraday rotation, we compute images with Faraday rotation switched off (setting the coefficient $\rho_V=0$) for each model. After computing $\angle \beta_2$ for images with Faraday rotation switched off and comparing with the images with Faraday rotation switched on as normal, we plot the distribution of shifts in $\angle \beta_2$ induced by Faraday rotation in \autoref{fig:beta_offset_20_1}.
The blue lines show the Fiducial models, while the red lines present the Faraday Thick cases. For most models in the Fiducial set (and all of the MADs), we find that the impact of Faraday rotation is small, typically shifting $\angle \beta_2$ by roughly 10 degrees. For most of the SANEs in the Fiducial set, this effect can be more significant. However, much of this can be explained by the fact that $|\beta_2|$ is low (written on the top right of each panel), and thus is not carrying much information to begin with.
\begin{figure*}
\center
\includegraphics[width=0.99\textwidth]{beta2OffsetDistributions.pdf}
\caption{For each of the models, we compute the shift in $\angle \beta_2$ due to Faraday rotation and here plot the probability distribution of these shifts. At the top of each panel, we also write the average amplitude of $\beta_2$ to show how important the mode is for each model. The text in each panel quotes 16th, 50th, and 84th percentiles for these shifts. For models where $\langle | \beta_2 | \rangle$ is significant ($\gtrsim 0.1$), we find that these shifts are modest, demonstrating that Faraday rotation typically only has a small impact on $\beta_2$ for these models. However, Faraday rotation can cause a much greater shift if SANEs and our Faraday Thick models. We find an interesting bias induced by the assumed direction of the magnetic field. Retrograde models are preferentially shifted towards more positive values, while prograde (and spin 0) models are shifted towards more negative values due to the assumption that the vertical magnetic field is aligned with the outer disk angular momentum, which is reversed by construction in our retrograde models.}
\label{fig:beta_offset_20_1}
\end{figure*}
We find an interesting pattern in the shifts due to Faraday rotation that differs between the prograde and retrograde models: retrograde models are preferentially shifted toward more positive values of $\angle \beta_2$ while prograde models are preferentially shifted toward more negative values. This pattern is consistent with a bias induced by the assumed direction of the vertical magnetic field, aligned here with the disk angular momentum on large scales. This is discussed in more detail in \autoref{sec:flip_b}.
In summary, we find that Faraday rotation fortunately usually does not randomize $\angle \beta_2$, even in some severely Faraday Thick models. However, it can impart a systematic shift in the distributions. This shift is small, approximately $10^\circ$ for our Fiducial MAD models, but can potentially be much more significant for Faraday Thick and SANE models. We find an interesting signature of the polarity of the magnetic field that we discuss further in \autoref{sec:flip_b}.
In the set of Fiducial simulations considered in this paper, the poloidal field direction is arbitrarily assumed to be parallel with the BH spin. The field direction could equivalently have been oriented in the opposite direction without affecting the evolution of the GRMHD. Consequently, any image library including only poloidal fields aligned with the BH spin vector is incomplete.
\section{Conclusions} \label{conclusion}
We have performed an in-depth exploration of the origin of the
``twistiness'' of the EVPAs, quantified by the $\angle \beta_2$, in simulated, time-averaged polarized images of M87*. We used a simple ring model to take into account different contributions including the plasma Doppler boosting, gravitational lensing and magnetic field geometry, in driving the ticks of EVPAs. We inferred the main location of the emission in various GRMHD simulations and read the magnetic and velocity fields at the emission location as key ingredients in our geometrical ring model. Our results can be summarized as follows:
$\bullet$ Comparing the geometric ring model with the GRMHD simulations, it is inferred that MAD models in general provide a better agreement with the ring model than the SANE cases.
$\bullet$ The Fiducial case shows a higher level of agreement than the Faraday Thick models, as expected, owing to the fact that the Faraday rotation is more important in the latter case than the former one.
$\bullet$ $\angle \beta_2$ seems to be directly linked to the BH spin, therefore it may be possible to use the twistiness of the ticks of the linear polarization to the infer the BH spin.
$\bullet$ Our analysis showed that among the drivers of the ticks of the EVPAs, the plasma boost and gravitational lensing provide a sub-dominant contribution in determining $\angle \beta_2$. Consequently, the magnetic field geometry predominantly drives the ticks of the linear polarization.
$\bullet$ We have shown that there is a trend in the normalized amplitude of the radial and azimuthal components of the magnetic and velocity fields at the emission location with the BH spin. This is encouraging, as any future measurement of the magnetic field and the plasma velocity might be very informative about the BH spin. Consequently, we propose to use the next generation of the EHT (ngEHT) to look for the BH spin through a measurement of the B and V fields at the emission location.
$\bullet$ We found that the impact of Faraday rotation on $\angle \beta_2$ is small for our Fiducial models. However, we noticed an interesting bias induced by the alignment vs anti-aligned of the vertical magnetic field direction with the BH spin. This bias becomes much more significant in the Faraday Thick models, which have relatively cooler electrons and increased Faraday depths compared to the Fiducial case. Future studies using libraries of model images from GRMHD should also include models where the magnetic field direction is flipped, which fortunately does not require additional GRMHD simulations.
$\bullet$ Although we considered a wide range of models in this paper, we did not explore the impact of different initial conditions on trends in $\angle \beta_2$. Higher resolutions could also qualitatively alter the flow when the plasmoids form. Finally, different emission models including non-thermal models, positrons and the tilted disk models may also contribute in changing the results. We leave further explorations of the above cases to a future study.
\section*{Data Availability}
Data directly corresponded to this manuscript and the figures is available to be shared on reasonable request from the corresponding author. The ray tracing of the simulation done in this work was performed using the {\sc ipole} \citep{Moscibrodzka&Gammie2018}. We have used the library of {\sc iharm} simulations by \cite{GammieIHARM2003,2021JOSS....6.3336P} from the standard library of 3D time-dependent GRMHD simulations performed in \citet{PaperV,PaperVIII}.
\section*{acknowledgement}
It is a great pleasure to thank Peter Galison and Michael Johnson for very fruitful conversations. Razieh Emami acknowledges the support by the Institute for Theory and Computation at the Center for Astrophysics as well as grant numbers 21-atp21-0077, NSF AST-1816420 and HST-GO-16173.001-A. We thank the supercomputer facility at Harvard University where most of the simulation work was done. GNW gratefully acknowledges support from the Institute for Advanced Study. ARR and KC acknowledge support by the National Science Foundation under Grant No. OISE 1743747. RJA acknowledges the Future Faculty Leaders Postdoctoral Fellowship. This research was made possible through the support of grants from the Gordon and Betty Moore Foundation and the John Templeton Foundation.
Dominic Chang acknowledges the support of the Black Hole Initiative at Harvard University, which is funded by grants from the John Templeton Foundation and the Gordon and Betty Moore Foundation to Harvard University. This work was also supported by the National Science Foundation grants AST 1935980 and AST 2034306 and the Gordon and Betty Moore Foundation (GBMF-5278). The opinions expressed in this publication are those of the author(s) and do not necessarily reflect the views of the Moore or Templeton Foundations. Freek Roelofs was supported by NSF grants AST-1935980 and AST-2034306. I. Mart\'i-Vidal acknowledges support from the GenT program of Generalitat Valenciana (CIDEGENT/2018/021) and MICINN Research Project PID2019-108995GB-C22.
\textit{Software:} matplotlib \citep{2007CSE.....9...90H}, numpy \citep{2011CSE....13b..22V}, scipy \citep{2007CSE.....9c..10O}, seaborn \citep{2020zndo...3629446W}, pandas \citep{2021zndo...5203279R}, h5py \citep{2016arXiv160804904D}.
|
{
"timestamp": "2022-10-05T02:02:45",
"yymm": "2210",
"arxiv_id": "2210.01218",
"language": "en",
"url": "https://arxiv.org/abs/2210.01218"
}
|
\section{Introduction}
\label{sec:intro}
A handful of fast-moving pulsars have been seen to have narrow X-ray structures (`filaments') extending from the pulsar point source at large angle to the proper motion axis, itself often marked by a Pulsar Wind Nebula (PWN) trail. The first discovered, and arguably most spectacular, is that associated with PSR B2224+65. This pulsar has a very large proper motion $\mu = 194.1 \pm 0.2$\,mas/y, which at its VLBI-measured $0.83^{+0.17}_{-0.10}$\,kpc parallax distance \citep{Deller2019} implies a highly supersonic $v_{\rm PSR}=765$\,km/s. This leads to the formation of its remarkable H$\alpha$ bow shock, `The Guitar Nebula' \citep{CRL1993}, which has a very small $\sim 0.1^{\prime\prime}$ standoff angle, and a long trail forming the neck and body of the Guitar. Projecting from near the pulsar at $\sim 115^\circ$ to its proper motion is an X-ray filament, with a variable width of $\sim 20^{\prime\prime}$ and length $\sim 2.5^\prime$. It has a sharp leading edge, in the direction of the pulsar motion with surface brightness trailing off behind.
In the picture sketched by \cite{Bandiera2008} and explored numerically by \citet{2019MNRAS.485.2041B} and \citet{2019MNRAS.490.3608O}, pulsar filaments are created by multi-TeV pulsar $e^\pm$ leaking out near the bow shock apex and escaping to external ISM field lines.
Electrons whose gyroradius $r_c$ approaches or exceeds the standoff distance $r_0= [{\dot E}/(4\pi \mu m_p n_0 c v_{\rm PSR}^2)]^{1/2}$ may escape to the filaments. Small $r_0$ requires some combination of low pulsar $\dot{E}$, high velocity $v_{\rm PSR}$, and high ambient ISM density $n_0$. The presence of an H$\alpha$ bow shock in B2224 (implying high ISM density), as well as its large transverse velocity seem to support this picture.
In \cite{deVries2022}, we argued that the morphology of the filament associated with PSR J2030+4415 can be explained by a variable particle injection rate: the H$\alpha$ morphology suggests a temporary decrease in the standoff distance, subsequently enabling enhanced particle injection into the ISM over a period of approximately a decade. In order to connect the properties of the X-ray filament to the level of particle injection, multi-epoch H$\alpha$ bow shock observations are crucial as they allow for direct measurement of $r_0$ and provide important clues to fluctuations in $\dot{E}$ or $n_0$ at earlier times. The Guitar, which has been observed several times by both \textit{Chandra} and \textit{HST} over a period of more than 25 years, thus provides us with a unique opportunity to witness the time evolution of a pulsar filament.
The filament of B2224 has been the subject of three previous \textit{Chandra} ACIS exposures in 2000, 2006 and 2012. Since there were significant changes between these epochs, we have collected a new, deeper ACIS exposure to provide a fiducial structure and context for the earlier observations. The evolution and X-ray spectral parameters give information about the multi-TeV $e^\pm$ injection which lights up the filament. Concurrent with the new epoch of X-ray observations, we have obtained a new \textit{HST} ACS/WFC H$\alpha$ image of the apex of the nebula.
\begin{figure*}[b]
\centering
\vskip -1cm
\includegraphics[width=\textwidth]{B2224figs/CXO_PS2r_Ha_comp3.pdf}\\
\caption{Overview of the Guitar/filament complex in the most recent \textit{HST} and \textit{Chandra} epochs. Red: 2020 {\it HST} ACS/WFC H$\alpha$, green: PanSTARRS2 $r$, blue: 2021 {\it CXO} 1-5\,keV X-rays. The pulsar point source lies at the tip of the H$\alpha$ nebula. Filament X-ray emission extends primarily to the right (NW). This has a sharp leading edge and extension behind. The Guitar `body' shows faintly in the H$\alpha$ in the lower half of the image.}
\label{fig:largescale}
\end{figure*}
\begin{figure*}[h]
\centering
\vskip -3cm
\includegraphics[width=7 in]{B2224figs/Guit_Ha_IFUstrip.pdf} \\
\caption{GMOS-N IFU H$\alpha$ velocity channel images, covering $5.5^{\prime\prime} \times 6.1^{\prime\prime}$. The combined IFU image from 2016 is shown in the middle panel. This is flanked by velocity slices (central velocity, in km/s, at upper right in each frame), with the H$\alpha$ limb as a red outline, for comparison. The oval region near the apex provides the line spectrum shown in Figure \ref{fig:IFUspec}.}
\label{fig:IFUchan}
\end{figure*}
\section{Observations and Data reduction}
\label{sec:data}
\subsection{Chandra Observations}
\begin{table}
\begin{flushleft}
\caption{Overview of B2224 \textit{CXO} observations used in this paper. The `Aim' column indicates aimpoint on the ACIS-I or ACIS-S array. `Exp' lists the exposure times in kiloseconds, after filtering out periods of high background.}
\setlength{\tabcolsep}{3pt}
\begin{tabular}{cccc|cccc}
\hline \hline
Date & Obs & Aim & Exp & Date & Obs & Aim & Exp \\
& & & [ks] & & & & [ks] \\ \hline
2000-10-21 & 755 & S& 48.8 & 2021-04-21 & 24433 & I & 25.7 \\
2006-08-28 & 6691& S& 10.0 & 2021-04-23 & 24431 & I & 25.7\\
2006-10-06 & 7400& S& 36.6 & 2021-04-25 & 24429 & I & 24.5\\
2012-07-28 & 14467& S& 14.6& 2021-07-04 & 24428 & I & 29.7\\
2012-07-29 & 14353& S& 34.6 & 2021-07-25 & 24427 & I & 24.7\\
2012-08-01 & 13771& S& 49.2 & 2021-10-09 & 24430 & I & 29.7\\
2021-02-19 & 24437 &I& 24.7 & 2021-10-20 & 23537 & I & 57.2\\
2021-03-14 & 24434 & I &29.5 & 2021-11-14 & 24432 & I & 29.6\\
2021-03-15 & 24435 &I& 14.6 & 2022-02-21 & 24426 & I & 20.9\\
2021-03-16 & 24992 &I & 14.9 & 2022-02-24 & 26336 & I & 18.0 \\
2021-04-03 & 24436 & I & 24.3 \\ \hline
\end{tabular} \\
\label{tab:ChandraObs}
\end{flushleft}
\end{table}
The Guitar, at its high Northern declination, requires short dwell times for the thermal health of {\it CXO}. Thus we obtained fifteen $15-60\,$ks visits between 2021 February 19 and 2022 February 24 to collect 393.8 \,ks of exposure. For all observations we used the I3 chip of ACIS-I array, with the aimpoint positioned so that the full filament was covered at any roll angle. An overview of the new and archival observations is given in Table \ref{tab:ChandraObs}. In addition to the 2021-2022 epoch of 393.8 ks, we re-analyze the three archival epochs: 2000.89 (48.8ks total, Ep1), 2006.80 (46.5 ks total, Ep2), and 2012.66 (98.4 ks total, Ep3).
All data were reprocessed with the standard CIAO reprocessing tools, using CIAO 4.12 and CALDB 4.9.1. We performed a relative astrometric correction by using \textit{wavdetect} on the aimpoint chip of each observation (S3 for the archival epochs, I3 for the latest epoch) and then using \textit{reproject\_aspect} to minimize the point source offsets between observations. ObsID 23537 was used as the reference observation, because it has the longest exposure time in the new epoch. The pulsar was excluded from the point source list, because its large proper motion makes it unsuitable for astrometry. For most ObsIDs, at least 4 sources could be used for registration. However the degraded soft X-ray response of ACIS and the short exposure time in the later observations (most notably 24435, 24436, 24992, and 26336) combined with the lack of large numbers of bright field stars means that for these obervations only 2-3 matching sources could be found. The bright source directly NW of the PSR unfortunately decreased in brightness over the course of 2021, making this source difficult to use for astrometry in the later observations of the 2021 epoch as well. We estimated the error on the frame registration from the RMS residuals after source matching, and summed the errors of individual frames weighted by exposure time to find the error on the relative astrometric correction in each epoch. We find $1 \sigma$ errors of 0.08, 0.12, 0.11, and 0.16 arcsec for the 2000, 2006, 2012, and 2021-2022 epochs respectively. After the astrometric correction, we combined the event files for each epoch and generated $1-5$\,keV exposure maps using a power law with $\Gamma=1.5$ (appropriate to the PWN emission, see \S3.3) as an input energy weighting, with the tool \textit{merge\_obs}.
In our X-ray analysis, we compare the exposure-corrected data from the S and I chips, which have significantly different particle background levels. We therefore estimated the particle background contribution by retrieving the ACIS `stowed' background maps from the calibration database, and scaling them by the number of 9.5-12\,keV counts of the observation in question (no bright sources were present to contribute significant photon counts to this band). The scaled backgrounds were subtracted from the data before making the exposure-corrected image for each epoch.
\subsection{New {\it HST} Apex Image}
\label{sec:HST}
To probe the current state of the bow shock we obtained a new {\it HST} ACS H$\alpha$ image of the nebula apex (the `head' of the Guitar) under Program 16426. This is a challenging observation, since, although the head is the brightest portion of the nebula, its surface brightness is still low. And while the ACS/WFC has the highest H$\alpha$ sensitivity of the present {\it HST} cameras, at low light levels it suffers severely from a degraded Charge Transfer Efficiency (CTE). Happily at $DEC=+65^\circ$, the Guitar lies far enough North to be occasionally in the Continuous Viewing Zone and CVZ observation were kindly granted for the three awarded orbits by {\it HST}, allowing much longer exposures, and greater photoelectron count per pixel at readout, than would otherwise be available. In the end we were able to schedule five 2910\,s F658N exposures (and two 338\,s F625W frames for continuum monitor and subtraction) on 2020 November 8 (MJD 59161). With few exposures we also reduce the total read-noise cost of the observation but slightly decrease the CR rejection efficiency. The second mitigation is to place the Guitar apex near the WFC1-CTE position, where the number of row transfers is minimal, decreasing CTE degradation. The cost is that WFC field of view is cropped closely around the apex, decreasing the number of upstream field star detections for registration and context. In addition, the geometrical distortions are largest near the array corners, such as the CTE1 position. Happily, at the observation epoch the default roll angle placed the body of the Guitar farther on to the WFC array. Its surface brightness is very low so that the only useful measurements of the body at {\it HST} resolution are the limb position in some of the brighter areas. Nevertheless it is gratifying to detect the whole structure (Figure \ref{fig:largescale}).
In the end these mitigation measures were successful and we have obtained the best-ever image of the Guitar head. Since the pulsar had moved $2.74^{\prime\prime}$ since the last {\it HST} exposure (\S3.1), there are quite substantial changes. All the {\it HST} data used in this paper can be found in MAST:\dataset[10.17909/ytdx-cf49]{http://dx.doi.org/10.17909/ytdx-cf49}.
\subsection{Archival IFU apex data}
Inspecting the Gemini archive, we found unpublished GMOS-N IFU observations of the Guitar nebula taken on 2008 June 10 and July 3 (Program GN-2008A-Q-3, van Kerkwijk, PI). The observations included $4\times 3863$\,s exposures with the IFU-2 mask, the B1200 grating and RG610 filter, covering the head of the nebula with a $0.2^{\prime\prime}$ fiber grid. A few 300\,s direct acquisition images using the G0310 H$\alpha$ filter and associated calibration files were also obtained. Conditions were good, meeting the 20\% best seeing criterion.
To improve S/N on this faint nebula, the GMOS-N detector was binned $2\times2$ during this observation. As it happens, the $2\times$ spatial binning left the fiber traces poorly resolved. This is generally not recommended and, indeed, meant that the Gemini pipeline software failed to trace the spectra and extract the data. To complete reductions, we therefore had to mark the 1000 fiber spectra positions by hand near the position of the H$\alpha$ feature in each spectral exposure flat field image and force a low-order trace centered on these fiber centroids. Importing these traces to the arcs we were able to use line features (again initially identified by hand) to establish a good wavelength solution. The traces applied to the target integrations could then be used to extract and calibrate the 1-D spectra. These were spatially flattened using sky lines and assembled into position-velocity cubes. The final weighted combination of these data gave a data cube with a spatial scale of $0.1^{\prime\prime}$/pixel and a wavelength scale of 0.4729\AA/image plane (21.6 km/s/image plane). The spectral resolution of 1.23\AA (56\,km/s) was confirmed by measuring sky lines and the $0.6^{\prime\prime}$ FWHM spatial resolution of the pre-images is maintained in the data cubes, as indicted by the width of the narrow H$\alpha$ limb $\sim 2.5^{\prime\prime}$ behind the apex.
\begin{figure}
\centering
\includegraphics[width=3.2in]{B2224figs/Guit_apexv.pdf} \\
\caption{Velocity profile just behind the nebula apex (oval in Figure \ref{fig:IFUchan}). A reflected version of the profile (red) shows that it is centered at $\sim -12$\,km/s. The high velocity $|v|=150-300$\,km/s wings (blue points, shifted from the red profile to match original apex profile wings) show a slight additional blue shift. }
\label{fig:IFUspec}
\end{figure}
We find that the nebula is best detected in low velocity channels near the nebula limb, as expected from neutral excitation in the post shock gas (and by projection effects). Larger velocities are found principally right behind the nebula apex, where charge exchange allows accelerated post-shock protons to obtain electrons and emit H$\alpha$. The line spectrum from a region just behind the apex is shown in Figure \ref{fig:IFUspec}. The similarity of the channel maps red and blue of the central velocity supports the inference from prior bow shock image fits that the pulsar space velocity lies close to the plane of the sky. Focusing on the velocity extrema we see an offset of $-32-(-12)=-20$\,/km/s for the wing components peaking at $\sim \pm 250$\,km/s, giving $\theta_v \approx {\rm arctan}(-20{\rm km/s/250 km/s})\approx 5^\circ$ out of the plane of the sky.
Assuming approximate axial symmetry, we can check these velocities by examining the transverse expansion of the head boundary in the HST images. By comparing the 2020 and 2006 HST images we can see that across the bulk of the head region, starting $5^{\prime\prime}$ back from the 2020 apex, the lateral expansion is $\approx 0.3^{\prime\prime}$ over 14y or $\approx \pm 85 {\rm km/s}$ at $d=0.83$\,kpc, in good agreement with the brightest emission in the channel maps. It is a bit more difficult to measure the transverse expansion corresponding to the elliptical apex region marked in Figure \ref{fig:IFUchan}, but comparing the 2008 GMOS-N pre-image with the 2006 HST frame, we see transverse expansion of $\sim 0.1^{\prime\prime}$ over 1.7y or $\sim \pm 230 {\rm km/s}$, in reasonable agreement with the wing component speeds in Figure \ref{fig:IFUspec}.
\section{Multi-Epoch Comparison}
Over the past 25 years we now have 4 epochs of observation each with {\it HST} in H$\alpha$ and {\it CXO} in X-rays (Table \ref{tab:ChandraObs}). Other ground-based H$\alpha$ images exist, but the very small angular scale of the bow shock stand-off requires {\it HST} resolution for serious study of the evolving morphology. Comparison of the shock between these epochs gives important clues to the nature of the filament.
\begin{figure*}
\hspace*{-5mm}\includegraphics[scale=0.5]{B2224figs/Guit_opt_seq.pdf}
\vskip -13.2cm\hskip 27mm \includegraphics[scale=0.82]{B2224figs/Guit_X_ev_bin2.pdf}
\vskip -0.4cm
\caption{1994-2021 Guitar/Filament Evolution. Left panels show four $22^{\prime\prime}\times 21^{\prime\prime}$ cutouts from the {\it HST} H$\alpha$ images (1994, 2001, 2006, 2020). The top panel has the pulsar positions at the four {\it HST} and four {\it CXO} epochs marked on lines representing 50y ($9.7^{\prime\prime}$) of proper motion. The lower panels have the outline of the 2020 {\it HST} H$\alpha$ limb marked, for comparison. The right panels show the filament evolution over the four {\it CXO} epochs ($4^\prime \times 1^\prime$ cutouts). The filament leading edge from the 2021 epoch is marked by the blue line, while the red arrow in the top and bottom panels shows the 50y proper motion, and a stationary background source is marked for reference.
}
\label{fig:4ep}
\end{figure*}
\subsection{Optical Evolution}
{\renewcommand{\arraystretch}{1.15}
\begin{table}
\centering
\caption{The standoff distances (in mas) measured for each \textit{HST} epoch, for thin and wide shock models; shown are the median values from the posterior distributions, with the 14th and 86th percentiles as the errors}. The estimates of \cite{Chatterjee2004} and \cite{Ocker2021} are also shown.
\begin{tabular}{c c c c c }
\hline \hline
Epoch & $r_{0,\rm{thin}}$& $r_{0, \rm{wide}}$& $r_{0,\rm{O2021}}$& $r_{0, \rm{CC2004}} $\\ \hline
1994 & $86_{-9}^{+12}$ & $94_{-7}^{+11}$ & $77 \pm 4$ & $120 \pm 40$ \\
2001 & $116_{-15}^{+16}$ & $112_{-14}^{+14}$ & $110 \pm 10$ & $100 \pm 40$ \\
2006 & $97_{-4}^{+4}$ & $93_{-3}^{+3}$ & $94 \pm 6$ & \\
2020 & $96_{-2}^{+4}$ & $92_{-2}^{+3}$ & \\ \hline
\end{tabular}
\label{tab:standoff}
\end{table}}
Comparing the optical images at the left hand side of Figure \ref{fig:4ep} with the line marking the limb of the 2020 image we see that as the pulsar advances, the perpendicular expansion is rapid at the apex but slows by a few arcsec behind. This is also visible in the IFU data cube. The general structure of the Guitar head is best seen in our new high S/N 2020 image; it is roughly symmetric, with indentations, especially a `pinch' $\sim 7^{\prime\prime}$ behind the pulsar, and higher limb brightness regions, e.g.\,$\sim 3^{\prime\prime}$ and $\sim 6^{\prime\prime}$ behind the pulsar. Thus the geometry of the bow shock apex and its expansion rate must vary. The most extreme illustrations of this are, of course, the apparently closed bubble of the Guitar head and the double cavity of the Guitar body itself. The approximate bi-lateral symmetry of the overall nebula indicates either that the central pulsar wind varies or that the perturbations producing these structures have a coherence scale substantially larger than the width of the nebula. However, there is also significant right-left asymmetry, which implicates instabilities in the shock flow or variations in the external medium on the few arcsec scale of the head width.
The spectrum of such perturbations have recently been explored by \citet{Ocker2021}, who, following \citet{Chatterjee2004} discuss apparent changes in the bow shock standoff distance in the previous three {\it HST} epochs. These $\theta_0$ were, however, estimated by marking the apparent bow shock limb by hand and then fitting to these marked points. This, of necessity, introduces substantial subjectivity. We therefore have sought to fit \citet{Wilkin2000} apex models directly to the {\it HST} images. This model computes the locus of the contact discontinuity, which for a `thin' shock marks the H$\alpha$ front. In practice post-shock pressure widens the structure; the H$\alpha$ emission standoff should be $\sim 1.3 r_0$ at the apex and this factor should grow downstream. A simple approximation increases the transverse scale by $1.25\times$ \citep{2014ApJ...784..154B} for a `wide' shock model. For the first three epochs we were able to register the frames to \textit{Gaia} stars to determine the position of the pulsar in the frame with an $1 \sigma$ uncertainty of 0.07, 0.07, and 0.06 pixels respectively. For 2020, however, WFC corner distortions defeated such registration, so we have let the pulsar position adjust over a 1 pixel ($\sim 50$mas) range. We used the affine invariant Markov Chain Monte Carlo (MCMC) algorithm of \citet{Goodman2010}, implemented through the python package {\sc emcee}, to sample the likelihood function and obtain posterior distributions for the standoff distance in each epoch. The MCMC routine was run using 50 walkers and 5000 steps for each walker. In order to run MCMC efficiently, we first performed a maximum likelihood analysis, and started the walkers with initial parameters close to the best-fit parameters. Upon visual inspection of the chains, we further excluded the first 500 steps of each walker to `burn in' the chains, ensuring convergence. We calculate the integrated autocorrelation time $\tau_f$ to be $
\sim 50$ steps, meaning that the walker length of 4500 steps should be sufficient.\footnote{In the {\sc emcee} documentation on autocorrelation analysis (\url{https://emcee.readthedocs.io/en/stable/tutorials/autocorr/)}, it is suggested that each walker should have a length of $>\,50\tau_f$ steps, so that enough independent samples can be obtained to yield accurate results.}.A visual comparison of the data and the Wilkin thin shock model for each epoch is shown in Figure \ref{fig:apexfit}. The posterior distributions for $r_0$ are plotted in Figure \ref{fig:posteriors}, with values listed in Table \ref{tab:standoff}. For the 2020 epoch, the position uncertainty from the posterior (the 14th and 86th percentiles of the distribution) is $\approx 0.15$ pixel ($\sim 8 $\,mas) in both the $x$ and $y$ directions.
\begin{figure*
\includegraphics[width=.95\textwidth]{B2224figs/wilkin_ts.png}
\caption{The Wilkin-model bow shock fits for the 4 different H$\alpha$ epochs. All images are shown in native resolution of $0.05\arcsec$/pixel. The left column shows a cut-out of the bow shock apex for the 4 epochs, using pixels up to $\approx 1^{\prime \prime}$ behind the apex. The 1994 and 2001 epochs have been lightly smoothed for visualization. The middle column shows the Wilkin model, and the rightmost column shows the residual (data-model)$^2$/$\sigma^2$. The red cross shows the location of the pulsar - a free parameter for the 2020 epoch, and referenced to Gaia using a set of reference stars for the other three epochs.}
\label{fig:apexfit}
\end{figure*}
\begin{figure*}
\includegraphics[width=.95\textwidth]{B2224figs/r0_posteriors_2.png}
\caption{The posterior distributions for the standoff distance $r_0$ in each epoch (left to right, top to bottom: 1994, 2001, 2006, 2020. Shown for reference are the estimated standoff distances of \citet{Ocker2021} and \citet{Chatterjee2004}}
\label{fig:posteriors}
\end{figure*}
The \citet{Ocker2021} estimates generally lie within the $r_0$ uncertainty ranges, but have nominal errors much smaller than we find for a direct fit, especially for the 1994 and 2001 data. Alas our more realistic errors mean that direct evidence for $r_0$ variation is poor. The bulk of our uncertainty range suggests that $r_0$ was larger in 2001, but even this result is weak. Additional images of the quality of our new ACS/WFC exposure are needed to probe stand-off variation at the required $\sim 5$mas level.
Nevertheless the head limb shape does suggest that the standoff was small when pulsar was at the position of the head's closed base, $\sim 15.5^{\prime\prime}$ behind the present apex (i.e. in $\sim 1940$). The transition into the head bubble may be similar to the `break-through' inferred for the PSR J2030+4415 H$\alpha$ nebula and filament \citep{deVries2022}. The `pinch' $\sim 7^{\prime\prime}$ back (i.e. in 1985), and the increased limb brightness $\sim 3.2^{\prime\prime}$ behind the apex (in $\sim 2004$) suggest weaker compression events.
\begin{figure}
\includegraphics[width=0.48\textwidth]{B2224figs/guitar_specregions.png}
\caption{Regions used for spectral analysis of the filament in the 2021 \textit{Chandra} epoch. We divided the filament into three main sections: the inner section where the leading edge is sharpest (0--0.7$^\prime$), the middle section where the filament appears to become more diffuse (0.7--1.3$^\prime$) and the outer, most diffuse section where the sharp leading edge has largely disappeared (1.3--2.4$^\prime$). Additionally, the inner and middle sections are divided by the green dashed line into the 'Leading' and 'Trailing' regions. We also identify a `Remnant' region of bright emission around $12\arcsec$ behind the leading edge in the middle section. The red regions show the contours of the Guitar nebula head (solid line) and body (dashed line) in the 2020 \textit{HST} H$\alpha$ image. }
\label{fig:specregs}
\end{figure}
\subsection{X-ray Evolution}
\begin{figure}
\centering
\vskip -3mm
\includegraphics[width=0.49\textwidth]{B2224figs/epoch_fil_lc_v3.png}
\vskip -3mm
\caption{Light-curves of the leading edge ($1^{\prime\prime}$ width) of the inner filament (0--0.7$^\prime$ segment), showing the flux in each epoch and the flux of that same region of the sky in following epochs. The y-axis indicates the 1-5 keV photon surface brightness.}
\label{fig:fil_lc}
\end{figure}
\begin{figure}
\centering
\vskip -3mm
\includegraphics[width=0.49\textwidth]{B2224figs/CF_F_SB.png}
\vskip -3mm
\caption{Light-curves of the inner counter-filament and inner and middle filament sections. Data points have been slightly offset from each other for legibility. The y-axis indicates the 1-5 keV photon flux per arcmin length of filament. The lengths of the inner counter-filament, and inner and middle filament sections are 0.25$^\prime$, 0.65$^\prime$, and 0.68$^\prime$ respectively and fluxes have been integrated across the width of the main filament.}
\label{fig:fil_lc_wide}
\end{figure}
In Figure \ref{fig:specregs} we define several regions useful in describing the filament's spectrum and its evolution.
The $e^\pm$ injection site shifts with the steady pulsar motion, and in Figure \ref{fig:4ep} it is apparent that the filament leading edge marches along with the pulsar, as also noted by \citet{2021RNAAS...5....5W}. Our deeper 2021 exposure provides a much better view of the counter-filament (CF) than earlier epochs. It extends at least $20^{\prime\prime}$ and likely $40^{\prime\prime}$ from the pulsar. Interestingly it does not line up well with the filament leading edge, instead intersecting the proper motion axis some $1.5^{\prime\prime}$ behind the pulsar position. Both it and the filament have substantial curvature near the bow shock. This is likely a field line `draping' effect or field distortion from supra-thermal particles as most clearly seen in the `lighthouse' PWN filament and counter-filament \citep{2016A&A...591A..91P}.
We checked to see if the PWN PSR trail is detected in our deep 2021 image. Using the `head region' of the Guitar (see Figure \ref{fig:specregs}) as an aperture and subtracting similar flanking regions as background, we find an excess of $11\pm 4.5$ counts in the 0.7--5\,keV, range, a marginal $2.5\sigma$ detection. This gives a filament/trail flux ratio $>100$, the largest among known filaments.
In Figure \ref{fig:fil_lc} we measure the surface brightness at the filament leading edge in each epoch and compare the flux in the same aperture in subsequent epochs. In general the region corresponding to the edge shows an initial rapid decrease in surface brightness in the following epoch (see also Figure \ref{fig:4ep}). We infer a rapid change in the electron population as the pulsar moves ahead to the next set of field lines, due to cooling, advection or diffusion. The subsequent brightness decrease, if any, is much smaller. Fortuitously the leading edge was much brighter than usual during the original 2000 epoch, which helped in the filament's discovery. This may be related to enhanced injection around this epoch. For example if $r_0$ decreases, then more pulsar/PWN shock particles have gyroradii exceeding $r_0$, so escape to the filament might increase and the filament surface brightness may temporarily increase. Averaged over the full width the fluxes per unit length seem quite constant (Figure \ref{fig:fil_lc_wide}); although the inner counter-filament appears more prominently in the 2021 image, its flux per unit length remains consistent with that of the filament, within errors.
Although the statistics are limited in the early images, there appear to be changes behind the leading edge. In Figure \ref{fig:4ep} the most notable changes are in the `Middle' section of the filament where the emission spreads behind the leading edge as a shifting ridge. We quantify this trend in Figure \ref{fig:spread}, where fits to Gaussian distributions transverse to the filament show a progressive shift and broadening of the maximum. Note that the integral flux is consistent with constant across the four epochs. A fit to such regions in the `Inner' zone gives similar evolution with nearly identical parameters, but lower statistical significance. We attempt to interpret these results in the conclusions.
\begin{figure}
\centering
\vskip -1.9mm
\includegraphics[width=0.49\textwidth]{B2224figs/fil_modelfits.png}
\vskip -3mm
\caption{Spread of the emission behind the leading edge in the filament middle section across four epochs. The data are well described by a steady shift of the peak behind the leading edge, a steady increase in the width, and a constant integrated flux. The y-axis indicates the 1--5 keV photon surface brightness. Labels indicate the best-fit parameter value (with $1 \sigma$ errors ): $x_{2000}$ and $\sigma_{2000}$ are the peak position and standard deviation of the Gaussian component in 2000 respectively; $\dot{\sigma}$ indicates the increase in $\sigma$ over time; and $\mu$ indicates the shift of the peak away from the leading edge over time.}
\label{fig:spread}
\end{figure}
\subsection{Spectral fits}
We have extracted spectra for the several regions of Figure \ref{fig:specregs} using the standard \textsc{CIAO} tools. To each of the spectra, we have fit a power law multiplied by Galactic absorption, which we have set at $2.7 \times 10^{21}$ cm$^{-2}$. The results of the spectral analysis are shown in Table \ref{tab:specfits}. There are no significant differences in spectral index between the regions. The weak evidence for spectral softening with distance from the pulsar would require much deeper observation for a serious test.
Additionally, we have estimated the magnetic field strength under the assumption of equipartition. For an optically thin region filled with relativistic electrons and magnetic field emitting synchrotron radiation
\begin{equation}
\label{eq:syncB}
B = 46 \left[ \frac{J_{\rm -20}(E_1,E_2) \sigma } {\phi} \frac{C_{1.5-\Gamma}(E_m, E_M)}{C_{2-\Gamma}(E_1,E_2)}\right] ^{2/7} \mu G
\end{equation}
where
\begin{equation}
C_q(x_1,x_2) = \frac{x_2^{q} - x_1^q}{q}.
\end{equation}
$J_{\rm -20}(E_1,E_2) = 4 \pi f_{\rm -20}(E_1, E_2) d^{2}/ V$ is the observed emissivity (in $10^{-20}$\,erg\,s$^{-1}$\,cm$^{-3}$, between $E_1$\,keV and $E_2$\,keV), $\sigma=w_B/w_e$ is the magnetization parameter, $\phi$ the filling factor, and $E_m$ and $E_M$ the minimum and maximum energies, in keV, of the synchrotron spectrum with photon $\Gamma$. We assume that the structures are cylindrical, with diameter set to the observed region width. We list the derived equipartition fields in Table \ref{tab:specfits} for $\sigma=\phi=1$, $E_m=0.01\,\rm{keV}$ and $E_M=10\,\rm{keV}$.
\begin{table}
\setlength{\tabcolsep}{3.5pt}
\caption{Spectral fit results (with $1 \sigma$ errors) for the filament in the 2021 \textit{Chandra} epoch (see Figure \ref{fig:specregs} for the regions). The `Leading' and `Trailing' regions are composed of the front and back halves, respectively of the combined inner and middle regions. B$_{eq}$ was computed assuming cylindrical volumes for each region.}
\centering
\label{tab:specfits}
\begin{tabular}{l l l l l l} %
\hline\hline
Region & Counts &$\Gamma$ &$f_{-15}$\textsuperscript{b}& $\chi^2$/DoF & B$_{eq}$ \\
& & & & & [$\mu G$] \\ [0.5ex] \hline
Inner & $214\pm17$ & $1.31\pm0.16$ & 9.9 &29.3/27 & 13 \\
Middle & $209\pm17$ & $1.37\pm0.17$ & 10.2 & 24.3/24 & 14 \\
Outer & $489\pm32$& $1.58\pm0.15$ & 24.1 & 53.2/48 & 8 \\
CF & $86\pm11$& $1.71\pm0.30$ & 3.5 & 23.8/24 & 17 \\
Leading & $273\pm19$ & $1.39\pm0.14$ & 13.6 & 22.7/33 & 19 \\
Trailing & $154\pm16$ & $1.60\pm0.20$ & 7.1 & 30.5/30 & 17 \\
Remnant & $174\pm19$ & $1.40 \pm 0.27$ & 7.2 & 38.0/33 & 9 \\
\hline
\end{tabular} \\
\leftline{\textsuperscript{a} $N_H$ fixed at $2.7\times10^{21}{\rm cm^{-2}}$.}
\leftline{\textsuperscript{b} $0.5-7\,$keV unabsorbed fluxes in units of $10^{-15}{\rm erg\,cm^{-2}s^{-1}}$.}
\end{table}
\section{Discussion and Conclusions}
The shape of the filament is complex and the epoch-to-epoch changes are subtle. We seek to explain these through a combination of variable particle injection at the moving pulsar, particle flow along field lines, particle diffusion across field lines and possible cooling. In practice cooling is likely not important on the scale of the observed filament since standard synchrotron theory gives a cooling time of
\begin{equation}
\tau \approx 7.6 \times 10^4 E_{\rm keV}^{-1/2} B_{\mu G}^{-3/2} {\rm y}.
\end{equation}
With an observed photon energy of $\sim 2$\,keV and $B_{\mu G} \sim 15$ estimated in \S2.3, we get a cooling time $\tau \approx 930$\,y, so over our four epochs we expect no significant cooling. Since the pulsar moves $\sim 3^\prime$ (twice the size of the Guitar body) in time $\tau$, cooling predicts a fading on this scale. Accordingly, the smaller scale morphology changes must be due to variable injection, advection and diffusion.
In the original \citet{Bandiera2008} picture the $r_c$ relevant for escape was that of the shocked pulsar wind. Since the mean field in that wind increases as $r_0$ decreases, $r_c/r_0$ is essentially constant, and does not control the particle escape; in this picture most bow-shock pulsars should produce filaments and they should do so at all epochs independent of the bow shock size. This does not appear to be the case, since filaments are rare and preferentially associated with pulsars with small $r_0$. Instead we argue that energetic $e^\pm$ are produced via reconnection throughout the shocked pulsar wind and that $r_c$ beyond the contact discontinuity, in the shocked ISM and external medium, controls escaping particle motion. The near-apex external field is modified by the draping effect to have a characteristic curvature radius $r_0$ and thus $r_c/r_0$ in this medium can control which particles move far enough in a gyroradius to encounter different external field orientations, and escape.
The curvature of the filament leading edge implies that the ambient field lines are not completely straight, although the similarity of the edge from epoch to epoch suggests that they are locally approximately parallel. The leading edge is quite sharp. The $e^\pm$ gyroradius $r_c$ in the local field subtends an angle of
\begin{equation}
\theta =r_c/d \approx 26^{\prime\prime} E_{\rm keV}^{1/2} B_{\mu G}^{-3/2} d_{\rm kpc}^{-1}
\end{equation}
for particles producing a peak photon energy $E_{\rm keV}$. For a leading edge field of $20\mu G$ (Table \ref{tab:specfits}) we get $\theta \approx 0.5^{\prime\prime}$ for the filament. This is comparable to the {\it CXO} resolution (but substantially larger than $r_0$). The filament leading edge stays sharp for the inner and middle zones, spreading primarily in the outer zone. This implies that the cross field diffusion coefficient ahead of the leading edge in the ambient ISM is small.
With an estimate of the flow speed $v_{e^\pm}$ along the leading edge, one could use the broadening with distance to get an estimate of this forward diffusion coefficient. Noting that this edge is actually the front reached by particles moving rapidly along a set of field lines, we see that the far filament represents earlier injection, onto field lines behind that connect to the pulsar at its current position. Thus the filament front follows an angle $\theta_f \sim v_{\rm PSR}{\rm cos}\Psi/v_{e^\pm}$ behind the ISM field lines, with the field lines themselves at an angle $\Psi\sim 25^\circ$ to the proper motion. If the filament and counter-filament propagation speeds are equal, we can account for $\Psi$ by comparing the PAs of the two sides; these should differ by $2\theta_f$. In practice this measurement is difficult since the counter-filament is short and the section closest to the bow shock suffers PWN-induced distortion. Very roughly, we estimate $\theta_f\lesssim 2^\circ$, and thus $v_{e^\pm} \approx v_{\rm PSR}{\rm cos} \Psi /\theta_f \gtrsim c/13$.
With small cross-field diffusion, we would expect particles confined to their injection field line and the filament would present an approximately uniform band, shifted increasingly farther from the Guitar axis, since particles on field lines to the rear would have more time to propagate away. This band would have brighter ridges marking times (field lines) of enhanced particle injection and a smooth fading on arcmin scales behind the leading edge due to synchrotron cooling. This is not what we see. Instead the emission behind the leading edge is patchy and seems to evolve on times short compared to the cooling times.
This may be understood if cross-field advection and diffusion increase behind the leading edge. From Figure \ref{fig:spread} we estimate the 2021 surface brightness peak as having position $x_{2021} \approx 12.2^{\prime\prime}$ behind the 2021 leading edge, with bulk motion of $\mu_{\rm ridge} \sim 0.15^{\prime\prime}{\rm y^{-1}}$ and spread of $\sigma(t) \sim [3.0+0.25(t-2000)]^{\prime\prime}$. We can attribute these increased rates to turbulence induced behind the leading edge by the injected particles; this leads to increased scattering and easier cross-field propagation. It then becomes interesting to trace the origin of the ridge that moves through Figure \ref{fig:spread}. With a coordinate increasing normal to and behind the leading edge, we can write the pulsar position at year $t$ as $x_p = \mu_{PSR} {\rm cos}\Psi (2021-t)$. Similarly $x_{\rm ridge} = x_{2021} + \mu_{ridge} (t-2021)$, with the proper motions in arcsec/y. Finally the propagation time between the pulsar and the middle zone $l \sim 75^{\prime\prime} d \sim 1$\, lt-y away is $t_\parallel \approx l/v_{e^\pm} \sim c/v_{e^\pm}$ years. Thus the date for the enhanced injection of the $e^\pm$ that we see in 2021 as a ridge moving through the filament is
\begin{equation}
t_{\rm inj} \approx2021 - x_{\rm r,2021}/(\mu_{\rm PSR} {\rm cos}\Psi+\mu_{\rm ridge}) +t_\parallel .
\end{equation}
From our fit to the ridge evolution we get $t_{\rm inj} \approx 1993_{-16}^{+7} + t_\parallel$, so to identify the moving ridge with particles injected when the pulsar was at the `pinch' in the Guitar head, $7^{\prime\prime}$ behind the apex, in 1985, we would want $\mu_{\rm ridge}$ low in the fit range and $t_\parallel = l/v_{e^\pm}<8 $\, y. Note that $\sigma$ decreases to 0 at $1990_{-10}^{+5}$, so consistent with $\sim 1985$, as well.
It is likely a coincidence that the back-propagation of the ridge brings it nearly parallel with the base of the Guitar head in the 2021 epoch. Although we don't see strong emission at this position in our earlier epochs, those images are shallow, and it is possible that future deep observations will show that this ridge is a permanent feature fixed in space. In that case it would be compatible with the simpler hypothesis that it is the fossil of strong injection at the point the pulsar broke into the head region in $\sim 1940$. More generally the lack of such `fossil' X-ray emission parallel with the Guitar body suggests that when the pulsar was blowing the bubbles corresponding to the body structure, the standoff $r_0$ was large and that little or no $e^\pm$ escape occurred. Thus the Guitar may have had an X-ray filament only since the very compact head region was formed.
Although forward propagation of the pulsar-generated cosmic rays is severely limited at the leading edge, it seems much freer behind, rearranging the injected particles long before they cool. While this means that the filament surface brightness profile is not a simple historical record of injection history, it does offer the opportunity to probe the diffusion of multi-TeV $e^\pm$ through the ISM and, more importantly, their effect, via induced MHD waves, on the local particle propagation. For B2224, injection seems to be effective over the $\sim 20^{\prime\prime}$ region of the Guitar head and neck where the bow shock standoff was evidently small, leading to a wide filament. In contrast, the filament of PSR J2030+4415 stays narrow since the injected period was short and the pulsar covered little distance in this time.
This picture of variable injection may certainly be tested by finding more example filaments, and connecting them with bow shock properties. Numerical simulations can also be useful in determining whether external field-controlled escape is viable or some other peculiarity of small $r_0$ bow shocks, such as enhanced local turbulence or asymmetric reconnection to the external fields, needs to be invoked
The effect of injected $e^\pm$ may be especially important in connection with the recently observed TeV halos around nearby young pulsars \citep{2017Sci...358..911A}. Interesting experiments to probe these effects would be enabled by identifying enhanced filament injection events (plausibly via H$\alpha$ bow shock monitoring) followed by a decade of sensitive X-ray images to observe, via synchrotron emission, the TeV $e^\pm$ pulse propagating and spreading. Such a campaign would be expensive in observation time, but would yield a rich harvest of information of cosmic ray and magnetic field dynamics, spread out before the observer in evolving filament images.
\acknowledgements
We wish to thank the observatory staff who helped in planning the exposures described in this paper, especially Jean Connelly of the CfA for help with {\it CXO} and Alison Vick and Ray Lucas of STScI for help with the ACS/WFC. We also wish to thank Marten van Kerkwijk for advice on the GMOS-N IFU data set.
\smallskip
\vspace{5mm}
MdV and RWR were supported in part by NASA grant G08-19050A, through the Smithsonian Astrophysical Observatory. GGP was supported by NASA grant G08-19050B. OK was supported by NASA grant GO8-19050C and ADAP grant 80NSSC19K0576. Support for this work was provided by the National Aeronautics and Space Administration through Chandra Award Number GO8-19050 issued by the Chandra X-ray Observatory Center, which is operated by the Smithsonian Astrophysical Observatory for and on behalf of the National Aeronautics Space Administration under contract NAS8-03060.
\vspace{5mm}
\facilities{HST(ACS/WFC), Gemini(GMOS-N), CXO}
\section{Introduction}
\label{sec:intro}
A handful of fast-moving pulsars have been seen to have narrow X-ray structures (`filaments') extending from the pulsar point source at large angle to the proper motion axis, itself often marked by a Pulsar Wind Nebula (PWN) trail. The first discovered, and arguably most spectacular, is that associated with PSR B2224+65. This pulsar has a very large proper motion $\mu = 194.1 \pm 0.2$\,mas/y, which at its VLBI-measured $0.83^{+0.17}_{-0.10}$\,kpc parallax distance \citep{Deller2019} implies a highly supersonic $v_{\rm PSR}=765$\,km/s. This leads to the formation of its remarkable H$\alpha$ bow shock, `The Guitar Nebula' \citep{CRL1993}, which has a very small $\sim 0.1^{\prime\prime}$ standoff angle, and a long trail forming the neck and body of the Guitar. Projecting from near the pulsar at $\sim 115^\circ$ to its proper motion is an X-ray filament, with a variable width of $\sim 20^{\prime\prime}$ and length $\sim 2.5^\prime$. It has a sharp leading edge, in the direction of the pulsar motion with surface brightness trailing off behind.
In the picture sketched by \cite{Bandiera2008} and explored numerically by \citet{2019MNRAS.485.2041B} and \citet{2019MNRAS.490.3608O}, pulsar filaments are created by multi-TeV pulsar $e^\pm$ leaking out near the bow shock apex and escaping to external ISM field lines.
Electrons whose gyroradius $r_c$ approaches or exceeds the standoff distance $r_0= [{\dot E}/(4\pi \mu m_p n_0 c v_{\rm PSR}^2)]^{1/2}$ may escape to the filaments. Small $r_0$ requires some combination of low pulsar $\dot{E}$, high velocity $v_{\rm PSR}$, and high ambient ISM density $n_0$. The presence of an H$\alpha$ bow shock in B2224 (implying high ISM density), as well as its large transverse velocity seem to support this picture.
In \cite{deVries2022}, we argued that the morphology of the filament associated with PSR J2030+4415 can be explained by a variable particle injection rate: the H$\alpha$ morphology suggests a temporary decrease in the standoff distance, subsequently enabling enhanced particle injection into the ISM over a period of approximately a decade. In order to connect the properties of the X-ray filament to the level of particle injection, multi-epoch H$\alpha$ bow shock observations are crucial as they allow for direct measurement of $r_0$ and provide important clues to fluctuations in $\dot{E}$ or $n_0$ at earlier times. The Guitar, which has been observed several times by both \textit{Chandra} and \textit{HST} over a period of more than 25 years, thus provides us with a unique opportunity to witness the time evolution of a pulsar filament.
The filament of B2224 has been the subject of three previous \textit{Chandra} ACIS exposures in 2000, 2006 and 2012. Since there were significant changes between these epochs, we have collected a new, deeper ACIS exposure to provide a fiducial structure and context for the earlier observations. The evolution and X-ray spectral parameters give information about the multi-TeV $e^\pm$ injection which lights up the filament. Concurrent with the new epoch of X-ray observations, we have obtained a new \textit{HST} ACS/WFC H$\alpha$ image of the apex of the nebula.
\begin{figure*}[b]
\centering
\vskip -1cm
\includegraphics[width=\textwidth]{B2224figs/CXO_PS2r_Ha_comp3.pdf}\\
\caption{Overview of the Guitar/filament complex in the most recent \textit{HST} and \textit{Chandra} epochs. Red: 2020 {\it HST} ACS/WFC H$\alpha$, green: PanSTARRS2 $r$, blue: 2021 {\it CXO} 1-5\,keV X-rays. The pulsar point source lies at the tip of the H$\alpha$ nebula. Filament X-ray emission extends primarily to the right (NW). This has a sharp leading edge and extension behind. The Guitar `body' shows faintly in the H$\alpha$ in the lower half of the image.}
\label{fig:largescale}
\end{figure*}
\begin{figure*}[h]
\centering
\vskip -3cm
\includegraphics[width=7 in]{B2224figs/Guit_Ha_IFUstrip.pdf} \\
\caption{GMOS-N IFU H$\alpha$ velocity channel images, covering $5.5^{\prime\prime} \times 6.1^{\prime\prime}$. The combined IFU image from 2016 is shown in the middle panel. This is flanked by velocity slices (central velocity, in km/s, at upper right in each frame), with the H$\alpha$ limb as a red outline, for comparison. The oval region near the apex provides the line spectrum shown in Figure \ref{fig:IFUspec}.}
\label{fig:IFUchan}
\end{figure*}
\section{Observations and Data reduction}
\label{sec:data}
\subsection{Chandra Observations}
\begin{table}
\begin{flushleft}
\caption{Overview of B2224 \textit{CXO} observations used in this paper. The `Aim' column indicates aimpoint on the ACIS-I or ACIS-S array. `Exp' lists the exposure times in kiloseconds, after filtering out periods of high background.}
\setlength{\tabcolsep}{3pt}
\begin{tabular}{cccc|cccc}
\hline \hline
Date & Obs & Aim & Exp & Date & Obs & Aim & Exp \\
& & & [ks] & & & & [ks] \\ \hline
2000-10-21 & 755 & S& 48.8 & 2021-04-21 & 24433 & I & 25.7 \\
2006-08-28 & 6691& S& 10.0 & 2021-04-23 & 24431 & I & 25.7\\
2006-10-06 & 7400& S& 36.6 & 2021-04-25 & 24429 & I & 24.5\\
2012-07-28 & 14467& S& 14.6& 2021-07-04 & 24428 & I & 29.7\\
2012-07-29 & 14353& S& 34.6 & 2021-07-25 & 24427 & I & 24.7\\
2012-08-01 & 13771& S& 49.2 & 2021-10-09 & 24430 & I & 29.7\\
2021-02-19 & 24437 &I& 24.7 & 2021-10-20 & 23537 & I & 57.2\\
2021-03-14 & 24434 & I &29.5 & 2021-11-14 & 24432 & I & 29.6\\
2021-03-15 & 24435 &I& 14.6 & 2022-02-21 & 24426 & I & 20.9\\
2021-03-16 & 24992 &I & 14.9 & 2022-02-24 & 26336 & I & 18.0 \\
2021-04-03 & 24436 & I & 24.3 \\ \hline
\end{tabular} \\
\label{tab:ChandraObs}
\end{flushleft}
\end{table}
The Guitar, at its high Northern declination, requires short dwell times for the thermal health of {\it CXO}. Thus we obtained fifteen $15-60\,$ks visits between 2021 February 19 and 2022 February 24 to collect 393.8 \,ks of exposure. For all observations we used the I3 chip of ACIS-I array, with the aimpoint positioned so that the full filament was covered at any roll angle. An overview of the new and archival observations is given in Table \ref{tab:ChandraObs}. In addition to the 2021-2022 epoch of 393.8 ks, we re-analyze the three archival epochs: 2000.89 (48.8ks total, Ep1), 2006.80 (46.5 ks total, Ep2), and 2012.66 (98.4 ks total, Ep3).
All data were reprocessed with the standard CIAO reprocessing tools, using CIAO 4.12 and CALDB 4.9.1. We performed a relative astrometric correction by using \textit{wavdetect} on the aimpoint chip of each observation (S3 for the archival epochs, I3 for the latest epoch) and then using \textit{reproject\_aspect} to minimize the point source offsets between observations. ObsID 23537 was used as the reference observation, because it has the longest exposure time in the new epoch. The pulsar was excluded from the point source list, because its large proper motion makes it unsuitable for astrometry. For most ObsIDs, at least 4 sources could be used for registration. However the degraded soft X-ray response of ACIS and the short exposure time in the later observations (most notably 24435, 24436, 24992, and 26336) combined with the lack of large numbers of bright field stars means that for these obervations only 2-3 matching sources could be found. The bright source directly NW of the PSR unfortunately decreased in brightness over the course of 2021, making this source difficult to use for astrometry in the later observations of the 2021 epoch as well. We estimated the error on the frame registration from the RMS residuals after source matching, and summed the errors of individual frames weighted by exposure time to find the error on the relative astrometric correction in each epoch. We find $1 \sigma$ errors of 0.08, 0.12, 0.11, and 0.16 arcsec for the 2000, 2006, 2012, and 2021-2022 epochs respectively. After the astrometric correction, we combined the event files for each epoch and generated $1-5$\,keV exposure maps using a power law with $\Gamma=1.5$ (appropriate to the PWN emission, see \S3.3) as an input energy weighting, with the tool \textit{merge\_obs}.
In our X-ray analysis, we compare the exposure-corrected data from the S and I chips, which have significantly different particle background levels. We therefore estimated the particle background contribution by retrieving the ACIS `stowed' background maps from the calibration database, and scaling them by the number of 9.5-12\,keV counts of the observation in question (no bright sources were present to contribute significant photon counts to this band). The scaled backgrounds were subtracted from the data before making the exposure-corrected image for each epoch.
\subsection{New {\it HST} Apex Image}
\label{sec:HST}
To probe the current state of the bow shock we obtained a new {\it HST} ACS H$\alpha$ image of the nebula apex (the `head' of the Guitar) under Program 16426. This is a challenging observation, since, although the head is the brightest portion of the nebula, its surface brightness is still low. And while the ACS/WFC has the highest H$\alpha$ sensitivity of the present {\it HST} cameras, at low light levels it suffers severely from a degraded Charge Transfer Efficiency (CTE). Happily at $DEC=+65^\circ$, the Guitar lies far enough North to be occasionally in the Continuous Viewing Zone and CVZ observation were kindly granted for the three awarded orbits by {\it HST}, allowing much longer exposures, and greater photoelectron count per pixel at readout, than would otherwise be available. In the end we were able to schedule five 2910\,s F658N exposures (and two 338\,s F625W frames for continuum monitor and subtraction) on 2020 November 8 (MJD 59161). With few exposures we also reduce the total read-noise cost of the observation but slightly decrease the CR rejection efficiency. The second mitigation is to place the Guitar apex near the WFC1-CTE position, where the number of row transfers is minimal, decreasing CTE degradation. The cost is that WFC field of view is cropped closely around the apex, decreasing the number of upstream field star detections for registration and context. In addition, the geometrical distortions are largest near the array corners, such as the CTE1 position. Happily, at the observation epoch the default roll angle placed the body of the Guitar farther on to the WFC array. Its surface brightness is very low so that the only useful measurements of the body at {\it HST} resolution are the limb position in some of the brighter areas. Nevertheless it is gratifying to detect the whole structure (Figure \ref{fig:largescale}).
In the end these mitigation measures were successful and we have obtained the best-ever image of the Guitar head. Since the pulsar had moved $2.74^{\prime\prime}$ since the last {\it HST} exposure (\S3.1), there are quite substantial changes. All the {\it HST} data used in this paper can be found in MAST:\dataset[10.17909/ytdx-cf49]{http://dx.doi.org/10.17909/ytdx-cf49}.
\subsection{Archival IFU apex data}
Inspecting the Gemini archive, we found unpublished GMOS-N IFU observations of the Guitar nebula taken on 2008 June 10 and July 3 (Program GN-2008A-Q-3, van Kerkwijk, PI). The observations included $4\times 3863$\,s exposures with the IFU-2 mask, the B1200 grating and RG610 filter, covering the head of the nebula with a $0.2^{\prime\prime}$ fiber grid. A few 300\,s direct acquisition images using the G0310 H$\alpha$ filter and associated calibration files were also obtained. Conditions were good, meeting the 20\% best seeing criterion.
To improve S/N on this faint nebula, the GMOS-N detector was binned $2\times2$ during this observation. As it happens, the $2\times$ spatial binning left the fiber traces poorly resolved. This is generally not recommended and, indeed, meant that the Gemini pipeline software failed to trace the spectra and extract the data. To complete reductions, we therefore had to mark the 1000 fiber spectra positions by hand near the position of the H$\alpha$ feature in each spectral exposure flat field image and force a low-order trace centered on these fiber centroids. Importing these traces to the arcs we were able to use line features (again initially identified by hand) to establish a good wavelength solution. The traces applied to the target integrations could then be used to extract and calibrate the 1-D spectra. These were spatially flattened using sky lines and assembled into position-velocity cubes. The final weighted combination of these data gave a data cube with a spatial scale of $0.1^{\prime\prime}$/pixel and a wavelength scale of 0.4729\AA/image plane (21.6 km/s/image plane). The spectral resolution of 1.23\AA (56\,km/s) was confirmed by measuring sky lines and the $0.6^{\prime\prime}$ FWHM spatial resolution of the pre-images is maintained in the data cubes, as indicted by the width of the narrow H$\alpha$ limb $\sim 2.5^{\prime\prime}$ behind the apex.
\begin{figure}
\centering
\includegraphics[width=3.2in]{B2224figs/Guit_apexv.pdf} \\
\caption{Velocity profile just behind the nebula apex (oval in Figure \ref{fig:IFUchan}). A reflected version of the profile (red) shows that it is centered at $\sim -12$\,km/s. The high velocity $|v|=150-300$\,km/s wings (blue points, shifted from the red profile to match original apex profile wings) show a slight additional blue shift. }
\label{fig:IFUspec}
\end{figure}
We find that the nebula is best detected in low velocity channels near the nebula limb, as expected from neutral excitation in the post shock gas (and by projection effects). Larger velocities are found principally right behind the nebula apex, where charge exchange allows accelerated post-shock protons to obtain electrons and emit H$\alpha$. The line spectrum from a region just behind the apex is shown in Figure \ref{fig:IFUspec}. The similarity of the channel maps red and blue of the central velocity supports the inference from prior bow shock image fits that the pulsar space velocity lies close to the plane of the sky. Focusing on the velocity extrema we see an offset of $-32-(-12)=-20$\,/km/s for the wing components peaking at $\sim \pm 250$\,km/s, giving $\theta_v \approx {\rm arctan}(-20{\rm km/s/250 km/s})\approx 5^\circ$ out of the plane of the sky.
Assuming approximate axial symmetry, we can check these velocities by examining the transverse expansion of the head boundary in the HST images. By comparing the 2020 and 2006 HST images we can see that across the bulk of the head region, starting $5^{\prime\prime}$ back from the 2020 apex, the lateral expansion is $\approx 0.3^{\prime\prime}$ over 14y or $\approx \pm 85 {\rm km/s}$ at $d=0.83$\,kpc, in good agreement with the brightest emission in the channel maps. It is a bit more difficult to measure the transverse expansion corresponding to the elliptical apex region marked in Figure \ref{fig:IFUchan}, but comparing the 2008 GMOS-N pre-image with the 2006 HST frame, we see transverse expansion of $\sim 0.1^{\prime\prime}$ over 1.7y or $\sim \pm 230 {\rm km/s}$, in reasonable agreement with the wing component speeds in Figure \ref{fig:IFUspec}.
\section{Multi-Epoch Comparison}
Over the past 25 years we now have 4 epochs of observation each with {\it HST} in H$\alpha$ and {\it CXO} in X-rays (Table \ref{tab:ChandraObs}). Other ground-based H$\alpha$ images exist, but the very small angular scale of the bow shock stand-off requires {\it HST} resolution for serious study of the evolving morphology. Comparison of the shock between these epochs gives important clues to the nature of the filament.
\begin{figure*}
\hspace*{-5mm}\includegraphics[scale=0.5]{B2224figs/Guit_opt_seq.pdf}
\vskip -13.2cm\hskip 27mm \includegraphics[scale=0.82]{B2224figs/Guit_X_ev_bin2.pdf}
\vskip -0.4cm
\caption{1994-2021 Guitar/Filament Evolution. Left panels show four $22^{\prime\prime}\times 21^{\prime\prime}$ cutouts from the {\it HST} H$\alpha$ images (1994, 2001, 2006, 2020). The top panel has the pulsar positions at the four {\it HST} and four {\it CXO} epochs marked on lines representing 50y ($9.7^{\prime\prime}$) of proper motion. The lower panels have the outline of the 2020 {\it HST} H$\alpha$ limb marked, for comparison. The right panels show the filament evolution over the four {\it CXO} epochs ($4^\prime \times 1^\prime$ cutouts). The filament leading edge from the 2021 epoch is marked by the blue line, while the red arrow in the top and bottom panels shows the 50y proper motion, and a stationary background source is marked for reference.
}
\label{fig:4ep}
\end{figure*}
\subsection{Optical Evolution}
{\renewcommand{\arraystretch}{1.15}
\begin{table}
\centering
\caption{The standoff distances (in mas) measured for each \textit{HST} epoch, for thin and wide shock models; shown are the median values from the posterior distributions, with the 14th and 86th percentiles as the errors}. The estimates of \cite{Chatterjee2004} and \cite{Ocker2021} are also shown.
\begin{tabular}{c c c c c }
\hline \hline
Epoch & $r_{0,\rm{thin}}$& $r_{0, \rm{wide}}$& $r_{0,\rm{O2021}}$& $r_{0, \rm{CC2004}} $\\ \hline
1994 & $86_{-9}^{+12}$ & $94_{-7}^{+11}$ & $77 \pm 4$ & $120 \pm 40$ \\
2001 & $116_{-15}^{+16}$ & $112_{-14}^{+14}$ & $110 \pm 10$ & $100 \pm 40$ \\
2006 & $97_{-4}^{+4}$ & $93_{-3}^{+3}$ & $94 \pm 6$ & \\
2020 & $96_{-2}^{+4}$ & $92_{-2}^{+3}$ & \\ \hline
\end{tabular}
\label{tab:standoff}
\end{table}}
Comparing the optical images at the left hand side of Figure \ref{fig:4ep} with the line marking the limb of the 2020 image we see that as the pulsar advances, the perpendicular expansion is rapid at the apex but slows by a few arcsec behind. This is also visible in the IFU data cube. The general structure of the Guitar head is best seen in our new high S/N 2020 image; it is roughly symmetric, with indentations, especially a `pinch' $\sim 7^{\prime\prime}$ behind the pulsar, and higher limb brightness regions, e.g.\,$\sim 3^{\prime\prime}$ and $\sim 6^{\prime\prime}$ behind the pulsar. Thus the geometry of the bow shock apex and its expansion rate must vary. The most extreme illustrations of this are, of course, the apparently closed bubble of the Guitar head and the double cavity of the Guitar body itself. The approximate bi-lateral symmetry of the overall nebula indicates either that the central pulsar wind varies or that the perturbations producing these structures have a coherence scale substantially larger than the width of the nebula. However, there is also significant right-left asymmetry, which implicates instabilities in the shock flow or variations in the external medium on the few arcsec scale of the head width.
The spectrum of such perturbations have recently been explored by \citet{Ocker2021}, who, following \citet{Chatterjee2004} discuss apparent changes in the bow shock standoff distance in the previous three {\it HST} epochs. These $\theta_0$ were, however, estimated by marking the apparent bow shock limb by hand and then fitting to these marked points. This, of necessity, introduces substantial subjectivity. We therefore have sought to fit \citet{Wilkin2000} apex models directly to the {\it HST} images. This model computes the locus of the contact discontinuity, which for a `thin' shock marks the H$\alpha$ front. In practice post-shock pressure widens the structure; the H$\alpha$ emission standoff should be $\sim 1.3 r_0$ at the apex and this factor should grow downstream. A simple approximation increases the transverse scale by $1.25\times$ \citep{2014ApJ...784..154B} for a `wide' shock model. For the first three epochs we were able to register the frames to \textit{Gaia} stars to determine the position of the pulsar in the frame with an $1 \sigma$ uncertainty of 0.07, 0.07, and 0.06 pixels respectively. For 2020, however, WFC corner distortions defeated such registration, so we have let the pulsar position adjust over a 1 pixel ($\sim 50$mas) range. We used the affine invariant Markov Chain Monte Carlo (MCMC) algorithm of \citet{Goodman2010}, implemented through the python package {\sc emcee}, to sample the likelihood function and obtain posterior distributions for the standoff distance in each epoch. The MCMC routine was run using 50 walkers and 5000 steps for each walker. In order to run MCMC efficiently, we first performed a maximum likelihood analysis, and started the walkers with initial parameters close to the best-fit parameters. Upon visual inspection of the chains, we further excluded the first 500 steps of each walker to `burn in' the chains, ensuring convergence. We calculate the integrated autocorrelation time $\tau_f$ to be $
\sim 50$ steps, meaning that the walker length of 4500 steps should be sufficient.\footnote{In the {\sc emcee} documentation on autocorrelation analysis (\url{https://emcee.readthedocs.io/en/stable/tutorials/autocorr/)}, it is suggested that each walker should have a length of $>\,50\tau_f$ steps, so that enough independent samples can be obtained to yield accurate results.}.A visual comparison of the data and the Wilkin thin shock model for each epoch is shown in Figure \ref{fig:apexfit}. The posterior distributions for $r_0$ are plotted in Figure \ref{fig:posteriors}, with values listed in Table \ref{tab:standoff}. For the 2020 epoch, the position uncertainty from the posterior (the 14th and 86th percentiles of the distribution) is $\approx 0.15$ pixel ($\sim 8 $\,mas) in both the $x$ and $y$ directions.
\begin{figure*
\includegraphics[width=.95\textwidth]{B2224figs/wilkin_ts.png}
\caption{The Wilkin-model bow shock fits for the 4 different H$\alpha$ epochs. All images are shown in native resolution of $0.05\arcsec$/pixel. The left column shows a cut-out of the bow shock apex for the 4 epochs, using pixels up to $\approx 1^{\prime \prime}$ behind the apex. The 1994 and 2001 epochs have been lightly smoothed for visualization. The middle column shows the Wilkin model, and the rightmost column shows the residual (data-model)$^2$/$\sigma^2$. The red cross shows the location of the pulsar - a free parameter for the 2020 epoch, and referenced to Gaia using a set of reference stars for the other three epochs.}
\label{fig:apexfit}
\end{figure*}
\begin{figure*}
\includegraphics[width=.95\textwidth]{B2224figs/r0_posteriors_2.png}
\caption{The posterior distributions for the standoff distance $r_0$ in each epoch (left to right, top to bottom: 1994, 2001, 2006, 2020. Shown for reference are the estimated standoff distances of \citet{Ocker2021} and \citet{Chatterjee2004}}
\label{fig:posteriors}
\end{figure*}
The \citet{Ocker2021} estimates generally lie within the $r_0$ uncertainty ranges, but have nominal errors much smaller than we find for a direct fit, especially for the 1994 and 2001 data. Alas our more realistic errors mean that direct evidence for $r_0$ variation is poor. The bulk of our uncertainty range suggests that $r_0$ was larger in 2001, but even this result is weak. Additional images of the quality of our new ACS/WFC exposure are needed to probe stand-off variation at the required $\sim 5$mas level.
Nevertheless the head limb shape does suggest that the standoff was small when pulsar was at the position of the head's closed base, $\sim 15.5^{\prime\prime}$ behind the present apex (i.e. in $\sim 1940$). The transition into the head bubble may be similar to the `break-through' inferred for the PSR J2030+4415 H$\alpha$ nebula and filament \citep{deVries2022}. The `pinch' $\sim 7^{\prime\prime}$ back (i.e. in 1985), and the increased limb brightness $\sim 3.2^{\prime\prime}$ behind the apex (in $\sim 2004$) suggest weaker compression events.
\begin{figure}
\includegraphics[width=0.48\textwidth]{B2224figs/guitar_specregions.png}
\caption{Regions used for spectral analysis of the filament in the 2021 \textit{Chandra} epoch. We divided the filament into three main sections: the inner section where the leading edge is sharpest (0--0.7$^\prime$), the middle section where the filament appears to become more diffuse (0.7--1.3$^\prime$) and the outer, most diffuse section where the sharp leading edge has largely disappeared (1.3--2.4$^\prime$). Additionally, the inner and middle sections are divided by the green dashed line into the 'Leading' and 'Trailing' regions. We also identify a `Remnant' region of bright emission around $12\arcsec$ behind the leading edge in the middle section. The red regions show the contours of the Guitar nebula head (solid line) and body (dashed line) in the 2020 \textit{HST} H$\alpha$ image. }
\label{fig:specregs}
\end{figure}
\subsection{X-ray Evolution}
\begin{figure}
\centering
\vskip -3mm
\includegraphics[width=0.49\textwidth]{B2224figs/epoch_fil_lc_v3.png}
\vskip -3mm
\caption{Light-curves of the leading edge ($1^{\prime\prime}$ width) of the inner filament (0--0.7$^\prime$ segment), showing the flux in each epoch and the flux of that same region of the sky in following epochs. The y-axis indicates the 1-5 keV photon surface brightness.}
\label{fig:fil_lc}
\end{figure}
\begin{figure}
\centering
\vskip -3mm
\includegraphics[width=0.49\textwidth]{B2224figs/CF_F_SB.png}
\vskip -3mm
\caption{Light-curves of the inner counter-filament and inner and middle filament sections. Data points have been slightly offset from each other for legibility. The y-axis indicates the 1-5 keV photon flux per arcmin length of filament. The lengths of the inner counter-filament, and inner and middle filament sections are 0.25$^\prime$, 0.65$^\prime$, and 0.68$^\prime$ respectively and fluxes have been integrated across the width of the main filament.}
\label{fig:fil_lc_wide}
\end{figure}
In Figure \ref{fig:specregs} we define several regions useful in describing the filament's spectrum and its evolution.
The $e^\pm$ injection site shifts with the steady pulsar motion, and in Figure \ref{fig:4ep} it is apparent that the filament leading edge marches along with the pulsar, as also noted by \citet{2021RNAAS...5....5W}. Our deeper 2021 exposure provides a much better view of the counter-filament (CF) than earlier epochs. It extends at least $20^{\prime\prime}$ and likely $40^{\prime\prime}$ from the pulsar. Interestingly it does not line up well with the filament leading edge, instead intersecting the proper motion axis some $1.5^{\prime\prime}$ behind the pulsar position. Both it and the filament have substantial curvature near the bow shock. This is likely a field line `draping' effect or field distortion from supra-thermal particles as most clearly seen in the `lighthouse' PWN filament and counter-filament \citep{2016A&A...591A..91P}.
We checked to see if the PWN PSR trail is detected in our deep 2021 image. Using the `head region' of the Guitar (see Figure \ref{fig:specregs}) as an aperture and subtracting similar flanking regions as background, we find an excess of $11\pm 4.5$ counts in the 0.7--5\,keV, range, a marginal $2.5\sigma$ detection. This gives a filament/trail flux ratio $>100$, the largest among known filaments.
In Figure \ref{fig:fil_lc} we measure the surface brightness at the filament leading edge in each epoch and compare the flux in the same aperture in subsequent epochs. In general the region corresponding to the edge shows an initial rapid decrease in surface brightness in the following epoch (see also Figure \ref{fig:4ep}). We infer a rapid change in the electron population as the pulsar moves ahead to the next set of field lines, due to cooling, advection or diffusion. The subsequent brightness decrease, if any, is much smaller. Fortuitously the leading edge was much brighter than usual during the original 2000 epoch, which helped in the filament's discovery. This may be related to enhanced injection around this epoch. For example if $r_0$ decreases, then more pulsar/PWN shock particles have gyroradii exceeding $r_0$, so escape to the filament might increase and the filament surface brightness may temporarily increase. Averaged over the full width the fluxes per unit length seem quite constant (Figure \ref{fig:fil_lc_wide}); although the inner counter-filament appears more prominently in the 2021 image, its flux per unit length remains consistent with that of the filament, within errors.
Although the statistics are limited in the early images, there appear to be changes behind the leading edge. In Figure \ref{fig:4ep} the most notable changes are in the `Middle' section of the filament where the emission spreads behind the leading edge as a shifting ridge. We quantify this trend in Figure \ref{fig:spread}, where fits to Gaussian distributions transverse to the filament show a progressive shift and broadening of the maximum. Note that the integral flux is consistent with constant across the four epochs. A fit to such regions in the `Inner' zone gives similar evolution with nearly identical parameters, but lower statistical significance. We attempt to interpret these results in the conclusions.
\begin{figure}
\centering
\vskip -1.9mm
\includegraphics[width=0.49\textwidth]{B2224figs/fil_modelfits.png}
\vskip -3mm
\caption{Spread of the emission behind the leading edge in the filament middle section across four epochs. The data are well described by a steady shift of the peak behind the leading edge, a steady increase in the width, and a constant integrated flux. The y-axis indicates the 1--5 keV photon surface brightness. Labels indicate the best-fit parameter value (with $1 \sigma$ errors ): $x_{2000}$ and $\sigma_{2000}$ are the peak position and standard deviation of the Gaussian component in 2000 respectively; $\dot{\sigma}$ indicates the increase in $\sigma$ over time; and $\mu$ indicates the shift of the peak away from the leading edge over time.}
\label{fig:spread}
\end{figure}
\subsection{Spectral fits}
We have extracted spectra for the several regions of Figure \ref{fig:specregs} using the standard \textsc{CIAO} tools. To each of the spectra, we have fit a power law multiplied by Galactic absorption, which we have set at $2.7 \times 10^{21}$ cm$^{-2}$. The results of the spectral analysis are shown in Table \ref{tab:specfits}. There are no significant differences in spectral index between the regions. The weak evidence for spectral softening with distance from the pulsar would require much deeper observation for a serious test.
Additionally, we have estimated the magnetic field strength under the assumption of equipartition. For an optically thin region filled with relativistic electrons and magnetic field emitting synchrotron radiation
\begin{equation}
\label{eq:syncB}
B = 46 \left[ \frac{J_{\rm -20}(E_1,E_2) \sigma } {\phi} \frac{C_{1.5-\Gamma}(E_m, E_M)}{C_{2-\Gamma}(E_1,E_2)}\right] ^{2/7} \mu G
\end{equation}
where
\begin{equation}
C_q(x_1,x_2) = \frac{x_2^{q} - x_1^q}{q}.
\end{equation}
$J_{\rm -20}(E_1,E_2) = 4 \pi f_{\rm -20}(E_1, E_2) d^{2}/ V$ is the observed emissivity (in $10^{-20}$\,erg\,s$^{-1}$\,cm$^{-3}$, between $E_1$\,keV and $E_2$\,keV), $\sigma=w_B/w_e$ is the magnetization parameter, $\phi$ the filling factor, and $E_m$ and $E_M$ the minimum and maximum energies, in keV, of the synchrotron spectrum with photon $\Gamma$. We assume that the structures are cylindrical, with diameter set to the observed region width. We list the derived equipartition fields in Table \ref{tab:specfits} for $\sigma=\phi=1$, $E_m=0.01\,\rm{keV}$ and $E_M=10\,\rm{keV}$.
\begin{table}
\setlength{\tabcolsep}{3.5pt}
\caption{Spectral fit results (with $1 \sigma$ errors) for the filament in the 2021 \textit{Chandra} epoch (see Figure \ref{fig:specregs} for the regions). The `Leading' and `Trailing' regions are composed of the front and back halves, respectively of the combined inner and middle regions. B$_{eq}$ was computed assuming cylindrical volumes for each region.}
\centering
\label{tab:specfits}
\begin{tabular}{l l l l l l} %
\hline\hline
Region & Counts &$\Gamma$ &$f_{-15}$\textsuperscript{b}& $\chi^2$/DoF & B$_{eq}$ \\
& & & & & [$\mu G$] \\ [0.5ex] \hline
Inner & $214\pm17$ & $1.31\pm0.16$ & 9.9 &29.3/27 & 13 \\
Middle & $209\pm17$ & $1.37\pm0.17$ & 10.2 & 24.3/24 & 14 \\
Outer & $489\pm32$& $1.58\pm0.15$ & 24.1 & 53.2/48 & 8 \\
CF & $86\pm11$& $1.71\pm0.30$ & 3.5 & 23.8/24 & 17 \\
Leading & $273\pm19$ & $1.39\pm0.14$ & 13.6 & 22.7/33 & 19 \\
Trailing & $154\pm16$ & $1.60\pm0.20$ & 7.1 & 30.5/30 & 17 \\
Remnant & $174\pm19$ & $1.40 \pm 0.27$ & 7.2 & 38.0/33 & 9 \\
\hline
\end{tabular} \\
\leftline{\textsuperscript{a} $N_H$ fixed at $2.7\times10^{21}{\rm cm^{-2}}$.}
\leftline{\textsuperscript{b} $0.5-7\,$keV unabsorbed fluxes in units of $10^{-15}{\rm erg\,cm^{-2}s^{-1}}$.}
\end{table}
\section{Discussion and Conclusions}
The shape of the filament is complex and the epoch-to-epoch changes are subtle. We seek to explain these through a combination of variable particle injection at the moving pulsar, particle flow along field lines, particle diffusion across field lines and possible cooling. In practice cooling is likely not important on the scale of the observed filament since standard synchrotron theory gives a cooling time of
\begin{equation}
\tau \approx 7.6 \times 10^4 E_{\rm keV}^{-1/2} B_{\mu G}^{-3/2} {\rm y}.
\end{equation}
With an observed photon energy of $\sim 2$\,keV and $B_{\mu G} \sim 15$ estimated in \S2.3, we get a cooling time $\tau \approx 930$\,y, so over our four epochs we expect no significant cooling. Since the pulsar moves $\sim 3^\prime$ (twice the size of the Guitar body) in time $\tau$, cooling predicts a fading on this scale. Accordingly, the smaller scale morphology changes must be due to variable injection, advection and diffusion.
In the original \citet{Bandiera2008} picture the $r_c$ relevant for escape was that of the shocked pulsar wind. Since the mean field in that wind increases as $r_0$ decreases, $r_c/r_0$ is essentially constant, and does not control the particle escape; in this picture most bow-shock pulsars should produce filaments and they should do so at all epochs independent of the bow shock size. This does not appear to be the case, since filaments are rare and preferentially associated with pulsars with small $r_0$. Instead we argue that energetic $e^\pm$ are produced via reconnection throughout the shocked pulsar wind and that $r_c$ beyond the contact discontinuity, in the shocked ISM and external medium, controls escaping particle motion. The near-apex external field is modified by the draping effect to have a characteristic curvature radius $r_0$ and thus $r_c/r_0$ in this medium can control which particles move far enough in a gyroradius to encounter different external field orientations, and escape.
The curvature of the filament leading edge implies that the ambient field lines are not completely straight, although the similarity of the edge from epoch to epoch suggests that they are locally approximately parallel. The leading edge is quite sharp. The $e^\pm$ gyroradius $r_c$ in the local field subtends an angle of
\begin{equation}
\theta =r_c/d \approx 26^{\prime\prime} E_{\rm keV}^{1/2} B_{\mu G}^{-3/2} d_{\rm kpc}^{-1}
\end{equation}
for particles producing a peak photon energy $E_{\rm keV}$. For a leading edge field of $20\mu G$ (Table \ref{tab:specfits}) we get $\theta \approx 0.5^{\prime\prime}$ for the filament. This is comparable to the {\it CXO} resolution (but substantially larger than $r_0$). The filament leading edge stays sharp for the inner and middle zones, spreading primarily in the outer zone. This implies that the cross field diffusion coefficient ahead of the leading edge in the ambient ISM is small.
With an estimate of the flow speed $v_{e^\pm}$ along the leading edge, one could use the broadening with distance to get an estimate of this forward diffusion coefficient. Noting that this edge is actually the front reached by particles moving rapidly along a set of field lines, we see that the far filament represents earlier injection, onto field lines behind that connect to the pulsar at its current position. Thus the filament front follows an angle $\theta_f \sim v_{\rm PSR}{\rm cos}\Psi/v_{e^\pm}$ behind the ISM field lines, with the field lines themselves at an angle $\Psi\sim 25^\circ$ to the proper motion. If the filament and counter-filament propagation speeds are equal, we can account for $\Psi$ by comparing the PAs of the two sides; these should differ by $2\theta_f$. In practice this measurement is difficult since the counter-filament is short and the section closest to the bow shock suffers PWN-induced distortion. Very roughly, we estimate $\theta_f\lesssim 2^\circ$, and thus $v_{e^\pm} \approx v_{\rm PSR}{\rm cos} \Psi /\theta_f \gtrsim c/13$.
With small cross-field diffusion, we would expect particles confined to their injection field line and the filament would present an approximately uniform band, shifted increasingly farther from the Guitar axis, since particles on field lines to the rear would have more time to propagate away. This band would have brighter ridges marking times (field lines) of enhanced particle injection and a smooth fading on arcmin scales behind the leading edge due to synchrotron cooling. This is not what we see. Instead the emission behind the leading edge is patchy and seems to evolve on times short compared to the cooling times.
This may be understood if cross-field advection and diffusion increase behind the leading edge. From Figure \ref{fig:spread} we estimate the 2021 surface brightness peak as having position $x_{2021} \approx 12.2^{\prime\prime}$ behind the 2021 leading edge, with bulk motion of $\mu_{\rm ridge} \sim 0.15^{\prime\prime}{\rm y^{-1}}$ and spread of $\sigma(t) \sim [3.0+0.25(t-2000)]^{\prime\prime}$. We can attribute these increased rates to turbulence induced behind the leading edge by the injected particles; this leads to increased scattering and easier cross-field propagation. It then becomes interesting to trace the origin of the ridge that moves through Figure \ref{fig:spread}. With a coordinate increasing normal to and behind the leading edge, we can write the pulsar position at year $t$ as $x_p = \mu_{PSR} {\rm cos}\Psi (2021-t)$. Similarly $x_{\rm ridge} = x_{2021} + \mu_{ridge} (t-2021)$, with the proper motions in arcsec/y. Finally the propagation time between the pulsar and the middle zone $l \sim 75^{\prime\prime} d \sim 1$\, lt-y away is $t_\parallel \approx l/v_{e^\pm} \sim c/v_{e^\pm}$ years. Thus the date for the enhanced injection of the $e^\pm$ that we see in 2021 as a ridge moving through the filament is
\begin{equation}
t_{\rm inj} \approx2021 - x_{\rm r,2021}/(\mu_{\rm PSR} {\rm cos}\Psi+\mu_{\rm ridge}) +t_\parallel .
\end{equation}
From our fit to the ridge evolution we get $t_{\rm inj} \approx 1993_{-16}^{+7} + t_\parallel$, so to identify the moving ridge with particles injected when the pulsar was at the `pinch' in the Guitar head, $7^{\prime\prime}$ behind the apex, in 1985, we would want $\mu_{\rm ridge}$ low in the fit range and $t_\parallel = l/v_{e^\pm}<8 $\, y. Note that $\sigma$ decreases to 0 at $1990_{-10}^{+5}$, so consistent with $\sim 1985$, as well.
It is likely a coincidence that the back-propagation of the ridge brings it nearly parallel with the base of the Guitar head in the 2021 epoch. Although we don't see strong emission at this position in our earlier epochs, those images are shallow, and it is possible that future deep observations will show that this ridge is a permanent feature fixed in space. In that case it would be compatible with the simpler hypothesis that it is the fossil of strong injection at the point the pulsar broke into the head region in $\sim 1940$. More generally the lack of such `fossil' X-ray emission parallel with the Guitar body suggests that when the pulsar was blowing the bubbles corresponding to the body structure, the standoff $r_0$ was large and that little or no $e^\pm$ escape occurred. Thus the Guitar may have had an X-ray filament only since the very compact head region was formed.
Although forward propagation of the pulsar-generated cosmic rays is severely limited at the leading edge, it seems much freer behind, rearranging the injected particles long before they cool. While this means that the filament surface brightness profile is not a simple historical record of injection history, it does offer the opportunity to probe the diffusion of multi-TeV $e^\pm$ through the ISM and, more importantly, their effect, via induced MHD waves, on the local particle propagation. For B2224, injection seems to be effective over the $\sim 20^{\prime\prime}$ region of the Guitar head and neck where the bow shock standoff was evidently small, leading to a wide filament. In contrast, the filament of PSR J2030+4415 stays narrow since the injected period was short and the pulsar covered little distance in this time.
This picture of variable injection may certainly be tested by finding more example filaments, and connecting them with bow shock properties. Numerical simulations can also be useful in determining whether external field-controlled escape is viable or some other peculiarity of small $r_0$ bow shocks, such as enhanced local turbulence or asymmetric reconnection to the external fields, needs to be invoked
The effect of injected $e^\pm$ may be especially important in connection with the recently observed TeV halos around nearby young pulsars \citep{2017Sci...358..911A}. Interesting experiments to probe these effects would be enabled by identifying enhanced filament injection events (plausibly via H$\alpha$ bow shock monitoring) followed by a decade of sensitive X-ray images to observe, via synchrotron emission, the TeV $e^\pm$ pulse propagating and spreading. Such a campaign would be expensive in observation time, but would yield a rich harvest of information of cosmic ray and magnetic field dynamics, spread out before the observer in evolving filament images.
\acknowledgements
We wish to thank the observatory staff who helped in planning the exposures described in this paper, especially Jean Connelly of the CfA for help with {\it CXO} and Alison Vick and Ray Lucas of STScI for help with the ACS/WFC. We also wish to thank Marten van Kerkwijk for advice on the GMOS-N IFU data set.
\smallskip
\vspace{5mm}
MdV and RWR were supported in part by NASA grant G08-19050A, through the Smithsonian Astrophysical Observatory. GGP was supported by NASA grant G08-19050B. OK was supported by NASA grant GO8-19050C and ADAP grant 80NSSC19K0576. Support for this work was provided by the National Aeronautics and Space Administration through Chandra Award Number GO8-19050 issued by the Chandra X-ray Observatory Center, which is operated by the Smithsonian Astrophysical Observatory for and on behalf of the National Aeronautics Space Administration under contract NAS8-03060.
\vspace{5mm}
\facilities{HST(ACS/WFC), Gemini(GMOS-N), CXO}
|
{
"timestamp": "2022-10-05T02:03:21",
"yymm": "2210",
"arxiv_id": "2210.01228",
"language": "en",
"url": "https://arxiv.org/abs/2210.01228"
}
|
\section{Introduction}
\label{sec:introduction}
Reinforcement Learning (RL) is a machine learning area concerned with sequential decision-making in real or simulated environments. RL has a solid theoretical background and shows outstanding capabilities to learn control in unknown non-stationary state-spaces \cite{Berkenkamp2017, cheung20a, Padakandla2020}. Recent literature demonstrates that Deep RL can master complex games such as Go \cite{Schrittwieser2020a}, StarCraft II \cite{Vinyals2019}, and progressively move towards mastering safe autonomous control \cite{Berkenkamp2017}. Furthermore, RL has the potential to contribute to health care for tumor classification \cite{Yu2019}, finances \cite{Li2017}, and industry-4.0 \cite{Pane2019} applications. RL solves problems iteratively by making decisions while learning from received feedback signals.
\subsection{Research Gap}
However, fundamental challenges limit RL from working reliably in real-world systems. The first issue is that the exploration-exploitation trade-off is difficult to balance in real-world systems because it is also a trade-off between successful learning and safe learning \cite{Berkenkamp2017}. The reward-is-enough hypothesis suggests that RL algorithms can develop general and multi-attribute intelligence in complex environments by following a well-defined reward signal. However, the second challenge is that reward functions that lead to efficient and safe training in complex environments are difficult to define \cite{Silver2021}. Given that it is feasible to craft an optimal reward function, agents could quickly learn to reach the desired behavior but still require exploration to find a good policy. RL also requires many samples to learn an optimal behavior, making it difficult for a policy to converge without simulated environments. While there are efforts to address RL's safety and sample efficiency concerns, it remains an open question \cite{Moerland2020}. These concerns represent challenges for training RL algorithms climate-efficient in an environmentally responsible manner. Most RL algorithms require substantial calculations to train and simulate environments before achieving satisfactory data to conclude performance measurements. Therefore, current state-of-the-art methods have a significant negative impact on the climate footprint of machine learning \cite{Henderson2020}.
Because of the difficulties mentioned above, a large percentage of RL research is conducted in environment simulations. Learning from a simulation is convenient because it simplifies quantitative research by allowing agents to freely make decisions that learn from catastrophic occurrences without causing harm to humans or real systems. Furthermore, simulations can operate quicker than real-world systems, addressing some of the issues caused by low sample efficiency.
There are substantial efforts in the RL field that focus on improving sample efficiency for algorithms but little work on improving simulation performance through implementation or awareness. Currently, most environments and simulations in RL research are integrated, implemented, or used through the Open AI Gym toolkit. The benefit of using AI Gym is that it provides a common interface that unifies the API for running experiments in different environments. There are other such efforts like Atari 2600 \cite{Bellemare2012}, Malmo Project \cite{Johnson2016a}, Vizdoom \cite{Kempka2016b}, and DeepMind Lab \cite{Beattie2016a}, but there is, to the best of our knowledge, no toolkit that competes with the environment diversity seen in AI Gym. AI Gym is written in Python, an interpreted high-level programming language, leading to a significant performance penalty. At the same time, AI Gym has substantial traction in the RL research community. Our concern is that this gradually leads to more RL environments and problems being implemented in Python. Consequently, RL experiments may cause unnecessary computing costs and computation time, which results in a higher carbon emission footprint \cite{Zhang2022a}. Our concern is further increased by comparing the number of RL environment implementations in Python versus other low-level programming languages.
Our contribution addresses this gap by developing an alternative to AI Gym without these adverse side effects by offering a comparable interface and increasing computational efficiency. As a result, we hope to reduce the carbon emissions of RL experiments for a more sustainable AI.
\subsection{Contribution Scope}
We propose the CaiRL Environment toolkit to fill the gap of a flexible and high-performance toolkit for running reinforcement learning experiments. CaiRL is a C++ interface to improve setup, development, and execution times. Our toolkit moves a considerable amount of computation to compile time, which substantially reduces load times and the run-time computation requirements for environments implemented in the toolkit. CaiRL aims to have a near-identical interface to AI Gym, ensuring that migrating existing codebases requires minimal effort. As part of the CaiRL toolkit, we present, to the best of our knowledge, the first Adobe Flash compatible RL interface with support for Actionscript 2 and 3.
Additionally, CaiRL supports environments running in the Java Virtual Machine (JVM), enabling the toolkit to run Java seamlessly if porting code to C++ is impractical. Finally, CaiRL supports the widely used AI Gym toolkit, enabling existing Python environments to run seamlessly. Our contributions summarize as follows:
\begin{enumerate}
\item Implement a more climate-sustainable and efficient experiment execution toolkit for RL research.
\item Contribute novel problems for reinforcement learning research as part of the CaiRL ecosystem.
\item Empirically demonstrate the performance effectiveness of CaiRL.
\item Show that our solution effectively reduces the carbon emission footprint when measuring following the metrics in \cite{henderson2020towards}.
\item Evaluate the training speed of CaiRL and AI Gym and empirically verify that improving environment execution times can substantially reduce the wall-clock time used to learn RL agents.
\end{enumerate}
\subsection{Paper Organization}
In Section 2, we dive into the existing literature on reinforcement learning game design and compare the existing solution to find the gap for our research question. Section 3 details reinforcement learning from the perspective of CaiRL and the problem we aim to solve. Section 4 details the design choices of CaiRL and provides a thorough justification for design choices. Section 5 presents our empirical findings of performance, adoption challenges, and how they are solved, and finally compares the interface of the CaiRL framework to OpenAI Gym (AI Gym). Section 6 presents a brief design recommendation for developers of new environments aimed at reinforcement learning research. Finally, we conclude our work and outline a path forwards for adopting CaiRL.
\section{Background}
\label{sec:background}
\subsection{Reinforcement Learning}
Reinforcement Learning is modeled according to a Markov Decision Process (MDP) described formally by a tuple \((S, A, T, R, \gamma, s_0)\). \(S\) is the state-space, \(A\) is the action-space, \(T \colon S \times A \rightarrow S\) is the transition function, \(R \colon S \times A \rightarrow \mathbb{R}\) is the reward function~\cite{Sutton2018}, \(\gamma\) is the discount factor, and \(s_0\) is starting state. In the context of RL, the agent operates iteratively until reaching a terminal state, at which time the program terminates. Q-Learning is an off-policy RL algorithm and seeks to find the best action to take given the current state. The algorithm operates off a Q-table, an n-dimensional matrix that follows the shape of state dimensions where the final dimension is the Q-values. Q-Values quantify how good it is to act \(a\) at time \(t\). This work uses Deep Learning function approximators in place of Q-tables to allow training in high-dimension domains \cite{Mnih2015}. This forms the algorithm Deep Q-Network (DQN), one of the first deep learning-based approaches to RL, and is commonly known for solving Atari 2600 with superhuman performance \cite{Mnih2015}. Section \ref{sec:carbon_emission} demonstrates that our toolkit significantly reduces the run-time and carbon emission footprint when training DQN in traditional control environments.
\subsection{Graphics Acceleration}
\label{sec:graphics-accel}
\todo{Introduction}
A graphics accelerator or a graphical processing unit (GPU) intends to execute machine code to produce images stored in a frame buffer. The machine code instructions are generated using a rendering unit that communicates with the central processing unit (CPU) or the GPU. These methods are called software rendering or hardware rendering, respectively. GPUs are specialized electronics for calculating graphics with vastly superior parallelization capabilities to their software counterpart, the CPU. Therefore, hardware rendering is typically preferred for computationally heavy rendering workloads. Consequently, it is reasonable to infer that hardware-accelerated graphics provide the best performance due to their improved capacity to generate frames quickly. On the other hand, we note that when the rendering process is relatively basic (e.g., 2D graphics) and access to the frame buffer is desired, the expense of moving the frame buffer from GPU memory to CPU memory dramatically outweighs the benefits. \cite{mileff2012efficient}
\todo{About, and why it is central to CaiRL?}
According to \cite{mileff2012efficient}, software rendering in modern CPU chips performs 2-10x faster due to specialized bytecode instructions. This study concludes that the GPU can render frames faster, provided that the frame permanently resides in GPU memory. Having frames in the GPU memory is impractical for machine learning applications because of the copy between the CPU and GPU. The authors in \cite{Mendel1348908} propose using Single Instruction Multiple Data (SIMD) optimizations to improve game performance. SIMD extends the CPU instruction set for vectorized arithmetic to increase instruction throughput. The authors find that using SIMD instructions increases performance by over 80\% compared to traditional CPU rendering techniques.
The findings in these studies suggest that software acceleration is beneficial in some graphic applications, and similarly, we find it useful in a reinforcement learning context. Empirically, software rendering performs better for simple 2D and 3D graphic applications due to the high-latency copy operation needed between the GPU and CPU. Much of the success of CaiRL lies in the fact that software rendering, while being slower for advanced games such as StarCraft, significantly outperforms hardware rendering for simple graphics. One alternative to improve performance in hardware rendering is to use pixel buffer objects or an equivalent implementation. A pixel buffer object (PBO) is a buffer storage that allows the user to retrieve frame buffer pixels asynchronously while a new frame buffer is drawn to the screen frame buffer. In particular, copying pixels without PBO is slow because rendering must halt while the buffer is read \cite{Lawlor2009}.
\subsection{Programming Languages}
\label{sec:programming_languages}
\todo{Introduction}
Machine learning research and application development have been carried out in various programming languages throughout history. In more recent history, the Python language has been used more frequently in the scientific community and, more specifically, in machine learning, and deep learning \cite{Raschka2020}. Unfortunately, Python's most used implementation is CPython, a single-threaded implementation with little regard for efficiency compared to compiled languages. However, Python's most popular toolkits for machine learning are implemented in compiled languages and use wrapper code to interact to increase performance. A study by Zehra et al. suggests that C++ has approximately a 50 times performance advantage over Python, and Python has advantages in code readability for beginners in programming \cite{Zehra2020}. It is clear from these studies that Python is great for prototyping and learning programming but is not suitable for performance-sensitive tasks. It is natural to seek an approach that can preserve the simplicity of Python while also maintaining acceptable task execution performance.
Pybind11 is one such framework that provides a method to create an efficient bridge between C++ and Python code. Pybind11 is a lightweight library that exposes C++ types in Python and vice versa but focuses mainly on exposing C++ code paths to Python applications. There is a minor performance penalty during the conversion between Python and C++ objects. Hence, implementations in C++ will run at near-native performance in Python. For this reason, we follow the path of implementing an efficient experiment toolkit for reinforcement learning in C++ with binding code to allow Python to interface with CaiRL.
\subsection{Summary}
The goal of CaiRL is to create an expanding set of high-performance environments for RL research. It is essential to encourage good practices by adding novel environments to the toolkit. Our extensive practical testing finds that rendering graphics in software provides substantially higher throughput for applications where access to the frame buffer is desirable. This observation is especially prominent for simple 2D and 3D-based applications. However, the benefits diminish as the graphical complexity increases. For example, it is clear from our findings that games such as StarCraft II render better using hardware acceleration.
We study the implications of implementation language for CaiRL and find that the choice of programming language is essential to CaiRL because it aims to be efficient and reduce the carbon emission footprint as much as possible. C++ seems like a natural choice as it is mature, has a stable standard library, and supersets the C language.
\section{Design Specifications}
\label{sec:design_specs}
The design goal of CaiRL is to have interoperability with AI Gym, but with orders of magnitude better performance and flexibility to support environments in a multitude of programming languages. Keeping full compatibility with AI Gym is central to trivializing the two frameworks without significant amendments to existing code.
CaiRL is a novel reinforcement learning environment toolkit for high-performance experiments. By designing such a toolkit, reinforcement learning becomes more affordable due to reduced execution costs and strives toward more sustainable AI. A bi-effect of these goals is that experiments run significantly faster, and most CPU cycles are spent on training AI instead of evaluating game states. The CaiRL environment toolkit supports classical RL problems such as (1) Cart-Pole, Acro-Bot, Mountain-Car, and Pendulum, (2) Novel, high-complexity games such as \anon{Deep RTS, \cite{Andersen2018a}, Deep Line Wars, X1337 Space Shooter}, and (3) over 1 000 flash games available for experimentation. \footnote{We invite the reader to \anon{\url{http://github.com/cair/rl}} for detailed toolkit documentation.}
The engine of CaiRL relies upon C++ with highly performant fast-paths such as Single Instruction Multiple Data (SIMD) for vectorized calculation that fits into the processor registry in a single instruction. The design of CaiRL mimics AI Gym but relies on templating and \code{const} expressions to evaluate calculations at compile-time instead of run-time. CaiRL is split into modules, and we dedicate this section to describing the design decisions and the resulting interaction layer and benefits compared to similar solutions.
\subsection{Building Blocks}
CaiRL follows the module design pattern to have minimal cross-dependencies between toolkit components. This has several benefits, namely (1) being easier to maintain and (2) reducing compile times significantly. CaiRL is composed of six essential modules:
\begin{enumerate}
\item \code{Runners} is a bridge for accessing non-native run-times, enabling a unified API for all environments. Flash environments use the Lightspark runner to run Flash games seamlessly. Similarly, Java games have a specialized Java Virtual Machine (JVM) runner.
\item \code{Renderers} is a module for drawing graphical frame buffer output to the screen. Currently, Blend2D and OpenCV are part of this module. This module is essential for training agents in graphical environments.
\item \code{Environments} are the module for integrating games and applications with a unified interface. This interface is near-identical to AI Gym but has less overhead because of the more efficient precompilation of machine code.
\item \code{Wrappers} are also similar to what is found in AI Gym. This module features code to wrap environment instances to change the execution behavior, such as limiting the number of timesteps before reaching the terminal state. The initial version of CaiRL features wrappers to flatten the state observation and add max timestamp restrictions.
\item \code{Spaces} are a module for defining the shape of state observation and action spaces, similar to AI Gym. All of the spaces use highly optimized code, which efficiently increases populating data matrices. The Box type features n-dimensional matrices, and finally, the Discrete type defines a one-dimensional vector of integers.
\item \code{Tooling} is the module for contributions that reach a stable state and enrich the features of CaiRL. One such example is the tournament framework that trivializes running single-elimination and Swiss-based tournaments.
\end{enumerate}
The CaiRL toolkit has exposed interfaces through its native C++ API and the Python API. The binding code is automatically generated for environments following the standard definition found in the \code{Env} class, but for highly customized implementations, such bindings must be added manually. Similarly, the CaiRL toolkit compiles Python-compatible machine code with significantly lower overhead when loaded and interpreted by CPython. See the discussion in Section \ref{sec:programming_languages}.
\subsection{Implementation Layer}
There are two ways of building reinforcement learning environments with CaiRL (1) using C++ directly or (2) through the Python to C++ bindings. CaiRL performs well in Python and C++ because most of the computation runs in optimized code. However, the Python bindings have additional computational costs because each line is interpreted and translated from Python and C++. The interpreter overhead can be reduced by diverging from the normal AI Gym API and implementing a \code{run} function, notably eliminating the need for interpreted loop code in Python. The primary goal of the CaiRL API is to match the AI Gym API to enable a seamless experience when migrating existing codebases to CaiRL.
\begin{lstlisting}[language=C++,label={lst:minicairl}, caption=Minimal Example of CaiRL-CartPole-v1 in C++]
e = Flatten<TimeLimit<200,CartPoleEnv>>()
for(int ep = 0; ep < 100; ep++){
e.reset();
int term, steps = 0;
while(!term){
steps++;
const auto [s1, r, term, info] =
e.step(e.action_space.sample());
auto obs = e.render();
}
}
\end{lstlisting}
Listing \ref{lst:minicairl} shows the C++ interface of the CaiRL toolkit. In C++, we deviate from the AI Gym API to allow modules as static template classes, as seen in line 1. A template defines a class that evaluates much of the program logic during compile-time. This has considerable run-time benefits because code initialization is done during compile-time. The downsides are that compile times increase substantially, and polymorphism is impossible between Python classes and C++ templates. However, it is possible to alleviate these challenges by predefining classes from the template implementations. This allows contributors to add Python-based environments to the repository of available experiments, however, at the cost of providing diminishing performance benefits.
A very central component of CaiRL is the ability to run experiments natively in Python. This becomes possible by creating code that interfaces C++ and Python using Pybind11. Pybind11 is a library that provides the ability to call code from the CaiRL shared library (C++ machine code) and the Python interpreter efficiently. There is no need for C++ experience using the Python binding code, and it is possible to use and customize CaiRL with Python for specialized experiments. The Python interface is similar to the C++ interface but focuses more on compatibility with the AI Gym interface.
\begin{lstlisting}[language=python,label={lst:minicairpython}, caption=Minimal Example of AI Gym and CaiRL CartPole-v1 in Python]
#e = gym.make("CartPole-v1")
e = cairl.make("CartPole-v1") # Use CaiRL
for ep in range(100):
e.reset()
term, steps = 0
while not term:
steps++
a = e.action_space.sample()
s1, r, term, info = e.step(a)
obs = e.render()
\end{lstlisting}
Listing \ref{lst:minicairpython} illustrates the use of CaiRL in Python compared to AI Gym. In particular, to change between AI Gym and CaiRL, the only change required is to use the cairl package (Line 2) instead of the gym package (Line 1).
\subsection{Affordable and Sustainable AI}
AI is a constantly growing field of research, and with the shifted focus on Deep Learning, it is well understood that the need for computing power has increased sharply. Deep Learning models have a range of a few thousand parameters, up to several billion parameters that require carefully tuning with algorithms such as stochastic gradient descent. Hence, compute power plays an essential role in the performance of the trained model. The same applies in Deep RL but requires extensive data sampling from an environment. It is reasonable to conclude that the cost of conducting trials increases rapidly and contributes against the emergence of more sustainable AI. CaiRL aims to minimize the cost of reinforcement learning by reducing environment execution time. In essence, this has the bi-effect of reducing the carbon emission footprint in RL significantly compared to existing solutions, as observed in section \ref{sec:perf_eval}.
\section{Game Run-times and Platforms}
This section presents the primary run-times that CaiRL supports to integrate environments from run-times other than Python and C++ seamlessly.
\subsection{JVM Applications}
Java is a popular programming language that runs in the Java Virtual Machine (JVM). Although Java is not the dominant language for environments in the RL research community, there are a few notable examples, such as MicroRTS \cite{Ontanon2013} and the Showdown AI competition \cite{Lee2017a}. These environments have shown significant value to several research communities in reinforcement learning, evolutionary algorithms, and planning-based AI. To integrate JVM-based games in CaiRL, the programmer defines configuration in a CMake file that describes how the source code is built to a Java archive (JAR) file. Then the programmer defines a C++ class that extends the \code{Env} class interface. The JVM and the C++ machine code communication is through the Java Native Interface (JNI). Using the JNI bridge, it is trivial to create a mapping from C++ to JVM, and it is conveniently also performant as the JVM has good optimization options. There are similar efforts to bridge Java games through JNI for games such as MicroRTS \cite{Huang2021}, but CaiRL aims toward a generic approach that encapsulates many existing games.
\subsection{Python Environments}
Python is arguably the most used programming language for RL research in recent literature, as suggested by Github tag statistics. We perform the following the search queries: \code{topic:reinforcement-learning+topic:game+language:python} for finding relevant Python environments, and \code{topic:reinforcement-learning+topic:game+language:c++} for C++ environments. We observe a ratio of 114:1 in favor of Python. Consequently, many of the popular reinforcement learning environments have native Python implementations. We approach the task of improving such environments with two possible solutions. The first approach automatically converts Python code into C++ using the Nuitka library found at \url{https://github.com/Nuitka/Nuitka}. It is also possible to add environments directly as a CaiRL Python package, although this method does not improve the performance and does not address climate emission concerns. All third-party environments reside in the \code{cairl.contrib} package and are freely available through the C++ and Python interface. For an environment to be fully compatible with the CaiRL interface, the environment must inherit the abstract \code{Env} class and implement the \code{step(action)}, \code{reset()} , and \code{render()} function. However, there are several open questions on how to efficiently improve the performance of most environments implemented in Python, see Section \ref{sec:future_work}.
\subsection{Flash Run-time}
The most notable feature of CaiRL is the ability to run flash games without external applications. CaiRL extends the LightSpark flash emulator for Actionscript 3 and falls back to GNU Gnash for ActionScript 2. CaiRL features a repository of over 1300 flash games for conducting AI research and reinforcement learning research. In this paper, we focus on the Multitask environment. Multitask is an environment that provides minigames that the agent must control concurrently. If the agent fails one of the tasks, the game terminates. The reward function is defined as positive rewards while the game is running and negative rewards when the game engine terminates (e.g., end of the game), indicating that the game is lost. The game observations are either raw pixels or the virtual Flash memory, and the actions-space is discrete. Our observation is that most existing Flash games have short-horizon episodes with few objectives to reach a positive terminal state. In addition, many of the games have simple game rules that are especially suited for benchmarking non-hierarchical RL algorithms. The CaiRL flash runner substantially expands the number of available game environments for experiments. To the best of our knowledge, CaiRL is the only tool that can control the game execution speed and guarantee broad support for Actionscript 2 and 3.
\subsection{Puzzle Run-time}
CaiRL supports the comprehensive collection of puzzles from the Simon Tatham collection\cite{Bauer2021}. This collection aims to provide logical puzzles that are solvable either by humans or algorithms. While reinforcement learning is not mainly known for solving logical puzzles, some literature suggests that RL can solve puzzles \cite{Dandurand2012}, potentially with the options framework from \cite{Sutton1999}. We find it beneficial to add puzzles for future research and demonstrate flexibility in adding new problems and environments. All puzzles include a heuristic-based solver, enabling transfer and curriculum learning research.
\section{Evaluations}
\subsection{Performance Evaluation}
\label{sec:perf_eval}
To evaluate the performance of CaiRL, we compare the classic control environments from AI Gym with an identical implementation using the CaiRL toolkit. Experiments run for 100 000 timesteps, and the measurements are averaged over 100 consecutive trials. The environments are evaluated with and without graphical rendering to demonstrate the effectiveness of raw computation speed and software rendering.
\begin{figure}[ht]
\includegraphics[width=\linewidth]{images/performance.pdf}
\label{fig:demo_0}
\caption{Execution run-time evaluation between CaiRL and AI Gym in the classical control tasks. The x-axis illustrates the execution time for 100 000 runs (episodes), averaged over 100 trials. The rows show the console and render versions in CaiRL and AI Gym.}
\end{figure}
Figure \ref{fig:demo_0} demonstrates the average console and rendering performance and clearly shows that CaiRL performs 5x faster in simulations and over 80x faster on rendering than the AI Gym equivalent. The console experiment indicates the raw performance boost when using high-performance programming languages. As discussed in Section \ref{sec:graphics-accel}, the graphical experiment validates the effectiveness of rendering the frame buffer in software instead of using hardware methods. Specifically, the rendering backend in AI Gym utilizes OpenGL and has far greater computational costs when accessing frames, often desirable in RL research.
\subsection{Algorithm Evaluation}
The scope of the algorithm evaluation is two-fold. First, we aim to find if CaiRL implementations can improve training time in that they are measurable, hence having positive effects on economics and climate emission rates. Finally, we evaluate if DQN can improve its behavior using the Flash Run-time in the Multitask game environment. We use the default hyperparameters proposed by \cite{Mnih2015} and use raw images as input to the algorithm for both experiments. The experiments run using an Intel 8700K CPU and an Nvidia GeForce 2080TI.
\begin{figure}[ht]
\includegraphics[width=\linewidth]{images/dqn_classical_control.pdf}
\label{fig:classical_control_dqn}
\caption{The average DQN training time for 100 runs in the classical control environments. The x-axis is the total execution time in milliseconds for training the agent 100 times until reaching the optimal strategy. Each time the agent converges, the policy is reset with a fixed randomization seed.}
\end{figure}
Figure \ref{fig:classical_control_dqn} clearly shows that the DQN algorithm is trained magnitudes faster in the CaiRL environment, indicating that a large part of the training time is the result computation time during sampling the environment. The algorithm trains until mastering the task (stopping criteria) for 100 trials, after which we average the results. Our findings conclusively show substantial wall-clock time reductions for training in the CaiRL environments compared to the AI Gym environments. The average reduction in training time across all trials is roughly 30 percent, illustrating and confirming that efficient environments are essential for developing AI that trains more climate-friendly.
\begin{figure}[ht]
\includegraphics[width=\linewidth]{images/dqn_multitask.pdf}
\label{fig:multitask_dqn}
\caption{DQN performance in the Multitask environment. The algorithm solves the environment after approximately 3 000 000 timesteps where the training procedure is averaged over 10 trials.}
\end{figure}
Figure \ref{fig:multitask_dqn} shows that the DQN algorithm successfully solves the multitask environment after approximately 1 500 000 frames averaged over ten trials. Note that we here only wish to verify that algorithms can learn from the flash game engine. By unlocking the frame rate of the simulation, it is possible to achieve approximately 140 frames per second using Intel 8700K in the Multitask environment. Compared to running the simulation in the integrated flash run-time in browsers, our approach increases the game execution speed to a factor of 4.6x in a majority of flash games. This is because Flash games have the game loop inside the rendering loop. Each training trial took approximately 6 hours to finish, and in total, the experiment lasted for 60 hours.
\subsection{Carbon Emission Evaluation}
\label{sec:carbon_emission}
This section aims to answer the following question: \textit{Is CaiRL a better alternative for lowering carbon emissions in RL}. To begin answering this question, we rerun experiments with the novel experiment-impact-tracker from \cite{henderson2020towards}. The experiment-impact-tracker is a drop-in method to track energy usage, carbon emissions, and compute utilization of the system and is recently proposed to encourage the researcher to create more sustainable AI. Our experiments run a DQN agent on the classical control environment CartPole-v1 in CaiRL and AI Gym. We compare the toolkits using the console-only version and the graphical variant. We use the following environment configurations and DQN parameters:
\begin{table}[!ht]
\centering
\caption{The DQN hyperparameters for the carbon emission experiment}
\label{tab:dqn_hyperparameters}
\begin{tabular}{l|l}
\textbf{Hyperparameter} & \textbf{Value} \\ \hline
Discount & 0.99 \\
Units & 32, 32 \\
Activation & elu \\
Optimizer & Adam \\
Loss Function & Huber \\
Batch Size & 32 \\
Learning Rate & 3e-4 \\
Target Update Freq & 150 \\
Memory Size & 50 000 \\
Exploration Start & 1.0 \\
Exploration Final & 0.01
\end{tabular}
\end{table}
The experiment runs for 1 000 000 timesteps in the console version and 10 000 timesteps for the graphical version\footnote{The experiments code be accessed at \anon{\url{https://github.com/cair/rl}}. }
\begin{table}[!ht]
\centering
\caption{The table describes the total carbon emission values and power consumption used during the experiments. The carbon emission is measured in CO2/kg, and the power draw is measured in milliwatt-hour (mWh).}
\label{tab:co2_results}
\begin{tabular}{llllll}
\hline
Measurement & Environment & CaiRL & Gym & Ratio \\
CO2/kg & Console & \textbf{0.000014 }& 0.000067 & 20.8955 \\
CO2/kg & Graphical & \textbf{0.000051} & 0.075265 & 147578.431373 \\
Power (mWh) & Console & \textbf{0.000319} & 0.001483 & 21.5104 \\
Power (mWh) & Graphical & \textbf{0.001131} & 1.673959 & 148006.9849 \\
\hline
\end{tabular}
\end{table}
Table \ref{tab:co2_results} shows that CaiRL has a considerably lower carbon emission than AI Gym. CaiRL has 20.89x less carbon emission in the console variant than Gym. The graphical experiment shows a more significant difference with a 147578x reduction in carbon emissions. The reason AI Gym has high emission rates is that it is locked to capturing images from the game window. We measure the emissions by subtracting the DQN time usage with the total time to only account for the environment run-time costs.
\section{ Conclusion}
CaiRL is a novel platform for RL and AI research and aims to reduce program execution time for experiments to reduce budget costs and the carbon emission footprint of AI. CaiRL outperforms AI Gym implementations significantly while also being compatible with existing AI Gym experiments. However, for CaiRL to be effective, code needs to be ported to the CaiRL toolkit. While this may seem tedious, it reduces execution times, reducing RL experiments' economic and climate-related footprint. However, there are preliminary options for automatically translating code from Python to C++, such as using the Nuitka compiler.
This contribution clearly outlines new recommendations and considerations for developing new environments for RL research. First, we recommend using low-level languages such as C++ to implement the logic and, optionally, using code binding libraries for interoperability between run-times. The effectiveness of this approach is further demonstrated by \cite{Bargiacchi2021, Fua2020}. Second, for 2D graphics, it is clear from our literature review that using software rendering with SIMD capabilities may provide significant benefits when accessing the frame buffer. Following these recommendations, we show that CaiRL has 30\% less overhead than AI Gym.
Lastly, we have illustrated that CaiRL supports many programming languages, including C++, Java, Python, and ActionScript 2 and 3. CaiRL supports over 1300 games in ActionScript, Several C++ games, MicroRTS, and Showdown in Java and supports building python games out of the box. In the evaluations of CaiRL, we demonstrate superiority in performance and positively impact the carbon footprint of AI.
\section{Future Work}
\label{sec:future_work}
This paper has presented CaIRL, a reinforcement learning toolkit for running a wide range of environments from different run-times in a unified framework.
CaiRL is an ambitious project to improve the tools required to conduct efficient reinforcement learning research. In fulfilling its role, the complexity of the toolkit demands extensive testing and verification to ensure that all experiments are performed following the original version to provide reliable experiment results. While CaiRL is now released, several interesting problems potentially can improve the environment performance further. For the continuation of this project, we believe that the following concerns may prove valuable to address:
\begin{itemize}
\item Find a suitable method of automatic conversion of Python code. Alternatively, be able to run Python code in more efficient run-times, such as the JVM.
\item Improve the JVM and Flash support so that researchers can more easily add new environments.
\item Expand the number of run-times that CaiRL supports while maintaining portability and efficiency
\item Perform static code analysis and recommend code quality improvements and efficiency to further reduce the climate footprint of environments.
\end{itemize}
\bibliographystyle{IEEEtran}
|
{
"timestamp": "2022-10-05T02:03:42",
"yymm": "2210",
"arxiv_id": "2210.01235",
"language": "en",
"url": "https://arxiv.org/abs/2210.01235"
}
|
"\\section{Introduction} \\label{sec:intro}\n\\input{sections/intro.tex}\n\n\\begin{figure*}[t]\n (...TRUNCATED)
| {"timestamp":"2022-10-05T02:01:05","yymm":"2210","arxiv_id":"2210.01166","language":"en","url":"http(...TRUNCATED)
|
"\\section{Introduction}\nThe unconditional security offered by quantum key distribution (QKD) relie(...TRUNCATED)
| {"timestamp":"2022-10-05T02:02:07","yymm":"2210","arxiv_id":"2210.01204","language":"en","url":"http(...TRUNCATED)
|
"\\section{Introduction}\\label{sec:introduction}\n\t\n\tFederated Learning (\\mtext{FL}) is designe(...TRUNCATED)
| {"timestamp":"2022-10-05T02:01:18","yymm":"2210","arxiv_id":"2210.01176","language":"en","url":"http(...TRUNCATED)
|
"\\section*{References}}\n\\graphicspath{{figures/}}\n\n\\include{preamble}\n\n\\journal{Computers a(...TRUNCATED)
| {"timestamp":"2022-10-05T02:04:21","yymm":"2210","arxiv_id":"2210.01251","language":"en","url":"http(...TRUNCATED)
|
"\\section{0pt}{1.0ex plus 0.5ex minus 0.2ex}{0.5ex plus 0.3ex minus 0.2ex}\n\n\\makeatletter\n\n\\d(...TRUNCATED)
| {"timestamp":"2022-10-05T02:03:51","yymm":"2210","arxiv_id":"2210.01240","language":"en","url":"http(...TRUNCATED)
|
"\\section{Introduction}\n\nSuppose that $T$ is an $\\forall\\exists$-axiomatizable theory in some c(...TRUNCATED)
| {"timestamp":"2022-10-05T02:02:59","yymm":"2210","arxiv_id":"2210.01223","language":"en","url":"http(...TRUNCATED)
|
"\\section*{Abstract}\nWe identify three-state Potts paramagnets with gapless edge modes on a triang(...TRUNCATED)
| {"timestamp":"2022-10-07T02:02:57","yymm":"2210","arxiv_id":"2210.01187","language":"en","url":"http(...TRUNCATED)
|
End of preview.
No dataset card yet
- Downloads last month
- 7