Download the notebook.
CIAO Workshop Exercises¶
This Jupyter notebook uses the bash_kernel
. Users will need to have this kernel installed before they can run the commadns in this notebook.
CIAO 4.12 users with pip3
can use the following commands to install bash_kernel
into their CIAO installtion:
pip3 install bash_kernel
python -m bash_kernel.install --sys-prefix
jupyter kernelspec list
after which they can then run
jupyter notebook
Introduction¶
These exercises are designed to familiarize students with Chandra data and some of the basics of X-ray data analysis using CIAO with Chandra data.
Students will use a variety of tools and scripts to perform typical Chandra data analysis tasks. These exercises are not intended to be a Cookbook for all Chandra data analysis, but rather are meant to expose students to basic X-ray analysis techniques.
Students should already have CIAO installed on their systems. The exercises here have been developed with CIAO 4.12, using the contrib-4.12.4 scripts package, with Chandra CALDB 4.9.2.1. Students should also have MARX installed. These exercises have been developed using MARX 5.5.0. The install_marx script in CIAO can be used to automate the installation process.
ciaover | egrep -v $USER
# # Name Version Build Channel caldb 4.9.2.1 1 https://cxc.cfa.harvard.edu/conda/ciao ciao 4.12.0 py37h04863e7_0 https://cxc.cfa.harvard.edu/conda/ciao ciao-contrib 4.12.3 py_0 https://cxc.cfa.harvard.edu/conda/ciao ds9 8.1 1 https://cxc.cfa.harvard.edu/conda/ciao sherpa 4.12.0 py37h04863e7_0 https://cxc.cfa.harvard.edu/conda/ciao System information:
Getting to know Chandra data¶
In this section students will obtain Chandra data and learn some techniques to inspect the quality of the data and how to reprocess their dataset.
Download Dataset¶
Exercise 1¶
Obtain the standard data distribution for Chandra OBS_ID 13858.
Q: How did you obtain the data (Chaser, download_chandra_obsid, FTP)?
/bin/rm -rf 13858
download_chandra_obsid 13858
Downloading files for ObsId 13858, total size is 68 Mb. Type Format Size 0........H.........1 Download Time Average Rate --------------------------------------------------------------------------- vv pdf 32 Mb #################### 4 s 8581.5 kb/s evt1 fits 22 Mb #################### 3 s 8520.5 kb/s evt2 fits 5 Mb #################### < 1 s 6172.2 kb/s asol fits 4 Mb #################### < 1 s 5480.5 kb/s mtl fits 640 Kb #################### < 1 s 2349.6 kb/s bias fits 493 Kb #################### < 1 s 2767.6 kb/s bias fits 450 Kb #################### < 1 s 2956.8 kb/s bias fits 436 Kb #################### < 1 s 2025.6 kb/s bias fits 422 Kb #################### < 1 s 2956.6 kb/s cntr_img jpg 371 Kb #################### < 1 s 1769.7 kb/s osol fits 368 Kb #################### < 1 s 2532.6 kb/s osol fits 368 Kb #################### < 1 s 2040.8 kb/s stat fits 360 Kb #################### < 1 s 1803.9 kb/s osol fits 358 Kb #################### < 1 s 2338.8 kb/s eph1 fits 308 Kb #################### < 1 s 1813.1 kb/s eph1 fits 303 Kb #################### < 1 s 2323.5 kb/s eph1 fits 283 Kb #################### < 1 s 1646.0 kb/s aqual fits 250 Kb #################### < 1 s 2019.0 kb/s osol fits 129 Kb #################### < 1 s 819.1 kb/s cntr_img fits 77 Kb #################### < 1 s 825.9 kb/s full_img fits 52 Kb #################### < 1 s 462.1 kb/s full_img jpg 42 Kb #################### < 1 s 384.5 kb/s vv pdf 35 Kb #################### < 1 s 334.3 kb/s oif fits 23 Kb #################### < 1 s 245.6 kb/s bpix fits 11 Kb #################### < 1 s 127.1 kb/s readme ascii 11 Kb #################### < 1 s 142.8 kb/s eph1 fits 8 Kb #################### < 1 s 125.6 kb/s flt fits 6 Kb #################### < 1 s 86.3 kb/s fov fits 6 Kb #################### < 1 s 100.8 kb/s msk fits 5 Kb #################### < 1 s 69.8 kb/s pbk fits 4 Kb #################### < 1 s 57.6 kb/s Total download size for ObsId 13858 = 68 Mb Total download time for ObsId 13858 = 12 s
Students may want to uncompress, gunzip, all of the files in the top-level directory, along with the primary and secondary directories at this point.
gunzip 13858/primary/*gz
gunzip 13858/secondary/*gz
download_obsid_caldb 13858 ./CALDB
download_obsid_caldb infile = 13858 outdir = ./CALDB background = no missing = no clobber = no verbose = 1 mode = ql Retrieving files for CALDB_VER = 4.9.2.1 Retrieving CALDB index files Processing infile=13858/primary/acisf13858N001_evt2.fits Retrieving CALDB data files Filename: 0------------------1 telD1999-07-23geomN0006.fits #################### telD1999-07-23aimptsN0002.fits #################### telD1999-07-23tdetN0001.fits #################### telD1999-07-23skyN0002.fits #################### telD1999-07-23sgeomN0001.fits #################### hrmaD1996-12-20axeffaN0008.fits #################### hrmaD1996-12-20vignetN0003.fits #################### acisD1997-04-17qeN0006.fits #################### acisD2010-02-01qeuN0007.fits #################### acisD2000-11-28badpixN0004.fits #################### acisD1999-08-13contamN0013.fits #################### acisD1996-11-01gradeN0004.fits #################### acisD2000-01-29grdimgN0001.fits #################### acisD2000-01-29gain_ctiN0008.fits #################### acisD2005-07-01evtspltN0002.fits #################### acisD2010-01-01ctiN0009.fits #################### acisD2012-05-01t_gainN0008.fits #################### acisD1999-07-22subpixN0001.fits #################### acisD2000-01-29fef_pha_ctiN0004.fits #################### acisD1999-09-16dead_areaN0001.fits #################### hrmaD1996-12-20reefN0001.fits #################### acisD2000-01-29p2_respN0008.fits #################### hrmaD1996-11-01wpsfN0001.fits #################### acisD2000-01-29osip_ctiN0006.fits #################### acisD2002-11-15gtilimN0004.fits #################### Be sure to source the new setup scripts to use these CALDB files. (t)csh: source ./CALDB/software/tools/caldbinit.unix bash: source ./CALDB/software/tools/caldbinit.sh
export CALDB=`pwd`/CALDB
export CALDBCONFIG=`pwd`/CALDB/software/tools/caldb.config
export CALDBALIS=none
Review V&V Report¶
Exercise 2¶
Read the Chandra Verification and Validation report in the top level directory of the data distribution: axaff13858N001_VV001_vv2.pdf
acroread 13858/axaff13858N001_VV001_vv2.pdf &
[1] 10390
Q: Summarize the V&V comments: Joint Proposal: NRAO
Q: What is the target of this observation? SDSS J091449.05+085321.1
Q: What is the sequence number SEQ_NUM of this observation? 702584
echo
acroread: command not found [1]+ Exit 127 acroread 13858/axaff13858N001_VV001_vv2.pdf
Display data in ds9¶
Locate the event files. There are two event files included in the standard data distribution. The Level 1 event file, evt1, is in the secondary/ directory, the Level 2 event file, evt2, is in the primary/ directory.
/bin/ls -1 13858/*/*evt*.fits
13858/primary/acisf13858N001_evt2.fits 13858/secondary/acisf13858_000N001_evt1.fits
Exercise 3¶
Display the Level 2 event file using ds9. Make sure to use Log scale.
ds9 13858/primary/acisf13858N001_evt2.fits -scale log &
[1] 10425
Q: Using the cursor, record the coordinate of the bright source in the center of the image:
xpaset -p ds9 crosshair 4103 4115
xpaset -p ds9 saveimage png ds9_01.png
display < ds9_01.png
xpaget ds9 crosshair wcs fk5 sexagesimal
xpaset -p ds9 mode region
9:14:49.1404 +8:53:20.741
Exercise 4¶
By default, ds9 only shows part of the Chandra dataset. Use the Bin menu to bin the data by a factor of 4 and then by a factor of 8.
Binning is different than Zooming. Zooming is done to the image (so after the event file has been binned). Set bin=1, and then zoom to ⅛.
xpaset -p ds9 bin factor 4
xpaset -p ds9 saveimage png ds9_exercise04_a.png
display < ds9_exercise04_a.png
xpaset -p ds9 bin factor 8
xpaset -p ds9 saveimage png ds9_exercise04_b.png
display < ds9_exercise04_b.png
xpaset -p ds9 bin factor 1
xpaset -p ds9 zoom 0.125
xpaset -p ds9 saveimage png ds9_exercise04_c.png
display < ds9_exercise04_c.png
Q: Describe why the Bin 8 image is different than the image Zoom'ed by ⅛:
**Zooming takes the default 1024x1024 image and samples every 8th row and column to create the display. Binning rebins the original event file with 8x8 pixels.***
Exercise 5¶
ds9 bins all the events in the event file into an image. That includes all events for all time and with all energies.
Use the Bin → Binning Parameters menu to add an energy=500:7000 as a Bin Filter.
xpaset -p ds9 zoom to 1
xpaset -p ds9 bin filter 'energy=500:7000'
xpaset -p ds9 saveimage png ds9_exercise05_a.png
display < ds9_exercise05_a.png
Q: Describe the difference in the images compared to the unfiltered image: Less background noise, max pixel value is lower (see colorbar scale compared to above)
Q: What unit is energy in? eV
Extra Credit¶
Try different energy ranges
xpaset -p ds9 bin filter 'energy=2000:10000'
xpaset -p ds9 saveimage png ds9_exercise05_extra1.png
display < ds9_exercise05_extra1.png
Try different time ranges
dmlist 13858/primary/acisf13858N001_evt2.fits header | grep TST
0047 TSTART 456518974.4871399999 [s] Real8 Observation start time (MET) 0059 TSTOP 456536836.1380900145 [s] Real8 Observation end time (MET) 0085 STARTBEP 301280942 Int4 BEP timer value at TSTART 0086 STOPBEP 1808980142 Int4 BEP timer value at TSTOP -- HISTORY PARM :tstart=TSTART ASC00210 -- HISTORY PARM :tstop=TSTOP ASC00211
xpaset -p ds9 bin filter 'time=456520000:456530000'
xpaset -p ds9 saveimage png ds9_exercise05_extra2.png
display < ds9_exercise05_extra2.png
xpaset -p ds9 quit
[1]+ Done ds9 13858/primary/acisf13858N001_evt2.fits -scale log
Inspect headers¶
Most Chandra data products are FITS files, specifically FITS binary tables, with extensive headers that fully describe the dataset. Students should become familiar with some of the basic keywords and tool used to examine those keywords
Exercise 7¶
Open the Level 2 event file in prism
The EVENTS extension is automatically selected. The Header Keywords are shown in the top, right pane.
prism 13858/primary/acisf13858N001_evt2.fits &
[1] 10920
import prism_exercise7.png
display < prism_exercise7.png
MISSION
: AXAFTELESCOP
: CHANDRAINSTRUME
: ACISDETNAM
: ACIS-5678GRATING
: NONEDATAMODE
: FAINTREADMODE
: TIMEDDATE-OBS
: 2012-06-19T18:49:34OBSERVER
: Dr. Kayhan GultekinONTIME
: 15069.1001159
Q: Record the value for the following keywords:
Q: What units are the ACIS focal plane temperature, FP_TEMP, recorded in? K
xpaset -p prism quit
[1]+ Done prism 13858/primary/acisf13858N001_evt2.fits
Exercise 8¶
Use dmlist with the header option to display the header.
dmlist 13858/primary/acisf13858N001_evt2.fits header,clean | \
egrep '^._TARG|^.*_NOM|^.*_PNT|^SIM_|^DTCOR|^ASCDSVER|^CALDBVER'
ASCDSVER 8.4.5 Processing system revision SIM_X -0.68282252473119 [mm] SIM focus pos SIM_Y 0 [mm] SIM orthogonal axis pos SIM_Z -190.1400660499 [mm] SIM translation stage pos RA_PNT 138.7056392802 [deg] Pointing RA DEC_PNT 8.8865713396 [deg] Pointing Dec ROLL_PNT 241.1563944238 [deg] Pointing Roll RA_NOM 138.7056392802 [deg] Nominal RA DEC_NOM 8.8865713396 [deg] Nominal Dec ROLL_NOM 241.1563944238 [deg] Nominal Roll DTCOR 0.98693426381071 Dead time correction CALDBVER 4.4.10
Q: Record the value for the following header keywords: see above
Q: This is an "ACIS-S" observation. How can you tell this from the event file header information? There is nothing in the header that says this is an 'ACIS-S' observation directly. The value of the
SIM_Z
keyword indicates that the aim point is located on the ACIS-S array
Extra Credit¶
dmkeypar 13858/primary/acisf13858N001_evt2.fits TIMEDEL echo+
3.14104
dmmakepar 13858/primary/acisf13858N001_evt2.fits[events] \
dmmakepar_exercise08.par clob+
pdump dmmakepar_exercise08.par | \
egrep -i '^._TARG|^.*_NOM|^.*_PNT|^SIM_|^DTCOR|^ASCDSVER|^CALDBVER'
ascdsver='8.4.5' sim_x='-0.68282252473119' sim_y='0' sim_z='-190.14006604987' ra_pnt='138.70563928021' dec_pnt='8.8865713395653' roll_pnt='241.15639442377' ra_nom='138.70563928021' dec_nom='8.8865713395653' roll_nom='241.15639442377' dtcor='0.98693426381071' caldbver='4.4.10'
plist dmmakepar_exercise08.par | \
egrep -i '^._TARG|^.*_NOM|^.*_PNT|SIM_|DTCOR|ASCDSVER|CALDBVER'
(ascdsver = 8.4.5) Processing system revision (sim_x = -0.68282252473119) SIM focus pos [mm] (sim_y = 0.0) SIM orthogonal axis pos [mm] (sim_z = -190.14006604987) SIM translation stage pos [mm] (ra_pnt = 138.70563928021) Pointing RA [deg] (dec_pnt = 8.8865713395653) Pointing Dec [deg] (roll_pnt = 241.15639442377) Pointing Roll [deg] (ra_nom = 138.70563928021) Nominal RA [deg] (dec_nom = 8.8865713395653) Nominal Dec [deg] (roll_nom = 241.15639442377) Nominal Roll [deg] (dtcor = 0.98693426381071) Dead time correction (caldbver = 4.4.10)
pget dmmakepar_exercise08.par \
sim_x sim_y sim_z ra_pnt dec_pnt roll_pnt ra_nom dec_nom roll_nom \
dtcor caldbver ascdsver
-0.68282252473119 0 -190.14006604987 138.70563928021 8.8865713395653 241.15639442377 138.70563928021 8.8865713395653 241.15639442377 0.98693426381071 4.4.10 8.4.5
dmhistory 13858/primary/acisf13858N001_evt2.fits acis_process_events | tr " " "\012"
# dmhistory (CIAO 4.12): WARNING: Found and corrected "pixlib" library parameters # dmhistory (CIAO 4.12): WARNING: Found and corrected "pixlib" library parameters acis_process_events infile="/dsops/ap/sdp.10/opus/prs_run/tmp//ACIS_F_L1_456484176n330/output/acisf13858_000N001_tmp_evt1.fits" outfile="/dsops/ap/sdp.10/opus/prs_run/tmp//ACIS_F_L1_456484176n330/output/acisf13858_000N001_evt1.fits" acaofffile="/dsops/ap/sdp.10/opus/prs_run/tmp//ACIS_F_L1_456484176n330/input/pcadf456520092N001_asol1.fits[time=456518974.4871400:456536836.1380900]" apply_cti="yes" apply_tgain="yes" alignmentfile="/dsops/ap/sdp.10/opus/prs_run/tmp//ACIS_F_L1_456484176n330/input/pcadf456520092N001_asol1.fits[time=456518974.4871400:456536836.1380900]" obsfile="/dsops/ap/sdp.10/opus/prs_run/tmp//ACIS_F_L1_456484176n330/output/axaff13858_000N001_obs0a.par" geompar="geom" logfile="/dsops/ap/sdp.10/opus/prs_run/tmp//ACIS_F_L1_456484176n330/output/acis_process_events.log" gradefile="CALDB" grade_image_file="CALDB" gainfile="CALDB" badpixfile="/dsops/ap/sdp.10/opus/prs_run/tmp//ACIS_F_L1_456484176n330/output/acisf13858_000N001_bpix1.fits" threshfile="CALDB" ctifile="CALDB" tgainfile="CALDB" mtlfile="/dsops/ap/sdp.10/opus/prs_run/tmp//ACIS_F_L1_456484176n330/output/acisf13858_000N001_fptemp_egti1.fits" eventdef="{d:time,s:ccd_id,s:node_id,i:expno,s:chip,s:tdet,f:det,f:sky,s:phas,l:pha,l:pha_ro,f:energy,l:pi,s:fltgrade,s:grade,x:status}" doevtgrade="yes" check_vf_pha="no" calc_cc_times="yes" trail="0.027" spthresh="13" time_offset="0" calculate_pi="yes" pi_bin_width="14.6" pi_num_bins="1024" max_cti_iter="15" cti_converge="0.1" tstart="TSTART" tstop="TSTOP" clobber="no" verbose="0" stop="sky" instrume="acis" rand_seed="1" rand_pha="yes" pix_adj="EDSER" subpixfile="CALDB" stdlev1="{d:time,s:ccd_id,s:node_id,i:expno,s:chip,s:tdet,f:det,f:sky,s:phas,l:pha,l:pha_ro,f:energy,l:pi,s:fltgrade,s:grade,x:status}" grdlev1="{d:time,s:ccd_id,s:node_id,i:expno,s:chip,s:tdet,f:det,f:sky,l:pha,l:pha_ro,s:corn_pha,f:energy,l:pi,s:fltgrade,s:grade,x:status}" cclev1="{d:time,d:time_ro,s:ccd_id,s:node_id,i:expno,s:chip,s:tdet,f:det,f:sky,f:sky_1d,s:phas,l:pha,l:pha_ro,f:energy,l:pi,s:fltgrade,s:grade,x:status}" ccgrdlev1="{d:time,d:time_ro,s:ccd_id,s:node_id,i:expno,s:chip,s:tdet,f:det,f:sky,f:sky_1d,l:pha,l:pha_ro,s:corn_pha,f:energy,l:pi,s:fltgrade,s:grade,x:status}"
Reprocess dataset¶
The Chandra calibration database (CALDB) is continually updated. The then most recent CALDB is used for observations as they are taken. Some calibrations, such as the time dependent gain calibrations, can only be definitively computed based on historical observations; thus the file in the current CALDB is always predicted. These calibrations are later updated to be definitive post facto.
The CIAO team strongly advises users to always reprocess data obtained from the archive.
Exercise 9¶
Use chandra_repro to reprocess the dataset.
chandra_repro 13858 out= clob+
Running chandra_repro version: 03 April 2020 Processing input directory '/home/kjg/Workshop/13858' Resetting afterglow status bits in evt1.fits file... Running the destreak tool on the evt1.fits file... Running acis_build_badpix and acis_find_afterglow to create a new bad pixel file... Running acis_process_events to reprocess the evt1.fits file... Output from acis_process_events: # acis_process_events (CIAO 4.12): The following error occurred 2 times: dsAPEPULSEHEIGHTERR -- WARNING: pulse height is less than split threshold when performing serial CTI adjustment. Filtering the evt1.fits file by grade and status and time... Applying the good time intervals from the flt1.fits file... The new evt2.fits file is: /home/kjg/Workshop/13858/repro/acisf13858_repro_evt2.fits Updating the event file header with chandra_repro HISTORY record Creating FOV file... Setting observation-specific bad pixel file in local ardlib.par. Cleaning up intermediate files WARNING: Observation-specific bad pixel file set for session use: /home/kjg/Workshop/13858/repro/acisf13858_repro_bpix1.fits Run 'punlearn ardlib' when analysis of this dataset completed. The data have been reprocessed. Start your analysis with the new products in /home/kjg/Workshop/13858/repro
dmdiff 13858/primary/acisf13858N001_evt2.fits 13858/repro/acisf13858_repro_evt2.fits data- || echo
Infile 1: 13858/primary/acisf13858N001_evt2.fits Infile 2: 13858/repro/acisf13858_repro_evt2.fits ----------------------- HEADER VALUE DIFFERENCES ----------------------- # dmdiff (CIAO 4.12): WARNING: header key "MJD_OBS" not present in infile2. # dmdiff (CIAO 4.12): WARNING: header key "MJD-OBS" not present in infile1. # dmdiff (CIAO 4.12): WARNING: header key "STARTMJF" not present in infile1. # dmdiff (CIAO 4.12): WARNING: header key "STARTMNF" not present in infile1. # dmdiff (CIAO 4.12): WARNING: header key "STOPMJF" not present in infile1. # dmdiff (CIAO 4.12): WARNING: header key "STOPMNF" not present in infile1. # dmdiff (CIAO 4.12): WARNING: header key "OBI_NUM" not present in infile1. # dmdiff (CIAO 4.12): WARNING: header key "TIME_ADJ" not present in infile1. # dmdiff (CIAO 4.12): WARNING: header key "CLSTBITS" not present in infile1. # dmdiff (CIAO 4.12): WARNING: header key "STATFILT" not present in infile1. Message: Keyword: Value(s): Diff: -------- ------- --------- ----- Values are not equal CREATOR cxc - Version DS 8.4 acis_process_events - CIAO 4.12 Values are not equal ASCDSVER 8.4.5 CIAO 4.12 # dmdiff (CIAO 4.12): WARNING: ASCDSVER comments are different. # dmdiff (CIAO 4.12): comment1= "Processing system revision" # dmdiff (CIAO 4.12): comment2= "ASCDS version number" Values are not equal CHECKSUM 9L8RCL6R9L6RCL6R nCkao9iYnAian9iY # dmdiff (CIAO 4.12): WARNING: CHECKSUM comments are different. # dmdiff (CIAO 4.12): comment1= "HDU checksum updated 2012-06-20T13:25:39" # dmdiff (CIAO 4.12): comment2= "HDU checksum updated 2020-10-13T15:01:09" Values are not equal DATASUM 3109198819 2612655147 # dmdiff (CIAO 4.12): WARNING: DATASUM comments are different. # dmdiff (CIAO 4.12): comment1= "data unit checksum updated 2012-06-20T13:25:10" # dmdiff (CIAO 4.12): comment2= "data unit checksum updated 2020-10-13T15:01:09" Values are not equal CONTENT EVT2 EVT1 Values are not equal HDUCLAS2 ACCEPTED ALL Values are not equal DATE 2012-06-20T13:25:05 2020-10-13T15:00:28 Values are not equal GAINFILE acisD2000-01-29gain_ctiN0006.fits acisD2000-01-29gain_ctiN0008.fits Values are not equal CTIFILE acisD2002-08-01ctiN0007.fits acisD2010-01-01ctiN0009.fits Values are not equal MTLFILE acisf13858_000N001_fptemp_egti1.fits acisf13858_000N001_mtl1.fits Values are not equal TGAINFIL acisD2012-02-01t_gain_biN0002.fits acisD2012-05-01t_gainN0008.fits Values are not equal BPIXFILE acisf13858_000N001_bpix1.fits acisf13858_repro_bpix1.fits Values are not equal HISTNUM 518 631 +113 Values are not equal ONTIME 15069.100115895 15070.556907833 +1.45679 Values are not equal ONTIME7 15069.100115895 15070.556907833 +1.45679 Values are not equal ONTIME5 15069.100115895 15070.556907892 +1.45679 Values are not equal ONTIME6 15069.100115895 15070.556907833 +1.45679 Values are not equal ONTIME8 15069.100115895 15070.556907892 +1.45679 Values are not equal LIVETIME 14872.211229171 14873.648987049 +1.43776 Values are not equal LIVTIME7 14872.211229171 14873.648987049 +1.43776 Values are not equal LIVTIME5 14872.211229171 14873.648987108 +1.43776 Values are not equal LIVTIME6 14872.211229171 14873.648987049 +1.43776 Values are not equal LIVTIME8 14872.211229171 14873.648987108 +1.43776 Values are not equal EXPOSURE 14872.211229171 14873.648987049 +1.43776 Values are not equal EXPOSUR7 14872.211229171 14873.648987049 +1.43776 Values are not equal EXPOSUR5 14872.211229171 14873.648987108 +1.43776 Values are not equal EXPOSUR6 14872.211229171 14873.648987049 +1.43776 Values are not equal EXPOSUR8 14872.211229171 14873.648987108 +1.43776 -------------------------- SUBSPACE VALUE DIFFERENCES -------------------------- Message: Column: Row Value(s): Diff: -------- ------- --- --------- ----- Range mins are not equal expno 1 0 3 +3 ( +inf %) Range maxs are not equal expno 1 2147483647 4801 -2.14748e+09 ( -100 %) # dmdiff (CIAO 4.12): WARNING: subspace column "status" type unknown or not supported. # dmdiff (CIAO 4.12): WARNING: phas units are different. # dmdiff (CIAO 4.12): unit1= "" # dmdiff (CIAO 4.12): unit2= "adu" # dmdiff (CIAO 4.12): WARNING: phas comments are different. # dmdiff (CIAO 4.12): comment1= "" # dmdiff (CIAO 4.12): comment2= "array of pixel pulse heights"
dmkeypar 13858/primary/acisf13858N001_evt2.fits CALDBVER echo+
dmkeypar 13858/repro/acisf13858_repro_evt2.fits CALDBVER echo+
check_ciao_caldb
4.4.10 4.4.10 CALDB environment variable = /home/kjg/Workshop/CALDB CALDB version = 4.9.2.1 release date = 2020-07-08T16:00:00 UTC CALDB query completed successfully.
dmlist 13858/primary/acisf13858N001_evt2.fits counts
dmlist 13858/repro/acisf13858_repro_evt2.fits counts
134855 134015
Q: Compare the header keyword values in the _repro_evt2.fits file with the evt2 file obtained from the archive. Discuss the differences: We see newer calibration files are used (
GAINFILE
,CTIFILE
, andTGAINFIL
). We see small diff inONTIME
.
Q: What version of the CALDB is installed? What is the value of the CALDBVER keyword? It is unchanged.
CALDBVER
is not updated by the tools; it's set in SDP.
Q: Compare the number of events in the reprocessed Level 2 event file with the number of events in the archived Level 2 event file. Why are they same (or not the same)? **Slightly different. New calibrations mean some good events go bad, some bad events go good (grade migration) **
Imaging Basics (Spatial Analysis)¶
In this section students will exercise some of the basic CIAO tools and scripts needed to perform basic imaging tasks.
Detect Sources¶
One of the most common analysis tasks is to detect sources.
Please keep in mind: CIAO detect tools only detect candidate sources and they are not photometric tools. The output from the detect tools should be used to guide further analysis.
See also:
- Wavdetect thread: http://cxc.cfa.harvard.edu/ciao/threads/wavdetect/
- Using detect output: http://cxc.cfa.harvard.edu/ciao/threads/detect_output/
Exercise 10¶
In this exercise students should complete the following steps
Create image, exposure map, and psf map. Run the fluximage script on the dataset. Students should be sure to set the binsize=1 and set bands=default or bands=broad.
Detect Sources. Run wavdetect on the fluximage output counts image, using the exposure map and psfmap. Students should select a set of wavelet scales to use that is appropriate for the dataset being analyzed.
fluximage 13858/repro/acisf13858_repro_evt2.fits out=acisf13858 bin=1 bands=broad clob+ mode=h psfecf=0.393
Running fluximage Version: 01 April 2020 Using CSC ACIS broad science energy band. Aspect solution 13858/repro/pcadf456520092N001_asol1.fits found. Bad-pixel file 13858/repro/acisf13858_repro_bpix1.fits found. Mask file 13858/repro/acisf13858_000N001_msk1.fits found. The output images will have 2937 by 4168 pixels, pixel size of 0.492 arcsec, and cover x=2735.5:5672.5:1,y=1838.5:6006.5:1. Running tasks in parallel with 8 processors. Creating aspect histograms for obsid 13858 Creating 4 instrument maps for obsid 13858 Creating 4 exposure maps for obsid 13858 Combining 4 exposure maps for obsid 13858 Thresholding data for obsid 13858 Exposure-correcting image for obsid 13858 Creating PSF map for obsid 13858 The following files were created: The clipped counts image is: acisf13858_broad_thresh.img The clipped exposure map is: acisf13858_broad_thresh.expmap The PSF map is: acisf13858_broad_thresh.psfmap The exposure-corrected image is: acisf13858_broad_flux.img
#mkpsfmap acisf13858_broad_thresh.img acisf13858_broad.psfmap \
# energy=1.4967 ecf=0.393 mode=h clob+
pset wavdetect \
infile=acisf13858_broad_thresh.img \
expfile=acisf13858_broad_thresh.expmap \
psffile=acisf13858_broad_thresh.psfmap \
scales='1.4 2 4 8 12 16 24 32' \
outfile=acisf13858_wav.src \
scellfile=acisf13858_wav.cell \
imagefile=acisf13858_wav.recon \
defnbkg=acisf13858_wav.nbkg \
clob+
wavdetect mode=h
ds9 acisf13858_broad_thresh.psfmap -scale linear -cmap standard -zoom to fit \
-saveimage png ds9_exercise10_a.png -quit
display < ds9_exercise10_a.png
ds9 acisf13858_broad_thresh.img -block 2 -scale log -region acisf13858_wav.src \
-scale limits 0 20 -smooth -saveimage png ds9_exercise10_b.png -quit
display < ds9_exercise10_b.png
Q: Display the PSF map in ds9. Why does it look the way it does? Chandra PSF increases in size the further away from optical axis.
Q: Record choice of wavelet scales and why that set was selected: above. Pseduo sqrt(2) used to detect srcs across field
Q: Open the broad-band image in ds9 and load the source list as a region file. Comment on the detected sources and any missed detections: src detects look good ; regions are a little small; maybe some faint stuff missed
Q: Are the ellipses the position error or the apparent size of the source? They are a measure of the observed source size. They are not the intrinsic (deconvolved) source size, nor are they the position error.
Extra Credit¶
Try differenct wavelet scales
wavdetect scales='1 4 16 64' mode=h clobber=yes outfile=fewscales.src
ds9 acisf13858_broad_thresh.img -block 2 -scale log -region fewscales.src \
-scale limits 0 20 -smooth -saveimage png ds9_exercise10_ec1.png -quit
display < ds9_exercise10_ec1.png
Try different significance thresholds, sigthresh.
wavdetect sigthresh=1e-7 mode=h clobber=yes outfile=lowersigthresh.src
ds9 acisf13858_broad_thresh.img -block 2 -scale log -region lowersigthresh.src \
-scale limits 0 20 -smooth -saveimage png ds9_exercise10_ec2.png -quit
display < ds9_exercise10_ec2.png
Try different ecf values when making the PSF map.
mkpsfmap acisf13858_broad_thresh.img ecf90.psfmap \
energy=1.4967 ecf=0.90 mode=h clob+
wavdetect mode=h clobber=yes outfile=ecf90.src psffile=ecf90.psfmap
ds9 acisf13858_broad_thresh.img -block 2 -scale log -region lowersigthresh.src \
-scale limits 0 20 -smooth -saveimage png ds9_exercise10_ec3.png -quit
display < ds9_exercise10_ec3.png
Try different energy bands.
mkpsfmap acisf13858_broad_thresh.img 5keV.psfmap \
energy=5.0 ecf=0.90 mode=h clob+
wavdetect mode=h clobber=yes outfile=5keV.src psffile=5keV.psfmap
ds9 acisf13858_broad_thresh.img -block 2 -scale log -region 5keV.src \
-scale limits 0 20 -smooth -saveimage png ds9_exercise10_ec4.png -quit
display < ds9_exercise10_ec4.png
Try using the celldetect tool.
celldetect acisf13858_broad_thresh.img \
expstk=acisf13858_broad_thresh.expmap \
psffile=ecf90.psfmap \
out=acisf13858_cell.src \
clob+ mode=h
ds9 acisf13858_broad_thresh.img -block 2 -scale log -region acisf13858_cell.src \
-scale limits 0 20 -smooth -saveimage png ds9_exercise10_ec5.png -quit
display < ds9_exercise10_ec5.png
Try using the vtpdetect tool.
vtpdetect acisf13858_broad_thresh.img \
exp=acisf13858_broad_thresh.expmap \
out=acisf13858_vtp.src \
clob+ mode=h
ds9 acisf13858_broad_thresh.img -block 2 -scale log -region acisf13858_vtp.src[src_region] \
-scale limits 0 20 -smooth -saveimage png ds9_exercise10_ec6.png -quit
display < ds9_exercise10_ec6.png
Create regions in ds9¶
The detect tools are one way to create regions automatically. However, often users analyzing a single source in an observation will simply create their own region in ds9 and then use those regions with the CIAO tools.
Exercise 11¶
- Open the broad-band counts image in ds9.
- Create a source region. Draw a circular source region around the bright source in the center of the image.
- Save the region, ds9_src.reg. Use ds9 format and celestial (world) coordinates.
- Delete the source region.
- Create a background region. Draw an annulus around the same source. The inner annulus region should be larger than the source region. The outer region should be large enough to get a large number of counts, but should be small enough to avoid any nearby source or any instrumental features (like the gaps between chips).
- Save the region, ds9_bkg.reg. Use CIAO format and physical coordinates.
ds9 acisf13858_broad_thresh.img -scale log -pan to 4096.5 4096.5 physical &
[1] 12463
echo "physical;circle(4104.5,4115.5,10)" | xpaset ds9 region
xpaset -p ds9 saveimage png ds9_exercise11_a.png
xpaget ds9 regions -format ds9 -system wcs -skyformat sexagesimal > ds9_src.reg
xpaset -p ds9 regions delete all
display < ds9_exercise11_a.png
cat ds9_src.reg
# Region file format: DS9 version 4.1 global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 fk5 circle(9:14:49.0898,+8:53:20.988,4.920")
echo "physical;annulus(4105.5,4113.5,45,125) # background" | xpaset ds9 region
xpaset -p ds9 saveimage png ds9_exercise11_b.png
xpaget ds9 regions -format ciao -system physical > ds9_bkg.reg
xpaset -p ds9 regions delete all
display < ds9_exercise11_b.png
cat ds9_bkg.reg
annulus(4105.5,4113.5,45,125)
xpaset -p ds9 quit
[1]+ Done ds9 acisf13858_broad_thresh.img -scale log -pan to 4096.5 4096.5 physical
Q: Record the source location used: see above
Q: Describe the differences between the CIAO format and the ds9 format regions: ds9 format includes meta-data: color, linestyle, etc.
Exercise 12¶
Compute source centroid. In this exercise students will use the dmstat tool to compute the source centroid in their region.
- Use dmcopy to filter the flux image thresh.img using the source region file.
- Use dmlist with the blocks option to display info about the filtered output image.
- Use dmstat with the centroid=yes option to compute the centroid of the counts in the filtered image.
- Use dmcopy to filter the Level 2 event file using the source region file and to bin it into an image with binsize=1.
- Use dmlist with the blocks option to display info about the filtered and binned image.
- Use dmstat with centroid=yes option to compute the centroid of the counts in the filtered and binned image.
dmcopy "acisf13858_broad_thresh.img[sky=region(ds9_src.reg)]" dmcopy_e12_src.fits clob+
dmlist dmcopy_e12_src.fits blocks,cols
-------------------------------------------------------------------------------- Dataset: dmcopy_e12_src.fits -------------------------------------------------------------------------------- Block Name Type Dimensions -------------------------------------------------------------------------------- Block 1: EVENTS_IMAGE Image Int4(21x21) -------------------------------------------------------------------------------- Columns for Image Block EVENTS_IMAGE -------------------------------------------------------------------------------- ColNo Name Unit Type Range 1 EVENTS_IMAGE[21,21] Int4(21x21) - -------------------------------------------------------------------------------- Physical Axis Transforms for Image Block EVENTS_IMAGE -------------------------------------------------------------------------------- Group# Axis# 1 1,2 sky(x) = (+4093.50) +(+1.0)* ((#1)-(+0.50)) (y) (+4104.50) (+1.0) ((#2) (+0.50)) -------------------------------------------------------------------------------- World Coordinate Axis Transforms for Image Block EVENTS_IMAGE -------------------------------------------------------------------------------- Group# Axis# 1 1,2 EQPOS(RA ) = (+138.7056)[deg] +TAN[(-0.000136667)* (sky(x)-(+4096.50))] (DEC) (+8.8866 ) (+0.000136667) ( (y) (+4096.50))
dmstat dmcopy_e12_src.fits cen+ sig- med+
EVENTS_IMAGE(x, y) min: 0 @: ( 4102 4106 ) max: 398 @: ( 4104 4116 ) cntrd[log] : ( 11.475857243 11.817354794 ) cntrd[phys]: ( 4104.4758572 4115.8173548 ) good: 316 null: 125
dmcopy 13858/repro/acisf13858_repro_evt2.fits"[sky=region(ds9_src.reg)][bin sky=1]" \
dmcopy_e12_evtsrc.fits clob+
dmlist dmcopy_e12_evtsrc.fits blocks,cols
-------------------------------------------------------------------------------- Dataset: dmcopy_e12_evtsrc.fits -------------------------------------------------------------------------------- Block Name Type Dimensions -------------------------------------------------------------------------------- Block 1: EVENTS_IMAGE Image Int2(20x20) Block 2: GTI7 Table 2 cols x 1 rows Block 3: GTI5 Table 2 cols x 1 rows Block 4: GTI6 Table 2 cols x 1 rows Block 5: GTI8 Table 2 cols x 1 rows -------------------------------------------------------------------------------- Columns for Image Block EVENTS_IMAGE -------------------------------------------------------------------------------- ColNo Name Unit Type Range 1 EVENTS_IMAGE[20,20] Int2(20x20) - -------------------------------------------------------------------------------- Physical Axis Transforms for Image Block EVENTS_IMAGE -------------------------------------------------------------------------------- Group# Axis# 1 1,2 sky(x) = (+4094.4409) +(+1.0)* ((#1)-(+0.50)) (y) (+4105.4658) (+1.0) ((#2) (+0.50)) -------------------------------------------------------------------------------- World Coordinate Axis Transforms for Image Block EVENTS_IMAGE -------------------------------------------------------------------------------- Group# Axis# 1 1,2 EQPOS(RA ) = (+138.7056)[deg] +TAN[(-0.000136667)* (sky(x)-(+4096.50))] (DEC) (+8.8866 ) (+0.000136667) ( (y) (+4096.50))
dmstat dmcopy_e12_evtsrc.fits cen+ sig- med+
EVENTS_IMAGE(x, y) min: 0 @: ( 4101.9408797 4105.9658198 ) max: 437 @: ( 4103.9408797 4115.9658198 ) cntrd[log] : ( 10.511035654 10.842105263 ) cntrd[phys]: ( 4104.4519153 4115.8079251 ) good: 316 null: 84
Q: Is the filtered image the same size as the fluximage output image size? Why? The CXCDM shrinks the image to the size of the region (by default)
Q: Record the centroid of fluximage output filtered image: 4104.4755245, 4115.8174825
Q: What are the good and null values that dmstat reports? The number of pixels outside the circle
Q: Is the image created by filtering and binning the event file the same size as the other images? Why? No. (20x20 vs 21x21). Filter image vs. Filter table then bin into an image
Q: Record the centroid of the event file filter and binned image: 4104.4519153, 4115.808491
Q: Is the centroid the same for the two images? Why? (Hint: what energies are being used?) Opps, no energy filter on the event file -- but image was made with broad band (500:7000eV).
Aperture Photometry¶
Obtaining the counts (or count rate) is the first step in computing the source flux.
Exercise 13¶
In this exercise students will use the CIAO analysis menu, aka dax, to get the net counts in their regions (from Exercise 11).
- Open the fluximage thresh.img in ds9.
- Load the source region file created in Exercise 11 step 3.
- Load the background region file created in Exercise 11 step 6.
- Double click on the background annulus to display the region properties.
- Under the Property menu, select Background. The region will now be drawn with a dashed line. Close the properties window.
- In the main ds9 window, goto Analysis →CIAO →Statistics → Net Counts.
- A text window will be display containing the information about the current regions.
- Try adjusting the source and background radii and repeating the analysis.
$ASCDS_INSTALL/bin/ds9 acisf13858_broad_thresh.img -scale log -pan to 4096.5 4096.5 physical &
[1] 12499
xpaset -p ds9 regions ds9_bkg.reg
xpaset -p ds9 regions select all
xpaset -p ds9 regions background
xpaset -p ds9 regions ds9_src.reg
xpaset -p ds9 saveimage png exercise_13_ds9a.png
display < exercise_13_ds9a.png
xpaset -p ds9 regions select all
xpaset -p ds9 analysis task "{Net Counts}"
import exercise_13_a.png
display < exercise_13_a.png
xpaset -p ds9 regions delete all
echo "physical; circle(4104.4434,4115.8478,17.145457)" | xpaset ds9 regions
echo "physical; annulus(4104.5,4115.5,26.305893,125) # background" | xpaset ds9 regions
xpaset -p ds9 saveimage png exercise_13_ds9b.png
display < exercise_13_ds9b.png
xpaset -p ds9 regions select all
xpaset -p ds9 analysis task "{Net Counts}"
import exercise_13_b.png
display < exercise_13_b.png
xpaset -p ds9 quit
[1]+ Done $ASCDS_INSTALL/bin/ds9 acisf13858_broad_thresh.img -scale log -pan to 4096.5 4096.5 physical
- Net counts with error: 1428 +/- 37.85
- Source counts: 1430
- Background counts: 270
Q: From step 7, record the following information from the Net Counts task:
Q: From step 8, describe how the net counts and net rates vary with changes to the source and background regions: net rate doesn't change much as bkg gets bigger/smaller (ie background is flat)
Exercise 14¶
In this exercise students will use the srcflux
script to get various estimates of the flux of the source.
- Obtain the source location in celestial coordinates from the source region file created in Exercise 11 step 3.
- Run the srcflux script on the reprocessed level 2 event file, using the position, pos, from step 1. All other parameters should remain at their defaults.
- Repeat step 2, using a different outroot and psfmethod=arfcorr
- Repeat step 3, using a different outroot, model="xsbbody.black_body" and paramvals="black_body.kT=1".
- Repeat step 4, using bands="hard".
punlearn dmcoords
dmcoords 13858/repro/acisf13858_repro_evt2.fits op=sky x=4104.4755245 y=4115.8174825 celfmt=hms verb=0
pget dmcoords ra dec
09:14:49.088 +08:53:21.16
punlearn srcflux
srcflux 13858/repro/acisf13858_repro_evt2.fits "09:14:49.088, +08:53:21.16" exercise14_step2 clob+ mode=h
srcflux infile = 13858/repro/acisf13858_repro_evt2.fits pos = 09:14:49.088, +08:53:21.16 outroot = exercise14_step2 bands = broad srcreg = bkgreg = bkgresp = yes psfmethod = ideal psffile = conf = 0.9 binsize = 1 rmffile = arffile = model = xspowerlaw.pow1 paramvals = pow1.PhoIndex=2.0 absmodel = xsphabs.abs1 absparams = abs1.nH=%GAL% abund = angr fovfile = asolfile = mskfile = bpixfile = dtffile = ecffile = CALDB parallel = yes nproc = INDEF tmpdir = /tmp clobber = yes verbose = 1 mode = h Processing OBI 000 Extracting counts Setting Ideal PSF : alpha=1 , beta=0 Getting net rate and confidence limits Getting model independent fluxes Getting model fluxes Getting photon fluxes Running tasks in parallel with 8 processors. Running aprates for exercise14_step2_0001_broad_rates.par Running eff2evt for exercise14_step2_broad_0001_src.dat Running eff2evt for exercise14_step2_broad_0001_bkg.dat Making response files for exercise14_step2_0001 Running modeflux for region 1 Using GAL=0.0426 for source 1 Adding net rates to output Appending flux results onto output Appending photflux results onto output Computing Net fluxes Adding model fluxes to output Scaling model flux confidence limits Summary of source fluxes Position 0.5 - 7.0 keV Value 90% Conf Interval #0001|9 14 49.08 +8 53 21.1 Rate 0.0827 c/s (0.0788,0.0866) Flux 5.68E-13 erg/cm2/s (5.41E-13,5.95E-13) Mod.Flux 5.88E-13 erg/cm2/s (5.6E-13,6.16E-13) Unabs Mod.Flux 6.3E-13 erg/cm2/s (6.01E-13,6.6E-13)
punlearn srcflux
srcflux 13858/repro/acisf13858_repro_evt2.fits "09:14:49.088, +08:53:21.16" exercise14_step3 \
psfmethod=arfcorr \
clob+ mode=h verbose=0
cat exercise14_step3_summary.txt
Summary of source fluxes Position 0.5 - 7.0 keV Value 90% Conf Interval #0001|9 14 49.08 +8 53 21.1 Rate 0.0961 c/s (0.0916,0.101) Flux 6.61E-13 erg/cm2/s (6.3E-13,6.92E-13) Mod.Flux 6.84E-13 erg/cm2/s (6.52E-13,7.16E-13) Unabs Mod.Flux 7.33E-13 erg/cm2/s (6.99E-13,7.68E-13)
punlearn srcflux
srcflux 13858/repro/acisf13858_repro_evt2.fits "09:14:49.088, +08:53:21.16" exercise14_step4 \
psfmethod=arfcorr \
model="xsbbody.black_body" paramvals="black_body.kT=1" \
clob+ mode=h verbose=0
cat exercise14_step4_summary.txt
Summary of source fluxes Position 0.5 - 7.0 keV Value 90% Conf Interval #0001|9 14 49.08 +8 53 21.1 Rate 0.0961 c/s (0.0916,0.101) Flux 6.61E-13 erg/cm2/s (6.3E-13,6.92E-13) Mod.Flux 1.01E-12 erg/cm2/s (9.66E-13,1.06E-12) Unabs Mod.Flux 1.03E-12 erg/cm2/s (9.82E-13,1.08E-12)
punlearn srcflux
srcflux 13858/repro/acisf13858_repro_evt2.fits "09:14:49.088, +08:53:21.16" exercise14_step5 \
psfmethod=arfcorr \
model="xsbbody.black_body" paramvals="black_body.kT=1" \
band="hard" \
clob+ mode=h verbose=0
cat exercise14_step5_summary.txt
Summary of source fluxes Position 2.0 - 7.0 keV Value 90% Conf Interval #0001|9 14 49.08 +8 53 21.1 Rate 0.0185 c/s (0.0164,0.0205) Flux 2.69E-13 erg/cm2/s (2.39E-13,2.98E-13) Mod.Flux 2.91E-13 erg/cm2/s (2.59E-13,3.23E-13) Unabs Mod.Flux 2.92E-13 erg/cm2/s (2.6E-13,3.25E-13)
Q: Record the net count rate, model independent flux, model flux from steps 2 through 5
.
Estimate | Step 2 | Step 3 | Step 4 | Step 5 |
---|---|---|---|---|
Count Rate | 0.827 | 0.962 | 0.962 | 0.0185 |
Flux | 5.6E-13 | 7.3E-13 | 7.3E-13 | 3.12E-13 |
Model Flux | 5.8E-13 | 6.74E-13 | 1.0E-12 | 2.91E-13 |
.
Q: Discuss the differences in the estimated fluxes obtained in steps 2 through 5.
Extra Credit¶
Try using psfmethod=quick and psfmethod=marx
punlearn srcflux
srcflux 13858/repro/acisf13858_repro_evt2.fits "09:14:49.088, +08:53:21.16" exercise14_step_ec1 \
psfmethod=quick \
clob+ mode=h verbose=0
cat exercise14_step_ec1_summary.txt
Summary of source fluxes Position 0.5 - 7.0 keV Value 90% Conf Interval #0001|9 14 49.08 +8 53 21.1 Rate 0.0954 c/s (0.091,0.1) Flux 6.56E-13 erg/cm2/s (6.25E-13,6.87E-13) Mod.Flux 6.79E-13 erg/cm2/s (6.47E-13,7.11E-13) Unabs Mod.Flux 7.28E-13 erg/cm2/s (6.94E-13,7.62E-13)
#source $ASCDS_INSTALL/marx-5.5.0/setup_marx.sh
export MARX_ROOT=$ASCDS_INSTALL
punlearn srcflux
srcflux 13858/repro/acisf13858_repro_evt2.fits "09:14:49.088, +08:53:21.16" exercise14_step_ec2 \
psfmethod=marx \
clob+ mode=h verbose=0
cat exercise14_step_ec2_summary.txt
Summary of source fluxes Position 0.5 - 7.0 keV Value 90% Conf Interval #0001|9 14 49.08 +8 53 21.1 Rate 0.0984 c/s (0.0938,0.103) Flux 6.76E-13 erg/cm2/s (6.44E-13,7.08E-13) Mod.Flux 7E-13 erg/cm2/s (6.67E-13,7.33E-13) Unabs Mod.Flux 7.5E-13 erg/cm2/s (7.15E-13,7.86E-13)
Estimate | ideal | quick | arfcorr | marx |
---|---|---|---|---|
Count Rate | 0.827 | 0.962 | 0.955 | 0.0985 |
Flux | 5.6E-13 | 7.3E-13 | 6.5E-13 | 7.84E-13 |
Model Flux | 5.8E-13 | 6.74E-13 | 6.7E-12 | 6.90E-13 |
Try other spectral model and other model parameters.
Try other energy bands (2-10 keV is a common band in the literature).
punlearn srcflux
srcflux 13858/repro/acisf13858_repro_evt2.fits "09:14:49.088, +08:53:21.16" exercise14_step_ec4 \
psfmethod=quick band="2.0:10.0:3.0" \
clob+ mode=h verbose=0
cat exercise14_step_ec4_summary.txt
Summary of source fluxes Position 2.0 - 10.0 keV Value 90% Conf Interval #0001|9 14 49.08 +8 53 21.1 Rate 0.0181 c/s (0.0162,0.0201) Flux 3.16E-13 erg/cm2/s (2.81E-13,3.5E-13) Mod.Flux 3.63E-13 erg/cm2/s (3.24E-13,4.03E-13) Unabs Mod.Flux 3.65E-13 erg/cm2/s (3.25E-13,4.05E-13)
Simulate PSF¶
The Chandra Point Spread Function (PSF) varies spatially across the field of view as well with energy. There is no analytic model of the PSF. The only way to obtain an estimate of the Chandra PSF for detailed spatial analysis is by simulation.
The psfmethod used by srcflux are only appropriate when integrating over a region. The pixel-to-pixel variations used in those methods is insufficient for any type of analysis that requires detailed spatial information.
There are two different simulators users can use.
- SAOTrace is the definitive mirror model and is made available to users via the ChaRT web interface.
- MARX is the end-to-end Chandra simulator used to calibrate the HETG gratings and includes a fairly accurate mirror model and detector models.
Exercise 15¶
In this exercise Students will simulate the PSF using ChaRT and with MARX. The simulate_psf script is used to create PSF images that are appropriate for further data analysis.
- Ensure that MARX is installed and that MARX_ROOT is set.
- Run ChaRT. http://cxc.cfa.harvard.edu/ciao/PSFs/chart2/index.html To run ChaRT users need to know the source location (celestial coordinates), an estimate of the photon flux (from the srcflux .flux output files), and an estimate of the energy. Students may be provided with a set of ChaRT output ray files.
- Run the simulate_psf script. Use the reprocessed level 2 event file as the infile and the coordinates of the source, in decimal degrees, for the ra and dec parameters. Use simulator=file and provide the stack of ray files obtained from ChaRT for the rayfile parameter. Set minsize=128 to obtain a reasonable size output image.
- Display the reprocessed level 2 event file in one ds9 frame and the simulate_psf output PSF in a 2nd frame. Tile the frames horizontally and save the image as a PNG file.
- Run simulate_psf with a different outroot, this time using simulator=marx and set the numiter parameter to the same number of iterations as were used with ChaRT. monoenergy=1.0 and flux=1e-4 can be used for the spectral model.
- Repeat step 4 using the MARX generated PSF.
#source $ASCDS_INSTALL/marx-5.5.0/setup_marx.sh
dmkeypar exercise14_step2_broad.flux net_photflux_aper echo+
0.000220913134986115
curl \
-F email=${USER}@head.cfa.harvard.edu \
-F coords=cel \
-F ra=09:14:49.088 \
-F dec=+08:53:21.16 \
-F asol=obi \
-F obsid=13858 \
-F obinum=0\
-F niter=10\
-F randseed=32767 \
-F energy=mono \
-F mono=2.3 \
-F flux=0.000221 \
https://saotrace.cfa.harvard.edu/cgi-bin/runwrapper
<html> <head><title>ChaRT Job Submitted</title></head> <body> <h1>ChaRT v2</h1> Job submitted. You will recieve an email from cxc_rays@head.cfa.harvard.edu when the job is complete or if there are any errors. </body> </html>
curl -o rays.tar.gz https://saotrace.cfa.harvard.edu/pickup/HRMA_ra138.70453_dec8.88921_en2.3_flux0.000221_dithered.tar.gz
tar xvfz rays.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1868k 100 1868k 0 0 7023k 0 --:--:-- --:--:-- --:--:-- 7023k HRMA_ra138.70453_dec8.88921_en2.3_flux0.000221_dithered_i0001_rays.fits HRMA_ra138.70453_dec8.88921_en2.3_flux0.000221_dithered_i0000_rays.fits HRMA_ra138.70453_dec8.88921_en2.3_flux0.000221_dithered_i0005_rays.fits HRMA_ra138.70453_dec8.88921_en2.3_flux0.000221_dithered_i0002_rays.fits HRMA_ra138.70453_dec8.88921_en2.3_flux0.000221_dithered_i0007_rays.fits HRMA_ra138.70453_dec8.88921_en2.3_flux0.000221_dithered_i0009_rays.fits HRMA_ra138.70453_dec8.88921_en2.3_flux0.000221_dithered_i0006_rays.fits HRMA_ra138.70453_dec8.88921_en2.3_flux0.000221_dithered_i0003_rays.fits HRMA_ra138.70453_dec8.88921_en2.3_flux0.000221_dithered_i0004_rays.fits HRMA_ra138.70453_dec8.88921_en2.3_flux0.000221_dithered_i0008_rays.fits
simulate_psf 13858/repro/acisf13858_repro_evt2.fits \
chart_sim ra=138.70453 dec=8.88921 \
simulator=file rayfile="HRMA*rays.fits" \
minsize=128 mode=h
simulate_psf infile = 13858/repro/acisf13858_repro_evt2.fits outroot = chart_sim ra = 138.70453 dec = 8.88921 spectrumfile = monoenergy = INDEF flux = INDEF simulator = file rayfile = HRMA*rays.fits projector = marx random_seed = -1 blur = 0.07000000000000001 readout_streak = no pileup = no ideal = yes extended = yes binsize = 1 numsig = 7 minsize = 128 numiter = 1 keepiter = no asolfile = marx_root = /home/kjg/miniconda/envs/ciao verbose = 1 mode = h Started check_setup Finished check_setup 10 rayfiles provided; ignoring numiter=1 parameter Performing iteration 1 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 2 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 3 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 4 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 5 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 6 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 7 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 8 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 9 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 10 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Started create_average_image Finished create_average_image Final output PSF image is : chart_sim.psf[PSF]
ds9 acisf13858_broad_thresh.img -scale log -pan to 4096.5 4096.5 physical \
-zoom to 4 \
chart_sim.psf -pan to 4096.5 4096.5 physical \
-view colorbar no \
-saveimage png ds9_exercise15_a.png -quit
display < ds9_exercise15_a.png
simulate_psf 13858/repro/acisf13858_repro_evt2.fits \
marx_sim ra=138.70453 dec=8.88921 \
simulator=marx \
minsize=128 mode=h \
mono=2.3 flux=0.000221 numiter=10
simulate_psf infile = 13858/repro/acisf13858_repro_evt2.fits outroot = marx_sim ra = 138.70453 dec = 8.88921 spectrumfile = monoenergy = 2.3 flux = 0.000221 simulator = marx rayfile = projector = marx random_seed = -1 blur = 0.07000000000000001 readout_streak = no pileup = no ideal = yes extended = yes binsize = 1 numsig = 7 minsize = 128 numiter = 10 keepiter = no asolfile = marx_root = /home/kjg/miniconda/envs/ciao verbose = 1 mode = h Started check_setup Finished check_setup Performing iteration 1 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 2 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 3 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 4 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 5 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 6 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 7 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 8 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 9 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Performing iteration 10 of 10 Started run_marx Finished run_marx Started create_psf_image Finished create_psf_image Started create_average_image Finished create_average_image Final output PSF image is : marx_sim.psf[PSF]
ds9 acisf13858_broad_thresh.img -scale log -pan to 4096.5 4096.5 physical \
-zoom to 4 \
marx_sim.psf -pan to 4096.5 4096.5 physical \
-view colorbar no \
-saveimage png ds9_exercise15_b.png -quit
display < ds9_exercise15_b.png
Q: Comment on a visual comparison of the ChaRT/SAOTrace PSF to the observation:
Q: Comment on a visual comparison of the MARX PSF to the observation:
Q: Describe any differences between the MARX and ChaRT PSFs:
Q: Is this a point source?
Extra Credit¶
Try setting simulate_psf readout_streak=yes. Try pileup=yes. Try blur=0.20
simulate_psf 13858/repro/acisf13858_repro_evt2.fits \
marxA_sim ra=138.70453 dec=8.88921 \
simulator=marx \
minsize=128 mode=h \
mono=2.3 flux=0.000221 numiter=10 verb=0 readout+
simulate_psf 13858/repro/acisf13858_repro_evt2.fits \
marxB_sim ra=138.70453 dec=8.88921 \
simulator=marx \
minsize=128 mode=h \
mono=2.3 flux=0.000221 numiter=10 verb=0 pileup+ ext-
simulate_psf 13858/repro/acisf13858_repro_evt2.fits \
marxC_sim ra=138.70453 dec=8.88921 \
simulator=marx \
minsize=128 mode=h \
mono=2.3 flux=0.000221 numiter=10 verb=0 blur=0.2
ds9 marx_sim.psf -scale log -pan to 4105.5 4113.5 physical \
-zoom to 4 \
marxA_sim.psf -pan to 4105.5 4113.5 physical \
marxB_sim.psf -pan to 4105.5 4113.5 physical \
marxC_sim.psf -pan to 4105.5 4113.5 physical \
-view colorbar no \
-saveimage png ds9_exercise15_ec1.png -quit
display < ds9_exercise15_ec1.png
Run the Lucy-Richardson deconvolution tool arestore using the broad band flux image and the PSFs simulated here. Try with different numbers of iterations.
arestore "acisf13858_broad_thresh.img[sky=bounds(region(ds9_bkg.reg))]" \
chart_sim.psf arestore.out num=150 clob+
ds9 acisf13858_broad_thresh.img -scale log -pan to 4105.5 4113.5 physical \
-zoom to 4 \
chart_sim.psf -pan to 4105.5 4113.5 physical \
arestore.out -pan to 4105.5 4113.5 physical \
-view colorbar no \
-tile mode column \
-saveimage png ds9_exercise15_ec2.png -quit
display < ds9_exercise15_ec2.png
Create a 3-color image¶
Three color (aka "true color" or "tri-color") images can be useful to help guide analysis by providing visual clues about changes in spectra.
Exercise 16¶
- Obtain the data for OBS_ID 13736. These data will only be used for this exercise.
- Reprocess the data using chandra_repro
- Run fluximage on the reprocessed level 2 event file. Use binsize=8 and bands=csc.
- Load the soft, medium, and hard band flux.img images into ds9. This can be done in the GUI by creating a new RGB frame and then loading the files individually or on the command line
ds9 -rgb -red root_soft_flux.img \
-green root_medium_flux.img \
-blue root_hard_flux.img
- Log scale each of the images.
- Use the Analysis → Smooth on each of the images.
- Save the image in PNG format.
- Exit ds9
- Use dmimg2jpg to create a similar 3-color image.
/bin/rm -rf 13736
download_chandra_obsid 13736 evt1,bpix,flt,mtl,msk,dtf,bias,pbk,asol,stat
Downloading files for ObsId 13736, total size is 322 Mb. Type Format Size 0........H.........1 Download Time Average Rate --------------------------------------------------------------------------- evt1 fits 286 Mb #################### 29 s 9947.3 kb/s asol fits 27 Mb #################### 3 s 9959.0 kb/s mtl fits 4 Mb #################### < 1 s 5629.2 kb/s stat fits 3 Mb #################### < 1 s 6104.2 kb/s bias fits 487 Kb #################### < 1 s 2137.3 kb/s bias fits 436 Kb #################### < 1 s 1944.0 kb/s bias fits 429 Kb #################### < 1 s 2087.8 kb/s bias fits 425 Kb #################### < 1 s 3001.3 kb/s bias fits 424 Kb #################### < 1 s 1799.4 kb/s bpix fits 78 Kb #################### < 1 s 844.1 kb/s flt fits 7 Kb #################### < 1 s 97.7 kb/s msk fits 5 Kb #################### < 1 s 93.9 kb/s pbk fits 4 Kb #################### < 1 s 47.2 kb/s Total download size for ObsId 13736 = 322 Mb Total download time for ObsId 13736 = 35 s
download_obsid_caldb 13736 ./CALDB
download_obsid_caldb infile = 13736 outdir = ./CALDB background = no missing = no clobber = no verbose = 1 mode = ql Retrieving files for CALDB_VER = 4.9.2.1 Retrieving CALDB index files Processing infile=13736/secondary/acisf13736_000N001_evt1.fits.gz Retrieving CALDB data files Filename: 0------------------1 telD1999-07-23geomN0006.fits .................... (skipped) telD1999-07-23aimptsN0002.fits .................... (skipped) telD1999-07-23tdetN0001.fits .................... (skipped) telD1999-07-23skyN0002.fits .................... (skipped) telD1999-07-23sgeomN0001.fits .................... (skipped) hrmaD1996-12-20axeffaN0008.fits .................... (skipped) hrmaD1996-12-20vignetN0003.fits .................... (skipped) acisD1997-04-17qeN0006.fits .................... (skipped) acisD2010-02-01qeuN0007.fits .................... (skipped) acisD2000-11-28badpixN0004.fits .................... (skipped) acisD1999-08-13contamN0013.fits .................... (skipped) acisD1996-11-01gradeN0004.fits .................... (skipped) acisD2000-01-29grdimgN0001.fits .................... (skipped) acisD2000-01-29gain_ctiN0008.fits .................... (skipped) acisD2005-07-01evtspltN0002.fits .................... (skipped) acisD2010-01-01ctiN0009.fits .................... (skipped) acisD2012-02-01t_gainN0008.fits #################### acisD1999-07-22subpixN0001.fits .................... (skipped) acisD2000-01-29fef_pha_ctiN0004.fits .................... (skipped) acisD1999-09-16dead_areaN0001.fits .................... (skipped) hrmaD1996-12-20reefN0001.fits .................... (skipped) acisD2000-01-29p2_respN0008.fits .................... (skipped) hrmaD1996-11-01wpsfN0001.fits .................... (skipped) acisD2000-01-29osip_ctiN0006.fits .................... (skipped) acisD2002-11-15gtilimN0004.fits .................... (skipped)
chandra_repro 13736 out=
Running chandra_repro version: 03 April 2020 Processing input directory '/home/kjg/Workshop/13736' Resetting afterglow status bits in evt1.fits file... Running the destreak tool on the evt1.fits file... Running acis_build_badpix and acis_find_afterglow to create a new bad pixel file... Running acis_process_events to reprocess the evt1.fits file... Filtering the evt1.fits file by grade and status and time... Applying the good time intervals from the flt1.fits file... The new evt2.fits file is: /home/kjg/Workshop/13736/repro/acisf13736_repro_evt2.fits Updating the event file header with chandra_repro HISTORY record Creating FOV file... Setting observation-specific bad pixel file in local ardlib.par. Cleaning up intermediate files WARNING: Observation-specific bad pixel file set for session use: /home/kjg/Workshop/13736/repro/acisf13736_repro_bpix1.fits Run 'punlearn ardlib' when analysis of this dataset completed. The data have been reprocessed. Start your analysis with the new products in /home/kjg/Workshop/13736/repro
fluximage 13736 out=tricolor band=csc bin=8 clob+
Running fluximage Version: 01 April 2020 Found 13736/repro/acisf13736_repro_evt2.fits Using event file 13736/repro/acisf13736_repro_evt2.fits Using CSC ACIS soft science energy band. Using CSC ACIS medium science energy band. Using CSC ACIS hard science energy band. Aspect solution 13736/repro/pcadf444947551N001_asol1.fits found. Bad-pixel file 13736/repro/acisf13736_repro_bpix1.fits found. Mask file 13736/repro/acisf13736_000N001_msk1.fits found. The output images will have 304 by 394 pixels, pixel size of 3.936 arcsec, and cover x=3568.5:6000.5:8,y=2840.5:5992.5:8. Running tasks in parallel with 8 processors. Creating aspect histograms for obsid 13736 Creating 15 instrument maps for obsid 13736 Creating 15 exposure maps for obsid 13736 Combining 5 exposure maps for 3 bands (obsid 13736) Thresholding data for obsid 13736 Exposure-correcting 3 images for obsid 13736 The following files were created: The clipped counts images are: tricolor_soft_thresh.img tricolor_medium_thresh.img tricolor_hard_thresh.img The clipped exposure maps are: tricolor_soft_thresh.expmap tricolor_medium_thresh.expmap tricolor_hard_thresh.expmap The exposure-corrected images are: tricolor_soft_flux.img tricolor_medium_flux.img tricolor_hard_flux.img
ds9 -rgb -view colorbar no \
-red tricolor_soft_flux.img -scale log -smooth yes -smooth radius 1 \
-green tricolor_medium_flux.img -scale log -smooth yes -smooth radius 1 \
-blue tricolor_hard_flux.img -scale log -smooth yes -smooth radius 1 \
-saveimage png ds9_exercise_16.png -quit
display < ds9_exercise_16.png
dmimg2jpg \
infile=tricolor_soft_flux.img \
greenfile=tricolor_medium_flux.img \
bluefile=tricolor_hard_flux.img \
outfile=dmimg2jpg_exercise13.jpg \
clob+
display < dmimg2jpg_exercise13.jpg
Q: Discuss the differences in the output from ds9 and dmimg2jpg. ds9 interactive
Extra Credit¶
Smooth the images with aconvolve before displaying
# Should convolve image and exposure map separately!
aconvolve tricolor_soft_flux.img tricolor_soft_flux_gaus.img "lib:gaus(2,5,1,1,1)" meth=slide clob+
aconvolve tricolor_medium_flux.img tricolor_medium_flux_gaus.img "lib:gaus(2,5,1,1,1)" meth=slide clob+
aconvolve tricolor_hard_flux.img tricolor_hard_flux_gaus.img "lib:gaus(2,5,1,1,1)" meth=slide clob+
dmimg2jpg \
infile=tricolor_soft_flux_gaus.img \
greenfile=tricolor_medium_flux_gaus.img \
bluefile=tricolor_hard_flux_gaus.img \
outfile=dmimg2jpg_exercise13_aconvolve.jpg \
clob+
display < dmimg2jpg_exercise13_aconvolve.jpg
Smooth the images with csmooth before displaying
# Csmooth really, really wants integer counts, so we smooth the counts image not the flux'ed image.
csmooth tricolor_soft_thresh.img none tricolor_soft_flux_csm.img sigmin=3 sclmax=20 mode=h clob+
csmooth tricolor_medium_thresh.img none tricolor_medium_flux_csm.img sigmin=3 sclmax=20 mode=h clob+
csmooth tricolor_hard_thresh.img none tricolor_hard_flux_csm.img sigmin=3 sclmax=20 mode=h clob+
# WARNING: Remainder will be smoothed on scale of 20.000000 # WARNING: Remainder will be smoothed on scale of 20.000000 # WARNING: Remainder will be smoothed on scale of 20.000000
dmimg2jpg \
infile=tricolor_soft_flux_csm.img \
greenfile=tricolor_medium_flux_csm.img \
bluefile=tricolor_hard_flux_csm.img \
outfile=dmimg2jpg_exercise13_csm.jpg \
clob+
display < dmimg2jpg_exercise13_csm.jpg
Smooth the images with dmimgadapt before displaying
dmimgadapt tricolor_soft_thresh.img tricolor_soft_flux_cone.img cone min=1 max=20 num=100 radscale=linear counts=25 clob+ mode=h
dmimgadapt tricolor_medium_thresh.img tricolor_medium_flux_cone.img min=1 max=20 num=100 radscale=linear counts=25 clob+ mode=h
dmimgadapt tricolor_hard_thresh.img tricolor_hard_flux_cone.img min=1 max=20 num=100 radscale=linear counts=25 clob+ mode=h
dmimg2jpg \
infile=tricolor_soft_flux_cone.img \
greenfile=tricolor_medium_flux_cone.img \
bluefile=tricolor_hard_flux_cone.img \
outfile=dmimg2jpg_exercise13_cone.jpg \
clob+
display < dmimg2jpg_exercise13_cone.jpg
Obtain overlapping multi-spectral images of this region from other archives. Use reproject_image to project the other datasets to the same tangent plane as the Chandra dataset. Create tri-color image using red for the lowest energy, and blue for the highest energy datasets.
Obtain the data for OBS_ID 635 and reprocess it with chandra_repro. Split the event file into 3 equal time intervals by filtering on the TIME column. Run fluximage on each time interval using the broad energy band. Use the 3 time-slices to create a 3 color image.
/bin/rm -rf 635
download_chandra_obsid 635 evt1,bpix,flt,mtl,msk,dtf,bias,pbk,asol,stat
Downloading files for ObsId 635, total size is 208 Mb. Type Format Size 0........H.........1 Download Time Average Rate --------------------------------------------------------------------------- evt1 fits 173 Mb #################### 21 s 8344.4 kb/s asol fits 26 Mb #################### 3 s 9889.3 kb/s mtl fits 4 Mb #################### < 1 s 5688.8 kb/s stat fits 3 Mb #################### < 1 s 4817.7 kb/s bias fits 435 Kb #################### < 1 s 1920.3 kb/s bias fits 433 Kb #################### < 1 s 2475.6 kb/s bias fits 432 Kb #################### < 1 s 2372.8 kb/s bias fits 426 Kb #################### < 1 s 3068.8 kb/s bias fits 423 Kb #################### < 1 s 2325.7 kb/s bpix fits 81 Kb #################### < 1 s 890.6 kb/s flt fits 7 Kb #################### < 1 s 96.7 kb/s msk fits 5 Kb #################### < 1 s 85.3 kb/s pbk fits 4 Kb #################### < 1 s 53.9 kb/s Total download size for ObsId 635 = 208 Mb Total download time for ObsId 635 = 26 s
download_obsid_caldb 635 ./CALDB
download_obsid_caldb infile = 635 outdir = ./CALDB background = no missing = no clobber = no verbose = 1 mode = ql Retrieving files for CALDB_VER = 4.9.2.1 Retrieving CALDB index files Processing infile=635/secondary/acisf00635_000N004_evt1.fits.gz Retrieving CALDB data files Filename: 0------------------1 telD1999-07-23geomN0006.fits .................... (skipped) telD1999-07-23aimptsN0002.fits .................... (skipped) telD1999-07-23tdetN0001.fits .................... (skipped) telD1999-07-23skyN0002.fits .................... (skipped) telD1999-07-23sgeomN0001.fits .................... (skipped) hrmaD1996-12-20axeffaN0008.fits .................... (skipped) hrmaD1996-12-20vignetN0003.fits .................... (skipped) acisD1997-04-17qeN0006.fits .................... (skipped) acisD2000-01-29qeuN0007.fits #################### acisD2000-01-29badpixN0004.fits #################### acisD1999-08-13contamN0013.fits .................... (skipped) acisD1996-11-01gradeN0004.fits .................... (skipped) acisD2000-01-29grdimgN0001.fits .................... (skipped) acisD2000-01-29gain_ctiN0008.fits .................... (skipped) acisD1996-11-01evtspltN0002.fits #################### acisD2000-01-29ctiN0009.fits #################### acisD2000-01-29t_gainN0008.fits #################### acisD1999-07-22subpixN0001.fits .................... (skipped) acisD2000-01-29fef_pha_ctiN0004.fits .................... (skipped) acisD1999-09-16dead_areaN0001.fits .................... (skipped) hrmaD1996-12-20reefN0001.fits .................... (skipped) acisD2000-01-29p2_respN0008.fits .................... (skipped) hrmaD1996-11-01wpsfN0001.fits .................... (skipped) acisD2000-01-29osip_ctiN0006.fits .................... (skipped) acisD1999-07-22gtilimN0007.fits ####################
chandra_repro 635 out=
Running chandra_repro version: 03 April 2020 Processing input directory '/home/kjg/Workshop/635' Resetting afterglow status bits in evt1.fits file... Running acis_build_badpix and acis_find_afterglow to create a new bad pixel file... Running acis_process_events to reprocess the evt1.fits file... Filtering the evt1.fits file by grade and status and time... Applying the good time intervals from the flt1.fits file... The new evt2.fits file is: /home/kjg/Workshop/635/repro/acisf00635_repro_evt2.fits Updating the event file header with chandra_repro HISTORY record Creating FOV file... Setting observation-specific bad pixel file in local ardlib.par. Cleaning up intermediate files WARNING: Observation-specific bad pixel file set for session use: /home/kjg/Workshop/635/repro/acisf00635_repro_bpix1.fits Run 'punlearn ardlib' when analysis of this dataset completed. The data have been reprocessed. Start your analysis with the new products in /home/kjg/Workshop/635/repro
dmstat "635/repro/acisf00635_repro_evt2.fits[cols time]" cen- sig- med-
time[s] min: 72039166.717 @: 1 max: 72141141.711 @: 451330 mean: 72091544.17 sum: 3.2537148722e+13 good: 451331 null: 0
python -c 'a=72039166;b=72141142;dt3=(b-a)/3.0;print(a+0.0*dt3,a+1.0*dt3,a+2.0*dt3,a+3.0*dt3)'
72039166.0 72073158.0 72107150.0 72141142.0
dmcopy "635/repro/acisf00635_repro_evt2.fits[time=72039166.0:72073158.0]" 635/repro/begin_evt.fits clob+
dmcopy "635/repro/acisf00635_repro_evt2.fits[time=72073158.0:72107150.0]" 635/repro/middle_evt.fits clob+
dmcopy "635/repro/acisf00635_repro_evt2.fits[time=72107150.0:72141142.0]" 635/repro/end_evt.fits clob+
fluximage 635/repro/begin_evt.fits rhooph_begin bin=6 band=broad clob+ verb=0
fluximage 635/repro/middle_evt.fits rhooph_middle bin=6 band=broad clob+ verb=0
fluximage 635/repro/end_evt.fits rhooph_end bin=6 band=broad clob+ verb=0
dmimg2jpg \
infile=rhooph_begin_broad_thresh.img \
greenfile=rhooph_middle_broad_thresh.img \
bluefile=rhooph_end_broad_thresh.img \
outfile=rhooph_time_slice.jpg \
clob+
display < rhooph_time_slice.jpg
e=635/repro/acisf00635_repro_evt2.fits
f=635/repro/acisf00635_repro_fov1.fits
dmcopy "${e}[sky=region($f),energy=500:7000][bin sky=6,time=::#3]" 635_time_cube.fits clob+
ds9 -frame delete -scale log -rgbcube 635_time_cube.fits -saveimage ds9_ex16_timecube.png -quit
display < ds9_ex16_timecube.png
Extract Light Curve¶
References:
- http://cxc.cfa.harvard.edu/ciao/threads/lightcurve/
- http://cxc.cfa.harvard.edu/ciao/threads/variable/
- http://cxc.cfa.harvard.edu/ciao/why/lightcurve.html
In X-ray astronomy the term "light curve" is used to describe the flux of a source vs time.
Exercise 17¶
- Create a light curve using the dmextract tool with the reprocessed level 2 event file filtered with the source and background regions created in Exercise 11 steps 3 and 6. Use a 100 second bin width: [bin time=::100].
- Repeat 1, using the following bin widths: 200, 500, 1000, 1.
- Plot each of the light curves.
dmextract 13858/repro/acisf13858_repro_evt2.fits"[sky=circle(4104.5,4115.5,10),energy=500:7000][bin time=::100]" \
out=dme_100s.lc op=ltc1 \
bkg=13858/repro/acisf13858_repro_evt2.fits"[sky=region(ds9_bkg.reg),energy=500:7000]" \
mode=h clob+
cat << EOM > mpl_ex17a.py
import matplotlib.pylab as plt
from pycrates import read_file
tab =read_file("dme_100s.lc[cols dt,net_rate]")
x = tab.get_column("dt").values
y = tab.get_column("net_rate").values
plt.plot(x,y, drawstyle="steps")
plt.xlabel("delta time")
plt.ylabel("net rate c/s")
plt.savefig("out_bin100.png")
EOM
python mpl_ex17a.py
display < out_bin100.png
for tt in 200 500 1000 1
do
dmextract 13858/repro/acisf13858_repro_evt2.fits"[sky=circle(4104.5,4115.5,10),energy=500:7000][bin time=::${tt}]" \
out=dme_${tt}s.lc op=ltc1 \
bkg=13858/repro/acisf13858_repro_evt2.fits"[sky=region(ds9_bkg.reg),energy=500:7000]" \
mode=h clob+
done
# dmextract (CIAO 4.12): WARNING: Binning size=1 smaller than TIMEDEL=3.14104 # dmextract (CIAO 4.12): WARNING: Binning size=1 smaller than TIMEDEL=3.14104
cat << EOM > mpl_ex17b.py
import matplotlib.pylab as plt
from pycrates import read_file
plt.subplot(4,1,1)
tab =read_file("dme_200s.lc[cols dt,net_rate]")
x = tab.get_column("dt").values
y = tab.get_column("net_rate").values
plt.plot(x,y, drawstyle="steps")
plt.ylabel("net rate c/s")
plt.subplot(4,1,2)
tab =read_file("dme_500s.lc[cols dt,net_rate]")
x = tab.get_column("dt").values
y = tab.get_column("net_rate").values
plt.plot(x,y, drawstyle="steps")
plt.ylabel("net rate c/s")
plt.subplot(4,1,3)
tab =read_file("dme_1000s.lc[cols dt,net_rate]")
x = tab.get_column("dt").values
y = tab.get_column("net_rate").values
plt.plot(x,y, drawstyle="steps")
plt.ylabel("net rate c/s")
plt.subplot(4,1,4)
tab =read_file("dme_1s.lc[cols dt,net_rate]")
x = tab.get_column("dt").values
y = tab.get_column("net_rate").values
plt.plot(x,y, drawstyle="steps")
plt.ylabel("net rate c/s")
plt.xlabel("delta time")
plt.savefig("out_bin_strip.png")
EOM
python mpl_ex17b.py
display < out_bin_strip.png
dmlist dme_100s.lc cols
-------------------------------------------------------------------------------- Columns for Table Block LIGHTCURVE -------------------------------------------------------------------------------- ColNo Name Unit Type Range 1 TIME_BIN channel Int4 1:179 S/C TT corresponding to mid-exposure 2 TIME_MIN s Real8 456518974.4871399999:456536836.1380900145 Minimum Value in Bin 3 TIME s Real8 456518974.4871399999:456536836.1380900145 S/C TT corresponding to mid-exposure 4 TIME_MAX s Real8 456518974.4871399999:456536836.1380900145 Maximum Value in Bin 5 COUNTS count Int4 - Counts 6 STAT_ERR count Real8 0:+Inf Statistical error 7 AREA pixel**2 Real8 -Inf:+Inf Area of extraction 8 EXPOSURE s Real8 -Inf:+Inf Time per interval 9 COUNT_RATE count/s Real8 0:+Inf Rate 10 COUNT_RATE_ERR count/s Real8 0:+Inf Rate Error 11 BG_COUNTS count Real8 -Inf:+Inf Background Counts 12 BG_ERR count Real8 -Inf:+Inf Error on Background counts 13 BG_AREA pixel**2 Real8 -Inf:+Inf Background Area of Extraction 14 BG_EXPOSURE s Real8 -Inf:+Inf Exposure time of background file 15 BG_RATE count/s Real8 -Inf:+Inf Background Rate 16 NORM_BG_COUNTS count Real8 -Inf:+Inf Background Counts 17 NORM_BG_ERR count Real8 -Inf:+Inf Error on Background counts 18 NET_COUNTS count Real8 -Inf:+Inf Net Counts 19 NET_ERR count Real8 -Inf:+Inf Error on Net Counts 20 NET_RATE count/s Real8 -Inf:+Inf Net Count Rate 21 ERR_RATE count/s Real8 -Inf:+Inf Error Rate -------------------------------------------------------------------------------- World Coord Transforms for Columns in Table Block LIGHTCURVE -------------------------------------------------------------------------------- ColNo Name 2: DT_MIN = +0 [s] +1.0 * (TIME_MIN -456519024.487140) 3: DT = +0 [s] +1.0 * (TIME -456519024.487140) 4: DT_MAX = +0 [s] +1.0 * (TIME_MAX -456519024.487140)
dmlist 13858/repro/acisf13858_repro_evt2.fits blocks,subspace
-------------------------------------------------------------------------------- Dataset: 13858/repro/acisf13858_repro_evt2.fits -------------------------------------------------------------------------------- Block Name Type Dimensions -------------------------------------------------------------------------------- Block 1: PRIMARY Null Block 2: EVENTS Table 16 cols x 134015 rows Block 3: GTI7 Table 2 cols x 1 rows Block 4: GTI5 Table 2 cols x 1 rows Block 5: GTI6 Table 2 cols x 1 rows Block 6: GTI8 Table 2 cols x 1 rows -------------------------------------------------------------------------------- Data subspace for block EVENTS: Components: 4 Descriptors: 16 -------------------------------------------------------------------------------- --- Component 1 --- 1 time Real8 TABLE GTI7 456520729.9422901273:456535800.4991979599 2 expno Int4 3:4801 3 ccd_id Int2 7:7 4 node_id Int2 0:3 5 chip [ 1] chipx 1:1024 5 chip [ 2] chipy 1:1024 6 tdet [ 1] tdetx 1:8192 6 tdet [ 2] tdety 1:8192 7 det [ 1] detx 0.50: 8192.50 7 det [ 2] dety 0.50: 8192.50 8 sky [ 1] x 0.50: 8192.50 8 sky [ 2] y 0.50: 8192.50 9 phas Int2 -4096:4095 10 pha Int4 0:36855 11 pha_ro Int4 0:36855 12 energy Real4 0: 1000000.0 13 pi Int4 1:1024 14 fltgrade Int2 0:255 15 grade Int2 0:0,2:2,3:3,4:4,6:6 16 status Bit --- Component 2 --- 1 time Real8 TABLE GTI5 456520729.9833301306:456535800.5402380228 2 expno Int4 3:4801 3 ccd_id Int2 5:5 4 node_id Int2 0:3 5 chip [ 1] chipx 1:1024 5 chip [ 2] chipy 1:1024 6 tdet [ 1] tdetx 1:8192 6 tdet [ 2] tdety 1:8192 7 det [ 1] detx 0.50: 8192.50 7 det [ 2] dety 0.50: 8192.50 8 sky [ 1] x 0.50: 8192.50 8 sky [ 2] y 0.50: 8192.50 9 phas Int2 -4096:4095 10 pha Int4 0:36855 11 pha_ro Int4 0:36855 12 energy Real4 0: 1000000.0 13 pi Int4 1:1024 14 fltgrade Int2 0:255 15 grade Int2 0:0,2:2,3:3,4:4,6:6 16 status Bit --- Component 3 --- 1 time Real8 TABLE GTI6 456520730.0243701339:456535800.5812779665 2 expno Int4 3:4801 3 ccd_id Int2 6:6 4 node_id Int2 0:3 5 chip [ 1] chipx 1:1024 5 chip [ 2] chipy 1:1024 6 tdet [ 1] tdetx 1:8192 6 tdet [ 2] tdety 1:8192 7 det [ 1] detx 0.50: 8192.50 7 det [ 2] dety 0.50: 8192.50 8 sky [ 1] x 0.50: 8192.50 8 sky [ 2] y 0.50: 8192.50 9 phas Int2 -4096:4095 10 pha Int4 0:36855 11 pha_ro Int4 0:36855 12 energy Real4 0: 1000000.0 13 pi Int4 1:1024 14 fltgrade Int2 0:255 15 grade Int2 0:0,2:2,3:3,4:4,6:6 16 status Bit --- Component 4 --- 1 time Real8 TABLE GTI8 456520730.0654101372:456535800.6223180294 2 expno Int4 3:4801 3 ccd_id Int2 8:8 4 node_id Int2 0:3 5 chip [ 1] chipx 1:1024 5 chip [ 2] chipy 1:1024 6 tdet [ 1] tdetx 1:8192 6 tdet [ 2] tdety 1:8192 7 det [ 1] detx 0.50: 8192.50 7 det [ 2] dety 0.50: 8192.50 8 sky [ 1] x 0.50: 8192.50 8 sky [ 2] y 0.50: 8192.50 9 phas Int2 -4096:4095 10 pha Int4 0:36855 11 pha_ro Int4 0:36855 12 energy Real4 0: 1000000.0 13 pi Int4 1:1024 14 fltgrade Int2 0:255 15 grade Int2 0:0,2:2,3:3,4:4,6:6 16 status Bit
Q: Why is there a gap at the beginning and at the end of the light curves with count_rate=0? outside of GTI but inside of TSTART-TSTOP
Q: Is the delta-time, dt, column actually a column in the dmextract output file? No, it's a coord on time column
Q: What can be learned from the light curve with 1 second time resolution? nothing
Q: What energy events were used to make these light curves? Does using an energy filter change things and if so how? **used energy=500:7000, if not then would have used all energies **
Q: ACIS event files contain multiple good time intervals (one for each chip). Which GTI was use? The first one, which in this case is for CCD=7 which is correct
Exercise 18¶
- Create a light curve using the glvary tool using the reprocessed level 2 event file with the source region.
- Repeat 1 using the background region.
- Plot the glvary source and background lightcurves using chips
glvary 13858/repro/acisf13858_repro_evt2.fits"[sky=circle(4104.5,4115.5,10),energy=500:7000]" \
out=glvary_src.prob lc=glvary_src.lc clob+ mode=h
cat << EOM > mpl_ex18a.py
import matplotlib.pylab as plt
from pycrates import read_file
tab =read_file("glvary_src.lc[cols time,count_rate]")
x = tab.get_column("time").values
y = tab.get_column("count_rate").values
plt.plot(x,y, drawstyle="steps")
plt.xlabel("time")
plt.ylabel("count rate c/s")
plt.savefig("glvary_src.png")
EOM
python mpl_ex18a.py
display < glvary_src.png
glvary 13858/repro/acisf13858_repro_evt2.fits"[sky=region(ds9_bkg.reg),energy=500:7000]" \
out=glvary_bkg.prob lc=glvary_bkg.lc clob+ mode=h
cat << EOM > mpl_ex18b.py
import matplotlib.pylab as plt
from pycrates import read_file
tab =read_file("glvary_bkg.lc[cols time,count_rate]")
x = tab.get_column("time").values
y = tab.get_column("count_rate").values
plt.plot(x,y, drawstyle="steps")
plt.xlabel("time")
plt.ylabel("count rate c/s")
plt.savefig("glvary_bkg.png")
EOM
python mpl_ex18b.py
display < glvary_bkg.png
Q: Describe how the glvary lightcurves differ from the dmextract light curves. it picked binning, no
dt
column. No net-rate
Q: Could any variability in the source region be due to variability in the background? No variability, background is not variable either
Extra Credit¶
Use the dither_region tool to compute the time resolved area fraction of the source and separately the background regions. Try using those as input to dmextract and glvary as exposure corrections. Compare to the results without those corrections.
punlearn ardlib
acis_set_ardlib 13858/repro/acisf13858_repro_bpix1.fits abs-
Updated ardlib parameter file: /home/kjg/cxcds_param4/ardlib.par AXAF_ACIS0_BADPIX_FILE -> CALDB AXAF_ACIS1_BADPIX_FILE -> CALDB AXAF_ACIS2_BADPIX_FILE -> CALDB AXAF_ACIS3_BADPIX_FILE -> CALDB AXAF_ACIS4_BADPIX_FILE -> CALDB AXAF_ACIS5_BADPIX_FILE -> 13858/repro/acisf13858_repro_bpix1.fits[BADPIX5] AXAF_ACIS6_BADPIX_FILE -> 13858/repro/acisf13858_repro_bpix1.fits[BADPIX6] AXAF_ACIS7_BADPIX_FILE -> 13858/repro/acisf13858_repro_bpix1.fits[BADPIX7] AXAF_ACIS8_BADPIX_FILE -> 13858/repro/acisf13858_repro_bpix1.fits[BADPIX8] AXAF_ACIS9_BADPIX_FILE -> CALDB
dither_region \
13858/repro/pcadf456520092N001_asol1.fits \
"circle(4104.5,4115.5,10)" \
dr_src.out \
wcs= 13858/repro/acisf13858_repro_evt2.fits \
mask= 13858/repro/acisf13858_000N001_msk1.fits \
mode=h clob+
dmlist dr_src.out cols
-------------------------------------------------------------------------------- Columns for Table Block AREAFRACTION -------------------------------------------------------------------------------- ColNo Name Unit Type Range 1 TIME s Real8 456520092.2497000098:456535804.9880300164 Time 2 EQPOS(RA,DEC) deg Real8 -360.0: 360.0 Sky Position 3 ROLL deg Real8 -Inf:+Inf Roll angle 4 FRACAREA Real8 -Inf:+Inf Fraction area 5 AREA_CHIP_FRAC[10] Real8(10) -Inf:+Inf Region Area Fraction per chip 6 DELTA_T s Real8 -Inf:+Inf Time 7 CHIP_FRAC_TIME[10] Real8(10) -Inf:+Inf Fraction of ontime per chip 8 STATUS Bit[8] Why fraction < 1
cat << EOM > mpl_ex18_drout.py
import matplotlib.pylab as plt
from pycrates import read_file
tab =read_file("dr_src.out[cols time,fracarea]")
x = tab.get_column("time").values
y = tab.get_column("fracarea").values
plt.plot(x,y, drawstyle="steps")
plt.xlabel("time")
plt.ylabel("fraction of area")
plt.savefig("dr_src.png")
EOM
python mpl_ex18_drout.py
display < dr_src.png
dither_region \
13858/repro/pcadf456520092N001_asol1.fits \
"region(ds9_bkg.reg)" \
dr_bkg.out \
wcs= 13858/repro/acisf13858_repro_evt2.fits \
mask= 13858/repro/acisf13858_000N001_msk1.fits \
mode=h clob+ maxpix=10000
# dither_region (CIAO 4.12): WARNING: Too many pixels, resetting resolution from 1.000000e+00 to 2.000000e+00 # dither_region (CIAO 4.12): WARNING: Too many pixels, resetting resolution from 2.000000e+00 to 3.000000e+00
cat << EOM > mpl_ex18_droutb.py
import matplotlib.pylab as plt
from pycrates import read_file
tab =read_file("dr_bkg.out[cols time,fracarea]")
x = tab.get_column("time").values
y = tab.get_column("fracarea").values
plt.plot(x,y, drawstyle="steps")
plt.xlabel("time")
plt.ylabel("fraction of area")
plt.savefig("dr_bkg.png")
EOM
python mpl_ex18_droutb.py
display < dr_bkg.png
The background is dither across bad columns/pixels, but only a tiny fraction of the area is lost.
Check for background flares¶
Reference:
Background flares may influence results especially when working with large source regions such as supernovae remnants or clusters.
For an on-axis point source, users should carefully consider whether excluding time due to a background flare would be better than accepting the time in order to obtain higher signal to noise.
Exercise 19¶
In this exercise, students will extract a light curve for a background, source-free region and use it to search for any evidence of a background flare.
- Using dmcoords, dmstat, dmlist, or ds9+dax, determine the CCD_ID where the bright source in the center of the field is located.
- Use dmcopy to exclude the wavdetect sources detected in Exercise 10 step 3 from the reprocessed Level 2 event file.
- Use dmextract to create a light curve using the source free event file, use a CCD_ID filter to select events from chip you found in step 1. Use a bin-width of 259.28 seconds.
- Use the deflare tool to search for background flares on the source chip using method=clean.
- Use dmcopy to apply the deflare output good-time interval, GTI, file to the reprocessed level 2 event file.
punlearn dmcoords
dmcoords 13858/repro/acisf13858_repro_evt2.fits op=sky x=4104.5 y=4115.5 verb=0
pget dmcoords x y ra dec chip_id chipx chipy
4104.5 4115.5 09:14:49.087 +08:53:21.00 7 207.3356406343804 517.7142405898469
python -c 'from region import *;wav=CXCRegion("acisf13858_wav.src");out=field()-wav;out.write("exclude.reg",fits=True, clobber=True)'
dmcopy 13858/repro/acisf13858_repro_evt2.fits"[sky=region(exclude.reg)]" 13858_evt.holes clob+
ds9 13858_evt.holes -scale log -bin factor 8 -saveimage png ds9_ex19.png -quit
display < ds9_ex19.png
dmextract 13858_evt.holes'[ccd_id=7][bin time=::259.28]' bkg_lc op=ltc1 clob+
cat << EOM > mpl_ex19.py
import matplotlib.pylab as plt
from pycrates import read_file
tab =read_file("bkg_lc[cols dt,count_rate]")
x = tab.get_column("dt").values
y = tab.get_column("count_rate").values
plt.plot(x,y, drawstyle="steps")
plt.xlabel("delta time")
plt.ylabel("count_rate")
plt.savefig("example19.png")
EOM
python mpl_ex19.py
display < example19.png
deflare bkg_lc bkg_lc_flare method=clean save="bkg_lc_flare.png"
#convert bkg_lc_flare.ps -trim bkg_lc_flare.png
display < bkg_lc_flare.png
Parameters used to clean the lightcurve are: script version = 28 August 2020 mean = None clip = 3 scale = 1.2 minfrac = 0.1 outfile = bkg_lc_flare plot = True rateaxis = y color = lime pattern = solid pattern color = red Total number of bins in lightcurve = 69 Max length of one bin = 255.892 s Num. bins with a smaller exp. time = 2 Num. bins with exp. time = 0 = 10 Number of bins with a rate of 0 ct/s = 10 Calculated an initial mean (sigma-clipped) rate of 3.22786 ct/s Lightcurve limits use a scale factor of 1.2 about this mean Filtering lightcurve between rates of 2.68988 and 3.87343 ct/s Number of good time bins = 58 Rate filter: 2.689879793095042 <= count_rate < 3.8734269020568606 Mean level of filtered lightcurve = 3.2278557517140505 ct/s GTI limits calculated using a count-rate filter: (count_rate>2.689879793095042 && count_rate<3.8734269020568606) The corresponding times are: ((time >= 456520530.16714) && (time < 456531160.64713997)) ; 10.29 ksec, bin 1 ((time >= 456531419.92714) && (time < 456535827.68714)) ; 4.32 ksec, bin 2 Exposure time of lightcurve = 14.87 ks Filtered exposure time = 14.62 ks DTCOR value = 0.986934 Creating GTI file Created: bkg_lc_flare Light curve cleaned using the lc_clean routine. Created: bkg_lc_flare.png
dmcopy 13858/repro/acisf13858_repro_evt2.fits"[@bkg_lc_flare]" 13858_deflare.evt clob+
dmlist 13858/repro/acisf13858_repro_evt2.fits counts
dmlist 13858_deflare.evt counts
134015 131495
Q: What CCD_ID was found in step 1? Which tool(s) were used? chip 7,
dmcoords
Q: Was there any evidence of a background flare in this observation, on this chip? If so, describe the flare (when did it occur within the observation, duration, etc.): **Yes, a very short 1-time-bin duration fare in the 2nd half of the observation **
Extra Credit¶
Try different bin-widths when creating the light curve. Does it affect the results?
dmextract 13858_evt.holes'[ccd_id=7][bin time=::50]' bkg_lc_50s op=ltc1 clob+
deflare bkg_lc_50s bkg_lc_flare_50s method=clean save="bkg_lc_flare_50s.png" plot- verb=0
#convert bkg_lc_flare_50s.ps -trim bkg_lc_flare50s.png
display < bkg_lc_flare_50s.png
Try different deflare method options.
deflare bkg_lc_50s bkg_lc_sigmaclip_50s method=sigma save="bkg_lc_sigmaclip_50s.png" plot- verb=0 < /dev/null
#convert bkg_lc_sigmaclip_50s.ps -trim bkg_lc_sigmaclip50s.png
display < bkg_lc_sigmaclip_50s.png
Try looking for flares on the other CCD's used in this observation.
dmextract 13858_evt.holes'[ccd_id=6][bin time=::259]' bkg_6lc op=ltc1 clob+
deflare bkg_6lc bkg_6lc_flare method=clean save="bkg_6lc_flare.png" plot- verb=0
#convert bkg_6lc_flare.ps -trim bkg_6lc_flare.png
display < bkg_6lc_flare.png
Spectral Analysis¶
The energy resolution and sensitivity of the ACIS detector allows for spectral analysis roughly in the 0.3 to 7.0 keV range.
Exercise 20¶
In this exercise Students will use the specextract tool to extract the spectrum, ARF, and RMF files for the source and background regions.
- Run the specextract script using the reprocessed level 2 event file with the source region from Exercise 11 step 3 and the background region from step 6 with the default parameter settings.
- Run specextract as in step 1 with a different outroot and setting weight=no
- Run specextract as in step 2 with a different outroot and setting correctpsf=yes
- Use dmdiff to compare the spectra (.pi) from steps 2 and 3 to the spectrum in step 1.
- Use dmdiff to compare the auxiliary response file (.arf) from steps 2 and 3 to the ARF in step 1.
- Use dmlist to get the BACKSCAL and EXPOSURE keywords from the source and background spectra.
punlearn specextract
specextract 13858/repro/acisf13858_repro_evt2.fits"[sky=circle(4104.5,4115.5,10)]" \
out=specextract_01 \
bkgfile=13858/repro/acisf13858_repro_evt2.fits"[sky=region(ds9_bkg.reg)]" \
mode=h clob+
Running specextract Version: 06 April 2020 Checking for blank sky background files... Using event file 13858/repro/acisf13858_repro_evt2.fits[sky=circle(4104.5,4115.5,10)] Aspect solution file 13858/repro/pcadf456520092N001_asol1.fits found. Bad-pixel file 13858/repro/acisf13858_repro_bpix1.fits found. Mask file 13858/repro/acisf13858_000N001_msk1.fits found. Setting bad pixel file Extracting src spectra Creating src ARF Creating src RMF Using mkacisrmf... Grouping src spectrum Updating header of specextract_01.pi with RESPFILE and ANCRFILE keywords. Updating header of specextract_01_grp.pi with RESPFILE and ANCRFILE keywords. Setting bad pixel file Extracting bkg spectra Creating bkg ARF Creating bkg RMF Using mkacisrmf... Updating header of specextract_01_bkg.pi with RESPFILE and ANCRFILE keywords. Updating header of specextract_01.pi with BACKFILE keyword. Updating header of specextract_01_grp.pi with BACKFILE keyword.
punlearn specextract
specextract 13858/repro/acisf13858_repro_evt2.fits"[sky=circle(4104.5,4115.5,10)]" \
out=specextract_02 \
bkgfile=13858/repro/acisf13858_repro_evt2.fits"[sky=region(ds9_bkg.reg)]" \
weight=no \
mode=h clob+
Running specextract Version: 06 April 2020 Checking for blank sky background files... Using event file 13858/repro/acisf13858_repro_evt2.fits[sky=circle(4104.5,4115.5,10)] Aspect solution file 13858/repro/pcadf456520092N001_asol1.fits found. Bad-pixel file 13858/repro/acisf13858_repro_bpix1.fits found. Mask file 13858/repro/acisf13858_000N001_msk1.fits found. Setting bad pixel file Extracting src spectra Creating src ARF Creating src RMF Using mkacisrmf... Grouping src spectrum Updating header of specextract_02.pi with RESPFILE and ANCRFILE keywords. Updating header of specextract_02_grp.pi with RESPFILE and ANCRFILE keywords. Setting bad pixel file Extracting bkg spectra Creating bkg ARF Creating bkg RMF Using mkacisrmf... Updating header of specextract_02_bkg.pi with RESPFILE and ANCRFILE keywords. Updating header of specextract_02.pi with BACKFILE keyword. Updating header of specextract_02_grp.pi with BACKFILE keyword.
punlearn specextract
specextract 13858/repro/acisf13858_repro_evt2.fits"[sky=circle(4104.5,4115.5,10)]" \
out=specextract_03 \
bkgfile=13858/repro/acisf13858_repro_evt2.fits"[sky=region(ds9_bkg.reg)]" \
correctpsf=yes \
mode=h clob+
Running specextract Version: 06 April 2020 WARNING: The 'correct' parameter is ignored when 'weight=yes'. Checking for blank sky background files... Using event file 13858/repro/acisf13858_repro_evt2.fits[sky=circle(4104.5,4115.5,10)] Aspect solution file 13858/repro/pcadf456520092N001_asol1.fits found. Bad-pixel file 13858/repro/acisf13858_repro_bpix1.fits found. Mask file 13858/repro/acisf13858_000N001_msk1.fits found. Setting bad pixel file Extracting src spectra Creating src ARF Creating src RMF Using mkacisrmf... Grouping src spectrum Updating header of specextract_03.pi with RESPFILE and ANCRFILE keywords. Updating header of specextract_03_grp.pi with RESPFILE and ANCRFILE keywords. Setting bad pixel file Extracting bkg spectra Creating bkg ARF Creating bkg RMF Using mkacisrmf... Updating header of specextract_03_bkg.pi with RESPFILE and ANCRFILE keywords. Updating header of specextract_03.pi with BACKFILE keyword. Updating header of specextract_03_grp.pi with BACKFILE keyword.
/bin/ls specextra*pi
specextract_01.pi specextract_02.pi specextract_03.pi specextract_01_bkg.pi specextract_02_bkg.pi specextract_03_bkg.pi specextract_01_grp.pi specextract_02_grp.pi specextract_03_grp.pi
dmdiff specextract_01.pi specextract_02.pi || echo
Infile 1: specextract_01.pi Infile 2: specextract_02.pi ----------------------- HEADER VALUE DIFFERENCES ----------------------- Message: Keyword: Value(s): Diff: -------- ------- --------- ----- Values are not equal CHECKSUM RhAiSZ2hRf8hRZ8h RYJgRXJgRXJgRXJg # dmdiff (CIAO 4.12): WARNING: CHECKSUM comments are different. # dmdiff (CIAO 4.12): comment1= "HDU checksum updated 2020-10-13T18:20:45" # dmdiff (CIAO 4.12): comment2= "HDU checksum updated 2020-10-13T18:21:57" # dmdiff (CIAO 4.12): WARNING: DATASUM comments are different. # dmdiff (CIAO 4.12): comment1= "data unit checksum updated 2020-10-13T18:20:07" # dmdiff (CIAO 4.12): comment2= "data unit checksum updated 2020-10-13T18:21:19" Values are not equal DATE 2020-10-13T18:20:06 2020-10-13T18:21:19 Values are not equal BACKFILE specextract_01_bkg.pi specextract_02_bkg.pi Values are not equal RESPFILE specextract_01.rmf specextract_02.rmf Values are not equal ANCRFILE specextract_01.arf specextract_02.arf -------------------------- SUBSPACE VALUE DIFFERENCES -------------------------- Message: Column: Row Value(s): Diff: -------- ------- --- --------- ----- TABLE NAME: SPECTRUM ----------------------- TABLE VALUE DIFFERENCES ----------------------- Message: Row: Column: Value(s): Diff: -------- ---- ------- --------- -----
Few keyword diffs, data are the same
dmdiff specextract_01.pi specextract_03.pi || echo
Infile 1: specextract_01.pi Infile 2: specextract_03.pi ----------------------- HEADER VALUE DIFFERENCES ----------------------- Message: Keyword: Value(s): Diff: -------- ------- --------- ----- Values are not equal CHECKSUM RhAiSZ2hRf8hRZ8h MealPcakMcakMcak # dmdiff (CIAO 4.12): WARNING: CHECKSUM comments are different. # dmdiff (CIAO 4.12): comment1= "HDU checksum updated 2020-10-13T18:20:45" # dmdiff (CIAO 4.12): comment2= "HDU checksum updated 2020-10-13T18:22:38" # dmdiff (CIAO 4.12): WARNING: DATASUM comments are different. # dmdiff (CIAO 4.12): comment1= "data unit checksum updated 2020-10-13T18:20:07" # dmdiff (CIAO 4.12): comment2= "data unit checksum updated 2020-10-13T18:22:00" Values are not equal DATE 2020-10-13T18:20:06 2020-10-13T18:22:00 Values are not equal BACKFILE specextract_01_bkg.pi specextract_03_bkg.pi Values are not equal RESPFILE specextract_01.rmf specextract_03.rmf Values are not equal ANCRFILE specextract_01.arf specextract_03.arf -------------------------- SUBSPACE VALUE DIFFERENCES -------------------------- Message: Column: Row Value(s): Diff: -------- ------- --- --------- ----- TABLE NAME: SPECTRUM ----------------------- TABLE VALUE DIFFERENCES ----------------------- Message: Row: Column: Value(s): Diff: -------- ---- ------- --------- -----
Same, few keys, no data diffs.
dmdiff specextract_01.arf"[#row=1:10]" specextract_02.arf"[#row=1:10]" comment- || echo
Infile 1: specextract_01.arf[#row=1:10] Infile 2: specextract_02.arf[#row=1:10] ----------------------- HEADER VALUE DIFFERENCES ----------------------- # dmdiff (CIAO 4.12): WARNING: header key "CHANTYPE" not present in infile2. # dmdiff (CIAO 4.12): WARNING: header key "DETCHANS" not present in infile2. # dmdiff (CIAO 4.12): WARNING: header key "THRSHLD" not present in infile2. # dmdiff (CIAO 4.12): WARNING: header key "FEFFILE" not present in infile2. # dmdiff (CIAO 4.12): WARNING: header key "FILTER" not present in infile1. # dmdiff (CIAO 4.12): WARNING: header key "RESPFILE" not present in infile1. # dmdiff (CIAO 4.12): WARNING: header key "ASPFILE" not present in infile1. # dmdiff (CIAO 4.12): WARNING: header key "FRACEXPO" not present in infile1. Message: Keyword: Value(s): Diff: -------- ------- --------- ----- Values are not equal CREATOR mkwarf - Version CIAO 4.12 mkarf v0.6.2-0 Values are not equal CHECKSUM Hc9MJa7MHa7MHa7M GX1SJU0RGU0RGU0R Values are not equal DATASUM 3336150329 3278258911 Values are not equal DATE 2020-10-13T18:20:13 2020-10-13T18:21:26 Values are not equal DETNAM ACIS-5678 ACIS-7 Values are not equal EXPOSURE 14873.648987049 14873.649553508 +0.000566459 # dmdiff (CIAO 4.12): WARNING: EXPOSURE units are different. # dmdiff (CIAO 4.12): unit1= "s" # dmdiff (CIAO 4.12): unit2= "secs" Values are not equal HISTNUM 96 49 -47 -------------------------- SUBSPACE VALUE DIFFERENCES -------------------------- Message: Column: Row Value(s): Diff: -------- ------- --- --------- ----- # dmdiff (CIAO 4.12): WARNING: Subspace column "ENERG_LO" ranges are different sizes. infile1 column has 0 value(s). infile2 column has 1 value(s). Skipping... # dmdiff (CIAO 4.12): WARNING: Subspace column "ENERG_HI" ranges are different sizes. infile1 column has 0 value(s). infile2 column has 1 value(s). Skipping... TABLE NAME: SPECRESP ----------------------- TABLE VALUE DIFFERENCES ----------------------- Message: Row: Column: Value(s): Diff: -------- ---- ------- --------- ----- Values are not equal 1 SPECRESP 1.49147403240204 1.48973083496094 -0.0017432 (-0.117 %) Values are not equal 2 SPECRESP 4.97732734680176 4.97146940231323 -0.00585794 (-0.118 %) Values are not equal 3 SPECRESP 7.5324239730835 7.52350187301636 -0.0089221 (-0.118 %) Values are not equal 4 SPECRESP 10.3130264282227 10.3007335662842 -0.0122929 (-0.119 %) Values are not equal 5 SPECRESP 12.8653202056885 12.8498973846436 -0.0154228 (-0.12 %) Values are not equal 6 SPECRESP 15.0967969894409 15.0785875320435 -0.0182095 (-0.121 %) Values are not equal 7 SPECRESP 17.0457077026367 17.025032043457 -0.0206757 (-0.121 %) Values are not equal 8 SPECRESP 19.3807334899902 19.3570747375488 -0.0236588 (-0.122 %) Values are not equal 9 SPECRESP 22.7180690765381 22.6901760101318 -0.0278931 (-0.123 %) Values are not equal 10 SPECRESP 26.3358535766602 26.3033237457275 -0.0325298 (-0.124 %)
dmstat specextract_01.arf"[cols specresp]" | egrep 'min|max'
min: 0.56832158566 @: 1070 max: 633.48712158 @: 125
dmstat specextract_02.arf"[cols specresp]" | egrep 'min|max'
min: 0.56637853384 @: 1070 max: 632.10601807 @: 125
dmstat specextract_03.arf"[cols specresp]" | egrep 'min|max'
min: 0.56832158566 @: 1070 max: 633.48712158 @: 125
dmlist specextract_01.pi,specextract_01_bkg.pi header,clean | egrep 'BACKSCAL|EXPOSURE'
BACKSCAL 4.681337854E-06 [pixel] Fractional area EXPOSURE 14873.6489870490 [s] Exposure time BACKSCAL 0.0006366619481 [pixel] Fractional area EXPOSURE 14873.6489870490 [s] Exposure time
Q: Record the BACKSCAL and EXPOSURE keywords. Why are these keywords important? Used to scale background to source
Q: Describe and discuss the differences, if any, from step 4. Smaller max by a little bit
Q: Describe and discuss the differences, if any, from step 5: None, warning 'corect=yes is not used when making weighted
Extra Credit¶
Use the rmfimg tool to convert the RMF into an image and display in ds9.
rmfimg specextract_01.rmf specextract_01.rmf.img clob+
ds9 specextract_01.rmf.img -scale log -zoom to fit -view colorbar no -cmap heat \
-saveimage png ds9_exercise20.png -quit
display < ds9_exercise20.png
Sherpa: Modeling and Fitting¶
References
sherpa is the fitting and modeling package developed for CIAO. It allows users to obtain best fit model parameters based on a number of models, fitting methods, and statistics used for uncertainty.
The exercise shown here is an extremely simple sherpa use case. More advanced usage includes user supplied models, linked model parameters, simultaneously fitting multiple datasets, fitting images, etc.
Exercise 21¶
In this exercise Students will begin to use sherpa to model and fit the spectrum of the source.
- Load the ungrouped source spectrum obtained from Exercise 20 step 1 into sherpa
sherpa> load_data("source.pha")
- Plot the spectrum using the plot_data command
- Group the data using group_counts(). Select a reasonable number of counts for the dataset. Replot the data.
- Restrict the energy range to a reasonable energy range using the notice() command. Replot the data.
- Set the source model to be an absorbed powerlaw using the set_source() command.
sherpa> set_source(xswabs.abs1*xspowerlaw.p1)
- Set the absorption nH to the value listed in the header of the spectrum file.
- Use plot_model() to see the model folded through the instrument responses (ARF and RMF).
- Use show_all() to see all the data and model details.
- subtract() the background. Replot the data.
- fit() the data.
- Use plot_fit() to see the data with the model overplotted.
- Use plot_fit_delchi() to see the data with the error weighted residuals.
- Use conf() to obtain uncertainties on the fitted parameters.
- Use set_method() to try different minimization techniques and repeat the fit().
- Use set_stat() to try different fit statistics and repeat the fit().
- Try different grouping schemes.
- Try different spectral models in the set_source() command.
- Repeat this exercise using the spectrum, ARF and RMF obtain in Exercise 20 steps 2 and 3.
Q: Which fit method works best?
Q: Which spectrum fits best?
Q: Which model/param is best?
Q: How does grouping affect the results?
Q: What are the advantages/disadvantages of one method over another?
Download the notebook.