Align and merge event files from different OBSIDs
Any two Chandra observations will generally use different X/Y sky coordinate
systems, even if the nominal pointing of the observatory was the same. Before
merging two observations one must convert the event positions of one observation
to the coordinate system used by the other.
IF you trust the offset and roll accuracy of the coordinate systems supplied
by the pipelines, then this is a simple offset calculation which is independent
of the data (i.e. it can be done even if you have no point sources). The CXC
plans to release a tool for this, dmreproject, eventually. In the mean time
you might do something in IDL like is done in reproject_event_files.pro,
which unfortunately doesn't preserve the FITS headers perfectly.
However, in general one will want to use a set of source positions from the
two observations to derive a least-squares coordinate transformation. The IDL
program register_frames.pro
will do this.
- Match up the sources from the two observations. Two source catalogs from
wavdetect (FITS format) can be displayed, edited, and matched using the program
combine_catalogs.pro, called
like this:
combine_catalogs,['obsxx.sources','obsyy.sources'],XOFFSETS=xoffsets,YOFFSETS=yoffsets
The optional vectors XOFFSETS & YOFFSETS can be used to supply rough
offsets between the catalogs so that matching sources come our near each
other. Buttons allow one to print information about each source
and to remove sources that don't appear in both catalogs, or that are
undesired for some other reason. If the edited catalogs are the
same length when saved, then combine_catalogs will match up sources and
save the catalogs in the same order (required for next step).
-
Choose one observation as the "reference" frame and the other as the
"skew" frame. The skew observation will have its event positions
changed to match the reference frame.
-
Load the X & Y positions for the sources into IDL and call register_frames.pro. The code to do this will depend on how your source list is stored and
how you did the matching. For FITS catalogs you'd do something like
this:
c1 = mrdfits('reference.cat', 1)
c2 = mrdfits('skew.cat', 1)
register_frames, c1.x, c1.y, c2.x, c2.y, mask
where "mask" is an undefined variable. A least-squares transformation
(offset-plus-rotation) will be computed and the fit residuals will be
plotted. The variable "mask" will be returned as a byte array containing 1's.
Examine the residuals and decide if any of the fiducial points should
be excluded from the fit. To exclude a point set its mask value
to zero, e.g. mask[17]=0, and call register_frames again. Continue
iterating until you're satisfied with the fit.
Use Scott Koch's Perl script coordshift.pl
to apply the transformation to the skew event list.
Once the alignment is made and confirmed, the datasets can be merged with dmmerge.
One should think carefully about any further analysis done with such a multi-obsid
dataset. Exposure maps must be combined (somehow). You can no longer
simply call mkrmf to get a response matrix since a given region on the sky will,
in general, have fallen on different detector regions in the two observations. In general, when you run any CIAO tool on the combined dataset, consider what
FITS keywords the tool may be consulting and consider whether those keyword values
make sense for the combined dataset.
A convenient display for testing the result is to show one image in contours on
the other shown as an image. P. Broos informs us of several methods for doing
this: FTOOL fv, H. Ebeling's IDL routine /bulk/pkg/asc/ebeling/imcont.pro and
imcont2.pro, IDL's intrinsic routine IMAGE_CONT, and TARA's Event Browser's dataset
2d Tool .