merge

If, for example, one observation has multiple segments from the same instrument, (i.e., mos1S001 and mos1U003) then one would want to merge the event files so all of the data can be used by, for example, edetect. In this case, the use of merge is trivial:

merge set1=mos1S001.fits
set2=mos1U003.fits outset=mos1T001.fits

The only possible issue here is to ensure that the observation segment in the set1 file occurs before the observation segment in the set2 file. Also bear in mind that merge only merges two files at a time; more files requires calls to merge. And, although it would make sense in many programming languages, you are not allowed to have the output file name being the same as one of the input file names.

One may also merge different observations if the pointing directions are very close. For example, observations 0820840301, 0820840401, and 0820840501 were all taken with the same pointing direction, but in different orbits. One would like to merge these observations to get the deepest possible source detection. In this case, one must merge more than just the event files for individual instruments, one must also merge the attitude files. The following was used to merge files for use with edetect:

merge set1=0820840301/analysis/atthk.fits
set2=0820840401/analysis/atthk.fits
outset=atthk_temp.fits
merge set1=atthk_temp.fits
set2=0820840501/analysis/atthk.fits
outset=atthk.fits
rm atthk_temp.fits

merge set1=0820840301/analysis/mos1S001.fits
set2=0820840401/analysis/mos1S001.fits
outset=mos1_temp.fits
mergedifferentobs="yes"
merge set1=mos1_temp.fits
set2=0820840501/analysis/mos1S001-clean.fits
outset=mos1_event.fits
mergedifferentobs="yes"
rm mos1_temp.fits

Note well in this case, the required use of the mergedifferentobs="yes" parameter.

If you merge individual segments of a single obsid, espfilt will work well. If you merge different obsids, espfilt will currently fail. (However, it is not clear that it should be able to work.)