Rolling Your Own

As mentioned above, cheese was originally a Perl script that did the repetitive setup for edetect_chain, and then take the output from that and uses region and make_mask to produce the source masks. Now, cheese is a FORTRAN program that does the same thing. This section steps through the commands that one would need to use if, for some reason, cheese cannot be run. Similarly, one may have a different method for finding point sources. In that case, so long as one can create a correctly formatted file like the emlliist.fits file, one can use it with SAS and ESAS.

edetect_chain can handle up to six bands per instrument, but the bands must be the same among the different instruments. For each band of each instrument one needs to extract the image. In the following example, we extract a soft image from MOS1.

evselect table=mos1S001-allevc.fits
withfilteredset=yes filtertype=expression
expression='(PATTERN$<=$12)&&(FLAG == 0)&&
(PI in [350:1100])'
imagebinning=imageSize imagedatatype=Int32
squarepixels=yes ignorelegallimits=yes
withxranges=yes withyranges=yes
xcolumn=X ximagesize=900
ximagemax=48400 ximagemin=3401
ycolumn=Y yimagesize=900
yimagemax=48400 yimagemin=3401
updateexposure=yes filterexposure=yes
verbosity=5 imageset=mos1S001-fovims.fits

Many of these parameters are required so that the images from different bands and different instruments will align correctly for use in edetect_chain. Executing this for multiple bands of multiple instruments is tedious and best put into a script, like cheese.

Since edetect_chain requires the attitude history file, it must be created if it does not already exist. This can be done simply:

atthkgen atthkset=atthk.fits timestep=1

The setup for edetect_chain is quite long and, in recognition of fat fingers and tiny typos, should not be attempted directly on the command line. Here is a relatively simple example:

edetect_chain imagesets='mos1S001-fovims.fits
mos1S001-fovimh.fits mos2S002-fovims.fits
mos2S002-fovimh.fits pnS003-fovims.fits
mos2S002-allevc.fits pnS003-allevc.fits'
pimin='350 2500 350 2500 350 2500'
pimax='1100 5000 1100 5000 1100 5000'
ecflist='1.2 1.2 1.2 1.2 3.2 3.2'
witheexpmap=yes likemin=10
eboxl_likemin=15 eboxm_likemin=15
ebox_withexpimage=yes esp_scut=0.01
esp_withootset=yes esp_nsplinenodes=20
eml_ecut=15 eml_scut=15
eml_withthreshold=yes eml_threshold=15
esen_mlmin=10 eml_list=emllist.fits

There are other parameters that may need to be tweaked as well. Note also that there are a large number of files created by edetect_chain.

Users will generally want to examine the emllist.fits file to determine what cuts best remove point sources for the scientific program at hand. This process can be quite subjective! For each source there are multiple entries in the emllist.fits table, all of which have the same ID_CLUSTER value. There will be an entry for each band/instrument combination, as well as one entry that is a summary (ID_INST=0). The region routine allows one to filter the emllist.fits by the values in its columns to determine which sources are excluded or not. In general, one would want to set a limiting flux (FLUX) and a limiting probability (DET_ML). One might also want to set the condition that the same sources be excluded from all instruments. This latter condition suggests that the summary entry be used. However, if a source does not fall into the FOV of every instrument, the flux for the summary entry may be listed as NULL, meaning that it would not be considered a real source for any filtering that relies on the FLUX column. Thus, it is important to look at the data in the emllist.fits file carefully before running region.

The next step is to create region files to exclude or excise the point sources. This is also done on an instrument by instrument basis. Again using mos1S001 as our example:

region eventset=mos1S001-allevc.fits
expression='(DIST_NN $>=$25)
&&(FLUX$>$=1e8)&&(ID_INST == 1)
&&(DET_ML >= 15)&&(ID_BAND == 1)'
bkgfraction=0.4 radiusstyle=contour
nosrcellipse=no outunit=detxy

Here the filtering uses a plethora of conditions, mostly to demonstrate the variables most likely to be used. Remember that region should also be run in detector coordinates: outunit=detxy bkgregionset=mos1S001-bkregsdet.fits.

The final step is to run makemask as was shown in the example in the previous section.

Often, the users objection to the output from cheese lies in the way the emllist.fits file was filtered by region. It is generally more efficient to run cheese, modify the emllist.fits file, and then rerun the region and makemask steps than it is to run all the constituent steps of cheese.