STScI’s Internet connections will be UNAVAILABLE Sunday, November 18, 2018 from 5:00 AM to 9:00 AM. We apologize for the inconvenience.
FUSE Tools in C
This is a guide to the data analysis tools that are distributed along with the CalFUSE pipeline pagkage. CalFUSE (pipeline processing) and the C-tools use the same libraries of supporting routines and are packaged together. We begin with instructions for performing common tasks: combining data from multiple exposures of a bright target, combining data from multiple exposures of a faint target, extracting night-only data from day+night IDF files, and dividing an IDF file into multiple time segments. We conclude with descriptions of each program.
Chapter 8 of the FUSE Data Handbook, Retrieving and Analyzing FUSE Data, provides further description and examples of the appropriate use of these tools.
Combining Spectra from Bright Targets
For bright targets, the goal is to maximize spectral resolution, so it's important to align the spectra from individual exposures precisely before combining them. A procedure to cross-correlate and combine spectra uses the IDL routine FUSE_REGISTER, but it becomes clumsy if you have more than a few exposures to combine.
To combine a large number of spectra for a moderately bright target, you can use cf_xcorr to determine their relative offsets, then cf_combine to shift and combine them.
prompt> ls P1010101*1alif4ttagfcal.fit > list_of_files prompt> cf_xcorr list_of_files list_of_shifts prompt> cf_combine list_of_shifts output_file.fit
The two programs are described in detail below, but note that cf_xcorr works only on detector segments that span the 1000-1100 Å waveband. The shifts are the same for sides A and B of a given detector, so you can, for example, use the shifts computed from LiF 1A spectra align the corresponding LiF 1B files.
Note: Due to fixed-pattern noise in the detectors, it may not be possible to achieve a S/N ratio greater than 30 simply by increasing exposure time, no matter how many exposures you combine, unless the data were obtained in the FP split mode. See the FUSE Data Handbook for details.
Combining Spectra from Faint Targets
For faint targets, the goal is to maximize the fidelity of the background model by increasing the signal-to-noise ratio on unilluminated regions of the detector. To do this, one combines the IDF files before extracting the spectra. This is easily done with cf_edit, but the program runs slowly if you feed it too many data files. A faster alternative is idf_combine.
Step 1: Combine the IDF files. The files need not be listed in chronological order, but all must live in the current directory.
prompt> idf_combine combined_idf_file input_idf_file1 \ prompt> input_idf_file2 input_idf_file3 ...
Step 2: CalFUSE v3.2 produces a bad-pixel mask (BPM file) for each exposure. If you've just run the pipeline, you should have the BPM files. If not, and you have the jitter and housekeeping files, you can create new BPM files easily:
prompt> cf_bad_pixels input_idf_file1 prompt> cf_bad_pixels input_idf_file2 prompt> cf_bad_pixels input_idf_file3
To combine the bad-pixel masks, use bpm_combine. File names and wavelength shifts are read from the header of the combined IDF file. All files must live in the current directory.
prompt> bpm_combine combined_bpm_file combined_idf_file
Step 3: Extract LiF and SiC spectra from the combined IDF file. To modify the wavelength range or binning of the resulting spectra, edit the parm*.fit files.
prompt> cf_extract_spectra combined_idf_file
Note: Because the extraction routine uses time-dependent effective-area and background calibration files, we do not recommend that you combine data taken more than a few months apart into a single IDF file. Instead, perform the steps listed above for each visit separately, then combine the resulting extracted spectral files as described above.
If you are in the position of having multiple exposures of a faint target, but knowing their relative wavelength offsets with exquisite precision, you can optimize both spectral resolution and background subtraction by shifting the spectra within the individual IDFs before combining them. For example, you can extract the individual spectra, determine the appropriate shifts for each, apply them to the IDF files, then run idf_combine. John Grimes has written a tool to shift spectra within an IDF. See the FUSE IDL Tools reference page. If you use John's tool and wish to combine your BPM files, you will have to modify the WOFFL* and WOFFS* keywords in the combined IDF by hand. These keywords, which list the shift in Ångstroms applied to the target spectra in the LiF and SiC apertures, are readily modified using the program modhead. See the instructions below.
The CalFUSE pipeline does not discard undesirable photon events, but merely flags them as bad. This makes it possible for the user to change the screening applied to the data without re-running the pipeline. An interactive tool for doing this is the IDL routine cf_edit, but the C program idf_screen provides the same capabilities and runs considerably faster. To select only night-time events, type
prompt> idf_screen M10101010011attagfidf.fit \ M10101010011a_night_ttagfidf.fit DAY GOOD
Here, "DAY" refers to the day/night flag, and "GOOD" selects only the night-time photons. A complete description of the program is provided in the IDF Cookbook.
Note: Strictly speaking, if you modify the good times in an IDF file, then you should generate a new bad-pixel mask with the same good times. To do that, use cf_bad_pixels, described above. If you don't care about correcting your spectra for bad pixels, you can skip this step. The program cf_extract_spectra will complain that it can't find the bad-pixel file, but it will run anyway.
The program idf_cut allows you to chop an IDF file into several smaller files:
> idf_cut idf_file RefTime Period Nout
Designed for time-resolved spectroscopy, the program sorts the records of the input file according to their phase, but you can turn this off by using a reference time of zero and a period that exceeds the total exposure time. For example, if EXPEND - EXPSTART = 1900 s, set the period to 2000 s. To slice such a file into four 500-second chunks, the command is
> idf_cut idf_file 0 2000 4
Complete instructions are provided in the IDF Cookbook.
Descriptions of Individual Programs
Combines bad-pixels masks from multiple exposures into a single file. For details, see the IDF Cookbook.
Performs a variety of arithmetic operations on two CalFUSE calibrated spectrum files. The second operand can be either a file or a numeric quantity. Supported operations are +, -, *, /, shift, boxcar, bin, avg_t, avg_s. If the second operand is a scalar, the operation is performed only on the FLUX column; otherwise, it is performed on the FLUX, COUNTS and WEIGHTS columns, and the statistical errors are propagated. The shift operation shifts the contents of the columns in the file by the number of pixels specifed by the second operand relative to the WAVE column (which is not shifted), the boxcar operation performs a boxcar smoothing of the flux and counts columns with a width specified by the second operand, and the bin operation bins the data by the number of pixels specified by operand 2. The avg_t and avg_s operations average two spectra: avg_t weights the spectra by their respective exposures times, and avg_s weights each pixel by its statistical weight.
Note that if you use the multiply operation you MUST enclose the asterisk in quotes ("*"); otherwise, the shell will replace the asterisk with a listing of all the files in the current directory before passing the command line to the program!
A more detailed description of the operation of cf_arith is given in the header of the source code.
# smooth spectrum with a 6-pixel boxcar:
# bin spectrum by 4 pixels:
# subtract airglow template from a spectrum
Options: -h: this help message -v: verbosity level (=1; 0 is silent) -a: ignore EXP_STAT keyword -k: Change EXP keywords to OBS
Combines a list of calibrated spectral files into a single output spectral file. If the file list has a second column listing the requested shift (in pixels) for each input file, cf_combine will shift and sum the files all at once. Note that a positive shift moves a spectrum to longer wavelengths. Input files for which the header keyword EXP_STAT != 0 are not included in the sum unless the -a flag is set.
The header of the output file is copied from the first input file, except that the EXPTIME keyword is updated with the sum of the exposure times of the input files, and some HISTORY lines are added. The WAVE column is copied from the first input file. The output FLUX column is the average of the fluxes in the input files, weighted by their exposure times, and the output ERROR column contains the propagated errors from the input files. The WEIGHTS and COUNTS columns are summed.
Computes shifts necessary to align multiple extracted spectral (*fcal.fit) files. The file with the greatest EXPTIME becomes the template. Each file is then compared with the template. We don't actually cross-correlate; instead, we shift the data file by -20, -19..., +19, +20 pixels and compute chi-squared between the data and template spectra. The wavelength range is hard-wired into the program: for point sources, it's 1045-1070 Å; for extended targets, it's 1030-1039 Å (the O VI doublet). If you prefer a different range of wavelengths, consider using get_shift, described below.
The output file contains six columns:
Note: while this routine is not elegant, it does a good job on most targets, which is our definition of success for pipeline software.
Returns the offset in pixels between two extracted spectral (*fcal.fit) files. The program performs a cross-correlation within the wavelength window defined by wave1 and wave2. Note that returned value is the offset of file 2 with respect to file 1. To align the two spectra, you must shift file 2 by the NEGATIVE of this value.
Combines IDF files from multiple exposures into a single file. For details, see the IDF Cookbook.
Chop an IDF file into several smaller IDF files. The records of the input IDF file can be sorted according to their time phase. For details, see the IDF Cookbook.
Alters the screening performed by the pipeline by modifying the photon flags within an IDF file. For details, see the IDF Cookbook.
Given the modified Julian date and a target's RA and DEC, program computes the heliocentric modified Julian date.
Return or modify the value of a header keyword in any FITS file. The extension number is 0 for the primary header-data unit (HDU), 1 for the first extension, etc. If omitted, the primary HDU is assumed. If filename.fit[ext] returns an error (modhead: No match), put this string in quotation marks ("filename.fit") or use an alternate construction (filename.fit+3).
If keyword is not found and new_value is specified, the keyword is added to the requested header. If new_value is not specified, the current value is returned. New_value may be a multi-word string, but modifications to the comment field of a keyword are not supported.
If you have a TTAG observation of a source in a close binary system, you might be interested in removing the orbital motion that smears out the photospheric lines. For a circular orbit, you can use remove_target_orbital_motion. For details, see the IDF Cookbook.
These routines, written to facilitate time-resolved photometry of bright stars, are described in the IDF Cookbook.
This utility program produces an ASCII file containing a listing of
the headers for each extension in the input FITS file.
The output file is written to a file in the current directory.
Note: listhead is provided as an executable, so runs
only on Sun workstations.