Using SCORPEON Models in XSPECReturn to: Analysis Threads | Analysis Main Page
OverviewThe NICER SCORPEON background model is a new background modeling technique. Unlike other models, SCORPEON produces an adjustable background model which can be fit within XSPEC just like the source spectral model. This page describes how to use the results of SCORPEON within XSPEC. Read this thread if you want to: Use SCORPEON Background Models Last update: 2024-07-19 IntroductionThe NICER X-ray Timing Instrument is non-imaging instrument. This means that for most work, both in spectroscopy and light curve analysis, the background must be subtracted based on an a priori model. As of NICERDAS version 10 (HEASoft 6.31 and later), three backgrond models are included in NICER's software and calibration suite. This page discusses the SCORPEON model and how to use the SCORPEON background models within XSPEC. Like all NICER background models, the SCORPEON model attempts to estimate the background which would apply to a specific spectrum. Various training variables, such as COR_SAX, overshoot count rates, undershoots, etc. are used to make an a priori estimate of the background contributions of each component. As described on the SCORPEON Overview page, there are many background components included within SCORPEON, some of which are due to the X-ray background and some of which are due to non-X-ray background terms such as high energy electrons and cosmic rays. Based upon the limited training variables, SCORPEON is not able to provide an independent estimate of all components. Indeed, there is ambiguity between several of the components, especially the electron-dominated components: for the same level of overshoot counts, the three electron-dominated SCORPEON background components have nearly three orders of magnitude difference in in-band count rate. Because of this, a priori NICER background modeling will always be imperfect to some extent. This statement applies to all NICER background modeling, including SCORPEON, 3C50 and Space Weather. There simply are not enough training variables to constrain all possible background variability. However, SCORPEON has an additional capability that other background models do not. The output of SCORPEON is an adjustable model that can be fit and manipulated within XSPEC. This capability has several major advantages:
A unique feature of using the SCORPEON model is that you are not subtracting the background, you are modeling it along with your source. However, this approach does have some negative impacts. An adjustable background model that must be fit in XSPEC means more work for the analyst. Using a SCORPEON model is not a simple matter of background subtraction, but rather an additional fitting step as well as some need for the analyst to understand the origins of NICER background. Also, adjusting and fitting a SCORPEON background may be infeasible when the scientist is working with a large scale analysis pipeline, or if data must be shared with an analyst that does not use XSPEC. In those cases, SCORPEON does provide an option to produce a background file, similar to the way that the 3C50 and Space Weather models operate. This background file will be simply subtracted from the data by XSPEC and is not adjustable. In this thread, we will discuss the following topics
Producing a SCORPEON Background ModelThere are several ways to produce a SCORPEON background model. In short, the NICER-recommended way is to use the nicerl3-spect task. This task produces all spectral products, including spectrum, responses, and background estimates. The user can control various aspects of the product generation, including which background model to apply. For more information and options, please see the SCORPEON Overview page.
In this example, we will process a fictional observation 2010100101.
For the example, we will download the data into the directory
/path/to/data/2010100101 and process it with nicerl2. Then we will
run nicerl3-spect to generate spectral products. First, we will
change to the working directory where the observation resides.
After running the nicerl3-spect task, there are a number of outputs placed in the 2010100101/xti/event_cl directory, including:
The "Load" Script and Loading Data Into XSPECThe "load" file is a convenience XSPEC script which loads data, responses and backgrounds into XSPEC so that you are ready to begin analysis.
Let's examine what is in this load file. We will use the
Unix "cat" command to list a file's contents:
The "set nicer_bkgspect 1" command sets an XSPEC (TCL) variable to indicate to the background script which spectrum number this will apply to. If you are just fitting one spectrum, this number will always be "1" but if you have multiple spectra (see next sections), you may have different numbers. Finally, the "@2010100101/xti/event_cl/ni2010100101mpu7_bg.xcm" tells XSPEC to execute the SCORPEON background model statements. This is a large file that defines NICER background model templates as well as setting a priori parameter norms. We will get more into these in later sections. Summary for One Spectrum
In summary, to load data into XSPEC you can use the nicerl3-spect
"load" script or you can design your own load process. First you load
the data into spectrum number 1 into datagroup 1.
Multiple Spectra
Neither XSPEC nor SCORPEON are limited to just one spectrum. Users
often have multiple datasets loaded into XSPEC, either joint fitting
between observatories or fitting multiple NICER data sets
simultaneously. Either way, this is supported. Here we give an
example of loading two NICER spectra:
Jointly Fitting Spectra from Different ObservatoriesFitting multiple spectra from different observatories is really no different than fitting multiple spectra from NICER alone. SCORPEON can be used in this case.
Users often have multiple datasets
loaded into XSPEC, either joint fitting between observatories or
fitting multiple NICER data sets simultaneously. Either way, this is
supported. Let's provide an example with NuSTAR and NICER, which is a
common combination:
What do the numbers mean in data / arf / response statements?
In the discussions above, we are using the XSPEC data, background,
response and arf statements to load in various files. Each of these
statements has one or more numbers attached to it. What do they mean?
Let's review these statements.
The first number of the data statement is the data group number that the spectrum is a member of. In this example, we have placed nicer1.pha in the 1st data group. Each data group has its own set of spectral parameters. Typically, although not always, you will want to place each spectrum file into a different data group, so that you can allow total intensities to vary between spectra etc. It is common to use the notation "data 1:1 file1.pha, 2:2 file2.pha" and spectrum 1 will be placed into data group 1, spectrum 2 into data group 2.
The second
number of the data statement (and only number of the background
statement) is the spectrum number. This is how you refer to
each loaded spectrum file. Here we have loaded nicer1.pha as spectrum
number 2. For the background statement, the spectrum number should
refer to the spectrum that was just loaded using the data statement.
The first number of the arf and response statements is the source number. For XSPEC, you can have multple sources that all contribute flux and counts towards a measured spectrum. Note that the source number is NOT the same as the data group or spectrum number. In most basic cases, the source number will be 1. However, as an example of where multiple sources could be useful, consider a NICER observation of a target that has another X-ray source very nearby inside NICER's field of view. You can use two XSPEC sources, one for each of the known X-ray emitting sources in the NICER field of view, and have a model and response for each. In fact, the SCORPEON model is implemented as two extra XSPEC sources, sources 98 and 99 by default, which correspond to the non-X-ray background and X-ray backgrounds, respectively. The "bg.xcm" file handles creating these sources and models. The second number of the response and arf statements is the spectrum number. This spectrum should match the file that was loaded with the "data" statement. For more reference information on how to use these statments, please see the XSPEC manual. Using PythonXSPEC has a Python interface known as PyXspec and SCORPEON supports this. When you run nicerl3-spect, set the parameter outlang=python, and the background and "load" scripts will be written in Python rather than XSPEC's xcm language. Please see the nicerl3-spect page for additional information. Please note that you must have a version of Python that supports PyXspec, and this version must be designated when you build HEASoft. Starting XSPEC and Loading Data
Let's begin by starting XSPEC
During the "load" process, a large number of commands will scroll by. This is normal. During this process all SCORPEON's model templates are defined using XSPEC's mdefine statement, and a priori parameter values are set. Problems Loading? You may encounter problems loading NICER + SCORPEON data into XSPEC. Possible problems:
Let's plot the spectrum in XSPEC. We will use the "X" windows
plotting device.
The result for this fictitious observation could look something like this: At this stage all we have is a background model and no source model, so it is not surprising that we don't have a good match between the model and spectrum. Let's remedy that. Define a Source ModelWith any spectral analysis you need to decide how to model the spectrum of your source. This is typically a case-by-case scientific decision. The selection of the model is outside the scope of this thread. For our purposes we will assume the source can be modeled with an absorbed broken power law or "bknpower" within XSPEC. We define source models as always, using the "model" command. No change to the syntax is required. SCORPEON models are also models, but are stored by default as "sources" 98 and 99. As long as you do not explicitly alter those sources, any model commands you type will not interfere with SCORPEON.
Therefore, we will enter the XSPEC model command that includes absorption
and a broken power law:
As discussed below, we will use the "pgstat" statistic because most
NICER spectra have low counts at high energies where the background is
most dominant.
Now, finally, we will type the "fit" command
Here is the resulting fit after typing "plot ldata ratio":
We can use the XSPEC "flux" command to obtain fluxes in a desired
energy range (0.5-10 keV in this example).
Managing SCORPEON Parameters
Up until this point, we have been ignoring the SCORPEON parameters. Let's take
a closer look. We can use the "show par" XSPEC command to display all of the
active parameters. Unlike a normal case, we see large display of values.
The parameters in the green box at the top are the normal science parameters for whatever model you chose (in this case the absorption and broken pawer law parameters).
The parameters in the magenta/pink box
in the middle are the NXB or
"non-X-ray Background" parameters. This source has two model
components, "niscorpv22_nxb" and "niscorpv22_noise", which are additive.
This entire source is known by it's name, "nxb" and you can set,
freeze and thaw the parameters of this source using that name. For
example we can freeze parameter 4 of the "nxb" model with the
following commands.
The parameters in the blue box at the bottom are the X-ray background terms. This model is known as "sky" to refer to components that are due to the diffuse X-ray sky (local or galactic). There are two components in this model, "niscorpv22_sky" and "niscorpv22_swcx", which are again additive. Important Note. You should never change or thaw the overall model "norm" values from the default values of 1.0 (nxb:8, sky:9 and sky:15 in the list above). An exception to this rule is the noise peak norm (nxb:11). What Are the SCORPEON Parameters?
First of all, let's discuss SCORPEON naming. All of the SCORPEON
model functions begin with a version number. In the example above,
all model functions have the form,
As the SCORPEON model is updated, new versions may become available. In principle the user could compare multiple different versions, since they are all available separately. Each model function has a set of parameters, which we describe briefly here. SCORPEON "niscorpv22_nxb" Parameters
SCORPEON "niscorpv22_noise" Parameters
SCORPEON "niscorpv22_sky" Parameters
SCORPEON "niscorpv22_swcx" Parameters
SCORPEON XSPEC GuidelinesHere we provide some important and basic guidelines for SCORPEON work within XSPEC. Following these guidelines will provide the best results for your analysis. Use a Wide Energy RangeUse as wide an energy range as possible (0.22-15 keV). Even if your target is detectable in a narrow energy range, the background components have different broadband spectra. Using the entire energy range helps SCORPEON distinguish between components.
Use one of the following commands:
Use Poisson StatisticsUse the Poisson statistics ("cstat" or "pgstat") during fitting. Even when your target has a large number of counts in a certain energy band, the counts above 10 keV are typically very low. Using Poisson statistics avoids biases that can distort the background fit.
You can enable Poisson statistics with one of the following commands:
Ignoring Low Energies?Normally, we recommend that you include the full NICER energy range during fits with SCORPEON models. However, you may be forced to ignore low energy channels. For example, because of a highly absorbed source, the spectrum may be systematics-dominated at low energies and add nothing to your fit. In that case, you can ignore low energies, but you should be aware of some changes you should apply to the fitting process. If you are ignoring low energy portions of a spectrum with a SCORPEON model, you should freeze some parameters so that those model components do not become unphysical. If you ignore 0.5 keV and below, freeze the noise_norm, lhb_em and gal_nh parameters. If you ignore 1.0 keV and below, also freeze the halo_em parameter. Check for artifactsCheck for known artifacts that indicate you should adjust how the background is modeled. A more detailed background artifact page is in development. Know that SCORPEON parameters have sensible defaultsAs much as possible, SCORPEON components are parameters are physically-motivated and have physically-motivated parameter values and minimum-maximum parameter ranges. By default, the SCORPEON model that is produced for your data set will have some parameters fixed and some parameters allowed to vary. Unless you have good reason, you should not thaw frozen parameters or change the min/max ranges. The ranges and thawed/fixed settings for each parameter are custom tailored to your observational conditions. In many cases, parameter values are frozen at the values as determined by published literature (for example, CXB power law index, galactic halo temperature, local hot bubble temperature). In other cases, the SCORPEON model provides an estimate as well as an estimated range for the parameters, which are based on published literature or based on measurements taken from NICER background observations. In some cases, such as precipitating electrons (PREL) or the South Atlantic Anomaly (SAA) components, a parameter may be thawed only if NICER passes through the relevant geographic regions where these components are active. In almost every case, the NICER team has attempted to provide sensible and motivated parameter values and ranges. You should be able to type "fit" in XSPEC without being too concerned that parameters will become unphysical. There are some exceptions to this general guideline. Generally speaking the precipitating electron (PREL) component can be highly variable over many orders of magnitude, but only in a very small polar horn geographic region where COR_SAX < 1.5. SCORPEON is currently unable to predict the contribution of this component with high accuracy. When SCORPEON detects that NICER is passing through a region where PREL is potentially active, it sets the normalization to zero but allows it to vary over a wide range. The Low Energy Electron (LEEL) background component is similar, except that it can appear anywhere in the NICER orbit, not just the polar horn regions. Thus, this parameter is always allowed to be free over a wide range. Saving Your Work With "save"
You can save your XSPEC work session using the "save" command. For example,
Modifications
|