XMM-Newton SAS Home Page
XMM-Newton Science Analysis System


pnspectra (pnspectra-0.18.2) [xmmsas_20230412_1735-21.0.0]


Algorithm

Read in params

read submode from cleaned PN event list
set scaling factor (scale) based on submode

set ccddef evselect expression based on quads chosen by user

set cornerdef evselect expression for corner-only selections

set quaddef(4) evselect expression for chosen-quads selections

set fulldef evselect expression for full FOV selections

set ruffovdef evselect expression for FOV open to sky selections

if maskitsky, set maskitsky filename add bkg-reg to selections

if maskitdet, set maskitdet filename add bkg-reg to selections

if withregion open, read region selection from input reg text file

run atthkgen to create atthk.fits unless it already exists

create corner only event file with evselect from cleaned event file

create corner only OOT event file with evselect from cleaned event file

create FOV image file with evselect from cleaned event file 

create FOV OOT image file with evselect from cleaned event file

create FOV exposure map with eexpmap from cleaned event file, 
atthk.fits, and FOV image

create FOV mask with emask from FOV image

create FOV SP scaling image with evselect from cleaned event file 
in DET coords

if (withbands) then

 create FOV image in region in selected band (elow-ehigh) with evselect 

 create FOV exposure map with eexpmap from cleaned event file
 
 create FOV mask with emask from FOV image 

 create FOV OOT image in region in selected band (elow-ehigh) with evselect

end if (withbands)

create spectrum from FOV region, run backscale, generate response

create spectrum from FOV OOT region, run backscale, generate response

create response from FOV spectrum with rmfgen 

create response from FOV spectrum with arfgen 

if (withbands) then 
 create FOV image in region in selected band (elow-ehigh) with evselect

 create FOV exposure map with eexpmap from cleaned event file
 
 create FOV mask with emask from FOV image 

 create FOV OOT image in region in selected band (elow-ehigh) with evselect

endif

foreach quadrant selected (1-4)
 create spectrum for FOV of region
 backscale spectrum
 
 create spectrum for FOV OOT of region
 backscale spectrum

 create spectrum for corner-only data 
 backscale spectrum

 create spectrum for corner-only OOT data 
 backscale spectrum

 create temp eventlist from corner-only data (temp_events.fits)
 extract cnts and livetimNN 

 rm temp_events.fits 

 create temp eventlist from corner-only OOT data (temp_events.fits)
 extract cntsoot

 rate = (cnts-(scale*cntsoot))/((1.0-scale)*expo)
 rate = rate*100. [why???]

 rm temp_events.fits

 create temp eventlist from corner-only data (temp_events.fits)
 PI in 600-1300
 extract lowe 

 rm temp_events.fits

 create temp eventlist from corner-only data (temp_events.fits)
 PI in 1650-7200
 extract hige 
 
 rm temp_events.fits

 create temp eventlist from corner-only OOT data (temp_events.fits)
 PI 600-1300
 extract loweoot

 rm temp_events.fits

 create temp eventlist from corner-only OOT data (temp_events.fits)
 PI 1650-7200
 extract higeoot

 calculate hardness ratio: 
 hard=(hige-(scale*higeoot))/(lowe-(scale*loweoot))

 create spectrum from the region from the FWC data
 backscale spectrum

 create spectrum from the region from the FWC OOT data 
 backscale spectrum 

 create spectrum from the corners from the FWC data 
 backscale spectrum

 create spectrum from the corners from the FWC OOT data
 backscale spectrum 

 if (withbands) then
  create image of FWC data for the region and the band 

  create FWC mask with emask from FWC image 

  mask FWC image with farith 

  rename FWC image: 
  mv pnS002-im2-350-1100-mask.fits pnS002-im2-350-1100.fits

  create image of FWC OOT data for the region and the band 

  create FWC mask with emask from FWC OOT image 

  mask FWC OOT image with farith 

  rename FWC OOT image:
  mv pnS002-im2-350-1100-mask-oot.fits pnS002-im2-350-1100-oot.fits

 end withbands
end foreach quadrant

rm intermediary files

end pnspectra



XMM-Newton SOC -- 2023-04-16