FUNCTION FIX_SOLCOR, LAM, HD0 ; ;+ ; NAME: ; FIX_SOLCOR ; ; PURPOSE: ; This function corrects the FUSE wavelength scale (as recorded ; in an "fcal" file) for the incorrect implementation of the ; heliocentric velocity shifts in versions of CALFUSE up to and ; including v.1.8.7. ; ; CALLING SEQUENCE: ; lamnew = FIX_SOLCOR( Lam, Hd0 ) ; ; INPUTS: ; Lam is the wavelength vector recorded in HDU1 of an ; "fcal" file processed by CALFUSE v.1.8.7 or earlier. ; ; Hd0 is the header from the PDU of the associated "fcal" file. ; ; OUTPUTS: ; This function returns the correct heliocentric wavelength vector. ; ; PROCEDURE: ; a) The version of CALFUSE used to process the data is extracted from ; HD0. If it is later than v.1.8.7, the input wavelength ; vector is returned unchanged. ; b) The value of V_HELIO is extracted from the header. This was ; applied in the wrong sense by CALFUSE. ; c) The damage is undone by applying a new correction of -2*V_HELIO. ; The negative sign corrects the sense of V_HELIO, while the ; factor of 2 undoes the incorrect shift and implements ; the correct shift: ; lambda[helio] = lambda[from the file] * [ 1. - (2.*VHELIO) / c ] ; ; RESTRICTIONS: ; The IDL Astronomy User's Library procedures must be accessible. ; The only procedure called is "fxpar". ; ; EXAMPLE: ; Suppose you are working with the data in a calibrated FUSE ; file named A13301010011alif4ttagfcal.fit, which was processed ; by CALFUSE v.1.8.7. You want to apply the heliocentric velocity ; correction to the wavelength vector. ; ; 1. Fetch the header of the PDU. ; IDL> hd0 = headfits( 'A13301010011alif4ttagfcal.fit' ) ; ; 2. Fetch the processed data structure. ; IDL> d = mrdfits( 'A13301010011alif4ttagfcal.fit', 1 ) ; ; 3. Extract the [incorrect] wavelength vector. ; IDL> lam = d.wave ; ; 4. Apply the heliocentric velocity shift correctly. ; IDL> lam = FIX_SOLCOR( lam, hd0 ) ; ; ; MODIFICATION HISTORY: ; Written by: Alex Fullerton (JHU/UVic) 2001-06-22. ;- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Check that the function is called with sufficient parameters. IF ( N_PARAMS( 0 ) NE 2 ) THEN BEGIN PRINT PRINT,' Correct use: new_lam = FIX_SOLCOR( lam, hd0 ) ' PRINT RETURN, 0. ENDIF ; Define constants cvel = 2.997792458E5 ; speed of light in vacuum [km/s] ; Make a new copy of the input wavelength vector. nlam = lam ; Determine the version of CALFUSE used to process the data. ; First: check that the keyword can be found (i.e., that hd is a PDU header). a = STRPOS( STRMID( hd0, 0, 8 ), 'CF_VERS' ) b = WHERE( a NE -1 ) IF ( b[0] EQ -1 ) THEN BEGIN PRINT PRINT,' FIX_SOLCOR: could not find CF_VERS keyword in header' PRINT RETURN, nlam ENDIF ; Second: fetch the value of the keyword. cfvers = STRTRIM( fxpar( hd0, 'CF_VERS'), 2 ) ; Third: convert it to a number. vers= '' tmp = STR_SEP( cfvers, '.' ) FOR i = 0, N_ELEMENTS( tmp ) - 1 DO vers = vers + tmp[i] vers = LONG( vers ) ; If the version is earlier than 1.8.7 (i.e., vers=187), then apply ; the correction. Otherwise, return the input wavelength vector. IF ( vers LE 189 ) THEN nlam = nlam*(1.0 - 2.*fxpar(hd0,'V_HELIO') / cvel) RETURN, nlam END