GMOS MOS: guidelines (part #1)

Home Forums Gemini Data Reduction GMOS MOS: guidelines (part #1)


This topic contains 2 replies, has 1 voice, and was last updated by  mangelo 1 week, 4 days ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #2844


    One of the difficulties (actually the first one!) that a new GMOS user finds is to establish a clear sequence of reduction steps. There is a huge documentation on IRAF (Gemini package) tasks and parameters, which requires considerable time to gain insight into the process. Some basic steps (e.g., bias and overscan subtraction, trimming) are quite obvious to anyone who deals with reduction of astronomical data, but there are some subtleties regarding spectroscopic data treatment that deserve to be discussed.

    The objective of this post is to summarize a possible (not definitive!) way to reduce GMOS multi-object spectroscopy (MOS) data (a more complete document, containing examples and a longer discussion, is under preparation and will be posted in this forum). USERS ARE REALLY WELCOME TO SHARE THEIR OWN EXPERIENCE, to highlight critical tasks parameters and issues found during the process. In what follows, we assume that you have the latest version of Gemini Iraf Package ( installed in your machine.

    Images are stored in multi-extension FITS format, containing a Principal Header Unit (PHU, containing informations about the instrument, weather conditions at the time of frame acquisition, target coordinates, etc) and 12 Science extensions (one for each amplifier, in the case of the Hamamatsu detectors), which contains the data itself.

    In order to see the structure of your raw FITS files, just type:
    fxhead %YOUR_RAW_FITS_IMAGE%.fits

    The disposal of the amplifiers is shown in

    Informations about gain, readnoise and bias level for each amplifier for all readout modes are registered in the file gmosamps.dat inside gmos$data folder (where gmos$data indicates the data directory inside the gmos folder, e.g., %YOUR_HOME_FOLDER%/anaconda/envs/astroconda/iraf_extern/gemini/gmos/data/gmosamps.dat). More detailed information about the detectors (saturation levels, plate scale, etc) can be acessed in the links (for Gemini-N) and (for Gemini-S).

    As we get more and more data for different targets during different nights, the data organization becomes a critical task. Besides, during the data reduction process, the number of produced files increases considerably.

    In the file files_and_folders_organization.txt attached to this post, we suggest an useful disposal of folders and subfolders, for a good organization of your data.



    ################### PART #2 ###################


    In this section, we propose a summarized sequence of reduction steps and give a short description of each task. As said above, a more complete documentation will be made available in this forum.

    ### 1) GPREPARE ###
    Run the task gprepare on all images (arcs, GCAL flats, science frames, twilight flats) in order to:

    – prepare raw GMOS data for reductions;
    – identify the PHU and the science extensions (see section DATA FORMAT AND DETECTORS above);
    – update the RDNOISE and GAIN values;
    – attach the content of the Mask Definition File (MDF) in a separate FITS extension (BINTABLE).

    ### 2) GSREDUCE ###
    Run GSREDUCE on the GCAL flats in order to:
    – perform overscan subtraction;
    – trim the frames;
    – perform bias subtraction (an already processed bias can be obtained from the Gemini Science Archive).

    The reduced images are multiplied by the respective gain values, so the outputs are in electrons.

    ### 3) GMOSAIC ###
    Run this task on the GCAL flats in order to:
    – Mosaic the different science extensions in only one extension.

    It is recommended to set fl_paste-, so the task will take into account the relative orientations of the 3 CCDs; with fl_fixpix+, the task will interpolate across the CCDs gaps, which are specified in the file gmos$data/chipgaps.dat (taking into account the detectors binning, specified in the keyword CCDSEC of each frame).

    ### 4) GSFLAT ###
    Run GSFLAT on the GCAL flats in order to:
    – Combine the GCAL flats;

    In order to produce the output combined and not normalized GCLAl flat (task parameter combflat), we must set fl_keep+. The combflat will be used in the next step, as a reference for cutting the slitlets.

    ### 5) GSCUT: 1st run ###
    Run GSCUT on the combined GCAL flats (combflat, see step 4 above) in order to:
    – Identify automatically the edges of each slitlet using the gradient method.

    The task identifies the edges of each slitlet from the gradients of counts in the combined GCAL flats. It also uses the information contained in the file gmos$data/GMOSgratings.dat, which must be specified in the task parameter gratingdb. Use the output files (task parameters outimage and secfile) to check if the slit edges were properly identified. Using fl_over+ (default) allow the task to use 1.05x slit length to accommodate distortions.

    ### 6) GSCUT: 2st run ###
    Run GSCUT on the combined GCAL flats (combflat, see step 4 above) in order to:
    – Identify the slits edges and update the MDF extension of the combflats with the positions of each slit.

    During this run, with no output files specified (that is, outimage=”” and secfile=””), the task with update the MDF extensions of the input images with the slits positons.

    ### 7) GSREDUCE ###
    Apply GSREDUCE to the arc frames in order to:
    – perform overscan subtraction;
    – trim the images;
    – perform bias subtraction;
    – mosaic the science extensions (interpolating across the gaps: fl_fixpix+);
    – cut the slitlets and paste them in different science extensions.

    As normally the the arc frames are obtained in fast readout mode, a proper bias image should be specified. The cut of the slitlets is performed according to the information contained in the MDF extension of the combflats (step 6 above).

    ### 8) GSAPPWAVE ###
    Run GSAPPWAVE on the reduced arcs in order to:
    – Add approximate wavelength calibration to the headers of GMOS spectra.

    This approximate wavelength calibration is performed based on the informations contained in the files gmos$data/GMOSgratings.dat (which must be specified in the task parameter gratingdb) and gmos$data/GMOSfilters.dat (task parameter filterdb).

    ### 9) GSWAVELENGTH ###
    Run GSWAVELENGTH on the reduced arcs in order to:
    – perform wavelength calibration.

    A high-resolution line list of CuAr is available at A linelist including 2nd order CuAr lines, useful for calibrating red wavelength settings, is available at

    The task should be run in interactive mode. It should be noted that it is not enough to simply analyze the RMS of the residues; the coverage of the solution must be verified: calibration lines must be present along the whole fit domain, whenever possible, in order to provide adequate rectification (see step 10 below) of the spectral lines. For a proper correction of possible distorsions along the spatial direction (that is, y-axis), it is important to specify low values for the task parameters step and nsum; putting a value of 2 for both parameters, the task will calculate a function lambda (x_pixel) for each 2 lines along the spatial direction, thus providing good sampling. See the files attached to this post for illustration purposes.



    ################### PART #3 ###################

    In addition to what was said above, regarding the wavelength calibration, other 3 parameters should be set to yes when running GSWAVELENGTH, namely refit, trace and fl_addfeat.

    The parameter refit+ allows the task REIDENTIFY (which is called by GSWAVELENGTH) to refit the coordinate function. According to the manual of the task REIDENTIFY, a new coordinate function of the same type as in the reference is fit using the new pixel positions. Otherwise only a zero point shift is determined for the revised coordinates without changing the form of the coordinate function.

    When the parameter trace is set to yes then as the reidentifications step across the image the last reidentified features are used a the reference. This “tracing” is useful if there is a coherent shift/distorsion in the features.

    The option fl_addfeat allows REIDENTIFY to automatically add new features from a line list during each reidentification. This option can be used to compensate for lost features from the reference solution, particularly when tracing.

    Try to use low orders (parameter order of GSWAVELENGTH) during the lamba (x_pixel) fitting procedures. Order is the number of polynomial terms (coefficients) or the number of spline pieces. At the end of the procedure, we have a dispersion solution every 2 rows (if parameter step is 2) throughout the data. GSWAVELENGTH then finds a surface lambda (x_pixel,y_pixel): the parameters for this run are fitcxord and fitcyord; again, it is recommended to choose values that are as low as possible without there being obvious systemic residuals. The results of the fits for each science extension are recorded in the database folder.

    ### 10) GSTRANSFORM ###
    Apply GSTRANSFORM on the arc frames using the wavelength solutions found in step 8 in order to:
    – check the rectification of calibration (CuAr) lines;
    – linearize the data in the wavelength direction.

    If proper wavelength solutions were derived, the emission lines will be perpendicular to the dispersion axis (X-axis). Use task IMPLOT across some comparison lines. It is important to highlight that the better the spectra rectification, the better your sky subtraction. If some of the science extensions were not properly rectified, you will need to re-run GSWAVELENGTH on these extensions (NOTE THAT, WHEN THE PARAMETER fl_overwrite IS SET TO yes, EACH GSWAVELENGTH RUN WILL OVERWRITE EXISTING DATABASE ENTRIES WITH THE NEW SOLUTION).

    ### 11) GQECORR ###
    Run GQECORR on the reduced (non-normalized) GCAL flats (output of GSREDUCE in step 2 above) in order to:
    – correct differences in quantum efficiency (QE) between the 3 CCDs;
    – create correction images to be used to correct the science images.

    The task employs the wavelength solution obtained in step #9 above and the content of the file gmos$data/gmosQEfactors.dat, which must be specified in the task parameter qecorr_data. This database file contains the calculated GMOS QE data based on
    supplied or empirically determined QE data for each CCD. The file contains fit coefficients for spectroscopic data. The correction values were empirically determined and they are simple polynomials (order 4 for EEV CCDs and order 9 for Hamamatsu):

    correction_value =
    C0 + (C1 * lambda) + (C2 * lambda**2) + … + (Cn * lambda**n))

    where lambda is the calculated wavelength of the pixel for the reference image and C0-n are the coefficients of the polynomial fit. The default coefficients are stored in the file gmos$data/gmosQEfactors.dat, given by qecorr_data.

    ### 12) GMOSAIC ###
    Run GMOSAIC on the QE corrected GCAL flats, in order to
    – paste the 12 science extensions into only one science extension.
    Use fl_fixpix+ to allow interpolations across the chips gaps (as specified in the file gmos$data/chipgaps.dat); also use fl_paste- so the task will take into account the relative orientations of the 3 detectors.

    ### 13) GSFLAT ###
    Run GSFLAT on the mosaiced and QE corrected GCAL flats in order to
    – generate normalized flats, which will be applied to correct the science images;

    The response function for every single line (task parameter fl_seprows+) in the region of each slitlet will be fitted. Then the data/fit ratios are obtained and registered in the output, so the pixel-to-pixel variations are determined. For the edges of the slitlets to be properly identified, the user needs to specify the (mosaiced) combflats generated in step #6; these combflats contain the slits positions recorded in their MDF extensions. The pixels in the regions between the slits are replaced with “1.0”.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.