To extract spectrum

In this tutorial, we will learn how to extract source and background spectra using LAXPC software.

The syantax for source spectrum extraction is

laxpc_make_spectra -u usergti.fits -r resp_files -l Layer_no -g Energy_grouping_factor level2.event.fits

Here,
a) -g is Energy grouping factor flag. The default value is 0.05.
b) -r is resp_files flag. It is OPTIONAL. The correct responses will be picked up by the code in Default mode.

Please see lightcurve generation file for all other filters.

The following output files will be produced
a) spectrum_10.pha, spectrum_20.pha and spectrum_30.pha
b) spectrum_grp_10.pha, spectrum_grp_20.pha and spectrum_grp_30.pha
c) lx10cshm20v1.0.rmf, lx20cshm04v1.0.rmf, lx30cshm28v1.0.rmf

If Layer 1 has been, the files will have an additional _L1 in their names. The last files are GROUPED in energy using grppha command.

NOTE: The spectrum files contains all the Header information of the event file used. Additionally the responses if provided are included. If usergti file has been given then the usergti extention is added to the fits lightcurve file.

Note on Grouping: LAXPC channels can be as many as 1024. The energy range to be considered from say 3-80 keV will have a large number of channels. However, the energy resultion of LAXPC is approximately 15%. So it is optimal to have three energy bins per resultion or at 5% level. The code reads the channel to energy conversion in the response file to group the spectrum at 0.05 level which is the default. The value can be changed by the flag -g . For example -g 0.1 will group at 10% level. Grouping can be shutoff (no group files produced) by -g 0.0 Using the grouped file for spectral fitting is highly recommended.

$ laxpc_make_spectra -u usergti.fits level2.event.fits 
 Event file being used: level2.event.fits                                 
 Output file name: spectrum                                          
 User GTI file name: usergti.fits                                      
 Group energy fraction:    5.00000007E-02
 extracting from all layers 
 Obtained energy information for laxpc           10  using lx10cshm08v1.0.rmf                                          
 Obtained energy information for laxpc           20  using lx20cshp05v1.0.rmf                                          
 Obtained energy information for laxpc           30  using lx30cshp16rho30v1.0.rmf                                     
 Exposure Time =    2519.67725    

Generate Background Spectrum file

The syntax command is

laxpc_make_backspectra -u usergti.fits -g igain -l ilayer -s syserr

NOTE: To run this command you MUST obtain source spectra first for the SAME usergti file and layer. RUN laxpc_make_spectra with the same -u and -l flags BEFORE.
Here,
a) -g is the gain flag.
if igain = 0, the background data closest in time is chosen
if igain = 1, the background data closest in gain is chosen
Default: 0
b) -s is systematic error flag that is added to the background spectrum. The default value is 0.02.
Output:
Background spectra i.e. pha files
backlxp10.pha, backlxp30.pha , backlxp30.pha
or
backlxp10_L1.pha, backlxp20_L1.pha , backlxp30_L1.pha for layer 1

$ laxpc_make_backspectra -u usergti.fits filterfiles 
 Filter file List being used: filterfiles
 GTI file List being used: usergti.fits
 Tstart  Tstop
   0.0000000000000000        2519.6771405339241     
 ------------------
 Finding background for LAXPC           10
 using background data file of apr17
 Difference in days           15
 Difference in gain   -2.0499999999999829     
 Written background file backlxp10.pha
 ----------------------------
 Finding background for LAXPC           20
 using background data file of apr17
 Difference in days           15
 Difference in gain    9.9999999999994316E-002
 Written background file backlxp20.pha
 ----------------------------
 Finding background for LAXPC           30
 using background data file of apr17
 Difference in days           15
 Difference in gain    22.849999999999966     
 Written background file backlxp30.pha
 ----------------------------

Output:

backlxp10.pha, backlxp30.pha , backlxp30.pha

Plotting the spectra

 $ xspec

       XSPEC version: 12.12.1
   Build Date/Time: Wed Mar 16 15:00:27 2022
XSPEC12>data 1:1 spectrum_grp_10.pha

1 spectrum  in use
 
Spectral Data File: spectrum_grp_10.pha  Spectrum 1
Net count rate (cts/s) for Spectrum:1  1.017e+03 +/- 8.479e-01 (77.1 % total)
 Assigned to Data Group 1 and Plot Group 1
  Noticed Channels:  1-78
  Telescope: ASTROSAT Instrument: LAXPC  Channel Type: PHA
  Exposure Time: 2520 sec
 Using fit statistic: chi
 Using Background File                backlxp10.pha
  Background Exposure Time: 6.051e+04 sec
 Using Response (RMF) File            lx10cshm08v1.0.rmf for Source 1

$ XSPEC12>data 2:2 spectrum_grp_20.pha 

2 spectra  in use
 
Spectral Data File: spectrum_grp_20.pha  Spectrum 2
Net count rate (cts/s) for Spectrum:2  1.086e+03 +/- 7.996e-01 (84.6 % total)
 Assigned to Data Group 2 and Plot Group 2
  Noticed Channels:  1-76
  Telescope: ASTROSAT Instrument: LAXPC  Channel Type: PHA
  Exposure Time: 2520 sec
 Using fit statistic: chi
 Using Background File                backlxp20.pha
  Background Exposure Time: 6.048e+04 sec
 Using Response (RMF) File            lx20cshp05v1.0.rmf for Source 1
$ XSPEC12>cpd /xw
$ XSPEC12>pl ld


This will display the X-ray spectrum.

$ XSPEC12>setpl en
$ XSPEC12>ig 1: **-3.0 50.0-**
$ XSPEC12>ig 2: **-3.0 50.0-**

$ XSPEC12>exit

Now you can fit the data with spectral model that best describes the X-ray emission for the source of your interest.