GNIRS XD reduction script

Home Forums Gemini Data Reduction GNIRS XD reduction script

This topic contains 3 replies, has 2 voices, and was last updated by  leighly 6 years, 2 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #468

    Here is the XDGNIRS script, for reducing GNIRS cross-dispersed data as far as obtaining a single 1D, roughly flux-calibrated spectrum. The manual (which is found in the “doc” subdirectory in the tar file, and also uploaded here separately for your convenience) explains the use and limitations of the code.

    XDGNIRS was written for a specific research project involving XD spectra of bright galaxies, and for those data sets it produces really nice spectra with very little manual intervention. It has been tested on other data sets and in many cases also works well. However, some bugs and inconveniences undoubtedly remain, and there may well be system dependency issues that crop up as well.

    Feel free to try XDGNIRS and post here if you have trouble (or to let us know if you find it useful, or if you create an improved version!). We (Rachel, Jen, Andrew) will attempt to help out as time permits, but please be aware that all support will have to be on a best-effort basis only.

    • This topic was modified 6 years, 6 months ago by rachelm rachelm. Reason: Added tags


    Some GNIRS users may be also IRTF SpeX users, and therefore may be
    accustomed to using xtellcor for telluric correction, and xmergeorders
    for merging the spectra. GNIRS XD spectra, extracted using XDGNIRS,
    can be reformatted to use this software. Note that this is the proper
    xtellcor used for SpeX data, not the xtellcor_general that can be used
    on generic IR spectra.

    A couple of simple IDL programs and a template SpeX spectrum that case
    be used to reformat the XDGNIRS extracted spectra are provided here:

    This procedure requires that the telluric standard be a A0V star. The
    xtellcor procedure is described in detail in this paper:

    The advantage over the method included in XDGNIRS is that it is
    simpler (since an A0V star is required) and it builds a convolution
    kernel to account for the instrumental response. It also has a nice
    method to optimally determine shifts and merge orders.


    The XDGNIRS script is followed through extraction (step=7). The
    resulting files vtarget_comb.fits and vstandard_comb.fits have
    a SCI, a VAR, and a DQ extension for each order. The IDL program
    simply extracts each SCI and VAR extension, and the wavelengths from
    each SCI header. It builds a matrix with columns consisting of the
    wavelength, the SCI extension, and error consisting of square root of
    the VAR extension, for each order. It then uses modfits to insert
    this into a template SpeX spectrum file. This is done for both the
    star and the target, and the results can be used directly in

    An example IDL session is below.

    IDL> input_gemini_image=’vtarget_comb.fits’
    IDL> output_image_name=’target_out.fits’
    IDL> template_directory=’/home/Directory_where_tar_file_was_unpacked/’
    – the program needs access to ‘spex_template.fits’ which it will copy
    and use to write the output to.
    IDL> .run ../write_image
    % Compiled module: WRITE_IMAGE.
    IDL> .run ../make_image
    % Compiled module: MAKE_IMAGE.
    IDL> write_image,input_gemini_image,output_image_name,im_out,template_directory

    Now the target file in spex format ‘target_out.fits’, will be present
    in your directory. Do the same thing for the telluric standard, and
    then you will be able to use xtellcor, almost as though these were
    SpeX spectra.

    1. The header for the output file is only minimally altered by this
    procedure. In principal, one could improve the program to put more
    information in the header, but it is not necessary to run
    2. As noted in the GNIRS and XDGNIRS documentation, the VAR extension
    may not give accurate errors. There are various ways that this
    could be fixed, for example, one could measure the variance in the
    spectrum at various points in the spectrum and scale the sqrt(VAR)
    to match those.
    3. The Paschen delta line at 1.005 microns is recommended for the
    construction of the kernel in xtellcor (see xtellcor help). This
    line appears in order 7 in the GNIRS spectra.


    That looks really useful. Thanks for posting, Karen!



    Hi Rachel, yes, I think it will be useful for previous SpeX users in particular.

    I realized that I forgot to post a link to an example star spectrum that has been processed using this procedure. (xtellcor allows a user to output the A0 star spectrum as a sanity check.) Heres the link to that:


    • This reply was modified 6 years, 2 months ago by  leighly.
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.