There is a script called xmmspec.csh which will then extract a source and background spectrum, make an arf and rmf file, group the spectrum, and associate the response files so the output can be read directly into xspec or sherpa.
For example, I defined source and background regions for my mos1 data, called mos1source70arcs.reg and mos1bg200arcs.reg and then use xmmspec as follows:
xun4> xmmspec.csh mos1_clean_evt.fits mos1source70arcs.reg mos1bg200arcs.reg none rmfgen mos1spec_ |& tee mos1spec_log.txt --------------------XMMSPEC.CSH version 1--------------------- Input was /exgal1/bjm/scripts/xmmspec.csh mos1_clean_evt.fits mos1source70arcs.reg mos1bg200arcs.reg none rmfgen mos1spec_ Attempting to detect previous filtering from table statistics... events were filtered between pattern(s) 0 - 12 Instrument is EMOS1 - using PI = 0-11999 channels in 15 channels bins single and double events (pattern <= 12) are in use. Centre of region is (x,y) = 30464,26400 - If the region is not simple this may be incorrect. Extracting source spectrum... evselect table=mos1_clean_evt.fits:EVENTS withspectrumset=yes spectrumset=mos1spec_spec.fits energycolumn=PI spectralbinsize=15 withspecranges=true specchannelmin=0 specchannelmax=11999 writedss=yes expression=(circle(30464,26400,1400,X,Y)) source spectrum written to mos1spec_spec.fits Extracting background spectrum... evselect table=mos1_clean_evt.fits:EVENTS withspectrumset=yes spectrumset=mos1spec_bgspec.fits energycolumn=PI spectralbinsize=15 withspecranges=true specchannelmin=0 specchannelmax=11999 writedss=yes expression=(circle(23520,26624,4000,X,Y)) background spectrum written to mos1spec_bgspec.fits Generating RMF... rmfgen spectrumset=mos1spec_spec.fits rmfset=mos1spec_rmf.fits threshold=1e-5 withenergybins=false pnline=0 RMF written to mos1spec_rmf.fits Making detector map to weight ARF... evselect table=mos1_clean_evt.fits:EVENTS destruct=false withfilteredset=true withimageset=true imageset=mos1spec_detmap.fits xcolumn=DETX ycolumn=DETY imagebinning=binSize ximagebinsize=120 yimagebinsize=120 expression=(circle(30464,26400,1400,X,Y)) writedss=true updateexposure=true ** evselect: warning (NoWCS), No WCS information available for image column DETX. ** evselect: warning (NoWCS), No WCS information available for image column DETY. detector map written to mos1spec_detmap.fits arfgen spectrumset=mos1spec_spec.fits arfset=mos1spec_arf.fits detmaptype=dataset detmaparray=mos1spec_detmap.fits: extendedsource=yes withrmfset=true rmfset=mos1spec_rmf.fits setbackscale=yes withbadpixcorr=true badpixlocation=mos1_clean_evt.fits withfilteredset=true filteredset=mos1spec_detmap_filter.fits withsourcepos=yes sourcecoords=pos sourcex=30464 sourcey=26400 ** arfgen::attcalc: warning (outOfImageRange), 401 events ( of 110885 ) out of range of image ARF written to mos1spec_arf.fits Computing BACKSCAL for background spectrum... backscale spectrumset=mos1spec_bgspec.fits withbadpixcorr=yes badpixlocation=mos1_clean_evt.fits Associating background spectrum and grouping counts into bins >= 20 using rmf mos1spec_rmf.fits and arf mos1spec_arf.fits Output written to mos1spec_spec_grppha.fits ----------------------------------------------------------------------------------Now I repeat this for mos2 and the pn camera. Note that rmfgen and arfgen may take a longish time to run (maybe even a few hours). The script gives you the choice to use one of the pre-generated rmfs that come as part of the calibration, however I've had problems with these giving me strange flux estimates later on, so I generally use rmfgen.
xun4> xspec Xspec 11.1.0 12:15:29 10-Jan-2002 For documentation, notes, and fixes see http://xspec.gsfc.nasa.gov/ Plot device not set, use "cpd" to set it Type "help" or "?" for further information XSPEC>data mos1spec_spec_grppha.fits mos2spec_spec_grppha.fits Net count rate (cts/s) for file 1 8.2745E-02+/- 2.5138E-03( 61.4% total) using response (RMF) file... mos1spec_rmf.fits using auxiliary (ARF) file... mos1spec_arf.fits using background file... mos1spec_bgspec.fits Net count rate (cts/s) for file 2 9.4467E-02+/- 2.6441E-03( 63.6% total) using response (RMF) file... mos2spec_rmf.fits using auxiliary (ARF) file... mos2spec_arf.fits using background file... mos2spec_bgspec.fits 2 data sets are in use XSPEC>cpd /xw XSPEC>setplot energy XSPEC>ignore 0-0.3 XSPEC>ignore 8.0-** XSPEC>plot data XSPEC>model wabs*mekal Model: wabs[1]( mekal[2] ) Input parameter value, delta, min, bot, top, and max values for ... Current: 1 0.001 0 0 1E+05 1E+06 wabs:nH>0.0138 Current: 1 0.01 0.001 0.001 100 100 mekal:kT>7 Current: 1 -0.01 1E-06 1E-05 1E+19 1E+20 mekal:nH>0.001 Current: 1 -0.01 0 0 1E+03 1E+03 mekal:Abundanc>0.3 Current: 0 -0.01 0 0 10 10 mekal:Redshift>0.888 Current: 1 -1 0 0 1 1 mekal:Switch> Current: 1 0.01 0 0 1E+24 1E+24 mekal:norm> --------------------------------------------------------------------------- --------------------------------------------------------------------------- Model: wabs[1]( mekal[2] ) Model Fit Model Component Parameter Unit Value par par comp 1 1 1 wabs nH 10^22 1.3800E-02 +/- 0. 2 2 2 mekal kT keV 7.000 +/- 0. 3 3 2 mekal nH cm-3 1.0000E-03 frozen 4 4 2 mekal Abundanc 0.3000 frozen 5 5 2 mekal Redshift 0.8880 frozen 6 6 2 mekal Switch 1.000 frozen 7 7 2 mekal norm 1.000 +/- 0. --------------------------------------------------------------------------- --------------------------------------------------------------------------- Chi-Squared = 1.3758436E+09 using 211 PHA bins. Reduced chi-squared = 6614632. for 208 degrees of freedom Null hypothesis probability = 0. XSPEC>freeze 1 Number of variable fit parameters = 2 XSPEC>fit 1000 Chi-Squared Lvl Fit param # 1 2 3 4 5 6 7 232.120 -3 1.3800E-02 9.237 1.0000E-03 0.3000 0.8880 1.000 1.1865E-03 227.303 -4 1.3800E-02 10.11 1.0000E-03 0.3000 0.8880 1.000 1.2840E-03 226.436 -5 1.3800E-02 10.37 1.0000E-03 0.3000 0.8880 1.000 1.2146E-03 225.918 -6 1.3800E-02 10.37 1.0000E-03 0.3000 0.8880 1.000 1.2686E-03 225.590 -7 1.3800E-02 10.37 1.0000E-03 0.3000 0.8880 1.000 1.2265E-03 225.399 -8 1.3800E-02 10.37 1.0000E-03 0.3000 0.8880 1.000 1.2592E-03 225.279 -9 1.3800E-02 10.37 1.0000E-03 0.3000 0.8880 1.000 1.2337E-03 225.208 -10 1.3800E-02 10.38 1.0000E-03 0.3000 0.8880 1.000 1.2536E-03 225.164 -11 1.3800E-02 10.37 1.0000E-03 0.3000 0.8880 1.000 1.2381E-03 225.138 -12 1.3800E-02 10.37 1.0000E-03 0.3000 0.8880 1.000 1.2502E-03 225.122 -13 1.3800E-02 10.37 1.0000E-03 0.3000 0.8880 1.000 1.2408E-03 225.112 -14 1.3800E-02 10.37 1.0000E-03 0.3000 0.8880 1.000 1.2481E-03 --------------------------------------------------------------------------- Variances and Principal axes : 2 7 1.40E+00 | -1.00 0.00 2.17E-09 | 0.00 -1.00 --------------------------------------------------------------------------- --------------------------------------------------------------------------- Model: wabs[1]( mekal[2] ) Model Fit Model Component Parameter Unit Value par par comp 1 1 1 wabs nH 10^22 1.3800E-02 frozen 2 2 2 mekal kT keV 10.37 +/- 1.183 3 3 2 mekal nH cm-3 1.0000E-03 frozen 4 4 2 mekal Abundanc 0.3000 frozen 5 5 2 mekal Redshift 0.8880 frozen 6 6 2 mekal Switch 1.000 frozen 7 7 2 mekal norm 1.2481E-03 +/- 0.4694E-04 --------------------------------------------------------------------------- --------------------------------------------------------------------------- Chi-Squared = 225.1121 using 211 PHA bins. Reduced chi-squared = 1.077091 for 209 degrees of freedom Null hypothesis probability = 0.212 XSPEC>plot data XSPEC>error 2 1.0 Parameter Confidence Range ( 1.000) 2 9.28255 11.5644 XSPEC>new 1 0.0 2 variable fit parameters Chi-Squared = 228.0797 using 211 PHA bins. Reduced chi-squared = 1.091290 for 209 degrees of freedom Null hypothesis probability = 0.174 XSPEC>flux 0.5 2.0 Model flux 1.6547E-04 photons ( 2.6600E-13 ergs)cm**-2 s**-1 ( 0.500- 2.000) DtSet : 1 Model flux 1.6547E-04 photons ( 2.6600E-13 ergs)cm**-2 s**-1 ( 0.500- 2.000) DtSet : 2 XSPEC>flux 0.0 10.0 Lower range 0. reset by matrix bound to 0.205 Model flux 3.9504E-04 photons ( 7.7979E-13 ergs)cm**-2 s**-1 ( 0.205- 10.000) DtSet : 1 Lower range 0. reset by matrix bound to 0.205 Model flux 3.9504E-04 photons ( 7.7979E-13 ergs)cm**-2 s**-1 ( 0.205- 10.000) DtSet : 2