Last modified: 12 December 2023

How do I extract many spectra with one command?

There are three different stack inputs that may be used to obtain multiple spectra in a single command: rgrid, pgrid, and lgrid.

Grid Type Syntax
Rectangular rgrid(xmin:xmax:dx,ymin:ymax:dy)
Polar pgrid(xcen,ycen,rmin:rmax:dr,thetamin:thetamax:dtheta)
Linear lgrid(lmin:lmax:dl)

For example, to extract spectra for each of 100 sources in my_src.fits:

unix% dmextract \
      infile="acis_evt2.fits[sky=region(my_src.fits[component=lgrid(1:100:1)])][bin pi]" \

More information is available from ahelp stack; see the Creating Multiple Spectra section of the Using the Output of Detect Tools thread for another example.