1: %%
2: %% Beginning of file 'sample.tex'
3: %%
4: %% Modified 2004 January 9
5: %%
6: %% This is a sample manuscript marked up using the
7: %% AASTeX v5.x LaTeX 2e macros.
8:
9: %% The first piece of markup in an AASTeX v5.x document
10: %% is the \documentclass command. LaTeX will ignore
11: %% any data that comes before this command.
12:
13: %% The command below calls the preprint style
14: %% which will produce a one-column, single-spaced document.
15: %% Examples of commands for other substyles follow. Use
16: %% whichever is most appropriate for your purposes.
17: %%
18: \documentclass[12pt,preprint]{aastex}
19:
20: %% manuscript produces a one-column, double-spaced document:
21:
22: %\documentclass[manuscript]{aastex}
23:
24: %% preprint2 produces a double-column, single-spaced document:
25:
26: %%\documentclass[preprint2]{aastex}
27:
28: %% Sometimes a paper's abstract is too long to fit on the
29: %% title page in preprint2 mode. When that is the case,
30: %% use the longabstract style option.
31:
32: %% \documentclass[preprint2,longabstract]{aastex}
33:
34: %% If you want to create your own macros, you can do so
35: %% using \newcommand. Your macros should appear before
36: %% the \begin{document} command.
37: %%
38: %% If you are submitting to a journal that translates manuscripts
39: %% into SGML, you need to follow certain guidelines when preparing
40: %% your macros. See the AASTeX v5.x Author Guide
41: %% for information.
42:
43: %\usepackage{epsfig}
44: %\usepackage{xspace}
45:
46: \newcommand{\vdag}{(v)^\dagger}
47: \newcommand{\myemail}{@galaxy.far.far.away}
48:
49: %% You can insert a short comment on the title page using the command below.
50:
51: %%\slugcomment{Not to appear in Nonlearned J., 45.}
52:
53: %% If you wish, you may supply running head information, although
54: %% this information may be modified by the editorial offices.
55: %% The left head contains a list of authors,
56: %% usually a maximum of three (otherwise use et al.). The right
57: %% head is a modified title of up to roughly 44 characters.
58: %% Running heads will not print in the manuscript style.
59:
60: \shorttitle{A CLOUDY/XSPEC Interface}
61: \shortauthors{Porter et al.}
62:
63: %% This is the end of the preamble. Indicate the beginning of the
64: %% paper itself with \begin{document}.
65:
66: \begin{document}
67: \title{A CLOUDY/XSPEC Interface}
68:
69: %% Use \author, \affil, and the \and command to format
70: %% author and affiliation information.
71: %% Note that \email has replaced the old \authoremail command
72: %% from AASTeX v4.0. You can use \email to mark an email address
73: %% anywhere in the paper, not just in the front matter.
74: %% As in the title, use \\ to force line breaks.
75:
76: \author{R. L. Porter\altaffilmark{1}, G. J. Ferland\altaffilmark{1}, S. B. Kraemer\altaffilmark{2}, B. K. Armentrout\altaffilmark{2}, K. A. Arnaud\altaffilmark{3}, \& T. J. Turner\altaffilmark{4}}
77:
78: \altaffiltext{1}{Dept. of Physics and Astronomy, University of Kentucky, Lexington, KY, 40506}
79: \altaffiltext{2}{Dept. of Physics, Catholic University of America, Washington, DC, 20064}
80: \altaffiltext{3}{Laboratory for X-ray Astrophysics, Code 662, NASA's Goddard Space Flight Center, Greenbelt, MD, 20771}
81: \altaffiltext{4}{Joint Center for Astrophysics, Physics Department, University of Maryland, Baltimore County, 1000 Hilltop Circle, Baltimore, MD 21250}
82:
83: %%\affil{Dept. of Physics and Astronomy, University of Kentucky, Lexington, KY, 40506}
84: %%\author{S. B. Kraemer \& B. K. Armentrout}
85: %%\affil{Dept. of Physics, Catholic University of America, Washington, DC, 20064}
86: %%\author{K. A. Arnaud}
87: %%\affil{Laboratory for High Energy Astrophysics, Code 660, NASA's Goddard Space Flight Center, Greenbelt, MD 20771}
88:
89: %%\email{gary@pa.uky.edu}
90:
91: \begin{abstract}
92: We discuss new functionality of the spectral simulation code CLOUDY which allows the user to calculate grids with one or more initial parameters varied and formats the predicted spectra in the standard FITS format. These files can then be imported into the x-ray spectral analysis software XSPEC and used as theoretical models for observations. We present and verify a test case. Finally, we consider a few observations and discuss our results.
93: \end{abstract}
94:
95: \keywords{methods: data analysis --- methods: statistical --- X-rays: general}
96:
97: \section{Introduction}
98: X-ray spectrometers typically record photon counts per energy bin. The photon count for each bin is equal to the integral of the incident spectrum times an instrument response function, which is a function of both photon energy and detector bin. In general, this integral cannot be reliably inverted to recover the incident spectrum, in part because inversion techniques tend to be unstable to small changes in the photon count. The solution then is to compare the photon counts recorded by the spectrometer with best-fit theoretical photon counts, calculated by integrating the product of the known instrument response function with theoretical spectra.
99:
100: XSPEC (last described by Arnaud 1996) is an open-source, X-ray spectral-fitting program, first developed in 1983 and still in development today. The current \textit{de facto} standard for X-ray spectral analyis, XSPEC calculates theoretical photon counts from theoretical spectra to find the best fit between the observed and theoretical photon counts. In order to do this, XSPEC must have not only data files containing the observed photon counts, background spectrum, and instrumental response (all of which can be readily obtained), but also theoretical models of any and all spectra that the user believes will accurately represent the actual source spectrum (as a whole or in part). XSPEC comes bundled with many such theoretical models, but can also import external models via two methods: an external subroutine or a table file. The table file option can be used if calculating an individual model is too CPU-intensive. The commands which control the importing of table models are as follows: \texttt{atable} for additive tabular models (intended to represent sources of emission), \texttt{mtable} for multiplicative tabular models (for absorption, filtering, and extinction), and \texttt{etable} for exponential tabular models (for any exponential effects). The purpose of this work is to greatly expand the pool of theoretical models by creating functionality allowing the existing spectral simulation code CLOUDY to produce predicted spectra in a format which the user can import into XSPEC. CLOUDY predictions have been used in XSPEC before (recent examples include Kraemer et al. 2005 and Turner et al. 2005). However, the new functionality discussed here greatly simplifies the process. We consider only additive and multiplicative models.
101:
102: \section{The Spectral Simulation Code CLOUDY}
103:
104: CLOUDY (last described by Ferland et al 1998) is an open-source, one-dimensional, spectral simulation code that has been in continuous development since 1978. Researchers reference use of CLOUDY in over 100 publications a year. The user gives commands specifying physical conditions such as intensity and shape of incident radiation, spatial and chemical composition, and pressure, density, and temperature laws, as well as commands controlling aspects of the microphysics, developmental features, or formatting of output. CLOUDY then calculates a self-consistent solution and reports a predicted spectrum.
105:
106: CLOUDY has long had the ability to vary one of more initial parameters to try to find an optimal set of parameters to fit a specified emission-line spectrum, line flux or luminosity, and/or a set of column densities. The \texttt{optimize} command and its keywords tell the code to vary one or more of the initial parameters to try to find an optimal set of parameters to fit a specified emission-line spectrum, line flux or luminosity, and/or a set of column densities. It uses any of several minimization methods to obtain a best fit to a set of observed quantities. The desired emission-line spectrum, line flux or luminosity, and/or column densities, are specified by a series of optimize commands. A keyword \texttt{vary} can appear on several of the commands used to specify initial conditions to indicate which parameters are to be varied. The commands with this option are listed in CLOUDY's documentation Hazy\footnote[1]{part 1, available at http://www.nublado.org/cloudy\underline{ }gold/hazy.htm}. The optimization architecture lends itself well to computing predetermined grids of models; the code simply varies parameters in regular intervals (determined by the user) instead of in a feedback loop (dependent upon the results of all previous models). %%This observation immediately allowed the variability in a grid of all of the parameters which may be varied by the %%optimizer.
107: More options are planned for the future, including the ability to vary parameters in a second (or even third) spatial dimension. The functionality discussed here will be supported in CLOUDY versions 6.04 and later.
108:
109: The commands used to control the XSPEC interface functionality are as follows:
110: \begin{itemize}
111: \item \texttt{vary} - At least one command must have this option. The value of the parameter specified on this line is ignored.
112: \item \texttt{grid, range X to X} - Each command with the \texttt{vary} option must be followed by this command, which specifies the range of the parameter. Both numbers X are required.
113: \item \texttt{grid, steps X} - This command must appear in order to actually turn on the grid functionality. The other commands will be ignored if this command is not present. The number X is optional and specifies the number of grid points for each variable.
114: \item \texttt{punch xspec mtable "filename"} - Optional. Produces a multiplicative table.
115: \item \texttt{punch xspec atable "filename"} - Optional. Produces an additive table. This command has several options, as follows:
116: \begin{itemize}
117: \item \texttt{[attenuated/reflected] incident continuum}
118: \item \texttt{[reflected] diffuse continuum}
119: \item \texttt{[reflected] lines}
120: \item \texttt{[reflected] spectrum}
121: \end{itemize}
122: The transmitted portion will be selected or ``punched''
123: if neither \texttt{attenuated} nor \texttt{reflected} is included. By ``reflected" we mean components escaping into the $2\pi$~sr subtended by the illuminated face toward the continuum source. If no options are specified for the \texttt{atable} command, the transmitted spectra will be punched. Note that the command can be specified multiple times, allowing the user to individually punch any or all of the separate components of the predicted spectra. A redshift parameter is automatically added to all additive tables, but can be disabled easily in XSPEC. See the discussion of energy binning below for limitations of including a redshift parameter.
124: \end{itemize}
125: The files produced by the punch commands are
126: in the FITS (Flexible Image Transport System) format.
127: FITS is a standard format used in astronomy, and endorsed by both NASA and the International Astronomical Union.
128: The most current definition of the FITS format is by Hanisch et al. (2001).
129: For more information on this format, visit the FITS Support Office website\footnote[2]{http://fits.gsfc.nasa.gov/fits\underline{ }home.html}.
130: A number of FITS image (and data) viewers and format converters are available\footnote[3]{http://fits.gsfc.nasa.gov/fits\underline{ }viewer.html}.
131: (The primary header of any FITS file produced by CLOUDY will list all the commands issued to CLOUDY in \texttt{COMMENT} tags.)
132: The table models used by XSPEC are a subset of the FITS format and are separately defined\footnote[4]{http://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/general/ogip\underline{ }92\underline{ }009/ogip\underline{ }92\underline{ }009.html}.
133:
134: The default energy resolution, $\Delta E/E$, used by CLOUDY is shown in Table \ref{table:resolution}.
135: At $1$~keV, the default resolution of 0.005 corresponds to a resolving power of 200, which will be better than the maximum resolving power achieved by the EPIC-MOS and EPIC-PN cameras on XMM-Newton, but comparable to or less than the maximum resolving power achieved with the Reflection Grating Spectrometer.
136: The resolving powers achieved by the Chandra X-Ray Observatory can be better still, especially with the Low Energy Transmission Grating Spectrometer and the High Energy Transmission Grating Spectrometer.
137: XSPEC will automatically rebin any table model to exactly match the bins of the specific instrument used in the observation, \textit{before} convolving the model with the instrument response function. This rebinning introduces an uncertainty that can be made arbitrarily small by improving CLOUDY's resolution.
138: The command \texttt{set continuum resolution XX} allows the user to modify the default resolution of CLOUDY by a constant factor (e.g., \texttt{set continuum resolution 0.1} will make the resolution ten times finer, or the resolving power ten times greater).
139: The user also has the option of defining a different continuum mesh, as described in Chapter 15 of Hazy 1. This is recommended for analyzing any spectrum which includes $8.16$~keV ($600$~Ryd), as the default resolution becomes 6 times more coarse for energies just above that energy. Note that a finer continuum mesh will be more CPU-intensive.
140:
141: If a redshift parameter is used in XSPEC, it is important that the energy resolution of table models is significantly smaller than the redshift. For example, at $1$~keV, the default resolution of 0.005 will only allow redshifts somewhat greater than 0.005 to be accurately treated. Redshifts comparable to or less than the energy resolution would yield photon counts essentially indistinguishable from the photon count at zero redshift.
142:
143: \section{Examples}
144:
145: As a test, we use CLOUDY to produce a simple blackbody spectrum, varying the temperature of the blackbody from $10^4$~K to $10^6$~K, with 21 logarithmically-spaced values (in $0.1$~dex steps). We set the total luminosity to $10^{39}$~erg~s$^{ - 1}$ and the distance from the source to the illuminated face of the cloud to $10$~kiloparsecs. According to the XSPEC manual, the normalization variable for an identical blackbody in XSPEC would be $K=L_{39}/D_{10}=1$, where $L_{39}$ is the luminosity in units $10^{39}$~erg~s$^{ - 1}$ and $D_{10}$ is the distance to the source in units of $10$~kpc. The spectra produced by CLOUDY are then imported into XSPEC as additive tables.
146:
147: We then create a blackbody model in XSPEC with the command \texttt{model bbody} (setting $kT=0.02$~keV and $K=1.0$), and produce simulated photon counts of the model by convolving the spectrum with an instrument response matrix using the command \texttt{fakeit}. (For the purposes of these test cases we answer ``no" to the question ``Use counting statistics in creating fake data?" This allows us to isolate errors.) For a perfect fit, we expect XSPEC to find $T=0.02$~keV$=232080$~K, or $log(T)=5.3656$, and normalization factor $norm=1$. We impose initial guesses of $log(T)=5.0$ and norm$=2.0$, and XSPEC settles on $log(T)=5.35726$ and $norm=1.00460$. If we decrease the spacing in our CLOUDY grid to $0.05$~dex steps, XSPEC finds $log(T)=5.36386$ and $norm=0.99297$. If, on the other hand, we increase the spacing to $0.20$~dex steps, XSPEC finds $log(T)=5.33856$ and $norm=1.04767$. Figure \ref{fig:blackbody} shows the fit (top-panel) and the ratio of data to folded model (bottom-panel) for the case with $0.05$~dex steps. The decreasing ratio at higher energies is due to errors introduced by the interpolation and can be made arbitrarily small by further decreasing the grid spacing.
148: %%To illustrate the use of a multiplicative table (which can not stand alone and must be multiplied by an additive %%table), we attempt to model the June 20, 1998, ASCA observation of NGC 5548 (Chiang et al. 2000). We punch a %%mutliplicative table, ``absorber.fit", from a CLOUDY grid in which we vary both the ionization parameter and hydrogen %%column density of a simple warm absorber. In XSPEC, we issue the command
149: %%\begin{equation}
150: %%\texttt{model mtable$\left\{\mathrm{absorber.fit}\right\}$(powerlaw)}.
151: %%\end{equation}
152: %%As explained in Chiang et al. (2000), residual dark distribution effects introduce large, uncorrectable errors for %%energies less than about 1 keV in late-mission, bright mode ASCA observations. If we restrict the energy range to %%2-10 keV, we find a reduced $\chi^2 = 1.06$. The data and folded model are shown in figure \ref{fig:ngc5548_better}.
153:
154: To illustrate the use of a multiplicative table (which can not stand alone and must be multiplied by an additive table), we attempt to model the July 9, 1993, ASCA (SIS1) observation of MCG-6-30-15 (Fabian et al. 1994). Following the procedure on page L61 of Fabian et al. (1994), we create a CLOUDY grid with a power law ``of photon index $\Gamma = 2$ and luminosity $10^{43}$~erg~s$^{-1}$, incident onto a shell at inner radius $10^{16}$~cm". We then vary the ionization parameter and column density. Fabian et al. then import the grid of transmitted spectra into XSPEC and find the best-fit column density, $N_\mathrm{w} = 10^{21.8}$~cm$^{-2}$, and ionization parameter, $\xi = 39$~erg~cm~s$^{-1}$ (corresponding to the dimensionless ionization parameter $U=2.38$). Instead of using the transmitted spectra, we punch a multiplicative table, ``absorber.fit", which consists of the total $\exp(-\tau)$ from the illuminated face to the end of the calculation (determined here by the column density). In XSPEC, we issue the command
155: \begin{equation}
156: \texttt{model mtable$\left\{\mathrm{absorber.fit}\right\}$(powerlaw)}.
157: \end{equation}
158: With a total $\chi^2 = 259.7$ and a reduced $\chi^2 = 2.45$, XSPEC finds $\log N_\mathrm{w} = 21.82\pm0.03$~cm$^{-2}$, $\xi = 38.4^{+6.5}_{-5.6}$~erg~cm~s$^{-1}$, and $\Gamma = 2.11\pm0.03$. The data and folded model are shown in figure \ref{fig:mcg63015}. While our photon index is significantly greater than the $\Gamma = 2$ forced by Fabian et al., our other two parameters match their parameters to within the stated uncertainties. Fabian et al. report a total $\chi^2 = 1081$, presumably including both July and August in the same fit, but do not report a reduced $\chi^2$. Note that our model is simply for the demonstration of a multiplicative table and does not have the self-consistency of the Fabian et al. approach.
159:
160: Finally, to illustrate an additive table with emission lines, we model the emission from the X-ray photoionized wind from binary Cygnus X-3.
161: Taking some cues from the appendix of Mitra (1996), but omitting the power law because we find it has little effect, we write the following CLOUDY commands:
162:
163: \begin{verbatim}
164: blackbody 14,000,000
165: luminosity 38.48 range 0.1 keV to 10000 keV
166: radius 11.5 vary
167: grid, range 11 to 12
168: wind 1000 km/sec
169: hden 13
170: grid, steps 11
171: stop zone 1
172: punch last xspec atable spectrum "transpec.fit"
173: punch last xspec atable reflected spectrum "refspec.fit"
174: \end{verbatim}
175:
176: A representative example of the produced reflected spectra is shown in figure \ref{fig:cloudy_example}.
177: In XSPEC, our model is built with the command
178: \begin{equation}
179: \texttt{model phabs(atable$\left\{\mathrm{transpec.fit}\right\}$+atable$\left\{\mathrm{refspec.fit}\right\}$)}.
180: \end{equation}
181: It is important to note that while the interpolation variables in our two tables are identical, and the two tables were produced by the same grid of models, XSPEC allows any variable to be a free parameter or tied to another parameter. In this case we force the radius (from the blackbody to the illuminated face) in our two tables to be tied but separate the normalization parameters. The two normalization parameters then represent relative contributions from the transmitted and reflected spectra.
182:
183: We fit our model to the June 20, 2004, XMM-Newton observation of P.I. Martin Turner (observation ID 0165360101).
184: The observation has been filtered to include only time intervals with less than 7 counts per second and rebinned with a minimum of 20 counts per energy bin. Both of these choices are somewhat arbitrary and based upon visual inspection of the data.
185: We consider only the first order spectrum from RGS1. Our model fits the data with a reduced $\chi^2 = 1.09$. The data and folded model are shown in figure \ref{fig:cygnusx3_xmmn}. The normalization parameter for the reflected spectrum is orders of magnitude greater than the normalization parameter for the transmitted spectrum, indicating that the reflected spectrum provides a much better fit than does the transmitted spectrum. As with the previous example, this is only for demonstration purposes.
186: A more detailed model would likely involve multiple zones and additional varied parameters.
187:
188: %%We fit our models to the June 11, 1993, ASCA observations by Kitamoto (1993). The data are from the SIS0 instrument, %%and include spectra from both a low and high state of X-Ray flux. The data and folded model are shown in figure %%\ref{fig:cygnusx3_asca}.
189:
190: Both XSPEC and CLOUDY are freely available online, and both have accompanying documentation. To download or find more details about XSPEC (or its parent software suite LHEASOFT), visit the NASA website at http://heasarc.gsfc.nasa.gov/docs/software.html. To download or find more details about CLOUDY, visit its homepage at http://www.nublado.org.
191:
192: This research has made use of the Tartarus (Version 3.1) database, created by Paul O'Neill and Kirpal Nandra at Imperial College London, and Jane Turner at NASA/GSFC. Tartarus is supported by funding from PPARC, and NASA grants NAG5-7385 and NAG5-7067. We also acknowledge support from NASA grant NNG04GC56G.
193:
194: \begin{thebibliography}{}
195: %\footnotesize
196: \bibitem[Arnaud(1996)]{arnaud96} Arnaud, K.A., 1996, Astronomical Data Analysis Software and Systems V, eds. Jacoby G. and Barnes J., p17, ASP Conf. Series volume 101.
197: %%\bibitem[Chiang et al.(2000)]{chiang00} Chiang, J. Reynolds, C.S., Blaes, O.M., Nowak, M.A., Murray, N., Madejski, G., Marshall, H.L., \& Magdziarz, P. 2000, ApJ 528, 292.
198: \bibitem[Fabian et al.(1994)]{fabian98} Fabian, A.C. et al. 1994, PASJ 46, L59.
199: \bibitem[Ferland et al.(1998)]{ferland98} Ferland, G. J., Korista, K. T., Verner, D. A., Ferguson, J. W., Kingdon, J. B., \& Verner, E. M. 1998, PASP 110, 761-778.
200: \bibitem[Hanisch et al.(2001)]{hanisch01} Hanisch, R.J. Farris, A., Greisen, E.W., Pence, W.D., Schlesinger, B.M. Teuben, P.J., Thompson, R.W. \& Warnock, A. III. 2001, A\&A 376, 359.
201: %%\bibitem[Kitamoto(1998)]{kitamoto98} Kitamoto 1993
202: \bibitem[Kraemer(2005)]{kraemer05} Kraemer, S.B. et al. 2005, ApJ 618, 155.
203: \bibitem[Mitra(1996)]{mitra96} Mitra, A. 1996, MNRAS 280, 953.
204: \bibitem[Turner(2005)]{turner05} Turner, T.J., Kraemer, S.B., George, I.M., Reeves, J.N., \& Bottorff, M.C. 2005, ApJ 618, 155.
205: \end{thebibliography}
206:
207: \clearpage
208:
209: \begin{deluxetable}{cr}
210: \tabletypesize{\scriptsize}
211: \tablecaption{The default resolution of CLOUDY. }
212: \tablewidth{0pt}
213: \tablehead
214: {
215: \colhead{Energy Range} &
216: \colhead{Resolution ($\Delta E/E$)} \\
217: }
218: \startdata
219: E $< 2.72\times10^{-7}~$keV & 0.1 \\
220: $2.72\times10^{-7}~$keV~$< E < 8.16~$keV & 0.005 \\
221: E $> 8.16~$keV & 0.03 \\
222: \enddata
223: %% \tablecomments{ Place table comments here.
224: %% Text for table notes should follow after the \enddata but before
225: %% the \end{deluxetable}. Make sure there is at least one \tablenotemark
226: %% in the table for each \tablenotetext.
227: %% \tablenotetext{a}{Sample footnote for table~\ref{tbl-1} that was generated with the deluxetable environment}
228: %% \tablenotetext{b}{Another sample footnote for table~\ref{tbl-1}}
229: \label{table:resolution}
230: \end{deluxetable}
231:
232: \clearpage
233:
234: \begin{figure}
235: \includegraphics[angle=-90,width=6in,keepaspectratio=true]{f1.eps}
236: \caption{A test of a blackbody model. The data was derived from XSPEC's built-in \texttt{bbody} model using the \texttt{fakeit} command. The folded model is the convolution of the chosen response matrix and the interpolated CLOUDY spectrum.}
237: \label{fig:blackbody}
238: \end{figure}
239:
240: \clearpage
241:
242: \begin{figure}
243: \includegraphics[angle=-90,width=6in,keepaspectratio=true]{f2.eps}
244: \caption[]{An ASCA observation of MCG-6-30-15 (crosses) and the folded model (solid). See text.}
245: \label{fig:mcg63015}
246: \end{figure}
247:
248: \clearpage
249:
250: \begin{figure}
251: \includegraphics[angle=0,width=6in,keepaspectratio=true]{f3.eps}
252: \caption[]{A sample spectrum produced by CLOUDY, with the default energy resolution. The radius parameter is 11.6, which means the illuminated face is $10^{11.6}$~cm from the center of the blackbody. See text.}
253: \label{fig:cloudy_example}
254: \end{figure}
255:
256: \clearpage
257:
258: \begin{figure}
259: %%\includegraphics*[angle=-90,width=6in,keepaspectratio=true]{cygnusx3_xmmn.eps}
260: \includegraphics*[angle=-90,width=6in,keepaspectratio=true]{f4.eps}
261: \caption[]{Reduced data from an XMM-Newton observation of Cygnus X-3 (crosses) and our folded model (solid).}
262: \label{fig:cygnusx3_xmmn}
263: \end{figure}
264:
265: \end{document}
266: