diff --git "a/data_all_eng_slimpj/shuffled/split2/finalzzoubb" "b/data_all_eng_slimpj/shuffled/split2/finalzzoubb" new file mode 100644--- /dev/null +++ "b/data_all_eng_slimpj/shuffled/split2/finalzzoubb" @@ -0,0 +1,5 @@ +{"text":"\\section{Introduction}\n\nIncreasing spatial resolution allows to observe directly parts of active galactic nuclei. However,\nthe innermost part is still unresolved and the information about its geometrical structure comes \nfrom spectroscopy. This structure is very complex, so vigorous discussions of inflow\/outflow \nare still going on. Among this unsolved problems is the origin of Broad Emission Lines. \n\nBroad Emission Lines come from a specific Broad Emission Line Region (BLR), as seen in well separation of \nthe Broad and narrow components in the emission lines of active galaxies. They cover significant fraction \nof the AGN sky, between 10 and 30 \\%, as implied by their luminosity, but they are rarely seen in\nabsorption (for rare exceptions, see e.g. Risaliti et al. 2011) which argues for the flat \nconfiguration (e.g. Nikolajuk et al. 2005, \nCollin et al. 2006), mostly hidden inside \nthe outer dusty-molecular torus. The motion of the material is roughly consistent with \ncircular Keplerian orbits (Wandel et al. 1999), but with significant additional velocity dispersion. Careful studies\nindicate two components of the BLR (Collin-Souffrin et al. 1988): High Ionization Lines (HIL; e.g. CIV) \nand Low Ionization Lines (LIL; e.g. H$\\beta$, Mg II). HIL show blueshift with respect to narrow lines and they\nare considered to be comming from outflowing wind. LIL do not show significant shift so cannot come from outflow,\nbut the region cannot be supported by the hydrostatic equilibrium. Therefore, the dynamics of LIL is\ndifficult to understand from theoretical point of view, and it is also not resolved by direct\nmonitoring (e.g. Peterson et al. 2004). \n\n\\begin{figure}[t]\n\\begin{center}\n\\hfill~\n \\includegraphics[width=0.6\\textwidth]{czernyb_talk_fig1.eps}\n\\hfill~\n \\caption{Schematic picture of the formation of the BLR. The outflow starts where the disk effective temperature drops below 1000 K and dust formation can proceed. Dusty outflow changes into a failed wind above the disk, where the irradiation leads to dust evaporation, the radiation pressure suport rapidly decreases and the material falls back onto the disk.}\n\\end{center}\n\\end{figure}\n\n\\section{Accretion Disk Temperature at the Onset of BLR}\n\nHere we show that the combination of the simplest accretion disk theory and the reverberation\nmeasurement of the BLR distance leads to surprising conclusion: the effective temperature of the\naccretion disk at the radius measured from reverberation is universal and equal to 1000 K. The argument goes\nin the following way (for more details, see Czerny \\& Hryniewicz 2011).\n\nThe measurements of the delay of the H$\\beta$ line with respect to the continuum at 5100 A for close to 40 objects\nallowed to determine the relation between the BLR size, as measured from such delay, and the monochromatic flux\n(Kaspi et al. 2000, Peterson et al. 2004). The most recent form of this relation, corrected for the starlight \ncontamination, was derived by Bentz et al. (2009). This relation can be written in the following way\n\\begin{equation}\n\\log R_{BLR}[{\\rm H}\\beta] = 1.538 \\pm 0.027 + 0.5 \\log L_{44,5100},\n\\label{Bentz}\n\\end{equation}\nwhere $R_{BLR}[{\\rm H}\\beta]$ is in light days and $L_{44,5100}$ is the monochromatic luminosity at \n5100 \\AA~ measured\nin units of $10^{44}$ erg s$^{-1}$. The value 0.027 is the error in the best-fit vertical \nnormalization.\n\nNow, from the simplest theory of the alpha disk (Shakura \\& Sunyaev 1973) we can find the monochromatic flux. The\nasymptotic formula is usually known in the form\n\\begin{equation}\nL_{\\nu} \\propto \\nu^{1\/3},\n\\end{equation}\nbut the proportionality coefficient is also known, and depends on the black hole mass, $M$, and accretion rate,\n$\\dot M$ as $(M \\dot M)^{2\/3}$. Taking into account this dependence, physical constants and fixing the frequency at\nthe value corresponding to the wavelength 5100 A, we have\n\\begin{equation}\n\\log L_{44,5100} = {2 \\over 3} \\log (M \\dot M) - 43.8820 + \\log \\cos i.\n\\label{L5100}\n\\end{equation} \nThis formula allows us to calculate the BLR radius from the Eq.~\\ref{Bentz}, if the\nproduct of ($M \\dot M$) is known.\n\nThe Shakura-Sunyaev accretion disk theory allows us to calculate the effective temperature of the disk at that \nradius as a function of the black hole mass and accretion rate\n\\begin{equation}\nT_{eff} = \\left ({3GM \\dot M \\over 8 \\pi r^3 \\sigma_B}\\right )^{0.25},\\label{Teff}\n\\end{equation}\nwhere $\\sigma_B$ is the Stefan-Boltzmann constant. Since BLR is far from the central black hole, the inner boundary effect can be neglected.\n\nWhen we combine Eqs.~\\ref{Bentz}, \\ref{L5100}, and \\ref{Teff}, the dependence on the unknown mass and accretion rate vanishes, and we obtain a single value for all the sources in the sample\n\\begin{equation}\nT_{eff} = 995 \\pm 74 {\\rm K},\n\\end{equation}\nwhere the error reflects the error in the constant in Eq.~\\ref{Bentz}. We stress that the resulting value does not depend either on the black hole mass or accretion rate. The value is universal, for all sources.\n\n\\section{BLR Formation Mechanism}\n\nThe value of the universal temperature of $\\sim 1000$ K immediately hints that the physical mechanism of the BLR\nformation is related to the dust formation in the accretion disk atmosphere. The dust opacity is large, and even \nmoderate radiation flux from the underlying disk can push the dusty material off the disk surface. This dusty \noutflow, however, cannot proceed too far from the disk plane. Lifted material is irradiated by the strong \nUV and X-ray flux from the central region, the material heats up, the dust evaporates, the opacity rapidly decreases,\nand in the absence of the strong radiation pressure the material fall back again onto the disk surface. Therefore,\nsuch a failed wind can account for lifting the material relatively high above the disk plane and at the same time\ndoes not give a strong systematic signatures of outflow since both outflow and inflow are present.\n\nThe overall geometry is shown in Fig.~1. The BLR region starts were the disk effective temperature, without \nirradiation from the central region, falls below \n1000 K, and it ends up at larger distance when the material has the temperature below 1000 K even if the \nirradiation is included. This outer radius marks the transition to the outer dusty\/molecular torus, where the \nirradiation is too weak to \nlead to dust evaporation and the outflow proceeds. \n\n\n\\section{Application to the Dark Energy Study}\n\nIt was already proposed by Watson et al (2011) that Eq.~2.1 can be used to determine the distance to a quasar in a way independent from the redshift. Reverberation measures the BLR size directly from the time delay, and Eq.~2.1 gives us the intrinsic monochromatic luminosity. This, combined with the observed monochromatic luminosity, gives the luminosity distance to the source. If a number of distant quasars are measured, a luminosity distance vs. redshift diagram can be constructed. Our interpretation of the BLR formation supports the view that Eq.~2.1 can apply to high redshift objects as well, since the mechanism is based on dust formation, this in turn is connected with medium metalicity, and the metalicity of distant quasars is known to be roughly solar.\n\nWith this in mind, we started a monitoring program with the Southern Africal Large Telescope. We choose intermediate quasars and Mg II line which belongs to LIL class, as H$\\beta$, and should not show rapid intrinsic variations characteristic for CIV line.\n\n\\section{Spectroscopy}\n\n\\subsection{Observations and Data Reduction}\n\nIn order to test the feasibility of spectroscopic studies of the corresponding\nobjects we have obtained a pair of medium resolution spectra of the quasar\nLBQS 2113-4538.\nThe observations have been performed using the Robert Stobie Spectrograph\non Southern Africal Large Telescope in the service mode. The observing data\nwas collected in two blocks, in the nights May 15\/16, 2012 (UT) and July 30\/31, 2012 (UT).\nEach block consists of a pair of 978 second exposures of the target spectrum\nfollowed by an exposure of the spectrum of the Argon calibration lamp, and\na set of flat-field images.\n\nInitial data reduction steps: gain correction, cross-talk correction,\noverscan bias subtraction and amplifier mosaicking have been performed\nby the SALT Observatory staff using a semi-automated pipeline\nfrom the SALT PyRAF package.\n\nFlat-field correction and further reduction steps have been performed\nusing procedures within the IRAF \npackage\\footnote{IRAF is distributed by the National Optical Astronomy\nObservatories, which are operated by the Association of Universities\nfor Research in Astronomy, Inc., under cooperative agreement with the\nNSF.}.\nThe pairs of adjacent spectrum images of LBQS 2113-4538 have been\ncombined into a single image. This enabled us to efficiently reject\ncosmic rays and raise the signal to noise ratio.\n\nIdentification of the lines in the calibration lamp spectrum, wavelength\ncalibration, image rectification and extraction of one dimensional spectra\nhave been done using functions from noao.twodspec package within IRAF.\n\n\\subsection{Preliminary results}\n\n\\begin{figure}[t]\n\\begin{center}\n\\hfill~\n \\includegraphics[width=0.4\\textwidth]{czernyb_talk_fig2.eps}\n\\hfill~\n \\caption{Two observations of the Mg II line of the quasar LBQS 2113-4538, separated by $\\sim 100$ days (preliminary results) made with SALT. The shape of the line has clearly changed, and the line intensity has changed by 9 \\%, which allows for a systematic monitoring of this source.}\n\\end{center}\n\\end{figure}\n\nIn Fig. 2 we present the two profiles of MgII line in the observed object.\nThe shape of the line has clearly changed during the $\\sim 75$ days period between the first and the second exposure. The line intensity has changed by 9 \\%. Thess facts allow for a systematic\nmonitoring of this source.\n\nWe now perform Monte Carlo simulations in order to optimize the project.\n\n\\section{Conclusions}\n\nWe propose that dust forms not only in the outer dusty\/molecular torus, but also closer in, in the non-irradiated thin disk atmosphere. This dust is responsible for the formation of the failed wind which accounts for the formation of the Low Ionization Line part of the Broad Line Region.\n\nThis interpretation automatically explains why the size of the BLR scales with the square root of the monochromatic, instead of bolometric, luminosity. It also solves the problem of high turbulence in the region without signatures of the systematic outflow. Since the this mechanism of BLR formation seems universal, and there is no strong metalicity gradients in quasars up to high redshift, this also justifies the use Eq.~2.1 for distant quasars as a way to measure their luminosity distance and probe the dark energy distribution. \n\n{\\underline{\\it Acknowledgements}}. This work was supported in part by grants NN N203 387737, NN 203 580940 and Nr. 719\/N-SALT\/2010\/0. \nAll of the observations reported in this paper were obtained with the Southern African Large Telescope (SALT).\n\n\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}} +{"text":"\\section{Introduction}\nDynamic environments still pose a challenge in robotics. A capability to detect moving objects allows extending results of various studies performed for static scenes to dynamic environments. Although much research such as the background subtraction method has been carried out to recognize moving objects, it is ineffective in scenes where moving objects occupying a major portion of the image, {(which we refer to as ``moving objects \\textit{dominate} the scene\").} \nSuch situations happen frequently when moving objects are nearby and should be treated as a top priority. \n\n\\begin{figure}[t]\n \\centering\n\\begin{subfigure}{.22\\textwidth}\n \\centering\n \\includegraphics[width=.9\\textwidth]{figures\/obj000600.png}\n \\caption{Object detection result}\n \\label{fig:first_sfig3}\n\\end{subfigure} %\n\\begin{subfigure}{.22\\textwidth}\n \\centering\n \\includegraphics[width=.9\\textwidth]{figures\/lenna_mask_first.png}\n \\caption{Object detection result}\n \\label{fig:first_sfig4}\n\\end{subfigure} \\\\\n\\vspace{0.15cm}\n\\begin{subfigure}{.22\\textwidth}\n \\centering\n \\includegraphics[width=.9\\textwidth]{figures\/residual_robust.png}\n \\caption{Residual image from the robust DVO}\n \\label{fig:first_sfig5}\n\\end{subfigure} %\n\\begin{subfigure}{.22\\textwidth}\n \\centering\n \\includegraphics[width=.9\\textwidth]{figures\/residual_proposed.png}\n \\caption{Residual image from the proposed method }\n \\label{fig:first_sfig6}\n\\end{subfigure} \n\n\\caption{ Results of moving object detection. (a), (b) are the results of detecting moving objects, and (a) contains a large moving object which dominates the scene with a freely moving camera. (c) Typical DVO only approach reaches a local minimum whereas (d) the proposed method demonstrates that the global optimum to the background is reached.}\n\\label{fig:first}\n\\vspace{-0.7cm}\n\\end{figure}\nTo address the above-mentioned problems arising from dynamic environments, we propose an occlusion accumulation method. The proposed method utilizes both depth and camera pose information obtained from VO to detect moving objects without a particular background model. Some direct VO methods using robust regression weight \\cite{Kerl2013ROE} are not able to track the accurate camera pose by falling into a local minimum when a moving object dominates the scene. In this work, we use the estimated camera pose up to the previous image to distinguish the moving objects and exclude them from the images to find the next camera pose. {If only the robust regression in the optimizer (bi-square regression in this paper) is used, the camera pose is likely to be estimated with respect to the moving object when the moving object dominates the scene. In the proposed method that estimates the camera pose with robust regression, the method excludes the moving object before it dominates the scene. Unlike the other mapping methods where memory usage increases each time an image is processed, the memory requirement of the proposed method is not heavy regardless of a long duration of image sequences, because it continuously updates the single occlusion information. }\n\n\nWe warp the previous depth image using the estimated camera pose and subtract with the current depth image. Accumulating those subtracted values shows a similar result to the background subtraction without relying on background modeling. Our method is robust to the effect of the moving object which dominates the scene and avoids other problems that occur when the background is incorrectly modeled. It is possible to detect a moving object which was originally static and regarded as the background. \n\nThe purpose of our research is to detect moving objects and to improve the performance of arbitrary VO in dynamic environments. Our contributions are summarized as follows.\n\n\\begin{itemize}\n\n\\item We suggest {a new method of the occlusion accumulation} which can detect moving objects that dominate the scene, without a background model. \n{\\item Our algorithm can improve the performance of any VO algorithm in a dynamic environment by augmenting it.}\n\\item The proposed algorithm can detect objects which have similar texture to the background and can be further improved by using an externally obtained camera pose.\n\n\n\\end{itemize} \n\n\\section{Related Work}\n\nThere are several types of moving object detection algorithms\n\\cite{Mehran2018NTMOD} using background modeling, trajectory classification, etc. The methods in \\cite{Amitha2015BMBC,EEDMTF,MODTTVCMC,BSMCAG}, belonging to the category of background modeling, commonly extract feature points and clustered features to distinguish the background and the foreground. They warp the previous image with homography transform attained from features in the dominant cluster. Such methods show a quite accurate object segmentation result in the scenes dominated by the background, but they assume that the dominant cluster is from a background, and they take a few seconds to process. \n\nIn \\cite{Yi2013DMONC}, the background and foreground are distinguished by a dual-mode single Gaussian model (SGM). The adaptive adjustment of the SGM learning rate reduces computation time, but some moving objects are perceived as background if the background is similar in color to the object.\n\nIn \\cite{BSFMC}, trajectory classification is conducted. They collect points that are tracked for several frames and find the dominant camera motion by applying RANSAC on the trajectories for tracked points. The authors defined conditional probability on trajectory models and applied the maximum a posterior rule to distinguish the points included in the moving object. The authors of \\cite{BSMCBTSLI, OSLTAPT} also propose a trajectory classification method by defining a low-dimensional descriptor for describing trajectory shape or spectral clustering with spatial regularity. They detect the outlier trajectories whose sum of the Euclidean distance to trajectories of the nearest neighbors exceeds a specified threshold or by using K-means clustering. The methods of \\cite{BSFMC, BSMCBTSLI, OSLTAPT} \nrequire an appropriate feature extraction method, and they may show sparse segmentation results due to utilization of the tracked features.\n\nBecause the aforementioned methods aimed to detect moving objects or tracking objects far from the camera, they used datasets where the background dominates the scene such as a surveillance system or sports relay. On the other hand, in robotic applications, because it is important to process in real-time and detect nearby objects which may occupy the scene, these studies can become less effective.\n\nWith the growing popularity of RGB-D cameras such as Kinect and ASUS Xtion PRO, moving object detection algorithms have begun to utilize them. The method in \\cite{MDTSA} estimates camera ego-motion using depth values, and then it uses a homogeneous transformation to warp the previous frame as in \\cite{Amitha2015BMBC}, \\cite{EEDMTF}, and \\cite{MODTTVCMC}. The segmentation is achieved by the particle filter and vectorization method. Accurate image warping is performed using depth values, but the problem of objects occupying a major portion of the image is not addressed in these methods. In \\cite{Javed2017OSRPCA}, they calculated a spatiotemporal graph Laplacians and spatial smoothness among the background pixels. Then, they adapt RPCA to incorporate two approaches for classifying foreground from background. Due to the high computational complexity of RPCA, computation time per frame is several seconds.\n\nIn the field of visual odometry, many studies have investigated camera pose estimation in dynamic environments by reducing the effect of the moving objects. In \\cite{Kerl2013ROE, RRVOD} and \\cite{kerl2012}, the camera pose is estimated by assigning the t-distribution or Huber norm weights, so that the dense visual odometry (DVO) method performs properly in some dynamic environments. The method of \\cite{Kim2016EBMB} labels the background with a non-parametric model and depth images obtained from the RGB-D camera, and estimates the camera pose by modifying the energy-based DVO. The algorithm would be ineffective when used for object detection, because they focus on labeling the background to estimate pose stably and does not label the moving object.\n\nThe method suggested in \\cite{leereal} performs rigid motion segmentation on RGB-D camera by a grid-based optical flow. The process of flow calculation and spatial, temporal segmentation was conducted in real-time, but the resulting segmentation \\cite{leereal} was a low resolution that is not as clear as the silhouette-shaped segmentation.\n\nIn \\cite{Jaimez2017FOSF}, the authors propose a robust camera pose estimation in dynamic environments and 3D scene-flow estimation on the moving object by applying depth geometric clustering and checking whether clusters match the camera motion of images. \nThey labeled the foreground and background as probability, and utilize the probability label as a weighing factor on pose estimation to perform well in dynamic environments. The algorithm does not clearly distinguish moving objects and the specified number of clusters would affect the performance. \n\n\n\\section{Moving Object Segmentation}\n Various factors such as illumination change, moving object, camera ego-motion induce image changes. Assuming that the photo-consistency assumption is not violated, in a static scene that involves moving objects with fixed camera, image change indicates the moving objects. In a dynamic scene which has arbitrary camera motion, we can attain a motionless image by warping the previous image with the estimated camera pose. We use the camera pose estimated from DVO with robust regression weight in this paper. We will refer to DVO with robust regression weight as robust DVO in this paper and more details about robust regression weight will be covered in Section \\ref{pose_esti}. After attaining a motionless image, the dynamic scene can be treated as a static scene. We focus on this feature and detailed explanation will follow.\n \n\\subsection{Occlusion Accumulation} \n When a moving object roams in the scene, depth can be changed. The depth change can be classified into two kinds. The first one is occlusion: the object will occlude the background in the head of the direction of movement. The second one is reappearance: the background will appear in the tail of the direction of movement. We assume that the depth of background is larger than that of the moving object. Object which pass the rear of the static background such as pillar, tree, etc. do not affect the depth value. We consider the pixel whose depth value changes to a smaller value as a pixel of the moving object.\n\n The occlusion map and the warping function are defined as\n\\begin{equation} \\label{def_occ}\n \\Delta Z_{i}(u,\\xi_{i}^{i+1}) = Z_i(\\text{w}(u,\\xi_{i}^{i+1})) - Z_{i+1}(u)\n\\end{equation}\nand\n\\begin{equation} \\label{def_warp}\n \\text{w}(u,\\xi_i^{i+1}) = \\pi (\\text{exp}(\\xi_i^{i+1})\\pi^{-1}(u,Z_i(u)))\n\\end{equation}\n where $Z_{i}(u)$ is the \\textit{i}th depth image and $u$ is a pixel on image $\\Omega (640 \\times 480)$. $\\xi_i^{i+1} \\in \\mathbb{R}^6 $ represents the 6-DOF camera pose parameter between the \\textit{i}th frame and the (\\textit{i}+1)th frame. The project function $\\pi: \\mathbb{R}^3 \\xrightarrow{}\\mathbb{R}^2$ maps a 3D point into a 2D image pixel. The term $ \\text{exp}(\\xi_i^{i+1}) \\in \\text{SE}(3) $ represents the transformation matrix for the corresponding camera pose parameter $\\xi_i^{i+1}$.\n\n If $\\Delta Z_{i} > 0$, it means that the depth has become smaller, i.e. the occlusion has occurred. Otherwise, $\\Delta Z_{i} < 0$ means that the depth has increased, i.e. the reappearance. \n We define the occlusion accumulation map by\n\\begin{align} \\label{def_accum}\n A_{i+1} (u) &= \\Delta Z_{i}(u,\\xi_{i}^{i+1}) + \\Tilde{A}_{i} (\\text{w}(u,\\xi_{i}^{i+1}))\\nonumber \\\\\n &\\approx \\Delta Z_{i}(u,\\xi_i^{i+1}) + \\sum_{k=1}^{i} \\Delta Z_{k}(\\text{w}(u,\\xi_{k+1}^{i}),\\xi_k^{k+1})\\nonumber \\\\\n &\\approx Z_{k_u}(\\text{w}(u,\\xi_{k_u}^{i+1})) - Z_{i+1}(u)\n\\end{align}\n The initial occlusion accumulation map is set as $A_{1}(u)=0$ for $\\forall u \\in \\Omega$ and $k_u$ is the index of the frame which first observed the pixel $u$ of the current frame. The $\\Tilde{A}(u)$ is truncated $A(u)$ and described later in Eqs.\\eqref{def_accum_re1} and \\eqref{def_accum_re2}, \n\n \n The warped pixels before the index at $k_u$ would be out of the observation window $\\Omega$ and there is nothing to calculate. The value of $\\Delta Z$ would reveal zero values for these indices.\n\n \n \\begin{figure}\n \\centering\n\\begin{subfigure}{.22\\textwidth}\n \\centering\n \\includegraphics[width=.9\\textwidth]{figures\/lenna1.png}\n \\caption{Color image}\n \\label{fig:sfig1}\n\\end{subfigure} %\n\\begin{subfigure}{.22\\textwidth}\n \\centering\n \\includegraphics[width=.9\\textwidth]{figures\/lenna2.png}\n \\caption{Masked image}\n \\label{fig:sfig2}\n\\end{subfigure} \\\\\n\\vspace{0.15cm}\n\\begin{subfigure}{.22\\textwidth}\n \\centering\n \\includegraphics[width=.9\\textwidth]{figures\/dZdt.png}\n \\caption{$\\Delta Z(u)$}\n \\label{fig:sfig3}\n\\end{subfigure} %\n\\begin{subfigure}{.22\\textwidth}\n \\centering\n \\includegraphics[width=.9\\textwidth]{figures\/Au.png}\n \\caption{$A(u)$}\n \\label{fig:sfig4}\n\\end{subfigure}\n\\caption{Illustration of the occlusion accumulation method. $A(u)$ represents the accumulation of $\\Delta Z(u)$ over time. A bright area is a region where $A(u)$ shows a positive value and is considered as a moving object, and a dark area is a region where $A(u)$ shows a negative value and the background is revealed again. The middle gray represents a value of zero. The moving object detection results from Eq.\\ref{def_bg} is shown in (b). The area considered as a moving object is painted purple.}\n\\label{fig:accum}\n\\vspace{-0.5cm}\n\\end{figure}\n \n When the truncation steps for $A(u)$ have not been triggered, the second and third approximate equalities in Eq.\\eqref{def_accum} would be satisfied by $A(u)=\\Tilde{A}(u)$. One can interpret the occlusion accumulation map as the result of subtraction between $k_u$th frame and current frame. In contrast to the background subtraction, we utilize the occlusion map, $\\Delta Z_{i}(u,\\xi_i^{i+1})$. Thus, our method does not need to depend on recognition of the background or 3D mapping.\n\n Existing depth sensors have the depth error, which quadratically grows along the depth value in \\cite{Jaimez2017FOSF}. To deal with such measurement uncertainty, we set a threshold as \n\\begin{equation} \\label{def_object}\n \\tau_{\\alpha}(u) = \\alpha \\cdot Z(u)^2\n\\end{equation}\nAlthough we set the threshold to be larger than zero, unwanted error values can exceed the threshold through the accumulation. Furthermore, negative values can be accumulated, so that occlusion could not exceed the threshold at all. In order to reduce their effect, we truncate the occlusion accumulation map $A_i (u)$ to $\\Tilde{A}_i (u)$ by the following:\n\\begin{eqnarray} \\label{def_accum_re1}\n \\Tilde{A}_i (u) &=& 0 \\qquad \\text{for } A_i (u) \\leq \\tau_{\\alpha}(u)\n\\\\ \\label{def_accum_re2}\n \\Tilde{A}_i (u) &=& 0 \\qquad \\text{for } \\Delta Z_{i}(u,\\xi_i^{i+1}) \\leq -\\tau_{\\beta}(u) \\;.\n\\end{eqnarray}\nThe truncation step in Eq.\\eqref{def_accum_re1} could disturb detecting the moving object which slowly approaches toward the camera. However, once the moving object is detected, the small values of $\\Delta Z_{i}(u,\\xi_i^{i+1})$ will be reflected. When the background reappears, $A_i (u)$ would not be lower than the threshold $\\tau_{\\alpha}(u)$ due to depth error accumulation. The truncation step in Eq. \\eqref{def_accum_re2} helps to detect the background reappearance. The moving object that moves away from the camera hardly exceed the threshold. Even so, if it exceeds the threshold, the object would soon fade away in the scene.\nThe result of the occlusion accumulation is shown in Fig. \\ref{fig:accum}. In order to help understanding, $A(u)$ has not been truncated using Eq. \\eqref{def_accum_re1} through every iteration yet. Since the depth value is not measured near the object, a stripe-like result appears in Fig. \\ref{fig:sfig4}.\n\n After calculating $A_i (u)$, we truncate the occlusion accumulation map to distinguish moving objects and background. The background map $B_i (u)$ would reveal 0 if a moving object shows proper occlusion. Otherwise, if the moving object has passed and the background reappears again, $B_i (u)$ would reveal 1, i.e., \n \\begin{equation} \\label{def_bg}\n B_i (u) = \n\\begin{cases}\n 0 & \\text{if } A_i (u) > \\tau_{\\alpha}(u) \\\\\n 1 & \\text{otherwise}\n\\end{cases}\n\\end{equation}\n The object mask can be calculated by inverting $B_i (u)$. \n\n \n\\subsection{Depth Compensation}\nOften, the depth images have invalid depth on an edge of the object or near the border of an image window. Its effect is shown in Fig. \\ref{fig:sfig4}. The segmentation in Fig. \\ref{fig:sfig2} has empty spaces over the moving object. Some of those invalid depth values in the current frame can be compensated by\n\\begin{equation} \\label{depth_compen}\n Z_i(\\Bar{u}) = Z_{i-1}(\\text{w}(\\Bar{u},\\xi_{i}^{i-1}))\n\\end{equation}\nwhere the unmeasured depth on the pixel $\\Bar{u}$ satisfies $Z(\\Bar{u})=0$. The compensated depth is used in the next depth image. The result of the depth compensation is shown in Fig.~ \\ref{fig:compen}. The original depth image has the unmeasured area that is colored as black, near the border and the boundary of the object. The unmeasured area on boundary of the object is filled with the previous depth image as in Fig. \\ref{fig:com_sfig2}. From the compensated depth image, $A(u)$ is now calculated reasonably (Fig. \\ref{fig:com_sfig3}), so that the object segmentation could cover the entire moving object (Fig. \\ref{fig:com_sfig4}).\n\\begin{figure}\n \\centering\n\\begin{subfigure}{.22\\textwidth}\n \\centering\n \\includegraphics[width=.9\\textwidth]{figures\/depth_before.png}\n \\caption{Original depth image}\n \\label{fig:com_sfig1}\n\\end{subfigure} %\n\\begin{subfigure}{.22\\textwidth}\n \\centering\n \\includegraphics[width=.9\\textwidth]{figures\/depth_after.png}\n \\caption{Compensated depth image}\n \\label{fig:com_sfig2}\n\\end{subfigure} \\\\\n\\vspace{0.15cm}\n\\begin{subfigure}{.22\\textwidth}\n \\centering\n \\includegraphics[width=.9\\textwidth]{figures\/Au2.png}\n \\caption{$A(u)$}\n \\label{fig:com_sfig3}\n\\end{subfigure} %\n\\begin{subfigure}{.22\\textwidth}\n \\centering\n \\includegraphics[width=.9\\textwidth]{figures\/lenna3.png}\n \\caption{Masked image}\n \\label{fig:com_sfig4}\n\\end{subfigure}\n\\caption{Result of depth compensation. A raw depth image (a) is compensated as (b). Compared to Fig.\\ref{fig:first}, the unwanted stripe-like result is corrected.}\n\\label{fig:compen}\n\\vspace{-0.5cm}\n\\end{figure}\n\n\n\\subsection{Occlusion Prediction on Newly Discovered Area}\nSuppose that there is a newly discovered area which has to be classified as the background or the moving object in a dynamic scene. \nThe occlusion map $\\Delta Z_{i}(\\Tilde{u},\\xi_{i-1}^{i})$ cannot be correctly calculated for $\\Tilde{u}$, i.e. the pixels of the newly discovered area, because the warped pixel onto the previous image $\\text{w}(\\Tilde{u},\\xi_{i}^{i-1})$ is not in the image window $\\Omega$. We define the newly discovered area as\n\\begin{equation} \\label{def_nda}\n \\Tilde{\\Omega} = \\{\\Tilde{u} | \\text{w}(\\Tilde{u},\\xi_{i}^{i-1})\\not\\in \\Omega \\}\n\\end{equation}\nWe suggest a method of predicting $A(\\Tilde{u})$ {with the fast marching method as the following:} \n\\begin{equation} \\label{def_nda_pred}\n A_i(\\Tilde{u}) = \\frac{\\sum_{\\delta u \\not \\in \\Tilde{\\Omega}} \\left\\{ A_i(\\delta u) + \\nabla_{\\delta u} Z_i (\\Tilde{u})\\right\\} }{\\sum_{\\delta u \\not \\in \\Tilde{\\Omega}}1}\n\\end{equation}\n The symbol $\\delta u$ means the nearest pixels of $\\Tilde{u}$ whose accumulated value $A(\\delta u)$ has been calculated, and $\\nabla_{\\delta u}Z_i (\\Tilde{u}) = Z_i (\\Tilde{u}) - Z_i(\\delta u)$ is the gradient of depth map with respect to $\\delta u$. Because $A(u)$ has correspondence with the depth map, {we predict $A(\\Tilde{u})$ with the gradient of the depth map and the occlusion accumulation map for the nearest pixel $\\delta u$ adjoining the known area.} {In other words, we interpolate $A(\\Tilde{u})$ with the average of $A(\\delta u) + \\nabla_{\\delta u} Z_i (\\Tilde{u})$.} After that, we update the newly discovered area by $\\Tilde{\\Omega} \\xleftarrow{} \\Tilde{\\Omega}-\\{\\delta u\\}$, and repeat Eq. \\eqref{def_nda_pred} until $\\Tilde{\\Omega} = \\phi$. This process operates on two consecutive frames. Since the effect of the newly discovered area is not noticeable in two consecutive frames, we compared the masked image with some frame interval in Fig. \\ref{fig:com_sfig4}.\n\nIn the positive area of the predicted $A(u)$ which is considered as a moving object, the background depth has never been detected, because the background was continuously occluded by the moving object until the current image.\n The algorithm could fail to recognize such appearance of the background. Even if the background appears, $A(u)$ may not be lower than the threshold in Eq. \\eqref{def_bg}. Then the truncation of Eq. \\eqref{def_accum_re2} is triggered so the background recognition works properly. The result of the prediction is depicted in Fig. \\ref{fig:newly}.\nWhen there is no nearest moving object outside the predicted area, we remove $A(u)$ of the predicted area to prevent error propagation. Also, if there are small-sized moving object labels, we suppress them as they are usually negligible. \n\n\\begin{figure}\n \\centering\n\\begin{subfigure}{.22\\textwidth}\n \\centering\n \\captionsetup{justification=centering}\n \\includegraphics[width=.9\\textwidth]{figures\/newly1.png}\n \\caption{Masked image \\newline (few frames ago)}\n\\end{subfigure} %\n\\begin{subfigure}{.22\\textwidth}\n \\centering\n \\captionsetup{justification=centering}\n \\includegraphics[width=.9\\textwidth]{figures\/newly2.png}\n \\caption{Masked image \\newline (current frame)}\n\\end{subfigure} \\\\\n\\begin{subfigure}{.22\\textwidth}\n \\centering\n \\includegraphics[width=.9\\textwidth]{figures\/newly1A.png}\n \\caption{$A(u)$ without prediction}\n\\end{subfigure} %\n\\begin{subfigure}{.22\\textwidth}\n \\centering\n \\includegraphics[width=.9\\textwidth]{figures\/newly2A.png}\n \\caption{$A(u)$ with prediction}\n\\end{subfigure}\n\n\\caption{Example of occlusion prediction on the newly discovered area. When a new area is detected while the camera moves, there is no depth information in a few frames ago. Occlusion map has zero value on such area. (c) shows the effect of the unmeasured depth values due to a newly discovered area. After executing the occlusion prediction method, $A(u)$ has proper occlusion map values on the newly discovered area shown in (d) and the moving object detection result obtained from (d) is shown in (b).}\n\\label{fig:newly}\n\\vspace{-0.5cm}\n\\end{figure}\n\n\\begin{figure*}[!ht]\n\\centering\n\\includegraphics[width=0.98\\textwidth]{figures\/segmentation_result.png}\n\\caption{Segmentation result for tested sequences in the order shown in Table.\\ref{table:obj&VO}. The first row shows the masked image and the second row represents the ground truth. The result of the proposed method with VO and external pose estimation is presented orderly in the third and fourth rows {(except the TUM dataset for the reasons described in text)}. Since the depth is not measured on the boundary of the image, moving objects are not labeled in those areas.}\n\\label{fig:result}\n\\vspace{-0.5cm}\n\\end{figure*}\n\n\\section{Robust Pose Estimation} \\label{pose_esti}\n\nIn this paper, we use DVO for camera pose measurement. Initially, we estimate the camera motion using only the sequence of RGB-D images. After detecting moving objects, the camera motion is estimated considering background mask $B(u)$.\nThe method using robust regression \\cite{Kerl2013ROE} effectively estimate ego-motion over a small region of moving object, but it reaches a local minimum solution when the region of moving object is large as shown in Fig.\\ref{fig:first}, because the background is confused with the moving object. On the other hand, the remaining moving object area after excluding the moving object detected up to the current frame is small enough to find upright camera pose. Thus, our method does not confuse the background and the moving object thanks to the accurate camera pose. \n The camera pose estimation is achieved by minimizing the cost function as shown in Eq. \\eqref{def_obj_fuc}. In the cost function, we use the bi-square norm shown in Eq. \\eqref{def_bisquare} which completely ignores the effect of the outliers.\n{ This property makes it possible to obtain the camera pose $\\xi$ based on background pixels which have a relatively small residual.}\n\n\\begin{equation} \\label{def_obj_fuc}\n \\vspace{-0.25cm}\n \\xi_i^{i+1} = \\operatorname*{argmin}_{\\xi}\\sum_{u\\in\\Omega} B_i (\\text{w}(u,\\xi)) \n J_i(u,\\xi)\n \\vspace{-0.25cm}\n\\end{equation}\nwhere\n\\begin{eqnarray} \\label{def_residual}\n J_i(u,\\xi) = \\rho_{k_I}( \\Delta I_{i}(u,\\xi)) + \\gamma \\cdot \\rho_{k_Z}( \\Delta Z_{i}(u,\\xi)) &&\n \n\\\\ \n\\label{def_bisquare}\n \\rho_{k}(e) =\n \\begin{cases}\n \\frac{k^2}{6}\\left\\{ 1-\\left[ 1 - (\\frac{e}{k})^2 \\right]^3 \\right\\} & \\text{for } |e| \\leq k \\\\\n \\frac{k^2}{6} & \\text{for } |e| > k\n \\end{cases}&&\n\\end{eqnarray}\n\n\nThe symbol $I_i$ in Eq. \\eqref{def_residual} is the $i$th color image and $k$ is the user-defined bi-square threshold. The residual values $\\Delta I$ and $\\Delta Z$ that are larger than $k$ do not influence the optimization process. In this paper, we use the levenberg-marquardt optimizer, and the parameter values $k_I = 48\/255$, $k_Z = 0.5$, and $\\gamma = 0.001$ are used.\n\n\n\n\n\n\n\n\n\n\n\n\\section{Experimental Results}\n\nTo evaluate our algorithm, we need RGB-D datasets in the presence of camera motion, ground truth data for moving objects, and camera trajectory. The dynamic object sequences of TUM dataset \\cite{TUMdataset} contain the ground truth camera pose and RGB-D images, but the ground truth segmentation for moving object was not provided because the moving object such as a sitting person whose arm is moving could not be segmented clearly.\nThus, we used TUM dataset only to evaluate relative pose error. Additionally, we evaluate the performance of the proposed moving object detection and the pose estimation method with the dataset in \\cite{leereal} and our dataset. \nThe data sequences from \\cite{leereal} are named with the prefix `ICSL' in \\cref{table:obj&VO}.\n\n\nWe collected dataset with an RGB-D camera of Kinect V1, and obtained the ground truth pose of the camera using VICON. In addition, we manually obtained the ground truth segmentation of moving objects in pixel-wisely.\n\nIt contains 5 sequences for static camera, whose name starts with `$static$' and 4 sequences for the dynamic environment whose name starts with `$dynamic$' where camera motion and moving objects exist simultaneously. \nThe sequences `$static\\_tree$',`$static\\_man$' respectively contain a tree and a man as a moving object. The sequence of `$static\\_board$' contains a large-sized moving object which could be misrecognized as the background. In `$static\\_destruct$', `$static\\_construct$' sequences, there are situations where a building-shaped object is brought in and then removed. These sequences induce background model changes. In the sequence `$dynamic\\_toss$', two people toss a doll to each other. It shows that multiple objects and fast objects can also be detected with our algorithm.\n{The dataset and detailed information can be found here:}\n\n\\url{https:\/\/haram-kim.github.io\/LARR-RGB-D-datasets\/}\n\n\\begin{table*}[t]\n\\vspace{+0.3cm}\n\\caption{Object segmentation result (F1-score) \\& relative pose error (RMSE)}\n\\vspace{-0.2cm}\n\\label{table:obj&VO}\n\n\\centering\n\\begin{tabular}{p{32mm} || C{10mm} | C{10mm} | C{10mm} | C{10mm} || C{8mm} | C{8mm} | C{8mm} | C{8mm} | C{8mm} | C{8mm}}\n\\toprule\n\\multirow{2}{*}{Sequences} & \\multirow{2}{*}{\\cite{MODTTVCMC}} & \\multirow{2}{*}{\\cite{MDTSA}}& \\multirow{2}{*}{\\begin{tabular}[c]{@{}c@{}}Proposed\\\\ method\\end{tabular}}& \\multirow{2}{*}{\\begin{tabular}[c]{@{}c@{}}Ours with\\\\ ext. pose\\end{tabular}}&\n\\multicolumn{2}{M{2cm}|}{Robust DVO}&\n\\multicolumn{2}{M{2cm}|}{Proposed method}& \n\\multicolumn{2}{M{2cm}}{Joint VO-SF \\cite{Jaimez2017FOSF}}\\\\ \\cline{6-11}\n& &\n& &\n&{tr.(m)} & {rot.($\\tcdegree$)} \n&{tr.(m)} & {rot.($\\tcdegree$)}\n&{tr.(m)} & {rot.($\\tcdegree$)}\\\\\n\\thickhline\n\nstatic\\_tree & \\textbf{0.9385} & 0.8873 & 0.8821 &0.8892 \n& 0.102 & 3.313 & 0.061 & \\textbf{1.856} & \\textbf{0.032} & 3.969\\\\\n\nstatic\\_board & 0.9044 & \\textbf{0.9256} & 0.9182 &0.9177\n&$\\times$ &$\\times$ & \\textbf{0.292} & \\textbf{4.839} & 0.584 & 10.916\\\\\n\nstatic\\_man & 0.7350 & \\textbf{0.8975} & 0.8739 &0.8755\n& 0.280 & 4.024 & 0.173 & 4.944 & \\textbf{0.072} & \\textbf{1.045}\\\\\n\nstatic\\_destruct & 0.5267 & 0.5565 & 0.8391 &\\textbf{0.9038}& 0.535 & 4.818 & 0.336 & 4.495 & \\textbf{0.131} & \\textbf{3.014}\\\\\n\nstatic\\_construct & 0.3948 & 0.8362 & \\textbf{0.8868} &0.8396\n& 0.809 & 10.433 & 0.153 & 3.821 & \\textbf{0.078} & \\textbf{1.272}\\\\\n\nICSL\\_place\\_items & 0.7139 & 0.6494 & 0.7204 & \\textbf{0.7366}\n& 0.041 & 1.082 & \\textbf{0.030} & \\textbf{0.893} & 0.094 & 5.379\\\\\n\nICSL\\_two\\_objects & 0.5073 & 0.8256 & \\textbf{0.8583} & 0.8580\n& 0.170 & 6.493 & \\textbf{0.013} & \\textbf{0.344} & - & - \\\\\n\n\\hline\ndynamic\\_board & $\\times$ & 0.6527 & \\textbf{0.9264} &{0.9247}\n&$\\times$ &$\\times$ & \\textbf{0.111} & \\textbf{1.939} & 0.135 & 4.644\\\\\n\ndynamic\\_man1 & $\\times$ & 0.4704 & {0.8123} &\\textbf{0.8287}\n& 0.255 & 9.027 & \\textbf{0.157} & \\textbf{4.108} & 0.223 & 12.949\\\\\n\ndynamic\\_man2 & $\\times$ & $\\times$ & \\textbf{0.8975} &0.8955\n& 0.646 & 11.286 & \\textbf{0.166} & \\textbf{2.165} & 0.206 & 6.180\\\\\n\ndynamic\\_toss & $\\times$ & 0.4395 & {0.7259} &\\textbf{0.7975}\n& 0.635 & 8.546 & \\textbf{0.324} & \\textbf{2.312} & 0.378 & 4.028\\\\\n\nICSL\\_fast\\_object & $\\times$ & $\\times$ & 0.8639 & \\textbf{0.8779}\n& 0.318 & 13.543 & \\textbf{0.092} & \\textbf{3.603} & - & - \\\\\n\nICSL\\_slow\\_object & $\\times$ & 0.7424 & 0.8971 & \\textbf{0.9142}\n& 0.407 & 17.585 & \\textbf{0.091} & \\textbf{3.779} & - & -\\\\\n\nTUM\\_sitting\\_static & & & &\n& 0.037 & 0.972 & \\textbf{0.035} & \\textbf{0.961} & 0.045 & 1.699 \\\\\n\nTUM\\_sitting\\_xyz & & & &\n& 0.078 & 2.027 & \\textbf{0.073} & \\textbf{1.860} & 0.205 & 4.066\\\\\n\nTUM\\_walking\\_static & & & &\n& 0.370 & 2.581 & \\textbf{0.217} & \\textbf{0.197} & 0.249 & 4.173\\\\\n\nTUM\\_walking\\_xyz & & & &\n& 0.974 & 15.871 & \\textbf{0.259} & \\textbf{4.069} & 0.659 & 12.370 \\\\\n\n\\bottomrule\n\n\\end{tabular}\n\\vspace{-0.6cm}\n\\end{table*}\n\nThe results of the object segmentation are shown in Table \\ref{table:obj&VO} and Fig. \\ref{fig:result}. We used the F1-score as a criterion for the moving object classification evaluation. The precision refers to how many of the pixels identified as moving objects are ground truth moving objects pixels and the recall refers to how many of the moving objects pixels in the image were correctly identified as moving objects. The F1-score is the harmonic mean of the precision and the recall. We calculated F1-score for each frame, and we averaged it in each sequence. The closer the score is to 1, the better the performance of moving object segmentation is.\nWe use the symbol `$\\times$' when quantitative evaluation is meaningless due to extremely poor performance, {and `-' for the algorithm that failed due to very few inliers in the corresponding sequence.}\n\nWe evaluated the segmentation performance of proposed method not only with robust DVO, but also with VICON data as an externally obtained camera pose. {The proposed method with camera pose of VICON data mostly performs better than the method with VO.}\n\nIn general static situations, all the compared algorithms perform well, but the performance of \\cite{MODTTVCMC, MDTSA} deteriorates in `$static\\_destruct$' and `$static\\_construct$' sequences, where the moving object appear at the beginning or the end of the video. The performance of \\cite{MODTTVCMC} degrades even if the background and the moving object are different in color. The sequences of dynamic environments contain a difficult situation in that some newly discovered area found by the camera is covered by moving objects, thus the background of that area has never been revealed. The algorithms in \\cite{MODTTVCMC, MDTSA} suffer in those situations so that the results were greatly affected.\nSince we do not use the background model and predict $A(u)$ for the newly discovered area, our method distinguished moving objects stably in `$static\\_destruct$', `$static\\_construct$' and other dynamic environment sequences. {In the dataset of \\cite{leereal}, our method correctly distinguishes the moving object from the background which have similar texture.}\n \n\nTo evaluate the performance improvement of the VO when augmented with our algorithm, the translational and rotational relative pose error metric in \\cite{TUMdataset} is adopted. We set the time parameter $\\Delta = 150$, which means that we evaluate the drift per 5 seconds recorded at 30 Hz.\nThe results are shown in Table. \\ref{table:obj&VO}, Fig. \\ref{fig:VO}.\nEven though RMSE is calculated with the frames that do not have a moving object, our algorithm improves the estimation result of the robust DVO significantly {in various datasets, especially in dynamic environments.}\n\nAs a result of applying the joint VO-SF in \\cite{Jaimez2017FOSF}, an algorithm based on DVO, it { mostly } performs better than DVO and shows smaller error than our proposed method in a \\textit{ fixed} camera. For the $static\\_board$ sequence where the moving object is dominant in the scene, the joint VO-SF method show large relative pose error than our method. {Interestingly, the results of $TUM\\_sitting$ sequences show that the bi-square weight method is more robust than the Cauchy weight based method, which can be explained by their difference in outlier rejection intensity.} The proposed method, compared to robust DVO and Joint VO-SF in dynamic environment, performs better in both rotational and translational motion regardless of a moving object which dominates a scene.\n\nAs can be seen in Fig. \\ref{fig:result}, although the moving objects are well separated, error exists due to the lack of texture in the background scene.\nWe expect that more accurate pose estimation in a dynamic environment can be achieved by applying other VO algorithms which show better performance on pose estimation in a static environment. \n\n\n\\begin{figure}[!t]\n\\centering\n\\includegraphics[width=0.45\\textwidth]{figures\/VO_dynmaic_man2.png}\n\\vspace{-0.1cm}\n\\caption{Translation estimation results on the sequence `$dynamic\\_ man2$'. The robust DVO fails to estimate the ego-motion due to a moving object. When combined with our algorithm, the performance improves significantly.}\n\\label{fig:VO}\n\\vspace{-0.5cm}\n\\end{figure}\n\n\\section{Conclusions}\nWe proposed a novel moving object detection method which utilizes occlusion accumulation and camera pose instead of a background model. To do this, we also presented the depth compensation on the unmeasured area and the occlusion prediction on the newly discovered area. Our method could detect the moving object which dominates the scene and improved the performance of robust DVO. In future work, we will combine the proposed method for robotic navigation tasks, which is designed to easily integrate with SLAM algorithms or obstacle avoidance algorithms.\n\n\n\n \n \n \n \n \n\n\n\n\n\n\n\n\n\n\\bibliographystyle{IEEEtran}\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}} +{"text":"\\section{Introduction}\n\nField-theoretic models with polynomial self-interaction are of growing interest in various areas of modern physics, from cosmology and high energy physics to condensed matter theory \\cite{vilenkin01,manton,khare}.\n\nIn $(1+1)$-dimensional models of a real scalar field with a high-order polynomial self-interaction potential, there exist topological solutions of the type of kinks, which can possess tails such that either or both decay as power laws towards the asymptotic states connected by the kink \\cite{khare,lohe}. Properties of kinks with exponential tail asymptotics (e.g., such as those arising as solutions to the sine-Gordon, $\\varphi^4$ or $\\varphi^6$ model) are well-understood \\cite{GaKuPRE,aek01,christov01,GaKuLi,weigel02,GaLeLi,GaLeLiconf,dorey}. In particular, we know a lot about kink-antikink interactions in such models. Meanwhile, interactions of kinks with power-law tails have not been studied in such detail.\n\nThe study of some properties and interactions of plane domain walls in $(2+1)$ and $(3+1)$ dimensional worlds can often be reduced to studying the properties and interactions of kinks in $(1+1)$ dimensions \\cite{GaLiRa,GaLeRaconf,GaKuYadFiz,Lensky,GaKsKuYadFiz01,GaKsKuYadFiz02}.\n\nIn this paper, we show that power-law asymptotics lead to long-range interaction between kinks and antikinks --- specifically, the force of the interaction can decay slowly, as some negative power of kink-antikink separation. This is a crucial difference from the (``classical'') case of kinks with exponential tail asymptotics. In the latter case, the kink-antikink interaction force always decays exponentially. \n\n\\section{A $(1+1)$-dimensional $\\varphi^8$ model featuring kinks with power-law tails}\n\nConsider the $(1+1)$-dimensional $\\varphi^8$ model \\cite{khare,lohe}, given by the Lagrangian field density\n\\begin{equation}\\label{eq:largang}\n\\mathscr{L}=\\frac{1}{2} \\left( \\frac{\\partial\\varphi}{\\partial t} \\right)^2-\\frac{1}{2} \\left( \\frac{\\partial\\varphi}{\\partial x} \\right) ^2-V(\\varphi),\n\\end{equation}\nwhere the potential of self-interaction is\n\\begin{equation}\\label{eq:potential8}\nV(\\varphi)=\\varphi^4(1-\\varphi^2)^2,\n\\end{equation}\nas depicted in figure \\ref{fig:potential}. The potential \\eqref{eq:potential8} has three degenerate minima: $\\tilde{\\varphi}_1=-1$, $\\tilde{\\varphi}_2=0$, and $\\tilde{\\varphi}_3=1$, such that $V(\\tilde{\\varphi}_1)=V'(\\tilde{\\varphi}_1)=V(\\tilde{\\varphi}_2)=V'(\\tilde{\\varphi}_2)=V(\\tilde{\\varphi}_3)=V'(\\tilde{\\varphi}_3)=0$.\n\n\\begin{figure}[h]\n\\centering\n\\includegraphics[scale=0.3]{Potential}\n\\caption{Potential \\eqref{eq:potential8} of the chosen $\\varphi^8$ model.}\n\\label{fig:potential}\n\\end{figure}\n\nDue to the Lorentz invariance of $(1+1)$-dimensional field theories generated by \\eqref{eq:largang} \\cite{manton}, we restrict to static solution without loss of generality. Static solutions, which are called kinks \\cite{manton}, interpolate between neighboring degenerate minima of the potential (vacua states of the model). We use the following notation for kinks: $\\varphi_{(-1,0)}(x)$ denotes the kink connecting the vacua $\\tilde{\\varphi}_1=-1$ and $\\tilde{\\varphi}_2=0$. We can also say that this kink belongs to the ``topological sector'' $(-1,0)$, and similarly for the other kinks of the model.\n\nThe $\\varphi^8$ model with the potential \\eqref{eq:potential8} has two kink solutions, $\\varphi_{(-1,0)}(x)$ and $\\varphi_{(0,1)}(x)$ shown in figures \\ref{fig:kinkU} and \\ref{fig:kinkD}, respectively, both of which exhibit mixed power-law and exponential tail asymptotics. To each kink there is also a corresponding antikink. The kink $\\varphi_{(-1,0)}(x)$ has power-law asymptotics at $x\\to +\\infty$, while the kink $\\varphi_{(0,1)}(x)$ has power-law asymptotics at $x\\to -\\infty$. All kink solutions of the chosen model can easily be obtained in the implicit closed form \\cite{khare,GaLeLi}:\n\\begin{equation}\\label{eq:kinks}\n2\\sqrt2x=-\\frac{2}{\\varphi}+\\ln\\frac{1+\\varphi}{1-\\varphi}.\n\\end{equation}\nFigure \\ref{fig:kinks} illustrates the two distinct kink solutions.\n(The corresponding expressions for antikinks can be obtained from \\eqref{eq:kinks} via the transformation $x\\mapsto -x$.)\nStandard Taylor series expansions reveal that the tail asymptotics of the kinks given by equation \\eqref{eq:kinks} are:\n\\begin{alignat}{2}\n\\varphi_{(-1,0)}(x) &\\sim-1+\\frac{2}{e^2}\\: e^{2\\sqrt{2}\\: x}, &\\qquad x\\to -\\infty.\\label{eq:kink1_asymp_minus}\\\\\n\\varphi_{(-1,0)}(x) &\\sim-\\frac{1}{\\sqrt{2}\\: x}, &\\qquad x\\to +\\infty.\\label{eq:kink1_asymp_plus}\\\\\n\\varphi_{(0,1)}(x) &\\sim-\\frac{1}{\\sqrt{2}\\: x}, &\\qquad x\\to -\\infty.\\label{eq:kink2_asymp_minus}\\\\\n\\varphi_{(0,1)}(x) &\\sim 1-\\frac{2}{e^2}\\: e^{-2\\sqrt{2}\\: x}, &\\qquad x\\to +\\infty.\\label{eq:kink2_asymp_plus}\n\\end{alignat}\nClearly, the kinks $\\varphi_{(-1,0)}(x)$ and $\\varphi_{(0,1)}(x)$ approach the vacuum state $\\tilde{\\varphi}_2=0$ very slowly (as $1\/x$) at $x\\to+\\infty$ and $x\\to-\\infty$, respectively. Meanwhile, the approach to the vacua $\\tilde{\\varphi}_1=-1$ and $\\tilde{\\varphi}_3=1$ is exponential.\n\n\\begin{figure}[h]\n \\centering\n \\subfloat[kink $\\varphi_{(0,1)}(x)$]{\\includegraphics[width=0.4\\textwidth]{KinkU}\\label{fig:kinkU}}\n \\hspace{15mm}\n \\subfloat[kink $\\varphi_{(-1,0)}(x)$]{\\includegraphics[width=0.4\\textwidth]{KinkD}\\label{fig:kinkD}}\n \\caption{The two kink solutions \\eqref{eq:kinks} of the chosen $\\varphi^8$ model with potential \\eqref{eq:potential8}.}\n \\label{fig:kinks}\n\\end{figure}\n\n\\section{Long-range interaction between a kink and an antikink}\nConsider a static configuration of a kink centered at some point $x=-\\xi$ and an antikink centered at $x=+\\xi$. Then, $\\xi$ is the half-distance between the kink and the antikink. Our goal is to find how the force of kink-antikink interaction, in the chosen $\\varphi^8$ model, depends upon $\\xi$. Here, by the force of interaction we mean the force produced on the kink by the antikink. To estimate this force, we use two methods: the collective coordinate approximation (see, e.g., \\cite{manton,aek01,GaKuLi,weigel02} and the references therein for details) and Manton's method (see, e.g., \\cite{manton,kks04} and the references therein for details).\n\n\\subsection{Collective coordinate approximation}\n\nIn order to find the interaction force in the case of power-law tails, we assume the following ansatz for the kink-antikink field configuration:\n\\begin{equation}\\label{eq:ansatz1}\n\\varphi(x;\\xi)=\\varphi_{(-1,0)}(x+\\xi)+\\varphi_{(0,-1)}(x-\\xi),\n\\end{equation}\nas shown in figure \\ref{fig:confD}. By a standard calculation \\cite{aek01}, we find that the effective potential $U_{\\scriptsize\\mbox{eff}}(\\xi)$ and effective force $F(\\xi)$ of the interaction are, respectively,\n\\begin{equation}\\label{eq:U_eff}\nU_{\\scriptsize\\mbox{eff}}(\\xi)=\\int_{-\\infty}^{+\\infty}\\left[\\frac{1}{2}\\left( \\frac{\\partial\\varphi}{\\partial x} \\right)^2 + V(\\varphi)\\right]dx, \\qquad F(\\xi)=\\frac{dU_{\\scriptsize\\mbox{eff}}}{d\\xi}.\n\\end{equation}\nHere, $F(\\xi)$ is the projection of the force onto the $x$-axis. Notice that we do not write the minus sign in front of the derivative of the effective potential because we are calculating the force on the left kink. Thus, a positive value of $-{dU_{\\scriptsize\\mbox{eff}}}\/{d\\xi}$ means that the force directed to the left, i.e.\\ having a negative projection onto the $x$-axis. This corresponds to repulsion between the kink and antikink. Therefore, the second formula in \\eqref{eq:U_eff} is written such that $F(\\xi)>0$ corresponds to attraction, and $F(\\xi)<0$ corresponds to repulsion.\n\nIn figure \\ref{fig:forcepow} we show the dependence $F$ upon $\\xi$ for the field configuration \\eqref{eq:ansatz1}. It is seen that the kink and antikink repel each other, and the force falls off slowly with increasing separation.\n\nLet us now consider the following kink-antikink field configuration:\n\\begin{equation}\\label{eq:ansatz2}\n\\varphi(x,\\xi)=\\varphi_{(0,1)}(x+\\xi)+\\varphi_{(1,0)}(x-\\xi)-1,\n\\end{equation}\nwhich is shown in figure \\ref{fig:confU}. Again, we seek to determine $F(\\xi)$. In this case, the kink and antikink are turned to each other by the exponential tails. The numerically calculated force of interaction is presented in figure \\ref{fig:forceexp}. From this figure, it is seen that the kink and antikink attract, and the force falls off quickly with increasing separation.\n\n\\begin{figure}[h]\n \\centering\n \\subfloat[configuration \\eqref{eq:ansatz1} for $\\xi=15$]{\\includegraphics[width=0.4\\textwidth]{ConfigurationD}\\label{fig:confD}}\n \\hspace{15mm}\n \\subfloat[configuration \\eqref{eq:ansatz2} for $\\xi=10$]{\\includegraphics[width=0.4\\textwidth]{ConfigurationU}\\label{fig:confU}}\n \\caption{Kink-antikink configurations given by (a) equation \\eqref{eq:ansatz1} and (b) equation \\eqref{eq:ansatz2}.}\n\\end{figure}\n\n\\subsection{Manton's method}\n\nWithin the framework of Manton's method \\cite{manton}, the force on the kink is given by the time derivative of the momentum on the semi-infinite interval $-\\infty 10 Z_{\\rm{\\odot}}$ in some quasars \\cite[e.g.][]{metallicity_distant}. High redshift quasars with super-solar metallicities suggest rapid chemical enrichment scenarios. Under this paradigm, the nuclei of the most massive galaxies in the early universe were enriched rapidly from the host galaxy's interstellar medium within $\\sim 500\\, \\rm{Myr}$ from the formation of the first stars. From then on, observations suggest that the metallicity of the quasar BLR did not change appreciably for a significant span of cosmic time.\n\nIt has also been suggested that the diversity of high-ionisation emission line ratios measured across a wide range of black hole masses and luminosities can be attributed, in whole or in part, to gas emission from at least two distinct regions of differing densities, illuminated by different ionizing radiation \\citep{sameshima2017, metal_density}. This model does not necessarily require the metallicity in the BLR to vary across the quasar population in order to account for the observed differences in emission line properties. These studies indicate that inferences on quasar chemical enrichment history utilizing emission-line flux ratios have to account for variations in the physical conditions of the emitting gas. \n\nIn this paper, we study spectra of 25 high-redshift (z > 5.8) quasars taken with ESO's VLT\/X-shooter and Gemini-N\/GNIRS. The bulk of our sample consists of high-resolution and high SNR spectra from the ESO-VLT X-shooter Large Program XQR-30 (P.I. V. D'Odorico). We fit and investigate flux ratios of metallicity-sensitive lines (primarily \\nv\/\\civ\\ and (\\siiv+\\oiv)\/\\civ) using individual quasar spectra and composites binned by black hole mass, bolometric luminosity, and blueshift of the C\\,\\textsc{iv}\\ line to determine whether these parameters are correlated with metallicity in the BLR. This paper follows closely other studies at lower redshift \\citep[e.g.][]{Nagao_2006, Xu2018, Shin_2019} and high redshift studies based on smaller samples \\citep[e.g.][]{Jiang_2007, metallicity_distant, DeRosa_2014, JJTang_2019, Onoue_2020, Wang_2021}, many of which report measurements of the same metallicity indicators we use. Compared to a recent study of 33 $z\\sim 6$ quasars observed with Gemini-N\/GNIRS \\citep{Wang_2021}, our sample contains higher SNR and spectral resolution spectra from X-shooter. Additionally, we consider the effects of BLR outflow on the metallicity-sensitive flux ratios, where the outflow is measured by the blueshift of the C\\,\\textsc{iv}\\ emission line \\citep[e.g.][]{Sulentic_2000, baskin_laor_2005, Vietri_2018}.\n\nThe content of this paper is organized as follows: in Section \\ref{sec:sample-composites}, we describe the properties of our high-redshift quasar sample, data reduction, spectrum processing, and the methodology for generating composites. In Section \\ref{sec:metallicity}, we describe our approach to fitting metallicity-sensitive emission lines and the conversion from line ratios to metallicities in the BLR. We present the results for our high redshift sample in Section \\ref{sec:results}, and in Section \\ref{sec:discussion}, we discuss and contextualize the results, presenting correlations found between the properties of the high redshift quasars and the metallicity of their BLRs. We summarize and conclude in Section \\ref{sec:conclusion}. Throughout the paper, we adopt flat $\\Lambda$CDM cosmology with H$_{0} = 70$ km s$^{-1}$ Mpc$^{-1}$ and $\\left(\\Omega_{\\rm m}, \\Omega_{\\Lambda}\\right) = \\left(0.3, 0.7\\right)$. All referenced wavelengths of emission lines are measured in vacuum.\n\n\n\\section{Quasar Sample and Composites} \\label{sec:sample-composites}\n\\subsection{Sample Selection} \nThe bulk of the sample originates from quasars in the ESO-VLT X-shooter Large Program XQR-30 (P.I. V. D'Odorico, program number 1103.A-0817)\\footnote{Collaboration website: \\href{https:\/\/xqr30.inaf.it\/}{https:\/\/xqr30.inaf.it\/}}. The XQR-30\nprogram targets 30 southern hemisphere bright QSOs at $5.8 < z < 6.6$ to study the universe in its infancy. These quasars have virially estimated BH masses of $(0.8 - 6.0) \\times 10^9\\, \\rm{M}_{\\odot}$ (Mazzucchelli et al. in prep.). At lower BH masses, $0.2 - 1.0 \\times 10^9\\, \\rm{M}_{\\odot}$, we include 1 quasar spectrum from \\cite{Shen_2019} and 9 spectra from \\cite{yang2021probing}, all of them taken with Gemini\/N GNIRS. From these other samples, we only considered spectra covering quasar properties outside the range of XQR-30 quasars with SNR > 5 per resolution element near rest-frame 1600\\AA\\ and 2800\\AA, which are in the proximity of the emission lines of interest. Their redshifts span a similar range from $z = 6.0$ to $z = 6.8$ with one quasar at $z = 7.54$ \\citep[i.e.][]{Onoue_2020}. All redshifts are measured from the peak of the best fit models to the Mg\\,\\textsc{ii}\\ emission line, where we use the complete reconstructed line profile in case of multi-component fits. We provide some details of the Mg\\,\\textsc{ii}\\ fits in Section \\ref{sec:emission-fitting} and we leave the complete discussion for Mazzucchelli et al. in prep.\n\nOf the 30 quasars in XQR-30, 14 are classified as quasars with broad absorption-lines (BAL) and 16 are considered non-BAL \\citep{Bischetti_2022_submitted}. We exclude quasars with BAL features as they introduce additional uncertainty in the measurement of line flux. From the XQR-30 non-BAL sample, we reject J1535+1943 by visual inspection due to its dust-reddened continuum in the wavelength regions of interest \\citep{yang2021probing}. Such a continuum is not well-modeled by the continuum fitting method we describe in Section \\ref{sec:emission-fitting} and it would affect the continuum fit if included in composites. Combined with 10 spectra from Gemini GNIRS, a total of 25 high-redshift quasar spectra are included in this study. Figure \\ref{fig:quasar_properties} and Table~\\ref{tab:quasar_sample} show the distribution of the quasar sample and physical properties.\n\n\\begin{figure*}\n\t\\includegraphics[width=\\textwidth]{figs\/quasar_properties.png}\n \\caption{Stacked distribution of quasar properties in our sample from left to right: redshift, quasar bolometric luminosity, black hole mass, C\\,\\textsc{iv}\\ blueshift. The properties of the XQR-30 sample, observed with ESO's X-shooter, are highlighted in blue while the GNIRS spectra are presented in orange. The inner bin edges of composites by quasar bolometric luminosity, black hole mass, and C\\,\\textsc{iv}\\ blueshift are delineated by black dashed lines.}\n \\label{fig:quasar_properties}\n\\end{figure*}\n\n\\subsection{Data Reduction and Post-Processing}\nThe data reduction procedure for GNIRS spectra is described in full in the source papers: \\citet{Shen_2019} and \\citet{yang2021probing}. \\citet{Shen_2019} used a combination of the PyRAF-based \\texttt{XDGNIRS} \\citep{XDGNIRS_eg} and the IDL-based \\texttt{XIDL} package while \\citet{yang2021probing} used the Python-based spectroscopic data reduction pipeline \\texttt{PypeIt} \\citep{PypeIt}.\n\nXQR-30 data {are} reduced with an improved version of the flexible custom IDL-based pipeline used with data from the XQ-100 legacy survey \\citep{XQ-100, Becker_2019}. The overall strategy is based on techniques described in \\citet{Kelson_2003} with optimal sky subtraction, telluric absorption correction, optimal extraction, and direct combination of exposures. The pipeline is described in additional detail in \\citet{Becker_2012} and it has also been used in other studies based on XQR-30 data \\citep[e.g.][]{Zhu_2021}. X-shooter data {are} obtained using three arms with the following wavelength ranges: UVB (300-559.5 nm), VIS (559.5-1024 nm), and NIR (1024-2480 nm). We extract data from only the VIS and NIR arms because there is no light in the UVB for our sources.\n\nIn the 50 km s$^{-1}$ rebinned quasar spectra from the XQR-30 sample, the mean SNR per pixel measured in the range 1400-1600\\AA\\ in the rest frame, is $\\sim30$ with a minimum of 24 and maximum of 38, while the mean SNR per pixel for the GNIRS sample is $\\sim13$, ranging between 6 and 30. Median pixel widths are 0.25\\AA\\ for the rebinned XQR-30 spectra and 0.43\\AA\\ for GNIRS spectra between rest-frame 1400-1600\\AA. The XQR-30 SNR reported here can be different from those of other studies based on XQR-30 data because of differences in binning strategies and wavelength region over which the SNR is measured. \n\nAfter data reduction, each spectrum undergoes a common post-processing procedure described as follows:\n\\begin{enumerate}\n \\item For every reduced spectrum in our quasar sample prior to creating composite spectra, the data {are} restricted to relatively high SNR. The per-pixel SNR floor is 1 for GNIRS spectra and 5 for XQR-30 spectra. Data restricted by the SNR floor are omitted from further processing and fitting.\n \\item We then apply a sigma-clip mask with a box width of {30 pixels}, and a 3-$\\sigma$ threshold to remove narrow absorption features and noise above 3-$\\sigma$. These absorption features are not desired when fitting the intrinsic flux and profile of the broad emission lines. {For the noisier and lower resolution GNIRS spectra, the sigma-clip mask has a minimal effect on the resulting spectra.}\n \\item As the spectra are observed with different instruments and exhibit a diversity of redshifts, we standardize the rest-frame wavelength domain for all of the spectra, facilitating the stacking of composites later. Every spectrum is resampled using a flux-conserving algorithm into a common wavelength domain with 1 \\AA\\ bins in the rest-frame. The resampling calculation and error propagation are described in detail in \\citet{Carnall_2017}. The number of pixels per 1 \\AA\\ bin in the raw spectra is wavelength-dependent, ranging from 1-3 pixels per bin for GNIRS spectra and 2-8 for X-shooter spectra. \n\\end{enumerate}\nTo test the robustness of our measurements, we vary the details of the post-processing procedure, Among the many variations, we perform the sigma-clipping before resampling rather than after, apply an upper error threshold to restrict the maximum allowable error, and in one instance, we do not perform resampling on individual quasar spectra. In each case, we find that the majority of measurements are consistent within their uncertainties and the overall correlations and conclusions we draw from our measurements are unaffected. This gives us confidence in our results. \n\n\\subsection{Black Hole Mass Estimate}\nThe black hole mass of each quasar is based on single-epoch virial mass estimates. We source the black hole masses from \\citet{Shen_2019}, \\citet{yang2021probing}, and Mazzucchelli et al. in prep. which span $\\log\\left({\\rm{M}_{\\rm{BH}}\/\\rm{M}_{\\odot}}\\right) = 8.4-9.8$ over the entire quasar sample. To determine the masses, these studies use the rest-frame UV Mg\\,\\textsc{ii}\\ broad emission line and the Mg\\,\\textsc{ii}-based virial estimator, described generally by the following,\n\\begin{equation}\n \\left(\\frac{M_{\\rm{BH,vir}}}{M_{\\odot}}\\right) = 10^{\\rm{a}} \\left[\\frac{\\lambda L_{\\lambda}}{10^{44} \\,\\rm{erg\\, s^{-1}}}\\right]^{b} \\left[\\frac{\\rm{FWHM (Mg\\,\\textsc{ii})}}{1000 \\,\\rm{km\\, s^{-1}}}\\right]^{2} \\,,\n \\label{eq:mgii-vo9}\n\\end{equation}\nwhere $\\lambda L_{\\lambda}$ is the monochromatic luminosity of the continuum at rest frame 3000 \\AA, and (a,b) are empirically calibrated against reverberation mapping experiments to the values (6.86, 0.5) in \\citet{Vestergaard_2009} and (0.74, 0.62) in \\citet{Shen_2011}. The masses of quasars in the XQR-30 and \\citet{yang2021probing} samples are estimated using the \\citet{Vestergaard_2009} calibration. The mass of the one quasar we've included from \\citet{Shen_2019} is reported with the \\citet{Shen_2011} calibration, but we have re-calibrated the mass with \\citet{Vestergaard_2009}, resulting in a 0.1 dex difference. The continuum luminosity is estimated by fitting a power-law continuum and Fe\\,\\textsc{ii}\\ emission around the Mg\\,\\textsc{ii}\\ line, as described in Section \\ref{sec:emission-fitting} and the Fe\\,\\textsc{ii}\\ template \\cite[i.e.][]{UV_iron_template} is consistent between the different studies. The absolute fluxing of the XQR-30 spectra {is based on calibrations against observed near-infrared photometry and} is described in full in Mazzucchelli et al. in prep. The Mg\\,\\textsc{ii}\\ full-width at half maximum (FWHM) is determined with single or multi-component Gaussian fits to the broad emission line and the peak of the total line profile is used to calibrate the systemic redshift of the quasar spectrum. Typical systematic errors from the virial mass estimator for the Mg\\,\\textsc{ii}\\ line can be up to 0.55 dex \\citep{shen_biases_2008, Vestergaard_2009}. Bolometric luminosities are measured from the flux-calibrated spectrum using the continuum luminosity at 3000\\AA\\ and adopting a bolometric correction of 5.15 \\citep{Shen_2011} throughout our entire sample.\n\nThe virial mass estimate is routinely applied to quasars \\citep[e.g.][]{2002MNRAS.331..795M, Shen_2012} and aside from the Mg\\,\\textsc{ii}\\ line, $\\rm{H}\\beta$ and C\\,\\textsc{iv}\\ emission lines have been used. Virial mass estimates using the $\\rm{H}\\beta$ emission line is not feasible for high redshift quasar studies prior to the James Webb Space Telescope, but the Mg\\,\\textsc{ii}\\ line width is correlated with $\\rm{H}\\beta$ and can be used as its substitution in single-epoch virial black hole mass estimates \\citep[e.g.][]{Salviander_2007, shen_biases_2008, Wang_2009, Shen_2012}. Compared to the C\\,\\textsc{iv}\\ emission line, the advantage of the Mg\\,\\textsc{ii}\\ line is that it is less affected by non-virial components of the black hole emission, such as the radiatively-driven BLR wind \\citep[e.g.][]{Saturni_2018}. The difference between the C\\,\\textsc{iv}\\ and Mg\\,\\textsc{ii}\\ virial mass estimates is correlated with the C\\,\\textsc{iv}\\ blueshift \\citep{Shen_2012, Coatman_2017}. \n\n\\subsection{C\\,\\textsc{iv}\\ Blueshift Measurement}\nThe C\\,\\textsc{iv}\\ emission line is of particular interest in assessing BLR outflow strength which has also been linked to metallicity \\citep[e.g.][]{Wang_2012, shin_2017_outflow}. This high-ionisation line can exhibit significant blueshifts \\citep[e.g.][]{Gaskell1982, Wilkes1984, Marziani_1996, vandenberk2001, baskin_laor_2005, 2007ApJ...666..757S} and asymmetric velocity profiles \\citep[e.g.][]{Sulentic_2000, baskin_laor_2005}, structure that is often interpreted as arising from a disk wind or outflow \\citep[e.g.][]{2007ApJ...666..757S, Vietri_2018}. The blueshift of C\\,\\textsc{iv}\\ is therefore an indication of the balance of emission between the outflowing ionised gas and the emission at a systematic redshift, which we call the ``wind'' and ``core'' component respectively \\citep[adopting the terminology of][]{metal_density}. At high redshifts (z > 5.8), the mean and median C\\,\\textsc{iv}-Mg\\,\\textsc{ii}\\ velocity shifts are greater than for luminosity-matched quasars at lower redshifts, although this may potentially be biased by increased torus opacity and orientation-driven selection effects \\citep{Meyer_2019, JT_2020, yang2021probing}. In this study, we define our estimate of the C\\,\\textsc{iv}\\ blueshift as \n\\begin{equation} \\label{eq:blueshift}\n \\frac{\\rm{C\\,\\textsc{iv}\\ blueshift}}{\\rm{km \\,s^{-1}}} \\equiv c \\times (1549.48\\mbox{\\normalfont\\AA} - \\lambda_{\\rm{med}})\/1549.48\\mbox{\\normalfont\\AA}\\,,\n\\end{equation}\nwhere $c$ is the speed of light and $\\lambda_{\\rm{med}}$ is the median wavelength bisecting the total continuum-subtracted C\\,\\textsc{iv}\\ emission line flux. The wavelength 1549.48\\AA\\ is the average of the C\\,\\textsc{iv}\\ $\\lambda\\lambda1548.19,1550.77$ doublet. This definition is the same as in \\citet{metal_density}, but their redshift is defined using a variety of low-ionization emission lines, some of which are known to exhibit velocity shifts relative to Mg\\,\\textsc{ii}. In this study, we define our redshift using only the Mg\\,\\textsc{ii}\\ line. Due to the 1 \\AA\\ wavelength resolution, we prescribe a minimum precision of $\\sim200$ km $\\rm{s}^{-1}$ for the C\\,\\textsc{iv}\\ blueshift, evaluated as an error of $\\pm 1$\\AA\\ at the average wavelength of the C\\,\\textsc{iv}\\ doublet. The overall uncertainty of the C\\,\\textsc{iv}\\ blueshift is combined with the uncertainty from the measured redshift. \n\nThe C\\,\\textsc{iv}\\ blueshift is also known to be anti-correlated with the line's equivalent width \\citep[EW;][]{Leighly2004, Richards2011, Vietri_2018, Rankine2020, JT_2020, metal_density}, a relationship which is reproduced for our high-redshift quasar sample in Figure \\ref{fig:CIV_blueshift_ew}. This correlation may be driven by orientation, properties of BLR winds, or the Baldwin effect linking properties of high-ionisation lines like C\\,\\textsc{iv}\\ with the quasar luminosity \\citep{Baldwin_1977_effect}. The results show highly blueshifted C\\,\\textsc{iv}\\ lines are weak, while stronger lines are less blueshifted and more symmetric.\n\nWe note that a velocity shift relative to C\\,\\textsc{ii}]\\ of 5510$^{+240}_{-110}$ km s$^{-1}$ was measured for J1342+0928 \\citep{Banados_2018, Onoue_2020} and \\citet{JT_2020} also measured velocity shifts relative to Mg\\,\\textsc{ii}\\ for several XQR-30 quasars in our sample. However, due to differences in the definition of C\\,\\textsc{iv}\\ blueshift\\footnote{It is also possible to define the C\\,\\textsc{iv}\\ blueshift by the maximum of the C\\,\\textsc{iv}\\ line profile or the blueshift and asymmetry index (BAI) defined as the flux blueward of 1549.48\\AA. Although we don't use these definition in this study, we have checked that these alternatives have little effect on the relative C\\,\\textsc{iv}\\ blueshifts between quasars. The relationship found in Figure \\ref{fig:CIV_blueshift_ew} and the correlations found in this study hold are unaffected.}, choice of Fe\\,\\textsc{ii}\\ template, and sometimes the referenced line to estimate the redshift, we have re-measured the blueshifts for most quasars in our sample. However, the C\\,\\textsc{iv}\\ blueshift could not be reliably determined for one individual quasar: J2338+2143, which, despite the minimum SNR requirement, has an overall SNR too poor to obtain a reliable fit. \n\n\\begin{figure}\n\t\\includegraphics[width=\\columnwidth]{figs\/CIV_Blueshift_EW.png}\n \\caption{C\\,\\textsc{iv}\\ equivalent width as a function of C\\,\\textsc{iv}\\ blueshift. There is a moderate anti-correlation between these two quantities, implying that weaker C\\,\\textsc{iv}\\ lines are more strongly blueshifted and stronger lines are less blueshifted. The outlier with high EW and blueshift is J1216+4519. Its SNR is low ($\\sim 7$ per pixel) which is reflected by the large error in EW.}\n \\label{fig:CIV_blueshift_ew}\n\\end{figure}\n\n\n\\subsection{Composite Spectra} \\label{sec:composites}\nThe primary objective of this work is to measure flux ratios of metallicity-sensitive lines binning by quasar properties, such as bolometric luminosity, black hole mass, and C\\,\\textsc{iv}\\ blueshift, to determine whether these parameters are correlated with metallicity in the BLR. Although most of the spectra have sufficient SNR to proceed with the emission-line fitting independently, the weak and blended emission lines of some SNR\/pixel $\\leq 8$ spectra in this sample could not be fit convincingly. By stacking the spectra, we are able to obtain higher SNR. Another reason to stack the spectra is to average out peculiarities of individual quasars in each bin in order to construct better comparisons to the photoionisation models referenced in Section \\ref{sec:line_ratios_metallicity}. As we are interested in the average spectral properties within a binned parameter space rather than the specific individual properties, we use equivalent weighting of spectra within each composite regardless of the SNR of input spectra so that the output is not biased in favor of any contributing quasar observed with high SNR. We construct 6 bins from each of the 3 quasar properties (black hole mass, bolometric luminosity, and C\\,\\textsc{iv}\\ blueshift), with a similar number of contributing quasar spectra in each bin. We also avoid extending the width of each bin too wide. Therefore, the average number of quasar spectra in each bin is 4, and all composites are created from 3-6 input spectra. \n\nThe dynamic range of quasar bolometric luminosity in this sample is $\\log\\left(\\rm{L}_{\\rm{bol}}\/\\rm{erg \\, s}^{-1}\\right) = 46.7-47.7$. We split the sample into 6 luminosity bins with the following edges: 46.72, 46.79, 46.95, 47.17, 47.30, 47.40, 47.70, and a composite is created from each bin. The first three bins include all 10 GNIRS spectra and the final three bins are composed of exclusively X-shooter spectra. The total BH mass range reflected in our high-redshift quasar spectra is $\\log\\left({\\rm{M}_{\\rm{BH}}\/\\rm{M}_{\\odot}}\\right) = 8.4-9.8$. Again, we form 6 mass bins with the following edges: 8.40, 8.75, 8.87, 8.98, 9.20, 9.40, 9.80, and create a composite spectrum from each bin. We also arrange and stack all individual quasars in the sample into 6 C\\,\\textsc{iv}\\ blueshift bins, with the following bin edges: $-$200, 680, 1500, 2500, 3000, 4000, 5000 km $\\rm{s}^{-1}$. Figure \\ref{fig:quasar_properties} shows the bin edges of each composite delineated by black dashed lines.\n\nPrior to stacking, we apply an upper error threshold equal to 2 times the minimum error within box widths of 50 pixels to restrict data to where the error is reasonable. The error threshold clips wavelength bins with unusually high error and high flux that were not masked by the general post-processing procedure. The resulting spectra contains the most stable and robustly measured elements. Without the upper error threshold, the propagation of error from a small number of component spectra can create unstable composites, leading to greater uncertainty in the final flux measurements. Every spectrum is then normalised across the rest-frame 1430\\AA$\\sim$1450\\AA\\ wavelength range and the arithmetic mean of each stack is taken to generate the composite. We also take the median or geometric mean \\citep[e.g.][]{vandenberk2001} of the stack and find that it does not significantly influence the result. Furthermore, we generate composites after subtracting a power-law continuum, fitted as described in Section \\ref{sec:emission-fitting}, and find that the resulting measured broad emission-line fluxes are not significantly discrepant either. In all cases, the resulting line ratio measurements regardless of taking the composite arithmetic mean, geometric mean, median, or after subtracting the continuum agree to within 2.0 $\\sigma$, with $\\sim 75\\%$ of measurements within 1.0 $\\sigma$.\n\nThe uncertainty in each resolution element is composed of the error in every contributing spectrum added in quadrature, but we also estimate the systematic error in each composite by generating all of the possible composites that can be obtained if any one contributing quasar spectrum is excluded. The standard deviation in each 1\\AA\\ pixel from all such simulated composites is treated as the systematic error, added in quadrature to the uncertainty propagated from each contributing spectrum. This systematic error is an additional source of error which raises the uncertainty floor of the combined spectrum and reduces the relative uncertainty between each resolution element, affecting the weighting of each pixel in a least-squares fitting routine. After combining all sources of uncertainty, the resulting SNR per pixel of the composites measured between rest-frame 1400-1600\\AA\\ is 20-100. We show a composite constructed from all 25 quasars in our sample in Figure \\ref{fig:all_composite}.\n\nThree individual quasar spectra are treated differently for our composites. PSOJ007+04, PSOJ025-11, and J1212+0505 are affected by proximate damped Ly\\,\\textsc{$\\alpha$}\\ absorption (pDLA) systems \\citep{Farina_2019, Banados_2019}, which causes a significant fraction of its Ly\\,\\textsc{$\\alpha$}\\ emission to be absorbed at the systemic redshift. We fit the emission lines of pDLA affected quasars individually, and mask their emission blueward of the N\\,\\textsc{v}\\ centroid from contributing to composites. \n\n\\begin{figure*}\n\t\\includegraphics[width=\\textwidth]{figs\/all_composite.png}\n \\caption{Composite created from all 25 high-redshift quasars in our sample compared against the SDSS quasar template comprised of 2200 spectra described in \\citet{vandenberk2001}. {The composite is split into two sections with independent y-axis scaling to better visualise the various spectral emission features, which are denoted with the grey dashed lines.} The composite and SDSS template are normalised together at 2200-2250\\AA, {and the grey spectrum is the error spectrum of the composite.} The blue and small patches of orange shaded regions indicate when the template or the {composite} is in excess respectively. Our high-redshift composite has a noticeably flatter continuum slope and significant Ly\\,\\textsc{$\\alpha$}\\ absorption compared to the lower redshift SDSS sample, but the profiles and relative integrated fluxes of emission features other than Ly\\,\\textsc{$\\alpha$}\\ are comparable.}\n \\label{fig:all_composite}\n\\end{figure*}\n\n\n\\section{Line Fitting and Metallicity Measurement} \\label{sec:metallicity}\n\\subsection{Emission-line Fitting} \\label{sec:emission-fitting}\nIn this work, we study a large number of rest-frame UV emission lines: Ly\\,\\textsc{$\\alpha$}, N\\,\\textsc{v}, Si\\,\\textsc{ii}, Si\\,\\textsc{iv}, O\\,\\textsc{iv}, N\\,\\textsc{iv}], C\\,\\textsc{iv}, He\\,\\textsc{ii}, O\\,\\textsc{iii}], Al\\,\\textsc{ii}, Al\\,\\textsc{iii}, Si\\,\\textsc{iii}, C\\,\\textsc{iii}], and Mg\\,\\textsc{ii}. The measurement of emission-line fluxes can be tricky due to adjoining and heavily blended lines, such as N \\textsc{v} $\\lambda$1240 \\AA\\ with Ly \\textsc{$\\alpha$} $\\lambda$1216 \\AA\\ or Al \\textsc{iii} $\\lambda$1857 \\AA, Si \\textsc{iii} $\\lambda$1887 \\AA, and C \\textsc{iii}] $\\lambda$1909 \\AA. Furthermore, the strong Fe\\,\\textsc{ii}\\ emission biases the underlying continuum level measurement. Despite these challenges, there are two widely employed methods for fitting quasar emission-lines \\citep{Nagao_2006}. One method measures the emission-line flux by integrating above a well-defined independent local continuum model \\citep[e.g.][]{vandenberk2001} and the other method endeavors to fit emission lines using one or more appropriate functions, such as Gaussians or Lorentzians \\citep[e.g.][]{Zheng_1997}. Both of these methods have shortcomings in measuring accurate emission-line fluxes. Defining an appropriate local continuum level below an emission-line is challenging and is sensitive to where the baseline is anchored. The additional uncertainty propagates into the resulting metallicity estimates. Regarding the function fitting approach, a single Gaussian or Lorentzian profile is insufficient for broad emission-lines with asymmetric velocity profiles \\citep[e.g.][]{corbin_1997, vandenberk2001, baskin_laor_2005}. The approach utilising multiple Gaussian functions can obtain smooth realisations of the line profile, but the decomposition is not unique and a large number of free parameters is required. Modified functions such as a skewed Gaussian (defined in Appendix \\ref{appendix:line-fitting-compare}) or asymmetric Lorentzian depend on fewer parameters and are arguably more physically relevant \\citep[e.g.][]{mallery_2012}. With multiple reasonable approaches, there is a concern that the resulting line flux can be method-dependent. In this work, we use various appropriate functions to fit emission lines and we compare the several different methods against similar fits from existing literature in Appendix \\ref{appendix:line-fitting-compare}.\n\nWe follow the general procedure from \\citet{Xu2018} and define the following two line-free windows in rest-frame to fit the continuum: 1445\\AA$-$1455\\AA, 1973\\AA$-$1983\\AA. In specific circumstances, we identify two additional windows (1320\\AA$-$1325\\AA, and 1370\\AA$-$1380\\AA) to further constrain the continuum shape or we extend the blue-end of the first line-free window to 1432\\AA\\ in the case of a blueshifted C\\,\\textsc{iv}\\ line. The continuum is fit with a power-law function normalised to rest-frame 3000 \\AA,\n\\begin{equation}\n F_{\\rm{pl}}(\\lambda) = F_{\\rm{pl, 0}} \\left(\\frac{\\lambda}{3000 \\mbox{\\normalfont\\AA}}\\right)^{\\gamma}\\,,\n \\label{eq:pl-cont}\n\\end{equation}\nwhere $F_{\\rm{pl, 0}}$ and $\\gamma$ represent the normalization and power-law slope respectively. We also consider the contribution of the Fe\\,\\textsc{ii}\\ pseudo-continuum spectrum using the empirical template from \\citet{UV_iron_template} to cover the wavelength range from 1200 \\AA\\ to 3500 \\AA. We convolve the template with a Gaussian broadening kernel to better fit the variety of features from the Fe\\,\\textsc{ii}\\ pseudo-continuum seen across spectra in our sample,\n\\begin{equation}\n F_{\\rm{Fe}}(\\lambda) = \\zeta_{\\rm{0}} \\, F_{\\rm{template}}|_{\\lambda(1+\\delta)} \\circledast G(\\lambda, \\sigma)\\,,\n\\end{equation}\nwhere the free parameters of the Fe\\,\\textsc{ii}\\ flux contribution include a flux scaling factor $\\zeta_{\\rm{0}}$, the FWHM of the broadening kernel $\\sigma$, and a small wavelength shift $\\delta$. The contribution from the iron continuum is more relevant at wavelengths close to the Mg \\textsc{ii} $\\lambda$2799 \\AA\\ line and is important in obtaining the virial mass estimate. Combined, the power-law and the Fe\\,\\textsc{ii}\\ template are fit to the data in the line-free windows and form the underlying continuum baseline.\n\nEmission lines are fit with the following double power-law method adopted from \\citet{Nagao_2006}, \\citet{Matsuoka_2011}, and \\cite{Xu2018},\n\\begin{equation}\n F_{\\rm{em}}(\\lambda) =\n \\begin{cases}\n F_{\\rm{0}} \\times \\left(\\frac{\\lambda}{\\lambda_{\\rm{0}}}\\right)^{-\\alpha} & \\lambda > \\lambda_{\\rm{0}} \\\\\n F_{\\rm{0}} \\times \\left(\\frac{\\lambda}{\\lambda_{\\rm{0}}}\\right)^{+\\beta} & \\lambda < \\lambda_{\\rm{0}}\n \\end{cases}\n \\label{eq:line_fit}\n\\end{equation}\nwhere the two power-law indices ($\\alpha$ and $\\beta$) are used to fit the red and blue sides of the emission-line profile. The peak intensity, $F_{\\rm{0}}$, controls the height of the emission line and the peak wavelength, $\\lambda_{\\rm{0}}$, defines the location of the peak. \n\nEmission lines with different degrees of ionisation often show systematically varied velocity profiles \\citep[e.g.][]{Gaskell1982, baskin_laor_2005}. Thus, we categorise emission lines into two distinct systems: high-ionisation lines (HILs) and low-ionisation lines (LILs). The HILs include N\\,\\textsc{v}, O\\,\\textsc{iv}, N\\,\\textsc{iv}], C\\,\\textsc{iv}, and He\\,\\textsc{ii}\\ while the LILs include Si\\,\\textsc{ii}, Si\\,\\textsc{iv}, O\\,\\textsc{iii}], Al\\,\\textsc{ii}, Al\\,\\textsc{iii}, Si\\,\\textsc{iii}, and C\\,\\textsc{iii}]\\ \\citep{Collin_Souffrin_1988}. The boundary separating the two main groups is an ionisation potential of 40 eV. We assume that the emission-line profiles of lines in the same category are coupled to the same line-emitting gas clouds of the BLR, sharing a common value for the $\\alpha$ and $\\beta$ power indices. Because we did not correct for the suppression of Ly\\,\\textsc{$\\alpha$}\\ from the intergalactic medium, the redder $\\alpha$ index of the Ly\\,\\textsc{$\\alpha$}\\ line is coupled with the HILs, while the bluer $\\beta$ index is left unconstrained \\citep{Nagao_2006, Xu2018}. \\footnote{Although the Ly\\,\\textsc{$\\alpha$}\\ line doesn't directly factor into the line ratios we measure or the metallicities we determine, its flux and line profile does affect the measured flux of the N\\,\\textsc{v}\\ line.} \n\nOur adopted piece-wise power-law function fit to emission lines has been compared to the double-Gaussian and modified Lorentzian methods, achieving better fits with fewer or equal number of free parameters \\citep{Nagao_2006}. In cases when the piece-wise function does not produce a reasonable fit to the shape of the spectral feature, such as significantly blueshifted lines, we fit a skewed Gaussian function, where both the skew and FWHM of the Gaussian are coupled between LILs and HILs. Unlike the default piece-wise strategy, Ly\\,\\textsc{$\\alpha$}\\ is completely decoupled from the HIL group when fitting skewed Gaussians. We choose to fit a single skewed Gaussian because it has the same number of free parameters as the piece-wise power-law fit. Changing the fitting strategy is also motivated by the reduction in the minimum chi-square value even when the fits produce similar emission-line flux ratios. A more complete description of the comparison between these two fitting methods and the definition of the skewed Gaussian are provided in Appendix \\ref{appendix:line-fitting-compare}. \n\nWhen LILs and HILs are not coupled, some local continuum methods can produce emission-line profiles with very different widths and skewness \\citep{vandenberk2001}. We assume, as several similar other studies do \\citep[e.g.][]{Nagao_2006, Matsuoka_2011, Xu2018}, that emission lines with similar ionising potentials originate from similar line-emitting regions in the BLR. The coupling of power indices in Equation \\ref{eq:line_fit} provides a crucial constraint in ensuring that the kinematics of line-emitting clouds are preserved within the LIL and HIL groups. Furthermore, without the coupling of HILs, the decomposition of the Ly\\,\\textsc{$\\alpha$}\\ and N\\,\\textsc{v}\\ emission profile is not unique. The coupling of the N\\,\\textsc{v}\\ profile and the red wing of Ly\\,\\textsc{$\\alpha$}\\ to HILs provides a way to obtain a unique solution that disentangles their line profiles and fluxes.\n\nThe emission lines Ly \\textsc{$\\alpha$} $\\lambda$1216, N \\textsc{v} $\\lambda$1240, Si \\textsc{ii} $\\lambda$1263, Si \\textsc{iv} $\\lambda$1398, O \\textsc{iv} $\\lambda$1402, N \\textsc{iv}] $\\lambda$1486, C \\textsc{iv} $\\lambda$1549, He \\textsc{ii} $\\lambda$1640, O \\textsc{iii}] $\\lambda$1663, Al \\textsc{ii} $\\lambda$1671, Al \\textsc{iii} $\\lambda$1857, Si \\textsc{iii} $\\lambda$1887, and C \\textsc{iii}] $\\lambda$1909\\ are all fit simultaneously. The line-fitting regions generally are 1214-1290, 1360-1430, 1450-1700, and 1800-1970\\AA\\ with some flexibility depending on the width and kinematics of the spectral features. Each line is allowed an independent $\\pm 25$\\AA\\ shift in central wavelength, $\\lambda_{\\rm{0}}$, with respect to the rest-frame vacuum wavelength. Whether we used the piece-wise power-law or skewed Gaussian approach, a single emission-line is fit with only four parameters. Figure \\ref{fig:example-fit-ATLASJ029-36} shows an example fit to ATLASJ029-36 which was observed with VLT\/X-shooter. In this example, all of the lines from Ly\\,\\textsc{$\\alpha$}\\ at 1216 \\AA\\ to C\\,\\textsc{iii}]\\ at 1909 \\AA\\ have been fit simultaneously, with coupled LILs and HILs. \n\n\\begin{figure*}\n\t\\includegraphics[width=\\textwidth]{figs\/ATLASJ029-36.png}\n \\caption{Example fit to ATLASJ029-36 observed using VLT\/X-shooter with a mean SNR per 1\\AA\\ pixel of 27.35 between 1400-1600\\AA. The top plot shows the spectrum after the post-processing techniques and the bottom plot shows the residuals. The inset plot provides a closer look at the line profiles of Ly\\,\\textsc{$\\alpha$}\\ and N\\,\\textsc{v}. {The vertical blue bars indicate the continuum fitting windows, which are fit by the power-law continuum denoted by the orange line.} The red lines indicate the emission line fits as well as the extent of the individual line-fitting windows. All fitted emission lines are labeled and their individual line profiles are shown.}\n \\label{fig:example-fit-ATLASJ029-36}\n\\end{figure*}\n\n\nWe fit the C\\,\\textsc{iv}\\ emission line to estimate the blueshift according to Equation \\ref{eq:blueshift}. When C\\,\\textsc{iv}\\ blueshifts < 4000 km $\\rm{s}^{-1}$, we adopt the piecewise power-law fit and at higher blueshifts, we use the skewed Gaussian function. We find both methods produce consistent results at lower C\\,\\textsc{iv}\\ blueshifts as shown in the comparison described in Appendix \\ref{appendix:line-fitting-compare}.\n\nWe also fit the Mg\\,\\textsc{ii}\\ line independently with one skewed Gaussian or two symmetric Gaussians, using the following line-free windows: 1770-1810, 2060-2340, 2600-2740, 2840-3100\\AA\\ to measure the continuum. {The continuum is measured independently for the} Mg\\,\\textsc{ii}\\ line fit because the contribution from the Fe\\,\\textsc{ii}\\ emission {is} much more significant at these longer wavelengths. {Although the fit parameters are not always consistent between the two wavelength ranges, we find the power-law to be an adequate local approximation of the accretion disk emission}. We use the Mg\\,\\textsc{ii}\\ FWHM, Equation \\ref{eq:mgii-vo9}, and calibration from \\citet{Vestergaard_2009} to determine the black hole mass and find good agreement with Mazzucchelli et al. in prep. We calibrate the spectrum against the observed quasar AB magnitude in the J bandpass, where flux from the spectrum integrated over the filter transmission profile is scaled appropriately to the observed value. The peak flux wavelength of the total Mg\\,\\textsc{ii}\\ line profile is used to determine the redshift and its error. Figure \\ref{fig:mgii_fit_example} shows an example of a multiple Gaussian fit to the Mg\\,\\textsc{ii}\\ emission line along with the combined power-law and Fe\\,\\textsc{ii}\\ continuum.\n\n\\begin{figure}\n\t\\includegraphics[width=\\columnwidth]{figs\/PSOJ217-16_MgII.png}\n \\caption{Example two-Gaussian fit to the Mg\\,\\textsc{ii}\\ emission line of PSOJ217-16, observed using VLT\/X-shooter. The top plot shows the spectrum after the post-processing techniques and the bottom plot shows the residuals. The inset plot provides a closer look at the Mg\\,\\textsc{ii}\\ line profile after continuum subtraction. The orange line is the power-law and the green line is full baseline continuum with the Fe\\,\\textsc{ii}\\ template. The red line marks the fit to the emission line and the extent of the fitting windows. These fits are presented in greater detail in Mazzucchelli et al. in prep.}\n \\label{fig:mgii_fit_example}\n\\end{figure}\n\nFor the line flux error estimation, we adopt a Monte-Carlo approach used in similar studies of high-redshift quasar spectra \\citep[e.g.][]{Shen_2019, 2020z7.5, 2021_luminous7.6}. We create 50 mock spectra for each individual spectrum and stacked composite, where the flux at each pixel is resampled from a symmetric distribution with a standard deviation equivalent to the pixel spectral error. We assume the spectrum noise to follow a Gaussian distribution in this case. The same fitting procedure is applied to every mock spectrum generated in this way and we filter out outlier fits by sigma-clipping the line flux measurements using a 3-$\\sigma$ threshold. The final line flux of each metallicity-sensitive line is the median of all remaining fits and the final uncertainty is its standard deviation.\n\n{Using other empirical templates of the} Fe\\,\\textsc{ii}\\ {emission} \\citep[e.g.][]{Tsuzuki_2006, Bruhweiler_2008, Mejia_2016} {can result in a maximum discrepancy of 20\\% in the} Mg\\,\\textsc{ii}\\ {FWHM, and 0.2\\% in the estimated redshift. Although this can modify the significance of the black hole mass correlation presented in} Section \\ref{sec:results}, {it has no effect on the metallicity estimates or the conclusions of this study, which depends primarily on the} C\\,\\textsc{iv}\\ {profile.}\n\nFigure \\ref{fig:quasar_properties} presents the distribution of redshift, bolometric luminosity, black hole mass, and C\\,\\textsc{iv}\\ blueshift in our sample. The completed sample covers redshifts $z = 5.8-7.5$, spanning a range in bolometric luminosity $\\log\\left(\\rm{L}_{\\rm{bol}}\/\\rm{erg \\, s}^{-1}\\right) = 46.7-47.7$ and a range in black hole mass $\\log\\left({\\rm{M}_{\\rm{BH}}\/\\rm{M}_{\\odot}}\\right) = 8.4-9.8$. Quasars with luminosities $\\log\\left(\\rm{L}_{\\rm{bol}}\/\\rm{erg \\, s}^{-1}\\right) \\leq 47.0$ and black hole masses $\\log\\left({\\rm{M}_{\\rm{BH}}\/\\rm{M}_{\\odot}}\\right) \\leq 8.9$ are all observed with GNIRS. We measure C\\,\\textsc{iv}\\ blueshifts spanning over 5000 km $\\rm{s}^{-1}$ in our sample, from values consistent with no detectable blueshift to the most extreme outflow-dominated spectrum in PSOJ065-25. None of the targets exhibit a significantly redshifted C\\,\\textsc{iv}\\ emission line. We list all of the measured quasar properties in Table \\ref{tab:quasar_sample}.\n\n\\subsection{Line Ratios and Metallicity} \\label{sec:line_ratios_metallicity}\nIn order to interpret the results of the fitting, it is useful to compare the measured high-ionisation line ratios against predictions from photoionisation models. It's well-known that single-zone photoionisation models are unable to fully reproduce the observed emission from the BLR, because the gas clouds span a wide range of densities and degrees of ionisation \\citep[e.g.][]{Davidson_1977, Collin_Souffrin_1988}. Multi-zone models incorporate emission from gas with a wide range of physical properties and are shown to be consistent with observation \\citep[e.g.][]{Rees_1989, Hamann_1998}.\n\nThe flux ratio-metallicity relation is sensitive to the density of line-emitting clouds, spectral energy distribution (SED) of the ionizing continuum, and microturbulence, but under the locally optimally-emitting cloud model \\citep[LOC;][]{Baldwin_1995_LOC}, the net emission spectrum can be reproduced by integrating across a wide range of physical conditions. Therefore, the characteristics of the observable spectrum originate from an amalgamation of emitters, where each emission line is formed in a region that is optimally suited to emit the targeted line. This model consistently reproduces properties of both low and high-ionisation emission lines observed in quasar spectra \\citep[e.g.][]{Korista_2000_LOC, Hamann_2002, Nagao_2006}.\n\nWe primarily utilise two broad emission-line flux ratios (\\nv\/\\civ, (\\siiv+\\oiv)\/\\civ) because the relevant lines are easier to detect and more commonly studied in the existing literature. However, we also present results for additional line ratios ((\\oiii+\\alii)\/\\civ, \\aliii\/\\civ, \\siiii\/\\civ, \\ciii\/\\civ). The emission from these other lines are substantially more difficult to measure and can only be detected in a robust manner in high SNR spectra, such as our XQR-30 sample of high-redshift quasars. We convert all of the line ratios into metallicity estimates using relations derived from \\texttt{Cloudy} photoionisation simulations described in \\citet{Hamann_2002} and \\citet{Nagao_2006}. Both models utilise the LOC model \\citep{Ferland_1998_cloudy}. \\citet{Nagao_2006} predicts line flux ratios for all listed line ratios with two models for the ionizing continuum: one with a strong UV thermal bump matching results from \\citet{large_uv_bump} and one with a weak UV thermal bump similar to Hubble Space Telescope quasar templates \\citep{Zheng_1997, telfer2002}. These two SEDs are thought to be extreme and opposite cases for the actual ionising continuum \\citep{Nagao_2006}, which gives us the full range of possible inferred metallicities. \\citet{Hamann_2002} predicts line flux ratios of only \\nv\/\\civ\\ for three mock incident spectra: that of \\citet{mf87}; a single hard power-law with index $\\alpha = -1.0$ ($f_{\\rm{\\nu}} \\propto \\nu^{\\rm{\\alpha}}$); and a segmented power-law with indices $\\alpha = [-0.9, -1.6, -0.6]$ for 0.25\\AA\\ to 12\\AA, 12\\AA\\ to 912\\AA, and 912\\AA\\ to 1 $\\mu$m respectively. The segmented power-law continuum approximates data gathered from observations \\citep[e.g.][]{Laor_1997}. For \\citet{Hamann_2002}, the \\citet{mf87} incident spectrum predicts the highest metallicities for the same line ratio and the $\\alpha = -1.0$ spectrum produces the lowest. The spread in metallicities predicted for the same line ratio is incorporated into our uncertainties. For \\nv\/\\civ\\ the results from both publications are largely consistent with minor differences arising from the SED of the ionizing continuum, integration ranges of gas density ($n_{\\rm{H}}$) or ionizing flux ($\\Phi_{\\rm{H}}$), cloud column density, and the version of \\texttt{Cloudy} used. \n\nLine ratios which imply metallicities over 10 $Z_{\\odot}$ extend beyond the parameter space probed by \\citet{Hamann_2002} or \\citet{Nagao_2006}. This occurs when the measured line ratio exceeds 0.84 for \\nv\/\\civ\\ or 0.45 for (\\siiv+\\oiv)\/\\civ. For the other line ratios, this occurs at (0.39, 0.16, 0.36, 0.57) for ((\\oiii+\\alii)\/\\civ, \\aliii\/\\civ, \\siiii\/\\civ, \\ciii\/\\civ). In order to investigate inferred metallicities for higher line ratios, we assume that the observed line flux ratio-metallicity relationship maintains a linear trend in log-space and linearly extrapolate beyond the parameter space probed by the simulations. Super-solar metallicites over 10 $Z_{\\odot}$ have not been calibrated against \\texttt{Cloudy} simulations.\n\nWe consider all of the photionisation calculations with different ionizing SEDs in our metallicity estimate. The effect of the ionizing continuum SED is responsible for up to a factor of two difference in the resulting metallicity predictions from \\nv\/\\civ. For \\nv\/\\civ, the uncertainty from the metallicity calibration based on the various photoionisation models is dominant over the observational uncertainty. (\\siiv+\\oiv)\/\\civ\\ is a more robust metallicity indicator than \\nv\/\\civ\\ because it is not as sensitive to differences in the ionizing continuum or assumed weighting functions \\citep[e.g.][]{Nagao_2006, Matsuoka_2011, Maiolino_2019_metallica}, and it is not affected by bias propagating from a poor fit to the highly absorbed Ly\\,\\textsc{$\\alpha$}\\ emission line. However, in this study, we offer no discussion on the discrepancy between the metallicity indicators. Instead, we present the inferred metallicities separately and use the spread of results from different assumed ionizing SEDs as the uncertainty of each individual measurement. A comparison between inferred metallicities from \\nv\/\\civ\\ and (\\siiv+\\oiv)\/\\civ\\ is provided in the Appendix.\n\n\n\\section{Results} \\label{sec:results}\nWe present all quasars and their measured properties in Table \\ref{tab:quasar_sample}. In addition to fitting the composites described in Section \\ref{sec:composites}, the emission-lines of nearly all of the quasar spectra can be fit individually. We fit the \\nv\/\\civ\\ line ratio for 16 of the 25 individual quasars, wherever the N\\,\\textsc{v}\\ emission can be separated from the Ly\\,\\textsc{$\\alpha$}\\ emission. We show the \\nv\/\\civ\\ and (\\siiv+\\oiv)\/\\civ\\ line ratio results for individual fits in Table \\ref{tab:quasar_sample} and provide 6 example fits to individual quasar spectra in the Appendix, covering the lowest and highest quasar bolometric luminosity, black hole mass, and C\\,\\textsc{iv}\\ blueshift. Also available are figure sets which show sample fits to bolometric luminosity composites, black hole mass composites, and C\\,\\textsc{iv}\\ blueshift composites. We provide all line fluxes measured from our composites normalised against C\\,\\textsc{iv}\\ in Tables \\ref{tab:composite_results}, \\ref{tab:composite_mass}, and \\ref{tab:composite_blueshift}.\n\n\\begingroup\n\\begin{table*}\n\\caption {\\label{tab:quasar_sample} Properties of the quasars and spectra included in this study and their measured emission line flux ratios. The redshift is determined from the Mg\\,\\textsc{ii}\\ line with an uncertainty floor of 0.001. The C\\,\\textsc{iv}\\ blueshift is measured using the median wavelength of the C\\,\\textsc{iv}\\ fit and the mean SNR is measured in the rest-frame wavelength range 1400-1600\\AA. We prescribe a minimum error of the C\\,\\textsc{iv}\\ blueshift equivalent to $\\sim$200 km s$^{-1}$, based on the 1\\AA\\ resolution of the resampled grid. All quasars listed above the horizontal divider are observed with GNIRS and all quasars listed below the divider are observed with X-shooter. The last column indicates our source for the black hole mass and bolometric luminosity. The bolometric correction used to measure the luminosity, single-epoch virial mass calibration, and Fe\\,\\textsc{ii}\\ template used to measure Mg\\,\\textsc{ii}\\ are all consistent throughout the sample.} \n\\begin{tabular}{lcccccccc}\n\\hline \\hline\n Name & R.A. & Decl. & Mg\\,\\textsc{ii}\\ Redshift & C\\,\\textsc{iv}\\ Blueshift & SNR & \\nv\/\\civ & (\\siiv+\\oiv)\/\\civ & M$_{\\rm{BH}}$\/L$_{\\rm{bol}}$ Ref\\\\\n & (J2000) & (J2000) & & (km s$^{-1}$) & & & & \\\\\n \\hline\nJ0024+3913 & 00:24:29.77 & 39:13:19.00 & 6.620 $\\pm$ 0.004 & 635 $\\pm$ 255 & 9.45 & 0.77 $\\pm$ 0.15 & 0.27 $\\pm$ 0.06 & 1 \\\\ \nJ0829+4117 & 08:29:31.97 & 41:17:40.40 & 6.773 $\\pm$ 0.007 & 1574 $\\pm$ 336 & 16.33 & 0.49 $\\pm$ 0.09 & 0.12 $\\pm$ 0.05 & 1 \\\\ \nJ0837+4929 & 08:37:37.84 & 49:29:00.40 & 6.702 $\\pm$ 0.001 & 600 $\\pm$ 204 & 30.91 & 1.49 $\\pm$ 0.08 & 0.66 $\\pm$ 0.10 & 1 \\\\ \nJ0910+1656 & 09:10:13.63 & 16:56:29.80 & 6.719 $\\pm$ 0.005 & $-$159 $\\pm$ 279 & 9.42 & 0.50 $\\pm$ 0.08 & 0.19 $\\pm$ 0.09 & 1 \\\\ \nJ0921+0007 & 09:21:20.56 & 00:07:22.90 & 6.565 $\\pm$ 0.001 & 678 $\\pm$ 204 & 9.66 & 0.49 $\\pm$ 0.13 & 0.16 $\\pm$ 0.05 & 1 \\\\ \nJ1216+4519 & 12:16:27.58 & 45:19:10.70 & 6.648 $\\pm$ 0.003 & 4955 $\\pm$ 232 & 7.63 & --- & 0.50 $\\pm$ 0.33 & 1 \\\\ \nJ1342+0928 & 13:42:08.10 & 09:28:38.60 & 7.510 $\\pm$ 0.010 & 6900 $\\pm$ 405 & 24.79 & --- & 0.78 $\\pm$ 0.28 & 1 \\\\ \nJ2102-1458 & 21:02:19.22 & $-$14:58:54.00 & 6.652 $\\pm$ 0.003 & 3433 $\\pm$ 232 & 11.47 & 1.82 $\\pm$ 0.44 & 0.57 $\\pm$ 0.23 & 1 \\\\ \nP333+26 & 22:15:56.63 & 26:06:29.40 & 6.027 $\\pm$ 0.006 & 2534 $\\pm$ 325 & 5.73 & 0.80 $\\pm$ 0.47 & 0.27 $\\pm$ 0.19 & 2 \\\\ \nJ2338+2143 & 23:38:07.03 & 21:43:58.20 & 6.565 $\\pm$ 0.009 & --- & 7.07 & --- & --- & 1 \\\\ \\hline\nPSOJ007+04 & 00:28:06.56 & 04:57:25.64 & 6.001 $\\pm$ 0.002 & 3816 $\\pm$ 218 & 24.58 & --- & 0.45 $\\pm$ 0.20 & 3 \\\\ \nPSOJ025-11 & 01:40:57.03 & $-$11:40:59.48 & 5.816 $\\pm$ 0.004 & 2575 $\\pm$ 266 & 26.54 & --- & 0.70 $\\pm$ 0.13 & 3 \\\\ \nPSOJ029-29 & 01:58:04.14 & $-$29:05:19.25 & 5.976 $\\pm$ 0.001 & 3295 $\\pm$ 205 & 27.39 & 1.14 $\\pm$ 0.13 & 0.64 $\\pm$ 0.15 & 3 \\\\ \nATLASJ029-36 & 01:59:57.97 & $-$36:33:56.60 & 6.020 $\\pm$ 0.002 & 2705 $\\pm$ 217 & 27.35 & 1.07 $\\pm$ 0.11 & 0.49 $\\pm$ 0.13 & 3 \\\\ \nVDESJ0224-4711 & 02:24:26.54 & $-$47:11:29.40 & 6.528 $\\pm$ 0.001 & 2217 $\\pm$ 204 & 28.68 & 0.79 $\\pm$ 0.04 & 0.34 $\\pm$ 0.11 & 3 \\\\ \nPSOJ060+24 & 04:02:12.69 & 24:51:24.42 & 6.170 $\\pm$ 0.001 & 1082 $\\pm$ 204 & 30.73 & 0.76 $\\pm$ 0.05 & 0.10 $\\pm$ 0.05 & 3 \\\\ \nPSOJ065-26 & 04:21:38.05 & $-$26:57:15.60 & 6.188 $\\pm$ 0.001 & 8288 $\\pm$ 204 & 36.57 & --- & 0.78 $\\pm$ 0.65 & 3 \\\\ \nPSOJ108+08 & 07:13:46.31 & 08:55:32.65 & 5.945 $\\pm$ 0.001 & 4832 $\\pm$ 205 & 37.27 & --- & 0.78 $\\pm$ 0.27 & 3 \\\\ \nPSOJ158-14 & 10:34:46.50 & $-$14:25:15.58 & 6.068 $\\pm$ 0.001 & 2683 $\\pm$ 204 & 31.67 & 0.81 $\\pm$ 0.07 & 0.28 $\\pm$ 0.09 & 3 \\\\ \nJ1212+0505 & 12:12:26.98 & 05:05:33.49 & 6.439 $\\pm$ 0.001 & 4329 $\\pm$ 204 & 31.27 & --- & 0.93 $\\pm$ 0.37 & 3 \\\\ \nPSOJ217-16 & 14:28:21.39 & $-$16:02:43.30 & 6.150 $\\pm$ 0.001 & 4023 $\\pm$ 204 & 34.57 & --- & 0.30 $\\pm$ 0.13 & 3 \\\\ \nPSOJ242-12 & 16:09:45.53 & $-$12:58:54.11 & 5.830 $\\pm$ 0.001 & 891 $\\pm$ 205 & 15.55 & 0.87 $\\pm$ 0.11 & 0.34 $\\pm$ 0.22 & 3 \\\\ \nPSOJ308-27 & 20:33:55.91 & $-$27:38:54.60 & 5.799 $\\pm$ 0.001 & 1971 $\\pm$ 205 & 33.18 & 0.98 $\\pm$ 0.06 & 0.95 $\\pm$ 0.10 & 3 \\\\ \nPSOJ323+12 & 21:32:33.19 & 12:17:55.26 & 6.586 $\\pm$ 0.001 & 697 $\\pm$ 204 & 31.34 & 0.73 $\\pm$ 0.05 & 0.36 $\\pm$ 0.08 & 3 \\\\ \nPSOJ359-06 & 23:56:32.45 & $-$06:22:59.26 & 6.172 $\\pm$ 0.001 & 1082 $\\pm$ 204 & 35.36 & 0.96 $\\pm$ 0.13 & 0.11 $\\pm$ 0.04 & 3 \\\\ \n\\hline \\hline\n\\multicolumn{6}{l}{\\footnotesize\n$^{1}$ \\citet{yang2021probing}\n$^{2}$ \\citet{Shen_2019}\n$^{3}$ Mazzucchelli et al. in prep.}\n\\end{tabular}\n\\end{table*}\n\\endgroup\n\nWe present the measured line ratios of all individual and composite fits of bolometric luminosity and black hole mass in Figure \\ref{fig:line_ratio_Lbol_Mbh}. For comparison, we show SDSS low-redshift composites reported in \\citet{Xu2018} and high-redshift ($z\\sim6$) quasars observed with GNIRS from \\citet{Wang_2021}. Square symbols indicate measurements from fits of composites while circular points indicate fits of individual spectra. Our data, indicated in blue and black, have the highest SNR and spectral resolution of the data represented in the figure. Measurements of both metallicity-sensitive line ratios show a large scatter between individual quasar fits even when controlling for quasar luminosity or black hole mass. Particularly at a bolometric luminosity range of $\\log\\left(L_{\\rm{bol}}\/\\rm{erg \\, s}^{-1}\\right) = 47.30-47.35$, we see over a factor of 8 difference between the individual quasar measured with the highest and lowest (\\siiv+\\oiv)\/\\civ\\ line ratio, as seen in Figure \\ref{fig:line_ratio_Lbolscatter}. The composites suppress the high variance that we observe in the individual measurements, which can be attributed to varied C\\,\\textsc{iv}\\ blueshifts. The associated uncertainty of the bolometric luminosity and black hole mass for each composite is determined by the mean and standard deviation of the input spectra. We note that in \\citet{Xu2018}, the black hole masses are estimated using the C\\,\\textsc{iv}\\ emission line which can be biased by its blueshift. \n\n\\begin{figure*}\n\\begin{tabular}{cc}\n \\includegraphics[width=90mm]{figs\/line_ratio_Lbol.png} & \\includegraphics[width=90mm]{figs\/line_ratio_Mbh.png} \n\\end{tabular}\n\\caption{\\nv\/\\civ\\ and (\\siiv+\\oiv)\/\\civ\\ flux ratios as a function of the quasar bolometric luminosity (left) and virially estimated black hole mass (right). The low-redshift sample (2.0 < $z$ < 5.0) indicated in grey is from \\citet{Xu2018} while another higher-redshift comparison sample indicated in red is sourced from \\citet{Wang_2021}. Our sample is presented in blue and black. Square points with capped error bars indicate composites while circular points indicate individual fits. Not all individual quasars involved in the composites are plotted. The single red square denotes the composite from \\citet{Wang_2021}. The black hole masses in this study and in \\citet{Wang_2021} are estimated with single-epoch virial estimates using the Mg\\,\\textsc{ii}\\ emission line, while the \\citet{Xu2018} study uses the C\\,\\textsc{iv}\\ emission line. {The orange shaded space indicates a range of line ratios which are consistent with the metallicity indicated in the secondary axis based on photoionisation calculations with different ionizing SEDs}. The overlapping region in the \\nv\/\\civ\\ plot indicates a range of line ratios which is consistent with both $\\rm{Z} = 10\\,\\rm{Z}_{\\odot}$ and $\\rm{Z} = 20\\,\\rm{Z}_{\\odot}$ \\citep[e.g.][]{Hamann_2002, Nagao_2006}. Metallicity values larger than 10 Z$_{\\odot}$ are extrapolated.} \\label{fig:line_ratio_Lbol_Mbh}\n\\end{figure*}\n\nThe line flux ratio measurements of our high-redshift quasar sample are essentially indistinguishable from the lower-redshift results of comparable luminosity and black hole mass sourced from \\citet{Xu2018}. Therefore, we do not observe appreciable evolution with redshift. However, our high-redshift sample does not show a statistically appreciable correlation between observed line ratios and the bolometric luminosity, as evidenced in previous work \\citep{hamann_1993, Dietrich_2003, Nagao_2006, Xu2018}. This may be because this sample covers a restricted luminosity range compared to the lower redshift sample. Deeper observations of quasars with high redshift and lower luminosity \\citep[e.g.][]{Matsuoka_2016} are needed to verify any trend in emission-line ratio with quasar bolometric luminosity. On the other hand, we recover the positive correlation between (\\siiv+\\oiv)\/\\civ\\ and the estimated black-hole mass as shown in Figure \\ref{fig:line_ratio_Lbol_Mbh}. The measurements of individual quasars exhibit large scatter for very similar quasar properties. We present the line ratio dependence on the C\\,\\textsc{iv}\\ blueshift in the following section to explain this variance.\n\n\\begin{figure*}\n\t\\includegraphics[width=\\textwidth]{figs\/line_ratio_Lbolscatter.png}\n \\caption{Example spectra of three quasars in the sample (PSOJ242-12, PSOJ308-27, and PSOJ359-06) which exhibit similar bolometric luminosities. The raw spectrum is shown in this plot, but many of the significant absorption features (e.g. in PSOJ359-06) are masked by the post-processing procedure. Overall line fits are shown in black. A large scatter in the (\\siiv+\\oiv)\/\\civ\\ emission line flux ratio is observed between quasar spectra with significantly different C\\,\\textsc{iv}\\ equivalent width, which is inversely correlated with the C\\,\\textsc{iv}\\ blueshift.}\n \\label{fig:line_ratio_Lbolscatter}\n\\end{figure*}\n\n\n\\subsection{C\\,\\textsc{iv}\\ Blueshift and Line Flux Ratios} \\label{sec:blueshift}\nFigure \\ref{fig:blueshift_line_ratio_results} plots emission line flux ratios against the C\\,\\textsc{iv}\\ blueshift along with the estimated black hole mass as a third axis, represented by the blue-green color scale. The C\\,\\textsc{iv}\\ blueshift and uncertainty of the composite spectra is obtained from the mean and standard deviation of the input spectra. We prescribe an uncertainty floor of the C\\,\\textsc{iv}\\ blueshift equivalent to 200 km s$^{-1}$ based on the 1 \\AA\\ wavelength grid, but the total uncertainty for measurements of individual quasars is composed also of the redshift error added in quadrature. On average, the C\\,\\textsc{iv}\\ blueshift error is 230 km s$^{-1}$. Measurements of the N\\,\\textsc{v}\\ emission line becomes more challenging to deblend from the Ly\\,\\textsc{$\\alpha$}\\ flux at high blueshifts, especially for individual lower SNR spectra, thus the high C\\,\\textsc{iv}\\ blueshift parameter space for \\nv\/\\civ\\ is only sparsely explored.\n\nThe results from Figures \\ref{fig:line_ratio_Lbolscatter} and \\ref{fig:blueshift_line_ratio_results} demonstrate that the measured emission line ratios are strongly correlated with the C\\,\\textsc{iv}\\ blueshift. Controlling for the C\\,\\textsc{iv}\\ spectral shape in Figure \\ref{fig:blueshift_line_ratio_results}, the relationship between the two emission line ratios with black hole mass is no longer clear. The C\\,\\textsc{iv}\\ lines of the highest mass quasars are typically more blueshifted, but the most massive quasars do not necessarily have the highest line ratios among other quasars with similar blueshifts. It could also be seen that quasars with moderate ($\\sim$1000 km s$^{-1}$) C\\,\\textsc{iv}\\ blueshifts can have a very large scatter in observable line ratios whereas quasars with higher blueshifts consistently possess some of the highest line ratios observed in our sample. At high C\\,\\textsc{iv}\\ blueshifts, the lower flux of the C\\,\\textsc{iv}\\ line, as evidenced by its correlation with narrower EWs shown in Figure \\ref{fig:CIV_blueshift_ew}, drives the C\\,\\textsc{iv}-normalised flux ratio measurements higher. The responses of the N\\,\\textsc{v}, Si\\,\\textsc{iv}, and O\\,\\textsc{iv}\\ equivalent widths are not proportionate to that of the C\\,\\textsc{iv}\\ line as the C\\,\\textsc{iv}\\ blueshift rises. We see similar trends on other metallicity-sensitive line ratios that depend on the C\\,\\textsc{iv}\\ flux as shown in Appendix Figure \\ref{fig:other_line_ratios}.\n\nFigure \\ref{fig:blueshift_mbh_lbol} presents the correlations found in our sample between the C\\,\\textsc{iv}\\ blueshift with the virially estimated black hole mass, quasar bolometric luminosity, and Eddington ratio. The C\\,\\textsc{iv}\\ blueshift is not significantly correlated with the quasar bolometric luminosity, but there is a moderate relationship between the C\\,\\textsc{iv}\\ blueshift with the Eddington ratio and estimated black hole mass, with the magnitude of Spearman correlation coefficients greater than 0.4 and at least 5\\% significance. We show in Figure \\ref{fig:line_ratio_residual} the residuals calculated by subtracting the correlation found between composites of C\\,\\textsc{iv}\\ blueshift and the (\\siiv+\\oiv)\/\\civ\\ line ratio from the measured line ratios of individual quasars. The results show that higher mass and more luminous quasars are not more likely to lie above this relationship, indicating no strong correlation with black hole mass or luminosity when controlling for blueshift \\citep[also see][]{metal_density}. The stronger and more significant correlation between line ratios and the C\\,\\textsc{iv}\\ blueshift {could be attributed to the fact that the} C\\,\\textsc{iv}\\ blueshift {is a more direct observable compared to the black hole mass or luminosity, which are estimated using calibrations with large associated uncertainties. When not controlled, the} C\\,\\textsc{iv}\\ blueshift {can bias other correlations found between quasar properties and the metallicity in the BLR, such as the apparent} mass correlation in Figure \\ref{fig:line_ratio_Lbol_Mbh}. It's important to note that the C\\,\\textsc{iv}\\ blueshift and quasar properties are not independent for our sample. This suggests that studies measuring metallicity-sensitive line flux ratios dependent on the C\\,\\textsc{iv}\\ flux should consider the C\\,\\textsc{iv}\\ spectral shape before interpreting the diversity of emission-line ratios as an indication of evolution in the BLR metallicity. \n\n\\begin{figure}\n\t\\includegraphics[width=\\columnwidth]{figs\/line_ratio_blueshift.png}\n \\caption{\\nv\/\\civ\\ and (\\siiv+\\oiv)\/\\civ\\ flux ratios as a function of the C\\,\\textsc{iv}\\ blueshift of quasars in the sample. Blueshift composites are presented in black while individual fits are mapped onto a blue-green gradient scaled to the black hole mass. The minimum C\\,\\textsc{iv}\\ blueshift error is 200 km s$^{-1}$ based on the 1\\AA\\ wavelength bins, but the contribution from the systemic redshift error is added in quadrature for an average total of 230 km s$^{-1}$ uncertainty. The Spearman correlation coefficients and p-values are derived from the fits to individual quasars. {The orange shaded space indicates a range of line ratios which are consistent with the metallicity indicated in the secondary axis based on photoionisation calculations with different ionizing SEDs}. The overlapping region in the \\nv\/\\civ\\ plot indicates a sub-space of parameters which is consistent with both $\\rm{Z} = 10\\,\\rm{Z}_{\\odot}$ and $\\rm{Z} = 20\\,\\rm{Z}_{\\odot}$. The line ratio correlation with the C\\,\\textsc{iv}\\ blueshift is more significant than the correlation with black hole mass or bolometric luminosity.}\n \\label{fig:blueshift_line_ratio_results}\n\\end{figure}\n\n\\begin{figure*}\n\t\\includegraphics[width=\\textwidth]{figs\/CIV_Blueshift_corr_v2.png}\n \\caption{The quasar black hole mass (left), bolometric luminosity (middle), and Eddington ratio (right) are plotted against the measured C\\,\\textsc{iv}\\ blueshift for our sample. The least-squares linear fits are shown along with the Spearman r-coefficients and their significance. There is a moderate, but significant, correlation between the quasar outflow indicator, i.e. the C\\,\\textsc{iv}\\ blueshift, and the black hole mass. The correlation between the C\\,\\textsc{iv}\\ blueshift with the Eddington ratio is weaker and less significant, while no significant correlation was found with the bolometric luminosity.}\n \\label{fig:blueshift_mbh_lbol}\n\\end{figure*}\n\n\\begin{figure}\n\t\\includegraphics[width=\\columnwidth]{figs\/line_ratio_residual.png}\n \\caption{(\\siiv+\\oiv)\/\\civ\\ residual as a function {of} black hole mass (left) and bolometric luminosity (right). The residual is measured by subtracting the correlation found between composites of C\\,\\textsc{iv}\\ blueshift and the (\\siiv+\\oiv)\/\\civ\\ line ratio from the measured line ratios of individual quasars. The scatter is large around zero with no apparent systematic deviation with black hole mass or bolometric luminosity. This shows that higher mass or more luminous quasars are not more likely to exhibit higher line ratios than their smaller or fainter counterparts. However, we caution the reader when interpreting this relationship, because the C\\,\\textsc{iv}\\ blueshift and quasar properties are not independent.}\n \\label{fig:line_ratio_residual}\n\\end{figure}\n\n\n\\subsection{Inferred Metallicity in the Quasar BLR} \\label{sec:metallicity_result}\nUsing models derived from the photoionisation code \\texttt{Cloudy}, we convert the measured \\nv\/\\civ\\ and (\\siiv+\\oiv)\/\\civ\\ line ratios into metallicity estimates in the BLR. Figures \\ref{fig:line_ratio_Lbol_Mbh} and \\ref{fig:blueshift_line_ratio_results} show the range of line ratios consistent with 5, 10, and 20 Z$_{\\odot}$ for \\nv\/\\civ\\ and 1, 5, 10, and 20 Z$_{\\odot}$ for (\\siiv+\\oiv)\/\\civ. The minimum and maximum bounds of each metallicity estimate are determined by the variations on the assumed ionizing SED used in \\texttt{Cloudy} photoionisation LOC models presented in \\citet{Hamann_2002} and \\citet{Nagao_2006}. The central tick is determined by the median of all relevant models. Larger variations in metallicity can be seen for the \\nv\/\\civ\\ line ratio, indicating that (\\siiv+\\oiv)\/\\civ\\ is less dependent on the shape of the ionizing flux SED \\citep[e.g.][]{Nagao_2006, Matsuoka_2011, Maiolino_2019_metallica}. The overlapping region in the \\nv\/\\civ\\ plot shows a range in the line ratio which is consistent with both $\\rm{Z} = 10\\,\\rm{Z}_{\\odot}$ and $\\rm{Z} = 20\\,\\rm{Z}_{\\odot}$ depending on the referenced photoionisation model, implying a factor of two uncertainty. The results for the other line ratios ((\\oiii+\\alii)\/\\civ, \\aliii\/\\civ, \\siiii\/\\civ, and \\ciii\/\\civ) plotted against quasar bolometric luminosity, estimated black hole mass, and C\\,\\textsc{iv}\\ blueshift are presented in Figure \\ref{fig:other_line_ratios} in the Appendix. Generally, these other line ratios predict metallicities similar to (\\siiv+\\oiv)\/\\civ.\n\nSpectra with high C\\,\\textsc{iv}\\ blueshift are dominated by emission from an outflowing BLR wind, which is correlated with high X\/C\\,\\textsc{iv}\\ line flux ratios. Photoionisation models suggest that the wind emission originates from higher density gas clouds closer in to the accretion disk, illuminated by high ionising fluxes, while the core emission is composed of emission from clouds with a broad range of physical properties, as in the LOC model \\citep{metal_density}. We therefore consider the metallicity results from spectra where the C\\,\\textsc{iv}\\ blueshift < 1500 km s$^{-1}$, minimizing the contribution from the wind emission. The two composites satisfying this requirement yield (\\nv\/\\civ, (\\siiv+\\oiv)\/\\civ) line ratios of ($0.83 \\pm 0.15$, $0.31 \\pm 0.13$) and ($0.84 \\pm 0.09$, $0.22 \\pm 0.03$) for C\\,\\textsc{iv}\\ blueshifts from $-$200-680 and 680-1500 km s$^{-1}$ respectively. We do not consider the other line ratios in this discussion as they are substantially more difficult to measure. The \\nv\/\\civ\\ line ratio typically predicts higher metallicities with greater corresponding uncertainty than the (\\siiv+\\oiv)\/\\civ\\ line ratio. Figure \\ref{fig:blueshift_line_ratio_results} also plots the line ratios for each C\\,\\textsc{iv}\\ blueshift composite and the inferred metallicity in the secondary axis. Using the aforementioned reference photoionisation models, the measured \\nv\/\\civ\\ line ratio is consistent with being produced by gas clouds with Z$_{-\\rm{200-680}}$ = $9.77 \\pm 2.35$ Z$_{\\odot}$ and Z$_{\\rm{680-1500}}$ = $9.96 \\pm 2.42$ Z$_{\\odot}$ for the two lowest C\\,\\textsc{iv}\\ blueshift composites. For (\\siiv+\\oiv)\/\\civ, it is Z$_{-\\rm{200-680}}$ = $4.61 \\pm 0.01$ Z$_{\\odot}$ and Z$_{\\rm{680-1500}}$ = $2.01 \\pm 0.01$ Z$_{\\odot}$. Both metallicity indicators individually suggest super-solar metallicities with high significance ($\\gtrsim$ 4-$\\sigma$). The absolute measured metallicity differs by a factor of 2-4 between the indicators although the (\\siiv+\\oiv)\/\\civ\\ line provides more robust results and is less affected by the model chosen for the ionising flux. Using the (\\siiv+\\oiv)\/\\civ\\ line ratio, we can see that the metallicity in the quasar BLR at $z\\sim6$ is at least 2-4 times super-solar. Inferred metallicities from spectra observed with high C\\,\\textsc{iv}\\ blueshifts range from ${\\rm{Z}}_{\\rm{>1500}}$ = 8 Z$_{\\odot}$ to as high as ${\\rm{Z}}_{\\rm{>3000}}$ = 20 Z$_{\\odot}$\n\n\n\\section{Discussion} \\label{sec:discussion}\nPrevious studies of chemical abundances in the BLR have suggested metallicities that are several times solar across a wide range of redshifts (2.0 < $z$ < 7.5) \\citep[e.g.][]{hamann1992, Dietrich_2003, metallicity_distant, Xu2018, Onoue_2020}, consistent with some galactic chemical evolution models \\citep{Tinsley_1980, Arimoto_1987, hamann_1993, Hamann_1999}. Complementary probes targeting quasar narrow absorption features also suggest super-solar (Z > 2 Z$_{\\odot}$) metallicites \\citep[e.g.][]{Hamann_1999, dodorico_2004_absorption, Jiang_2018, Maiolino_2019_metallica}. The lack of apparent redshift evolution up to $z\\sim6$ stands in contrast to studies of metallicity in star-forming galaxies and Lyman-break galaxies up to $z\\sim3.5$, which show evolution in the mass-metallicity relationship and an overall decrease in metallicity with redshift \\citep[e.g.][]{Maiolino_2008, Mannucci_2009_LSD}. It's possible to infer the host galaxy metallicity using the mass of the central black hole using the tight (0.1 dex) galaxy stellar mass - gas phase metallicity relationship (MZR) \\citep[e.g.][]{Maiolino_2008, Dave_2017_mufasa, Curti_2019_Klever, Maiolino_2019_metallica, Sanders_2021_MOSDEF} combined with the M$_{\\rm{BH}}$\/M$_{\\rm{host}}$ ratios \\citep[e.g.][]{Targett_2012}. The results from comparisons between quasar BLR and host galaxy metallicities at redshifts $2.25 < z < 5.25$ suggest that the BLR is enriched in excess of the inferred metallicities of the host galaxies, which are approximately solar \\citep{Xu2018}. This discrepancy has been attributed to the black hole mass-metallicity relationship and selection effects, where only the most massive and enriched high-redshift quasars are selectively observed in a magnitude-limited survey \\citep[e.g.][]{metallicity_distant, Maiolino_2019_metallica}. However, \\citet{Xu2018}, \\citet{Wang_2021}, and this paper study samples with comparable quasar properties as shown in Figure \\ref{fig:line_ratio_Lbol_Mbh}. The \\citet{Xu2018} composites include hundreds of SDSS DR12 quasar spectra in the redshift range $2.25 < z < 5.25$, whereas \\citet{Wang_2021} utilises a higher-redshift sample with 33 $z\\sim6$ quasars. These quasars occupy a similar black hole mass and luminosity range, and show very similar line ratios within the scatter of the data, suggesting that a selection bias is not sufficient to explain the apparent lack of redshift evolution. \n\nAdditionally, we note that the C\\,\\textsc{iv}\\ blueshift, a signature of quasar outflows, is a significant factor correlated with the measured C\\,\\textsc{iv}\\ flux (see Figure \\ref{fig:CIV_blueshift_ew}). According to a study of 34 low-redshift quasars spanning nearly 3 dex in black hole mass and bolometric luminosity, outflow indicators are not correlated with black hole mass and only marginally correlated with luminosity and Eddington ratio \\citep{shin_2017_outflow}. Although our study covers a smaller range of quasar parameters, our results in Figure \\ref{fig:blueshift_mbh_lbol} show a moderate, but significant, correlation between the C\\,\\textsc{iv}\\ blueshift and the black hole mass. There is also a similar negative correlation between the C\\,\\textsc{iv}\\ blueshift and the Eddington ratio, and no significant correlation with quasar bolometric luminosity. There are several methodical differences between the measurements in our study and those in \\citet{shin_2017_outflow}. We measure black hole virial masses based on Mg\\,\\textsc{ii}\\ instead of H$\\beta$, and calculate systemic redshifts from the Mg\\,\\textsc{ii}\\ line rather than from a combination of low-ionisation narrow lines (Si\\,\\textsc{ii}, O\\,\\textsc{ii}], O\\,\\textsc{i}], H$\\beta$). We also use different outflow indicators: our C\\,\\textsc{iv}\\ blueshift is defined in Equation \\ref{eq:blueshift}, in contrast to the ``velocity shift index'' (VSI) and ``blueshift and asymmetry index'' (BAI) defined in Equations 2 and 3 of \\citet{shin_2017_outflow}. According to our result, a correlation between the black hole mass or bolometric luminosity with the C\\,\\textsc{iv}\\ blueshift implies that the C\\,\\textsc{iv}\\ flux is anti-correlated with the C\\,\\textsc{iv}\\ blueshift by extension (see Figure \\ref{fig:CIV_blueshift_ew}). As the C\\,\\textsc{iv}\\ blueshift is found to be correlated with the metallicity-sensitive rest-frame UV line ratios and quasar properties, this has the potential to bias correlations between metallicity and black hole mass or luminosity. The relationship between the C\\,\\textsc{iv}\\ blueshift and these line ratios can be explained by increased gas opacity with metallicity, leading to larger absorption and increased acceleration \\citep[e.g.][]{Wang_2012}. However, the extreme metallicities ($\\sim 20\\, \\rm{Z}_{\\odot}$) seen in the most blueshifted high redshift ($z > 6.0$) quasars in our sample suggest that while the relationship between the C\\,\\textsc{iv}\\ blueshift and the line ratio is real, the comparison to the simple photoionisation models is no longer appropriate as emission from the BLR outflow dominates the observed spectrum. The dynamics, density, and geometry of the BLR wind is not the same as for symmetric core emission \\citep{metal_density}. An alternative explanation is that the C\\,\\textsc{iv}\\ blueshift relationship with the rest-frame UV line ratios is driven primarily by the weakening of the symmetric C\\,\\textsc{iv}\\ core emission and enhanced emission toward the line-of-sight from quasar orientation \\citep[e.g.][]{Yong_2020}. Further studies on quasar properties and their emission-line flux ratios will need to account for indications of quasar outflows or avoid using emission lines that are strongly affected by BLR outflow.\n\nIt has also been suggested that the observed diversity of line ratios (\\nv\/\\civ\\ and (\\siiv+\\oiv)\/\\civ\\ among others) can be attributed to the variation of density of the emitting gas and the incident ionizing flux instead of metallicity. \\citet{metal_density} proposes a model with two kinematically distinct regions, the core and the wind, that can reproduce the range of observed broad emission-line flux ratios under solar metallicities, as long as the spatial density distribution of the emitting gas clouds is adjusted accordingly. Such multiple zone photoionisation models have been used to great effect in reproducing quasar and AGN spectra \\citep[e.g.][]{Rees_1989, Peterson_1993, Baldwin_1996, Hamann_1998, Korista_2000_LOC}. The locally optimally emitting cloud (LOC) model, proposed in \\citet{Baldwin_1995_LOC}, is a natural extension of multi-zone models. The advantage of the LOC model is that the total line emission is composed of an integration over the density ($n_{\\rm{H}}$) and ionizing flux ($\\Phi_{\\rm{H}}$) parameter space assuming certain empirically motivated distribution functions \\citep{Nagao_2006}, thereby bypassing the need for specific knowledge of either $n_{\\rm{H}}$ or $\\Phi_{\\rm{H}}$. The properties of the emission lines are then dominated by the emitters that are optimally suited to emit the targeted line \\citep{Baldwin_1995_LOC}. It is well-documented that the line ratios depend sensitively on $n_{\\rm{H}}$ and $\\Phi_{\\rm{H}}$ \\citep[e.g.][]{Hamann_2002, Nagao_2006, metal_density}, but the LOC results represent the average properties of diverse quasar samples. We note that the high-density wind component ($n_{\\rm{H}} \\approx 10^{13-14}$ cm$^{-3}$, $\\Phi_{\\rm{H}} \\approx 10^{22-24}$ cm$^{-2}$ s$^{-1}$) and the range of typically assumed BLR properties ($n_{\\rm{H}} \\approx 10^{9-12}$ cm$^{-3}$, $\\Phi_{\\rm{H}} \\approx 10^{18-21}$ cm$^{-2}$ s$^{-1}$) suggested in \\citet{metal_density} are parameter ranges which are also covered by the LOC photoionisation models used in this study ($n_{\\rm{H}} \\approx 10^{7-14}$ cm$^{-3}$, $\\Phi_{\\rm{H}} \\approx 10^{17-24}$ cm$^{-2}$ s$^{-1}$) \\citep{Hamann_2002, Nagao_2006}. However, if the assumed cloud distribution functions used in photoionisation models are inaccurate, the absolute metallicity inferred from line ratios is subject to change. For example, photoionisation models using emission from clumpy disk winds can produce spectra resembling that of quasars \\citep{Dannen_2020_clumpy, Matthews_2020_clumpy}, showing that there are viable alternatives to the LOC models we have referenced for the conversions between line ratio and metallicity.\n\nThe results from \\citet{metal_density} further motivated us to use a quasar outflow indicator, the C\\,\\textsc{iv}\\ blueshift, as a control to limit the effect of the BLR wind. Even for composites of low C\\,\\textsc{iv}\\ blueshift where the assumed contribution to the overall emission from the wind is low, we observe in Figure \\ref{fig:blueshift_line_ratio_results} that the average emission-line properties are comparable to emission from gas clouds with metallicity several times solar (e.g. Z$_{-\\rm{200-680}}$ = $4.61 \\pm 0.01$ Z$_{\\odot}$ using (\\siiv+\\oiv)\/\\civ) under the LOC model.\n\nThe super-solar metallicities in the quasar BLR inferred from low C\\,\\textsc{iv}\\ blueshift composites imply rapid enrichment scenarios that are not unrealistic under normal galactic chemical evolution scenarios in the cores of massive galaxies \\citep[e.g.][]{Gnedin_1997, Dietrich_2003}. The BLR is a small nuclear region of the galaxy (<1 pc) with higher densities entailing shorter dynamical timescales \\citep[e.g.][]{Gnedin_1997, Cen_1999, Kauffman_2000, Granato_2004}. The total mass of the BLR is on the order of 10$^{4}\\, \\rm{M}_{\\odot}$ \\citep{Baldwin_2003}, and it can be enriched rapidly to super-solar metallicities within 10$^{8}$ yrs by a single supernova explosion every 10$^{4}$ yrs \\citep{metallicity_distant}. Under some multi-zone chemical evolution models, massive star formation in the galactic central regions and subsequent metal enrichment via supernovae can predict super-solar metallicities (up to 10 Z$_{\\odot}$) within 0.5 - 0.8 Gyrs \\citep[e.g.][]{hamann_1993, Friaca_1998, romano_2002}. This rapid enrichment scenario means that the properties of the BLRs do not necessarily trace the chemical properties of their host galaxies \\citep[e.g.][]{Suganuma_2006, Matsuoka_2018}. This is supported by studies presenting estimates of metallicity in the quasar narrow-line region (NLR) which represent a region over 1000 pc in size \\citep[e.g.][]{Bennert_2006_NLRsize}. The metallicity in the NLR was found to be 2-3 times lower than the BLR, following similar MZR trends as star-forming galaxies \\citep[e.g.][]{Dors_2019}. However, in addition to high-metallicity BLRs, there is now mounting evidence that entire host galaxies can be highly enriched to solar values in early cosmic time as evidenced by measurements of C, N, and O ions \\citep[e.g.][]{Walter_2003, Venemans_2017, Novak_2019, Pensabene_2021}.\n\n\nMore exotic enrichment scenarios such as enhanced supernova rates in central star clusters \\citep[e.g.][]{artymowicz_1993, Shields_1996}, star formation inside quasar accretion disks \\citep[e.g.][]{Collin_1999, Goodman_2004, Toyouchi_2021}, or nucleosynthesis without stars \\citep[e.g.][]{Chakrabarti_1999, Hu_2008, Datta_2019} are also capable of producing highly enriched BLRs in a short time. However, we do not consider these to be strictly necessary to explain the metallicities in the $z\\sim6$ redshift quasars inferred from observations in this study. Pushing metallicity estimates to even higher redshifts $z>8$ when the universe is only 0.6 Gyr old would place more stringent constraints on the metal enrichment timescales from the era of re-ionisation of the universe, where such rapid enrichment scenarios could be required to produce super-solar metallicities \\citep[e.g.][]{Friaca_1998}.\n\n\n\\section{Conclusions} \\label{sec:conclusion}\nIn this study, we examined a sample of 25 high-redshift (z > 5.8) quasars, 15 of which were observed with X-shooter during the XQR-30 programme and 10 of which were observed with Gemini North's GNIRS sourced from \\citet{Shen_2019} and \\citet{yang2021probing}. The sample from XQR-30 contains the highest-quality spectra covering the rest-frame UV emission lines observed in quasars in this redshift range. The bolometric luminosity of the quasars in this sample covers $\\log\\left(\\rm{L}_{\\rm{bol}}\/\\rm{erg \\, s}^{-1}\\right) = 46.7-47.7$ assuming a bolometric correction factor of 5.15 from the continuum luminosity at 3000\\AA. The black hole mass range in the sample is $(0.2 - 6.0) \\times 10^9\\, \\rm{M}_{\\odot}$, measured with single-epoch virial mass estimates utilizing the FWHM of the Mg\\,\\textsc{ii}\\ emission line. We measured the blueshift of the C\\,\\textsc{iv}\\ line in most of the quasars in this sample and created composites by quasar luminosity, black hole mass, and C\\,\\textsc{iv}\\ blueshift. We then measured broad rest-frame UV emission-line flux ratios in individual quasar spectra and all composites. The main results are as follows:\n\\begin{itemize}\n \\item Due to the relationship between the C\\,\\textsc{iv}\\ blueshift and its equivalent width, the metallicity-sensitive broad emission-line ratios correlate with the C\\,\\textsc{iv}\\ blueshift, which is an indicator of the projected BLR outflow velocity. If not accounted for, this correlation biases studies of quasar metallicity and its relationship with black hole mass and luminosity. The correlation between the metallicity-sensitive emission line flux ratios and the C\\,\\textsc{iv}\\ blueshift is stronger and more significant than for the quasar bolometric luminosity or black hole mass. \n \\item Comparing against \\texttt{Cloudy}-based photoionisation models, the metallicity inferred from line ratios of the high-redshift ($z\\sim6$) quasars in this study is several (at least 2-4) times super-solar, consistent with studies of much larger samples at lower redshifts and similar studies at comparable redshifts. We also find no strong evidence of redshift evolution in the BLR metallicity, indicating that the BLR is already highly enriched at $z\\sim6$. The metallicity-sensitive emission-line flux ratios are sensitive to the density $n_{\\rm{H}}$ of gas clouds and the incident ionizing flux $\\Phi_{\\rm{H}}$, but we use locally optimally-emitting cloud photoionisation models to draw conclusions based on the average properties of diverse samples of quasars. Our low C\\,\\textsc{iv}\\ blueshift composites are good probes of metallicity at this redshift as they minimise the effects of the BLR wind.\n \\item The lack of redshift evolution in the BLR metallicity is contrary to studies of metallicity in star-forming and Lyman-break galaxies, which show a significant redshift dependence. Furthermore, estimates of host galaxy properties based on black hole mass suggest metallicities that are approximately solar. We find that selection effects are not sufficient to explain the apparent lack of redshift evolution and the discrepancy between the BLR metallicity and host galaxy metallicity. However, given the small scale of the BLR, rapid enrichment scenarios make it a poor tracer of host galaxy metallicity.\n \\item The super-solar metallicity inferred for BLRs at $z\\sim6$ provides stringent constraints on the timescales of star formation and metal enrichment in the vicinity of some of the earliest supermassive black holes. Rapid metal enrichment scenarios of the BLR are not unrealistic under normal galactic chemical evolution models and more exotic explanations, such as nucleosynthesis or star formation inside the accretion disk, are not strictly necessary. \n\\end{itemize}\n\nIntrinsic absorption lines could, in principle, provide more straightforward estimates of the BLR metallicity \\citep[e.g.][]{Hamann_1999, dodorico_2004_absorption, Maiolino_2019_metallica}. In the past, such studies were not possible due to low SNR of quasar spectra at $z \\sim 6$, but the high-quality data of XQR-30 enables this type of investigation, which will be explored in a future study. More precise metallicity diagnostics would solidify and refine these results, especially for individual quasars. \n\n\n\\section*{Acknowledgements}\n\nWe thank Matthew Temple for the helpful discussion {and the reviewer, Yoshiki Matsuoka, for the thoughtful comments and suggestions which have improved this work.}\n\nThe results of this research is based on observations collected at the European Organisation for Astronomical Research in the Southern Hemisphere under ESO programme 1103.A-0817. \n\nThis work is also based, in part, on observations obtained at the international Gemini Observatory, a program of NSF's NOIRLab, which is managed by the Association of Universities for Research in Astronomy (AURA) under a cooperative agreement with the National Science Foundation on behalf of the Gemini Observatory partnership: the National Science Foundation (United States), National Research Council (Canada), Agencia Nacional de Investigaci\\'{o}n y Desarrollo (Chile), Ministerio de Ciencia, Tecnolog\\'{i}a e Innovaci\\'{o}n (Argentina), Minist\\'{e}rio da Ciencia, Tecnologia, Inova\\c{c}\\~{o}es e Comunica\\c{c}\\~{o}es (Brazil), and Korea Astronomy and Space Science Institute (Republic of Korea).\n\nS.L. is grateful to the Australian National University Research School of Astronomy \\& Astrophysics (ANU\/RSAA) for funding his Ph.D. studentship and the European Southern Observatory for the research internship.\n\nCAO was supported by the Australian Research Council (ARC) through Discovery Project DP190100252.\n\nM.B. acknowledges support from PRIN MIUR project ``Black Hole winds and the Baryon Life Cycle of Galaxies: the stone-guest at the galaxy evolution supper'', contract \\#2017PH3WAT. \n\nACE acknowledges support by NASA through the NASA Hubble Fellowship grant $\\#$HF2-51434 awarded by the Space Telescope Science Institute, which is operated by the Association of Universities for Research in Astronomy, Inc., for NASA, under contract NAS5-26555. \n\nSEIB acknowledges funding from the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme (grant\nagreement No. 740246 \"Cosmic Gas\").\n\nJTS acknowledges funding from the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme (grant agreement No. 885301 ``Quasar Chronicles'').\n\n\n\\section*{Data Availability}\nThe data underlying this article will be shared on reasonable request to the corresponding author. \n\n\n\n\n\n\n\\bibliographystyle{mnras}\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}} +{"text":"\\section{Introduction}\n\nThe study of quantum many-body systems is one of the most active fields of modern condensed-matter physics. Among the most celebrated effects, we can mention frictionless flows in superfluid and superconducting systems and the geometrical quantization features of the fractional quantum Hall effect. While this physics was traditionally studied in liquid Helium samples~\\cite{pinesnozieres,leggett2004}, in atomic nuclei~\\cite{ringschuck}, in quark-gluon plasmas~\\cite{yagi,sinha}, or in electron gases confined in solid-state devices~\\cite{Schrieffer1964,Mahan1990,Tinkham2004,Yoshioka2002}, {the last two decades have witnessed impressive advances} using ultra-cold atomic gases trapped in magnetic or optical traps~\\cite{Dalfovo1999,Bloch2008,Giorgini2008}. \n\nIn the last few years, a growing community has started investigating many-body effects in the novel context of the so-called quantum fluids of light~\\cite{RMP}, i.e. assemblies of many photons confined in suitable optical devices, where effective photon-photon interactions arise from the optical nonlinearity of the medium. After the pioneering studies of Bose-Einstein condensation~\\cite{BEC} and superfluidity~\\cite{superfluidity} effects in dilute photon gases in weakly nonlinear media, a great interest is presently being devoted to strongly nonlinear systems, where even single photons are able to appreciably affect the optical properties of the system. \n\nThe most celebrated example of such physics is the photon blockade effect~\\cite{imamoglu}, where the presence of a single photon in a cavity is able to {detune the cavity} frequency away from the pump laser, so that photons behave as effectively impenetrable particles. Experimental realizations of this idea have been reported by several groups using very different material platforms, from single atoms in macroscopic cavities~\\cite{birnbaum}, to single quantum dots in photonic crystal cavities~\\cite{vuckovic,Reinhard}, to single Josephson qubits in circuit QED devices for microwaves~\\cite{CiQED-blockade,CiQED_rev}.\n\nScaling up to arrays of many cavities coupled by photon tunneling is presently a hot challenge in experimental physics{, as it would realize a Bose-Hubbard model for photons where the photon blockade effect may lead to a rich} physics, including the superfluid to Mott-insulator phase transition at a commensurate filling or Tonks-Girardeau gases of impenetrable photons in one-dimensional continuum models. The first works on strongly correlated photons were restricted to quasi-equilibrium regimes where the photon loss rate is much slower than the internal dynamics of the gas so that the system has time to thermalize and\/or be adiabatically transfered to the desired strongly correlated state~\\cite{photonMI,TGHarvard}. While this assumption might be satisfied in suitably designed circuit-QED devices in the microwave domain, radiative losses are hardly negligible in realistic optical cavities in the infrared or visible domain, {so that} thermalization is {generally} far from being granted~\\cite{RMP,CiQED_rev}.\n\nAs a result, a very active attention has been {recently} devoted to the peculiar non-equilibrium effects that arise for realistic loss rates. Starting from the pioneering work on photon blockade in non-equilibrium photonic Josephson junctions~\\cite{gerace-fazio}, the interest has {been focused} on the study of schemes to generate strongly correlated many-body states {in the very non-equilibrium context of photon systems, where the steady-state is not determined by a thermal equilibrium condition, but by a dynamical balance of driving and losses.}\n\nThe first such scheme proposed in~\\cite{TGnoi} was based on a coherent pumping: provided the different many-body states are sufficiently separated in energy, many-photon processes driven by the coherent external laser are able to selectively address each many-body state as done in optical spectroscopy of atomic levels. In this way, the non-equilibrium condition is no longer just a hindrance, but offers new perspectives, as it allows to individually probe each excited state. Furthermore, the appreciable radiative losses make microscopic information on the many-body wavefunction be directly encoded in the quantum coherence of the secondary emission from the device~\\cite{FQH,UWC,Braid}. While this coherent pumping scheme offers a viable way to generate and control few photon states in small arrays, its efficiency is restricted to mesoscopic systems where the different states are well-separated in energy. Moreover, this scheme intrinsically leads to coherent superpositions of states of different photon number: while this feature is intriguing in view of observing many-body braiding phases~\\cite{Braid}, it is not ideally suited to generate states with a well-defined photon number such as Mott-insulator states.\n\nThe identification of new schemes that do not suffer from these limitations is therefore of great importance in view of experiments. In the present work we study the potential of frequency-dependent gain processes to selectively generate strongly correlated states of photons in arrays of strongly nonlinear cavities. The frequency-dependence of amplification is a well-known fact of laser physics and is often exploited to choose and stabilize a desired lasing mode~\\cite{laser}. In the last years, a series of works by our groups~\\cite{PRL10,Chiocchetta13} have explored its effect on exciton-polariton Bose-Einstein condensation experiments, in particular questioning the apparent thermalization of the non-condensed fraction~\\cite{Chiocchetta14,Bajoni,Weitz,Kirton14,alessio2}. All these works were however restricted to the weakly interacting regime where quantum fluctuations can be treated in the input-output language by means of a Bogoliubov-like linearized theory around the mean-field. Here we tackle the far more difficult case of strong nonlinearities, which requires including the non-Markovian features due to the frequency-dependent gain into the many-body master equation for the strongly interacting photons and then to solve the quantum many-body theory of the generalized driven-dissipative Bose-Hubbard model. \n\nIn the last years, similar questions have been theoretically addressed by several groups. Just to mention a few of them, a scheme to obtain a thermal state at finite temperature with a non-vanishing effective chemical potential for photons has been proposed in~\\cite{Adhikari} using a clever parametric system-bath coupling with as special eye to circuit-QED and opto-mechanical systems. A further development in this direction~\\cite{Kapit} has considered pumping by two-photon processes in the presence of an auxiliary shadow lattice in a circuit-QED architecture: in spite of the complexity of the proposed set-up, the mechanism underlying the stabilization of many-body states is very similar to our frequency-dependent gain. With respect to these proposals and to the engineered dissipations originally proposed for atoms~\\cite{diehl} and then extended to photons~\\cite{hafezi,domokos} to organic polaritons \\cite{Lambrecht,keeling2}, and circuit QED systems \\cite{aron,gourgy,tureci}, our approach has the crucial advantage of being based on a quite commonly observed feature of laser and photonic systems such as a frequency-dependent gain.\nFinally, a pioneering discussion of the onset of collective coherence in a related model of a cavity array embedding population-inverted atoms has recently appeared in~\\cite{Ruiz}, but little attention was paid to the effect of strong nonlinearities nor to the development of a tractable quantum formalism.\n\nThe aim of this article is to introduce the readers to the basic physics of a frequency-dependent incoherent pumping and to first illustrate the consequences of the resulting non-Markovianity in the simplest configurations before attacking more complex many-body effects. With this idea in mind, the structure of the article is the following. In Sec.\\ref{sec:Presentation-of-the} we present the physical system and we develop the theoretical model based on a master equation for the cavities coupled to the atoms of the gain medium. The projective method to eliminate the atomic degrees of freedom and write a master equation for the photonic density matrix is sketched in Sec.\\ref{sec:Closed-master-equation} along the lines of the general theory of~\\cite{Breuer}. First application of the method to a single cavity configuration is discussed in Sec.\\ref{sec:onecavity} and specific features of the weak and the strong nonlinearity cases are illustrated, e.g. a novel mechanism for optical bistability and the selective generation of Fock states with a well defined photon number. The richer physics of many cavity arrays is discussed in Sec.\\ref{sec:Arrays-of-cavities}: In a Markovian regime, the photonic steady state has the surprisingly trivial form of a Grand-Canonical distribution of infinite temperature, and therefore is fully independent of the many-body photonic Hamiltonian. In a weakly non-Markovian regime, an effective Grand-Canonical distribution of finite temperature is obtained even in the absence of thermalization mechanisms; in a strongly nonlinear and non-Markovian regime, signatures of a Mott insulator state with one photon per cavity are illustrated. Conclusions are finally drawn in Sec.\\ref{sec:Conclu}. In the Appendices, we provide the details of the derivation of the photonic master equation using projective methods, on the exact stationary state in the Markovian case, on a perturbative expansion of the coherences in the weakly non-Markovian limit, and on further numerical validation of the purely photonic master equation.\n\n\n\n\\section{The physical system and the theoretical model}\\label{sec:Presentation-of-the}\n\n\\subsection{The physical system}\n\nIn this work, we consider a driven-dissipative Bose-Hubbard model for photons in an array of $k$ coupled nonlinear cavities of natural frequency $\\omega_{cav}$. In units such that $\\hbar=1$, the Hamiltonian for the isolated system dynamics has the usual form~\\cite{RMP,CiQED_rev,Hartmann_rev}:\n\\begin{equation}\nH_{ph}=\\sum_{i=1}^{k}\\left[\\omega_{cav}a_{i}^{\\dagger}a_{i}+\\frac{U}{2}a_{i}^{\\dagger}a_{i}^{\\dagger}a_{i}a_{i}\\right]{-}\\sum_{\\avg{i,j}}\\left[ Ja_{i}^{\\dagger}a_{j}+hc\\right].\n\\end{equation}\nThey are arranged in a one-dimensional geometry {and} are coupled via tunneling processes with amplitude $J$. Each cavity is assumed to contain a Kerr nonlinear medium, which induces effective repulsive interactions between photons in the same cavity with an interaction constant $U$ proportional to the Kerr nonlinearity $\\chi^{(3)}$.\nDissipative phenomena due the finite transparency of the mirrors and absorption {by the cavity material} are responsible for a finite lifetime of photons, which naturally decay at a rate $\\Gamma_{loss}$. \n\nAs mentioned in the introduction, the key novelty of this work with respect to earlier work consists in the different mechanism that is proposed to compensate for losses and replenish the photon population. Instead of a coherent pumping or a very broad-band {amplifying} laser medium, we consider a configuration where a set of $N_{at}$ two level atoms is present in each cavity. Each atom is strongly pumped at a rate $\\Gamma_{pump}$, spontaneously decays to its ground state at a rate $\\gamma$ and, most importantly, is coupled to the cavity with a Rabi frequency $\\Omega_{R}$: as a result, the atoms provide an incoherent pumping of the cavities, with a frequency-dependent rate centered at the atomic frequency $\\omega_{at}$. Our choice of two different physical mechanisms for nonlinearity and pumping (for example, two different atomic species) allows us to to tune independently photonic interactions and emission.\n\n\nThe free evolution of the atoms and their coupling to the cavities are described by the following Hamiltonian terms,\n\\begin{eqnarray}\nH_{at}&=&\\sum_{i=1}^{k}\\sum_{l=1}^{N_{at}}\\omega_{at}\\sigma_{i}^{+(l)}\\sigma_{i}^{-(l)} \\\\ \nH_{I}&=&\\Omega_{R}\\sum_{i=1}^{k}\\sum_{l=1}^{N_{at}}\\left[a_{i}^{\\dagger}\\sigma_{i}^{-(l)}+a_{i}\\sigma_{i}^{+(l)}\\right]:\n\\end{eqnarray}\nthe atomic frequency $\\omega_{at}$ is assumed to be in the vicinity (but not necessarily resonant) with the cavity mode and the atom-cavity coupling is assumed to be weak enough $\\Omega_R\\ll \\omega_{at},\\omega_{cav}$ to be far from the ultra-strong coupling regime~\\cite{bastard} and from any superradiant Dicke transition~\\cite{dicke}.\n\nAs usual, the dissipative dynamics under the effect of the pumping and decay processes can be described in terms of a master equation for the density matrix $\\rho$ of the whole atom-cavity system, \n\\begin{equation}\n\\partial_{t}\\rho=\\frac{1}{i}\\com{H_{ph}+H_{at}+H_{I}}{\\rho}+\\mathcal{L}(\\rho),\\label{eq:evinitio}\n\\end{equation}\nwhere the different dissipative processes are summarized in the Lindblad super-operator $\\mathcal{L}=\\mathcal{L}_{pump}+\\mathcal{L}_{loss,\\, at}+\\mathcal{L}_{loss,\\, cav}$, with \n\\begin{eqnarray}\n\\mathcal{L}_{pump} &=& \\frac{\\Gamma_{pump}}{2}\\sum_{i=1}^{k}\\sum_{l=1}^{N_{at}}\\left[2\\sigma_{i}^{+(l)}\\rho\\sigma_{i}^{-(l)}-\\sigma_{i}^{-(l)}\\sigma_{i}^{+(l)}\\rho-\\rho\\sigma_{i}^{-(l)}\\sigma_{i}^{+(l)}\\right], \\\\\n\\mathcal{L}_{loss,\\, at} & = & \\frac{\\gamma}{2}\\sum_{i=1}^{k}\\sum_{l=1}^{N_{at}}\\left[2\\sigma_{i}^{-(l)}\\rho\\sigma_{i}^{+(l)}- \\sigma_{i}^{+(l)}\\sigma_{i}^{-(l)}\\rho-\\rho\\sigma_{i}^{+(l)}\\sigma_{i}^{-(l)}\\right], \\\\ \n\\mathcal{L}_{loss,\\, cav}&=&\\frac{\\Gamma_{loss}}{2}\\sum_{i=1}^{k}\\left[2a_{i}\\rho a_{i}^{\\dagger}-a_{i}^{\\dagger}a_{i}\\rho-\\rho a_{i}^{\\dagger}a_{i}\\right]\n\\end{eqnarray}\ndescribing the pumping of the atoms, the spontaneous decay of the atoms, and the photon losses, respectively. The $\\sigma_{i}^{\\pm(l)}$ operators are the usual raising and lowering operators for the $l$-th atom in the $i$-th cavity. We introduce the detuning $\\delta=\\omega_{cav}-\\omega_{at}$ of the bare cavity frequency with respect to the atomic frequency. In the following, we shall concentrate on a regime in which pumping of the atoms is much faster than their spontaneous decay, $\\Gamma_{pump}\\gg \\gamma$, so the $\\mathcal{L}_{loss,\\, at}$ Lindblad term can be safely neglected. \n\nFor simplicity, we will also restrict our attention to the $\\Gamma_{pump}\\gg\\sqrt{N_{at}}\\Omega_{R}$ regime, where the atoms are immediately repumped to their excited state after emitting a photon into the cavity: under such an assumption, an atom having decayed to the ground state does not have the time to reabsorb any photon before being repumped to its excited state. In this regime, complex cavity-QED effects such as Rabi oscillations do not take place and the photon emission takes place in an effectively irreversible way~\\cite{Breuer,QuantumNoise}: as a result, we are allowed to eliminate the atomic dynamics from the problem and write a much simpler photonic master equation involving only the {cavity degrees of freedom}. \n\n\n\n\\subsection{Closed master equation for the {photonic} density matrix}\\label{sec:Closed-master-equation}\n\nUnder the considered $\\Gamma_{pump}\\gg\\Omega_R$ approximation, the atomic population is concentrated in the excited state and it is possible to use projective methods to write a closed master equation for the photonic density matrix where the atomic degrees of freedom $\\mathcal{B}$ have been traced out, $\\rho_{ph}=Tr_{\\mathcal{B}}\\rho$. All details of the (quite cumbersome) calculations can be found in \\ref{app:projective}. The resulting photonic master equation reads \n\\begin{equation}\n\\partial_{t}\\rho_{ph} = -i\\left[H_{ph},\\rho_{ph}(t)\\right]+\\mathcal{L}_{loss} + \\mathcal{L}_{em},\n\\label{eq:photon_only}\n\\end{equation}\nwith \n\\begin{eqnarray}\n\\mathcal{L}_{loss} & = & \\frac{\\Gamma_{loss}}{2}\\sum_{i=1}^{k}\\left[2a_{i}\\rho a_{i}^{\\dagger}-a_{i}^{\\dagger}a_{i}\\rho-\\rho a_{i}^{\\dagger}a_{i}\\right],\\label{eq:loss}\\\\\n\\mathcal{L}_{em} & = & \\frac{\\Gamma_{em}}{2}\\sum_{i=1}^{k}\\left[\\tilde{a}_{i}^{\\dagger}\\rho a_{i}+a_{i}^{\\dagger}\\rho\\tilde{a}_{i}-a_{i}\\tilde{a}_{i}^{\\dagger}\\rho-\\rho\\tilde{a}_{i}a_{i}^{\\dagger}\\right]. \\label{eq:gainmarkov}\n\\end{eqnarray}\ndescribing photonic losses and emission processes, respectively.\nWhile the loss term has a standard Lindblad form at rate $\\Gamma_{loss}$, the emission term keeps some memory of the atomic dynamics as it involves modified lowering and raising operators \n\\begin{eqnarray}\n\\tilde{a}_{i}&=&\\frac{\\Gamma_{pump}}{2}\\int_{0}^{\\infty}d\\tau\\, e^{(-i\\omega_{at}-\\Gamma_{pump}\/2)\\tau}a_{i}(-\\tau) ,\n\\label{eq:atilde} \\\\\n\\tilde{a}_{i}^{\\dagger}&=&\\left[\\tilde{a}_{i}\\right]^{\\dagger} \\label{eq:adagtilde}\n\\end{eqnarray}\nwhich contain the photonic (hamiltonian and dissipative) dynamics during pumping. In the limit we are considering in which photonic losses are slow with respect to atomic pump, these operators are the interaction picture ones with respect to the photonic hamiltonian in the cavity array and have a simpler expression~:\n\\begin{equation}\na_{i}(\\tau)=e^{iH_{ph}\\tau}\\,a_{i}\\,e^{-iH_{ph}\\tau}.\n\\end{equation}\nThe Fourier-like integral in Eqs.\\ref{eq:atilde} and \\ref{eq:adagtilde} is responsible for the frequency selectivity of the emission, as the integral is maximum when the free evolution of $a_i$ occurs at a frequency close to the atomic one $\\omega_{at}$. \n\nA deeper physical insight on the operators (\\ref{eq:atilde}) and (\\ref{eq:adagtilde}) can be obtained by looking at their matrix elements in the basis of eigenstates of the photonic hamiltonian. We consider two eigenstates $\\ket f$ (resp. $\\ket{f'}$) with $N$ (resp. $N+1)$ photons and energy $\\omega_{f}$ (resp. $\\omega_{f'}$). After elementary manipulation, we see that the emission amplitude follows a Lorentzian law as a function of the detuning between the frequency difference of the two photonic states $\\omega_{f'f}=\\omega_{f'}-\\omega_{f}$ and the atomic transition frequency $\\omega_{at}$,\n\\begin{equation}\n\\bra{f'}\\tilde{a}_{i}^{\\dagger}\\ket f = \\frac{\\Gamma_{pump}\/2}{-i(\\omega_{at}-\\omega_{f'f})+\\Gamma_{pump}\/2}\\bra{f'}a_{i}^{\\dagger}\\ket f~. \\label{eq:crea}\n\\end{equation}\nUpon insertion of Eq.\\ref{eq:crea} into the master equation Eq.\\ref{eq:photon_only}, one can associate the real part of the Lorentzian factor to an effective emission rate\n\\begin{equation}\n\\Gamma_{em}(\\omega_{f'f})=\\Gamma^0_{em} \\frac{\\Gamma^2_{pump}\/4}{(\\omega_{at}-\\omega_{f'f})^2+\\Gamma_{pump}^2\/4},\n\\end{equation}\nwhile the imaginary part can be related to a frequency shift of the photonic states under the effect of the population-inverted atoms. In the next section, this point will be made more precise under a secular approximation.\n\nThe width of the Lorentzian is set by the pumping rate $\\Gamma_{pump}$, that is by the autocorrelation time $\\tau_{pump}=1\/\\Gamma_{pump}$ of the atom seen as a frequency-dependent emission bath. The peak emission rate exactly on resonance is equal to\n\\begin{equation}\n\\Gamma^0_{em}=\\frac{4N_{at}\\Omega_{R}^{2}}{\\Gamma_{pump}}\\,.\n\\end{equation}\nWhile the $\\Gamma_{pump}\\gg\\sqrt{N_{at}}\\Omega_R$ assumption automatically implies that the emission is much slower than the atomic repumping rate, $\\Gamma_{em}\\ll\\Gamma_{pump}$, no constraint need being imposed on the parameters $J$, $U$ and $\\delta=\\omega_{cav}-\\omega_{at}$ of the photonic Hamiltonian, which can be arbitrarily large. Whereas an extension of our study to the $\\Gamma_{loss}\\gtrsim \\Gamma_{pump}$ regime would only introduce technical complications, entering the $\\Gamma_{em}\\gtrsim \\Gamma_{pump}$ regime is expected to dramatically modify the physics, as a single atom could exchange photons with the cavity at such a fast rate that it has not time to be repumped to the excited state in between two emission events. As a result, reabsorption processes and Rabi oscillations are possible, which considerably complicate the theoretical description. {These issues will be the subject of future investigations.}\n\n\\subsection{Reformulation in Lindblad form in the secular approximation\\label{sec:photonic-lindblad-form}}\nIn the case the system has a discrete spectrum, it is possible in the so-called secular approximation to write another photonic master implementing non-markovian effects with a more standard Lindblad form, compatible with Monte Carlo wave-function simulations \\cite{Castin} and giving equivalent driven-dissipative dynamics. This can be explained by the following argument: in a weak dissipation limit ($\\Gamma_{em},\\,\\Gamma_{loss}$ very small with respect to the gaps in the spectrum) terms of the density matrix $\\rho_{f,\\tilde{f}},\\, \\rho_{f',\\tilde{f}'}$ which would be rotating at different frequencies $\\omega_{f,\\tilde{f}},\\, \\omega_{f',\\tilde{f}'}$ if the system were isolated, are not coupled to each other by dissipation since the coupling $\\Gamma^{0}_{em},\\, \\Gamma_{loss}$ is negligible with respect to their frequency difference $\\Delta\\omega=\\omega_{f',\\tilde{f}'}-\\omega_{f,\\tilde{f}}=\\omega_{f',f}-\\omega_{\\tilde{f}',\\tilde{f}}$. Considering this, all relevant dissipative transitions verify then $\\Delta\\omega\\simeq 0$. Restricting the previous master equation given by Eqs.~\\ref{eq:photon_only},\\ref{eq:gainmarkov} and \\ref{eq:crea} to these transitions, it is possible to rewrite the dynamics in the following way (details of the derivation are given in \\ref{app:Lindblad-form}): \n\\begin{equation}\n\\partial_{t}\\rho_{ph} = -i\\left[H_{ph}+\\left(\\sum_{i} H_{lamb,i}\\right),\\rho_{ph}(t)\\right]+\\mathcal{L}_{loss} + \\bar{\\mathcal{L}}_{em},\n\\label{eq:photon_only_MCWF}\n\\end{equation}\nwith \n\\begin{equation}\n\\label{eq:gainmarkov_MCWF}\n\\bar{\\mathcal{L}}_{em}(\\rho_{ph})= \\frac{\\Gamma_{em}}{2}\\sum_{i=1}^{k}\\left[2\\bar{a}_{i}^{\\dagger}\\rho_{ph} \\bar{a}_{i}-\\bar{a}_{i}\\bar{a}_{i}^{\\dagger}\\rho_{ph}-\\rho_{ph}\\bar{a}_{i}\\bar{a}_{i}^{\\dagger}\\right],\n\\end{equation}\n\\begin{equation}\n\\label{eq:crea_MCWF}\n \\bra{f'}\\bar{a}_{i}^{\\dagger}\\ket{f}=\\frac{\\Gamma_{pump}\/2}{\\sqrt{(\\omega_{at}-\\omega_{f',f})^2+\\left(\\Gamma_{pump}\/2\\right)^2}}\\bra{f'}a_{i}^\\dagger\\ket{f},\n\\end{equation}\n\\begin{equation}\n\\label{eq:lamb_MCWF}\n \\bra{f'}H_{lamb,i}\\ket{f}=\\sum_{f''} \\bra{f'}a_{i}\\ket{f''}\\left(\\frac{(\\omega_{f'',f}-\\omega_{at})\\Gamma_{pump}\/2}{(\\omega_{at}-\\omega_{f'',f})^2+(\\Gamma_{pump}\/2)^2}\\right)\\bra{f''}a_{i}^\\dagger\\ket{f}.\n\\end{equation}\nNote that the jump operators $\\bar{a}_i^\\dagger$ have the same form as the ones considered in~\\cite{Kapit} and have for effect to modify the the transition rate, while the \"imaginary part\" of Eq.~\\ref{eq:crea} induces an additional Hamiltonian contribution in the form of a Lamb shift. Notice that the two master equations Eqs.~\\ref{eq:photon_only},~\\ref{eq:photon_only_MCWF} are slightly different. However, under the considered approximation they are expected to provide equivalent dynamics. The latter form has the advantage of being of Lindblad form, and thus is directly compatible with MCWF simulations \\cite{Castin} and can be useful from a numerical point of view.\n\nThe secular approximation can be very restrictive (particularly in the thermodynamic limit where the spectrum is continuous). However, our feeling is that the reformulation of Eq.\\ref{eq:photon_only_MCWF} should be accurate in a wider range of parameters. Quantitatively, we anticipate the condition $\\Gamma_{em},\\, \\Gamma_{loss}\\ll\\Gamma_{pump}$ to be sufficient. More investigations in this direction are under way.\n\\section{One cavity}\n\\label{sec:onecavity}\n\nAs a first example of application, we consider the simplest case of a single nonlinear cavity. A special attention will be paid to the stationary state $\\rho_{ss}$ of the system for which Eq.\\ref{eq:photon_only} imposes \n\\begin{equation}\n0=-i\\left[H_{ph},\\rho_{ss}\\right]+\\mathcal{L}_{loss}\\left(\\rho_{ss}\\right)+\\mathcal{L}_{em}\\left(\\rho_{ss}\\right).\n\\end{equation}\nIn our specific case of a single cavity, the photonic states are labelled by the photon number $N$ and have an energy \n\\begin{equation}\n\\omega_{N}=N\\omega_{cav}+\\frac{1}{2}N(N-1)U.\n \\end{equation}\nCorrespondingly, the $N\\rightarrow N+1$ transition has a frequency\n\\begin{equation}\n\\omega_{N+1,N}=\\omega_{cav}+NU,\n\\end{equation}\nand the corresponding photon emission rate is\n\\begin{equation}\n\\Gamma_{em}(\\omega_{N+1,N})=\\Gamma_{em}^0\\frac{(\\Gamma_{pump}\/2)^{2}}{(\\omega_{N+1,N}-\\omega_{at})^{2}+(\\Gamma_{pump}\/2)^{2}}.\n\\end{equation}\nAs no coherence can exist between states with different photon number $N$, the stationary density matrix is diagonal in the Fock basis, $\\rho_{ss}=\\delta_{N,N'}\\pi_N$ with the populations $\\pi_N$ satisfying \n\\begin{equation}\n(N+1)\\Gamma_{loss}\\pi_{N+1}-(N+1)\\Gamma_{em}(\\omega_{N+1,N})\\pi_{N}+N\\Gamma_{em}(\\omega_{N,N-1})\\pi_{N-1}-N\\Gamma_{loss}\\pi_{N}=0,\n\\end{equation}\nwhere the two last terms of course vanish for $N=0$. \nAs only states with neighboring $N$ are connected by the emission\/loss processes, detailed balance is automatically enforced in the stationary state, which imposes the simple condition on the populations,\n\\begin{equation}\n(N+1)\\Gamma_{loss}\\pi_{N+1}-(N+1)\\Gamma_{em}(\\omega_{N+1,N})\\pi_{N}=0\n\\end{equation}\nwhich is straightforwardly solved in terms of a product,\n\\begin{equation}\n\\pi_{N} = {\\pi_{0}}\\,\\prod_{M=0}^{N-1}\\frac{\\Gamma_{em}(\\omega_{M+1,M})}{\\Gamma_{loss}}= \\left(\\frac{\\Gamma_{em}^0}{\\Gamma_{loss}}\\right)^{N}\\prod_{M=0}^{N-1}\\frac{(\\Gamma_{pump}\/2)^{2}}{(\\omega_{M+1,M}-\\omega_{at})^{2}+(\\Gamma_{pump}\/2)^{2}}\\pi_{0}.\n\\end{equation}\nThe excellent agreement of this result with a numerical solution of the full atom-cavity system is illustrated in \\ref{app:valid}.\n\n\n\n\n\n\n\\subsection{Linear regime}\n\n\\begin{figure*}[htbp]\n\\begin{center}\n \\includegraphics[height=0.40\\textwidth,clip]{lasing_condition}\\hspace{1cm}\n\\includegraphics[height=0.40\\textwidth,clip]{nonlin_o_2_inf_o}\\\\ \\vspace*{1.5cm}\n\\includegraphics[height=0.40\\textwidth,clip]{nonlin_o_1_inf_o_inf_o_2} \\hspace{1cm}\n\\includegraphics[height=0.40\\textwidth,clip]{nonlin_o_inf_o_1}\\\\ \\vspace*{1.cm}\n\\end{center}\n\\caption{(a) Emission vs. loss rate as a function of the detuning from the atomic frequency $\\omega_{at}$: the three curves are for peak emission $\\Gamma_{em}^0$ larger ({red dash-}dotted), equal ({black} dashed), smaller ({green} solid) than the loss rate $\\Gamma_{loss}$.\n(b-d) Populations $\\pi_N$ of the $N$-photon state as a function of $N$ in the three cases $\\omega_{2}\\leq\\omega_{cav}$ (b), $\\omega_{1}\\leq\\omega_{cav}\\leq\\omega_{2}$ (c), $\\omega_{cav}\\leq\\omega_{1}$ (d). In the three panels, the open dots are the numerical results of the atom-cavity theory, while the {solid} line is the prediction of the analytical purely photonic theory; the {dashed} curves show the ratio $\\Gamma_{em}(\\omega_{N+1,N})\/\\Gamma_{loss}$ as a function of $N$.\nParameters: $\\delta\/U=4$ (b), $-2$ (c), $-6$ (d). In all panels, $2U\/\\Gamma_{pump}=0.2$, \n $2\\Gamma_{loss}\/\\Gamma_{pump}=0.0006$, \n $2\\Omega_{R}\/\\Gamma_{pump}=0.02$. \n \\label{fig:Gain-and-populations}}\n\\end{figure*}\n\nFor a vanishing nonlinearity $U=0$, all transition frequencies $\\omega_{N+1,N}$ are equal to the bare cavity frequency $\\omega_0$ and the {populations} of the different $N$ states have a constant ratio\n\\begin{equation}\n\\frac{\\pi_{N+1}}{\\pi_{N}}=\\frac{\\Gamma_{em}^0}{\\Gamma_{loss}}\\frac{(\\Gamma_{pump}\/2)^{2}}{\\delta^{2}+(\\Gamma_{pump}\/2)^{2}},\n\\end{equation}\nwhere we remind that $\\delta=\\omega_{cav}-\\omega_{at}$.\nFor weak pumping\nand\/or large detuning, {one has}\n\\begin{equation}\n\\Gamma_{em}^0\\frac{(\\Gamma_{pump}\/2)^{2}}{\\delta^{2}+(\\Gamma_{pump}\/2)^{2}}<\\Gamma_{loss} ,\n\\end{equation}\n{so} the density matrix for the cavity shows a monotonically decreasing thermal occupation law. \nFor strong pumping\nand close to resonance{, one can achieve the regime where the emission overcompensates} losses and the cavity mode starts being strongly populated: \n \\begin{equation}\n\\Gamma_{em}^0\\frac{(\\Gamma_{pump}\/2)^{2}}{\\delta^{2}+(\\Gamma_{pump}\/2)^{2}}>\\Gamma_{loss} .\n \\end{equation}\nThe transition between the two regimes is the usual laser threshold, but our purely photonic theory is not able to include the gain saturation mechanism that serves to stabilize laser oscillation above threhsold~\\cite{laser,QuantumNoise}: within our purely photonic theory, the population {would in fact show} a clearly unphysical monotonic growth for increasing $N$. A complete description in terms of the full atom-cavity master equation would of course solve this pathology including a gain saturation mechanism according to usual laser theory{, but this goes beyond the scope of the present work.}\n\n \n\\subsection{Optical bistability phenomena in weak nonlinear cavities}\nFor $U>0$, the situation is much more interesting as the effective transition frequency depends on the number of photons, \n\\begin{equation}\n\\omega_{N+1,N}=\\omega_{cav}+NU\\geq\\omega_{cav}, \\hspace{1cm},\n\\end{equation}\nso the gain condition\n\\begin{equation}\n\\frac{\\Gamma_{em}^0}{\\Gamma_{loss}}\\frac{(\\Gamma_{pump}\/2)^{2}}{(\\omega_{N+1,N}-\\omega_{at})^{2}+(\\Gamma_{pump}\/2)^{2}}\\geq1\\label{eq:lasing}\n\\end{equation}\ncan be satisfied in a finite range of photon numbers only, as it is illustrated in Fig.\\ref{fig:Gain-and-populations}(a). As a consequence, even a weak nonlinearity $U$ is able to stabilize the system for any value of $\\Gamma_{em}^0$ even in the absence of any gain saturation mechanism.\n\nFor $\\Gamma_{em}^0<\\Gamma_{loss}$, losses always dominate. For $\\Gamma_{em}^0>\\Gamma_{loss}$, the gain condition is instead satisfied in a range of frequencies $[\\omega_1,\\omega_2]$ around $\\omega_{at}$. Under the weak nonlinearity condition $U\\ll \\Gamma_{pump}$, the $[\\omega_1,\\omega_2]$ range typically contains a large number of transition frequencies $\\omega_{N+1,N}$ at different $N$. Three different regimes can then be identified depending on the position of the cavity frequency $\\omega_{cav}$ with respect to the $[\\omega_1,\\omega_2]$ range.\n \n(i) If $\\omega_{2}\\leq\\omega_{cav}$, then the gain condition is never verified, and the population $\\pi_{N}$ shown in Fig.\\ref{fig:Gain-and-populations}(b) is a monotonically decreasing function of $N$. In this regime, the state of the cavity field is very similar to a thermal state, as it usually happens in a laser below threshold. (ii) If $\\omega_{1}\\leq\\omega_{cav}\\leq\\omega_{2}$, the population $\\pi_N$ shown in Fig.\\ref{fig:Gain-and-populations}(c) is an increasing function for small $N$, shows a single maximum for $N\\simeq \\bar{N}=(\\omega_2-\\omega_{cav})\/U$, and finally monotonically decreases for $N>\\bar{N}$.\n\n\n\\begin{figure}[htbp]\n\\begin{center}\n\\includegraphics[width=0.4\\textwidth,clip]{two_point_correlation_weak_interacting.eps}\n\\end{center}\n\\caption{\n\\label{fig:g2_one_weak}\nPurely photonic simulation of the two-time coherence function $g^{(2)}(\\tau)$ in the weakly nonlinear regime.\nParameters $U\/\\Gamma_{pump}=0.1$, $\\Gamma_{loss}\/\\Gamma_{pump}=0.03$, $\\Gamma^0_{em}\/\\Gamma_{pump}=0.04$, $\\delta=-6U$ as in Fig.\\ref{fig:Gain-and-populations}(d).\n}\n\\end{figure}\n\nThe phenomenology is the richest in the regime (iii) where $\\omega_{cav}\\leq\\omega_{1}$. In this case, for small $N$ the population $\\pi_N$ decreases from its initial value $\\pi_0$ until the nonlinearly shifted frequency enters in the gain interval for $N\\simeq \\bar{N}'=(\\omega_1-\\omega_{cav})\/U$. After this point $\\pi_N$ starts increasing again until it reaches a local maximum at $N\\simeq \\bar{N}=(\\omega_2-\\omega_{cav})\/U$. Finally, for even larger $N$ it begins to monotonically decrease. An example of this complicate behaviour is shown in Fig.\\ref{fig:Gain-and-populations}(d).\n\nThe existence of two well separate local maxima at $N=0$ and $N\\simeq \\bar{N}$ in the photon number distribution $\\pi_N$ suggests that the incoherently driven nonlinear cavity exhibits a sort of bistable behaviour: when it is prepared at one maximum of the photon number distribution $\\pi_N$, the system is trapped in a metastable state localized in a neighborhood of this maximum for a macroscopically long time. Switching from one metastable state to the other results is only possible as a result of a large fluctuation, so it has a very low probability, typically exponentially small in the photon number difference between the two metastable states.\n\nThis bistable behavior is clearly visible in the temporal dependence of the delayed two-photon correlation function\n\\begin{equation}\ng^{(2)}(\\tau)=\\frac{\\langle a^{\\dagger}(t)\\,a^{\\dagger}(t+\\tau)\\,a(t+\\tau)\\,a(t) \\rangle_{ss}}{\\langle a^{\\dagger}(t)\\,a (t) \\rangle_{ss}\\langle a^{\\dagger}(t+\\tau)\\,a(t+\\tau) \\rangle_{ss}}:\n\\end{equation} \nthat is plotted in Fig.\\ref{fig:g2_one_weak}. At short times, the value of $g^{(2)}$ is determined by a weighted average of the contribution of the two maxima according to the stationary $\\pi_N$. After a quick transient of order $1\/\\Gamma_{em,loss}$, which corresponds to a fast local equilibration of the probability distribution around each of its maxima, the $g^{(2)}$ correlation function slowly decays to its asymptotic value $1$ on a much longer time-scale mainly set by the exponentially long switching time from one maximum to the other\n\nBefore proceeding, it is worth emphasizing that the present mechanism for optical bistability bears important differences from the dispersive or absorptive optical bistability phenomena discussed in textbooks~\\cite{Boyd,B-C}. On one hand there is some analogy to dispersive optical bistability in that the intensity-dependence of the refractive index is responsible for a frequency shift of the cavity resonance; on the other hand the frequency-selection is not provided by the resonance condition with a monochromatic coherent incident field rather by the frequency dependence of the gain due to the incoherent pump.\n\n\n\\subsection{Photon number selection in strongly nonlinear cavities \\label{sub:Strongly-nonlinear-cavity,}}\n\nIn the opposite limit $U\\gg\\Gamma_{pump}$, the nonlinearity is so large that a change of photon number by a single unity has a sizable effect on the emission rate $\\Gamma_{em}(\\omega_{N+1,N})$. As discussed in \\ref{app:projective}, the derivation of the photonic master equation remains fully valid in this regime provided $\\Gamma_{pump}\\gg\\Gamma_{em}^0,\\Gamma_{loss}$.\n\nThe ensuing physics is most clear in the regime when the maximum emission rate is large but only a single transition fits within the emission lineshape: these assumptions are equivalent to imposing that \n\\begin{equation}\n\\frac{\\Gamma_{em}^0}{\\Gamma_{loss}}\\gg 1\\hspace{1cm}\\textrm{and}\\hspace{1cm} \\frac{\\Gamma_{em}^0}{\\Gamma_{loss}}\\frac{\\Gamma_{pump}^2}{U^{2}}\\ll1\n\\end{equation}\nwith the further condition that the emission is resonant with the $N_0\\rightarrow N_0+1$ transition, \n\\begin{equation}\n\\omega_{at}=\\omega_{cav}+N_{0}U. \n\\end{equation}\nAs a result, only this last transition is dominated by emission, while all others are dominated by losses.\n\n\\begin{figure}\n\\begin{center}\n\\includegraphics[scale=0.3,clip]{photon_selec_2.eps} \n\\hspace{1cm}\\includegraphics[scale=0.3,clip]{photon_selec_3.eps}\n\\end{center}\n\\caption{\n{Selective generation of a $N_0=2$ photon (upper panel) and $N_0=3$ photon (lower panel) Fock state: Population $\\pi_N$ as a function of $N$ for different pumping parameters. The points are the result of a purely photonic simulation, the lines are a guide to the eye.\nLeft panel parameters:} for all curves $\\delta=-U$, $2\\Omega_R\/\\Gamma_{pump}=0.01$, and then for each particular curve $2\\Gamma_{loss}\/\\Gamma_{pump}=2\\,10^{-5}$ (blue solid line), $2\\,10^{-6}$ (green, dashed line), $2\\,10^{-7}$ (red, dash-dotted line), $2\\,10^{-8}$ (magenta, dotted line). $2U\/\\Gamma_{pump}=10^{3\/2}$ (blue solid line), $10^{2}$ (green, dashed line), $10^{5\/2}$ (red, dash-dotted line), $10^{3}$ (magenta, dotted line).\n{Right panel parameters:} fora ll curves $\\delta=-U$, $2\\Omega_R\/\\Gamma_{pump}=0.01$, and then $2\\Gamma_{loss}\/\\Gamma_{pump}=5\\,10^{-8}$ (blue solid line), $5\\,10^{-9}$ (green, dashed line), $5\\,10^{-10}$ (red, dash-dotted line), $5\\,10^{-11}$ (magenta, dotted line). $2U\/\\Gamma_{pump}=2\\,10^{5\/2}$ (blue solid line), $2\\,10^{3}$ (green, dashed line), $2\\,10^{7\/2}$ (red, dash-dotted line), $2\\,10^{4}$ (magenta, dotted line).\nThe goal of {these} {choices} of parameters was to control the steady-state ratios $P(N+1)\/P(N)=10^{-2}$ and $P(N)\/P(0)=0.1, 1, 10, 100$ (blue, green, red, magenta).\n\\label{fig:one_strongly}}\n\\end{figure}\n\n\n\\begin{figure}[htbp]\n\\begin{center}\n\\includegraphics[width=0.35\\textwidth,clip]{two_point_correlation_strongly_interacting}\\hspace{1cm}\n\\includegraphics[width=0.35\\textwidth,clip]{generation_pop.eps}\n\\end{center}\n\\caption{\n\\label{fig:g2_one_strongly_generation}\nLeft panel: Purely photonic simulation of the two-time coherence function $g^{(2)}(\\tau)$ for a strongly nonlinear regime in a (metastable) $N_0=2$ photon selection regime. The inset shows a magnified view of the short time region.\nParameters: $2U\/\\Gamma_{pump}=100$, $2\\Gamma_{loss}\/\\Gamma_{pump}=2\\, 10^{-3}$, $2\\Gamma_{em}\/\\Gamma_{pump}=0.2$, $\\delta=-U$; in the language of Fig.\\ref{fig:one_strongly}, the present parameters would correspond to a regime where the $N=0,2$ states are almost equally occupied.\nRight panel: Preparation of the metastable state at $N_0=2$ starting from a $N=4$\n$\\pi(4)$ (red {dot-dashed}) $\\pi(2)$ (green {dashed}) $\\pi(0)$ (blue {solid}). Same parameters as in Fig.\\ref{fig:one_strongly}.\n} \n\\end{figure}\n\n\n\nIn terms of the diagrams in Fig.\\ref{fig:Gain-and-populations}, the stationary distribution $\\pi_N$ is therefore sharply peaked at two specific values, $N=0$ and at $N=N_0$. Examples of this physics are illustrated in Fig.\\ref{fig:one_strongly}: the two peaks are always clearly visible, but depending on the parameters their relative height can be tuned to different values almost at will. It is however important to note that having a sizable stationary population in the $N=N_0$ peak requires quite extreme values of the parameters as population would naturally tend to accumulate at $N=0$ and this difficulty turns out to be exponentially harder for larger $N_0$.\n\n\nThe physics underlying this behaviour can be easily explained in terms of the asymmetry in the switching mechanisms leading from $N=0$ to $N=N_0$ and viceversa. The former process requires in fact a sequence of several unlikely emission events from $N=0$ to $N=N_0-1$ as emission is favoured only in the last step. On the other hand, decay from $N=N_0$ occurs as a consequence a single unlikely loss event from $N=N_0-1$ to $N=N_0-2$: as soon as the system is at $N=N_0-2$, it will quickly decay to $N=0$. \n\nThe rate $\\Gamma_{acc}$ of such an accident can be estimated as follows: the probability that the system in $N=N_0-1$ decays to $N=N_0-2$ is a factor ${(N_{0}-1)\\Gamma_{loss}}\/({N_{0}\\Gamma_{em}^0})$ smaller than the one of being repumped to $N=N_0$. As the rate at which the system decays from $N=N_0$ to $N_0-1$ is approximately equal to $N_{0}\\Gamma_{loss}$, one finally obtains\n\\begin{equation}\n\\Gamma_{acc}=N_{0}\\Gamma_{loss}\\frac{(N_{0}-1)\\Gamma_{loss}}{N_{0}\\Gamma_{em}^0}\\ll N_{0}\\Gamma_{loss}.\n\\end{equation}\nThis longer time scale $\\tau_{acc}=\\Gamma_{acc}^{-1}$ is clearly visible in the long tail of the time-dependent $g^{(2)}(t)$ that is plotted in the left panel of Fig.\\ref{fig:g2_one_strongly_generation}. The quick feature at very short times corresponds to the emission rate $\\Gamma_{em}$.\n\nIf needed, the characteristic time scale $\\tau_{acc}$ could be further enhanced by adding a second atomic species whose transition frequency is tuned to quickly and selectively emit photons on the $N-2\\rightarrow N-1$ transition. In this way, the accident rate can be efficiently reduced to $\\Gamma_{acc}^{(2)}\\simeq\\Gamma_{loss}\\left(\\Gamma_{loss}\/\\Gamma_{em}^0\\right)^{2}\\ll\\Gamma_{acc}$. By repeating the mechanism on $k$ transitions, one can suppress the accident rate in a geometrical way to $\\Gamma_{acc}^{(k)}\\simeq\\Gamma_{loss}\\left(\\Gamma_{loss}\/\\Gamma_{em}^0\\right)^{k}\\ll\\Gamma_{acc}$. Finally, the Fock state with $N_0$ photons can be fully stabilized to an infinite lifetime and no problem of metastability if $N_0$ different atomic species are included so to cover all transitions from $N=0$ to $N=N_0$.\n\nFrom a slightly different perspective, we can take advantage of {the slow rate of accidents $\\Gamma_{acc}$} to selectively prepare a metastable state with $N=N_0$ photons even in parameter regimes where the $N=0$ state would be statistically favoured at steady-state. Though the state will eventually decay to $N=0$, the lifetime of the metastable $N=N_0$ state can be long enough to be useful for interesting experiments: The idea to prepare the state with $N_0$ photons is to inject a larger number $N>N_0$ of photons into the cavity: the system will quickly decay to the $N=N_0$ state where the system remains trapped with a lifetime $\\Gamma_{acc}^{-1}$. \n\nThe efficiency of this idea is illustrated in the right panel of Fig.\\ref{fig:g2_one_strongly_generation} where we plot the time evolution of the most relevant populations $\\pi_N$. The initially created state with $N=N_{in}$ photons quickly decays, so that population accumulates into $N=N_0$ on a time-scale of the order of $\\Gamma_{loss}$; the eventual decay of the population towards $N=0$ will then occur on a much longer time set by $\\Gamma_{acc}$. It is worth noting that this strategy does not require that the initial preparation be number-selective: it will work equally well if a wide distribution of $N_{in}$ are generated at the beginning, provided a sizable part of the distribution lies at $N>N_0$. Furthermore, this idea removes the need for extreme parameters such as the ones used in Fig.\\ref{fig:one_strongly} to obtain a balance between $\\pi(N)$ and $\\pi(0)$: as a result, the difficulty of creating a (metastable) state of $N_0$ photons is roughly independent of $N_0$. \n\n{These} results show the potential of this novel photon number selection scheme to obtain light pulses with novel nonclassical properties: for instance, upon a sudden switch-off of the cavity mirrors, {one would obtain} a wavepacket containing an exact number of photons {sharing the same wavefunction}. With respect to the many other configurations discussed in the recent literature to produce $N$-photon Fock states and photon bundles~\\cite{Majumdar,Rundquist,Munoz}, our proposal has the advantage of giving a deterministic preparation of a $N$-photon Fock state in the cavity, which can then be manipulated to extract light pulses with the desired quantum properties.\n\n\n\\section{Cavity arrays} \\label{sec:Arrays-of-cavities}\n\nAfter having unveiled a number of interesting features that occur in the simplest case of a single-cavity, we are now in a position to start attacking the far richer many-cavity case. From now on we consider that the isolated photonic Hamiltonian is the Bose-Hubbard one with tunelling $J$ and interaction constant $U$. Throughout this section, we shall make heavy use of the purely photonic description previously derived, which allows to consider bigger systems with a higher number of photons. A numerical validation of this approach against the solution of the full atom-cavity master equation is presented in \\ref{app:valid}.\n\n\n\\subsection{Markovian regime} \\label{sec:Markov}\n\nWe begin by considering the Markovian limit of the theory, which is recovered for $\\Gamma_{pump}=\\infty$, i.e. for a frequency-independent gain. In this case, the emission term of the master equation for photons Eq.\\ref{eq:gainmarkov} reduces to the usual Lindblad form\n\\begin{equation}\n\\mathcal{L}_{em} =\\frac{\\Gamma_{em}^0}{2}\\sum_{i=1}^{k}\\left[2a_{i}^{\\dagger}\\rho a_{i}-a_{i}a_{i}^{\\dagger}\\rho-\\rho a_{i}a_{i}^{\\dagger}\\right].\n\\end{equation}\nFor a single cavity, the stationary state is immediately obtained as \n\\begin{equation}\n\\pi_{N}=\\frac{1}{1-\\frac{\\Gamma_{em}^0}{\\Gamma_{loss}}}\\left(\\frac{\\Gamma_{em}^0}{\\Gamma_{loss}}\\right)^{N}:\n\\end{equation}\na necessary condition for stability for this system is of course that $\\Gamma_{em}^0<\\Gamma_{loss}$. For $\\Gamma_{em}^0>\\Gamma_{loss}$ amplification would in fact exceed losses and the system display a laser instability: while a correct description of gain saturation is beyond the purely photonic theory, the full atom-cavity theory would recover for this model the standard laser operation~\\cite{QuantumNoise,Breuer,laser}.\n\nFor larger arrays of $k$ sites, a straightforward calculation shows that in the Markovian limit the stationary matrix keeps a structureless form, \n\\begin{equation}\n\\rho_{\\infty}=\\sum_{N}\\pi_{N}\\mathcal{I}_{N} ,\n\\end{equation}\nwith \n\\begin{equation}\n\\pi_{N}=\\frac{1}{\\sum_{M}D_{M}\\left(\\frac{\\Gamma_{em}^0}{\\Gamma_{loss}}\\right)^{M}}\\left(\\frac{\\Gamma_{em}^0}{\\Gamma_{loss}}\\right)^{N}.\n\\end{equation}\nHere, $D_{N}=\\frac{(N+k-1)!}{(k-1)!N!}$ is the dimension of the Hilbert subspace with a total number of photons equal to $N$ and $\\mathcal{I}_{N}$ is the projector over this subspace. The interested reader can find the details of the derivation in \\ref{app:Exact-stationary-solution}. \n\nThis result shows that independently of the number of cavities and the details of the Hamiltonian, in the Markovian limit the density matrix in the stationary state corresponds to an effective Grand-Canonical ensemble at infinite temperature $\\beta=0$ with a fugacity $z=e^{\\beta\\mu}={\\Gamma_{em}^0}\/{\\Gamma_{loss}}$ determined by the pumping and loss conditions only: All states are equally populated and the system does not display much interesting physics. In particular, the steady state does not depend on the tunelling amplitude $J$ and on the photon-photon interaction constant $U$\n\n\n\n\\subsection{Effective Grand-Canonical distribution in a weakly non-Markovian and secular regime \\label{sub:GC}}\n\nThe situation changes as soon as some non-Markovianity is included in the model. In this section we start from a weakly non-Markovian case where all relevant transitions adding one photon have a narrow distribution around the bare cavity frequency, $|\\omega_{f'f}-\\omega_{cav}|\\ll\\Gamma_{pump}$. We also assume a secular limit where $U,\\, J\\gg\\Gamma^0_{em},\\,\\Gamma_{loss}$, so that the non-diagonal terms of the density matrix {in the photonic hamiltonian eigenbasis} oscillate at a fast rate and are thus effectively decoupled from the (slowly varying) populations. In this limit, we can safely assume that all coherences vanish and we can restrict our attention to the populations. This somehow critical approximation will be justified a posteriori in the next section, where we treat perturbatively the coupling of populations to coherences and show both analytically and numerically that in the weakly markovian regime, their contribution is of higher order in the 'non-markovianity' parameter $1\/\\Gamma_{pump}$ and therefore can be safely neglected.\n\nUnder these assumptions, the transfer rate on the $\\ket{f'}\\rightarrow \\ket{f}$ transition where one photon is lost from $N+1$ to $N$ has a frequency-independent form\n\\begin{equation}\nT_{f' \\rightarrow f} = \\Gamma_{loss}\\left|\\bra{f} a \\ket{f'}\\right|^{2},\n\\end{equation}\nwhile the reverse emission process depends on the detunings $\\Delta_{f'f}=\\omega_{f'f}-\\omega_{cav}$ and $\\delta=\\omega_{cav}-\\omega_{at}$ as\n\\begin{equation}\n T_{f\\rightarrow f'} = \\Gamma_{em}^0\\left|\\bra{f'} a^\\dagger \\ket{f}\\right|^2 \\frac{\\frac{\\Gamma_{pump}^2}{4}}{(\\Delta_{f'f}+\\omega_{cav}-\\omega_{at})^{2}+\\frac{\\Gamma_{pump}^2}{4}}\n \\simeq \\tilde{\\Gamma}_{em}^0\\left|\\bra fa^\\dagger \\ket{f'}\\right|^2 \\left[1-\\beta\\Delta_{f'f}+\\mathcal{O}\\left(\\Delta_{f'f}\\right)^{2}\\right],\n \\label{eq:emissonWMS}\n\\end{equation}\nwith \n\\begin{eqnarray}\n\\tilde{\\Gamma}_{em}^0 & = & \\frac{\\left(\\Gamma_{pump}\/2\\right)^{2}}{(\\omega_{cav}-\\omega_{at})^{2}+\\left(\\Gamma_{pump}\/2\\right)^{2}}\\Gamma_{em}^0 ,\\\\\n\\beta & = & \\frac{2(\\omega_{cav}-\\omega_{at})}{(\\omega_{cav}-\\omega_{at})^{2}+\\left(\\Gamma_{pump}\/2\\right)^{2}}.\n\\label{eq:beta}\n\\end{eqnarray}\nIn this expression, the weakly non-Markovian regime is characterized by having $|\\beta \\Delta_{f'f} | \\ll 1$: in this case, the square bracket in Eq.\\ref{eq:emissonWMS} can be replaced with no loss of accuracy by an exponential\n\\begin{equation}\n1-\\beta\\Delta_{f'f}\\simeq e^{-\\beta\\Delta_{f'f}},\n\\end{equation}\nwhich immediately leads to a Grand-Canonical form of the stationary density matrix \n\\begin{equation}\n\\rho_{\\infty}=\\frac{1}{\\Xi}e^{\\beta N\\mu}e^{-\\beta H},\n\\end{equation}\nwith an effective chemical potential \n\\begin{equation}\n\\mu=\\frac{1}{\\beta}\\log\\left(\\frac{\\tilde{\\Gamma}_{em}^0}{\\Gamma_{loss}}\\right)+\\omega_{cav} \n\\end{equation}\nand an effective temperature $k_B T=1\/\\beta$: most remarkably, even if each transition involves a small deviation from the bare cavity frequency $\\omega_{cav}$,\nthe cumulative effect of many such deviations can have important consequences for large photon numbers, so to make the stationary distribution strongly non-trivial. Remarkably, both positive and negative temperature configurations can be obtained from Eq.\\ref{eq:beta} just by tuning the peak emission frequency $\\omega_{at}$ either below or above the bare cavity frequency $\\omega_{cav}$. \nAs expected for a thermal-like distribution, detailed balance between eigenstates is satisfied\n \\begin{multline}\nT_{f'\\rightarrow f}\\pi_{f'}-T_{f\\rightarrow f'}\\pi_{f}=\\left|\\bra{f'} a^\\dagger \\ket{f}\\right|^{2} \\,\\left[\\Gamma_{loss}\\frac{1}{\\Xi}\\left(\\frac{\\tilde{\\Gamma}_{em}^0}{\\Gamma_{loss}}e^{\\beta\\omega_{cav}}\\right)^{N+1}e^{-\\beta \\omega_{f'}} \\right. +\\\\\n-\\left.\\tilde{\\Gamma}_{em}^0\\,e^{-\\beta\\left(\\omega_{f'f}-\\omega_{cav}\\right)}\\frac{1}{\\Xi}\\left(\\frac{\\tilde{\\Gamma}_{em}^0}{\\Gamma_{loss}}e^{\\beta\\omega_{cav}}\\right)^{N}e^{-\\beta \\omega_{f}}\\right] =0,\n\\end{multline}\nbut it is crucial to keep in mind that this thermal-like distribution does not arises from any real thermalization process, but is a consequence of the specific form chosen for the pumping and dissipation. The application of this concept to the study of effective thermalization effects in a driven-dissipative non-Markovian condensate in the weakly interacting regime will be the subject of a future work, also with an eye to photon~\\cite{Weitz} and polariton~\\cite{BEC,Bajoni} Bose-Einstein condensation experiments.\n\n\n\n\\begin{figure}\n\\begin{center}\n\\includegraphics[width=0.25\\columnwidth,clip]{test_GC_n}\n\\hspace{1cm}\n\\includegraphics[width=0.25\\columnwidth,clip]{test_GC_corr}\n\\hspace{1cm}\n\\includegraphics[width=0.25\\columnwidth,clip]{eigenstate_coherence.eps}\n\\end{center}\n\\caption{\nLeft and center panels: average number of photons $n_1=\\langle a_1^\\dagger a_1\\rangle$ (left) and spatial coherence $g_{1,2}^{(1)}= \\langle a_1^\\dagger a_2\\rangle\/\\langle a_1^\\dagger a_1\\rangle$ (center) in a two cavity system with small $U\/\\Gamma_{pump}$ and $J\/\\Gamma_{pump}$ as a function of the non linearity $U$ at fixed $\\Gamma_{pump}$. In red dots, exact resolution of the photonic master equation, and in black solid line the grand canonical ensemble ansatz. Parameters~: $2J\/\\Gamma_{pump}=0.02$, $2\\Gamma_{loss}\/\\Gamma_{pump}=0.002$, $2\\Gamma_{em}\/\\Gamma_{pump}=0.0014$, $2\\delta\/\\Gamma_{pump}=0.6$. \nRight panel: purely photonic simulation of the relative quantum coherence between two arbitrarily chosen two-photon eigenstates $\\rho_{ij}\/\\sqrt{\\rho_{ii}\\rho_{jj}}$ as a function of $1\/\\Gamma_{pump}$ (the result does not depend on the specific eigenstates considered). As expected, this coherence vanishes in $1\/\\Gamma^2_{pump}$ in the Markovian limit $1\/\\Gamma_{pump}\\to 0$. The value above $1$ for large $1\/\\Gamma_{pump}$ signals breakdown of positivity of the density matrix as we move out of the validity regime of the purely photonic master equation.\nParameters: $J\/\\Gamma_{loss}=1$, $\\Gamma_{em}\/\\Gamma_{loss}=0.5$, $\\delta=-\\Gamma_{loss}$, $U\/\\Gamma_{loss}=2$.\n\\label{fig:GCtest}}\n\\end{figure}\n\nA numerical test of this result for a two cavity system with a strong pumping $\\Gamma_{pump}\\gg U,J$ and a large enough photon number so to induce appreciable nonlinear effects is shown in Fig.\\ref{fig:GCtest}. The results of this comparison are displayed in the left and central panels: excellent agreement between an exact resolution of the photonic master equation and the grand canonical ensemble ansatz is found in both the average photon number and the first-order coherence.\n\n\\subsection{Beyond the secular approximation}\n\nIn the weakly non-Markovian regime, the validity of the effective Grand-Canonical description can be extended outside the secular approximation according to the following arguments.\nAs a first step, we decompose the master equation as\n\\begin{equation}\n\\frac{d\\rho}{dt}=[\\mathcal{M}_0+\\delta\\mathcal{M}]\\rho,\n\\end{equation}\nwhere the super-operators $\\mathcal{M}$ and $\\delta\\mathcal{M}$ act of the linear space of density matrices $\\rho$ as\n{\\begin{equation}\n\\mathcal{M}_{0}[\\rho]=-i\\com H{\\rho}+\\frac{\\Gamma_{loss}}{2}\\sum_{i=1}^{k}\\left[2a_{i}\\rho a_{i}^{\\dagger}-a_{i}^{\\dagger}a_{i}\\rho-\\rho a_{i}^{\\dagger}a_{i}\\right] +\\frac{\\tilde{\\Gamma}_{em}^0}{2}\\sum_{i=1}^{k}\\left[\\hat{a}_{i}^{\\dagger}\\rho a_{i}+a_{i}^{\\dagger}\\rho\\hat{a}_{i}-a_{i}\\hat{a}_{i}^{\\dagger}\\rho-\\rho\\hat{a}_{i}a_{i}^{\\dagger}\\right],\n\\end{equation}}\nand \n\\begin{equation}\n \\delta\\mathcal{M}[\\rho]=\\frac{\\tilde{\\Gamma}_{em}^0}{2}\\sum_{i=1}^{k}\\left[\\delta a_{i}^{\\dagger}\\rho a_{i}+a_{i}^{\\dagger}\\rho\\delta a_{i}-a_{i}\\delta a_{i}^{\\dagger}\\rho-\\rho \\delta a_{i} a_{i}^{\\dagger}\\right],\n \\label{perturbation}\n \\end{equation}\nwith \n\\begin{equation}\n\\tilde{a}_{i}^{\\dagger}=\\frac{\\tilde{\\Gamma}_{em}^0}{\\Gamma_{em}^0}\\,\\left( \\hat{a}_{i}^{\\dagger}+\\delta a_{i}^{\\dagger}\\right),\n\\end{equation} and \n{\\begin{equation}\n\\bra{f'}\\hat{a}_{i}^{\\dagger}\\ket f=\\left(e^{-\\beta\\Delta_{f'f}}-i\\frac{\\omega_{cav}-\\omega_{at}}{\\Gamma_{pump}}\\right)\\bra{f'}a_{i}^{\\dagger}\\ket f,\n\\end{equation}}\nfrom which we deduce that \n{\\begin{equation}\n\\bra{f'}\\delta a_{i}^{\\dagger}\\ket f\\underset{\\Gamma_{pump}\\to\\infty}{=}\\bra{f'}a_{i}^{\\dagger}\\ket f \\, \\left(-i\\frac{\\Delta_{f'f}}{\\Gamma_{pump}}+\\mathcal{O}\\left(\\frac{\\Delta_{f',f}}{\\Gamma_{pump}}\\right)^{2}\\right).\n\\label{deltacreation}\n\\end{equation} }\nUsing similar arguments to the Markovian case of \\ref{app:Exact-stationary-solution}, we can easily show that the grand canonical distribution is a steady state of this modified $\\mathcal{M}_{0}$ operator,\n\\begin{equation}\n\\mathcal{M}_{0}(e^{\\beta N\\mu}e^{-\\beta H})=0,\n\\end{equation}\nAs the correction term $\\delta\\mathcal{M}$ vanishes in the Markovian limit proportionally to $1\/\\Gamma_{pump}$, we can calculate the lowest order correction to the steady state in $\\delta\\mathcal{M}$. Expanding the steady state in powers of $1\/\\Gamma_{pump}$ keeping a constant $(\\omega_{cav}-\\omega_{at})\/\\Gamma_{pump}$, we see easily that the first order corrections in eq. (\\ref{deltacreation}) are purely imaginary so that populations are perturbed only to second order in {$\\beta\\Delta_{f'f}$}. In our Markovian limit, these corrections then vanish even if we perform simultaneously the Markovian and thermodynamic limit. \n\nSecondly, coherences (which are exactly zero in the Markovian case, see Sec.\\ref{sec:Markov}) should be then proportional to {$1\/\\Gamma_{pump}$}. However, we have shown in \\ref{app:quadratic coherences} that the linear contribution to coherences vanishes when we sum over all sites of the system. We conclude thus that in the weakly non Markovian limit, coherences between eigenstates of the hamiltonian are quadratic in $1\/\\Gamma_{pump}$ and therefore remain very small even out of the secular approximation. \n\nAs a further verification of this analytical argument, in the right panel of Fig.\\ref{fig:GCtest} we have shown the $\\Gamma_{pump}$ dependence of the coherence between an arbitrary pair of two-photon states as well as the error in the population of an arbitrary eigenstate, between the true steady state and the grand canonical distribution. As expected on analytical grounds, both these quantities scale indeed as $\\Gamma_{pump}^{-2}$.\n\nFrom these arguments, we conclude that the breakdown of the secular approximation which occurs in the thermodynamic limit where the spectrum become continuous should not affect the effective thermalization of the steady state in the weakly non-Markovian regime of large $\\Gamma_{pump}$. Even if the steady-state is not affected, we however expect that the relatively strong dissipation will significantly affect the the system dynamics. A complete study of this physics will be the subject of a future work. \n\n\\section{Two cavities with strong non linearity}\n\n\\subsection{Towards Mott-insulator physics}\n\nAs a final example of application of our concepts, in this last section we present some preliminary results on the most interesting case of two strongly nonlinear cavities with $U\\gg\\Gamma_{pump}$: extending the photon-number selectivity idea to the many-cavity case, we look for many-body states that resemble a Mott insulator~\\cite{Bloch2008,RMP,Hartmann_rev}. As in the single cavity case, the strong pumping $\\Gamma_{em}\\gg \\Gamma_{loss}$ would favour a large occupations of sites, but is counteracted by the effect of the nonlinearity $U\\gg \\Gamma_{pump}$ which {sets} an upper bound to the occupation: the result is a steady-state with a well-defined number of photons per cavity.\n\n\n\\begin{figure}\n\\begin{center}\n\\includegraphics[scale=0.3,clip]{mott_n} \\hspace{1cm}\n\\includegraphics[scale=0.3,clip]{mott_g2} \\\\\n\\includegraphics[scale=0.3,clip]{mott_g1} \\hspace{1cm}\n\\includegraphics[scale=0.3,clip]{mott_spontcoh}\n \\end{center}\n\\caption{Purely photonic simulations of steady-state observables as a function of $2U\/\\Gamma_{pump}$ in a two-cavity system: (a) average number of photons $n_{1}=\\langle{a_{1}^{\\dagger}a_{1}}\\rangle$, (b) one-site two-body correlation function $g_{1,1}^{(2)}=\\langle{a_{1}^{\\dagger}a_{1}^{\\dagger}a_{1}a_{1}}\\rangle=\\langle{n_{1}(n_{1}-1)}\\rangle$, (c) inter-site one-body correlation function $g_{1,2}^{(1)}={\\langle a_{1}^{\\dagger}a_{2}\\rangle }\/{\\langle a_{1}^{\\dagger}a_{1}\\rangle }$. Parameters: $2J\/\\Gamma_{pump}=0.2$, $2\\Gamma_{loss}\/\\Gamma_{pump}=0.002$, $2\\Gamma_{em}\/\\Gamma_{pump}=0.06$ (solid black line). Red dashed line, same simulation with a weaker $2\\Gamma_{em}\/\\Gamma_{pump}=0.00144$. Panel (d), from left to right~: state occupancy, energy and two site spatial coherence of the different eigenstates of the hamiltonian, at the maximum coherence point $2U\/\\Gamma_{pump}=0.16$ of the red dashed line.\n\\label{fig:mott}}\n\\end{figure}\n\nThe result of numerical calculations based on the photonic master equation are shown as black lines in Fig.\\ref{fig:mott}(a-c) in the $\\omega_{cav}=\\omega_{at}$ case: for a high emission rate $\\Gamma_{em}^0$ and a strong non linearity $U$, signatures of the desired Mott state with one particle per site are visible in the steady-state average number of photons that tends to $1$ for a strong nonlinearity $U$ [panel (a)], in the probability of double occupancy that tends to $0$ [panel (b)], and in the one-body coherence between the two sites that also tends to $0$ [panel (c)]. \n\nWhile these results are a strong evidence of $N_0=1$ Mott state, a similar calculation for larger $N_0 \\geq 2$ Mott states is made much more difficult by metastability issues and the Mott state would typically have a finite lifetime. As in the single cavity case, we expect that this problem could be fixed by adding several atomic species on resonance with the different photonic transitions below $N_0$.\n\nBased on this preliminary analysis, we can attempt to make some claims on the structure of the non-equilibrium phase diagram of our model. As for $J=0$ one can efficiently create a Fock state in each cavity, we expect that for small $J$ the system will remain in a sort of Mott state. On the other hand, in the weakly interacting regime we expect the system to display a coherent Bose-Einstein condensate~\\cite{PRL10}. In between, one can anticipate that system should display some form of non-equilibrium Mott-Superfluid transition. Analytical and numerical studies in this direction are in progress.\n\n\\subsection{An unexpected mechanism for coherence}\n\nThe red dashed lines in the same panels Fig.\\ref{fig:mott}(a-c) show the same simulation for a weaker emission rate $\\Gamma_{em}^0$, which allows to consider weaker values of the nonlinearity without increasing too much the photon number. In particular, in panel (c) we see that the non-negligible value of $2J\/\\Gamma_{pump}$ is responsible for a significant spatial coherence between the two sites, which attains a maximum value $g^{(1)}_{12}\\approx 0.26$ for an interaction strength $2U\/\\Gamma_{pump}\\simeq 0.16$ of the same order of magnitude as the tunnel coupling $2J\/\\Gamma_{pump}=0.2$. \n\nThe quite unexpected appearance of this coherence can be understood as follows. On one hand, in the absence of tunneling $J=0$, all the dynamics is local and we do not expect any spatial coherence. On the other hand, in the absence of interactions $U=0$ and for zero detuning, symmetric and anti-symmetric states are equally close to resonance (albeit with opposite detuning) and then equally populated, so there should not be any coherence either. However in presence of both tunnelling and small interactions (i.e. for $J,U\\neq 0$ and $U\\ll J$), the energy of all eigenstates (symmetric\/anti-symmetric states with various photon numbers) is perturbatively shifted in the upward direction by (small) interactions $U$. As a result, symmetric states, which are below the resonance, get closer to resonance and become more populated than the anti-symmetric ones, which get farther to the resonance and are thus depleted. As one can see in the plot of the energy, the spatial coherence and the steady-state occupancy of the different eigenstates shown in Fig.\\ref{fig:mott}(d) for the maximum coherence point, this induces an overall positive coherence between the two sites.\n\nEven though the nonlinearity is only active for states with at least two photons, it is interesting to note that also in the $N=1$ manifold the antisymmetric state is less populated than the symmetric one. This population unbalance is inherited from the one in the above-lying $N>1$ states, as the decay preferentially occurs into the symmetric state. Since no coherence is expected in both limiting cases of purely interacting $U\\gg J$ and non interacting $U\/0=0$ photons, the maximum of the coherence is obtained when interactions and tunelling are of the same magnitude, $U\\approx J$: this result is clearly visible in panel Fig.\\ref{fig:mott}(c).\n\nInvestigation of this many-body physics in the more interesting case of larger arrays which can accommodate a larger number of photons requires sophisticated numerical techniques to deal with the dynamics in a huge Hilbert space~\\cite{Pisa,corner} and will be the subject of future work. A very exciting advance in this direction was recently published in~\\cite{Kapit} for strongly interacting photons in the presence of a synthetic gauge field for light: analogously to the Mott insulator state studied here, the combination of the effectively frequency-dependent pumping (obtained via a two-photon pumping in the presence of an auxiliary lattice) and the many-body energy gap was predicted to generate and stabilize fractional quantum Hall states of light.\n\n\n\\section{Conclusions}\n\\label{sec:Conclu}\n\nIn this work we have proposed and characterized a novel scheme to generate strongly correlated states of light in strongly nonlinear cavity arrays. Photons are incoherently injected in the cavities using population-inverted two-level atoms, which preferentially emit photons around their resonance frequency. The resulting frequency-dependence of the gain will be the key element to generate and stabilize the desired quantum state. A manageable theoretical description of the system is obtained using projective methods, which allow to eliminate the atomic degrees of freedom and describe the non-Markovian photonic dynamics in terms a generalized master equation. \n\nThe efficiency of the our pumping scheme to generate specific quantum states is first validated on a single-cavity system: for weak nonlinearities, a novel mechanism for optical bistability is found. For strong nonlinearities, Fock states with a well-defined photon number can be generated with small number fluctuations. \n\nIn the general many cavity case, in the weakly non-Markovian case the steady-state of the system recovers a Grand-Canonical distribution with an effective chemical potential determined by the pumping strength and an effective inverse temperature proportional to the non-Markovianity: This very general results may have application to explain apparent thermalization in recent photon and polariton condensation experiments. \n\nFinally, the power of a frequency-dependent pumping to generate strongly correlated states of light is illustrated in the case of a strongly nonlinear two-cavity system which, in the strongly non-Markovian regime, can be driven into a state that closely reminds a Mott-insulator state. A general study of the potential and of the limitations of the frequency-dependent gain to generate generic strongly correlated states with many photons will be the subject of future work.\n\n\\section{Acknowledgments}\nIC acknowledges financial support by the ERC through the QGBE grant, by the EU-FET Proactive grant AQuS (Project No.640800), and by the Provincia Autonoma di Trento, partly through the project ``On silicon chip quantum optics for quantum computing and secure communications'' (``SiQuro''). Continuous discussions with Alessio Chiocchetta, Hannah Price, Alberto Amo, Jacqueline Bloch, and Mohammad Hafezi are warmly acknowledged.\n\n\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}}