Fabrizio Nicastro ****** IMAGING SPECTROSCOPY OF A POINT-LIKE SOURCE: STEP-BY-STEP THREAD ******* # cd to the dir where the data are cd /data/ciao_demo/nic/ # Copying previously saved regions from regions to main dir for manual run cp ./regions/sou.reg ./ cp ./regions/bgd.reg ./ # display data with ds9 and select source and background extraction regions # Data are from a ACIS-S Chandra observation of 3C 295. The source is a # Seyfert 1 in the cluster (z = 4733) (Henry et al., 1985, A.J., 90, 1425). ds9 evt2.fits & # RA = 14:11:23.41 (212.8475) ; DEC = +52:13:31.36 (+52.22538) (2000) # Weighted average nH (cm**-2) 1.33E+20 (from W3nH) # Move the source at the center of the image and zoom-up ===> Center-button to center; zoom-button twice to zoom-up # Select and save source (circle) and background (annulus) regions: ===> Region -> Region Format -> Ciao ===> Region -> Region Coordinate System -> Physical ===> Region -> Save Regions... -> Save As "s.reg" (source) and "b.reg" ===> (background). # Read in pre-save regions "sou.reg", "bgd.reg" ===> Region -> Load Regions... -> "sou.reg" (source) and "bgd.reg" (background) #Exit ds9 # Extract source spectrum: dmextract punlearn dmextract # Describe parameters (essentgially infile/outfile) plist dmextract dmextract infile="evt2.fits[sky=region(sou.reg)][bin pi]" outfile=sou.pi # Extract background spectrum: dmextract punlearn dmextract pset dmextract infile="evt2.fits[sky=region(bgd.reg)][bin pi]" pset dmextract outfile=bgd.pi dmextract # Inspecting the events file: looking for TSTART punlearn dmlist dmlist evt2.fits header |grep TSTART #0028 TSTART 52377343.2940040 Real8 Observation start time # Running 'dmstat' on the source regions of the events file, to find out # mean chipx and chipy coordinates in that regions, during the observation. punlearn dmstat dmstat "evt2.fits[sky=region(sou.reg)][cols chipx, chipy, ccd_id, x, y]" # chipx(mean) = 361.285227, chipy(mean) = 397.837500 ccd_id(mean) = 7 # x(mean) = 3873.765353, y(mean) = 4157.007312 [to be used in mkarf] # Look up FEF (FITS Embedded Function) spectral calibration file (this depends # on the detector coordinates). punlearn acis_fef_lookup # Describe parameters plist acis_fef_lookup acis_fef_lookup chipid=7 chipx=361.285227 chipy=397.837500 type=pi tstart=52377343.2940040 # /soft/ciao/CALDB/data/chandra/acis/cpf/fefs/FP-100/acis7b_x03_y06_FP-100_D1999-08-13fef_piN0001.fits # Make RMF file: punlearn mkrmf # Describe parameters: particularly axis1 vs axis2 (in this case, energy vs pi) plist mkrmf mkrmf infile="/soft/ciao/CALDB/data/chandra/acis/cpf/fefs/FP-100/acis7b_x03_y06_FP-100_D1999-08-13fef_piN0001.fits" outfile=sou.rmf axis1="energy=0.1:11.0:0.01" axis2="pi=1:1024:1" logfile="" # Examining RMF file (1090 rows in MATRIX = (11.0 - 0.1) / 0.01): prism sou.rmf & # Apply SIM (Science Instrument Module) Correction: The input file contains # the optical axis offsets and the SIM offsets in separated columns. # The output file contains the optical axis offsets plus the SIM offsets #for X, Z and ROLL. Needed to built an aspect histogram (to build the ARF) punlearn asp_apply_sim # Describe parameters (infile=aoff.fits outfile=saoff.fits) plist asp_apply_sim asp_apply_sim infile=acisf00578_000N001_aoff1.fits outfile=sim_aoff.fits clobber=yes # Build an Aspect Histogram (needs the events file containing the GTI subspace punlearn asphist # Describe parameters (infile=sim_aoff.fits gtifile=evt2.fits # outfile=asphist.fits. dtffile="Live-Time Correction FILE for HRC") plist asp_apply_sim asphist infile=sim_aoff.fits gtifile="evt2.fits[sky=region(sou.reg)]" outfile=asphist.fits dtffile="" # Make ARF file: punlearm mkarf # Describe parameters (detsubsys = ACIS-In; ACIS-S(n-4); engrid = "same # energy grid used to build the block EBOUNDS in the RMF; or direcly input # the RMF; sourcepixelx and sourcepixely = x and y source physical pixels mkarf detsubsys="ACIS-S3" grating=NONE outfile=sou.arf asphistfile=asphist.fits obsfile=asphist.fits maskfile=NONE engrid="0.1:11.0:0.01" sourcepixelx=3873.765353 sourcepixely=4157.007312 verbose=0 # OR, inputting the RMFs for the energy grid: mkarf detsubsys="ACIS-S3" grating=NONE outfile=sou2.arf asphistfile=asphist.fits obsfile=asphist.fits maskfile=NONE engrid="grid(sou.rmf[cols ENERG_LO, ENERG_HI])" sourcepixelx=3873.765353 sourcepixely=4157.007312 verbose=0 # FILES BUILT: # SOURCE SPECTRUM = sou.pi # BACKGROUND SPECTRUM = bgd.pi # SOURCE RMF = sou.rmf # SOURCE ARF = sou.arf # SAME PROCEDURE FOR BACKGROUND ARF AND RMF, if NEEDED (different events file # taken at different epochs, or "very" different (in detector coordinates) # source and background extraction regions. # # GROUP THE OUTPUT SPECTRUM punlearn dmgroup # Describe parameters: 'binspec' only if grouptype=BIN; 'grouptypeval' if # grouptype=NUM_CTS, NUM_BINS, SNR or ADAPTIVE; column="column cntaining the # data to group; bincolumn="column to group on" (if blank # the group is done on the row number); tab-specification: channels to be # not grouped. plist dmgroup dmgroup infile=sou.pi outfile=sou_grp.pi binspec="" tabspec="" grouptype=NUM_CTS column=COUNTS bincolumn=CHANNEL grouptypeval=15 # Edit the header of the source spectrum to update the keywords BACKFILE, # RESPFILE and ANCRFILE: punlearn dmhedit: dmhedit infile=sou_grp.pi operation="add" key=BACKFILE value=bgd.pi dmhedit infile=sou_grp.pi operation="add" key=RESPFILE value=sou.rmf dmhedit infile=sou_grp.pi operation="add" key=ANCRFILE value=sou.arf # deleting sou*, bgd*, files from main dir rm sou* rm bgd* # ****************************** DONE ************************************* # EXTRACTING SOURCE AND BACKGROUND SPECTRA AND BUILDING RMF AND ARF USING # THE SCRIPT PSEXTRACT # Using same regions selected above for source and background # Copying previously saved regions from regions to main dir for psextract # run cp ./regions/sou.reg ./ cp ./regions/bgd.reg ./ # Running psextract punlearn psextract # Describe parameters (events and bgevents = source and background events # files; root = root name for output files; aoff = aspect offsets file [can be # either SIM-corrected or not]; ptype = pi|pha; gtype, gspec = grouping type # and specifications; plist psextract psextract events="evt2.fits[sky=region(sou.reg)]" bgevents="evt2.fits[sky=region(bgd.reg)]" root=sou aoff=acisf00578_000N001_aoff1.fits # FILES BUILT: # SOURCE SPECTRUM = sou.pi # BACKGROUND SPECTRUM = sou_bg.pi # SOURCE RMF = sou.rmf # SOURCE ARF = sou.arf # Deleting sou* and bgd* files from main dir rm sou* rm bgd* # ****************************** DONE ************************************* # EXTRACTING SOURCE AND BACKGROUND SPECTRA AND BUILDING RMF AND ARF USING # THE NEW VERSION OF THE SCRIPT PSEXTRACT AND WITH A BACKGROUND EXTRACTION # REGION FAR FROM THE SOURCE EXTRACTION REGION # Using same regions selected above for source and an offset region for # background (bgd_off.reg) # Copying previously saved regions from regions to main dir for psextract2 # run cp ./regions/sou.reg ./ cp ./regions/bgd_off.reg ./ # show regions with ds9: ds9 evt2.fits & # Read in pre-saved regions "sou.reg", "bgd_off.reg" ===> Region -> Load Regions... -> "sou.reg" (source) and "bgd)off.reg" ===> (background) cp ./ps2param/psextract2.par ~/cxcds_param/psextract.par # Running psextract # Describe parameters: additional parameter: bgaoff: aspect offsets file # for the background events file [can be either SIM-corrected or not]. In # this case we use the same events file for source and background, and then # leave the gaoff parameter blank: assume gaoff = aoff. plist psextract psextract2 events="evt2.fits[sky=region(sou.reg)]" bgevents="evt2.fits[sky=region(bgd_off.reg)]" root=sou2 aoff=acisf00578_000N001_aoff1.fits bgaoff="" # FILES BUILT: # SOURCE SPECTRUM = sou2.pi # BACKGROUND SPECTRUM = sou2_bg.pi # SOURCE RMF = sou2.rmf # SOURCE ARF = sou2.arf # BACKGROUND RMF = sou2_bg.rmf # BACKGROUND ARF = sou2_bg.arf # Show created files: ls sou2* # Show value of keywords BACKFILE, RESPFILE and ANCRFILE in sou2.pi and # sou2_bg.pi dmlist sou2.pi header |grep BACKFILE dmlist sou2.pi header |grep RESPFILE dmlist sou2.pi header |grep ANCRFILE # ******** dmlist sou2_bg.pi header |grep BACKFILE dmlist sou2_bg.pi header |grep RESPFILE dmlist sou2_bg.pi header |grep ANCRFILE #deleting all sou2* files and *reg files rm sou2* rm *reg # ****************************** DONE ************************************* # FITTING THE DATA IN SHERPA # CD to manually pre-done dir: cd ./pre-done sherpa data sou_grp.pi lp data ignore energy :0.3,3.: lp data xswabs[abs](0.1) pow[pl](2,1,0.01:0:1e10) show source = abs * pl fit goodness abs.1 = 0.0133:0.0133:100 fit goodness # ****************************** DONE ************************************* # FITTING SIMULTANEOUSLY SOURCE AND BACKGROUND SPECTRA WITH DIFFERENT RMFs # AND ARFs #CD to the previously made pre-done_psextract2 dir cd ./pre-done_psextract2 sherpa # fitting the background-subtracted source spectrum with source RMF and ARF # (same case as above) data sou2.pi subtract lp data ignore energy :0.3,3.: lp data xswabs[abs](0.1) pow[pl](2,1,0.01:0:1e10) show source = abs * pl fit goodness abs.1 = 0.0133:0.0133:100 fit goodness lp 2 fit res # fitting the source and background spectra simultaneously, as separated # data sets, and each with its own RMF and ARF erase abs erase pl data 1 sou2.pi data 2 sou2_bg.pi ignore 1:2 energy :0.3,3.: lp data xswabs[abs](0.1) pow[pl](2,1,0.01:0:1e10) pow[plbg](1.4,1,0.01:0:1e10) show source 1 = abs * pl + plbg source 2 = plbg fit 1:2 abs.1 = 0.0133:0.0133:100 fit 1:2 lp 2 fit res