NIRDust: Probing Hot Dust Emission around Type 2 AGN using K-band Spectra

Hot dust in the proximity of AGNs strongly emits in the Near Infrared producing a red excess that, in type 2 sources, can be modeled to measure its temperature. In the era of high spatial-resolution multi-wavelength data, mapping the hot dust around Supermassive Black Holes is important for the efforts to achieve a complete picture of the dust role and distribution around these compact objects. In this work we propose a methodology to detect the hot dust emission in the proximity of Type 2 AGNs and measure its temperature using K-band spectra ( 𝜆 𝑐 = 2.2 𝜇 m). To achieve this, we have developed NIRDust, a Python package for modeling K-band spectra, estimate the dust temperature and characterize the involved uncertainties. We tested synthetic and real spectra in order to check the performance and suitability of the physical model over different types of data. Our tests on synthetic spectra demonstrated that the obtained results are influenced by the signal-to-noise ratio (S/N) of the input spectra. However, we accurately characterized the uncertainties, which remained below ∼ 150 K for an average S/N per pixel exceeding 20. Applying NIRDust to NGC 5128 (Centaurus A), observed with the Gemini South Telescope, we estimated a dust temperature of 662 and 667 K from Flamingos-2 spectra and 697 and 607 K from GNIRS spectra using two different approaches.


INTRODUCTION
The Unified Model for Active Galactic Nuclei (Antonucci 1993;Netzer 2015) proposes orientation with respect to the observer as the fundamental difference between AGN types.The key to the unification is a nuclear structure of molecular gas and dust that absorbs the radiation in some lines of sight but not in others and was unresolved in the observations that drove the model (e.g.Mason 2015).As modern facilities become available this structure can be studied at higher spatial resolutions, via infrared spectroscopy and interferometry and sub-mm observations, bringing clues to its true morphology.This structure, called "the torus" due to its theoretical origin, not only absorbs radiation in order to display the differences between AGN types but it could play an important role in the accretion mechanism of the SMBH as it is part of the inflow and outflow processes in the nuclear regions of galaxies.
Over the last decades the model for the dusty absorber has suffered profound changes.The idea of a "clumpy torus" was adopted after the homogeneity of the torus was ruled out on the basis of the high temperatures the dust reaches under such conditions (Krolik ★ E-mail: ggaspar@unc.edu.ar& Begelman 1988;Nenkova et al. 2002Nenkova et al. , 2008)).Later, the discovery of a polar component observed with MIR interferometry (e.g.Hönig et al. 2012Hönig et al. , 2013;;López-Gonzaga et al. 2014;Asmus et al. 2016;Stalevski et al. 2019;Asmus 2019) resulted in a new model that incorporates a polar component as an outflowing wind and a thin annulus of high temperature dust (∼ 1500 K) observed in NIR interferometry data at the dust sublimation radius (Hönig 2019).Parallel to this, several authors have found massive and large equatorial components observing in the sub-mm regime, establishing that the dusty absorber can reach sizes up to 100 pc (e.g.Izumi et al. 2018;Alonso-Herrero et al. 2018;Combes et al. 2019;García-Burillo et al. 2021).Regarding the chemical composition of the dust, temperature plays a key role, as different grain composition and sizes sublimate with increasing temperature.For instance, silicates are destroyed in regions with temperatures above 1200 K while graphite grains can survive up to 1900 K (Hönig & Kishimoto 2017).In this context, the temperature of the hot dust in the torus is a fundamental parameter that is related with the determination of the density, the composition and the geometry of the torus.
Dust radiates at different wavelengths depending on its temperature.In the case of dust thermally heated by the accretion disc of a SMBH part of the emission is detected in the near-infrared and, in particular, is prominent in the K-band (2-2.4𝜇m).Several authors have reported measurements of the temperature of hot dust in AGNs using JHK colors (e.g.Glass & Moorwood 1985;Alonso-Herrero et al. 1998), NIR interferometry (e.g.Kishimoto et al. 2011;Leftley et al. 2021;Gravity Collaboration et al. 2020;Gámez Rosas et al. 2022) or NIR spectroscopy (e.g.Burtscher et al. 2015;Durré & Mould 2018;Gaspar et al. 2019Gaspar et al. , 2022;;Riffel et al. 2022) and found temperatures ranging from 700 to 1500 K. Burtscher et al. (2015) measured the temperature of the hot dust component for 51 near AGNs in 1" apertures and found a mean of 887 ± 68 K for type 2 AGNs and 1292 ± 46 K for type 1 AGNs.Regarding the extension and temperature distribution of this hot dust, Gaspar et al. (2019Gaspar et al. ( , 2022) ) found T ∼ 1000 K dust in scales of tens of pc and almost constant in temperature in two Seyfert 2 nuclei.Gámez Rosas et al. ( 2022) measured dust temperatures using MIR interferometry with MATISSE/ESO/VLTI instrument in several sub-pc regions around the SMBH of NGC 1068, the archetypical Seyfert 2 galaxy.They found temperatures ranging between 800 and 1500 K in the different regions that "do not decrease systematically with distance from the inferred black hole position".Finally, Riffel et al. (2022) found hot dust emission extended outside the unresolved core and stated that the emission inside ∼ 40 pc is dominated by hot dust in a sample of 18 nearby Seyfert galaxies.The variety of these dust detections evidence that more temperature measurements in high angular resolution infrared data are necessary to improve our understanding on the extension, distribution, and origin of the hot dust in the proximities of AGNs.
The resolved NIR spectroscopic observations currently available with ground-based 8-10 m class telescopes are suitable for determining the extent and temperature distribution of the hot dust component in AGNs, as they can resolve the central regions of these objects at resolutions of tens of pc or less in nearby galaxies.Furthermore, the MIRI (5-28 m) and NIRSpec (0.6 -5 m) instruments on board the James Webb Space Telescope will enable spectroscopic mapping of dust and molecular gas in the central regions of AGNs with unprecedented sensitivity and spatial resolution.
This work introduces NIRDust, a Python-based tool designed for detecting and measuring the temperature of hot dust near Type 2 AGNs.NIRDust utilizes K-band rest frame spectra to fit the temperature of a blackbody component emitted by the hot dust in the NIR range.The package offers a range of functionalities, including spectrum storage, pre-processing, and fitting.NIRDust's application programming interface (API) facilitates seamless integration with Astropy (Astropy Collaboration et al. 2013), particularly with Specutils, enabling users to incorporate NIRDust into their broader code base when working with NIR spectra.
In Section 2 we present the fundamental physics basis for the code.In Section 3 the functionalities and quality of the package are described along with an application example and, in Section 4 the results of tests to evaluate the performance of NIRDust are presented.The Summary and future work are in Section 5.

MODELLING THE HOT DUST EMISSION
For type 2 AGNs, in the absence of a non-thermal featureless continuum, the nuclear spectrum continuum in the K-band is conformed by two elements: the stellar population spectrum and the emission by hot dust (Thatte et al. 1997;Gratadour et al. 2003, and references therein).This is easily appreciated when observing the slope of the nuclear spectrum continuum that remains constant or even rising when a pure stellar spectrum is expected to fall (e.g.Ferruit et al. 2004;Gravity Collaboration et al. 2020), i.e. a red excess is present.This means that, if the stellar spectrum can be computed then the dust emission can be isolated.This hot dust component is not only detected in the nuclear spectrum but it can be found in more external regions in high-angular resolution spectra (e.g.Gaspar et al. 2022;Riffel et al. 2022).
At moderate spectral resolution ( = 1000 − 3000), the dust emission can be modeled by a blackbody function of single temperature.In the real case, the emission could be composed by a continuum of temperatures, but for this kind of spectra experience has shown that using a single temperature is sufficient (e.g.Durré & Mould 2018;Gaspar et al. 2019).
The blackbody radiation can be described by Planck's law as a function of frequency , and parameterized by its temperature, , and an amplitude, , as: where ℎ,  and  correspond to the Planck constant, Boltzmann constant and speed of light, respectively.The scale factor  is used to model the intensity amplitude of the blackbody radiation for a given temperature .It is worth noticing that the introduction of this factor does not affect the location of the radiation peak or the general shape of the blackbody function.The dust emission can then be modeled by the free parameters  and .
To model the Target Spectrum, where the hot dust emission is expected to be found, we use a linear combination of the stellar component and a blackbody function as in Durré & Mould (2018): Here,   is the Target Spectrum,   is the Reference Spectrum that accounts for the stellar emission,   is the blackbody function of temperature T, and  ′ is a constant emission that represents the sky background (it is recommended that the sky background is previously subtracted to make  ′ the closer to zero as possible). and  ′ are scale factors of the stellar and blackbody components respectively.The reformulation of  ′ and  ′ is introduced for the technical purpose of exploring the parameter space with a logarithmic distribution (see Section 3 for more details on the technical discussion).Thus, the parameter space is defined by  ≡ {, , , }.
In order to model the hot dust emission with Eq. 2 spectra do not necessarily have to be flux calibrated.This is important because the uncertainties introduced in the flux-calibration process can reach 30−50% in the NIR due to the fast changes in atmospheric conditions that occur at this wavebands.The telluric correction (essential when studying spectral continuum) eliminates the shape of the atmosphere transmission and the instrumental response from the spectrum and hence the flux calibration is reduced to a multiplicative operation.Given the linear combination that models the Target Spectrum, this multiplicative factor is absorbed by the  parameter.The temperature information does not change after the multiplicative operation.

The Reference Spectrum
As stated above, in order to isolate the hot dust spectrum present in the nuclear region of a Type 2 AGN, it is necessary to provide the stellar spectrum of the same region.The hypothesis working here is that   is the same as the Target Spectrum stellar component, in other words, that the stellar population that emitted   is the same stellar population which inhabits the region that emitted   .
is , of course, not possible to isolate from the Target Spectrum without knowing the dust emission, but there are some hypothesis under which this stellar spectrum can be represented by different proxies.The main hypothesis is that in the NIR the late-type population emission is dominant in comparison with the emitted by young stars.This allows, for instance, for the nuclear stellar population to be represented by a spectrum or a mix of spectra of late-type stars.Moreover, the late-type population is more homogeneously distributed than the young population that is usually located in clusters or "clumps" as can be seen, for example, in Fig. 1 of Lin et al. (2013) were the same galaxy is shown in different wavebands.Taking this into account it could be considered that a spectrum of the stellar population extracted at a certain distance from the nucleus can serve as reference for the nuclear stellar population.
One crucial consideration of this approximation is the frequent occurrence of starburst activity intertwined with AGN emissions in galactic nuclei.Depending on the intensity and duration of the starburst, deviations from the external stellar population used as a reference can emerge.In this context, the choice of width and location for extracting the Reference Spectrum becomes pivotal in accurately emulating the nuclear stellar population.Notably, in cases where high spatial resolution data is available, analyzing the slopes of the continuum at various radii can offer insights into where the stellar population is most representative of the overall population and where regions of hot dust are prevalent.If a multitude of spectra are extracted from distinct radii, a meticulous examination of the spectral slopes can reveal a radius at which the slope consistently remains unchanged as one moves to larger radii.Once this phenomenon is observed, it becomes reasonable to infer that these particular spectra are indeed representative of the underlying spectral population.This approach provides a valuable tool for pinpointing radii where the stellar population's characteristics remain relatively stable and unaffected by extreme local conditions such as the presence of hot dust.An illustrative example of this concept can be found in Fig. 9 of Gaspar et al. (2022), where the variations in the slope of the spectral continuum are evident between the nucleus and two distinct radii.Interestingly, in these two radii, the spectral slope remains consistent.For a comprehensive set of spectra illustrating these findings, the interested reader is directed to the appendix of the aforementioned publication.In Sec.4.2 of this work, we elaborate on the procedure employed to select the Reference Spectrum for a specific example presented herein, corresponding to the galaxy NGC 5128.
In summary and under the aforementioned hypothesis,   could be represented by a Reference Spectrum in three different ways: • A spectrum of the same galaxy extracted in the nuclear region but far enough from the nucleus to avoid the hot dust component.(moderate to high spatial resolution data) • A spectrum of a late-type star.
• A nuclear stellar template of a non active galaxy of similar type to the host galaxy under study.
It is important to acknowledge that NIRDust has been exclusively tested using the first and second scenarios.The first one, which involves analyzing a spectrum extracted near the nucleus of the same galaxy, has been previously employed in other studies (e.g.Durré & Mould 2018;Gaspar et al. 2019Gaspar et al. , 2022) ) and has also been successfully implemented as an alternative in situations where the Population Synthesis technique does not yield satisfactory results (Dumont et al. 2020).The second scenario, that was applied by Burtscher et al. (2015), and the third scenario, which remains hypothetical, require further testing to determine their suitability for modeling the stellar population of AGNs using NIRDust.

NIRDUST
The entire experiment of this work are supported by NIRDust.NIR-Dust is an object-oriented package (Ram et al. 2003) that is fundamentally designed around the factory-method pattern (Gamma et al. 1995), so the easiest way to create the available objects on the package, is usually some function or method.The core features of the project are centered around the NirdustSpectrum class, serving as a comprehensive model of a spectrum.This class is capable of segmenting the spectrum within designated boundaries, transforming the spectral axis into frequencies, standardizing intensity levels, deriving noise from a region defined by the user, and implementing selective masking on distinct portions of the spectrum.In addition, NIRDust offers additional preprocessing capabilities for line spectrum construction and resampling of two spectra to match the same resolution, Finally, the main functionality of the package is also available, which consists in estimating and characterizing the dust temperature, this algorithm is explained in detail in the Subsection 3.1.
To guarantee accurate results, NIRDust maintains a strict adherence to the PEP-8 coding standard (Van Rossum et al. 2001) and employs the Flake-8 tool for seamless code consistency.With a comprehensive suite of 93 unit tests (Jazayeri 2007), it meticulously validates software components, accommodating Python versions spanning from 3.8 to 3.11, and achieving an impressive 99% code coverage (Miller & Maloney 1963).
A detailed description of the use of NIRDust, the installation process, the bug report procedure, and a more in-depth discussion of the project quality can be found in Appendix B.

Fitting procedure
The model given by equation 2 is fitted using both spectra, Target and Reference, using a basin-hopping algorithm (Wales & Doye 1997).This is a two-phase method that combines a global minimization algorithm with local minimization at each step.When the local optimization routine finds a local minimum, the basin-hopping algorithm randomly perturbs this local solution and attempts a new local optimization.This technique has provided useful results in many problems where the likelihood surface is hard to explore and simpler minimization algorithms tend to get stuck in local minima.
The parameter space of the problem, is given by four free parameters  ≡ {, , , }.We consider the case where observations, , are independent and identically distributed, sampled from the same gaussian probability function  (|), where each parameter is described by a normal distribution N (, ).Then the likelihood function can be expressed as: where the index  runs through all observed points in the spectrum.
The explicit expression takes the form: where  corresponds to the uncertainty value of the observations.Ideally, one should use the covariance matrix which is not always available in spectroscopic studies.We estimate the uncertainty  using the standard deviation of the observed data to the fitted continuum.

APPLICATION ON SIMULATED AND REAL SPECTRA
In this section we present two scenarios designed to test the accuracy of the model described in Section 2 and the capability of NIRDust's implementation to recover the true values of its parameters.We consider the following cases: the use of controlled synthetic spectra, and the real case of NGC 5128 (CenA), which also serves as an independent comparison with the results reported by Burtscher et al. (2015) for this galaxy.
The goal of these tests is to evaluate the impact of the characteristics of the input spectra and the masking procedure on the estimated parameters, particularly the temperature.Moreover, the tests over synthetic spectra intend to serve as a guide to estimate the uncertainties involved when using NIRDust on real spectra.

Synthetic spectra: accuracy in the presence of noise
For this test we built multiple synthetic models that represent the Target and Reference spectra where we vary the following conditions of interest to asses their impact.
• The signal-to-noise (S/N) ratio of both spectra.
• The percentage and location of points removed when masking the spectral features.
We simultaneously consider a wide range of temperature values, ranging between 500 and 1600 K.For simplicity we modeled the stellar population of the Reference Spectrum as a decreasing linear function.The Target spectrum was then modeled according to equation 2 where we adopted fixed parameter values of  = 3.5,  = 8.3, and  = −3.3.However, we have studied the behaviour of the results presented here when these parameters are varied along the default bounds range for fit_blabckbody() and found that the results remain unaltered.In all cases a different gaussian noise (different random seed) is added to each spectra to obtain the desired S/N ratio.The spectral resolution of both spectra is set at 3.5 Å/pix and they consist of 541 spectral points.Throughout all this work, we've consistently measured the S/N ratio using NIRDust's compute_noise class method.This method calculates the noise by determining the standard deviation of the continuum-subtracted spectrum within a user-defined wavelength interval.This interval must be carefully chosen to represent the noise characteristics of the entire spectrum.Subsequently, the mean signal within this interval is divided by the calculated noise value yielding an average S/N ratio per pixel.
In Fig 1 the results for the first test are presented.In this case the S/N of both synthetic spectra are equal and varied from 20 to 500 for each value of temperature, with a higher sampling for S/N < 100.The fitting procedure was run with higher number of iterations (niter=700) instead of the default value (niter=200) of iterations to achieve convergence in the low S/N points.The deviation of the fitted temperature from the real value, Δ, for different S/N is shown in the top left panel.In the top right, bottom left and bottom right panels the variations for the , , and  parameters are respectively presented.At high S/N (≳ 150) the temperature is accurately estimated for temperatures below 900 K, but for higher temperatures a systematic and constant overestimation of ≲ 50 K is obtained.However, with decreasing S/N (20-50), lower temperatures show an increase in the overestimation reaching Δ ∼ 100 K.As can be seen in the other three panels,  and  follow the same trend, remaining constant for S/N ≳ 150 and deviating for lower S/N in the cases of the lower temperatures (≲ 900 K).The  parameter remains constant along the entire T and S/N ranges and represents a minor contribution to the total flux (< 1%).
Summarizing, for all values of temperature we find that the uncertainty remains below 150 K with a tendency to decrease for higher temperatures, as one would intuitively expect.To achieve an uncertainty below 50 K a Target Spectrum with S/N≳ 150 is required.It is important to remark that in all cases with S/N ≥ 20 the uncertainty correspond to a systematic overestimation.The user can consider this as a "correction factor" that can be applied to the obtained temperature.An example of this correction is presented in Subsec.4.2.
Three additional cases where the S/N of the Reference Spectrum is lower than the S/N of the Target Spectrum are presented in Appendix A.
In Fig. 2 we present results regarding the application of masks used to remove spectral features or high noise regions.The test consisted on computing the difference between the fitted temperature and the real temperature of the synthetic spectrum for different masking scenarios.Through this analysis, our objective was to discern the presence of spectral regions and/or a minimum of available spectral points crucial for accurate dust temperature determination, emphasizing the necessity for meticulous consideration when implementing masking strategies.The synthetic spectra are the same as used in the previous test but the S/N is fixed at a high value of 800 to minimize the uncertainties introduced by the gaussian noise.
Four cases where considered: • "4 intervals" mask: a mask consisting of 4 equi-distant and equisized intervals distributed along the spectral range (top left panel).
• "Blue interval" mask: a mask consisting of one interval in the blue part of the spectrum at 2.07 m (top right panel).
• "Red interval" mask: a mask consisting of one interval in the red part of the spectrum at 2.24 m (bottom left panel).
• "Central interval" mask: and a mask consisting in one interval in the central part of the spectral range at 2.15 m (bottom right panel).In all cases the percentage of removed points is the sum of the masked intervals and increases between 0 and 60%.
In all cases the uncertainty in the estimated temperature is mainly constant until a 30% of mask percentage is reached.Taking into account that the S/N of the spectra involved in this test is of 800 it can be considered that this initial overestimation of the temperature is attributable to the S/N effect as analyzed in the previous test.As the masking percentage increases, however, the uncertainty in the obtained temperature changes in all the cases except the 4 intervals mask (top left panel).In the other three cases, the uncertainty increases and even changes sign.This is expected since the 4 intervals mask is the one that keeps higher amounts of points distributed along the spectral range and hence is expected to retain the information of the continuum slope.Therefore, if the mask involved consists of one large interval placed anywhere along the spectral range it is not recommended to mask beyond 30% of the points.

Real spectra: Centaurus A
We have used three different sets of spectra of NGC 5128 (Centaurus A), obtained with different instruments and focal plane sampling techniques, to measure the hot dust temperature and compare it to the temperature reported by Burtscher et al. (2015) of (796 ± 1) K for the hot dust in Cen A nucleus measured in a 1" diameter aperture.Their spectra were selected from the ESO SINFONI (Eisenhauer et al. 2003)  The legend shows the temperatures of the blackbody used to construct the synthetic Target Spectrum in each case.The vertical axis in all panels shows the respective difference of the estimated value of a parameter minus its true value.The horizontal axis corresponds to the S/N ratio of the Target Spectrum that is equal to the S/N ratio of the Reference Spectrum in this case.seeing of 0.6" taken in March-April, 2005(Neumayer et al. 2007).NGC 5128 was chosen as the primary subject of our comparative study due to the availability of two extra suitable datasets for direct analysis obtained with Flamingos-2 and GNIRS both at the Gemini Observatory.Additionally, Burtscher et al. kindly provided us the SINFONI cube of NGC 5128 they used in their work and the spectrum of the star they used as Reference Spectrum for the stellar population HD 176617 (private communication).We adopted a distance of 3.84 Mpc for NGC 5128 (Rejkuba 2004) to calculate the linear radii in pc.
For this comparative analysis we used two different approaches for the Reference Spectrum in order to compare them: in one hand an off-nuclear spectrum of the same galaxy as described in Sec.2.1 (Reference 1), and in the other hand, the spectrum of the star used in Burtscher et al. (2015) (Reference 2).
We extracted Target and Reference spectra from our two datasets: •   longslit spectra taken with Flamingos-2 (Eikenberry et al. 2008;Gomez et al. 2012) at Gemini South with PA =151°( semimajor-axis direction), on February 21, 2021.The percentage of masking implemented is of 30% and the mask consist of 8 narrow intervals distributed along the band with bigger presence in the blue part of the spectra.Taking this into account and considering the behaviours of similar masks presented in Fig. 2 (the cases of masks composed of 4 intervals and one blue interval) the uncertainty is expected to be dominated by the S/N of the spectra (see subsec.4.1).
• A   data cube taken with GNIRS (Elias et al. 2006) at Gemini South in 2005 (Díaz et al. 2021, Program ID GS-2005A-Q-38).The percentage of masking is of 10% and the mask consist of one interval in the red part of the spectrum.For this kind of mask, the uncertainty is expected to be only attributed to the S/N.
In the top panel of Fig. 3, the Flamingos-2 spectra are displayed for different radii, spanning the range from 0 to 43 pc, on both sides of the slit.The nuclear spectrum, designated as the Target Spectrum, is highlighted in red, while the Reference Spectrum is depicted in black.Notably, the blue spectra extracted from various radii exhibit a consistent slope of the spectral continuum across all spectra except the nuclear one.This means that the excess punitively produced by the hot dust emission is present only in the nuclear spectrum and hence all the other blue spectra displayed in the Figure have  Central interval T=500 T=600 T=700 T=800 T=900 T=1000 T=1100 T=1200 T=1300 T=1400 T=1500 T=1600 Figure 2. Uncertainty in the estimated temperature when varying the percentage of points removed from both the Target and the Reference spectra for different temperatures using mask_spectrum().Four masks were implemented: 4 equi-distant and equi-sized intervals distributed along the spectral range (top left panel); one interval in the blue part of the spectrum at 2.07 m (top right panel); one interval in the red part of the spectrum at 2.24 m (bottom left panel); and one interval in the central part of the spectral range at 2.15 m (bottom right panel).In all cases the percentage of removed points is the sum of the masked intervals.The temperatures showed in the legend are the temperatures of the blackbody model of the synthetic Target Spectrum in each case.
a substantial separation from the nucleus.For the GNIRS dataset, shown in the bottom panel of Fig. 3, a distinct approach was necessary due to the instrument's limited field of view (FOV).Instead of employing annular apertures, circular apertures were extracted from different regions surrounding the nucleus at a fixed distance of 2.25".Integrating these circular aperture extractions yielded the Reference Spectrum.As a result of this methodology, Fig. 3 exclusively showcases the Target Spectrum and the Reference Spectrum.It's imperative to note that the validation of the Reference Spectrum's integrity was supported by the Flamingos-2 spectra observations, ensuring the absence of red excess beyond the nucleus.
The characteristics of the four extracted spectra, along with the SINFONI spectra from Burtscher et al. (2013), are summarized in Table 1.The table includes information on the masking percentage, the temperature obtained using NIRDust, and the expected uncertainty calculated from the S/N the two spectra involved in each fit.The table is divided into three parts corresponding to the instrument used to capture the Target Spectrum.For the Flamingos-2 and GNIRS data, there are two Reference Spectra: one extracted from the same galaxy (reference 1) and the SINFONI spectrum of HD 176617 (ref-erence 2).A good fit for the SINFONI Target Spectrum could not be obtained using a Reference Spectrum extracted from the same data cube.Therefore, this result is not included in the table.
In Fig. 4 we present the NIRDust fitting results for the 5 combinations of spectra described in Table 1.We obtained temperatures of 662 K (Reference 1) and 667 K (Reference 2) from the Flamingos-2 spectrum and of 697 K (Reference 1) and 607 K (Reference 2) from the GNIRS data cube.As previously mentioned, the synthetic spectra tests of Sec.4.1 showed that the S/N of the spectra causes an overestimation of the temperature.We present the overestimation of the temperature estimated for each pair of spectra in column 8 of Table 1.Sec.4.1.For the SINFONI spectrum, the obtained dust temperature is 649 K, which is 147 K lower than the temperature of 796 K reported by Burtscher et al. (2015).Nevertheless, all temperatures obtained with NIRDust are consistent with each other within a typical uncertainty of ∼ 100 K. Since both the Target and Reference spectra from SINFONI are the same as in Burtscher et al. (2015), this difference in temperature may arise from differences in the methodology, specifically the equation for the linear combination used to perform the fitting.Despite this difference is worth noting Table 1.Description of the three data sets used to measure the dust temperature with NIRDust.The obtained results are presented in column 7. The masking percentage is only indicated for the Reference Spectrum as may not be the same for all the references.The Target Spectrum presents the same masking percentage as the Reference in each case.More extensive experiments on the impact of the Reference Spectrum using different options and data sets are necessary in order to further constrain the uncertainties involved in the estimation of the dust temperature using the method described in Sec. 2.

SUMMARY AND FUTURE WORK
In this work we have presented an analysis on the proposed model to describe the NIR emission of hot dust in Type 2 AGNs.We designed a set of multiple synthetic spectra that allowed a thorough analysis on the behaviour of the mathematical model that describes the physics of the emitting dust.This study provided useful insights at the moment of analysing real spectra from Flamingos-2 (Gemini South), GNIRS (Gemini North) and SINFONI (VLT).
The results presented here can be summarized in the following key points: • The parametrization choice of the model in terms of  = {, , , } and a basin-hopping optimization algorithm are suitable to detect the hot dust component in real spectra.
• The tests performed over synthetic spectra show that estimated temperature presents a systematic error which value depends primarily on the S/N of the Target Spectrum and can be accurately characterized for each dataset.In most cases the error of the temperatures is below 100 K for S/N ≥ 20; for the extreme cases of low T and low S/N the error can rise up to 150 K.
• The five dust temperatures obtained for NGC 5128 (Centaurus A) using three independent data sets from Flamingos-2 (662 K and 667 K), GNIRS (697 K and 607 K) and SINFONI (653 K) and two different Reference Spectra for the first two data sets are consistent within a typical uncertainty of ∼ 100 K.The obtained temperatures for the three data sets fall in the low temperature regime for Type 2 AGN NIR emitting dust.
• The comparison of the dust temperatures obtained with NIR-Dust for the SINFONI spectrum used by Burtscher et al. (2015) for NGC 5128 yields a difference of 147 K with their reported temperature of 796 K.
To achieve these results we developed NIRDust, an open source Python package that uses K-band rest frame spectra to detect hot dust in Type 2 AGNs and measure its temperature.This package is open to the astronomical community and is an effort to provide a standardized and reproducible procedure to measure the temperature of hot dust present in these objects.The performance of NIRDust in the presence of gaussian noise is satisfactory and the uncertainties involved can be estimated.
As a continuation of this work we intend to characterize the impact of different Reference Spectrum choices on the estimated temperature.New features will be added, like an optional power law function in the model to account for any scattered disk accretion emission present in the Target Spectrum.1.First row corresponds to the Flamingos-2 Target Spectra, the second row to the GNIRS Target Spectra and the third row to the SINFONI Target Spectra.For the first two rows the left column corresponds to the Reference Spectrum extracted from the same galaxy and the right column corresponds to the cases where the spectrum of HD 176617 was used as reference.In the 5 cases the plots are the actual output of NIRDust, to see the obtained temperatures reference to Table 1 Rejkuba M., 2004, A&A, 413, 903 Riffel R., Pastoriza M. G., Rodríguez-Ardila A., Bonatto C., 2009, MNRAS, 400, 273 Riffel R., et al., 2022, MNRAS, 512, 3906 Stalevski M., Tristram K. R. W., Asmus D., 2019, MNRAS, 484, 3334 Thatte N., Quirrenbach A., Genzel R., Maiolino R., Tecza M., 1997, ApJ, 490, 238 Van Rossum G., Warsaw B., Coghlan N., 2001, Python. org, 1565 Wales D. J., Doye J. P. K., 1997, Journal of Physical Chemistry A, 101, 5111

APPENDIX A: TESTS
Here we present three complementary tests to the ones described in Subsec.4.1 using synthetic spectra.In these cases we consider different relative proportions of S/N between the Target and Reference spectra.The construction of the spectra follow the same steps as described before: fixed parameter values of  = 3.5,  = 8.3, and  = −3.3, and temperatures values ranging between 500 and 1600 K.The stellar population of the Reference spectrum is modeled as a decreasing linear function.
In Figures A1, A2 and A3 we present the results for the scenarios where the S/N of the Reference Spectrum is 75%, 50% and 25% of the S/N of the Target Spectrum, respectively.
In the three cases the behaviour of the parameters T, , , and  is similar to the case where the S/N of both spectra is equal (Fig. 1).However, a slight difference is noticeable in the low S/N regime: as the S/N fraction of the Reference Spectrum decreases, the point where the lowest temperatures raise their uncertainty occurs at higher Target Spectrum S/N.

APPENDIX B: APPLICATION EXAMPLE
In this subsection we present an application example of the simplest case scenario.A more complete example can be found in the Github repository of the project 1 .In this example the fitting is performed over the nuclear spectrum of the galaxy but the reader should keep in mind that NIRDust can be applied at any radius where the dust component is present.
The first step is to read the spectrum from a FITS file, providing the name of the file and the redshift of the galaxy.Then it is necessary to follow some steps in order to "clean" the spectrum of undesirable spectral features such as emission/absorption lines or residuals from the reduction process.The user may need to cut the borders of the spectrum due to higher noise or to remove spectral features such as the CO band usually present in the end of the   filter.All this steps can be performed with the functionalities described in the previous subsection.The impact of these operations on the best-fit solution is evaluated in Section 4. These procedures must be followed for both spectra: the Target and the Reference.Once both spectra are pre-processed, the function fit_blackbody() can be executed to obtain the model that best describes the data.The initial values and bounds for the parameters can be provided by the user along with the amount of iterations required.As well, the contribution of the  term can be limited through the gamma_target_fraction parameter.In this example the bounds, the amount of iterations, and the limit on the  term are initially given to the function.In Fig. B1 an example of the output plot is presented.
>>> import n i r d u s t a s nd >>> import m a t p l o t l i b .p y p l o t a s p l t

# Read t h e two s p e c t r a f r o m t h e FITS f i l e # t h e r e d s h i f t f o r t h i s g a l a
x y i s 0 .0 0 1 8 3 >>> t a r g e t _ s p e c t r u m = nd .r e a d _ f i t s ( . . . " n u c l e a r _ s p e c t r u m .f i t s " , z = 0 .0 0 1 8 3 ) >>> r e f _ s p e c t r u m = nd .r e a d _ f i t s ( . . ." e x t e r n a l _ s p e c t r u m .f i t s " , z = 0 .0 0 1 8 3 )

# Cut t h e b o r d e r s o f t h e s p e c t r u m i n A n g s t r o m s
1 https://github.com/Gaiana/nirdust# T h i s i s u s e r d e f i n e d >>> c u t _ t g t = t a r g e t _ s p e c t r u m .c u t _ e d g e s ( . . . 2 0 6 0 0 , 2 2 7 0 0 ) >>> c u t _ r e f = r e f _ s p e c t r u m .c u t _ e d g e s ( . . . 2 0 6 0 0 , 2 2 7 0 0 )

# F i n d s p e c t r a l l i n e s and c o n s t r u c t t h e masks
>>> l i n e s _ t g t , i n t e r v a l s _ t g t = \ . . .nd .l i n e _ s p e c t r u m ( c u t _ t g t , n o i s e _ f a c t o r = 5 .5 ) >>> l i n e s _ r e f , i n t e r v a l s _ r e f = \ . . .nd .l i n e _ s p e c t r u m ( c u t _ r e f , n o i s e _ f a c t o r = 3 .5 )

# A p p l y t h e mask t o t h e s p e c t r a
>>> m a s k _ t g t = c u t _ t g t .m a s k _ s p e c t r u m ( . . .l i n e _ i n t e r v a l s = i n t e r v a l s _ t g t ) >>> m a s k _ r e f = c u t _ r e f .m a s k _ s p e c t r u m ( . . .l i n e _ i n t e r v a l s = i n t e r v a l s _ r e f )

# O b t a i n t h e v a l u e o f t h e f i t t e d t e m p e r a t u r e
>>> T = r e s u l t .t e m p e r a t u r e .v a l u e

# V i s u a l i z e t h e h o t d u s t s p e c t r u m and t h e model
>>> a x i s = r e s u l t .p l o t ( show_components = T r u e ) >>> p l t .show ( )

B1 Quality
Quality is a user-determined characteristic and not a technical feature, which is based on the user's experience with a product with respect to their interests and requirements, which may vary over time (Feigenbaum 1983).From developer perspective software quality can be composed of qualitative and quantitative metrics.For NIRDust we determine our quality threshold by defending a coding standard, code coverage, unit tests and continuous integration.We chose to follow the PEP-8 standard (Van Rossum et al. 2001), which defines a coding style convention proposed by the Python community, both for the standard language library and in community projects.Following PEP-8 ensures that any Python programmer has a reasonable understanding of the code written and makes it easier to find collaborators and maintain the project over time.This standard are enforced using the Flake-8 tool2 , that automatically checks deviations in style and will help minimize the code-errors in future versions.In addition to style and maintainability, it is clearly obvious that we want NIRDust to work properly on all computers on which it is deployed, taking into account the heterogeneity of operating systems and Python versions.For this reason, we have implemented 93 Unittesting to validate that the individual components of the software work correctly (Jazayeri 2007).NIRDust is tested for Python 3.8, 3.9 and 3.10, reaching 99% of code-coverage (Miller & Maloney 1963), or in other words our test-suite executes almost all the code of the project.
The source code is hosted in a public GitHub repository3 with a open-source MIT-License4 The committed versions of code are automatically tested with a continuous-integration workflow implemented with GitHub Actions5 (Fowler & Foemmel 2006), and the documentation is built from the repository and made public in the read-the-docs service6 (Holscher et al. 2010).
The project is available in the Python-Package-Index (PyPi)7 throught the pip installer8 .Finally, the project is registered in the Astrophysics Source Code Library (ASCL, Allen & Schmidt 2015)9 .This paper has been typeset from a T E X/L A T E X file prepared by the author.

Figure 1 .
Figure1.Results of the fitting procedure when varying the S/N of both the Target and the Reference spectra for different temperatures.The legend shows the temperatures of the blackbody used to construct the synthetic Target Spectrum in each case.The vertical axis in all panels shows the respective difference of the estimated value of a parameter minus its true value.The horizontal axis corresponds to the S/N ratio of the Target Spectrum that is equal to the S/N ratio of the Reference Spectrum in this case.

Figure 3 .
Figure3.Top panel: Flamingos-2 spectra extracted at different radii (r) at both sides of the slit (SE and NW directions).In red and black the Target and Reference spectra are highlighted.Bottom panel: GNIRS spectra extracted at the nucleus (Target) and at 42 pc of radius (Reference), in this case the Reference Spectrum is a combination of spectra extracted at 42 pc in several regions of the IFU field, for more details see the text.The dotted black line is a guide to compare the Target and Reference spectra slopes.

Figure 4 .
Figure 4. NIRDust fitting results for the 5 combinations of spectra described in Table1.First row corresponds to the Flamingos-2 Target Spectra, the second row to the GNIRS Target Spectra and the third row to the SINFONI Target Spectra.For the first two rows the left column corresponds to the Reference Spectrum extracted from the same galaxy and the right column corresponds to the cases where the spectrum of HD 176617 was used as reference.In the 5 cases the plots are the actual output of NIRDust, to see the obtained temperatures reference to Table1 a r e e q u a l l y s a m p l e d : >>> t g t , r e f = nd .m a t c h _ s p e c t r a l _ a x e s ( . . .m a s k _ t g t , m a s k _ r e f )# F i t >>> b o u n d s = (

Figure A1 .Figure A2 .Figure A3 .Figure B1 .
Figure A1.Uncertainty in the estimated parameters when varying the S/N of both the Target and the Reference spectra for different temperatures.The temperatures showed in the legend are the temperatures of the synthetic Target Spectrum in each case, the S/N of the Reference Spectrum corresponds to 75% of the S/N of the Target Spectrum.
the potential to serve as a reliable Reference Spectrum.Our choice, however, was directed towards one of the more distant spectra, thereby ensuring Burtscher et al. (2015)easured by NIRDust and byBurtscher et al. (2015)fall in the range of relatively low temperature that have been previously reported for Seyfert 2 nucleii such as the one hosted NGC 5128(Riffel et al. 2009). that