In sections 6.7.5 and 6.8.3 you have seen how to merge lightcurves and spectra from different Science Windows belonging to the same group. In that case the file og_jmx2.fits points to all the Science Windows and it is possible to launch the collecting/merging tools lc_pick and spe_pick directly on the group (group=og_jmx2.fits+1).
If you have Science Windows belonging to different groups, you need an intermediate step. Basically you need to create a file (an index) that points to all the Science Windows you want to co-add, similarly to the case seen in the previous section. Then this file will be given as input via the "group" parameter at the place of og_jmx2.fits.
To create the index make a list of the Science Window groups you want to combine and save it as, e.g., dols.txt under $REP_BASE_PROD/obs/. To ensure a proper work of the software give the full path, i.e. your file should look like
/WORKING-DIR/obs/GROUP1/scw/011901060010.001/swg_jmx2.fits
/WORKING-DIR/obs/GROUP1/scw/011901070010.001/swg_jmx2.fits
/WORKING-DIR/obs/GROUP2/scw/012000360010.001/swg_jmx2.fits
/WORKING-DIR/obs/GROUP2/scw/012000370010.001/swg_jmx2.fits
The first 2 files belong to a run with the og_create parameter "ogid" equal to "GROUP1" while the latter two to a run with "ogid" equal to "GROUP2". /WORKING-DIR/ has to be the extensive name of $REP_BASE_PROD. WARNING: make sure that the lightcurve and spectra files exist for each Science Window you want to co-add (jmx2_src_lc.fits and jmx2_srcl_spe.fits files).
Then give the command that actually builds the fits file from the ASCII file:
cd $REP_BASE_PROD/obs/ txt2idx element="dols.txt" index="index_comb_2.fits"
Then run lc_pick and spe_pick putting the parameter "group" equal to "index_comb_2.fits":
cd $REP_BASE_PROD/obs/ lc_pick source="J180108.2-250445" attach=n \ group=index_comb_2.fits+1 lc=GX5-1.lc.fits emin="3.04" \ emax=10.08 instrument="JMX2"GX5-1.lc.fits contains the merged lightcurve of GX5-1 (source_ID=J180108.2-250445, as can be seen e.g. in the ISDC reference catalog) in the 3.04-10.08keV band (energy range that of course has to exist in the jmx2_src_lc.fits original files!). Using lc_pick without specifying the energy range, will produce an output file with multiple extensions, one per available energy range.
cd $REP_BASE_PROD/obs spe_pick group="index_comb_2.fits"\ source="GX 5-1" rootname="GX5-1" instrument="JMX2"
GX5-1_sum_pha.fits (the combined spectrum of GX 5-1) and GX5-1_single_pha2.fits (a file with the four spectra of the initial four Science Windows collected together) are created. spe_pick also creates an ARF, appropriate for your particular dataset. This ARF is written to GX5-1_sum_arf.fits and GX5-1_single_arf2.fits files. The names of the response and ancrfile are inserted in the keyword of the final files, so that they are automatically recognised by XSPEC.