Find an event file in SAS_ODF Find the celestial position of the start of the slew If (X range of event file > Y range) { NRANGES = (XMAX - XMIN) / 72000 + 1 else NRANGES = (YMAX - YMIN) / 72000 + 1 } for i=1 to NRANGES Calculate the minimum and maximum for the main axis: ax1min = (XMIN or YMIN) + 72000 * (i-1) ax1max = ax1min + 72000 find ranges in second axis which have value of ax1 between min and max NB: There can be >1 range if the slew doubles back for j=1 to Nranges_ax2 Filter the event file with this X and Y range: evselect table=eventfile expression=(X in [$x1:$x2])&&(Y in [$y1:$y2]) withfilteredset=yes filteredset=<filtfilename> Attitude correct the filtered event file to the centre pixel: attcalc eventset=<filtfilename> refpointlabel=user nominalra=<ra> nominaldec=<dec> Find the X, Y range of the attitude-corrected event file Get the RA, DEC of the centre of the filtered file Create an image name stem from the central RA and DEC Iname = I<rev><obsid><ra><dec> Create an unfiltered image from this event file as a diagnostic: evselect table=<filtfilename> imageset=<Iname"_wartsnall.ds"> Create images in each energy band evselect table=<filtfilename> imageset=<Iname"_b1.ds"> expression=(FLAG==0)&&(PI in [200:500])&&(PATTERN==0) evselect table=<filtfilename> imageset=<Iname"_b2.ds"> expression=(FLAG==0)&&(PI in [501:1000])&&(PATTERN<=4) etc. Make exposure maps eexpmap imageset=Idel.fits eventset=<filtfilename> expimageset=$expb4 $expb5 $expb0", "pimin=2000 200 200","pimax=12000 2000 12000" Add together 0.2-0.5, 0.5-1.0, 1.0-2.0 and 2-12 keV images to make the b0 and b5 images using "farith" } End of Second Axis loop } End of First axis loop