!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! Copyright 2011 California Institute of Technology !!! !!! fix_reference.class !!! !!! 2011-06-03 version 1.0 Initial release !!! 2014-11-17 version 2.0 sradford !!! update for changes in class variable names !!! !!! @fix_reference [ new_restf(MHz) [ new_voff(km/s) ] ] !!! !!! Fixes reference channel and frequency and velocity offset. !!! !!! Supply a correct frequency in the signal sideband that was doppler-tracked, !!! and optionally a correct velocity offset to avoid a round-off error. !!! !!! Use case: You have observed 12CO and 13CO lines simultaneously with !!! wideband receiver and spectrometer by doppler-tracking the 12CO frequency. !!! The center of the spectrometer was offset from the 12CO frequency to !!! accommodate the 13CO line. Now you want to fix the header variables so !!! that those values are for the 12CO frequency in the signal sideband. !!! !!! file in ... !!! file out ... !!! find ... !!! set variable spectro write !!! for i 1 to found !!! get next !!! @fix_reference 220398.6765 0 !!! write !!! next !!! !!! C18O (J=2-1) 219560.3568 MHz !!! 13CO (J=2-1) 220398.6765 MHz !!! 12CO (J=2-1) 230538.0000 MHz sic\let clight = 2.99792458e5 /new double ! Speed of light (km/s) sic\let new_restf = r%head%spe%restf /new double sic\let new_image = r%head%spe%image /new double sic\let new_rchan = r%head%spe%rchan /new real sic\let new_fres = r%head%spe%fres /new real ! No change (topocentric!!!) sic\let new_vres = r%head%spe%vres /new real sic\let new_voff = r%head%spe%voff /new real sic\if ("&1 ".ne." ") then sic\let new_restf = &1 sic\let new_image = (r%head%spe%restf+r%head%spe%image)-new_restf sic\let new_rchan = r%head%spe%rchan+(new_restf-r%head%spe%restf)*(1+r%head%spe%doppler)/new_fres sic\let new_vres = -clight*new_fres/((1+r%head%spe%doppler)*new_restf) sic\let new_voff = r%head%spe%voff-clight*(new_restf-r%head%spe%restf)/r%head%spe%restf sic\if ("&2 ".ne." ") then sic\let new_voff = &2 sic\end if sic\let r%head%spe%restf = new_restf sic\let r%head%spe%image = new_image sic\let r%head%spe%rchan = new_rchan sic\let r%head%spe%fres = new_fres sic\let r%head%spe%vres = new_vres sic\let r%head%spe%voff = new_voff sic\end if