So in mosaic/ I have:
xun4> ls Atthk.ds@ mos2_clean_evt.fits@ mos1_clean_evt.fits@ pn_clean_evt.fits@
xun4> xmmmosaic.csh pn_clean_evt.fits m1_clean_evt.fits m2_clean_evt.fits atthk.dat 22 300 8000 pm1m2bin22_03_8keV_ | & tee pm1m2bin22_03_8keV_log.txt --------------------XMMMOSAIC.CSH version 1.3--------------------- Input was /exgal6/bjm/scripts/xmmmosaic.csh pn_clean_evt.fits m1_clean_evt.fits m2_clean_evt.fits atthk.dat 22 300 8000 pm1m2bin22_03_8keV_ Making PN image, and generating exposure map... used XMMEXPMAP.CSH version 1.1 - log written to pm1m2bin22_03_8keV_pn_expmaplog.txt Making MOS1 image, and generating exposure map... used XMMEXPMAP.CSH version 1.1 - log written to pm1m2bin22_03_8keV_m1_expmaplog.txt Making MOS2 image, and generating exposure map... used XMMEXPMAP.CSH version 1.1 - log written to pm1m2bin22_03_8keV_m2_expmaplog.txt 3 data set(s) in use - renormalising exposure maps so their max value when added together is 1 Mosaicing images... mosaic written to pm1m2bin22_03_8keV_mosaic.fits and normalised mosaic (created with exposure maps normalised so their maximum is 1) written to pm1m2bin22_03_8keV_mosaic_norm.fitsThis script creates 2 mosaiced images pm1m2bin22_E03_8keV_mosaic.fits, with units of counts per second, and pm1m2bin22_E03_8keV_mosaic_norm.fits which was created with a normalised exposure map, so still has units of counts. This flattens the image, to account for vignetting, but preserves the Poisson statistics, which is useful when making radial profiles and performing 2D fitting
We need to take our mosaiced image, and crop it down into a smaller region. I used a square region, trying to avoid chip gaps, and include most of the emission detected above. I used the CIAO tool dmcopy to crop the image,
xun4> dmcopy "pm1m2bin22_E03_8keV_mosaic.fits[(x,y)=region(pm1m2bin22_box.reg)]" pm1m2bin22_E03_8keV_boxmosaic.fitsI then use calview to generate psf images for the three telescopes. This cannot be done from the command line - you need to use the GUI
xun4> calview &Now enter the details for your observation into the calview window, and click on view -> PSF. This will display a psf image in ds9, then go to file -> save as fits image (in ds9) and save the psf image. Repeat for the 3 cameras. Now I use xmmcomb_psf.csh to combine the psfs of the 3 telescopes by adding the fits images created by calview together, after weighting the PN telescopes psf by a factor of 2 because of its extra counts. The resulting image is then normailsed, so the sum is 1.
xmmcomb_psf.csh pnpsf.fits mos1psf.fits mos2psf.fits 3psf_norm.fits --------------------XMMCOMB_PSF.CSH version 1--------------------- Input was /exgal1/bjm/scripts/xmmcomb_psf.csh pnpsf.fits mos1psf.fits mos2psf.fits 3psf_norm.fits Output combined psf image 3psf_norm.fits created with a sum of 1.000000 counts. ------------------------------------------------------------------------------------This psf image can then be used as an instrument model in sherpa to convolve a source model through.
xun4> more 2drprof_sherpascript.txt data "pm1m2bin22_E03_8keV_boxmosaic.fits" FITSIMAGE psffromfile[psfinst] psfinst.file="3psf_norm.fits" psfinst.xsize=50 psfinst.ysize=50 fre psfinst.ypos fre psfinst.xpos instrument=psfinst const2d[bck] bck.c0=1.3327e-5 bck.c0.max=5e-5 bck integrate off fre bck.c0 source=bck+beta2d[blob1] blob1 . ampl . max = 0.01 blob1.ampl.min=0.00001 blob1.xpos.max=100 blob1.xpos.min=70 blob1.ypos.max=100 blob1.ypos.min=70 blob1.alpha.max=2.5 blob1.alpha.min=1.0 blob1.r0.max=50 blob1.r0.min=5 blob1 . r0 = 15 blob1 . alpha = 1.5 blob1 . xpos = 84 blob1 . ypos = 84 blob1 . ampl = 0.001 blob1 integrate off statistic cash fre blob1 . r0 fre blob1 . alpha fre blob1 . xpos fre blob1 . ypos fre blob1 . ellip fre blob1 . theta show all fit fre blob1.ampl thaw blob1.xpos thaw blob1.ypos show all fit fre blob1 . xpos fre blob1 . ypos thaw blob1.ampl show all fit thaw blob1.r0 show all fit thaw blob1.alpha show all fit thaw blob1.ellip show all fit thaw blob1.theta show all fit thaw blob1.xpos thaw blob1.ypos show all fit save all mysavefile.shp write RESIDUALS myresiduals.fits write MODEL mymodel.fits projection blob1.alpha blob1.r0 ------------------------------------------------------------------------------You'll need to set the values to be sensible for your data, and note that the running time depends strongly on the size of the image, and the psf. Here my image is about 170x170 pixels, and the psf image size is 50x50 pixels. The PSF image is actually larger than this, but I used the psfinst.xsize and psfinst.ysize parameters to crop it down.
To run this sherpa script, use
xun4> nice +19 sherpa 2drprof_sherpascript.txt |& tee 2drprof_sherpalog.txt
After you are happy with the fit, you can use the command image fit which displays the data, model, and residuals in ds9, which you can save as fits images. Alternatively, the write commands shown in the script above create these fits images from the sherpa prompt, without requiring ds9.