To extract Spectrum and Light Curve using LAXPCSOFTWARE (Format-B)
Pre-requirements:
Make a directory that contains “LAXPCSOFTWARE” in a home directory or working directory and is provided by the ASTROSAT website. It provides software that converts laxpc level-1 data to science products.
For recent or updated background spectra, you need to update the software from the LAXPC website or from a website, which can be downloaded from link below. :
https://www.tifr.res.in/~astrosat_laxpc/LaxpcSoft.html
get v3.0 of the software, which contains updated background spectra.
The LAXPC Level-1 Data recent version and release date is mentioned as below:
version 3.4.3, Release:07May2022
Download the data from the ASTROSAT arXiv :
https://astrobrowse.issdc.gov.in/astro_archive/archive/Home.jsp
For example, We are analysing Black Hole source Swift J1658.2-42, observation ID 20180220T02_004T01_9000001910 and Orbit no. 12977.
__________________________________________________________________________________________
Create a working directory in your home called ‘Analysis’ to keep the results.
Unzip the data in the working darectory
> unzip LEVL1AS1LXP20180220T02_004T01_9000001910_12977.zip
Now go to the directory where the data is extracted.
> cd 20180220_T02_004T01_9000001910_level1/laxpc/12977
Here we find four directories lxp1, lxp2, lxp3, aux, hk along with two file .mkf and .xml lxp1, lxp2 and lxp3 are to extract data for laxpc10, laxpc20 and laxpc30 respectively.
For generating lightcurve and spectra of laxpc 10, 20, 30 go to lxp1, lxp2, lxp3 directory respectively. It contains two modes of data one is modeBB and another is modeEA data. Since we are working with event mode data, go to modeEA.
> cd lxpl/modeEA/
______________________________________________________________________________________________
Untar the LAXPCSOFTWARE
> tar -zxvf laxpcsoftv3.0.tar.gz
Steps to use LAXPCSOFTWARE for a given data
open the findfile and give the path after find and before a name. Here we will give the path of data.
> gedit findfile
Original file:
# find /mnt/Data/Data/level-2/ -name "*00000$1*.???" | grep -v lxp2 | grep -v lxp3 | grep -v issdc | grep -v "gti$" | grep -v "frt$" | grep -v "pha$" | grep -v "orb$" | grep -v "att$" | grep -v "lbt$" | grep -v frame | sort > ls2
# find /mnt/Data/Data/level-1/ -name "*00000$1lxp1EA_level1.fits" | sort > ls1
#find /mnt/Data/Data/level-1/ -name "*00000$1*.*" | grep -v lxp2 | grep -v lxp3 | grep -v issdc | grep -v "gti$" | grep -v "frt$" | grep -v "xml$" | grep -v "hk$" | grep -v "orb$" | grep -v "txt$" | grep -v "bti$" | grep -v "aux1" | grep -v "aux2" | grep -v frame | grep -v ".tar" | sort > ls1
find /mnt/Data/Data/level-1/*000$1* -name "*00000$1*.*" | grep -v lxp2 | grep -v lxp3 | grep -v issdc | grep -v "gti$" | grep -v "frt$" | grep -v "xml$" | grep -v "hk$" | grep -v "orb$" | grep -v "txt$" | grep -v "bti$" | grep -v "aux1" | grep -v "aux2" | grep -v frame | grep -v ".tar" | sort > ls1
#find /mnt/Data/Data/level-1/forD/*000$1* -name "*00000$1*.*" | grep -v lxp2 | grep -v lxp3 | grep -v issdc | grep -v "gti$" | grep -v "frt$" | grep -v "xml$" | grep -v "hk$" | grep -v "orb$" | grep -v "txt$" | grep -v "bti$" | grep -v "aux1" | grep -v "aux2" | grep -v frame | grep -v ".tar" | sort > ls1
Edit with Data Path
# find /mnt/Data/Data/level-2/ -name "*00000$1*.???" | grep -v lxp2 | grep -v lxp3 | grep -v issdc | grep -v "gti$" | grep -v "frt$" | grep -v "pha$" | grep -v "orb$" | grep -v "att$" | grep -v "lbt$" | grep -v frame | sort > ls2
# find /mnt/Data/Data/level-1/ -name "*00000$1lxp1EA_level1.fits" | sort > ls1
#find /mnt/Data/Data/level-1/ -name "*00000$1*.*" | grep -v lxp2 | grep -v lxp3 | grep -v issdc | grep -v "gti$" | grep -v "frt$" | grep -v "xml$" | grep -v "hk$" | grep -v "orb$" | grep -v "txt$" | grep -v "bti$" | grep -v "aux1" | grep -v "aux2" | grep -v frame | grep -v ".tar" | sort > ls1
find /home/iucaa/Desktop/laxpcsoft_format_B/20180220_T02_004T01_9000001910_level1/laxpc -name "*00000$1*.*" | grep -v lxp2 | grep -v lxp3 | grep -v issdc | grep -v "gti$" | grep -v "frt$" | grep -v "xml$" | grep -v "hk$" | grep -v "orb$" | grep -v "txt$" | grep -v "bti$" | grep -v "aux1" | grep -v "aux2" | grep -v frame | grep -v ".tar" | sort > ls1
#find /mnt/Data/Data/level-1/forD/*000$1* -name "*00000$1*.*" | grep -v lxp2 | grep -v lxp3 | grep -v issdc | grep -v "gti$" | grep -v "frt$" | grep -v "xml$" | grep -v "hk$" | grep -v "orb$" | grep -v "txt$" | grep -v "bti$" | grep -v "aux1" | grep -v "aux2" | grep -v frame | grep -v ".tar" | sort > ls1
All the four necessary files of the data will save inside ls1.
> sh findfile observation ID
Check all required files in ls1.It contains four files .mkf .tct and two .fits files along with the path (1) .mkf file for information on pointing, orbit etc (2) .tct file from aux subdirectory for conversion from Instrument to UTC time (3) .fits file from ModeBB for BBC mode data (4) .fits file from ModeEA for Event mode data
> more ls1
/home/iucaa/Desktop/laxpcsoft_format_B/20180220_T02_004T01_9000001910_level1/laxpc/12977/AS1T02_004
T01_9000001910lxp_level1.mkf
/home/iucaa/Desktop/laxpcsoft_format_B/20180220_T02_004T01_9000001910_level1/laxpc/12977/aux/AS1T02
_004T01_9000001910lxp_level1.tct
/home/iucaa/Desktop/laxpcsoft_format_B/20180220_T02_004T01_9000001910_level1/laxpc/12977/lxp1/modeB
B/AS1T02_004T01_9000001910lxp1BB_level1.fits
/home/iucaa/Desktop/laxpcsoft_format_B/20180220_T02_004T01_9000001910_level1/laxpc/12977/lxp1/modeE
A/AS1T02_004T01_9000001910lxp1EA_level1.fits
# remove all the files except four needed for laxpcl1.e
move ls1 to laxpcl1.inp (copy and delete ls1)
> mv ls1 laxpcl1.inp
laxpcl1.inp contains all four files which were in ls1.
> more laxpcl1.inp
/home/iucaa/Desktop/laxpcsoft_format_B/20180220_T02_004T01_9000001910_level1/laxpc/12977/AS1T02_004
T01_9000001910lxp_level1.mkf
/home/iucaa/Desktop/laxpcsoft_format_B/20180220_T02_004T01_9000001910_level1/laxpc/12977/aux/AS1T02
_004T01_9000001910lxp_level1.tct
/home/iucaa/Desktop/laxpcsoft_format_B/20180220_T02_004T01_9000001910_level1/laxpc/12977/lxp1/modeB
B/AS1T02_004T01_9000001910lxp1BB_level1.fits
/home/iucaa/Desktop/laxpcsoft_format_B/20180220_T02_004T01_9000001910_level1/laxpc/12977/lxp1/modeE
A/AS1T02_004T01_9000001910lxp1EA_level1.fits
check for the code files
> ls *.f
backshift.f laxpcl1.f
These are two Fortran programs (1) laxpcl1.f : To process the level-1 data and generate the event
file, light curve, spectrum for source and background as well as GTI file(2) backshift.f: To apply gain shift to align the background spectrum with the source spectrum and identify the required response file
To copy into makefile. makefiles are provided to compile the program using gfortran compilers.
> cp makefile.gfortran makefile
To execute the program. The executable file is produced with extension .e
> make laxpcl1
gfortran -O3 -o laxpcl1.e laxpcl1.f
To creates lxp1level2.gti
> ./laxpcl1.e
It will ask the following inputs from the terminal
Type lxp,tbin,anode
# lxp: S. no. of LAXPC detector (1-3) 1 for LAXPC10 …. 3 for LAXPC30
# tbin: Time bin for light curve 1 or 2 or 3 (in seconds for light curve)
# ian: Anodes to be used for light curve/ spectrum '0' for all anodes.
1 for layer1 ; 2 for Anode 2; 3 for layer 2; 4 for Anode 4
5 for layer 3 (anode 5); 6 for layer 4 (Anode 6); 7 for layer 5 (anode 7).
Type channel range for light curve
# The range of Channel no. to be used in light curve (0-1023), type "/" to use all channels
In case if you want to give channel no. (different energy range) then you need to check
channel no. corresponding to energy from response ( fv or fdump *.rmf (response file of
a detector). LX10 and LX30 use 512 channels binned so for light curve, need to multiply by 2.
Similarly LX20 uses 256 channels and need to multiply by 4.
Type No. of channels in spectrum: 1024/512/256# Since response file for LX10 & LX30 is 512 channel (give 512 for these two) ; for LX20 give 256.
Type uld bin (nul), Earth occultation (je), event flag (iev)
Note: nul, je, iev
# first input “nul” : 0 (for ULD BG model) or -1 (for lat and long model in 2 dimension) or -3 (same
with 3 dimension).
nul: ULD bin, used to generate spectrum for a specified value (1-4)
Spectrum will be averaged over time when ULD count is in the
specified ULD bin. The background spectrum would be for
the respective bin. This is useful only for generating
background spectrum in different ULD bins.
nul=0: All ULD values are combined to get source spectrum.
The background spectrum will combine observed background
spectra from all bins in correct proportion
nul=-1: The source spectrum will include full observation
while the background spectrum is scaled from observed
spectrum by a factor which is determined by fit to
background counts with latitude and longitude.
nul=-2: The source spectrum will include full observation
while the background spectrum is scaled from observed
spectrum for layer 1 in channel range (0-200, < approx 20 keV)
by a factor which is determined by fit to background counts with
latitude and longitude. This option should be used for faint sources
when it will use background fit to layer 1 count rate in channel range
0-200 (< approx 20 keV).
nul=-3: Similar to nul=-1, except that background fit in
3D is used
Default value is nul=-1
# 2nd input “je”: 1 for source spectrum or -1 earth occulation
je (1 or -1)
je=1: The source spectrum is generated
je=-1: The spectrum during Earth occultation is generated
# 3rd input “iev”:
iev<0, the event files (.evn and .evn1) are written out. These are
large files and suppressing these files will speed-up the program.
iev>=0, the event files are not written out
iev=1 or -1, only single events where all energy is deposited in one of
the main anodes are selected.
abs(iev).ne.1, double events where at least one energy is the Xe k X-ray
range are also selected. It is difficult to account for these events
when the gain of the detector has shifted. For some cases it may
be better to suppress these, though it will reduce the efficiency
of the detector.
Output files: All output file have prefix lxpi, where i can be 1,2 or 3
depending on which detector is chosen (input parameter LXP).
Since writing of full event file takes too long, that part can
be controlled by using the parameter iev.
The following output files are produced:
lxpilevel2.event: Summary of frames read from level1 EA mode file
Example with an input parameter without filter of uld bin,Earth occultation, event flag :
> ./laxpcl1.e
Type lxp,tbin,anode [1 1.0 0]
2 1 0
Type channel range for light curve [0 1023]
/
Type No. of channels in spectrum: 1024/512/256 [ 256 ]
256
Type uld bin,Earth occultation, event flag [-1 1 2]
-1 1 2
33379 4
5390 75630418.517600000 1110.4633000046015
18210 75636688.763249993 1201.2135799974203
29559 75641715.796959996 46.482339993119240
30754 75642958.657330006 1242.8603700101376
256846904.00000000 256863328.00000000 75644000.899480000
957 1010 256863283.00000000
957 256846844.00000000 1349440.8425156251 75627516.377759993 0.0000000000000000
7 8438 104205 24301440
97039 957 100002 16423 75627578.000000000 75644000.899480000 256863283.00000000 256863328.63004142
8019 4
4 8019
97039 957 100002 0 16423 75627578.000000000 75644000.899480000 256863283.00000000 256863328.63004142 75644000.734999999 94
2
75644000.899480000 75643846.432400003 256863283.00000000 256846844.00000000 256863328.63004142 256846904.96563107 75643955.130820006 75627516.377759993
tobs= 9276.0000000000000 0.73856000602245331
9275.2614399939775 619.22550555178600
502 16423 75644011.103000000 16439.000000000000 75627577.951000005
4 164 16433
0 9275.0000000000000 398.19761082340943 404.99218685800366
0.19708108582507036 0.21326031558546768
uld fraction: 2.2695E-03 3.6323E-01 4.2429E-01 1.7119E-01 4.1284E-02 0.0000E+00
count 5594515.0000000000 5170050
4 5594515
16384 6.1035156250000000E-005
0
1.00000E+00 5.64807E-01 9.76928E-01 1.21788E-04
Example with an input parameter with filter of uld bin,Earth occultation, event flag:
> ./laxpcl1.e
Type lxp,tbin,anode [1 1.0 0]
2 1 0
Type channel range for light curve [0 1023]
/
Type No. of channels in spectrum: 1024/512/256 [ 512 ]
256
Type uld bin,Earth occultation, event flag [-1 1 2]
-1 1 2
33379 4
5390 75630418.517600000 1110.4633000046015
18210 75636688.763249993 1201.2135799974203
29559 75641715.796959996 46.482339993119240
30754 75642958.657330006 1242.8603700101376
256846904.00000000 256863328.00000000 75644000.899480000
957 1010 256863283.00000000
957 256846844.00000000 1349440.8425156251 75627516.377759993 0.0000000000000000
7 8438 104205 24301440
97039 957 100002 16423 75627578.000000000 75644000.899480000 256863283.00000000 256863328.63004142
8019 4
4 8019
97039 957 100002 0 16423 75627578.000000000 75644000.899480000 256863283.00000000 256863328.63004142 75644000.734999999 94
2
75644000.899480000 75643846.432400003 256863283.00000000 256846844.00000000 256863328.63004142 256846904.96563107 75643955.130820006 75627516.377759993
tobs= 9276.0000000000000 0.73856000602245331
9275.2614399939775 619.22550555178600
502 16423 75644011.103000000 16439.000000000000 75627577.951000005
4 164 16433
0 9275.0000000000000 280.00449816544494 286.89382462559718
9.1128172290055057E-002 0.62567358107381210
uld fraction: 2.2695E-03 3.6323E-01 4.2429E-01 1.7119E-01 4.1284E-02 0.0000E+00
count 5594515.0000000000 5591914
4 5594515
16384 6.1035156250000000E-005
0
1.00000E+00 5.64807E-01 9.69406E-01 1.21788E-04
To show Time interval in .gti file. It has total four columns; 1st two are start and end time in instrument time while last two are in UTC time. No of rows will depends on how many good time segment are presnt.
> more lxp2level2.gti
5
7.56275810000000E+07 7.56284780000000E+07 2.56846908623209E+08 2.56847805636685E+08
7.56312500000000E+07 7.56343750000000E+07 2.56850577678320E+08 2.56853702725256E+08
7.56343800000000E+07 7.56347470000000E+07 2.56853707725331E+08 2.56854074730846E+08
7.56370940000000E+07 7.56409510000000E+07 2.56856421766102E+08 2.56860278823955E+08
7.56429700000000E+07 7.56440000000000E+07 2.56862297854383E+08 2.56863327869853E+08
Move created GTI file to gti.inp
> mv lxp2level2.gti gti.inp
To create spectral file go back to step.
> ./laxpcl1.e
Type lxp,tbin,anode [1 1.0 0]
2 1 0
Type channel range for light curve [0 1023]
/
Type No. of channels in spectrum: 1024/512/256 [ 256]
256
Type uld bin,Earth occultation, event flag [-1 1 2]
-1 1 2
33379 4
5390 75630418.517600000 1110.4633000046015
18210 75636688.763249993 1201.2135799974203
29559 75641715.796959996 46.482339993119240
30754 75642958.657330006 1242.8603700101376
256846904.00000000 256863328.00000000 75644000.899480000
957 1010 256863283.00000000
957 256846844.00000000 1349440.8425156251 75627516.377759993 0.0000000000000000
7 8438 104205 24301440
97039 957 100002 16423 75627578.000000000 75644000.899480000 256863283.00000000 256863328.63004142
8019 4
4 8019
97039 957 100002 0 16423 75627578.000000000 75644000.899480000 256863283.00000000 256863328.63004142 75644000.734999999 94
2
75644000.899480000 75643846.432400003 256863283.00000000 256846844.00000000 256863328.63004142 256846904.96563107 75643955.130820006 75627516.377759993
tobs= 9276.0000000000000 0.73856000602245331
9275.2614399939775 619.22550555178600
502 16423 75644011.103000000 16439.000000000000 75627577.951000005
4 164 16433
0 9275.0000000000000 280.00449816544494 286.89382462559718
9.1128172290055057E-002 0.62567358107381210
uld fraction: 2.2695E-03 3.6323E-01 4.2429E-01 1.7119E-01 4.1284E-02 0.0000E+00
count 5594515.0000000000 5591914
4 5594515
16384 6.1035156250000000E-005
0
1.00000E+00 5.64807E-01 9.69406E-01 1.21788E-04
After running two times ( after light curve and spectra are generated).
To generate background spectral file and response file
> make backshiftv3
gfortran -w -O3 -o backshiftv3.e backshiftv3.f
> ./backshiftv3.e
#It will ask the following inputs from the terminal
Type lxp, anode,idi
type .pha file name
lxp2level2back.pha
type lxp,anode,idi [1 0 0]
2 0 0
Type time-bin, channel range for light curve, nul [1 0 1023 -1]
1 0 / -1
66 1188
23 4 69
type .pha file name [ lxp2level2back.pha ]
lxp2level2back.pha
16 16 870 876
background feb18 chosen
Source-ch= 224.4 back-ch= 224.5 shift= -0.0
14 0.28523559570311363
Mean count rate: 200.0 199.9 ratio= 1.001
4 139 -3.2450358072916665E-004
change in count rate= 0.15263149810536447
Response-ch= 224.1 shift= 0.3
use the response file lx20v1.0.rmf
Use gain-offset = -0.17 keV
Output: lxp2level2.spec ; lxp2level2back_shifted.spec ; lxp2level2.lcurv ; response (lx20v1.0.rmf )
Now copy lxp2level2.spec ; lxp2level2back_shifted.spec ; lxp2level2.lcurv ; response
from LAXPCSOFTWARE directory to the working directory where the data is present.
Note: If the LAXPCSOFTWARE and data both are in the same directory then it does not need to
copy these files.
____________________________________________________________________________________________
To generate lightcurve
> lcurve
lcurve 1.0 (xronos6.0)
Number of time series for this task[2] 1
Ser. 1 filename +options (or @file of filenames +options)[Back_lightcurve_3.0_80.0keV.lc] lxp2level2.lcurv
Series 1 file 1:lxp2level2.lcurv
Selected FITS extensions: 1 - RATE TABLE;
Source ............ Swift J1658.2-42 Start Time (d) .... 18169 18:21:48.623
FITS Extension .... 1 - `RATE ` Stop Time (d) ..... 18169 22:55:28.870
No. of Rows ....... 9220 Bin Time (s) ...... 1.000
Right Ascension ... Internal time sys.. Converted to TJD
Declination ....... Experiment ........ ASTROSAT LAXPC
Filter ............ A1-A7 All Event
Corrections applied: Vignetting - Yes; Deadtime - Yes; Bkgd - No ; Clock - YES
values: 1.00000000 1.00000000 1.00000000
Selected Columns: 1- Time; 2- Y-axis; 3- Y-error;
File contains binned data.
Name of the window file ('-' for default window)[-]
Expected Start ... 18169.76514610197 (days) 18:21:48:623 (h:m:s:ms)
Expected Stop .... 18169.95519525313 (days) 22:55:28:870 (h:m:s:ms)
Minimum Newbin Time 1.0000000 (s)
for Maximum Newbin No.. 16421
Default Newbin Time is: 32.108421 (s) (to have 1 Intv. of 512 Newbins)
Type INDEF to accept the default value
Newbin Time or negative rebinning[1]
Newbin Time ...... 1.0000000 (s)
Maximum Newbin No. 16421
Default Newbins per Interval are: 512
(giving 33 Intervals of 512 Newbins each)
Type INDEF to accept the default value
Number of Newbins/Interval[7183] 16421
Maximum of 1 Intvs. with 16421 Newbins of 1.00000 (s)
Name of output file[97020.flc]
Do you want to plot your results?[yes]
Enter PGPLOT device[/xw]
16421 analysis results per interval
100% completed
Intv 1 Start 18169 18:21:50
Ser.1 Avg 509.7 Chisq 0.3115E+05 Var 1722. Newbs. 9220
Min 366.7 Max 716.4 expVar 509.7 Bins 9220
PLT>