rvsao-2.8.3/0002755000016200001660000000000012707520742011732 5ustar minkoirsysrvsao-2.8.3/bin0000777000016200001660000000000012707520247014560 2./bin.linux64ustar minkoirsysrvsao-2.8.3/Doc/0002755000016200001660000000000012547016276012443 5ustar minkoirsysrvsao-2.8.3/Doc/emsao.hlp0000644000016200001660000004330611164516655014260 0ustar minkoirsys.help emsao Mar2009 rvsao .ih NAME emsao -- Compute redshift by identifying shifted emission lines .ih USAGE emsao spectra .ih PARAMETERS .ls spectra = "" List of file names of spectra to analyze. @ indicates list should come from file . [] indicates that a range of apertures in a multispec file should be processed, where is a comma- and/or hyphen-separated list of numbers. The files should be dispersion-corrected and linear in wavelength. .le .ls specnum = 0 If this is nonzero and \fIspectra\fR contains a single file name, this is a range of spectrum numbers in a multispec file for which emission line velocities will be obtained. Wavelength dispersion information is then read from APNUMn, and velocity information is read from APVELn, APVXCn, and APVEMn and saved in APVELn and APVEMn, the values of which contain multiple values. If specnum is zero, velocity information is in separate keywords for each value. .le .ls specband = "" Spectrum band if multispec file .le .ls skynum = 0 If this is nonzero, the sky spectrum, which is used for equivalent width errors, is read from this spectrum number of the current spectrum file .le .ls skyband = 0 Sky band if multispec file .le .ls specdir = "./" Directory containing spectra to analyze .le .ls linefit = yes If yes, search for emission lines fit their positions, and average them into a weighted mean velocity for the spectrum. If no, display spectrum with labelled emission lines found in a previous application of EMSAO and results from any previous XCSAO run which is archived in the image header. .le .ls fixbad = no If yes, replace portions of spectrum given in file \fIbadlines\fR with a straight line linking the adjacent points. This feature can be used to eliminate emission and absorption features caused by poor removal of night sky emission lines. (added in version 2.0) .le .ls badlines = "badlines.dat" File containing list of starting and stopping wavelengths in Angstroms for removal of portions of all object spectra. All information after the second wavelength is a comment field. This file is assumed to be in the directory \fIlinedir\fR unless a complete pathname starting with "/" or including a "$" is specified (added in version 2.0). .le .ls renormalize = no If yes, renormalize spectrum before fitting by multiplying each pixel by 1000 times the mean pixel value for the spectrum. . Set this to "yes" for fluxed spectra. If set to "no" and all values of the object spectrum are less than 1, the spectrum is renormalized anyway, to avoid crashing the program. .le .ls st_lambda INDEF Starting wavelength in angstroms of portion of spectrum to use If INDEF, start at beginning of spectrum. .le .ls end_lambda INDEF Ending wavelength in angstroms of portion of spectrum to use If INDEF, end at end of spectrum. .le .ls nsmooth 10 Number of times the spectrum is smoothed using a 1-2-1 sliding box before the emission line search occurs. This smoothed spectrum is also the version which is displayed. .le .ls vel_init "search" The type of velocity to be used for the initial guess at where the emission lines should be. If "search", look for the lines in the \fIemsearch\fR file. If "guess", use \fIczguess\fR. If "correlation", use the \fICZXC\fR parameter in the file header which was set by XCSAO. If ("cortemp", use the velocity obtained by XCSAO when cross-correlating this spectrum against the template specified by \fIcortemp\fR. If "emission", use the \fICZEM\fR file header parameter which was set by a previous run of EMSAO. If "file", use the \fIVELOCITY\fR parameter from the header, a combined velocity which is set by both EMSAO and XCSAO. .le .ls czguess 0. Initial guess at the radial velocity if >1 or z if <1. It is used only if vel_init is "guess". .le .ls cortemp "" Name of template from which to use cross-correlation velocity. (new in 2.0) .le .ls wspan 10. Wavelength in angstroms to search around redshifted line center. This should always be less than the distance between the closest lines for which you are searching. .le .ls linesig 2.0 A line peak must be this many standard deviations above the continuum to qualify as a line. .le .ls emsearch "emsearch.dat" File containing list of emission lines used to determine an initial velocity guess if \fIvel_init\fR is "search". Each line contains: .br Center wavelength of line in angstroms .br Starting wavelength in angstroms for search for this line .br Ending wavelength in angstroms for search for this line .br Name of line (terminated by end of line or space) .le .ls emlines "rvsao$lib/emlines.dat" File containing list of emission lines, where the each line contains: .br Center wavelength of line in angstroms .br Starting wavelength in angstroms for continuum for this line .br Ending wavelength in angstroms for continuum for this line .br Half-width in angstroms for region to fit for this line .br Name of line (terminated by end of line or space) .le .ls linedir = rvsao$lib/ Directory for emission and absorption information files. If the name of one of the individual files containis "/" or "$", it is assumed to be a full path name, and \fIlinedir\fR is not used. .le .ls npfit 2 Number of pixels to fit around line peak (+-) .le .ls nlcont 1 Number of coefficients in line continuum fit (0-3). An overall continuum fit is subtracted, but the fit may not be good enough to remove the local continuum. If 0, no additional continuum is fit for each line. If the continuum is poorly subtracted using the parameters in \fIcontpars\fR, values of more than 0 for \fInlcont\fR can cause trouble. .le .ls esmooth 0 Number of times the spectrum is smoothed using a 1-2-1 sliding box before the emission lines are fit. Normally 0, it can be set to 1 or 2 for very noisy data when the fitting subroutine may otherwise be unable to fit a continuum. It should be set no higher to avoid distorting the emission line profiles. .le .ls emcombine "emcomb.dat" File containing list of groups of emission lines which should be fit together. Each entry contains the following information for one group of two to five lines: .br Number of combined emission lines .br Number of angstroms to add to fit beyond left and right line centers .br For each emission line: .br Center wavelength in angstroms .br Relative line height .le .ls mincont 0.0 If continuum is greater than this value, compute the equivalent width of the current line, which is the width the line would be if it were as high as the continuum is deep. If the continuum is less than or equal to this value, compute the area of the line in counts times wavelength. When working with continuum subtracted spectra or spectra where the emission lines are so strong that there is minimal continuum, make this value larger than the largest possible continuum fit value to get consistently computed numbers. (added in 2.0) .le .ls lwmin 0.4 Minimum fraction of mean line width for individual line (added in 2.0) .le .ls lwmax 1.7 Maximum fraction of mean line width for individual line (added in 2.0) .le .ls lsmin 2.0 Minimum equivalent width in sigma for individual line (added in 2.0) .le .ls sigline 0.0 Velocity error if single line found. Use gaussian fit error if 0 or INDEF. This value may need to be set higher to use a good, but different cross-correlation properly when the program computes a combined velocity. .le .ls disperr = 0.01 RMS dispersion error in Angstroms .le .ls vel_corr "file" Spectrum velocity correction to the solar system barycenter. Set to "none" if spectrum has already been shifted or if this correction is unnecessary. If "file", \fIBCV\fR is used if present in the file header, or else \fIHCV\fR. If "hfile", the header parameter \fIHCR\fR is always used. If neither is found, no correction is made. If "heliocentric" or "barycentric" corrections are chosen, position and time parameters are read from the spectrum data file header. \fIDATE-OBS\fR (date in format 'dd-mm-yy') \fIUT\fR (U.T. at end of exposure as 'hh:mm:ss') and \fIUTOPEN\fR (U.T. at start of exposure as 'hh:mm:ss') or \fIEXPOSURE\fR (length of exposure in seconds) are used to compute the midtime of the exposure. \fIRA\fR (right ascension as 'hh:mm:ss.ss'), \fIDEC\fR (declination as 'dd:mm:ss.ss'), and \fIEPOCH\fR (epoch of coordinates defaults to 1950.0) give the position of the object whose spectrum this is. \fISITELONG\fR (observatory longitude as 'dd:mm:ss.ss' or degrees), \fISITELAT\fR (observatory latitude as 'dd:mm:ss.ss' or degrees), and \fISITEELEV\fR (observatory altitude in meters) give the observatory position. .le .ls report_mode = 1 Format of report sent to \fIlogfiles\fR. A tab table with column headings is written if the mode flag is negated. .ls =1 Full information on each emission line found .le .ls =2 One line per spectrum, with combined, cross-correlation, and emission line velocities, number of lines found and fit, and a list of names and wavelengths of the lines which were used in the fit. .le .ls =3 One line per spectrum, with combined, cross-correlation, and emission line velocities, number of lines found and fit, and velocities for all possible reference lines, with velocities of lines not used in the final fit set to 0. .le .ls =4 One line per spectrum, with file name, instrument, object, right ascension, declination, altitude, azimuth, Julian date, exposure, emission velocity and error, cross-correlation velocity, error, and R-value (for the template specified by cortemp or best template value if cortemp is ""), and the combined velocity and error. Following the number of lines found and the number of lines fit, the velocity, error, height, width, and equivalent width are then given for each line, with zero values indicating that the line was not used in the fit. If the continuum under the line is less than mincont, the area of the line is given instead of the equivalent width. .le .ls =5 Same as mode 2, but emission line template cross-correlation velocity is always given as the cross-correlation velocity. .le .ls =6 Same as mode 3, but emission line template cross-correlation velocity is always given as the cross-correlation velocity. .le .ls =8 Single line report with line offset, error, height, width, and equivalent width for each emission line .le .ls =9 Single line report with line offset for each emission line .le .le .ls archive = no If yes, save emission line results in SAO TDC archive record. .le .ls save_vel = no If yes, save results in the IRAF image header. Combined velocity and error are stored as \fIVELOCITY\fR and \fIVELERROR\fR. Emission line velocity and error in IRAF image header as \fICZEM\fR and \fICZEMERR\fR, and the number of lines used in the fit is in \fICZEMNLF\fR .le .ls verbose = yes If yes, results of the emission line search are logged. .le .ls logfiles = "STDOUT,emsao.log" All results from \fIemvel\fR are recorded in these files. .le .ls device = "stdgraph" Device on which to display graphic summary of results. .le .ls hardcopy = no Print graphic summary of results on \fIplotter\fR. .le .ls displot = yes If yes, graph data on terminal (yes or no) .le .ls plotter = "stdplot" If \fIhardcopy\fR is yes, make hardcopies of graphs on this device. .le .ls dispmode = 2 Graphical display mode (2=with line list 3=full screen) .le .ls vel_plot "emission" The redshift of this velocity is used to compute the positions of the absorption and emission lines which are flagged in the display. Choices are emission, correlation, or combination (a weighted combined velocity). .le .ls curmode = yes If yes, stop in cursor mode after plotting and labelling spectrum and wait for cursor commands described below. .le .ls dispem = yes If yes, flag positions of emission lines which have been found. Those used in the velocity fit are plotted as solid lines. The "-" cursor command can be used to delete these from the fit. Those lines found but omitted from the fit are plotted as dashed lines. The "+" cursor command can be used to add them to the fit. .le .ls dispabs = yes If yes, flag positions of absorption lines. .le .ls ablines "ablines.dat" File containing list of absorption lines to plot, where the each line contains: .br Center wavelength of line in angstroms .br Name of line (terminated by end of line or space) .le .ls velfit = yes If yes, combine the redshifts found for individual emission lines into a single emission line velocity. (eliminated from 1.8 on) .le .ls obj_plot yes If yes, a plot of the object spectrum is displayed before the emission lines are searched for. .le .ls contsub_plot = no Plot the continuum-subtracted data .le .ls debug = no If yes, intermediate values of the parameters are recorded in the log files. Too much information is printed to be useful for anything but debugging. .le .ls nsum = 1 Number of pixels to sum across dispersion .ls cursor = "" Graphics cursor input. When null the standard cursor is used otherwise the specified file is used. .le .ih DESCRIPTION \fIemsao\fR finds emission lines, computes redshifts for each identified line, and combines them into a single radial velocity. The results may be graphically displayed or printed. If \fIcurmode\fR is set, the graphic cursor remains active after the spectrum is plotted and labelled, and the following keystrokes may be used to redisplay and/or rework the fit (in addition to the standard IRAF cursor facilities, a menu of which can be obtained by typing :.help): .ls ? Print list of \fIemsao\fR cursor commands. .le .ls a Set redshift guess from an absorption line at the cursor position. Respond to the prompt with either the line name from the ablines.dat file or a specific wavelength, which doesn't have to be one of the tabulated lines, in Angstroms. It might help to set the smoothing to 0 using \fIn\fR before doing this. .le .ls b Set blue limit of spectrum to be searched to current cursor position. .le .ls c Force the final velocity to a specific value which may be .ls e the emission line velocity, .le .ls x the cross-correlation velocity as read from the spectrum header, .le .ls c the combination velocity as computed by emsao, .le .ls g the initial guess as set by emsao.vel_init, .le .ls s a specific velocity and error to be typed in. .le .le .ls d Replaces a region between the marked vertical cursors with interpolated values from the edges of the marked region. This is typically used to eliminate poorly subtracted night sky lines or emission lines. \fIx\fR can be used to cancel the first \fId\fR. .le .ls e Set redshift guess from an emission line at the cursor position. Respond to the prompt with either the line name from the ablines.dat file or a specific wavelength, which doesn't have to be one of the tabulated lines, in Angstroms. It might help to set the smoothing to 0 using \fIn\fR before doing this. .le .ls f Refit the redshift. If lines have been added or deleted, a new weighted mean is computed. If a new initial guess has been set or line fitting parameters have been modified, a new line search is done. .le .ls g Change number of times spectrum is smoothed (nsmooth) to the number given in response to prompt. It may help to set this to 0 before identifying emission or absorption lines using e or a. .le .ls i Reset the initial velocity for the line search. .le .ls k Toggle between display with continuum subtracted and display with continuum included (default). This works for both dispmode=1 and dispmode=2. .le .ls l Reset the \fIlinesig\fR and \fIwspan\fR parameters which determine the the number of standard deviations above the continuum at which to define an emission line and the wavelength to search around the redshifted center of an individual line. .le .ls m Change number of times spectrum is smoothed (\fIesmooth\fR) for line fitting to the number given in response to the prompt. This should be zero unless high noise levels are preventing good line fits in which case it may be set to 1, or at most, 2. .le .ls n Disaprove the final velocity and set the quality flag to X. .le .ls p Replot the current display. .le .ls q Quit and exit. .le .ls r Set the red limit of spectrum to be searched to current cursor position. .le .ls s Set the redshift guess from an entered rest wavelength for the current cursor position. .le .ls t Use the velocity from the nth template in the list displayed in a emsao.dispmode=1 summary display. .le .ls u Forces the current spectrum to be replotted at the original scale. .le .ls v Select the source of the redshift at which the absorption and emission lines are plotted. It may be an emission, correlation, or combined radial velocity from the image header as \fICZEM\fR, \fICZXC\fR, or \fIVELOCITY\fR. .le .ls w Show rest and observed wavelength at cursor position. .le .ls x Cancel \fId\fR and \fIz\fR commands before second keystroke. .le .ls z Replots the region of the spectrum in wavelength between successive uses. \fIx\fR can be used to cancel the first \fIz\fR. .le .ls + Add closest found emission line to the velocity fit if it has been dropped, overriding program's selection criteria. If this doesn't work, use the \fIv\fR command to plot using the emission velocity. .le .ls '-' Drop closest found emission line from the velocity fit if it has been used, overriding program's selection criteria. If this doesn't work, use the \fIv\fR command to plot using the emission velocity. .le .ls '.' Cancel delete (d) or zoom (z) command. .le .ls '/' Toggle between spectrum plus summary display (dispmode=1) and full screen spectrum display (dispmode=2). .le .ls @ Make hard copy of graph to \fIplotter\fR. .le .ih EXAMPLES To obtain the redshift and dispersion of a single galaxy rvsao> emsao galaxy To obtain redshifts for a whole night's worth of galaxy spectra: rvsao> emsao @nite1.ls where the file nite1.ls contains the name of the galaxy images. .ih SEE ALSO rvsao.contpars which sets the continuum fit parameters On-line help is available on the World Wide Web at http://tdc-www.harvard.edu/iraf/rvsao/emsao .endhelp rvsao-2.8.3/Doc/Readme0000644000016200001660000000141210636773441013560 0ustar minkoirsysRVSAO documentation and help files bcvcorr.hlp IRAF help file for the stand-alone barycentric velocity task contpars.hlp IRAF help file for the continuum fit pset task CONTPARS contsum.hlp IRAF help file for the continuum fit pset task CONTSUM emsao.hlp IRAF help file for the emission line velocity task EMSAO eqwidth.hlp IRAF help file for the equivalent width task EQWIDTH qplot.hlp IRAF help file for the redshift checking task QPLOT relearn.hlp IRAF help file for the parameter updating task relearn linespec.hlp IRAF help file for the emission line template creation task sumtemp.hlp IRAF help file for the template combining task xcsao.hlp IRAF help file for the cross-correlation velocity task XCSAO zvel.hlp IRAF help file for task running EMSAO and XCSAO in sequence rvsao-2.8.3/Doc/relearn.hlp0000644000016200001660000000100105333551773014567 0ustar minkoirsys.help relearn Feb93 rvsao .ih NAME relearn -- Update task parameter file using values from old parameter file .ih USAGE relearn task .ih PARAMETERS .ls task = "" Name of task of which parameter file is to be updated .le .ih DESCRIPTION \fIrelearn\fR saves the current parameter values for the named task, unlearns it, and reassigns the old parameter values to the new file. Instead of typing .br dpar task >temp.file .br unlearn task .br cl .} \def\paspconf@pageid{\xdef\@thefnmark{\null} \@footnotetext{This manuscript was prepared with the PASP \LaTeX\ macros v\paspconf@ver}} \ifnum\@ptsize<1 \typeout{Warning: Undersize manuscript font (1\@ptsize\space pts). Use 11pt documentstyle option.} \fi \def\ps@title{\let\@mkboth\@gobbletwo \def\@oddhead{\hbox{}\hfil\rm\thepage}% \def\@oddfoot{}% \def\@evenhead{\rm\thepage\hfil\hbox{}}% \def\@evenfoot{}\def\sectionmark##1{}\def\subsectionmark##1{}} \def\ps@myheadings{\let\@mkboth\@gobbletwo \def\@oddhead{\hbox{}\hskip 1in\rightmark\hfil\rm\thepage}% \def\@oddfoot{}% \def\@evenhead{\rm\thepage\hskip 1in\leftmark\hfil\hbox{}}% \def\@evenfoot{}\def\sectionmark##1{}\def\subsectionmark##1{}} \def\@leftmark#1#2{\uppercase{#1}} \def\@rightmark#1#2{\uppercase{#2}} \def\posterpaper{\@input{poster.sty}} \ps@empty \let\ps@title=\ps@empty \textwidth=5.25in \textheight=8.3in \topmargin=0in \oddsidemargin=1.25in \evensidemargin=1.25in \parindent=2em \parskip=.1ex \def\@singleleading{0.9} \def\@doubleleading{1.6} \def\baselinestretch{\@singleleading} \def\tightenlines{\def\baselinestretch{\@singleleading}} \def\loosenlines{\def\baselinestretch{\@doubleleading}} \let\journalid=\@gobbletwo \let\articleid=\@gobbletwo \let\received=\@gobble \let\accepted=\@gobble \def\paspconf@frontindent{.45in} \if@paspconfpretty \def\title#1{\vspace*{1.0\baselineskip} {\leftskip\paspconf@frontindent\noindent\uppercase{\large\bf #1}\par} \vspace*{1\baselineskip}\thispagestyle{title}} \def\affil#1{{\leftskip \paspconf@frontindent \noindent{\it #1}\par}} \else \def\title#1{\vspace*{1.5\baselineskip} {\leftskip\paspconf@frontindent\noindent\uppercase{#1}\par} \vspace*{1\baselineskip}\thispagestyle{title}} \def\affil#1{{\leftskip \paspconf@frontindent \noindent#1\par}} \fi \def\author#1{\vspace*{1\baselineskip} {\leftskip\paspconf@frontindent\noindent\uppercase{#1}\par}} \def\altaffilmark#1{$^{#1}$} \def\altaffiltext#1#2{\footnotetext[#1]{#2}} \if@paspconfpretty \def\abstract{\vspace*{1\baselineskip}\bgroup\leftskip\paspconf@frontindent \noindent{\bf ABSTRACT}\hskip 1.5em} \def\endabstract{\par\egroup\vspace*{1.4\baselineskip}} \else \def\abstract{\vspace*{1\baselineskip}\bgroup\leftskip\paspconf@frontindent \noindent\underline{ABSTRACT}\hskip 1.5em} \def\endabstract{\par\egroup\vspace*{2\baselineskip}} \fi \skip\footins 4ex plus 1ex minus .5ex \footnotesep 3ex \long\def\@makefntext#1{\noindent\hbox to\z@{\hss$^{\@thefnmark}$}#1} \def\tablenotemark#1{\rlap{$^{#1}$}} \def\tablenotetext#1#2{ \@temptokena={\vspace{.5ex}{\noindent\llap{$^{#1}$}#2}\par} \@temptokenb=\expandafter{\tblnote@list} \xdef\tblnote@list{\the\@temptokenb\the\@temptokena}} \def\spewtablenotes{ \ifx\tblnote@list\@empty \else \let\@temptokena=\tblnote@list \gdef\tblnote@list{\@empty} \vspace{4.5ex} \footnoterule \vspace{.5ex} {\footnotesize\@temptokena} \fi} \newtoks\@temptokenb \def\tblnote@list{} \def\endtable{\spewtablenotes\end@float} \@namedef{endtable*}{\spewtablenotes\end@dblfloat} \let\tableline=\hline \def\thefigure{\@Roman\c@figure} \def\fnum@figure{FIGURE \thefigure} \def\thetable{\@Roman\c@table} \def\fnum@table{TABLE \thetable} \long\def\@makecaption#1#2{ \vskip 10pt \setbox\@tempboxa\hbox{#1\hskip 1.5em #2} \ifdim \wd\@tempboxa >\hsize {\leftskip 2em #1\hskip 1.5em #2\par} \else \hbox to\hsize{\hskip 2em\box\@tempboxa\hfil} \fi} \def\fps@figure{tbp} \def\fps@table{htbp} \let\keywords=\@gobble \let\subjectheadings=\@gobble \setcounter{secnumdepth}{0} \if@paspconfpretty \def\section{\@startsection {section}{1}{\z@}{-4.2ex plus -1ex minus -.2ex}{2.2ex plus .2ex}{\normalsize\bf}} \def\subsection{\@startsection{subsection}{2}{\z@}{-2.2ex plus -1ex minus -.2ex}{1.1ex plus .2ex}{\normalsize\bf}} \def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-2.2ex plus -1ex minus -.2ex}{0.1ex plus .2ex}{\normalsize\it}} \else \def\section{\@startsection {section}{1}{\z@}{-4.2ex plus -1ex minus -.2ex}{2.2ex plus .2ex}{\normalsize}} \def\subsection{\@startsection{subsection}{2}{\z@}{-2.8ex plus -1ex minus -.2ex}{0.1ex plus .2ex}{\normalsize}} \def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-2.8ex plus -1ex minus -.2ex}{0.1ex plus .2ex}{\normalsize}} \fi \if@paspconfpretty \def\@sect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth \def\@svsec{}\else \refstepcounter{#1}\edef\@svsec{\csname the#1\endcsname\hskip 1em }\fi \begingroup #6\relax \@hangfrom{\hskip #3\relax\@svsec}% {\interlinepenalty \@M \ifnum #2=1 \uppercase{#8}% \else #8\fi\par}% \endgroup \csname #1mark\endcsname{#7}\addcontentsline {toc}{#1}{\ifnum #2>\c@secnumdepth \else \protect\numberline{\csname the#1\endcsname}\fi #7} \def\@svsechd{} \@xsect{#5}} \else \def\@sect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth \def\@svsec{}\else \refstepcounter{#1}\edef\@svsec{\csname the#1\endcsname\hskip 1em }\fi \begingroup #6\relax \@hangfrom{\hskip #3\relax\@svsec}% {\interlinepenalty \@M \ifnum #2=1 \underline{\uppercase{#8}}% \else \underline{#8}\fi\par}% \endgroup \csname #1mark\endcsname{#7}\addcontentsline {toc}{#1}{\ifnum #2>\c@secnumdepth \else \protect\numberline{\csname the#1\endcsname}\fi #7} \def\@svsechd{} \@xsect{#5}} \fi \def\acknowledgments{\section{Acknowledgments}} \let\acknowledgements=\acknowledgments \def\mathwithsecnums{ \@newctr{equation}[section] \def\theequation{\hbox{\normalsize\arabic{section}-\arabic{equation}}}} \def\references{\section{REFERENCES} \bgroup\parindent=0pt\parskip=\itemsep \def\refpar{\par\hangindent=3em\hangafter=1}} \def\endreferences{\refpar\egroup} \def\thebibliography{\section{REFERENCES} \list{\null}{\leftmargin 3em\labelwidth 0pt\labelsep 0pt\itemindent -3em \usecounter{enumi}} \def\refpar{\relax} \def\newblock{\hskip .11em plus .33em minus .07em} \sloppy\clubpenalty4000\widowpenalty4000 \sfcode`\.=1000\relax} \def\endthebibliography{\endlist} \def\@biblabel#1{\relax} \def\@cite#1#2{#1\if@tempswa , #2\fi} \def\reference{\relax\refpar} \def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi \def\@citea{}\@cite{\@for\@citeb:=#2\do {\@citea\def\@citea{,\penalty\@m\ }\@ifundefined {b@\@citeb}{\@warning {Citation `\@citeb' on page \thepage \space undefined}}% {\csname b@\@citeb\endcsname}}}{#1}} \let\jnl@style=\it \def\ref@jnl#1{{\jnl@style#1\/}} \def\aj{\ref@jnl{AJ}} \def\araa{\ref@jnl{ARA\&A}} \def\apj{\ref@jnl{ApJ}} \def\apjl{\ref@jnl{ApJ}} \def\apjs{\ref@jnl{ApJS}} \def\applopt{\ref@jnl{Appl.Optics}} \def\apss{\ref@jnl{Ap\&SS}} \def\aap{\ref@jnl{A\&A}} \def\aapr{\ref@jnl{A\&A~Rev.}} \def\aaps{\ref@jnl{A\&AS}} \def\azh{\ref@jnl{AZh}} \def\baas{\ref@jnl{BAAS}} \def\jrasc{\ref@jnl{JRASC}} \def\memras{\ref@jnl{MmRAS}} \def\mnras{\ref@jnl{MNRAS}} \def\pra{\ref@jnl{Phys.Rev.A}} \def\prb{\ref@jnl{Phys.Rev.B}} \def\prc{\ref@jnl{Phys.Rev.C}} \def\prd{\ref@jnl{Phys.Rev.D}} \def\prl{\ref@jnl{Phys.Rev.Lett}} \def\pasp{\ref@jnl{PASP}} \def\pasj{\ref@jnl{PASJ}} \def\qjras{\ref@jnl{QJRAS}} \def\skytel{\ref@jnl{S\&T}} \def\solphys{\ref@jnl{Solar~Phys.}} \def\sovast{\ref@jnl{Soviet~Ast.}} \def\ssr{\ref@jnl{Space~Sci.Rev.}} \def\zap{\ref@jnl{ZAp}} \let\astap=\aap \let\apjlett=\apjl \let\apjsupp=\apjs \def\deg{\hbox{$^\circ$}} \def\sun{\hbox{$\odot$}} \def\earth{\hbox{$\oplus$}} \def\la{\mathrel{\hbox{\rlap{\hbox{\lower4pt\hbox{$\sim$}}}\hbox{$<$}}}} \def\ga{\mathrel{\hbox{\rlap{\hbox{\lower4pt\hbox{$\sim$}}}\hbox{$>$}}}} \def\sq{\hbox{\rlap{$\sqcap$}$\sqcup$}} \def\arcmin{\hbox{$^\prime$}} \def\arcsec{\hbox{$^{\prime\prime}$}} \def\fd{\hbox{$.\!\!^{\rm d}$}} \def\fh{\hbox{$.\!\!^{\rm h}$}} \def\fm{\hbox{$.\!\!^{\rm m}$}} \def\fs{\hbox{$.\!\!^{\rm s}$}} \def\fdg{\hbox{$.\!\!^\circ$}} \def\farcm{\hbox{$.\mkern-4mu^\prime$}} \def\farcs{\hbox{$.\!\!^{\prime\prime}$}} \def\fp{\hbox{$.\!\!^{\scriptscriptstyle\rm p}$}} \def\micron{\hbox{$\mu$m}} \def\onehalf{\hbox{$\,^1\!/_2$}} \def\onethird{\hbox{$\,^1\!/_3$}} \def\twothirds{\hbox{$\,^2\!/_3$}} \def\onequarter{\hbox{$\,^1\!/_4$}} \def\threequarters{\hbox{$\,^3\!/_4$}} \def\ubvr{\hbox{$U\!BV\!R$}} \def\ub{\hbox{$U\!-\!B$}} \def\bv{\hbox{$B\!-\!V$}} \def\vr{\hbox{$V\!-\!R$}} \def\ur{\hbox{$U\!-\!R$}} \newcount\lecurrentfam \def\LaTeX{\lecurrentfam=\the\fam \leavevmode L\raise.42ex \hbox{$\fam\lecurrentfam\scriptstyle\kern-.3em A$}\kern-.15em\TeX} \def\plotone#1{\centering \leavevmode \epsfxsize=\textwidth \epsfbox{#1}} \def\plottwo#1#2{\centering \leavevmode \epsfxsize=.45\textwidth \epsfbox{#1} \hfil \epsfxsize=.45\textwidth \epsfbox{#2}} \def\plotfiddle#1#2#3#4#5#6#7{\centering \leavevmode \vbox to#2{\rule{0pt}{#2}} \special{psfile=#1 voffset=#7 hoffset=#6 vscale=#5 hscale=#4 angle=#3}} rvsao-2.8.3/Doc/xcsao.tex0000644000016200001660000002766605177017475014324 0ustar minkoirsys% Lines starting with "%" are comments; they will be ignored by LaTeX. \documentstyle[11pt,paspconf]{article} \begin{document} \title{XCSAO: A Radial Velocity Package for the IRAF Environment} \author{Michael J. Kurtz, Douglas J. Mink, William F. Wyatt, Daniel G. Fabricant, and Guillermo Torres} \affil{Harvard-Smithsonian Center for Astrophysics, Cambridge, MA 02138} \author{Gerard A. Kriss} \affil{Department of Physics and Astronomy, Johns Hopkins University, Baltimore, MD 21218} \author{John L. Tonry} \affil{Department of Physics, MIT, Cambridge, MA 02139} \begin{abstract} XCSAO is a software package for obtaining radial velocities of stars and galaxies from optical spectra using the cross-correlation method. It has been written to work within the IRAF environment, and is compatible with other packages being developed at SAO for optical spectra. We discuss the individual components of the package in terms of the decisions required to set up the package for a new instrument/observing program. Using artificial spectra we show the procedures necessary to optimize the set up parameters, and demonstrate the robustness of the package when applied to spectra from both stars and galaxies. \end{abstract} \keywords{Data Analysis, Spectra, Radial Velocities, Redshifts} \section{Introduction} During the decade of the 1980s all radial velocities produced at SAO, both stellar and extra-galactic, were reduced using a suite of FORTH routines on NOVA computers written by John Tonry (Tonry and Davis 1979) and maintained and extended by Bill Wyatt (Tonry and Wyatt 1988). Moving our reductions onto modern computers in the IRAF (Tody 1986) environment required a total rewritting of the code; this has resulted in the RVSAO package, the main parts of which are XCSAO, for cross-correlation velocities, and EMSAO for emission line velocities. Copies of the source and IRAF installation scripts can be obtained by anonymous FTP from sao-ftp.harvard.edu as pub/iraf/pkg/rvsao/rvsao.tar.Z. A README file is also in the directory. XCSAO has been extensively tested on Decstations and Sparcstations and is expected to experience no major changes. EMSAO is still undergoing substantial revision. Both tasks have been in production use at SAO for the past year, and are currently in production use by several large redshift and radial velocity programs worldwide. XCSAO has its origins in the XCOR program written by Gerry Kriss, as well as the FORTH code, and a FORTRAN rendition of it by Tonry. Eventually we included the continuum estimation methods from Mike Fitzpatrick's FXCOR. Our code was written and is being maintained by Doug Mink. This paper presents a very brief overview of the capabilities of XCSAO, and some of the testing procedures we have developed for it. An extensive description of the program is in preparation for PASP (Kurtz, et al. 1992). \section{Elements of XCSAO} The following subsections describe briefly the elements of XCSAO in the order in which they occur in the code. We indicate those elements which we believe should receive critical attention when setting up XCSAO for a new instrument. \subsection{Input Formats} XCSAO takes lists of 1-dimensional wavelength calibrated spectra in the standard format used by the ONEDSPEC task in the NOAO package. Spectra may be either log or linear lamda binned. Two lists are required, one for the unknowns and one for the templates; each unknown will be compared separately with each template. Figure~I shows the parameter file for XCSAO. \begin{figure} \vspace {20cm} \caption{Parameter File for XCSAO.}\label{fig-1} \end{figure} \subsection{Rebinning} Spectra are rebinned into the specified number of log wavelength bins (NCOLS) so that there is the maximum possible overlap between the unknown and the template in the rest frame. This is achieved by iterating on the radial velocity a total of NZPASS times; in addition the user can choose an initial guess CZGUESS by setting CZINIT=yes. The error in the estimate of radial velocity can often be halved on the second pass. Note that this binning suggests that it is worthwhile to have the template cover the broadest wavelength range possible, at a dispersion equal or better than the unknown's, the rebinning will then choose the proper wavelength region for maximal overlap, with the resolution determined by the unknown. We find that it is in all cases better to rebin to the next larger power of two than the number of actual pixels, rather than the next smaller. \subsection{Apodization} The spectra are apodized by a cosine bell over a specified percentage of its extent. The size of the apodized region should be kept as small as possible while still preventing ringing in the fourier transform. We have found 5\%\ is satisfactory for most spectra, but this should be set for each new instrument following some testing. \subsection{Continuum and Emission Line Suppression} The continuum is subtracted from each spectrum after being calculated by routines derived from the ICFIT task, and only slightly modified from their implementation in the FXCOR task in the RV0 package. There are a large number of possibilities here, different observing programs require different settings. This is the area which we believe deserves the most experimentation when setting up a reduction. If EMCHOP=yes XCSAO will remove emission lines and replace them with the value of the continuum before performing the cross corelation. The emission lines are found using ICFIT, with parameters settable as for the continuum supression; the method for finding emission lines here is similar to that used in the sister task EMSAO. Removing emission lines is critical to finding absorption line redshifts from galaxies with emission lines, if the spectrum is too noisy for the emission line removal, or if it has sharp spurious absorption features from poor sky subtraction we recommend that the offending regions be exised by hand, using SPLOT. \subsection{Fourier Filtering} Before correlating the unknown with the template each is put through a bandpass filter in the fourier domane (unless TEMPFIL=yes, then the template is considered to have already been filtered). We have done a number of experiments with the fourier filter, some of the main results are: 1. The type of ramp used in the bandpass filter is not important (assuming it is a reasonable choice, a step function is not reasonable). We have therefore removed all the options for filter type from XCSAO, and use just a cosine bell. 2. The exact choice of the high pass roll-off is unimportant. in so far as it does not impinge on the main data region. 3. The exact choice of the low pass roll-on is critical to the reduction, it should be chosen with great care. This also effects the relation of the $r$ statistic with the actual error, see below. 4. Use of a frequency weighting scheme which can be shown in the limit of infinitly wide spectra to produce the maximum likelihood estimation for the lag (radial velocity) (e.g. Hassab and Boucher, 1979) is not an effective technique for spectra similar to ours. \subsection{Cross Correlation} The normal fourier cross correlation, the transform of one spectrum times the conjugate of the transform of the other, is performed. \subsection{Peak Fitting} The user can set the function to use to fit the peak with PKMODE, normally this makes no significant difference in the velocity. The user also sets the fraction of the peak height to fit the function to with PKFRAC, .5 is the default choice. Because the spectrum is quantized in pixels while the fractional power point to fit to is not we perform two fits, one two pixels wider than the other, and report the weighted mean as the result of the fit. \subsection{Error Calculation} Following Tonry and Davis(1979) we calculate an error as a function of their $r$ statistic. It can be shown analytically that for sinusoidal noise with a half width of the sinusoid equal to the halfwidth of the correlation peak that the mean error in the estimation of the peak of the correlation function is \begin{equation} error = {3\over 8}{w \over{(1+r)}} \end{equation} where w is the FWHM of the correlation peak, and r is the ratio of the correlation peak height to the amplitude of the antisymmetric noise. For large observing programs a better error estimate may be obtained. The coefficient ${3 \over 8} w$ is for many situations a constant, and may be estimated by taking the mean of a number of measures. The error estimate then becomes a constant divided by $(1 + r)$. This is not in all cases possible, for example when the low pass fourier roll-on is changed the relation of $r$ with error changes. ${3 \over 8} w$ tracks this properly. Figure~II shows the calculated errors (dots) versus the actual mean errors (solid lines) as a function of the $r$ statistic for three different low-pass filters; note that the calculated errors do track the actual errors, but that the relation of $r$ with error changes. \begin{figure} \vspace {8cm} \caption{Individual error estimates (dots) versus actual mean errors (solid lines) for 1200 synthetic echelle spectra. The three sets are for three different fourier filter roll-on points; the filter parameters, and the mean errors for each filter are shown on the figure.}\label{fig-2} \end{figure} \subsection{Output Formats} While XCSAO may be run totally as a batch proceedure, it may also be run in an interactive mode. Intermediate stages in the reduction may be plotted, and the correlation peak to chose may be specified. At the conclusion of a reduction one may choose to redo the reduction interactively, to view a plot of the main absorption lines, to edit the emission lines, to remove spectral regions, .... \begin{figure} \vspace{8cm} \caption{Primary output plot from XCSAO}\label{fig-3} \end{figure} \begin{figure} \vspace{8cm} \caption{Output plot showing absorption lines labeled}\label{fig-4} \end{figure} Figure~III shows the standard final plot, and Figure~IV shows an absorption line plot, both for a galaxy spectrum observed by M. Ramella with the ESO 1.5m telescope. \section{Testing} We have tested XCSAO with synthetic spectra created to have a specified number of counts sampled from a parent distribution, which is a template spectrum. For tests of echelle spectra we used Kurucz models for the templates, for tests of galaxy spectra we used high S/N observations. Note that we can know the true radial velocity difference between the unknowns and the templates either exactly in the case of models, or where the template spectrum was exactly the one used to create the synthetic spectra, or with very high accuaracy, as when the radial velocity template is different from the template used to create the synthetic spectra. The data used to create Figure~II were 1200 synthetic spectra created from a Kurucz model of a 5500K dwarf, and having between 5000 and 30,000 total counts. The template used for cross correlation was exactly the same template as was used to create the synthetic spectra. A complete description of the testing procedures will be found in Kurtz, et al. (1992). \acknowledgments Steve Levine and John Morse made important contributions to the development of the code. Dave Latham, Alejandra Milone, Susan Tokaraz, and John Huchra have contributed mightily of their expertise. Much of the IRAF code we have used was written by Mike Fitzpatrick and Frank Valdes. \begin{references} \reference Hassab, J.C. and Boucher, R.E. 1979, {\it IEEE Trans. Acoust. Speech Signal Process.}, {\bf ASSP-27}, 922 \reference Kurtz, M.J., Mink, D.J., Wyatt, W.F., Fabricant, D.G., Torres, G., Kriss, G.A., and Tonry, J.L. 1992, \pasp, to be submitted \reference Tody, D. 1986, in {\it Instrumentation in Astronomy VI}, ed. D.L. Crawford, Proc. SPIE 627, 733 \reference Tonry, J.L. and Davis, M. 1979, \aj, {\bf 84}, 1511 \reference Tonry, J.L. and Wyatt, W.F. 1988, {CFA Z-Machine Data Analysis Software}, Cambridge: Smithsonian Astrophysical Observatory \end{references} \end{document} rvsao-2.8.3/Doc/contpars.hlp0000644000016200001660000000276611253501411014771 0ustar minkoirsys.help contpars Sep09 rvsao .ih NAME contpars -- Parameter set for continuum and line removal .ih USAGE contpars .ih PARAMETERS .ls c_interactive no Fit continuum interactively (yes or no). If yes, a graph of the spectrum and the continuum fit is plotted to stdgraph, with rejected points flagged. "q" accepts the fit and continues the main task, "?" prints options, "d" deletes points, "u" undeletes points, "f" refits and redraws the data. .le .ls c_sample "*" Sample of points to use in fit. "*" = all. .le .ls c_function spline3 Continuum fitting function (spline3 or legendre or chebyshev or spline1) .le .ls naverage 1 Number of points in sample averaging .le .ls order 1 Order of fitting function. This is the IRAF order, i.e. the number of coefficients, not what you might expect. If order=0, no continuum is fit or removed. .le .ls s_low_reject 2. Spectrum continuum fit minimum acceptance limit in sigma of fit .le .ls s_high_reject 2. Spectrum continuum fit maximum acceptance limit in sigma of fit .le .ls t_low_reject 2. Template continuum fit minimum acceptance limit in sigma of fit .le .ls t_high_reject 2. Template continuum fit maximum acceptance limit in sigma of fit .le .ls niterate 10 Number of rejection iterations .le .ls grow 1. Rejection growing radius .le .ih DESCRIPTION \fIcontpars\fR sets the parameters to be used to fit the continuum of spectra on which XCSAO or EMSAO are being run. .ih EXAMPLE To set continuum fit parameters, rvsao> contpars .ih SEE ALSO xcsao, emsao .endhelp rvsao-2.8.3/Doc/rvsao.files0000644000016200001660000000767405333545554014636 0ustar minkoirsys RVSAO An IRAF package to compute radial velocities by Doug Mink, Bill Wyatt, Guillermo Torres, Mike Kurtz Harvard-Smithsonian Center for Astrophysics Gerry Kriss Center for Astrophysical Sciences, Johns Hopkins University John Tonry Massachusetts Institute of Technology John Morse University of North Carolina Stephen Levine University of Wisconsin Here is a list of all of the SPP and Fortran routines used by the RVSAO package, an evolved version of Gerry Kriss's REDSHIFT package, merged with peak fitting routines developed at the Center for Astrophysics. In directory Xcor: aspart.x compute antisymmetric noise (called by xcorfit) buffers.x various buffer routines (called by xcorfit) correlate.x various correlation routines (called by xcorfit) earlin.x polynomial fitting (called by pkfitp, pkfitq) pkfitc.x fit cos(x)/(1+x^2) to cross-correlation (called by xcorfit) pkfitp.x fit parabola to cross-correlation (called by xcorfit) pkfitq.x fit quartic to cross-correlation (called by xcorfit) pknum.x count peaks in cross-correlation (called by xcorfit) pkwidth.x find max and width of cross-correlation (called by xcorfit,pkfit) plotsubs.x summary page subwindow plotting (called by xcplot) rebinr.x rebin spectrum and template (called by t_xcsao) t_xcsao.x main program for cross-correlation redshifts xcarch.x write SAO TDC archive records (called by t_xcsao) xcmin.x fit function to data (called by pkfitc) xcorfit.x compute cross-correlation and fit peak (called by t_xcsao) xcplot.x Plot summary page, handle cursor interaction (called by t_xcsao) xcrslts.x summarize results to log file (called by t_xcsao) In directory Emvel: emarch.x Write SAO TDC archive emission line record to a file emeplot.x Plot spectrum and mark emission and absorption lines emfind.x Find all lines within section of spectrum which meet criteria emfit.x Compute radial velocity from emission line shift emgauss.x Gaussian EMMIN calling program and computation subroutines emguess.x Make initial velocity guess by examining spectrum eminit.x Read emission and absorption line information from files emlfit.x Fit gaussians to all lines found emmin.x Fitting subroutine emplot.x Cursor handling subroutine emrslts.x Display results of emission line fits to display and/or file emsrch.x Find emission lines in spectrum emvfit.x Combine information from multiple emission lines for velocity t_emsao.x Main emission line program EMSAO In directory Util: apodize.x Apodize spectrum bcv.f Compute barycentric velocity correction for spectrum chopper.c Emission line chopper (SAO) compbcv.x Interface to barycentric correction subroutine contpars.x Subroutines to deal with ICFIT continuum removal emchop.x Interface to SAO emission line chopper evalpoly.c Polynomial evaluator used by chopper.c fourm.x Fourier transform based on Press, et al. getimage.x Read a spectrum from an IRAF file getsky.x Read a sky spectrum from an IRAF file getspec.x Read an object specrum from an IRAF file gettemp.x Read a template spectrum from an IRAF file gettemps.x Read a list of templates from IRAF files hershey.f Draw characters using hershey font set icsubcon.x Remove continuum and emission lines using ICFIT routines imgpar.x Get parameters from an IRAF image header invert.x Invert a matrix legendre.x Fit and compute Legendre polynomials matinv.x Invert a matrix plotspec.x Plot a spectrum, includes cursor interaction polfit.x Fit a polynomial to a vector polyfunc.c Evaluate a polynomial ranges.x Decode ranges of numbers from a string replot.x Plot a vector (called by plotspec) smooth.x 1-2-1-smooth a vector subcon.x Remove a polynomial continuum from a spectrum vcombine.x Combine emission line and cross-correlation velocities rvsao-2.8.3/Doc/hints0000644000016200001660000000075705577662700013526 0ustar minkoirsysEMSAO: Turn off smoothing (NSMOOTH=0 or 0) before identifying lines to redo emission line search EMSAO: In case of crash with "ERROR: [floating operand error]", try rerunning with vel_init="search". Chances are the correlation velocity isn't too good, or that it points at a bad line. Another possibility is an inadequate continuum fit. Try changing the order in contpars by 1 or 2, if EMSAO has been working on your data, or by more if it hasn't yet worked. rvsao-2.8.3/Doc/qplot.hlp0000644000016200001660000000314410627624372014306 0ustar minkoirsys.help qplot Sep95 rvsao .ih NAME qplot -- Use EMSAO to plot emission and absorption lines already found in a spectrum file or list of spectra .ih USAGE qplot spectra .ih PARAMETERS .ls spectra = "" List of file names of spectra to analyze. @filename indicates list should come from file filename. As of version 1.3, apertures of multispec spectrum files can be entered as numbers, lists, or ranges enclosed in brackets after each file name in the list or file. This parameter is directly passed to the task chosen below. .le .ls qtask = "xcsao" Task to run (xcsao or emsao)"} .le .ls velplot = "combination" Velocity to plot (combination or emission or correlation .le .ih DESCRIPTION QPLOT runs either XCSAO without correlating or EMSAO with finding new lines, then displays the spectrum with lines labelled and previously-obtained results. These results should have been written to the image headers using save_vel=yes when XCSAO and EMSAO were run. The cursor mode is turned on, so that initial conditions can be changed (such as a new redshift guess or deleted cosmic ray) and the program (XCSAO or EMSAO) can be rerun. The main reason for using QPLOT is to set a quality flag in the spectrum image header. If the task is not rerun, only the summary information is rewritten. If the spectrum is recorrelated or refit, the new results are only written to the spectrum header if a quality flag (y=OK, n=bad, j=questionable) is set. .ih EXAMPLES To check the redshift of a single galaxy cl> qplot galaxy To check redshifts for a whole night's worth of galaxy spectra: cl> qplot @nite1.ls .ih BUGS .endhelp rvsao-2.8.3/Doc/zvel.hlp0000644000016200001660000000321105544157622014123 0ustar minkoirsys.help zvel Mar94 rvsao .ih NAME zvel -- Compute redshift using the cross-correlation and emission line techniques .ih USAGE zvel spectra .ih PARAMETERS .ls imagelist = "" List of file names of spectra to analyze. @ indicates list should come from file . [] indicates that a range of apertures in a multispec file should be processed, where is a comma- and/or hyphen-separated list of numbers. .le .ls imagext=".imh" Image header file name extension .le .ls emis_vel=yes Compute emission line velocities (yes or no) .le .ls corr_vel=yes Compute cross correlation velocities (yes or no) .le .ls plot=yes Plot results on display (yes or no) .le .ls hard_copy=no Make printer hard copies (yes or no) .le .ls curmode = no If yes, wait in cursor mode after each spectrum is processed. Cursor mode commands may be listed by typing "?". .le .ls verbose = no If yes, values of the parameters fit to the selected peak are recorded in the log files. This is most useful for debugging. .le .ih DESCRIPTION ZVEL runs either XCSAO or EMSAO or both, so the user doesn't have to type a file name in twice. Set parameters in XCSAO, EMSAO, and CONTPARS. curmode, hard_copy, plot, and verbose override the equivalent parameters in XCSAO and EMSAO. If both XCSAO and EMSAO are being run, the image files should be writeable so the cross-correlation velocity can be saved to be used as an initial guess at the emission line velocity. .ih EXAMPLES To obtain the redshift and dispersion of a single galaxy cl> zvel galaxy To obtain redshifts for a whole night's worth of galaxy spectra: cl> zvel @nite1.ls .ih BUGS .endhelp rvsao-2.8.3/Doc/velset.hlp0000644000016200001660000000450110636773612014451 0ustar minkoirsys.help velset apr94 rvsao .ih NAME velset -- Artificially change the redshift of spectra. .ih USAGE velset input output .ih DESCRIPTION This task changes the wavelength scale of spectra, moving them from one given redshift to another one. The input spectra are specified by an image template list. The output is either a matching list of spectra or a directory. The task works by copying the input spectra to the output destination, and then modifying the header keywords that describe the wavelength axis, on the output spectra only. A spectrum may not be copied onto itself; this prevents original wavelength information from being accidently overwritten. Image sections are ignored both on input and output, because it is assumed that the user wants a copy of the input with the wavelength scale modified. *** WARNING *** Use this task on log-wavelength spectra ONLY. SUMSPEC will rebin and shift linear wavelength spectra. This task looks in the header for keywords describing the wavelength axis; keywords are sought in the following order: first, IRAF keywords 'W0' and 'WPC'; next, CD keywords 'CRVALn' and 'CDn_1'; and finally, FITS keywords 'CRVALn' and 'CDELTn' (n is the value of task parameter 'axis', unless the IRAF header keyword 'DISPAXIS' is found, in which case it takes precedence over the parameter). Logarithmic wavelength scale is treated correctly if either the 'log' task parameter is set to "yes" or if the IRAF header keyword 'DC-FLAG' is found in the header with value 1. 'HISTORY' records are appended to the header. .ih PARAMETERS .ls input [file name template] Name(s) of the input files containing spectra. .le .ls output [file name or directory name] The output file, or directory, to which the transformed spectra will be written. .le .ls velz=yes Is the new redshift in Z (yes) or km/sec (no) .le .ls newz = 0.0 The redshift of the output spectra. .le .ls (verbose = yes) [boolean] Print operations? If set to "yes", the wavelength origin and step for both the input and output spectra are listed as the task progresses. .ih EXAMPLES 1. Transform a set of spectra with root name 'cluster*' to redshift 0.0. The result will be stored in subdirectory 'local/'. The input spectra are in STSDAS format (extension '.hhh'). .nf to> setvel cluster*.hhh local/ newz=0.0 .fi .ih BUGS .ih SEE ALSO .endhelp rvsao-2.8.3/Doc/bcvcorr.hlp0000644000016200001660000001354512104475051014603 0ustar minkoirsys.help bcvcorr Mar2012 rvsao .ih NAME bcvcorr -- Set barycentric velocity correction in a spectrum image header .ih USAGE bcvcorr image .ih PARAMETERS # Spectra .ls spectra "" List of input spectra .le .ls specnum "0" Spectrum number(s) if multispec file. This affects how the barycentric velocity will be written into the header if savebcv is yes. If specnum is 0, the BCV keyword is used; otherwise, APVELn is used, with the barycentric velocity correction in the 4th field: 0.0 0.0 _ bcv . .le .ls specdir "" Directory for input spectra .le .ls specsky no If yes, this spectrum is a twilight sky or solar spectrum, and the velocity correction is computed from the direction of the sun, not the telescope pointing correction. .le .ls subgrav no If subgrav=yes and specsky=yes, subtract a correction for the sun's gravity (0.636) from the barycentric and heliocentric corrections computed by the program. If savebcv=yes, BCV, HCV, and SGRV are written to the image header. HCV, the velocity of the sun relative to the spectrograph with the gravitational correction subtracted, should be used as the spectrum correction (rvsao.svel_corr=heliocentric) when cross-correlating twilight spectra with XCSAO. # Sky direction .ls keyra "RA" Right ascension header keyword .le .ls keydec "DEC" Declination header keyword .le .ls keyeqnx "EPOCH" Coordinate equinox header keyword .le .ls keyjd "HJD" Header keyword for Julian date at middle of observation .le .ls keydate "DATE-OBS" Header keyword for date of observation (dd/mm/yyyy) .le .ls keystart "UTOPEN" Header keyword for UT at start of observation .le .ls keymid "UTMID" Header keyword for UT in middle of observation .le .ls keyend "UT" Header keyword for UT at end of observation .le .ls keyexp "EXPOSURE" Header keyword for duration of observation in seconds .le .ls obsname "file" Observatory name. If file to read from image header .le .ls keyobs "SITENAME" Observatory name header keyword .le .ls keylat "SITELAT" Observatory latitude header keyword .le .ls keylong "SITELONG" Observatory longitude header keyword .le .ls keyalt "SITEALT" Observatory altitude header keyword .le .ls obslong 0.0 Observatory longitude, used if obsname is not "file" .le .ls obslat 0.0 Observatory latitude, used if obsname is not "file" .le .ls obsalt 0.0 Observatory altitude in meters, used if obsname is not "file" .le .ls savebcv no Save barycentric velocity correction as BCV and heliocentric velocity correction as HCV in data file header (yes or no) .le .ls savejd no Save Geocentric Julian Date as GJDN, Heliocentric Julian Date as HJDN, and UT midtime of observation as UTMID in data file header (yes or no) .le .ls verbose yes Displays heliocentric and barycentric corrections .le .ls printmode 1 If 1, display heliocentric and barycentric corrections and ancillary data; if 2, display only barycentric correction .le .ls debug no Displays intermediate results .le .ih DESCRIPTION \fIbcvcorr\fR can be used to set the barycentric velocity correction of spectra which do not have the header keywords expected by the correction computation subroutine in XCSAO, EMSAO, or SUMSPEC, or use different keywords than the program expects. The time, date, direction, and observatory can come from specified keywords or values directly from parameters. In the case of the observatory position, a third option is to set the obsname parameter to a string which is looked up in the IRAF observatory database. Either keymid or two of keystart, keyend, and keyexp will be used to compute the exact observation time, in conjunction with the date from keydate, if keyjd, which is assumed to be the midtime of the observation, is not present. If savebcv is yes, the barycentric velocity correction is written to the image header. If specnum is 0, the BCV keyword is used; otherwise, APVELn is used, with the barycentric velocity correction in the 4th field: 0.0 0.0 _ bcv . No matter what specnum is set to, the midtime UT is written to UTMID, and the Julian Date and Heliocentric Julian Date are written to GJDN and HJDN respectively, but only to those keywords which are not already filled. The barycentric velocity correction is added to the observed redshift of a spectrum to get a velocity relative to the solar system barycenter so that a set of radial velocities over time have a constant reference point. .ih EXAMPLE To compute a spectrum's barycentric velocity correction, reading everything from the spectrum's header: .nf RA = ' 11:04:31.90' /RIGHT ASCENSION SET BY COMMENT FILE DEC = '-21:07:35.0' /DECLINATION SET BY COMMENT FILE EPOCH = 2000.0 /SET BY COMMENT FILE DATE-OBS= '28/01/100' /UT DD/MM/YY AT END OF EXPOSURE UT = '08:00:28' /UT HH:MM:SS AT END OF EXPOSURE UTOPEN = '07:42:26' /UT HH:MM:SS AT BEGINNING OF EXPOSURE EXPTIME = 1081.01 /INTEGRATION TIME, SECONDS HJDN = 2451571.83082 /HELIOCENTRIC JULIAN DAY AT MIDDLE OF EXPOSURE SITENAME= 'oro ' SITELONG= '+71:33:33.0' /LONGITUDE, DEGREES WEST OF ZERO SITELAT = '+42:30:13.0' /LATITUDE, DEGREES SITEELEV= 137.0 /ELEVATION, METERS .fi Note that the RVSAO package recognizes nonstandard FITS dates, such as this one, which really should be '2000-01-28'. .nf rv> bcvcorr spectrum 0104.H096050.fits: 4096 x 2 x 1 2-D image UT start: 7:42:26.0, mid: 7:51:26.5, end: INDEF, exp: 1081 2000-Jan-28 7:51:26.5 UT RA: 11:04:31.9, Dec: -21:07:35.0 2000.0 28/01/100 lat 42:30:13.0 , long 71:33:33.0, alt 137.0 Julian date is 2451571.82739 at 2000-Jan-28 7:51:26.5 UT Object at ra 11:04:31.900 dec -21:07:35.00 eq 2000 Heliocentric Julian date: 2451571.83081 gbcvel = 20.6503 ghcvel = 20.6598 geovel = -0.0394 bcv = 20.6109 hcv = 20.6204 computed bcv = INDEF hcv = INDEF from file .fi .ih SEE ALSO On-line help is available on the World Wide Web at http://tdc-www.harvard.edu/iraf/rvsao/bcvcorr .endhelp rvsao-2.8.3/Doc/sumspec.hlp0000644000016200001660000002533611164516635014634 0ustar minkoirsys.help sumspec Mar2009 rvsao .ih NAME sumspec -- Make a composite spectrum from several spectra .ih USAGE sumspec spectra compfile .ih PARAMETERS .ls spectra = "" List of file names of spectra to analyze. @ indicates list should come from file . [] indicates that a range of apertures in a multispec file should be processed, where is a comma- and/or hyphen-separated list of numbers. .le .ls specnum = 0 If this is nonzero and \fIspectra\fR contains a single file name, this is a range of spectrum numbers in a multispec file which will be added. Wavelength dispersion information is read from APNUMn or the WCS keywords. Velocity information is read from APVELn and saved in APVELn and APVXCn. In a non-multispec file, radial velocity is read from the VELOCITY header parameter. .le .ls specband = 0 If this is nonzero, it is the band in the multispec file(s) specified by spectra which will be summed. Wavelength dispersion information is read from APNUMn, where n is the aperture specified by \fIspecnum\fR or the WCS keywords. Velocity information is read from APVELn and saved in APVELn and APVXCn. (New in version 2.0) .le .ls specdir = "./" Directory containing spectra to analyze. This part of the pathname is not printed at the top of the page, and is assumed to be the same for all spectra listed in the spectra parameter. .le .ls compfile = "" File name for output spectrum. .le .ls compname = "" Title for output spectrum. .le .ls compdir = "" Directory for output spectrum .le .ls nspec = 1 Number of spectra in output file .le .ls save_names = yes Save names of input files in output file header (yes or no) .le .ls copy_header = yes Copy output header from first input spectrum (yes or no) .le .ls normin = no If yes, the data spectrum is divided by its mean value before being processed. Use this on spectra which have unusual data values such as those produced by flux calibration. .le .ls fixbad = no If "yes", remove wavelength-delimited regions listed in the file specfied by \fIbadlines\fR. (added in version 2.0) .le .ls badlines = badlines.dat File containing list of starting and stopping wavelengths in Angstroms for removal of portions of all object spectra if \fIfixbad\fR is yes. All information after the second wavelength is a comment field. This file is assumed to be in the directory \fIlinedir\fR unless a complete pathname starting with "/" is specified. (added in version 2.0) .le .ls linedir = "rvsao$lib/" Directory containing line list file named by badlines. This parameter is ignored if: that filename contains a "/" in the first column, as it is assumed to be a full pathname, if there is a "/" anywhere else in the filename, as it is assumed to be a path relative to the current working directory, or if there is a "$" in the filename, as the part preceding the "$" is assumed to be an IRAF environment parameter (ending in "/") defining a directory. .le .ls cont_remove = no Remove continuum from input spectra if not "no". If "subtract", subtract continuum. If "divide", divide by continuum. If "zerodiv", divide by continuum and subtract 1. This last should be used instead of "divide" if the file is to be cross-correlated. In version 2.0, "divide" subtracted 1; in version 2.1b15 and later, it doesn't, and the "zerodiv" option was added. Parameters used in the fit are mostly set in the contsum pset. .le .ls cont_split = 1 Number of regions into which to split the spectrum for separate continuum fits .le .ls reject = "no" Chop out emission lines from object spectra before adding them to the composite spectrum if "yes". If "specfile", emission lines are removed if the value of the CHOPEM keyword in the object spectrum image header is T. If the keyword is not present or is F, emission lines are not removed. If "no", emission lines are never removed. If EMCHOP in the input spectrum file is 1, emission lines are not removed. .le .ls abs_reject = 100.0 Input spectrum absorption line rejection in sigma of fit .le .ls em_reject = 2.0 Input spectrum emission line rejection in sigma of fit .le .ls contout = no Remove continuum from output spectrum/spectra if not "no". If "subtract", subtract continuum. If "divide", divide by continuum. If "zerodiv", divide by continuum and subtract 1. This last should be used instead of "divide" if the file is to be cross-correlated. In version 2.0, "divide" subtracted 1; in version 2.1b15 and later, it doesn't, and the "zerodiv" option was added. Parameters used in the fit are mostly set in the contsum pset. .le .ls cont_plot = yes If yes, plots of the continuum-subtracted input spectra are displayed. This is most useful for determining the appropriateness of the continuum fitting parameters. .le .ls cont_add = 0 Continuum level added to output spectrum to keep all flux above zero, for example .le .ls spec_smooth = 0 If >0, the spectra are smoothed \fIsmooth\fR times before graphing them. The spectrum is NEVER smoothedvefore adding .le .ls st_lambda = INDEF Starting wavelength in angstroms of output spectrum. If INDEF, use beginning of wavelength overlap between input spectra. .le .ls end_lambda = INDEF Ending wavelength in angstroms of output spectrum. If INDEF, use end of wavelength overlap between input spectra. .le .ls pix_lambda = INDEF Wavelength per pixel in angstroms of output spectrum. If INDEF, compute from wavelength range and number of pixels in output spectra. .le .ls ncol = 2048 Number of pixels into which to rebin data. .le .ls complog = no Rebin into log wavelength (yes or no) .le .ls interp_mode = "spline3" Interpolation mode to use when rebinning spectra, must be "nearest" or "linear" or "spline3" or "poly3" or "poly5" or "sinc" or "lsinc" or "drizzle" or "sums". .le .ls normout = no If true, the output spectrum is divided by its mean value before being transformed. This is used on spectra which may have unusual values due to their having already been flux-calibrated. .le .ls spec_plot = yes If yes, plots of the individual spectra are displayed. During this time the normal IRAF cursor commands are active as well as several more that are itemized below. If emission lines are chopped, before and after plots are displayed, as well as the chopped line(s). .le .ls spec_int = no If yes, pause in cursor mode after each input spectrum has been plotted. .le .ls comp_plot = yes If yes, a plot of the output spectrum is displayed after each input spectrum is added. Cursor commands are activated for zooming in on a portion of the spectrum and hard copies may be made to stdplot using the \fI@\fR command. .le .ls comp_int = no If yes, pause in cursor mode after the composite spectrum has been plotted. .le .ls ymin = INDEF Minimum y value to plot. Autoscale if INDEF .le .ls ymax = INDEF Maximum y value to plot. Autoscale if INDEF .le .ls velcomp = INDEF Velocity in km/sec to which to shift individual spectra. If INDEF, do not shift spectra at all. .le .ls zcomp = INDEF Velocity of output spectrum as delta lambda / lambda; overrides velcomp if not INDEF. .le .ls svel_corr = "barycentric" Spectrum velocity correction to the solar system barycenter. Set to "none" if spectrum has already been shifted or if this correction is unnecessary. If "file", \fIBCV\fR is used if present in the file header, or else \fIHCV\fR. If "hfile", the header parameter \fIHCV\fR is always used. If neither is found, no correction is made. If svel_corr is not set to "none", but velcomp and zcomp are INDEF, data is shifted to the barycentric velocity correction of the first spectrum, if it has one. If "heliocentric" or "barycentric" corrections are chosen, position and time parameters are read from the spectrum data file header. \fIDATE-OBS\fR (date in format 'dd-mm-yy') \fIUT\fR (U.T. at end of exposure as 'hh:mm:ss') and \fIUTOPEN\fR (U.T. at start of exposure as 'hh:mm:ss') or \fIEXPOSURE\fR (length of exposure in seconds) are used to compute the midtime of the exposure. \fIRA\fR (right ascension as 'hh:mm:ss.ss'), \fIDEC\fR (declination as 'dd:mm:ss.ss'), and \fIEPOCH\fR (epoch of coordinates defaults to 1950.0) give the position of the object whose spectrum this is. \fISITELONG\fR (observatory longitude as 'dd:mm:ss.ss' or degrees), \fISITELAT\fR (observatory latitude as 'dd:mm:ss.ss' or degrees), and \fISITEELEV\fR (observatory altitude in meters) give the observatory position. Use bcvcorr task to set BCV in header and use "file" here if header parameters are different. .le .ls nsmooth = 0 Number of times to 1-2-1 smooth displayed spectrum .le .ls device = "stdgraph" Interactive device on which to graphicallly .le .ls plotter = "stdplot" Second, non-interactive device on which to plot the graphic summary of results. .le .ls logfiles = "STDOUT,sumtemp.log" All results from SUMTEMP are recorded in these files. .le .ls nsum = 1 Number of pixels to sum across dispersion .le. .ls debug = no If yes, values of the parameters fit to the selected peak are recorded in the log files. This is most useful for debugging. .le .ih DESCRIPTION SUMSPEC combines spectra, shifting them to a common redshift, if either the \fIvel_comp\fR or the \fIz_comp\fR parameter is not INDEF. The VELOCITY header parameter of each of these spectra is assumed to be a solar-system-barycenter-corrected velocity, and a barycentric correction (computed by SUMSPEC or extracted from the BCV or HCV header parameter) is subracted to get the redshift of the spectrum. Each spectrum is shifted and rebinned to log or linear wavelength, then added to the composite spectrum. Input may be multispec or twodspec format, but output is always a one-dimensional file. .ih CURSOR The following keystrokes are active for graphs of input and output spectra in addition to the normal IRAF cursor facilities (a list of those is available with the command ":.help"): .ls @ Make a hard copy on the device designated by \fIplotter\fR. .le .ls c Prints cursor position in x and y. This is the default. All other undefined keys perform this same function. .le .ls d Replaces a region between the marked vertical cursors with interpolated values from the edges of the marked region. This is typically used to eliminate poorly subtracted night sky lines or emission lines. .le .ls n Smooth spectrum n times before plotting. This only affects to current spectrum display and the final spectrum graph, not the spectrum data. .le .ls q Quit and exit. .le .ls r Forces a replot of the current spectrum at the original scale. .le .ls u Redisplay the entire plot after zooming. .le .ls z Zoom in on the region marked by two successive 's .le .ih EXAMPLE To make a galaxy template by combining a list of galaxy spectra: rvsao> sumspec @galaxies template=galtemp tempvel=1000.0 .ih SEE ALSO rvsao.contsum which sets the continuum fit parameters On-line help is available over the World Wide Web at http://tdc-www.harvard.edu/iraf/rvsao/sumspec .endhelp rvsao-2.8.3/Doc/xcsao.hlp0000644000016200001660000006762611253505253014273 0ustar minkoirsys.help xcsao Mar2009 rvsao .ih NAME xcsao -- Compute redshift using the cross-correlation technique .ih USAGE xcsao spectra .ih PARAMETERS .ls spectra = "" List of file names of spectra to analyze. @ indicates list should come from file . [] indicates that a range of apertures in a multispec file should be processed, where is a comma- and/or hyphen-separated list of numbers. .le .ls specnum = 0 If this is nonzero and \fIspectra\fR contains a single file name, this is a range of spectrum numbers (1-10 or 1,2,5-20 with no spaces, for example) in a multispec file which will be cross-correlated. For each spectrum number, n, wavelength dispersion information is read from APNUMn, and velocity information is read from APVELn and saved in APVELn and APVXCn, the values of which contain multiple values. If specnum is zero, velocity information is in separate keywords for each value. .le .ls specband = 0 Spectrum band if multispec file .le .ls specdir = "./" Directory containing spectra to analyze. .le .ls correlate = yes If "yes" or "velocity", cross-correlate object spectrum against specified template spectrum in log wavelength, displaying spectrum, correlation peak (if display mode 1), and detailed results for the best 12 templates. If "wavelength", cross-correlate object spectrum against specified template spectrum in wavelength, displaying spectrum, correlation peak (if display mode 1), and detailed results for the best 12 templates. If "pixel", cross-correlate object spectrum against specified template spectrum in pixels, displaying the spectrum, correlation peak (if display mode 1), and detailed results for the best 12 templates. If "no", display spectrum with previous results read from the spectrum image header with no correlation peak plot. If the spectrum is recorrelated, it is processed in log wavelength, and "velocity" is assumed. .le .ls templates = "" Template file or comma-separated list of file names of images to use as templates or name of file containing template file names, one per line, in which case the list file name must be preceded by a "@". Apertures of multispec template files can be entered as numbers, lists, or ranges enclosed in brackets after each file name in the list or file. Wavelength (or pixel) ranges of templates to be correlated can be specified by appending :w1-w2 (:p1-p2) to the template name. Multiple pieces of a single template spectrum can thus be correlated agains multiple pieces of an object spectrum. .le .ls tempnum = 0 If nonzero and \fItemplates\fR contains a single file name, this is a range of spectrum numbers in a multispec file to be used as templates. Wavelength dispersion information is read from APNUMn, and velocity information is read from APVELn. If \fIechelle\fR is yes, this number is ignored unless the first number is different from the first number of \fIspecnum\fR, in which case the difference from the \fIspecnum\fR number is assumed to be a shift in order between the two spectra, if \fIspecnum\fR is "1-48", and \fItempnum\fR is "2-49", spectrum order 1 is correlated against template order 2, 2 against 3, and so forth. .le .ls tempband = 1 Template band if template is multispec file .le .ls tempdir = "" Directory for template spectra .le .ls echelle = no If yes, the spectrum and the template are assumed to be multispec files containing multiple orders. The range of spectrum numbers (which may not have the same numbers as the echelle orders) defined by \fIspecnum\fR is used for the template rather than the range defined in \fItempnum\fR. .le .ls st_lambda = INDEF Starting wavelength in angstroms of portion of spectrum to correlate. If INDEF, use beginning of wavelength overlap between template and spectrum. If correlate="pixel", this is the first pixel of both the spectrum and the template to include in the correlation. .le .ls end_lambda = INDEF Ending wavelength in angstroms of portion of spectrum to correlate. If INDEF, use end of wavelength overlap between template and spectrum. If correlate="pixel", this is the last pixel of both the spectrum and the template to include in the correlation. .le .ls obj_plot = yes If yes, a plot of the object spectrum is displayed. During this time the normal IRAF cursor commands are active as well as several more that are itemized below.A If emission lines are chopped, before and after plots are displayed, as well as the chopped line(s). .le .ls xcor_plot = yes If yes, a plot of the filtered cross-correlation function is displayed. Cursor commands are activated, and a peak other than the maximum can be chosen to be the center with the keystroke \fIp\fR. Hard copies to stdplot may also be made using the \fI@\fR command. .le .ls xcor_file = yes If yes, files are written containing the filtered cross-correlation function for each object/template pair. The name of each file is \fIobject\fR.\fItemplate\fR, and there is one line of header containing the object and template names and the Julian date of the observation. The correlation is listed in ASCII format over the range specified by the \fIcvel\fR and \fIdvel\fR parameters as \fIvelocity correlation\fR pairs. .le .ls fixbad = no If yes, replace portions of spectrum given in file \fIbadlines\fR with a straight line linking the adjacent points. This feature can be used to eliminate emission and absorption features caused by poor removal of night sky emission lines. (added in version 2.0) .le .ls badlines = "badlines.dat" File containing list of limits for bad pixels to be interpolated across before processing a spectrum. Each line of the file contains the starting and stopping wavelengths in Angstroms and a line identification string. If the line ID starts with "pix", the limits are assumed to be stated as pixels rather than wavelength. This file is assumed to be in the directory \fIlinedir\fR unless a complete pathname starting with "/" is specified.(added in version 2.0) .le .ls s_emchop = "no" Chop out emission lines from object spectrum before cross-correlating with template if "yes". If "tempfile", emission lines are removed if the value of the CHOPEM keyword in the template image header is T. If the keyword is not present or is F, emission lines are not removed. If "specfile", emission lines are removed if the value of the CHOPEM keyword in the object spectrum image header is T. If the keyword is not present or is F, emission lines are not removed. If "no", emission lines are never removed. If EMCHOP in the object spectrum file is 1, emission lines are never removed. .le .ls t_emchop = "no" Chop out emission lines from template spectrum before cross-correlating with object if "yes". If "tempfile", emission lines are removed if the value of the CHOPEM keyword in the template image header is T. If the keyword is not present or is F, emission lines are not removed. If "specfile", emission lines are removed if the value of the CHOPEM keyword in the object spectrum image header is T. If the keyword is not present or is F, emission lines are not removed. If "no", emission lines are never removed. If EMCHOP in the template spectrum file is 1, emission lines are never removed. .le .ls s_abs_reject 100. Spectrum absorption line rejection in sigma of fit (0=no rejection) .le .ls s_em_reject 2. Spectrum emission line rejection in sigma of fit (0=no rejection) .le .ls t_abs_reject 0. Template absorption line rejection in sigma of fit (0=no rejection) .le .ls t_em_reject 0. Template emission line rejection in sigma of fit (0=no rejection) .le .ls bell_window = 0.05 A fraction bell_window of the ends of the object and template spectrum are multiplied by a cosine bell. This is to reduce high wave number Fourier components that would be produced by abrupt cutoffs at the ends of the spectra. .le .ls renormalize = no If yes, the data spectrum is divided by its mean value before being transformed. The minimum value (divided by the mean first) is then subtracted, and the whole thing is multiplied by an arbitrary factor of 1000.0 to put it within normal count levels. This is used on spectra which may have unusual values if they have already been flux-calibrated. .le .ls ncols = 2048 Number of columns into which to rebin data before transforming. It must be a power of two, usually the next higher than the number of pixels in the spectrum, but for some spectra with sharp emission lines, such as ThAr echelle calibration spectra, bigger is better, and numbers as large as 65536 work pretty well, though larger ncols take significantly more time. .le .ls interp_mode = "spline3" Interpolation mode to use when rebinning spectra, must be "linear" or "spline3" or "poly3" or "poly5" or "sums". The first four fit the spectrum and interpolate values; "sums" redistributes flux without fitting and is best if your spectrum is under-resolved. .le .ls zero_pad = no If yes, pad Fourier transforms of both object and template spectra with an equal amount of zeroes to avoid wrap-around correlations. It also adds the zeroes onto both object and template vectors if this is "tempfile" and the template file has ZEROPAD=YES in its header. This usually gives better results, especially for emission line spectra, but the option of turning it off has been kept to allow comparison of results with older versions of XCSAO. *If zero_pad=yes, low_bin (if not =1), top_low (if not =1), top_nrun, and nrun are doubled inside the program. (as of RVSAO 2.6.5) .le .ls low_bin = 5, top_low = 10, top_nrun = 80, nrun = 140 The Fourier amplitudes are multiplied by a cosine-bell filter function, starting at \fIlow_bin\fR and running to \fInrun\fR. Values chosen for low_bin and nrun are not critical. Generally low_bin should be about 5 to 10 for a 1024 point spectrum of 2-4 pixel resolution. Set nrun based upon the number of points in your spectrum and the resolution. For a spectrum of NPTS pixels and resolution FWHM, nrun ~ NPTS / (2*PI * FWHM/2.355). See Tonry and Davis 1979, A.J., 84, 1511. To avoid filtering emission line spectra, it is a good idea to set nrun and topnrun to ncols .le .ls vel_init = zero Make an inital velocity guess. It is used to shift the template in wavelength to give a better overlap region.The options are: "zero" to use no initial velocity, "guess" to use \fIczguess\fR, "correlation" to use the correlation velocity in the spectrum header parameter CZXC, "emission" to use the emission line velocity in the spectrum header parameter CZEM, and "combination" to use the velocity in the spectrum header parameter VELOCITY. .le .ls czguess = 0 Velocity in km/sec used as an initial guess if \fIczinit\fR is yes. .le .ls nzpass = 0 Number of iterations shifting the template to match features with the spectrum. Zero and one both give one pass through. .le .ls tshift = 0. Night to night velocity zero point shift. If this is zero, each template spectrum header is checked for a TSHIFT parameter, and that is used if present. .le .ls svel_corr = "file" Spectrum velocity correction to the solar system barycenter. Set to "none" if spectrum has already been shifted or if this correction is unnecessary. If "file", \fIBCV\fR is used if present in the file header, or else \fIHCV\fR. If "hfile", the header parameter \fIHCV\fR is always used. If neither is found, no correction is made. If "heliocentric" or "barycentric" corrections are chosen, position and time parameters are read from the spectrum data file header. \fIDATE-OBS\fR (date in format 'dd-mm-yy') \fIUT\fR (U.T. at end of exposure as 'hh:mm:ss') and \fIUTOPEN\fR (U.T. at start of exposure as 'hh:mm:ss') or /fIEXPTIME/fR/\fIEXPOSURE\fR (length of exposure in seconds) are used to compute the midtime of the exposure. \fIRA\fR (right ascension as 'hh:mm:ss.ss'), \fIDEC\fR (declination as 'dd:mm:ss.ss'), and \fIEPOCH\fR (epoch of coordinates defaults to 1950.0) give the position of the object whose spectrum this is. \fISITELONG\fR (observatory longitude as 'dd:mm:ss.ss' or degrees), \fISITELAT\fR (observatory latitude as 'dd:mm:ss.ss' or degrees), and \fISITEELEV\fR (observatory altitude in meters) give the observatory position. .le .ls tvel_corr = "file" Template velocity correction. Set to "none" if template is already corrected to "heliocentric", else "heliocentric", "barycentric", or "file". If "file", BCV is used if present in header, else HCV. VELOCITY in the template file header is assumed to be the barycentric corrected velocity. If the spectrum is unshifted, this correction must be made; if the spectrum has been shifted, this should be "none" and the BCV parameter in the template header should be 0. If "barycentric" or "heliocentric", the same parameters as above must be present in the template file header. .le .ls pkmode = 1 Flag for peak fitting: 1=parabola, 2=quartic, 3=cos/(1+x^2) .le .ls pkfrac = 0.5 Fraction of peak or number of points for peak fitting. If \fIpkfrac\fR is negated, the points used in the fit will be marked. (option added in 1.8) .le .ls pksrch = 25 When a correlation peak is manually selected, the position used as the peak is the maximum correlation value within this many bins of the cursor-selected bin. .le .ls minvel = -1000. Minimum allowable correlation peak velocity shift in km/sec. .le .ls maxvel = 100000. Maximum allowable correlation peak velocity shift in km/sec. .le .ls report_mode = 1 Mode in which results of fit are reported. .ls =1 commented text .le .ls =2 one line per spectrum-template combination. Includes filenames, R, velocity and error in km/sec, and height and width of correlation peak. .le .ls =3 one line per spectrum giving best fit and previous results Previous results are read from the image header and written alternately with new results: file, old R, new R, old velocity, new velocity, old error, new error, Julian date of observation, and name of best template. .le .ls =4 one line per spectrum-template combination. Includes filenames, R value, velocity, and error. .le .ls =5 one long line per spectrum-template combination. Includes 4 filter parameters, template file name, tshift from template header, spectrum filename, velocity, R value, peak height and width, and heliocentric velocity correction. .le .ls =6 One long line per spectrum-template combination, including spectrum and template names, Julian date, velocity, error, R-value, correlation peak height and width, and velocity correction to solar system barycenter .le .ls =7 one long line per spectrum-template combination, including per template results from current correlation and from previous correlation as saved in the spectrum header. Includes filename, old and new R-vaule, old and new velocity, old and new error, old and new peak height, old and new ARMS, Julian date of observation, and old and new template names. .le .ls =8 one long line per spectrum combination, including spectrum filename, instrument code, object name, Julian date of observation, emission line velocity and error, correlation velocity, error, and R-value, number of emission lines found and fit, and the name of the template giving the highest R-value. .le .ls =9 one long line per spectrum-template combination, including observatory code, spectrum filename, template filename, Julian date of observation, velocity, error, and R-value, correlation peak height and width, barycentric velocity correction. The sigma of the spectrum transform, sigma of the template transform, and name of the file containing the correlation vector for this spectrum-template combination are added to the end of the line if such a file is written. .le .ls =10 one long line per spectrum, including spectrum filename, Julian date of observation, number of best template in list, name of best template, velocity, error, and R-value for best, and each template. .ls =11 one long line per spectrum, including spectrum filename, Julian date of observation, number of best template in list, filename, velocity, error, and R-value for best template, filename, velocity, error, and R-value for each template. .le .ls =12 one long line per spectrum, including spectrum filename, Julian date of observation, number of best template in list, and filename, velocity, error, and R-value for each template. .le .ls =13 one long line per spectrum-template combination, including observatory code, spectrum filename, template filename, Julian date of observation, velocity (from the searched, not fit, peak), peak height and width, barycentric velocity correction. The sigma of the spectrum transform, sigma of the template transform, and name of the file containing the correlation vector for this spectrum-template combination are added to the end of the line if such a file is written. .le .ls =14 one long line per spectrum, including spectrum filename, Julian date of observation, emission line velocity, error, number of lines found, and number of lines fit, number and name of best template in list, and filename, velocity, error, and R-value for each template. (mode added in version 2.0) .le .ls =15 one long line per spectrum-template combination, including spectrum and template names, Julian date, velocity, error, R-value, correlation peak height and width, and velocity correction to solar system barycenter. It is like mode 6, but with 2 more template name characters and velocities to m/sec. (mode added in version 2.0.1) .le .ls =16 one line per spectrum-template combination, including spectrum and template names (24 and 16 characters, respectively), R-value, radial velocity and error in km/sec, height of correlation peak, template wavelength limits, and center wavelength of correlated template spectrum. This is used with wide synthetic templates of which only portions are used. .le .ls =17 one line per spectrum-template combination for Hectochelle, including aperture, fiber, beam, 24-character spectrum name, last 24 characters of template name, heliocentric Julian Day, radial velocity, velocity error, R-value, correlation peak height and width, and barycentric velocity correction. .le .ls logfiles = "STDOUT,xcsao.log" All results from XCOR are recorded in these files. .le .ls save_vel = no If yes, save emission line velocity and error in IRAF image header as CZXC and CZXCERR, and R-value as CZXCR (or APVELn and APVXCn if a multispec file). .le .ls rvcheck = no Enable header update if not correlate=no (yes or no) .le .ls archive = no If yes, save emission line results in SAO TDC archive records in the current directory. .le .ls nsmooth = 0 If >0, the data spectrum is smoothed \fIsmooth\fR times for the final one-page display. The spectrum is NEVER smoothed for the correlation. .le .ls cvel = INDEF Center velocity of the summary velocity correlation graph in km/sec. This defaults to the velocity from the cross-correlation with the highest R value. .le .ls dvel = INDEF Velocity half-width of the summary velocity correlation graph in km/sec. This defaults to 20 times the width of the peak of the cross-correlation with the highest R value. .le .ls ablines = "ablines.dat" Name of file containing an absorption line list. It is used if the "l" cursor option is selected to label absorption lines. Each line has .br Center wavelength of line in angstroms .br Name of line (terminated by end of line or space) .le .ls emlines = "emlines.dat" Name of file containing an absorption line list. It is used if the "l" cursor option is selected and the "e" cursor command is used to identify an emission line in the spectrum. If the filename is preceded by a "+", emission lines are always labelled. Each line contains: .br Center wavelength of line in angstroms .br Starting wavelength in angstroms for continuum for this line .br Ending wavelength in angstroms for continuum for this line .br Half-width in angstroms for region to fit for this line .br Name of line (terminated by end of line or space) .le .ls linedir = rvsao$lib/ Directory for emission and absorption information files. If the name of one of the individual files containis "/" or "$", it is assumed to be a full path name, and \fIlinedir\fR is not used. .le .ls dispmode = 1 Display modes .ls =1 Display spectrum and cross-correlation with template information. .le .ls =-1 Display spectrum, plotted from 0, and cross-correlation with template information. .le .ls =2 Display spectrum with absorption and known emission lines labelled and tables of template and emission line information. .le .ls =3 Display spectrum with absorption and known emission lines labelled using the entire display without the table of results .le .ls =4 Display continuum-subtracted spectrum with absorption and known emission lines labelled and tables of template and emission line information. .le .ls =5 Display continuum-subtracted spectrum with absorption and known emission lines labelled using the entire display without the table of results. .le .le .ls displot = yes Display graphic summary of results on an interactive display \fIdevice\fR. .le .ls device = "stdgraph" Interactive device on which to display a graphic summary of XCSAO's results. .le .ls curmode = no If yes, wait in cursor mode after each spectrum is processed. Cursor mode commands may be listed by typing "?" or space. .le .ls hardcopy = yes Display graphic summary of results on \fIplotter\fR. .le .ls plotter = "stdplot" Second, non-interactive device on which to plot the graphic summary of results. .le .ls temp_plot = no Plot the template spectra .le .ls contsub_plot = yes If yes, plots of the continuum-subtracted object and template spectra are displayed. This is most useful for determining the appropriateness of the order of the polynomial chosen to fit the continuum. .le .ls apodize_plot = yes If yes, plots of the windowed object and template spectra are displayed. This is most useful for determining the size of the cosine bell window applied to either end of the spectrum. .le .ls fft_plot = yes If yes, the power spectrum of the transformed object data is displayed. This is useful for setting the low order cutoff for the fits and for seeing if any periodic noise is present in the data. .ls uxcor_plot = yes If yes, the unfiltered cross-correlation data is plotted. .le .ls phase_plot = yes If yes, the phase of the cross-correlation function is plotted. .le .ls debug = no If yes, values of the parameters fit to the selected peak are recorded in the log files. This is most useful for debugging. .le .ls nsum = 1 Number of pixels to sum across dispersion. .le .ls cursor = "" Graphics cursor input. When null the standard cursor is used otherwise the specified file is used. .le .ih DESCRIPTION XCSAO provides an interactive facility to determine redshifts and velocity dispersions using the Cross-correlation Technique (e.g., Tonry and Davis 1979, A.J., 84, 1511). In brief, the cross-correlation technique assumes that a galaxy spectrum is simply the convolution of a stellar spectrum with a Gaussian which describes the line of sight velocity dispersion of the galaxy's constituent stars. Cross-correlating a template spectrum with the galaxy spectrum then produces a function with a peak at the redshift of the galaxy with a width related to the dispersion of the galaxy. Peaks in the cross-correlation function are identified and fit by parabolas to obtain their position and width and hence the redshift and velocity dispersion of the galaxy. The templates are read separately for each object. The wavelength scale may be linear or logarithmic; if it is linear, the data will be rebinned to a logarythmic scale. It is specified in the header by the starting log or linear wavelength (W0, CRVAL1, or APNUMn) and the delta log or linear wavelength per pixel (WPC, CDELT1 or APNUMn). The dispersion must run along axis 1 of the image. The templates should have the keyword VELOCITY or APVELn in their headers. This specifies the CORRECTED velocity (km/sec, + => receding) for the observation. The \fItvel_corr\fR parameter tells whether and how this heliocentric velocity was corrected from an observed velocity. If VELOCITY is not found, it is assumed to be zero. If the templates have a TSHIFT parameter and \fItshift\fR is zero, that velocity is added to the template velocity. The objects are read one at a time. Each object-template combination is rebinned in log-lambda to the designated (power of two) number of points over the overlapping wavelength region. Continua are fit to these rebinned log-wavelength spectra using the IRAF interactive curve fitting software, with optional emission line removal. Parameters for these continuum fits are set using the \fIcontpars\fR pset. Acceptance limits in sigma can be set for both absorption and emission features for the continuum fit and point removal for both object and template spectra. The spectra are then optionally renormalized to the average value of the spectrum. The ends of the spectra are windowed by a cosine bell to suppress high frequency noise. The object and template are filtered in Fourier space and multiplied together to form the transform of the cross-correlation function. This is transformed back into real space. The largest peak is found and fit by a parabola, quartic, or function of the form cos(x)/(1+x^2). The fitted parameters are saved, and a summary output is produced for each object. In this summary, the redshift is corrected for the velocity of the template star. The redshift is given as cz in km/sec. The quoted errors are one sigma on each parameter. .ih CURSOR The following keystrokes are active for intermediate spectrum and cross-correlation plots in addition to the normal IRAF cursor facilities (a list of those is available with the command ":.help"): .ls @ Make a hard copy on the device designated by \fIplotter\fR. .le .ls d Replaces a region between the marked vertical cursors with interpolated values from the edges of the marked region. This is typically used to eliminate poorly subtracted night sky lines or emission lines. .le .ls n Smooth spectrum n times before plotting. This only affects the current spectrum display and the final spectrum graph, not the spectrum data. .le .ls p Forces the current vertical cursor location to be chosen as the peak in the cross-correlation function which is used to obtain the redshift and dispersion. The maximum within 25 pixels of the cursor is actually used. .le .ls q Quit and exit. .le .ls r Forces a replot of the current spectrum at the original scale. .le .ls u Redisplay the entire plot after zooming. .le .ls z Zoom in on the region marked by two successive 's .le The following keystrokes are active for the final plot in addition to the normal IRAF cursor facilities (list available with the command ":.help"): .ls c Reset correlation peak fitting function and fraction to fit. (1.7) .le .ls f Change transform filter parameters. (1.7) .le .ls g Smooth spectrum n times before plotting. This only affects the current spectrum display and the final spectrum graph, not the spectrum data. (1.8) .le .ls j Set quality flag to conditional (1.8) .le .ls l Plot spectrum with absorption lines labelled. Label emission lines if the R-value for an emission line template (emission lines not chopped) is > 5 or if they have already been fit by EMSAO. (\fIdispmode\fR=2) .le .ls n Set quality flag to unacceptable. (1.8) .le .ls p Rerun cross-correlation, stopping in the filtered cross-correlation plot to select a peak other than the highest one. .ls u Unzoom the spectrum graph if using display mode 2 (1.8) .le .le .ls v Change the velocity limits within which a correlation peak is allowed. (1.7) .le .ls x Plot the spectrum, without line labels, and the cross-correlation on the same page. (\fIdispmode\fR=1) .le .ls y Set quality flag in header to yes. (1.8) .le .ls z Zoom in on the spectrum graph between two cursor clicks if using display mode 2. (1.8) .le .ih EXAMPLES To obtain the redshift and dispersion of a single galaxy rvsao> xcsao galaxy templates=template To obtain redshifts for a whole night's worth of galaxy spectra using 5 different templates: rvsao> xcsao @nite1.ls templates=@temp.ls where the file temp.ls contains the names of the 5 template images and the file nite1.ls contains the name of the galaxy images. .ih SEE ALSO rvsao.contpars which sets the continuum fit parameters On-line help is available on the World Wide Web at http://tdc-www.harvard.edu/iraf/rvsao/xcsao .endhelp rvsao-2.8.3/Doc/contsum.hlp0000644000016200001660000000255611164516605014641 0ustar minkoirsys.help contsum Mar2009 rvsao .ih NAME contsum -- Parameter set for continuum and line removal in SUMSPEC .ih USAGE contsum .ih PARAMETERS .ls c_interactive no Fit continuum interactively (yes or no). If yes, a graph of the spectrum and the continuum fit is plotted to stdgraph, with rejected points flagged. "q" accepts the fit and continues the main task, "?" prints options, "d" deletes points, "u" undeletes points, "f" refits and redraws the data. .le .ls c_sample "*" Sample of points to use in fit. "*" = all. .le .ls c_function spline3 Continuum fitting function (spline3 or legendre or chebyshev or spline1) .le .ls naverage 1 Number of points in sample averaging .le .ls order 1 Order of fitting function .le .ls s_low_reject 2. Spectrum continuum fit minimum acceptance limit in sigma of fit .le .ls s_high_reject 2. Spectrum continuum fit maximum acceptance limit in sigma of fit .le .ls t_low_reject 2. Template continuum fit minimum acceptance limit in sigma of fit .le .ls t_high_reject 2. Template continuum fit maximum acceptance limit in sigma of fit .le .ls niterate 10 Number of rejection iterations .le .ls grow 1. Rejection growing radius .le .ih DESCRIPTION \fIcontsum\fR sets the parameters to be used to fit the continuum of spectra on which SUMSPEC is being run. .ih EXAMPLE To set continuum fit parameters, rvsao> contsum .ih SEE ALSO sumspec .endhelp rvsao-2.8.3/Doc/linespec.hlp0000644000016200001660000001042306756622326014754 0ustar minkoirsys.help linespec Aug99 rvsao .ih NAME linespec -- Make a spectrum from a list of emission and/or absorption lines .ih USAGE linespec linefile specfile .ih PARAMETERS .ls linefile "" Filename with list of emission or absorption lines in the format .br Center wavelength of line in Angstroms .br Half-width of line: in Angstroms if positive, .br in km/sec if negative .br Height of line in counts (this is arbitrary) .br Name of line .le .ls linedir "" Directory for line list (null string means current directory) .le .ls linewidth 2.0 Half-width at half-max of Gaussian emission lines in Angstroms This instrumental function is convolved with the spectrum from linefile. .le .ls maxwidth no Use maximum of line or instrument width (yes) or convolve instrument with spectrum (no). .le .ls zspec 0 Delta lambda / lambda to which to shift individual spectral lines. This is useful for making spectra for very distant objects and supercedes velspec if it is not zero. .ls velspec 0 If this is not zero, shift the wavelengths of all specified lines to this velocity. .le .ls continuum 0 Continuum level for output spectrum. This is useful if software to be used on the created spectrum has problems with a continuum of zero or absorption lines with negative nadirs. .le .ls specobj = "" Title for output spectrum .le .ls specfile = "" File name for output spectrum .le .ls specdir = "" Directory for output spectrum (null string means current directory) .le .ls st_lambda = INDEF Starting wavelength in angstroms for output file .le .ls end_lambda = INDEF Ending wavelength in angstroms for output file .le .ls pix_lambda 0.25, Wavelength per pixel in Angstroms .le .ls spec_plot = yes If yes, a plot of the output spectrum is displayed. Cursor commands are activated for zooming in on a portion of the spectrum and hard copies may be made to stdplot using the \fI@\fR command. If maxwidth is no, the spectrum is displayed both before and after it is convolved with the instrumental Gaussian. .le .ls spec_int no If yes, interact with the graph of the output spectrum .le .ls device = "stdgraph" Interactive device on which to display a graphic summary of XCSAO's results. .le .ls plotter = "stdplot" Second, non-interactive device on which to plot the graphic summary of results. .le .ls verbose yes Print summary to log file (yes or not). .le .ls logfiles = "STDOUT,linespec.log" All results from LINTEMP are recorded in these files. .le .ls debug = no If yes, values of the parameters fit to the selected peak are recorded in the log files. This is most useful for debugging. .le .ls cursor = "" Graphics cursor input. When null the standard cursor is used otherwise the specified file is used. .le .ih DESCRIPTION LINESPEC reads a list of positions of emission and/or absorptions lines and creates a spectrum with Gaussian lines of the the indicated half-widths at the indicated positions, writing a one-dimensional IRAF file with the appropriate keywords in the header. If velspec is nonzero, the emission lines are shifted to that redshift velocity. .ih CURSOR The following keystrokes are active for spectrum template plots in addition to the normal IRAF cursor facilities (a list of those is available with the command ":.help"): .ls @ Make a hard copy on the device designated by \fIplotter\fR. .le .ls c Prints cursor position in x and y. This is the default. All other undefined keys perform this same function. .le .ls d Replaces a region between the marked vertical cursors with interpolated values from the edges of the marked region. This is can be used to eliminate lines from a template without changing the line list, though the line will still appear in the image header. .le .ls n Smooth spectrum n times before plotting. This affects the actual spectrum, so it is usually not a good idea to exit from a plot with this set to any value other than 0. .le .ls q Quit and exit. .le .ls r Forces a replot of the current spectrum at the original scale. .le .ls u Redisplay the entire plot after zooming. .le .ls z Zoom in on the region marked by two successive 's .le .ih EXAMPLE To make a emission line template from a list of commonly observed emission lines: cl> linespec emtemp.dat emtemp .ih SEE ALSO On-line help is available over the World Wide Web at http://tdc-www.harvard.edu/iraf/rvsao/linespec .endhelp rvsao-2.8.3/Doc/bcvcorr.ps0000644000016200001660000003142606457477710014462 0ustar minkoirsys%!PS-Adobe-3.0 %%Creator: groff version 1.09 %%CreationDate: Thu Jan 15 16:29:44 1998 %%DocumentNeededResources: font Times-Bold %%+ font Times-Roman %%+ font Times-Italic %%DocumentSuppliedResources: procset grops 1.09 0 %%Pages: 9 %%PageOrder: Ascend %%Orientation: Portrait %%EndComments %%BeginProlog %%BeginResource: procset grops 1.09 0 /setpacking where{ pop currentpacking true setpacking }if /grops 120 dict dup begin /SC 32 def /A/show load def /B{0 SC 3 -1 roll widthshow}bind def /C{0 exch ashow}bind def /D{0 exch 0 SC 5 2 roll awidthshow}bind def /E{0 rmoveto show}bind def /F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def /G{0 rmoveto 0 exch ashow}bind def /H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /I{0 exch rmoveto show}bind def /J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def /K{0 exch rmoveto 0 exch ashow}bind def /L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /M{rmoveto show}bind def /N{rmoveto 0 SC 3 -1 roll widthshow}bind def /O{rmoveto 0 exch ashow}bind def /P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /Q{moveto show}bind def /R{moveto 0 SC 3 -1 roll widthshow}bind def /S{moveto 0 exch ashow}bind def /T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def /SF{ findfont exch [exch dup 0 exch 0 exch neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /MF{ findfont [5 2 roll 0 3 1 roll neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /level0 0 def /RES 0 def /PL 0 def /LS 0 def /PLG{ gsave newpath clippath pathbbox grestore exch pop add exch pop }bind def /BP{ /level0 save def 1 setlinecap 1 setlinejoin 72 RES div dup scale LS{ 90 rotate }{ 0 PL translate }ifelse 1 -1 scale }bind def /EP{ level0 restore showpage }bind def /DA{ newpath arcn stroke }bind def /SN{ transform .25 sub exch .25 sub exch round .25 add exch round .25 add exch itransform }bind def /DL{ SN moveto SN lineto stroke }bind def /DC{ newpath 0 360 arc closepath }bind def /TM matrix def /DE{ TM currentmatrix pop translate scale newpath 0 0 .5 0 360 arc closepath TM setmatrix }bind def /RC/rcurveto load def /RL/rlineto load def /ST/stroke load def /MT/moveto load def /CL/closepath load def /FL{ currentgray exch setgray fill setgray }bind def /BL/fill load def /LW/setlinewidth load def /RE{ findfont dup maxlength 1 index/FontName known not{1 add}if dict begin { 1 index/FID ne{def}{ pop pop}ifelse }forall /Encoding exch def dup/FontName exch def currentdict end definefont pop }bind def /DEFS 0 def /EBEGIN{ moveto DEFS begin }bind def /EEND/end load def /CNT 0 def /level1 0 def /PBEGIN{ /level1 save def translate div 3 1 roll div exch scale neg exch neg exch translate 0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit [] 0 setdash /setstrokeadjust where{ pop false setstrokeadjust }if /setoverprint where{ pop false setoverprint }if newpath /CNT countdictstack def userdict begin /showpage{} def }bind def /PEND{ clear countdictstack CNT sub{end}repeat level1 restore }bind def end def /setpacking where{ pop setpacking }if %%EndResource %%IncludeResource: font Times-Bold %%IncludeResource: font Times-Roman %%IncludeResource: font Times-Italic grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron /scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent /ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen /period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon /semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O /P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex /underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y /z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft /guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl /endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut /dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash /quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen /brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft /logicalnot/minus/registered/macron/degree/plusminus/twosuperior /threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior /ordmasculine/guilsinglright/onequarter/onehalf/threequarters /questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE /Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex /Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis /multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn /germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla /egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis /eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash /ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def /Times-Italic@0 ENC0/Times-Italic RE/Times-Roman@0 ENC0/Times-Roman RE /Times-Bold@0 ENC0/Times-Bold RE %%EndProlog %%Page: 1 1 %%BeginPageSetup BP %%EndPageSetup /F0 9/Times-Bold@0 SF -.18(NA)72 36 S(ME).18 E/F1 10/Times-Roman@0 SF (bcv-)72 48 Q(corr)72 60 Q(--)72 72 Q(Set)72 84 Q(barycen-)72 96 Q(tric) 72 108 Q -.15(ve)72 120 S(loc-).15 E(ity)72 132 Q(cor)72 144 Q(-)-.2 E (rec-)72 156 Q(tion)72 168 Q(in)72 180 Q(a)72 192 Q(spec-)72 204 Q(trum) 72 216 Q(image)72 228 Q(header)72 240 Q F0(USA)72 264 Q(GE)-.495 E F1 (bcv-)72 276 Q(corr)72 288 Q(image)72 300 Q F0 -.666(PA)72 324 S(RAM-) .666 E(E-)72 336 Q(TERS)72 348 Q F1(#)72 360 Q(Spec-)72 372 Q(tra)72 384 Q/F2 10/Times-Bold@0 SF(tra)72 396 Q(spec-)72 504 Q F1(List)90 516 Q(of) 90 528 Q(input)90 540 Q(spec-)90 552 Q(tra)90 564 Q F2(num)72 576 Q(0) 73.666 588 Q(spec-)72 684 Q F1(Spec-)90 696 Q(trum)90 708 Q(num-)90 720 Q(ber\(s\))90 732 Q(if)90 744 Q(mul-)90 756 Q(ti-)90 768 Q(spec)90 780 Q (\214le)90 792 Q EP %%Page: 2 2 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Bold@0 SF(specdir)72 108 Q/F1 10/Times-Roman@0 SF(Direc-)90 120 Q(tory)90 132 Q(for)90 144 Q(input)90 156 Q(spec-)90 168 Q(tra)90 180 Q(#)90 192 Q(Sk)90 204 Q(y)-.15 E(direc-)90 216 Q(tion)90 228 Q F0 (RA)73.666 240 Q -.1(ke)72 336 S(yra).1 E F1(Right)90 348 Q(ascen-)90 360 Q(sion)90 372 Q(header)90 384 Q -.1(ke)90 396 S(yw)-.05 E(ord)-.1 E F0(dec)72 408 Q(DEC)73.666 420 Q -.1(ke)72 516 S(y-).1 E F1(Decli-)90 528 Q(na-)90 540 Q(tion)90 552 Q(header)90 564 Q -.1(ke)90 576 S(yw)-.05 E(ord)-.1 E F0(qnx)72 588 Q(EPOCH)73.666 600 Q -.1(ke)72 696 S -.1(ye).1 G(-).1 E F1(Coor)90 708 Q(-)-.2 E(di-)90 720 Q(nate)90 732 Q(equinox)90 744 Q(header)90 756 Q -.1(ke)90 768 S(yw)-.05 E(ord)-.1 E F0(HJD)73.666 780 Q EP %%Page: 3 3 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Bold@0 SF -.1(ke)72 84 S(yjd).1 E/F1 10/Times-Roman@0 SF (Header)90 96 Q -.1(ke)90 108 S(yw)-.05 E(ord)-.1 E(for)90 120 Q(Julian) 90 132 Q(date)90 144 Q(at)90 156 Q(mid-)90 168 Q(dle)90 180 Q(of)90 192 Q(obser)90 204 Q(-)-.2 E -.25(va)90 216 S(-).25 E(tion)90 228 Q F0(date) 72 240 Q -.35(DA)73.666 252 S(TE-)-.6 E(OBS)72 264 Q -.1(ke)72 360 S(y-) .1 E F1(Header)90 372 Q -.1(ke)90 384 S(yw)-.05 E(ord)-.1 E(for)90 396 Q (date)90 408 Q(of)90 420 Q(obser)90 432 Q(-)-.2 E -.25(va)90 444 S(-).25 E(tion)90 456 Q(\(dd/mm/yyyy\))90 468 Q F0(UT)73.666 480 Q(OPEN)-.18 E -.1(ke)72 576 S(ystart).1 E F1(Header)90 588 Q -.1(ke)90 600 S(yw)-.05 E (ord)-.1 E(for)90 612 Q(UT)90 624 Q(at)90 636 Q(start)90 648 Q(of)90 660 Q(obser)90 672 Q(-)-.2 E -.25(va)90 684 S(-).25 E(tion)90 696 Q F0 (UTMID)73.666 708 Q EP %%Page: 4 4 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Bold@0 SF -.1(ke)72 12 S(ymid).1 E/F1 10/Times-Roman@0 SF (Header)90 24 Q -.1(ke)90 36 S(yw)-.05 E(ord)-.1 E(for)90 48 Q(UT)90 60 Q(in)90 72 Q(mid-)90 84 Q(dle)90 96 Q(of)90 108 Q(obser)90 120 Q(-)-.2 E -.25(va)90 132 S(-).25 E(tion)90 144 Q F0(UT)73.666 156 Q -.1(ke)72 252 S -.1(ye).1 G(nd).1 E F1(Header)90 264 Q -.1(ke)90 276 S(yw)-.05 E(ord) -.1 E(for)90 288 Q(UT)90 300 Q(at)90 312 Q(end)90 324 Q(of)90 336 Q (obser)90 348 Q(-)-.2 E -.25(va)90 360 S(-).25 E(tion)90 372 Q F0(exp)72 384 Q(EXPO-)73.666 396 Q(SURE)72 408 Q -.1(ke)72 504 S(y-).1 E F1 (Header)90 516 Q -.1(ke)90 528 S(yw)-.05 E(ord)-.1 E(for)90 540 Q(dura-) 90 552 Q(tion)90 564 Q(of)90 576 Q(obser)90 588 Q(-)-.2 E -.25(va)90 600 S(-).25 E(tion)90 612 Q(in)90 624 Q(sec-)90 636 Q(onds)90 648 Q F0 (\214le)73.666 672 Q(obsname)72 768 Q F1(Obser)90 780 Q(-)-.2 E -.25(va) 90 792 S(-).25 E EP %%Page: 5 5 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(tory)90 12 Q(name.)90 24 Q(If)90 36 Q(\214le)90 48 Q(to)90 60 Q(read)90 72 Q(from)90 84 Q(image)90 96 Q(header)90 108 Q /F1 10/Times-Bold@0 SF(obs)72 120 Q(SITE-)73.666 132 Q -.2(NA)72 144 S (ME).2 E -.1(ke)72 240 S(y-).1 E F0(Obser)90 252 Q(-)-.2 E -.25(va)90 264 S(-).25 E(tory)90 276 Q(name)90 288 Q(header)90 300 Q -.1(ke)90 312 S(yw)-.05 E(ord)-.1 E F1(lat)72 324 Q(SITE-)73.666 336 Q(LA)72 348 Q(T) -.95 E -.1(ke)72 444 S(y-).1 E F0(Obser)90 456 Q(-)-.2 E -.25(va)90 468 S(-).25 E(tory)90 480 Q(lat-)90 492 Q(i-)90 504 Q(tude)90 516 Q(header) 90 528 Q -.1(ke)90 540 S(yw)-.05 E(ord)-.1 E F1(long)72 552 Q(SITE-) 73.666 564 Q(LONG)72 576 Q -.1(ke)72 672 S(y-).1 E F0(Obser)90 684 Q(-) -.2 E -.25(va)90 696 S(-).25 E(tory)90 708 Q(lon-)90 720 Q(gi-)90 732 Q (tude)90 744 Q(header)90 756 Q -.1(ke)90 768 S(yw)-.05 E(ord)-.1 E F1 (SITEAL)73.666 780 Q(T)-.92 E EP %%Page: 6 6 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Bold@0 SF -.1(ke)72 84 S(yalt).1 E/F1 10/Times-Roman@0 SF (Obser)90 96 Q(-)-.2 E -.25(va)90 108 S(-).25 E(tory)90 120 Q(alti-)90 132 Q(tude)90 144 Q(header)90 156 Q -.1(ke)90 168 S(yw)-.05 E(ord)-.1 E F0(long)72 180 Q(0.0)73.666 192 Q(obs-)72 288 Q F1(Obser)90 300 Q(-)-.2 E -.25(va)90 312 S(-).25 E(tory)90 324 Q(lon-)90 336 Q(gi-)90 348 Q (tude,)90 360 Q(used)90 372 Q(if)90 384 Q(obsname)90 396 Q(is)90 408 Q (not)90 420 Q("\214le")90 432 Q F0(lat)72 444 Q(0.0)73.666 456 Q(obs-)72 552 Q F1(Obser)90 564 Q(-)-.2 E -.25(va)90 576 S(-).25 E(tory)90 588 Q (lat-)90 600 Q(i-)90 612 Q(tude,)90 624 Q(used)90 636 Q(if)90 648 Q (obsname)90 660 Q(is)90 672 Q(not)90 684 Q("\214le")90 696 Q F0(0.0) 73.666 708 Q EP %%Page: 7 7 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Bold@0 SF(obsalt)72 12 Q/F1 10/Times-Roman@0 SF(Obser)90 24 Q(-)-.2 E -.25(va)90 36 S(-).25 E(tory)90 48 Q(alti-)90 60 Q(tude)90 72 Q(in)90 84 Q(meters,)90 96 Q(used)90 108 Q(if)90 120 Q(obsname)90 132 Q (is)90 144 Q(not)90 156 Q("\214le")90 168 Q F0(no)73.666 192 Q(sa)72 288 Q -.1(ve)-.25 G(bcv).1 E F1(Sa)90 300 Q -.15(ve)-.2 G(barycen-)90 312 Q (tric)90 324 Q -.15(ve)90 336 S(loc-).15 E(ity)90 348 Q(cor)90 360 Q(-) -.2 E(rec-)90 372 Q(tion)90 384 Q(as)90 396 Q(BCV)90 408 Q(and)90 420 Q (Helio-)90 432 Q(cen-)90 444 Q(tric)90 456 Q(Julian)90 468 Q(Date)90 480 Q(as)90 492 Q(HJD)90 504 Q(in)90 516 Q(IRAF)90 528 Q(data)90 540 Q (\214le)90 552 Q(header)90 564 Q(\(yes)90 576 Q(or)90 588 Q(no\))90 600 Q F0(bose)72 612 Q -.1(ye)73.666 624 S(s).1 E -.1(ve)72 720 S -.37(r-).1 G F1(Dis-)90 732 Q(plays)90 744 Q(helio-)90 756 Q(cen-)90 768 Q(tric)90 780 Q(and)90 792 Q EP %%Page: 8 8 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(barycen-)90 12 Q(tric)90 24 Q(cor)90 36 Q(-)-.2 E(rec-)90 48 Q(tions)90 60 Q/F1 10/Times-Bold@0 SF(no)73.666 72 Q(deb)72 168 Q(ug)-.2 E F0(Dis-)90 180 Q(plays)90 192 Q(inter)90 204 Q(-)-.2 E (me-)90 216 Q(di-)90 228 Q(ate)90 240 Q(results)90 252 Q/F2 9 /Times-Bold@0 SF(DESCRIP-)72 288 Q(TION)72 300 Q/F3 10/Times-Italic@0 SF (bcv-)72 312 Q(corr)72 324 Q F0(can)72 336 Q(be)72 348 Q(used)72 360 Q (to)72 372 Q(set)72 384 Q(the)72 396 Q(barycen-)72 408 Q(tric)72 420 Q -.15(ve)72 432 S(loc-).15 E(ity)72 444 Q(cor)72 456 Q(-)-.2 E(rec-)72 468 Q(tion)72 480 Q(of)72 492 Q(spec-)72 504 Q(tra)72 516 Q(which)72 528 Q(do)72 540 Q(not)72 552 Q(use)72 564 Q(the)72 576 Q(header)72 588 Q -.1 (ke)72 600 S(yw)-.05 E(ords)-.1 E -.15(ex)72 612 S(pected).15 E(by)72 624 Q(the)72 636 Q(cor)72 648 Q(-)-.2 E(rec-)72 660 Q(tion)72 672 Q (com-)72 684 Q(pu-)72 696 Q(ta-)72 708 Q(tion)72 720 Q(sub-)72 732 Q (rou-)72 744 Q(tine)72 756 Q(in)72 768 Q(XCSA)72 780 Q(O,)-.55 E(EMSA)72 792 Q(O,)-.55 E EP %%Page: 9 9 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF(or)72 12 Q(SUM-)72 24 Q(SPEC.)72 36 Q/F1 9 /Times-Bold@0 SF(EXAM-)72 72 Q(PLE)72 84 Q F0 -.8(To)72 96 S(set)72 108 Q(a)72 120 Q(spec-)72 132 Q(trum')72 144 Q(s)-.55 E(barycen-)72 156 Q (tric)72 168 Q -.15(ve)72 180 S(loc-).15 E(ity)72 192 Q(cor)72 204 Q(-) -.2 E(rec-)72 216 Q(tion:)72 228 Q(rv>)108 252 Q(bcv-)72 264 Q(corr)72 276 Q(spec-)72 288 Q(trum)72 300 Q F1(SEE)72 336 Q(ALSO)72 348 Q F0(On-) 72 360 Q(line)72 372 Q(help)72 384 Q(is)72 396 Q -.2(av)72 408 S(ail-) -.05 E(able)72 420 Q(on)72 432 Q(the)72 444 Q -.8(Wo)72 456 S(rld).8 E -.4(Wi)72 468 S(de).4 E -.8(We)72 480 S(b).8 E(at)72 492 Q(http://tdc-) 72 504 Q(www)72 516 Q(.harv)-.65 E(ard.edu/iraf/rvsao/bcvcorr)-.25 E EP %%Trailer end %%EOF rvsao-2.8.3/Doc/pix2wl.hlp0000644000016200001660000000516211050371034014357 0ustar minkoirsys.help pix2wl Aug2008 rvsao .ih NAME pix2wl -- Compute the wavelength at a given pixel in a spectrum .ih USAGE .nf pix2wl spectrum pixel .fi .ih PARAMETERS .ls spectrum Spectrum image file with dispersion function .le .ls specext = 0 Spectrum extension number in multiextension FITS image .le .ls specnum 0 Spectrum number in multispec image (order in echelle image) .le .ls specband 0 Spectrum band in multispec image .le .ls pixel INDEF Pixel at specified wavelength (returned) .le .ls wavelength INDEF Wavelength in Angstroms for pixel .le .ls pixform "%8.3f" IRAF format for pixel output .le .ls waveform "%8.3f" IRAF format for wavelength output .le .ls nsum = 1 Number of pixels to sum across dispersion .le .ls verbose no If yes, print the pixel value .le .ls debug = no If yes, print the file name, transformation, and wavelength per pixel .le .ih DESCRIPTION Compute the wavelength at a given pixel in a spectrum, saving the value as the pix2wl.wavelength parameter. If the pixel is zero, the wavelength at the start of first pixel (=0.5) is saved as pix2wl.wavelength, and the wavelength at the end of the last pixel (=npts+0.5) is saved as pix2wl.wave2. Otherwise, pix2wl.wave2=INDEF. If verbose=yes, print the wavelength of the pixel (or if the pixel is zero, the wavelengths of the first and last pixels) using the pix2wl.waveform format. If debug=yes, print spectrum image name, followed by the wavelength value using the pix2wl.waveform format, the pixel falue using the pix2wl.pixform format, and the delta wavelength per pixel across this pixel. .ih EXAMPLES 1) Compute the wavelength at a given pixel for use in a CL script: .nf rvsao> pix2wl 22572.fits 3000 rvsao> =pix2wl.wavelength 6435.7338761065 rvsao> .fi 2) Print the wavelength at a given pixel: .nf rvsao> pix2wl 22572.fits 3000 v+ 6435.734 rvsao> .fi 3) Print the wavelength at a given pixel more verbosely: .nf rvsao> pix2wl 22572.fits 3000 d+ 22572.fits: 3000 -> 6435.734 (0.5744/pix) rvsao> .fi 4) Compute the wavelength range of an image for use in a CL script: .nf rvsao> pix2wl 22572.fits 0 rvsao> =pix2wl.wavelength 4712.8929877685 rvsao> =pix2wl.wave2 7065.5371880127 rvsao> .fi 5) Print the wavelength range of an image: .nf rvsao> pix2wl 22572.fits 0 v+ 4712.893 - 7065.537 rvsao> .fi 6) Print the wavelength range of an image more verbosely: .nf rvsao> pix2wl 22572.fits 0 d+ 22572.fits: 4712.893-7065.537 (4096 pixels, 0.5742/pix) rvsao> .fi 7) Check the inverse of the dispersion function: .nf rvsao> pix2wl 22572.fits 3000 rvsao> wl2pix 22572.fits pix2wl.wavelength v+ 3000.000 rvsao> .fi .ih AUTHOR Doug Mink, Harvard-Smithsonian Center for Astrophysics .endhelp rvsao-2.8.3/Doc/contemp.hlp0000644000016200001660000000301606037225743014611 0ustar minkoirsys.help contemp Oct95 template .ih NAME contemp -- Parameter set for continuum removal .ih USAGE contemp .ih PARAMETERS .ls c_interactive no Fit continuum interactively (yes or no). If yes, a graph of the spectrum and the continuum fit is plotted to stdgraph, with rejected points flagged. "q" accepts the fit and continues the main task, "?" prints options, "d" deletes points, "u" undeletes points, "f" refits and redraws the data. .le .ls c_sample "*" Sample of points to use in fit. "*" = all. .ls c_function spline3 Continuum fitting function (spline3 or legendre or chebyshev or spline1) .ls naverage 1 Number of points in sample averaging .ls order 1 Order of fitting function .ls s_low_reject 2. Spectrum continuum fit minimum acceptance limit in sigma of fit .ls s_high_reject 2. Spectrum continuum fit maximum acceptance limit in sigma of fit .ls t_low_reject 2. Template continuum fit minimum acceptance limit in sigma of fit .ls t_high_reject 2. Template continuum fit maximum acceptance limit in sigma of fit .ls niterate 10 Number of rejection iterations .ls grow 1. Rejection growing radius .le .ih DESCRIPTION \fIcontemp\fR sets the parameters to be used to fit the continuum of spectra being summed to make a template by \fIsumtemp\fR. It can also be use to fit the continuum of the resulting template spectrum. How the continuum is removed is controlled by parameters in the \fIsumtemp\fR task. This paarameter set is basd on \fIrvsao.contpars\fR. .ih EXAMPLE To set continuum fit parameters, rv> contemp .ih .endhelp rvsao-2.8.3/Doc/eqwidth.hlp0000644000016200001660000002520511203032263014575 0ustar minkoirsys.help eqwidth July08 rvsao .ih NAME eqwidth -- bandpass spectrophotometry of spectra .ih USAGE eqwidth input output bands .ih PARAMETERS .ls input Input list of spectra to be measured. These may be one dimensional spectra in individual or "multispec" format or calibrated spatial spectra such as long slit or Fabry-Perot images. The dispersion axis and summing parameters are specified by package parameters for the spatial spectra. .le .ls output Output file for the results. This may be a filename or "STDOUT" to write to the terminal. .le .ls bands Bandpass file consisting of lines with one, two, or three bandpasses per line. A bandpass is specified by an identification string (quoted if it is null or contains whitespace), the central wavelength, the width of the bandpass in wavelength, and a filter filename with the special value "none" if there is no filter (a flat unit response). This format is described further in the description section. .le .ls banddir = "rvsao$lib/" Bandpass directory .le .ls specnum = "1" List of apertures to select from the input spectra. For one dimensional spectra this is the aperture number and for spatial spectra it is the column or line. If the null string is specified all apertures are selected. The aperture list syntax is a range list which includes intervals and steps (see \fBranges\fR). .le .ls specband = 0 Spectrum band to use if input is an IRAF multispec spectrum .le .ls skyband = 0 Spectrum band containing sky spectrum removed from object if this is and IRAF multispec spectrum. This is used to compute the error. .le .ls bandfilt = no Filter names follow wavelength limits in bandpass file if yes .le .ls bandcont = no Continuum names precede wavelength limits in bandpass file if yes .le .ls bindim = 0 Number of rows in unbinned (bin by one) spectrum. Bin by 4 if less than half this; bin by 2 if less than this; else bin by 1. .le .ls normalize = yes Normalize the bandpass fluxes by the bandpass response? If no then the results will depend on the bandpass widths and filter function values. If yes then fluxes will be comparable to an average pixel value. When computing indices and equivalent widths the flux must either be normalized or the bandpasses and filter response functions must be the same. .le .ls fitcont = no Fit continuum instead of computing at specific points (yes or no) .le .ls netflux = no Compute the net flux from the emission region instead of equivalent width by subtracting the mean continuum per pixel times the number of pixels in the region if yes. .le .ls byexp = no Convert to counts per second (exposure normalization) if yes .le .ls bypix = no Convert to counts per row (spatial normalization) if yes .le .ls torest = no Shift spectrum from observed velocity to zero velocity if yes. Set no for night sky lines. Set to yes to remove redshift from observed object spectra before computing equivalent widths .le .ls mag = no Output the bandpass fluxes as magnitudes with the magnitude zero point specified by \fImagzero\fR if yes .le .ls magzero = 0. Magnitude zero point used if \fImag\fR = yes .le .ls device = "stdgraph" Display device .le .ls plot_obj = no Plot the raw object data .le .ls int_obj = no Interact with plot of raw object data .le .ls plot_fitcont = no Plot the continuum fit to the data .le .ls plot_contsub = no Plot the continuum-subtracted data .le .ls int_contsub = no Interact with plot of continuum-subtracted data .le .ls nsmooth = 0 Number of times to 1-2-1 smooth plotted spectra .le .ls report_mode = 1 Mode for output: Each line starts with the file name, followed by this information for each line: 1: line name, line flux, continuum name, continuum flux, index, equivalent width 2: line flux, continuum flux, index, index error (line names in column heading) 3: line flux, equivalent width, equivalent width error (line names in column heading) 4: index, index error (line names in column heading) 5: equivalent width, equivalent width error (line names in column heading) .le .ls nsum = 1 Number of pixels to sum across dispersion .le .ls hardcopy = no Automatic hardcopy of results (yes or no) .le .ls plotter = "stdplot" Hardcopy output device .le .ls verbose = yes Include a verbose header giving a banner, the parameters used, the bandpasses, and column headings? .le .ls debug = no Print debugging info? .le .ls cursor = "" Graphics cursor input .le .ih DESCRIPTION \fBeqwidth\fR performs bandpass spectrophotometry with one or more bandpasses on one or more spectra. A list of input spectra is specified. The spectra may be of any type acceptible in the \fBnoao.onedspec\fR package including multispec format with nonlinear dispersion, long slit spectra, and even 3D cubes with one dispersion axis. The \fIapertures\fR parameter allows selecting a subset of the spectra by aperture number. The bandpasses are specified in a text file. A bandpass consists of four fields; an identification name, the wavelength of the bandpass center, a bandpass width, and an optional filename for a filter. The identification is a string which must be quoted if a null name or a name with whitespace is desired. The identification could be given as the central wavelength if nothing else is appropriate. The filter field is a filename for a text file containing the filter values. A filter file consists of a wavelength ordered list of wavelength and relative response. Extrapolation uses the end point values and interpolation is linear. The special name "none" is used if there is no filter, though if the parameter \fIbandfilt\fR is set to no, this column can be omitted entirely. Both of these options are equivalent to unit response at all wavelengths. In the bandpass file there may be one, two, or three bandpasses on a line. Below are some examples of the three cases: .nf alpha 5000 10 myalpha.dat beta1 4000 100 none beta2 4100 100 none line 4500 100 none red 4000 200 none blue 5000 200 none .fi The flux in each bandpass is measured by summing each pixel in the interval multiplied by the interpolated filter response at that pixel. At the edges of the bandpass the fraction of the pixel in the bandpass is used. If the bandpass goes outside the range of the data an INDEF value will be reported. If the \fInormalize\fR option is yes then the total flux is divided by the sum of the filter response values. If the \fImag\fR option is yes the flux will be converted to a magnitude (provided it is positive) using the formula .nf magnitude = magzero - 2.5 * log10 (flux) .fi where \fImagzero\fR is a parameter for the zero point magnitude and log10 is the base 10 logarithm. Note that there is no attempt to deal with the pixel flux units. This is the responsiblity of the user. If there is only one bandpass (on one line of the band file) then only the band flux or magnitude is reported. If there are two bandpasses the fluxes or magnitudes for the two bands are reported as well as a band index, the flux ratio or magnitude difference (depending on the \fImag\fR) flag, and an equivalent width using the second band as the continuum. If there are three bandpasses then a continuum bandpass flux is computed as the interpolation between the bandpass centers to the center of the first bandpass. The special bandpass identification "cont" will be reported. The equivalent width is obtained from the two bandpasses by the formala .nf eq. width = (1 - flux1 / flux2) * width1 .fi where flux1 and flux2 are the two bandpass fluxes and width1 is the width of the first bandpass. Note that for this to be meaningful the bandpasses should be normalized or have the same width/response. The results of measuring each bandpass in each spectrum are written to the specified output file. This file may be given as "STDOUT" to write the results to the terminal. The output file contains lines with the spectrum name and aperture, the band identifications and fluxes or magnitudes, and the band index and equivalent width (if appropriate). The \fIverbose\fR option allows creating a more documented output by including a commented header with the task name and parameters, the bandpass definitions, and column labels. The examples below show the form of the output. .ih EXAMPLES The following examples use artificial data and arbitrary bands. 1. Show example results with one, two, and three bandpass entries in the bandpass file. .nf cl> type bands test 6125 50 none red 6025 100 none blue 6225 100 none test 6125 50 none red 6025 100 none test 6125 50 none blue 6225 100 none test 6125 50 none cl> eqwidth oned STDOUT bands # EQWIDTH: NOAO/IRAF IRAFX valdes@puppis Mon 15:31:45 01-Nov-93 # bands = bands, norm = yes, mag = no # band filter wavelength width # test none 6125. 50. # red none 6025. 100. # blue none 6225. 100. # test none 6125. 50. # red none 6025. 100. # test none 6125. 50. # blue none 6225. 100. # test none 6125. 50. # # spectrum band flux band flux index eqwidth oned(1) test 44.33 cont 97.97 0.45 27.37 oned(1) test 44.33 red 95.89 0.46 26.89 oned(1) test 44.33 blue 100.04 0.44 27.84 oned(1) test 44.33 .fi 2. This example shows measurments on a long slit spectrum with an aperture selection and magnitude output. .nf cl> type leqwidth.dat band1 4500 40 none band2 4600 40 none band3 4700 40 none cl> nsum=5 cl> eqwidth ls STDOUT leqwidth.dat apertures=40-60x5 mag+ magzero=10.1 # EQWIDTH: NOAO/IRAF IRAFX valdes@puppis Mon 15:37:18 01-Nov-93 # bands = leqwidth.dat, norm = yes, mag = yes, magzero = 10.10 # band filter wavelength width # band1 none 4500. 40. # band2 none 4600. 40. # band3 none 4700. 40. # # spectrum band mag ls[38:42,*](40) band1 3.14 ls[38:42,*](40) band2 3.19 ls[38:42,*](40) band3 3.15 ls[43:47,*](45) band1 3.13 ls[43:47,*](45) band2 3.15 ls[43:47,*](45) band3 3.14 ls[48:52,*](50) band1 2.34 ls[48:52,*](50) band2 2.43 ls[48:52,*](50) band3 2.43 ls[53:57,*](55) band1 3.10 ls[53:57,*](55) band2 3.15 ls[53:57,*](55) band3 3.12 ls[58:62,*](60) band1 3.14 ls[58:62,*](60) band2 3.19 ls[58:62,*](60) band3 3.15 .fi .ih REVISIONS .ls EQWIDTH V2.3.0 New in this release, almost all code is from noao.onedspec.sbands .le .ih SEE ALSO splot .endhelp rvsao-2.8.3/Doc/qplotc.hlp0000644000016200001660000000612010627624535014447 0ustar minkoirsys.help qplotc May2007 rvsao .ih NAME qplotc -- Use EMSAO or XCSAO to plot emission and absorption lines already found in a spectrum file or list of spectra .ih USAGE qplotc spectra .ih PARAMETERS .ls spectra = "" List of file names of spectra to analyze. @filename indicates list should come from file filename. As of version 1.3, apertures of multispec spectrum files can be entered as numbers, lists, or ranges enclosed in brackets after each file name in the list or file. This parameter is directly passed to the task chosen below. .le .ls qtask = "xcsao" Task to run (xcsao or emsao)"} .le .ls velplot = "combination" Velocity to plot (combination or emission or correlation .le .ls dispmode = 4 Format in which to display summary page on an interactive display device and on the hard-copy device plotter. If the format code is negated, the spectrum is plotted with the intensity scaled from zero rather than the spectrum minimum. 2 or 4 are best for qplotting, although 3 and 5 will give better resolution of the spectrum. cursor zoom works in all 4 of these modes. =-1 Display all of spectrum, with portion used marked, scaled from an intensity of zero, and cross-correlation with template information. =0 Display only part of spectrum used in correlation and cross-correlation with template information. (2.0) =1 Display all of spectrum, with portion used marked, and cross-correlation with template information. =2 Display spectrum with absorption and known emission lines labelled and both template and emission line information. =3 Display spectrum with absorption and known emission lines labelled using the entire display without the table of results =4 Display continuum-subtracted spectrum with absorption and known emission lines labelled and tables of template and emission line information. =5 Display continuum-subtracted spectrum with absorption and known emission lines labelled using the entire display without the table of results. .le .ih DESCRIPTION QPLOT runs either XCSAO without correlating or EMSAO with finding new lines, then displays the spectrum with lines labelled and previously-obtained results. These results should have been written to the image headers using save_vel=yes when XCSAO and EMSAO were run. The results are plotted by default in display mode 4 which displays the spectrum with the continuum fit subtracted and lines in the bad line list removed, if xcsao.fixbad=yes or emsao.fixbad=yes, as appropriate. The cursor mode is turned on, so that initial conditions can be changed (such as a new redshift guess or deleted cosmic ray) and the program (XCSAO or EMSAO) can be rerun. The main reason for using QPLOT is to set a quality flag in the spectrum image header. If the task is not rerun, only the summary information is rewritten. If the spectrum is recorrelated or refit, the new results are only written to the spectrum header if a quality flag (y=OK, n=bad, j=questionable) is set. .ih EXAMPLES To check the redshift of a single galaxy cl> qplotc galaxy To check redshifts for a whole night's worth of galaxy spectra: cl> qplotc @nite1.ls .ih BUGS .endhelp rvsao-2.8.3/Doc/pxcsao.hlp0000644000016200001660000006527111431070653014444 0ustar minkoirsys.help pxcsao Aug2010rvsao .ih NAME pxcsao -- Compute redshift using cross-correlation and save parameters .ih USAGE pxcsao spectra .ih PARAMETERS .ls spectra = "" List of file names of spectra to analyze. @ indicates list should come from file . [] indicates that a range of apertures in a multispec file should be processed, where is a comma- and/or hyphen-separated list of numbers. .le .ls specnum = 0 If this is nonzero and \fIspectra\fR contains a single file name, this is a range of spectrum numbers in a multispec file which will be cross- correlated. For each spectrum number, n, wavelength dispersion information is read from APNUMn, and velocity information is read from APVELn and saved in APVELn and APVXCn, the values of which contain multiple values. If specnum is zero, velocity information is in separate keywords for each value. .le .ls specband = 0 Spectrum band if multispec file .le .ls specext = 0 FITS extension containing the spectrum .le .ls specdir = "./" Directory containing spectra to analyze. .le .ls correlate = yes If "yes" or "velocity", cross-correlate object spectrum against specified template spectrum in log wavelength, displaying spectrum, correlation peak (if display mode 1), and detailed results for the best 12 templates. If "wavelength", cross-correlate object spectrum against specified template spectrum in wavelength, displaying spectrum, correlation peak (if display mode 1), and detailed results for the best 12 templates. If "pixel", cross-correlate object spectrum against specified template spectrum in pixels, displaying the spectrum, correlation peak (if display mode 1), and detailed results for the best 12 templates. If "no", display spectrum with previous results read from the spectrum image header with no correlation peak plot. If the spectrum is recorrelated, it is processed in log wavelength, and "velocity" is assumed. .le .ls templates = "" Template file or comma-separated list of file names of images to use as templates or name of file containing template file names, one per line. Apertures of multispec template files can be entered as numbers, lists, or ranges enclosed in brackets after each file name in the list or file. Wavelength (or pixel) ranges of templates to be correlated can be specified by appending :w1-w2 (:p1-p2) to the template name. Multiple pieces of a single template spectrum can thus be correlated agains multiple pieces of an object spectrum. .le .ls tempnum = 0 If nonzero and \fItemplates\fR contains a single file name, this is a range of spectrum numbers in a multispec file to be used as templates. Wavelength dispersion information is read from APNUMn, and velocity information is read from APVELn. .le .ls tempband = 1 Template band if template is multispec file .le .ls tempdir = "" Directory for template spectra .le .ls echelle = no If yes, the spectrum is assumed to be a multispec file containing multiple orders. The range of spectrum numbers (which may not have the same numbers as the echelle orders) defined by \fIspecnum\fR is used for the template rather than the range defined in \fItempnum\fR. .le .ls st_lambda = INDEF Starting wavelength in angstroms of portion of spectrum to correlate. If INDEF, use beginning of wavelength overlap between template and spectrum. .le .ls end_lambda = INDEF Ending wavelength in angstroms of portion of spectrum to correlate. If INDEF, use end of wavelength overlap between template and spectrum. .le .ls obj_plot = yes If yes, a plot of the object spectrum is displayed. During this time the normal IRAF cursor commands are active as well as several more that are itemized below.A If emission lines are chopped, before and after plots are displayed, as well as the chopped line(s). .le .ls xcor_plot = yes If yes, a plot of the filtered cross-correlation function is displayed. Cursor commands are activated, and a peak other than the maximum can be chosen to be the center with the keystroke \fIp\fR. Hard copies to stdplot may also be made using the \fI@\fR command. .le .ls xcor_file = yes If yes, files are written containing the filtered cross-correlation function for each object/template pair. The name of each file is \fIobject\fR.\fItemplate\fR, and there is one line of header containing the object and template names and the Julian date of the observation. The correlation is listed in ASCII format over the range specified by the \fIcvel\fR and \fIdvel\fR parameters as \fIvelocity correlation\fR pairs. .le .ls fixbad = no If yes, replace portions of spectrum given in file \fIbadlines\fR with a straight line linking the adjacent points. This feature can be used to eliminate emission and absorption features caused by poor removal of night sky emission lines. (added in version 2.0) .le .ls badlines = "badlines.dat" File containing list of starting and stopping wavelengths in Angstroms for removal of portions of all object spectra. All information after the second wavelength is a comment field. This file is assumed to be in the directory \fIlinedir\fR unless a complete pathname starting with "/" is specified.(added in version 2.0) .le .ls s_emchop = "no" Chop out emission lines from object spectrum before cross-correlating with template if "yes". If "tempfile", emission lines are removed if the value of the CHOPEM keyword in the template image header is T. If the keyword is not present or is F, emission lines are not removed. If "specfile", emission lines are removed if the value of the CHOPEM keyword in the object spectrum image header is T. If the keyword is not present or is F, emission lines are not removed. If "no", emission lines are never removed. If EMCHOP in the object spectrum file is 1, emission lines are never removed. .le .ls t_emchop = "no" Chop out emission lines from template spectrum before cross-correlating with object if "yes". If "tempfile", emission lines are removed if the value of the CHOPEM keyword in the template image header is T. If the keyword is not present or is F, emission lines are not removed. If "specfile", emission lines are removed if the value of the CHOPEM keyword in the object spectrum image header is T. If the keyword is not present or is F, emission lines are not removed. If "no", emission lines are never removed. If EMCHOP in the template spectrum file is 1, emission lines are never removed. .le .ls s_abs_reject 100. Spectrum absorption line rejection in sigma of fit (0=no rejection) .le .ls s_em_reject 2. Spectrum emission line rejection in sigma of fit (0=no rejection) .le .ls t_abs_reject 0. Template absorption line rejection in sigma of fit (0=no rejection) .le .ls t_em_reject 0. Template emission line rejection in sigma of fit (0=no rejection) .le .ls bell_window = 0.05 A fraction bell_window of the ends of the object and template spectrum are multiplied by a cosine bell. This is to reduce high wave number Fourier components that would be produced by abrupt cutoffs at the ends of the spectra. .le .ls renormalize = no If yes, the data spectrum is divided by its mean value before being transformed. The minimum value (divided by the mean first) is then subtracted, and the whole thing is multiplied by an arbitrary factor of 1000.0 to put it within normal count levels. This is used on spectra which may have unusual values if they have already been flux-calibrated. .le .ls ncols = 2048 Number of columns into which to rebin data before transforming, must be a power of two between 256 and 8192. .le .ls interp_mode = "spline3" Interpolation mode to use when rebinning spectra, must be "linear" or "spline3" or "poly3" or "poly5" or "sums". .le .ls zero_pad = no If yes, pad Fourier transforms of both object and template spectra with an equal amount of zeroes to avoid wrap-around correlations. This usually gives better results, but the option of turning it off has been kept to allow comparison of results with older versions of XCSAO. *If zero_pad=yes, double low_bin, top_low, top_nrun, and nrun. .le .ls low_bin = 5, top_low = 10, top_nrun = 80, nrun = 140 The Fourier amplitudes are multiplied by a cosine-bell filter function, starting at \fIlow_bin\fR and running to \fInrun\fR. Values chosen for low_bin and nrun are not critical. Generally low_bin should be about 5 to 10 for a 1024 point spectrum of 2-4 pixel resolution. Set nrun based upon the number of points in your spectrum and the resolution. For a spectrum of NPTS pixels and resolution FWHM, nrun ~ NPTS / (2*PI * FWHM/2.355). See Tonry and Davis 1979, A.J., 84, 1511. .le .ls vel_init = zero Make an inital velocity guess. It is used to shift the template in wavelength to give a better overlap region.The options are: "zero" to use no initial velocity, "guess" to use \fIczguess\fR, "correlation" to use the correlation velocity in the spectrum header parameter CZXC, "emission" to use the emission line velocity in the spectrum header parameter CZEM, and "combination" to use the velocity in the spectrum header parameter VELOCITY. .le .ls czguess = 0 Velocity in km/sec used as an initial guess if \fIczinit\fR is yes. .le .ls nzpass = 0 Number of iterations shifting the template to match features with the spectrum. Zero and one both give one pass through. .le .ls tshift = 0. Night to night velocity zero point shift. If this is zero, each template spectrum header is checked for a TSHIFT parameter, and that is used if present. .le .ls svel_corr = "file" Spectrum velocity correction to the solar system barycenter. Set to "none" if spectrum has already been shifted or if this correction is unnecessary. If "file", \fIBCV\fR is used if present in the file header, or else \fIHCV\fR. If "hfile", the header parameter \fIHCV\fR is always used. If neither is found, no correction is made. If "heliocentric" or "barycentric" corrections are chosen, position and time parameters are read from the spectrum data file header. \fIDATE-OBS\fR (date in format 'dd-mm-yy') \fIUT\fR (U.T. at end of exposure as 'hh:mm:ss') and \fIUTOPEN\fR (U.T. at start of exposure as 'hh:mm:ss') or /fIEXPTIME/fR/\fIEXPOSURE\fR (length of exposure in seconds) are used to compute the midtime of the exposure. \fIRA\fR (right ascension as 'hh:mm:ss.ss'), \fIDEC\fR (declination as 'dd:mm:ss.ss'), and \fIEPOCH\fR (epoch of coordinates defaults to 1950.0) give the position of the object whose spectrum this is. \fISITELONG\fR (observatory longitude as 'dd:mm:ss.ss' or degrees), \fISITELAT\fR (observatory latitude as 'dd:mm:ss.ss' or degrees), and \fISITEELEV\fR (observatory altitude in meters) give the observatory position. .le .ls tvel_corr = "file" Template velocity correction. Set to "none" if template is already corrected to "heliocentric", else "heliocentric", "barycentric", or "file". If "file", BCV is used if present in header, else HCV. VELOCITY in the template file header is assumed to be the barycentric corrected velocity. If the spectrum is unshifted, this correction must be made; if the spectrum has been shifted, this should be "none" and the BCV parameter in the template header should be 0. If "barycentric" or "heliocentric", the same parameters as above must be present in the template file header. .le .ls pkmode = 1 Flag for peak fitting: 0=parabola, 1=quartic, 3=cos/(1+x^2), 0=all three .le .ls pkfrac = 0.5 Fraction of peak or number of points for peak fitting. If \fIpkfrac\fR is negated, the points used in the fit will be marked. (option added in 1.8) .le .ls pksrch = 25 When a correlation peak is manually selected, the position used as the peak is the maximum correlation value within this many bins of the cursor-selected bin. .le .ls minvel = -1000. Minimum allowable correlation peak velocity shift in km/sec. .le .ls maxvel = 100000. Maximum allowable correlation peak velocity shift in km/sec. .le .ls report_mode = 1 Mode in which results of fit are reported. .ls =1 commented text .le .ls =2 one line per spectrum-template combination. Includes filenames, R, velocity and error in km/sec, and height and width of correlation peak. .le .ls =3 one line per spectrum giving best fit and previous results Previous results are read from the image header and written alternately with new results: file, old R, new R, old velocity, new velocity, old error, new error, Julian date of observation, and name of best template. .le .ls =4 one line per spectrum-template combination. Includes filenames, R value, velocity, and error. .le .ls =5 one long line per spectrum-template combination. Includes 4 filter parameters, template file name, tshift from template header, spectrum filename, velocity, R value, peak height and width, and heliocentric velocity correction. .le .ls =6 One long line per spectrum-template combination, including spectrum and template names, Julian date, velocity, error, R-value, correlation peak height and width, and velocity correction to solar system barycenter .le .ls =7 one long line per spectrum-template combination, including per template results from current correlation and from previous correlation as saved in the spectrum header. Includes filename, old and new R-vaule, old and new velocity, old and new error, old and new peak height, old and new ARMS, Julian date of observation, and old and new template names. .le .ls =8 one long line per spectrum combination, including spectrum filename, instrument code, object name, Julian date of observation, emission line velocity and error, correlation velocity, error, and R-value, number of emission lines found and fit, and the name of the template giving the highest R-value. .le .ls =9 one long line per spectrum-template combination, including observatory code, spectrum filename, template filename, Julian date of observation, velocity, error, and R-value, correlation peak height and width, barycentric velocity correction. The sigma of the spectrum transform, sigma of the template transform, and name of the file containing the correlation vector for this spectrum-template combination are added to the end of the line if such a file is written. .le .ls =10 one long line per spectrum, including spectrum filename, Julian date of observation, number of best template in list, name of best template, velocity, error, and R-value for best, and each template. .ls =11 one long line per spectrum, including spectrum filename, Julian date of observation, number of best template in list, filename, velocity, error, and R-value for best template, filename, velocity, error, and R-value for each template. .le .ls =12 one long line per spectrum, including spectrum filename, Julian date of observation, number of best template in list, and filename, velocity, error, and R-value for each template. .le .ls =13 one long line per spectrum-template combination, including observatory code, spectrum filename, template filename, Julian date of observation, velocity (from the searched, not fit, peak), peak height and width, barycentric velocity correction. The sigma of the spectrum transform, sigma of the template transform, and name of the file containing the correlation vector for this spectrum-template combination are added to the end of the line if such a file is written. .le .ls =14 one long line per spectrum, including spectrum filename, Julian date of observation, emission line velocity, error, number of lines found, and number of lines fit, number and name of best template in list, and filename, velocity, error, and R-value for each template. (mode added in version 2.0) .le .ls =15 one long line per spectrum-template combination, including spectrum and template names, Julian date, velocity, error, R-value, correlation peak height and width, and velocity correction to solar system barycenter. It is like mode 6, but with 2 more template name characters and velocities to m/sec. (mode added in version 2.0.1) .le .ls =16 one line per spectrum-template combination, including spectrum and template names (24 and 16 characters, respectively), R-value, radial velocity and error in km/sec, height of correlation peak, template wavelength limits, and center wavelength of correlated template spectrum. This is used with wide synthetic templates of which only portions are used. .le .ls =17 one line per spectrum-template combination for Hectochelle, including aperture, fiber, beam, 24-character spectrum name, last 24 characters of template name, heliocentric Julian Day, radial velocity, velocity error, R-value, correlation peak height and width, and barycentric velocity correction. .le .ls logfiles = "STDOUT,xcsao.log" All results from XCOR are recorded in these files. .le .ls save_vel = no If yes, save emission line velocity and error in IRAF image header as CZXC and CZXCERR, and R-value as CZXCR (or APVELn and APVXCn if a multispec file). .le .ls rvcheck = no Enable header update if not correlate=no (yes or no) .le .ls archive = no If yes, save emission line results in SAO TDC archive records in the current directory. .le .ls nsmooth = 0 If >0, the data spectrum is smoothed \fIsmooth\fR times for the final one-page display. The spectrum is NEVER smoothed for the correlation. .le .ls cvel = INDEF Center velocity of the summary velocity correlation graph in km/sec. This defaults to the velocity from the cross-correlation with the highest R value. .le .ls dvel = INDEF Velocity half-width of the summary velocity correlation graph in km/sec. This defaults to 20 times the width of the peak of the cross-correlation with the highest R value. .le .ls ablines = "ablines.dat" Name of file containing an absorption line list. It is used if the "l" cursor option is selected to label absorption lines. Each line has .br Center wavelength of line in angstroms .br Name of line (terminated by end of line or space) .le .ls emlines = "emlines.dat" Name of file containing an absorption line list. It is used if the "l" cursor option is selected and the "e" cursor command is used to identify an emission line in the spectrum. If the filename is preceded by a "+", emission lines are always labelled. Each line contains: .br Center wavelength of line in angstroms .br Starting wavelength in angstroms for continuum for this line .br Ending wavelength in angstroms for continuum for this line .br Half-width in angstroms for region to fit for this line .br Name of line (terminated by end of line or space) .le .ls linedir = rvsao$lib/ Directory for emission and absorption information files. If the name of one of the individual files containis "/" or "$", it is assumed to be a full path name, and \fIlinedir\fR is not used. .le .ls dispmode = 1 Display modes .ls =1 Display spectrum and cross-correlation with template information. .le .ls =-1 Display spectrum, plotted from 0, and cross-correlation with template information. .le .ls =2 Display spectrum with absorption and known emission lines labelled and tables of template and emission line information. .le .ls =3 Display spectrum with absorption and known emission lines labelled using the entire display without the table of results .le .ls =4 Display continuum-subtracted spectrum with absorption and known emission lines labelled and tables of template and emission line information. .le .ls =5 Display continuum-subtracted spectrum with absorption and known emission lines labelled using the entire display without the table of results. .le .le .ls displot = yes Display graphic summary of results on an interactive display \fIdevice\fR. .le .ls device = "stdgraph" Interactive device on which to display a graphic summary of XCSAO's results. .le .ls curmode = no If yes, wait in cursor mode after each spectrum is processed. Cursor mode commands may be listed by typing "?". .le .ls hardcopy = yes Display graphic summary of results on \fIplotter\fR. .le .ls plotter = "stdplot" Second, non-interactive device on which to plot the graphic summary of results. .le .ls besttemp = "" Best template (returned from last cross-correlated spectrum) .le .ls velocity = 0. Velocity for best template (returned from last cross-correlated spectrum) .le .ls velerr = 0. Velocity error for best template (returned from last cross-correlated spectrum) .le .ls r = 0. R-value for best template (returned from last cross-correlated spectrum) .le .ls temp_plot = no Plot the template spectra .le .ls contsub_plot = yes If yes, plots of the continuum-subtracted object and template spectra are displayed. This is most useful for determining the appropriateness of the order of the polynomial chosen to fit the continuum. .le .ls apodize_plot = yes If yes, plots of the windowed object and template spectra are displayed. This is most useful for determining the size of the cosine bell window applied to either end of the spectrum. .le .ls fft_plot = yes If yes, the power spectrum of the transformed object data is displayed. This is useful for setting the low order cutoff for the fits and for seeing if any periodic noise is present in the data. .ls uxcor_plot = yes If yes, the unfiltered cross-correlation data is plotted. .le .ls phase_plot = yes If yes, the phase of the cross-correlation function is plotted. .le .ls debug = no If yes, values of the parameters fit to the selected peak are recorded in the log files. This is most useful for debugging. .le .ls nsum = 1 Number of pixels to sum across dispersion. .le .ls cursor = "" Graphics cursor input. When null the standard cursor is used otherwise the specified file is used. .le .ih DESCRIPTION XCSAO provides an interactive facility to determine redshifts and velocity dispersions using the Cross-correlation Technique (e.g., Tonry and Davis 1979, A.J., 84, 1511). In brief, the cross-correlation technique assumes that a galaxy spectrum is simply the convolution of a stellar spectrum with a Gaussian which describes the line of sight velocity dispersion of the galaxy's constituent stars. Cross-correlating a template spectrum with the galaxy spectrum then produces a function with a peak at the redshift of the galaxy with a width related to the dispersion of the galaxy. Peaks in the cross-correlation function are identified and fit by parabolas to obtain their position and width and hence the redshift and velocity dispersion of the galaxy. The templates are read separately for each object. The wavelength scale may be linear or logarithmic; if it is linear, the data will be rebinned to a logarythmic scale. It is specified in the header by the starting log or linear wavelength (W0, CRVAL1, or APNUMn) and the delta log or linear wavelength per pixel (WPC, CDELT1 or APNUMn). The dispersion must run along axis 1 of the image. The templates should have the keyword VELOCITY or APVELn in their headers. This specifies the CORRECTED velocity (km/sec, + => receding) for the observation. The \fItvel_corr\fR parameter tells whether and how this heliocentric velocity was corrected from an observed velocity. If VELOCITY is not found, it is assumed to be zero. If the templates have a TSHIFT parameter and \fItshift\fR is zero, that velocity is added to the template velocity. The objects are read one at a time. Each object-template combination is rebinned in log-lambda to the designated (power of two) number of points over the overlapping wavelength region. Continua are fit to these rebinned log-wavelength spectra using the IRAF interactive curve fitting software, with optional emission line removal. Parameters for these continuum fits are set using the \fIcontpars\fR pset. Acceptance limits in sigma can be set for both absorption and emission features for the continuum fit and point removal for both object and template spectra. The spectra are then optionally renormalized to the average value of the spectrum. The ends of the spectra are windowed by a cosine bell to suppress high frequency noise. The object and template are filtered in Fourier space and multiplied together to form the transform of the cross-correlation function. This is transformed back into real space. The largest peak is found and fit by a parabola, quartic, or function of the form cos(x)/(1+x^2). The fitted parameters are saved, and a summary output is produced for each object. In this summary, the redshift is corrected for the velocity of the template star. The redshift is given as cz in km/sec. The quoted errors are one sigma on each parameter. .ih CURSOR The following keystrokes are active for intermediate spectrum and cross-correlation plots in addition to the normal IRAF cursor facilities (a list of those is available with the command ":.help"): .ls @ Make a hard copy on the device designated by \fIplotter\fR. .le .ls d Replaces a region between the marked vertical cursors with interpolated values from the edges of the marked region. This is typically used to eliminate poorly subtracted night sky lines or emission lines. .le .ls n Smooth spectrum n times before plotting. This only affects the current spectrum display and the final spectrum graph, not the spectrum data. .le .ls p Forces the current vertical cursor location to be chosen as the peak in the cross-correlation function which is used to obtain the redshift and dispersion. The maximum within 25 pixels of the cursor is actually used. .le .ls q Quit and exit. .le .ls r Forces a replot of the current spectrum at the original scale. .le .ls u Redisplay the entire plot after zooming. .le .ls z Zoom in on the region marked by two successive 's .le The following keystrokes are active for the final plot in addition to the normal IRAF cursor facilities (list available with the command ":.help"): .ls c Reset correlation peak fitting function and fraction to fit. (1.7) .le .ls f Change transform filter parameters. (1.7) .le .ls g Smooth spectrum n times before plotting. This only affects the current spectrum display and the final spectrum graph, not the spectrum data. (1.8) .le .ls j Set quality flag to conditional (1.8) .le .ls l Plot spectrum with absorption lines labelled. Label emission lines if the R-value for an emission line template (emission lines not chopped) is > 5 or if they have already been fit by EMSAO. (\fIdispmode\fR=2) .le .ls n Set quality flag to unacceptable. (1.8) .le .ls p Rerun cross-correlation, stopping in the filtered cross-correlation plot to select a peak other than the highest one. .ls u Unzoom the spectrum graph if using display mode 2 (1.8) .le .le .ls v Change the velocity limits within which a correlation peak is allowed. (1.7) .le .ls x Plot the spectrum, without line labels, and the cross-correlation on the same page. (\fIdispmode\fR=1) .le .ls y Set quality flag in header to yes. (1.8) .le .ls z Zoom in on the spectrum graph between two cursor clicks if using display mode 2. (1.8) .le .ih EXAMPLES To obtain the redshift and dispersion of a single galaxy cl> xcsao galaxy templates=template To obtain redshifts for a whole night's worth of galaxy spectra using 5 different templates: cl> xcsao @nite1.ls templates=@temp.ls where the file temp.ls contains the names of the 5 template images and the file nite1.ls contains the name of the galaxy images. .ih SEE ALSO On-line help is available on the World Wide Web at http://tdc-www.harvard.edu/iraf/rvsao/xcsao .endhelp rvsao-2.8.3/Doc/pemsao.hlp0000644000016200001660000004610011431070714014417 0ustar minkoirsys.help pemsao Aug2010 rvsao .ih NAME pemsao -- Compute redshift by identifying shifted emission lines .ih USAGE pemsao spectrum .ih PARAMETERS .ls spectra = "" List of file names of spectra to analyze. @ indicates list should come from file . [] indicates that a range of apertures in a multispec file should be processed, where is a comma- and/or hyphen-separated list of numbers. The files should be dispersion-corrected and linear in wavelength. .le .ls specnum = 0 If this is nonzero and \fIspectra\fR contains a single file name, this is a range of spectrum numbers in a multispec file for which emission line velocities will be obtained. Wavelength dispersion information is then read from APNUMn, and velocity information is read from APVELn, APVXCn, and APVEMn and saved in APVELn and APVEMn, the values of which contain multiple values. If specnum is zero, velocity information is in separate keywords for each value. .le .ls specband = "" Spectrum band if multispec file .le .ls specext = 0 FITS extension containing the spectrum .le .ls skynum = 0 If this is nonzero, the sky spectrum, which is used for equivalent width errors, is read from this spectrum number of the current spectrum file .le .ls skyband = 0 Sky band if multispec file .le .ls specdir = "./" Directory containing spectra to analyze .le .ls linefit = yes If yes, search for emission lines fit their positions, and average them into a weighted mean velocity for the spectrum. If no, display spectrum with labelled emission lines found in a previous application of EMSAO and results from any previous XCSAO run which is archived in the image header. .le .ls fixbad = no If yes, replace portions of spectrum given in file \fIbadlines\fR with a straight line linking the adjacent points. This feature can be used to eliminate emission and absorption features caused by poor removal of night sky emission lines. (added in version 2.0) .le .ls badlines = "badlines.dat" File containing list of starting and stopping wavelengths in Angstroms for removal of portions of all object spectra. All information after the second wavelength is a comment field. This file is assumed to be in the directory \fIlinedir\fR unless a complete pathname starting with "/" or including a "$" is specified (added in version 2.0). .le .ls renormalize = no If yes, renormalize spectrum before fitting by multiplying each pixel by 1000 times the mean pixel value for the spectrum. . Set this to "yes" for fluxed spectra. If set to "no" and all values of the object spectrum are less than 1, the spectrum is renormalized anyway, to avoid crashing the program. .le .ls st_lambda INDEF Starting wavelength in angstroms of portion of spectrum to use If INDEF, start at beginning of spectrum. .le .ls end_lambda INDEF Ending wavelength in angstroms of portion of spectrum to use If INDEF, end at end of spectrum. .le .ls nsmooth 10 Number of times the spectrum is smoothed using a 1-2-1 sliding box before the emission line search occurs. This smoothed spectrum is also the version which is displayed. .le .ls vel_init "search" The type of velocity to be used for the initial guess at where the emission lines should be. If "search", look for the lines in the \fIemsearch\fR file. If "guess", use \fIczguess\fR. If "correlation", use the \fICZXC\fR parameter in the file header which was set by XCSAO. If ("cortemp", use the velocity obtained by XCSAO when cross-correlating this spectrum against the template specified by \fIcortemp\fR. If "emission", use the \fICZEM\fR file header parameter which was set by a previous run of EMSAO. If "file", use the \fIVELOCITY\fR parameter from the header, a combined velocity which is set by both EMSAO and XCSAO. .le .ls czguess 0. Initial guess at the radial velocity if >1 or z if <1. It is used only if vel_init is "guess". .le .ls cortemp "" Name of template from which to use cross-correlation velocity. (new in 2.0) .le .ls wspan 10. Wavelength in angstroms to search around redshifted line center. This should always be less than the distance between the closest lines for which you are searching. .le .ls linesig 2.0 A line peak must be this many standard deviations above the continuum to qualify as a line. .le .ls emsearch "emsearch.dat" File containing list of emission lines used to determine an initial velocity guess if \fIvel_init\fR is "search". Each line contains: .br Center wavelength of line in angstroms .br Starting wavelength in angstroms for search for this line .br Ending wavelength in angstroms for search for this line .br Name of line (terminated by end of line or space) .le .ls emlines "rvsao$lib/emlines.dat" File containing list of emission lines, where the each line contains: .br Center wavelength of line in angstroms .br Starting wavelength in angstroms for continuum for this line .br Ending wavelength in angstroms for continuum for this line .br Half-width in angstroms for region to fit for this line .br Name of line (terminated by end of line or space) .le .ls linedir = rvsao$lib/ Directory for emission and absorption information files. If the name of one of the individual files containis "/" or "$", it is assumed to be a full path name, and \fIlinedir\fR is not used. .le .ls npfit 2 Number of pixels to fit around line peak (+-) .le .ls nlcont 1 Number of coefficients in line continuum fit (0-3). An overall continuum fit is subtracted, but the fit may not be good enough to remove the local continuum. If 0, no additional continuum is fit for each line. If the continuum is poorly subtracted using the parameters in \fIcontpars\fR, values of more than 0 for \fInlcont\fR can cause trouble. .le .ls esmooth 0 Number of times the spectrum is smoothed using a 1-2-1 sliding box before the emission lines are fit. Normally 0, it can be set to 1 or 2 for very noisy data when the fitting subroutine may otherwise be unable to fit a continuum. It should be set no higher to avoid distorting the emission line profiles. .le .ls emcombine "emcomb.dat" File containing list of groups of emission lines which should be fit together. Each entry contains the following information for one group of two to five lines: .br Number of combined emission lines .br Number of angstroms to add to fit beyond left and right line centers .br For each emission line: .br Center wavelength in angstroms .br Relative line height .le .ls mincont 0.0 If continuum is greater than this value, compute the equivalent width of the current line, which is the width the line would be if it were as high as the continuum is deep. If the continuum is less than or equal to this value, compute the area of the line in counts times wavelength. When working with continuum subtracted spectra or spectra where the emission lines are so strong that there is minimal continuum, make this value larger than the largest possible continuum fit value to get consistently computed numbers. (added in 2.0) .le .ls lwmin 0.4 Minimum fraction of mean line width for individual line (added in 2.0) .le .ls lwmax 1.7 Maximum fraction of mean line width for individual line (added in 2.0) .le .ls lsmin 2.0 Minimum equivalent width in sigma for individual line (added in 2.0) .le .ls sigline 0.0 Velocity error if single line found. Use gaussian fit error if 0 or INDEF. This value may need to be set higher to use a good, but different cross-correlation properly when the program computes a combined velocity. .le .ls disperr = 0.01 RMS dispersion error in Angstroms .le .ls vel_corr "file" Spectrum velocity correction to the solar system barycenter. Set to "none" if spectrum has already been shifted or if this correction is unnecessary. If "file", \fIBCV\fR is used if present in the file header, or else \fIHCV\fR. If "hfile", the header parameter \fIHCR\fR is always used. If neither is found, no correction is made. If "heliocentric" or "barycentric" corrections are chosen, position and time parameters are read from the spectrum data file header. \fIDATE-OBS\fR (date in format 'dd-mm-yy') \fIUT\fR (U.T. at end of exposure as 'hh:mm:ss') and \fIUTOPEN\fR (U.T. at start of exposure as 'hh:mm:ss') or \fIEXPOSURE\fR (length of exposure in seconds) are used to compute the midtime of the exposure. \fIRA\fR (right ascension as 'hh:mm:ss.ss'), \fIDEC\fR (declination as 'dd:mm:ss.ss'), and \fIEPOCH\fR (epoch of coordinates defaults to 1950.0) give the position of the object whose spectrum this is. \fISITELONG\fR (observatory longitude as 'dd:mm:ss.ss' or degrees), \fISITELAT\fR (observatory latitude as 'dd:mm:ss.ss' or degrees), and \fISITEELEV\fR (observatory altitude in meters) give the observatory position. .le .ls report_mode = 1 Format of report sent to \fIlogfiles\fR. A tab table with column headings is written if the mode flag is negated. .ls =1 Full information on each emission line found .le .ls =2 One line per spectrum, with combined, cross-correlation, and emission line velocities, number of lines found and fit, and a list of names and wavelengths of the lines which were used in the fit. .le .ls =3 One line per spectrum, with combined, cross-correlation, and emission line velocities, number of lines found and fit, and velocities for all possible reference lines, with velocities of lines not used in the final fit set to 0. .le .ls =4 One line per spectrum, with file name, instrument, object, right ascension, declination, altitude, azimuth, Julian date, exposure, emission velocity and error, cross-correlation velocity, error, and R-value (for the template specified by cortemp or best template value if cortemp is ""), and the combined velocity and error. Following the number of lines found and the number of lines fit, the velocity, error, height, width, and equivalent width are then given for each line, with zero values indicating that the line was not used in the fit. If the continuum under the line is less than mincont, the area of the line is given instead of the equivalent width. .le .ls =5 Same as mode 2, but emission line template cross-correlation velocity is always given as the cross-correlation velocity. .le .ls =6 Same as mode 3, but emission line template cross-correlation velocity is always given as the cross-correlation velocity. .le .ls =8 Single line report with line offset, error, height, width, and equivalent width for each emission line .le .ls =9 Single line report with line offset in Angstroms for each emission line .le .ls =10 One line per spectrum, with combined, cross-correlation, and emission line velocities, number of lines found and fit, and a list of names and wavelengths of the lines which were used in the fit, without equivalent width error. .le .ls =11 Single line report with line offset in pixels for each emission line .le .le .ls archive = no If yes, save emission line results in SAO TDC archive record. .le .ls save_vel = no If yes, save results in the IRAF image header. Combined velocity and error are stored as \fIVELOCITY\fR and \fIVELERROR\fR. Emission line velocity and error in IRAF image header as \fICZEM\fR and \fICZEMERR\fR, and the number of lines used in the fit is in \fICZEMNLF\fR .le .ls verbose = yes If yes, results of the emission line search are logged. .le .ls logfiles = "STDOUT,emsao.log" All results from \fIemvel\fR are recorded in these files. .le .ls device = "stdgraph" Device on which to display graphic summary of results. .le .ls hardcopy = no Print graphic summary of results on \fIplotter\fR. .le .ls displot = yes If yes, graph data on terminal (yes or no) .le .ls plotter = "stdplot" If \fIhardcopy\fR is yes, make hardcopies of graphs on this device. .le .ls dispmode = 2 Graphical display mode (2=with line list 3=full screen) .le .ls vel_plot "emission" The redshift of this velocity is used to compute the positions of the absorption and emission lines which are flagged in the display. Choices are emission, correlation, or combination (a weighted combined velocity). .le .ls curmode = yes If yes, stop in cursor mode after plotting and labelling spectrum and wait for cursor commands described below. .le .ls dispem = yes If yes, flag positions of emission lines which have been found. Those used in the velocity fit are plotted as solid lines. The "-" cursor command can be used to delete these from the fit. Those lines found but omitted from the fit are plotted as dashed lines. The "+" cursor command can be used to add them to the fit. .le .ls dispabs = yes If yes, flag positions of absorption lines. .le .ls ablines "ablines.dat" File containing list of absorption lines to plot, where the each line contains: .br Center wavelength of line in angstroms .br Name of line (terminated by end of line or space) .le .ls velfit = yes If yes, combine the redshifts found for individual emission lines into a single emission line velocity. (eliminated from 1.8 on) .le .ls nlfit = 0 Number of emission lines found and fit .le .ls emline = "" Name of first emission line .le .ls wlrest = 0 Rest wavelength of first emission line .le .ls velocity = 0 Velocity for all emission lines .le .ls velerr = 0 Velocity error for all emission lines .le .ls lineheight = 0 Height of first emission line .le .ls linewidth = 0 Width of first emission line .le. .ls lineeqw = 0 Equivalent width (or area, if continuum is less than \fImincont\fR) of first emission line .le .ls meanvel = 0. Mean velocity in km/sec .le .ls meanerr = 0. Mean velocity error in km/sec .le .ls medvel = 0. Median velocity in km/sec .le .ls medq1 = 0. First quartile velocity for multiple orders .le .ls medq2 = 0. Second quartile velocity for multiple orders .le .ls meanpix = 0. Mean pixel shift of first line .le .ls medpix = 0. Median pixel shift of first line .le .ls meandwl = 0. Mean wavelength shift of first line in Angstroms .le .ls meddwl = 0. Median wavelength shift of first line in Angstroms .le .ls obj_plot yes If yes, a plot of the object spectrum is displayed before the emission lines are searched for. .le .ls contsub_plot = no Plot the continuum-subtracted data .le .ls debug = no If yes, intermediate values of the parameters are recorded in the log files. Too much information is printed to be useful for anything but debugging. .le .ls nsum = 1 Number of pixels to sum across dispersion .ls cursor = "" Graphics cursor input. When null the standard cursor is used otherwise the specified file is used. .le .ih DESCRIPTION \fIpemsao\fR finds emission lines, computes redshifts for each identified line, and combines them into a single radial velocity. The results are written into the parameter file for this task and may also be graphically displayed or printed. If \fIcurmode\fR is set, the graphic cursor remains active after the spectrum is plotted and labelled, and the following keystrokes may be used to redisplay and/or rework the fit (in addition to the standard IRAF cursor facilities, a menu of which can be obtained by typing :.help): .ls ? Print list of \fIemsao\fR cursor commands. .le .ls a Set redshift guess from an absorption line at the cursor position. Respond to the prompt with either the line name from the ablines.dat file or a specific wavelength, which doesn't have to be one of the tabulated lines, in Angstroms. It might help to set the smoothing to 0 using \fIn\fR before doing this. .le .ls b Set blue limit of spectrum to be searched to current cursor position. .le .ls c Force the final velocity to a specific value which may be .ls e the emission line velocity, .le .ls x the cross-correlation velocity as read from the spectrum header, .le .ls c the combination velocity as computed by emsao, .le .ls g the initial guess as set by emsao.vel_init, .le .ls s a specific velocity and error to be typed in. .le .le .ls d Replaces a region between the marked vertical cursors with interpolated values from the edges of the marked region. This is typically used to eliminate poorly subtracted night sky lines or emission lines. \fIx\fR can be used to cancel the first \fId\fR. .le .ls e Set redshift guess from an emission line at the cursor position. Respond to the prompt with either the line name from the ablines.dat file or a specific wavelength, which doesn't have to be one of the tabulated lines, in Angstroms. It might help to set the smoothing to 0 using \fIn\fR before doing this. .le .ls f Refit the redshift. If lines have been added or deleted, a new weighted mean is computed. If a new initial guess has been set or line fitting parameters have been modified, a new line search is done. .le .ls g Change number of times spectrum is smoothed (nsmooth) to the number given in response to prompt. It may help to set this to 0 before identifying emission or absorption lines using e or a. .le .ls i Reset the initial velocity for the line search. .le .ls k Toggle between display with continuum subtracted and display with continuum included (default). This works for both dispmode=1 and dispmode=2. .le .ls l Reset the \fIlinesig\fR and \fIwspan\fR parameters which determine the the number of standard deviations above the continuum at which to define an emission line and the wavelength to search around the redshifted center of an individual line. .le .ls m Change number of times spectrum is smoothed (\fIesmooth\fR) for line fitting to the number given in response to the prompt. This should be zero unless high noise levels are preventing good line fits in which case it may be set to 1, or at most, 2. .le .ls n Disaprove the final velocity and set the quality flag to X. .le .ls p Replot the current display. .le .ls q Quit and exit. .le .ls r Set the red limit of spectrum to be searched to current cursor position. .le .ls s Set the redshift guess from an entered rest wavelength for the current cursor position. .le .ls t Use the velocity from the nth template in the list displayed in a emsao.dispmode=1 summary display. .le .ls u Forces the current spectrum to be replotted at the original scale. .le .ls v Select the source of the redshift at which the absorption and emission lines are plotted. It may be an emission, correlation, or combined radial velocity from the image header as \fICZEM\fR, \fICZXC\fR, or \fIVELOCITY\fR. .le .ls w Show rest and observed wavelength at cursor position. .le .ls x Cancel \fId\fR and \fIz\fR commands before second keystroke. .le .ls z Replots the region of the spectrum in wavelength between successive uses. \fIx\fR can be used to cancel the first \fIz\fR. .le .ls + Add closest found emission line to the velocity fit if it has been dropped, overriding program's selection criteria. If this doesn't work, use the \fIv\fR command to plot using the emission velocity. .le .ls '-' Drop closest found emission line from the velocity fit if it has been used, overriding program's selection criteria. If this doesn't work, use the \fIv\fR command to plot using the emission velocity. .le .ls '.' Cancel delete (d) or zoom (z) command. .le .ls '/' Toggle between spectrum plus summary display (dispmode=1) and full screen spectrum display (dispmode=2). .le .ls @ Make hard copy of graph to \fIplotter\fR. .le .ih EXAMPLES To obtain the redshift and dispersion of a single galaxy cl> emsao galaxy To obtain redshifts for a whole night's worth of galaxy spectra: cl> emsao @nite1.ls where the file nite1.ls contains the name of the galaxy images. .ih SEE ALSO On-line help is available on the World Wide Web at http://tdc-www.harvard.edu/iraf/rvsao/pemsao .endhelp rvsao-2.8.3/Doc/skyplot.hlp0000644000016200001660000000440611164461677014662 0ustar minkoirsys.help skyplot July2008 rvsao .ih NAME skyplot -- Use XCSAO to plot sky emission over a sky spectrum .ih USAGE skyplot spectra .ih PARAMETERS .ls spectra = "" List of file names of spectra to plot .le .ls specband = 3 Spectrum band to plot. The sky is in band 3 in IRAF multispec files from the FAST and Hectospec spectrographs. .le .ls specnum = "" Spectrum aperture range to plot .le .ls specdir = "" Directory for spectrum to plot .le .ls skylines = "mmtsky.dat" File of emission lines to label. Other good files in the same directory include mhosky1.dat and mhoskyall.dat, which have more emission lines, and skylines.dat, which has fewer. .le .ls linedir = "rvsao$lib/" Directory for lines to label .le .ih DESCRIPTION SKYPLOT runs EMSAO and displays the spectrum with night sky emission lines labelled. Type "q" to go on to the next spectrum in a list. Type "?" or space to get a menu of cursor commands. .ih CURSOR COMMANDS .nf a Set redshift guess from absorption line b Set blue limit of line search c Change continuum parameters d Delete data between 1st and 2nd positions e Set redshift guess from emission line f Refit redshift g Number of times to smooth plotted spectrum h Toggle print of heading with filename and redshift i Change initial velocity for search j Conditional velocity k Plot continuum-subtracted spectrum l Line search parameters m Number of times to smooth fit spectrum n Disapprove velocity o Turn line labelling on and off p Replot current graph q Leave plot r Set red limit of line search s Set VELOCITY to a specific value t Switch template for correlation velocity u Unzoom v Plot at e>mission x>correlation c>ombined velocity w Show rest and observed wavelengths x Plot correlation if available or exit y Approve velocity z Zoom between 1st and 2nd positions . Cancel delete or zoom / Toggle plot between full screen and lines + Add emission line to fit - Subtract emission line from fit ( Plot previous aperture or order > Plot next aperture or order @ Make hard copy of screen ? Display this menu .fi .ih EXAMPLES To check the skylines in a spectrum, cl> skyplot galaxy.ms.fits To check sky spectra for a whole night's worth of spectra: cl> skyplot @nite1.ls .ih BUGS .endhelp rvsao-2.8.3/Doc/listspec.hlp0000644000016200001660000000767711003723272015000 0ustar minkoirsys.help listspec Apr2008 rvsao .ih NAME listspec -- List wavelength and pixel value for spectrum image .ih USAGE .nf listspec filelist .fi .ih PARAMETERS .ls input Image file template. .le .ls specext = 0 Spectrum extension number in multiextension FITS image .le .ls specnum 0 Spectrum number in multispec image .le .ls specband 0 Spectrum band in multispec image .le .ls pix1 INDEF First pixel to list (INDEF starts with first pixel in this spectrum) .le .ls pix2 INDEF Last pixel to list (INDEF starts with last pixel in this spectrum) .le .ls lambda1 INDEF Starting wavelength to list (INDEF starts with first defined wavelength in file) .le .ls lambda2 INDEF Ending wavelength to list (INDEF starts with first defined wavelength in file) .le .ls logwav = no Print log wavelength instead of wavelength .le .ls renormalize = 0.0 Renormalize data to this number (neg mean pos max) .le .ls printlim = no Print values at only pix1 and pix2 if yes else pixels between .le .ls columns = "wf" Print n=ap p=pixel w=wavelength f=flux v=velocity d=deltawave .le .ls numform = "%3d" IRAF format for spectrum number/aperture/order .le .ls pixform = "%4d" IRAF format for spectrum pixel number .le .ls fluxform = "%g" IRAF format for flux output .le .ls waveform = "%9.3f" IRAF format for wavelength/log wavelength output .le .ls outfile = no Write list to output file x.wav (yes or no) .le .ls heading = no Include one line description at start of each file (yes or no) .le .ls nsum = 1 Number of pixels to sum across dispersion .le .ls verbose no If yes, print the name of the spectrum before listing its values. .le .ls debug = no Print extra information for debugging (yes or no) .le .ih DESCRIPTION Print wavelength/pixel value pairs for a spectrum image, computing the wavelength using the world coordinate system defined in the image header. If number is nonzero, print the pixel number in that column for each pixel. If lambda1 is set, start with the first pixel with a wavelength greater than or equal to lambda1 in angstroms. If lambda2 is set, stop with the last pixel with a wavelength less than or equal to lambda2 in angstroms. If pix1 is set, start at that pixel number (overidden by lambda1). If pix2 is set, end with that pixel number (overidden by lambda2). .ih EXAMPLES 1) Print a portion of a spectrum: .nf rvsao> listspec 2001.0530.0086.N5548.ms.fits pix1=1000 pix2=1010 columns=wf v+ Spectrum N5548 1 - 2635 5109.598 566.9747 5111.069 535.2692 5112.541 451.0975 5114.012 507.8816 5115.484 544.0441 5116.955 518.6956 5118.427 539.1362 5119.898 530.2105 5121.370 475.1248 5122.841 489.9548 5124.312 505.7442 rvsao> .fi 2) Print a portion of a spectrum with pixel numbers: .nf rvsao> listspec 2001.0530.0086.N5548.ms.fits pix1=1000 pix2=1010 columns=pwf v+ Spectrum N5548 1 - 2635 1000 5109.598 566.9747 1001 5111.069 535.2692 1002 5112.541 451.0975 1003 5114.012 507.8816 1004 5115.484 544.0441 1005 5116.955 518.6956 1006 5118.427 539.1362 1007 5119.898 530.2105 1008 5121.370 475.1248 1009 5122.841 489.9548 1010 5124.312 505.7442 rvsao> .fi 3) Print the first ten pixels of a spectrum with pixel numbers: .nf rvsao> listspec 2001.0530.0086.N5548.ms.fits pix2=10 columns=pwf 1 3639.606 56.43489 2 3641.077 29.7611 3 3642.549 58.7378 4 3644.020 101.496 5 3645.492 108.704 6 3646.963 69.95907 7 3648.435 72.81136 8 3649.906 71.15504 9 3651.378 61.04418 10 3652.849 77.30488 rvsao> .fi 4) Print the width and velocity shift with pixel numbers: .nf rvsao> listspec 2001.0530.0086.N5548.ms.fits pix1=1000 pix2=1010 columns=pwdv v+ Spectrum N5548 1 - 2635 1000 5109.598 1.471 86.334 1001 5111.069 1.471 86.309 1002 5112.541 1.471 86.285 1003 5114.012 1.471 86.260 1004 5115.484 1.471 86.235 1005 5116.955 1.471 86.210 1006 5118.427 1.471 86.185 1007 5119.898 1.471 86.161 1008 5121.370 1.471 86.136 1009 5122.841 1.471 86.111 1010 5124.312 1.471 86.086 rvsao> .fi .endhelp rvsao-2.8.3/Doc/xcplot.hlp0000644000016200001660000000143711034470462014453 0ustar minkoirsys.help xcplot July2008 rvsao .ih NAME xcplot -- Use XCSAO to plot a spectrum .ih USAGE xcplot spectra .ih PARAMETERS .ls spectra = "" List of file names of spectra to plot .le .ls specband = 0 Spectrum band to plot. If 0, plot the first or only spectrum in the file. .le .ls specnum = "" Spectrum aperture range to plot .le .ls specdir = "" Directory for spectrum to plot .le .ih DESCRIPTION XCPLOT runs XCSAO without correlating the spectrum with a template and simply displays the spectrum. Parameters for line labelling and other functions are those already set in XCSAO. .ih EXAMPLES To plot a spectrum, cl> xcplot galaxy.ms.fits To plot the spectra for a whole night's worth of spectra: cl> skyplot @nite1.ls Type "q" to move on to the next spectrum. .ih BUGS .endhelp rvsao-2.8.3/Doc/emplot.hlp0000644000016200001660000000424111164461715014443 0ustar minkoirsys.help emplot July2008 rvsao .ih NAME emplot -- Use EMSAO to plot a spectrum with lines labelled .ih USAGE emplot spectra .ih PARAMETERS .ls spectra = "" List of file names of spectra to plot .le .ls specband = 0 Spectrum band to plot. If 0, plot the first or only spectrum in the file. .le .ls specnum = "" Spectrum aperture range to plot .le .ls specdir = "" Directory for spectrum to plot .le .ls emlines = "emlines.dat" File of emission lines to label. .le .ls ablines = "ablines.dat" File of absorption lines to label. .le .ls linedir = "rvsao$lib/" Directory for lines to label .le .ih DESCRIPTION EMPLOT runs EMSAO without fitting lines in the spectrum and displays the spectrum with lines labelled and previously-obtained results, if any. Type "q" to go on to the next spectrum in a list. Type "?" or space to get a menu of cursor commands. .ih CURSOR COMMANDS .nf a Set redshift guess from absorption line b Set blue limit of line search c Change continuum parameters d Delete data between 1st and 2nd positions e Set redshift guess from emission line f Refit redshift g Number of times to smooth plotted spectrum h Toggle print of heading with filename and redshift i Change initial velocity for search j Conditional velocity k Plot continuum-subtracted spectrum l Line search parameters m Number of times to smooth fit spectrum n Disapprove velocity o Turn line labelling on and off p Replot current graph q Leave plot r Set red limit of line search s Set VELOCITY to a specific value t Switch template for correlation velocity u Unzoom v Plot at e>mission x>correlation c>ombined velocity w Show rest and observed wavelengths x Plot correlation if available or exit y Approve velocity z Zoom between 1st and 2nd positions . Cancel delete or zoom / Toggle plot between full screen and lines + Add emission line to fit - Subtract emission line from fit ( Plot previous aperture or order > Plot next aperture or order @ Make hard copy of screen ? Display this menu .fi .ih EXAMPLES To plot a spectrum, cl> emplot galaxy.ms.fits To plot a whole night's worth of spectra: cl> emplot @nite1.ls .ih BUGS .endhelp rvsao-2.8.3/Doc/wl2pix.hlp0000644000016200001660000000355411050367513014371 0ustar minkoirsys.help wl2pix Aug2008 rvsao .ih NAME wl2pix -- Compute the pixel at a given wavelength in a spectrum .ih USAGE .nf wl2pix spectrum wavelength .fi .ih PARAMETERS .ls spectrum Spectrum image file with dispersion function .le .ls specext = 0 Spectrum extension number in multiextension FITS image .le .ls specnum 0 Spectrum number in multispec image (order in echelle image) .le .ls specband 0 Spectrum band in multispec image .le .ls wavelength INDEF Wavelength in Angstroms for pixel .le .ls pixel INDEF Pixel at specified wavelength (returned) .le .ls pixform "%8.3f" IRAF format for pixel output .le .ls waveform "%8.3f" IRAF format for wavelength output .le .ls nsum = 1 Number of pixels to sum across dispersion .le .ls verbose no If yes, print the pixel value .le .ls debug = no If yes, print the file name, transformation, and wavelength per pixel .le .ih DESCRIPTION Compute the pixel value for a given wavelength in a spectrum, saving the value as the pix2wl.pixel parameter. If verbose=yes, print the pixel value using the pix2wl.pixform format. If debug=yes, print spectrum image name, followed by the wavelength value using the pix2wl.waveform format, the pixel falue using the pix2wl.pixform format, and the delta wavelength per pixel across this pixel. .ih EXAMPLES 1) Compute the pixel at a given wavelength for use in a CL script: .nf rvsao> wl2pix 22572.fits 7000 rvsao> =wl2pix.pixel 3982.3984617936 rvsao> .fi 2) Print the pixel at a given wavelength: .nf rvsao> wl2pix 22572.fits 7000 v+ 3982 rvsao> .fi 3) Print the pixel at a given wavelength more verbosely: .nf rvsao> wl2pix 22572.fits 7000 d+ 22572.fits: 7000.000 -> 3982 (0.5744/pix) rvsao> .fi 4) Check the inverse of the dispersion function: .nf rvsao> wl2pix 22572.fits 7000 rvsao> pix2wl 22572.fits wl2pix.pixel v+ 7000.000 rvsao> .fi .ih AUTHOR Doug Mink, Harvard-Smithsonian Center for Astrophysics .endhelp rvsao-2.8.3/Doc/wlrange.hlp0000644000016200001660000001274111215534656014610 0ustar minkoirsys.help wlrange Jun2009 rvsao .ih NAME wlrange -- Return the wavelength overlap range for a list of spectra .ih USAGE wlrange spectra .ih PARAMETERS .ls spectra = "" List of file names of spectra to analyze. @ indicates list should come from file . [] indicates that a range of apertures in a multispec file should be processed, where is a comma- and/or hyphen-separated list of numbers. .le .ls specnum = 0 If this is nonzero and \fIspectra\fR contains a single file name, this is a range of spectrum numbers in a multispec file which will be added. Wavelength dispersion information is read from APNUMn or the WCS keywords. Velocity information is read from APVELn and saved in APVELn and APVXCn. In a non-multispec file, radial velocity is read from the VELOCITY header parameter. .le .ls specband = 0 If this is nonzero, it is the band in the multispec file(s) specified by spectra which will be summed. Wavelength dispersion information is read from APNUMn, where n is the aperture specified by \fIspecnum\fR or the WCS keywords. Velocity information is read from APVELn and saved in APVELn and APVXCn. (New in version 2.0) .le .ls specdir = "./" Directory containing spectra to analyze. This part of the pathname is not printed at the top of the page, and is assumed to be the same for all spectra listed in the spectra parameter. .le .ls st_lambda = INDEF Starting wavelength in angstroms of output spectrum. If INDEF, use beginning of wavelength overlap between input spectra. .le .ls end_lambda = INDEF Ending wavelength in angstroms of output spectrum. If INDEF, use end of wavelength overlap between input spectra. .le .ls pix_lambda = INDEF Wavelength per pixel in angstroms of output spectrum. If INDEF, compute from wavelength range and number of pixels in output spectra. .le .ls ncol = INDEF Number of pixels into which to rebin data. .le .ls wl1 = INDEF Reddest wavelength in Angstroms (returned) .le .ls wl2 = INDEF Bluest wavelength in Angstroms (returned) .le .ls dwl = INDEF Wavelength per pixel in Angstroms (returned) .le .ls npix = INDEF Number of pixels (from file or set) (returned) .le .ls velcomp = INDEF Velocity in km/sec to which to shift individual spectra. If INDEF, do not shift spectra at all. .le .ls zcomp = INDEF Velocity of output spectrum as delta lambda / lambda; overrides velcomp if not INDEF. .le .ls svel_corr = "barycentric" Spectrum velocity correction to the solar system barycenter. Set to "none" if spectrum has already been shifted or if this correction is unnecessary. If "file", \fIBCV\fR is used if present in the file header, or else \fIHCV\fR. If "hfile", the header parameter \fIHCV\fR is always used. If neither is found, no correction is made. If svel_corr is not set to "none", but velcomp and zcomp are INDEF, data is shifted to the barycentric velocity correction of the first spectrum, if it has one. If "heliocentric" or "barycentric" corrections are chosen, position and time parameters are read from the spectrum data file header. \fIDATE-OBS\fR (date in format 'dd-mm-yy') \fIUT\fR (U.T. at end of exposure as 'hh:mm:ss') and \fIUTOPEN\fR (U.T. at start of exposure as 'hh:mm:ss') or \fIEXPOSURE\fR (length of exposure in seconds) are used to compute the midtime of the exposure. \fIRA\fR (right ascension as 'hh:mm:ss.ss'), \fIDEC\fR (declination as 'dd:mm:ss.ss'), and \fIEPOCH\fR (epoch of coordinates defaults to 1950.0) give the position of the object whose spectrum this is. \fISITELONG\fR (observatory longitude as 'dd:mm:ss.ss' or degrees), \fISITELAT\fR (observatory latitude as 'dd:mm:ss.ss' or degrees), and \fISITEELEV\fR (observatory altitude in meters) give the observatory position. Use bcvcorr task to set BCV in header and use "file" here if header parameters are different. .le .ls nsum = 1 Number of pixels to sum across dispersion .le .ls verbose = yes Display final result (yes or no) .le .ls debug = no Display intermediate results (yes or no) .le .ih DESCRIPTION WLRANGE reads a list of spectra, shifting them to a common redshift, if either the \fIvel_comp\fR or the \fIz_comp\fR parameter is not INDEF. The VELOCITY header parameter of each of these spectra is assumed to be a solar-system-barycenter-corrected velocity, and a barycentric correction (computed by SUMSPEC or extracted from the BCV or HCV header parameter) is subracted to get the redshift of the spectrum. The wavelength overlap blue and red limits are returned as well as the maximum number of pixels per spectrum and a wavelength per pixel binning which would match that number to the range. .ih EXAMPLE Get the overlapping wavelength range for a 300-fiber Hectospec spectrum: rvsao> wlrange comp.ms.fits WLRANGE: 4608-point spectra from 3550.852A to 6040.839A by 0.540A rvsao> dpar wlrange wlrange.spectra = "comp.ms.fits[1-300]" wlrange.specnum = "0" wlrange.specband = 0 wlrange.specdir = "" wlrange.st_lambda = INDEF wlrange.end_lambda = INDEF wlrange.pix_lambda = INDEF wlrange.npts = INDEF wlrange.wl1 = 3550.8524067942 wlrange.wl2 = 6040.838948816 wlrange.dwl = 0.54047895420487 wlrange.npix = 4608 wlrange.velcomp = INDEF wlrange.zcomp = INDEF wlrange.svel_corr = "none" wlrange.nsum = 1 wlrange.verbose = yes wlrange.debug = no wlrange.mode = "ql" # EOF .ih SEE ALSO On-line help is available over the World Wide Web at http://tdc-www.harvard.edu/iraf/rvsao/wlrange .endhelp rvsao-2.8.3/Doc/pvel.hlp0000644000016200001660000000412611422423075014105 0ustar minkoirsys.help pvel Jul2010 rvsao .ih NAME pvel -- Compute redshift using the cross-correlation and emission line techniques .ih USAGE pvel spectra .ih PARAMETERS .ls spectra = "" List of file names of spectra to analyze. @ indicates list should come from file . [] indicates that a range of apertures in a multispec file should be processed, where is a comma- and/or hyphen-separated list of numbers. .le .ls nskip = 0 Number of files in list to skip .le .ls ap1 = 1 First spectrum aperture to process .le .ls ap2 = 1 Last spectrum aperture to process .le .ls specband = 0 Spectrum band if multispec file .ls specext = 0 FITS extension for spectra (0 if only primary header)"} .le .ls specdir = "" Directory from which to read spectra .le .ls templates = "" List of template spectra .le .ls tempdir = "" Directory for template spectra .le .ls corr_vel = yes Compute cross correlation velocities (yes or no) .le .ls emis_vel = no Compute emission line velocities (yes or no) .le .ls plot = no Plot results on display (yes or no) .le .ls hard_copy = no Make printer hard copies (yes or no) .le .ls curmode = no If yes, wait in cursor mode after each spectrum is processed. Cursor mode commands may be listed by typing "?". .le .ls verbose = no Print what's happening (yes or no) .le .ls debug = no Print everything that happens in pxcsao and/or pemsao (yes or no) .le .ih DESCRIPTION PVEL runs either PXCSAO or PEMSAO or both, so the user doesn't have to type a file name in twice. Set parameters in PXCSAO, PEMSAO, and CONTPARS. ap1 and ap2 override specnum. specext, specband, specdir, templates, tempdir, curmode, hard_copy, plot, and debug override the equivalent parameters in XCSAO and EMSAO. If both XCSAO and EMSAO are being run, the image files should be writeable so the cross-correlation velocity can be saved to be used as an initial guess at the emission line velocity. .ih EXAMPLES To obtain the redshift and dispersion of a single galaxy cl> pvel galaxy To obtain redshifts for a whole night's worth of galaxy spectra: cl> pvel @nite1.ls .ih BUGS .endhelp rvsao-2.8.3/Xcsao/0002755000016200001660000000000012707520263013005 5ustar minkoirsysrvsao-2.8.3/Xcsao/pkfitp.x0000644000016200001660000001126206526115071014472 0ustar minkoirsys# File rvsao/Xcor/pkfitp.x # August 16, 1996 # By Doug Mink, Harvard-Smithsonian Center for Astrophysics # After Gerard Kriss # Copyright(c) 1995 Smithsonian Astrophysical Observatory # You may do anything you like with this file except remove this copyright. # The Smithsonian Astrophysical Observatory makes no representations about # the suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. #--- Fit peak of cross-correlation define MAXPWIDTH 100 procedure pkfitp (npt,xind,xcor,xvel,fracpeak,pkindx,npfit,center,width, height,debug) int npt # Number of points in cross-correlation vector real xind[ARB] # Cross-correlation vector indices real xcor[ARB] # Cross-correlation vector real xvel[ARB] # velocities corresponding to cross-correlation double fracpeak # fraction of peak to use for fitting int pkindx # Bin containing maximum int npfit # number of points used in peak fit (returned) double center # center of peak (returned) double width # width of peak (returned) double height # height of peak (returned) bool debug # True for diagnostic printout int il, ir, ilu, iru double cu, cl double wu, wl double hu, hl double pwidth double pwu, pwl, pweight double co[3] int ncoef begin # Find the peak in the cross-correlation function. # The peak found here can be altered in plotspec with the 'p' keystroke. call pkwidth (npt,xcor,xvel,fracpeak,pkindx,height,pwidth,il,ir) if (debug) { call printf ("PKFITP: imax = %d, il= %d, ir = %d\n") call pargi (pkindx) call pargi (il) call pargi (ir) call printf ("PKFITP: height = %f, width = %f\n") call pargd (height) call pargd (width) } if (il == ir) { npfit = 0; if (pkindx > 0) { center = double (xind[pkindx]) height = double (xcor[pkindx]) } else { center = 0.d0 height = 0.d0 } width = 0.d0 if (debug) call printf ("PKFITP: No peak found, returning zeroes\n"); return; } if (fracpeak == 0) fracpeak = 0.5d0 # Fit the peak down to the specified fraction if (fracpeak < 1.d0) { # Compute fit for endpoints just above half of peak ilu = il + 1 iru = ir - 1 npfit = iru - ilu + 1 ncoef = 3 call earlin (xind[ilu],xcor[ilu],npfit,co,-ncoef) call parabolapeak (co, cu, hu, wu) pwu = double (iru - ilu) if (debug) { call printf ("PKFITP U %d-%d %d pts c: %8.3f p: %6.4f w: %6.3f\n") call pargi (ilu) call pargi (iru) call pargi (npfit) call pargd (cu) call pargd (hu) call pargd (wu) } # Compute fit for endpoints just below half of peak npfit = ir - il + 1 ncoef = 3 call earlin (xind[il],xcor[il],npfit,co,-ncoef) call parabolapeak (co,cl, hl, wl) pwl = double (ir - il) if (debug) { call printf ("PKFITP L %d-%d %d pts c: %8.3f p: %6.4f w: %6.3f\n") call pargi (il) call pargi (ir) call pargi (npfit) call pargd (cl) call pargd (hl) call pargd (wl) call printf ("PKFITP pwu: %6.3f pwl: %6.3f pw: %6.3f\n") call pargd (pwu) call pargd (pwl) call pargd (pwidth) } # Compute weighted average of peak parameters pweight = (pwidth - pwl) / 2.0 center = cl + ((cl - cu) * pweight) height = hl + ((hl - hu) * pweight) width = wl + ((wl - wu) * pweight) } # Fit a fixed-width parabola to the peak # Try 11 pts for normal peaks, 5 pts for very narrow peaks (late type stars) else if (fracpeak > 1.d0) { npfit = fracpeak ir = il + npfit - 1 ncoef = 3 call earlin (xind[il],xcor[il],npfit,co,-ncoef) call parabolapeak (co,center, height, width) } # If fit finds a peak which is outside of the fit area, assume it is wrong if (center > xind[ir] || center < xind[il] || height <= 0.) { if (pkindx > 0) { center = double (xind[pkindx]) height = double (xcor[pkindx]) } else { center = 0.d0 height = 0.d0 } width = 0.d0 } end #--- Routine to compute the center x0, height h, width w of a parabola procedure parabolapeak (a,x0,h,w) double a[3], h, w, x0 begin if (a[3] == 0) { x0 = 0 h = 1 w = 1 return } x0 = -a[2] / (2.d0 * a[3]) h = a[1] - a[2]*a[2] / (4.d0 * a[3]) w = -h / (2.d0 * a[3]) if (w >= 0) w = dsqrt (w) else w = -dsqrt (-w) end # Sep 25 1991 Make all computations double instead of real, if possible # Mar 27 1992 Pass velocity vector to PKWIDTH (and change argument order) # Nov 30 1992 Pass debug as argument; drop inclusion of fquot common # Apr 13 1994 Remove unused variable nhalf # Jul 3 1995 If fit out of bounds, return initial peak and zero width # Aug 21 1995 Drop debug from PKWIDTH call # Aug 16 1996 Zero returned values if no peak is found rvsao-2.8.3/Xcsao/pkfitc.x0000644000016200001660000001024506030030026014437 0ustar minkoirsys# File rvsao/Xcor/pkfitc.x # August 21, 1995 # By Doug Mink,Harvard-Smithsonian Center for Astrophysics # After Guillermo Torres # Copyright(c) 1992 Smithsonian Astrophysical Observatory # You may do anything you like with this file except remove this copyright. # The Smithsonian Astrophysical Observatory makes no representations about # the suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. #************************************************************** # Fit the following function to the observations [xind,xcor]: * # * # A cos(Bz) * # f(x) = ------------ where z = x - C * # 1 + D z**2 * # * # Array a[4] receives initial values for the fit and returns * # the adjusted parameters A, B, C, D. * # * # G. Torres (Jan/1989) * #************************************************************** procedure pkfitc (npt,xind,xcor,xvel,peakfrac,pkindx,npfit,center,width,height,debug) int npt # Number of data points to fit real xind[ARB] # index vector real xcor[ARB] # cross-correlation vector real xvel[ARB] # velocity vector double peakfrac # Fraction of peak height above which fit is done int pkindx # Bin containing maximum int npfit # number of points used in peak fit (returned) double center # center of peak (returned) double width # width of peak (returned) double height # height of peak (returned) bool debug # True for diagnostic listing double a[4],cov[4],denom,ff,dff,pi, dv, psi0, dpsi,g int il, ir, ierr, itry begin pi = 3.1415926535897932d0 # Find peak and limits for fit call pkwidth (npt,xcor,xvel,peakfrac,pkindx,height,width,il,ir) npfit = ir - il + 1 # First approximations for B and D ierr = 1 itry = 0 while (ierr > 0 && itry < 2) { dv = xind[ir] - xind[il] a[1] = height a[2] = pi / dv a[3] = xind[pkindx] a[4] = 16.d0 * (dsqrt(2.d0) - 1.d0) / (dv * dv) # This division by 2 is for better convergence (at least in some cases...) a[4] = a[4] / 2. # Try different values for parameter D, according to itry: start # with D as computed above, and if it fails then try with twice # the starting value, and finally with half of the starting value g = -1.25 * (itry * itry) + 2.25 * itry + 1. a[4] = g * a[4] # if (debug) { # call printf ("PKFITC: calling MINI; try= %d\n") # call pargi (itry) # } # Do fit call xcmin (npfit,xind[il],xcor[il],4,a,debug,cov,ierr) if (ierr > 0) { call printf ("PKFITC Error: singular matrix\n") itry = itry + 1 if (itry > 2) { call printf ("PKFITC Error: max. iteration exceeded\n") if (ierr > 1) return } } } # Calculate FWHM of peak # (Newton - Raphson method to solve non - linear equation) # Maybe this can be improved psi0 = dv / 4. dpsi = 1. while (dpsi > 1.e-4) { denom = 1. + a[4] * psi0 * psi0 ff = (cos (a[2] * psi0) / denom) - .5 dff = -a[2] * sin (a[2] * psi0) / denom dff = dff - (2. * a[4] * psi0 * cos (a[2] * psi0) / (denom * denom)) dpsi = ff / dff psi0 = abs (psi0 - dpsi) # call printf ("PKFITC: psi= %f dpsi= %f\n") # call pargd (psi0) # call pargd (dpsi) } width = 2. * psi0 height = a[1] center = a[3] end #--- Function to be minimized procedure mfunk (n, x, y, a, chi) int n real x[ARB] real y[ARB] double a[4] double chi double psi,f int i begin chi = 0. for (i = 1; i <=n; i = i + 1) { psi = x[i] - a[3] f = a[1] * cos(a[2] * psi) / (1. + a[4] * psi**2) chi = chi + (y[i] - f) ** 2 } chi = chi / (n - 4) end # Sep 25 1991 Make height, width, and peakfrac double for PKWIDTH call # Oct 23 1991 Add debug argument to xcmin call which now calls SPP program # Mar 27 1992 Pass velocity vector to PKWIDTH (and change argument order) # Nov 30 1992 Pass debug as argument; drop inclusion of fquot common # Aug 21 1995 Drop DEBUG from PKWIDTH call rvsao-2.8.3/Xcsao/pkfitq.x0000644000016200001660000001302106016177423014471 0ustar minkoirsys# File rvsao/Xcor/pkfitq.x # August 21, 1995 # By Doug Mink, Harvard-Smithsonian Center for Astrophysics # After Gerard Kriss # Copyright(c) 1994 Smithsonian Astrophysical Observatory # You may do anything you like with this file except remove this copyright. # The Smithsonian Astrophysical Observatory makes no representations about # the suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. #--- Fit quartic to peak of cross-correlation procedure pkfitq (npt,xind,xcor,xvel,fracpeak,imax,npfit,center,width,height,debug) int npt # Number of points in cross-correlation vector real xind[ARB] # Cross-correlation vector indices real xcor[ARB] # Cross-correlation vector real xvel[ARB] # velocities corresponding to cross-correlation double fracpeak # Fraction of peak height above which fit is done int imax # Bin containing maximum int npfit # number of points used in peak fit (returned) double center # center of peak (returned) double width # width of peak (returned) double height # height of peak (returned) bool debug # True for diagnosting listing int il, ir, ilu, iru, ilh, irh double clh, crh double cu, cl double wu, wl double hu, hl double pwidth double pwu, pwl, pweight double co[5] int ncoef begin # Find the peak in the cross-correlation function. # The peak found here can be altered in plotspec with the 'p' keystroke. call pkwidth (npt,xcor,xvel,0.5d0,imax,height,pwidth,ilh,irh) call pkwidth (npt,xcor,xvel,fracpeak,imax,height,pwidth,il,ir) if (fracpeak == 0) fracpeak = 0.5 # Fit the peak down to the specified fraction if (fracpeak < 1.) { # Compute fit for endpoints just above half of peak ilu = il + 1 iru = ir - 1 npfit = iru - ilu + 1 ncoef = 5 call earlin (xind[ilu],xcor[ilu],npfit,co,-ncoef) clh = xind[ilh] crh = xind[irh] cu = xind[imax] call quarticpeak (co,clh,crh,cu,hu,wu) pwu = dble (iru - ilu) if (debug) { call printf ("PKFITP U %d pts c: %f p: %f w: %f\n") call pargi (npfit) call pargd (cu) call pargd (hu) call pargd (wu) } # Compute fit for endpoints just below half of peak npfit = ir - il + 1 ncoef = 5 call earlin (xind[il],xcor[il],npfit,co,-ncoef) clh = xind[ilh] crh = xind[irh] cl = xind[imax] call quarticpeak (co,clh,crh,cl,hl,wl) pwl = dble (ir - il) if (debug) { call printf ("PKFITP L %d pts c: %f p: %f w: %f\n") call pargi (npfit) call pargd (cl) call pargd (hl) call pargd (wl) call printf ("PKFITP pwu: %f pwl: %f pw: %f\n") call pargd (pwu) call pargd (pwl) call pargd (pwidth) } # Compute weighted average of peak parameters pweight = (pwidth - pwl) / 2.0 center = cl + ((cl - cu) * pweight) height = hl + ((hl - hu) * pweight) width = wl + ((wl - wu) * pweight) } # Fit the peak to a fixed number of points # Try 11 pts for normal peaks, 5 pts for very narrow peaks (late type stars) else if (fracpeak > 1) { npfit = fracpeak ncoef = 3 call earlin (xind[il],xcor[il],npfit,co,-ncoef) clh = xind[ilh] crh = xind[irh] center = xind[imax] call quarticpeak (co,clh,crh,center,height,width) } end #--- Routine to compute the center and half max points of a quartic # x0 and xl, xr are provided with initial guesses procedure quarticpeak (a,xl,xr,x0,h,w) double a[5], x0, xl, xr, h, w double acc, p, z, x, x1, step, s, xd, xc, diff int i, iroot begin p(z) = a[1] + z*(a[2] + z*(a[3] + z*(a[4] + z*a[5]))) # d(z) = a[2] + z*(2*a[3] + z*(3*a[4] + z*4*a[5])) # c(z) = 2*a[3] + z*(6*a[4] + z*12*a[5]) acc = 1.d-3 h = p(x0) # call printf ("PKFITQ: initial center= %f height= %f\n") # call pargd (x0) # call pargd (h) # Get the center with Newton diff = acc + 1. for (i = 1; i <= 50 && abs(diff) > acc; i = i + 1) { xd = a[2] + x0*(2*a[3] + x0*(3*a[4] + x0*4*a[5])) xc = 2*a[3] + x0*(6*a[4] + x0*12*a[5]) diff = xd / xc x = x0 - diff if (abs (diff) > acc) x0 = x } x0 = .5 * (x + x0) h = p(x0) # call printf ("PKFITQ: center= %f height= %f\n") # call pargd (x0) # call pargd (h) # call printf ("PKFITQ: coeff = %f %f %f %f %f\n") # call pargd (a[1]) # call pargd (a[2]) # call pargd (a[3]) # call pargd (a[4]) # call pargd (a[5]) # Now test to see whether the polynomial ever reaches half max # and if it does, compute where it is (fudge a0 and look for roots) a[1] = a[1] - (0.5d0 * h) for (iroot = 1; iroot <= 2; iroot = iroot + 1) { if (iroot == 1) x1 = xl else x1 = xr step = .1 s = 0.1 while (s < 3. && p(x0+s*(x1-x0)) >= 0) { s = s + step } # No sign change and we've probably got no root if (s >= 3) { call printf ("QUARTICPEAK: poly never reaches half maximum\n") x = x1 } # Get the zero with Newton's method else { i = 1 x = (s - step/2) * (x1 - x0) + x0 while (i <= 50 && abs (diff) >= acc) { xd = a[2] + x*(2*a[3] + x*(3*a[4] + x*4*a[5])) diff = p(x) / xd i = i + 1 x = x - diff } x = .5 * (x1 + x) } if (iroot == 1) xl = x else xr = x } a[1] = a[1] + 0.5d0*h w = xr - xl return end # Sep 25 1991 Make height, width, and peakfrac double for PKWIDTH call # Feb 11 1992 Clarify comments on fixed number of point fit # Mar 27 1992 Pass velocity vector to PKWIDTH (and change argument order) # Nov 30 1992 Pass debug as argument; drop inclusion of fquot common # Apr 13 1994 Drop unused variable nhalf # Aug 21 1995 Drom DEBUG from PKWIDTH call rvsao-2.8.3/Xcsao/pknum.x0000644000016200001660000000172605306520416014331 0ustar minkoirsys# File rvsao/Xcor/pknum.x # July 25, 1990 # By Doug Mink, Harvard-Smithsonian Center for Astrophysics # Copyright(c) 1991 Smithsonian Astrophysical Observatory # You may do anything you like with this file except remove this copyright. # The Smithsonian Astrophysical Observatory makes no representations about # the suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. #--- Find number of peaks in cross-correlation function procedure pknum (xcor, k1, k2, npeaks) real xcor[ARB] # Cross-correlation vector int k1, k2 # Limits over which to count peaks int npeaks # Number of peaks (returned) int k, k0, slope, last_slope begin npeaks = 0 k0 = k1 + 1 if (xcor[k0] >= xcor[k1]) last_slope = 1 else last_slope = -1 for (k = k0; k < k2; k = k+1) { if (xcor[k+1] >= xcor[k]) slope = 1 else slope = -1 if (slope != last_slope) { npeaks = npeaks + 1 last_slope = slope } } end rvsao-2.8.3/Xcsao/pkwidth.x0000644000016200001660000001110412505352464014645 0ustar minkoirsys# File rvsao/Xcor/pkwidth.x # March 27, 2015 # By Jessica Mink, Harvard-Smithsonian Center for Astrophysics # Copyright(c) 1990-2015 Smithsonian Astrophysical Observatory # You may do anything you like with this file except remove this copyright. # The Smithsonian Astrophysical Observatory makes no representations about # the suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. #--- Find peak and full width at given power of cross-correlation function include "../lib/rvsao.h" procedure pkwidth (newpts,xcor,xvel,fracpeak,imax, height, width, il, ir) int newpts # Number of points in cross-correlation vector real xcor[ARB] # Cross-correlation vector real xvel[ARB] # Cross-correlation vector velocities double fracpeak # fraction of peak to use for fitting int imax # Bin containing maximum (computed if zero) double height # actual height of peak (returned) double width # actual width of peak (returned) int il # first bin for peak fit (returned) int ir # last bin for peak fit (returned) double rr, rl, fracp, dindef int i,iwidth,pmin,pmax real velmin, velmax include "../lib/rvsao.com" begin dindef = INDEFD pmax = 0 pmin = 0 if (debug) { call printf ("PKWIDTH: initial peak at %d / %d\n") call pargi (imax) call pargi (newpts) call flush (STDOUT) } # Use the input peak position if it is set if (imax > 0) { height = xcor[imax] pmin = imax pmax = imax } # Find the peak in the cross-correlation function if it's not already set. else { height = 0. imax = 0; if (minvel == dindef) velmin = -100000.0 else velmin = minvel if (maxvel == dindef) velmax = 200000.0 else velmax = maxvel do i = 1, newpts { if ((minvel == dindef || xvel[i] >= velmin) && (maxvel == dindef || xvel[i] <= velmax)) { if (pmin == 0) pmin = i pmax = i if (xcor[i] >= height) { if (i+1 <= newpts && i-1 > 0) { if (xcor[i] >= xcor[i-1] && xcor[i] >= xcor[i+1]) { height = xcor[i] imax = i # if (debug) { # call printf ("PKWIDTH: %d %8.2f %6.3f %6.3f %6.3f\n") # call pargi (i) # call pargr (xvel[i]) # call pargr (xcor[i-1]) # call pargr (xcor[i]) # call pargr (xcor[i+1]) # } } } } } } } if (pmax == 0 && pmin == 0) { rr = 0.d0 rl = 0.d0 height = 0.d0 } # Set limits and width if number of points to fit is given else if (fracpeak > 1) { iwidth = fracpeak * 0.5d0 il = imax - iwidth ir = imax + iwidth rl = il rr = ir } # Set actual level for fraction of peak else { if (fracpeak == 0) fracp = height * 0.5d0 else fracp = height * fracpeak if (debug) { call printf ("PKWIDTH: fracpeak=%4.2f * %f, search from %d to %d\n") call pargd (fracpeak) call pargd (height) call pargi (pmin) call pargi (pmax) } # Find left fractional power point il = imax while (xcor[il] > fracp && il > 0) { il = il - 1 } if (xcor[il+1] != xcor[il]) rl = il + ((fracp-xcor[il]) / (xcor[il+1]-xcor[il])) else rl = il # Find right fractional power point ir = imax while (xcor[ir] > fracp) { ir = ir + 1 } if (xcor[ir-1] != xcor[ir]) rr = ir - ((fracp - xcor[ir]) / (xcor[ir-1] - xcor[ir])) else rr = ir } width = rr - rl if (debug) { call printf ("PKWIDTH: %8.3f - %8.3f = %6.3f c= %d, h= %6.4f\n") call pargd (rl) call pargd (rr) call pargd (width) call pargi (imax) call pargd (height) } end # Oct 3 1990 Add minpix and maxpix limits # May 28 1991 Get minshift, maxshift, and pksrch from cl # Sep 25 1991 Make height and width double precision # Nov 4 1991 Make fracpeak double # Feb 11 1992 When fracpeak > 1, treat it as number of points to fit # Mar 27 1992 Use velocity instead of pixel limits; change argument order # May 28 1992 Move limited peak search to cursor subroutine where it belongs # Nov 30 1992 Avoid divide by zero by testing spectrum values for equality # Pass debug as argument; drop inclusion of fquot common # Dec 1 1992 Correct velocity limits if user puts them in backwards # Aug 9 1993 Read minvel and maxvel instead of minshift and maxshift # Mar 22 1995 Don't accept peak if it isn't max of surroundng points # Jul 13 1995 Accept peak if it is equal to either of the adjacent points # Aug 18 1995 Move MINVEL and MAXVEL acquisition to XCFIT # May 12 1998 Return 0 width if no peak has been found # May 22 1998 Fix bug so preset peak position works # Mar 27 2015 Link to header and common files in lib/ rvsao-2.8.3/Xcsao/xcrslts.x0000644000016200001660000012074612505352074014707 0ustar minkoirsys# File rvsao/Xcsao/xcrslts.x # May 25, 2012 # By Jessica Mink, Harvard-Smithsonian Center for Astrophysics # Copyright(c) 1990-2012 Smithsonian Astrophysical Observatory # You may do anything you like with this file except remove this copyright. # The Smithsonian Astrophysical Observatory makes no representations about # the suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # Produce a statistical summary of all the cross-correlations of templates # and the object spectrum. Most input to summary is in common in "rvsao.com" include include "../lib/rvsao.h" include "../lib/contin.h" define SZ_MONTH 3 procedure xcrslts (specfile, mspec, image, newpts, rmode0, filexcor, txfile) char specfile[ARB] # spectrum file name int mspec # spectrum number within file pointer image # spectrum data structure int newpts # number of points in cross-correlation int rmode0 # report format (0=archive,1=normal,2=one-line) bool filexcor # true if correlation vector file is written char txfile[SZ_PATHNAME,ARB] # names of correlation vector files char filename[SZ_PATHNAME] char instrument[8] char incode char bcvform[16], hcvform[16] char jdot, lbr, rbr, colon int mm, dd, yyyy int i, j, k, nc, imax, itemp int strldx() int icz, icze, iczxc, iczxce, iczem, iczeme double dj # Julian date of observation double djh # Heliocentric Julian date of observation double width double dindef int strncmp(),strcmp(), strlen() int inova,jnova,qnova,ltemp,ic char pname[20] # image header parameter name int rmode # report format (0=archive,1=normal,2=one-line) double novavel[MAXTEMPS] # Correlation velocity of each template double novaerr[MAXTEMPS] # Correlation velocity error of each template double novar[MAXTEMPS] # Correlation R-value of each template real novahght[MAXTEMPS] # Height of correlation peak for this template real novawdth[MAXTEMPS] # Width of correlation peak for this template real novarms[MAXTEMPS] # Asymetric RMS for this template int nnova # Total number of templates char novaname[SZ_PATHNAME,MAXTEMPS] # Names of the templates char tempfile[SZ_PATHNAME] # Template filename char str[SZ_LINE] char tempinfo[32] char spchar[8] int ibl, ibr int fiber, aperture, beam char nameform[16] double ra, dec, ut, vel, fracpeak, z1, epoch string month "JanFebMarAprMayJunJulAugSepOctNovDec" int imaccf(), stridx() include "../lib/rvsao.com" include "../lib/results.com" include "../lib/oldres.com" begin dindef = INDEFD jdot = '.' colon = ':' lbr = char (91) rbr = char (93) mm = INDEFI dd = INDEFI yyyy = INDEFI if (imaccf (image, "DATE-OBS") == YES) call imgdate (image, "DATE-OBS", mm, dd, yyyy) else if (imaccf (image, "DATE") == YES) call imgdate (image, "DATE", mm, dd, yyyy) djh = 0.d0 dj = 0.d0 call juldate (image,ut,dj,djh,debug) call strcpy ("HCV: %6.2f", hcvform, 16) call strcpy ("BCV: %6.2f", bcvform, 16) # Set separating character to tab if report mode is less than 0 if (rmode0 >= 0) { call strcpy (" ", spchar, 8) rmode = rmode0 } else { call strcpy ("\t", spchar, 8) rmode = -rmode0 } # Mode 1: Print everything if (rmode == 1) { if (pkfrac < 0.d0) fracpeak = -pkfrac else fracpeak = pkfrac # Set up heading in logfiles ra = dindef dec = dindef call imgdpar (image,"RA",ra) if (ra != dindef) { call imgspar (image, "RA", str, SZ_LINE) if (stridx (colon, str) == 0) ra = ra / 15.0 } call imgdpar (image,"DEC",dec) epoch = 1950.0 call imgdpar (image,"EPOCH",epoch) call imgdpar (image,"EQUINOX",epoch) do i = 1, nlogfd { call fprintf(logfd[i], "\n%s Object: %s \n") call pargstr (specid) call pargstr (specname) if (ra != dindef && dec != dindef) { call fprintf(logfd[i], "RA: %011.2h Dec: %010.1h %.1f\n") call pargd (ra) call pargd (dec) call pargd (epoch) } else call fprintf(logfd[i], "(No position)\n") if (dd == INDEFI || mm == INDEFI || yyyy == INDEFI) call fprintf(logfd[i], "(No observation date) ") else if (djh > 0.d0) { call fprintf(logfd[i], "%4d-%3.3s-%02d %011.2h =HJD%.4f ") call pargi (yyyy) call pargstr (month[(mm - 1) * SZ_MONTH + 1]) call pargi (dd) call pargd (ut) call pargd (djh) } else { call fprintf(logfd[i], "%4d-%3.3s-%02d %011.2h =JD%.4f ") call pargi (yyyy) call pargstr (month[(mm - 1) * SZ_MONTH + 1]) call pargi (dd) call pargd (ut) call pargd (dj) } switch (svcor) { case NONE: call pargstr ("no BCV") case HCV: call fprintf(logfd[i], hcvform) case BCV: call fprintf(logfd[i], bcvform) case FHCV: if (specvb) call fprintf(logfd[i], bcvform) else call fprintf(logfd[i], hcvform) case FBCV: if (specvb) call fprintf(logfd[i], bcvform) else call fprintf(logfd[i], hcvform) default: } call pargd (spechcv) call fprintf(logfd[i], "\n") call fprintf(logfd[i],"%.1fA- %.1fA ") call pargd (twl1[itmax]) call pargd (twl2[itmax]) if (zpad) { call fprintf(logfd[i],"%dx2 points, ") call pargi (npts) } else { call fprintf(logfd[i],"%d points, ") call pargi (newpts) } call fprintf(logfd[i],"filter: %d %d %d %d apodize %4.2f fit %3.2f best %d\n") call pargi (lo) call pargi (toplo) call pargi (topnrn) call pargi (nrun) call pargr (han) call pargd (fracpeak) call pargi (itmax) if (tshift != 0.0) { call fprintf(logfd[i],"Tshift: %6.2f \n") call pargd (tshift) } } # Record results in log files (one line per template per peak fit mode) do itemp = 1, ntemp { do j = 1, nlogfd { call fprintf(logfd[j],"Temp: %16s vel: %6.2f ") call pargstr (tempid[1,itemp]) call pargd (tempvel[itemp]) call fprintf(logfd[j]," tsh: %6.2f HCV: %6.2f Peak: %7.3f") call pargd (tempshift[itemp]) call pargd (temphcv[itemp]) call pargd (cz[itemp]) if (correlate == COR_PIX || correlate == COR_WAV) call fprintf(logfd[j]," h:%5.3f R: %6.2f Shift: %7.3f +/- %7.3f %d") else call fprintf(logfd[j]," h:%5.3f R: %6.2f CZ: %7.3f +/- %7.3f %d") call pargd (thght[itemp]) call pargd (czr[itemp]) call pargd (zvel[itemp]) call pargd (czerr[itemp]) call pargi (pkmode0) if (tschop[itemp]) call fprintf(logfd[j]," -el") if (tachop[itemp]) call fprintf(logfd[j]," -al") if (tempfilt[itemp] == 1) call fprintf(logfd[j]," -tf") else if (tempfilt[itemp] == 2) call fprintf(logfd[j]," +hi") else if (tempfilt[itemp] == 3) call fprintf(logfd[j]," +hi -tf") if (!tscont[itemp]) call fprintf(logfd[j]," +tc") else if (tconproc[itemp] == ZEROCONT) call fprintf(logfd[j]," divc") call fprintf(logfd[j],"\n") } } } # Mode 2: One line per template else if (rmode == 2) { do itemp = 1, ntemp { if (taa[itemp] != 0) { dlogw = 1.d0 / (dlog (10.d0) * taa[itemp]) width = c0 * ((10.d0 ** (twdth[itemp] * dlogw)) - 1.d0) } else width = tvw[itemp] do j = 1, nlogfd { call fprintf(logfd[j],"%-16.16s %-16.16s %6.2f %9.3f %8.3f %5.3f %7.3f\n") call pargstr (specid) call pargstr (tempid[1,itemp]) call pargd (czr[itemp]) call pargd (zvel[itemp]) call pargd (czerr[itemp]) call pargd (thght[itemp]) call pargd (width) } } } # Mode 3: One line per object spectrum with past results and best template else if (rmode == 3) { nc = 16 call strcpy (specid,filename,nc) # call printf("%16s -> %16s\n") # call pargstr (specid) # call pargstr (filename) imax = 1 i = imax do j = 1, nlogfd { call fprintf(logfd[j],"%-16.16s %6.2f %6.2f %9.3f %9.3f %8.3f %8.3f %6.3f %6.3f %12.2f %c %s\n") call pargstr (filename) call pargd (spr0) call pargd (czr[itmax]) call pargd (spvel0) call pargd (zvel[itmax]) call pargd (sperr0) call pargd (czerr[itmax]) call pargd (spechcv0) call pargd (spechcv) call pargd (djh) call pargc (spqual0) call pargstr (tempid[1,itmax]) } } else if (rmode == 4) { nc = strldx (jdot,specfile) - 1 call strcpy (specid,filename,nc) # call printf("%16s -> %16s\n") # call pargstr (specid) # call pargstr (filename) do itemp = 1, ntemp { do j = 1, nlogfd { call fprintf(logfd[j],"%-16.16s %s %6.2f %9.3f %8.3f\n") call pargstr (filename) call pargstr (tempid[1,itemp]) call pargd (czr[itemp]) call pargd (zvel[itemp]) call pargd (czerr[itemp]) } } } else if (rmode == 5) { nc = strldx (jdot,specid) - 1 call strcpy (specid,filename,nc) # call printf("%16s -> %16s\n") # call pargstr (specid) # call pargstr (filename) do itemp = 1, ntemp { if (taa[itemp] != 0) { dlogw = 1.d0 / (dlog (10.d0) * taa[itemp]) width = c0 * ((10.d0 ** (twdth[itemp] * dlogw)) - 1.d0) } else width = tvw[itemp] do j = 1, nlogfd { call fprintf(logfd[j],"%2d %2d %3d %3d %-16.16s %5.2f %-14.14s") call pargi (lo) call pargi (toplo) call pargi (topnrn) call pargi (nrun) call pargstr (tempid[1,itemp]) call pargd (tempshift[itemp]) call pargstr (specid) call fprintf(logfd[j]," %6.2f %4.1f %4.2f %5.1f %5.2f\n") call pargd (zvel[itemp]) call pargd (czr[itemp]) call pargd (thght[itemp]) call pargd (width) call pargd (spechcv) } } } else if (rmode == 6) { call imgspar (image,"INSTRUME",instrument,8) if (strncmp (instrument,"echelle",7) == 0) incode = 'T' else if (strncmp (instrument,"mmtech",6) == 0) incode = 'M' else if (strncmp (instrument,"oroech",6) == 0) incode = 'W' else incode = '_' nc = strldx (jdot,specid) - 1 call strcpy (specid,filename,nc) # call printf("%16s -> %16s\n") # call pargstr (specid) # call pargstr (filename) do itemp = 1, ntemp { if (taa[itemp] != 0) { dlogw = 1.d0 / (dlog (10.d0) * taa[itemp]) width = c0 * ((10.d0 ** (twdth[itemp] * dlogw)) - 1.d0) } else width = tvw[itemp] if (width < 0.d0) width = 0.d0 do j = 1, nlogfd { call fprintf(logfd[j],"%c %-14.14s %-16.16s %14.5f %7.2f %6.2f %5.3g %4.2f %5.1f %6.2f") call pargc (incode) call pargstr (specid) call pargstr (tempid[1,itemp]) call pargd (djh) call pargd (zvel[itemp]) call pargd (czerr[itemp]) call pargd (czr[itemp]) call pargd (thght[itemp]) call pargd (width) call pargd (spechcv) if (filexcor) { call fprintf(logfd[j]," %7.2f %7.2f %s") call pargd (tsig1[itemp]) call pargd (tsig2[itemp]) call pargstr (txfile[1,itemp]) } call fprintf(logfd[j],"\n") } } } else if (rmode == 7) { # nc = strldx (jdot,specid) - 1 nc = 16 call strcpy (specid,filename,nc) # call printf("%16s -> %16s\n") # call pargstr (specid) # call pargstr (filename) # Read previous cross-correlation information from image file call imgipar (image,"NTEMP",nnova) call imgipar (image,"QCSTAT",qnova) do inova= 1, nnova { call sprintf (pname,6,"TEMPL%d") call pargi (inova) call imgspar (image,pname,novaname[1,inova],SZ_PATHNAME) ltemp = strlen (novaname[1,inova]) if (ltemp > 0) { do itemp = 1, ltemp { ic = novaname[itemp,inova] if (ic == 32) ic = EOS if (ic > 64 & ic < 96) ic = ic + 32 novaname[itemp,inova] = ic } } else if (inova == 1) call imgspar (image,pname,novaname[1,inova],SZ_PATHNAME) call strcpy ("ztemp",novaname[1,inova],SZ_PATHNAME) call sprintf (pname,8,"TCZXC%d") call pargi (inova) call imgdpar (image,pname,novavel[inova]) call sprintf (pname,8,"TCZXCR%d") call pargi (inova) call imgdpar (image,pname,novar[inova]) call sprintf (pname,8,"TCZXCER%d") call pargi (inova) call imgdpar (image,pname,novaerr[inova]) call sprintf (pname,8,"TXCHGHT%d") call pargi (inova) call imgrpar (image,pname,novahght[inova]) call sprintf (pname,8,"TXCWDTH%d") call pargi (inova) call imgrpar (image,pname,novawdth[inova]) call sprintf (pname,8,"TXCARMS%d") call pargi (inova) call imgrpar (image,pname,novarms[inova]) call sprintf (pname,8,"QCSTATS%d") call pargi (inova) } call strcpy ("none",novaname[1,nnova+1],SZ_PATHNAME) novavel[nnova+1] = 0.d0 novar[nnova+1] = 0.d0 novaerr[nnova+1] = 0.d0 novahght[nnova+1] = 0.d0 novarms[nnova+1] = 0.d0 do itemp = 1, ntemp { jnova = nnova+1 do inova = 1, nnova { if (strcmp(novaname[1,inova],tempid[1,itemp]) == 0) jnova = inova } do j = 1, nlogfd { call fprintf(logfd[j],"%16.16s %6.2f %6.2f %9.3f %9.3f %8.3f %8.3f") call pargstr (filename) call pargd (novar[jnova]) call pargd (czr[itemp]) call pargd (novavel[jnova]) call pargd (zvel[itemp]) call pargd (novaerr[jnova]) call pargd (czerr[itemp]) call fprintf(logfd[j]," %7.5f %7.5f %7.5f %7.5f %12.2f %s %s %s\n") call pargr (novahght[jnova]) call pargd (thght[itemp]) call pargr (novarms[jnova]) call pargd (tarms[itemp]) call pargd (dj) call pargstr (tempid[1,itemp]) call pargstr (novaname[1,jnova]) if (qnova == 1) call pargc ("?") else if (qnova == 2) call pargc ("?") else if (qnova == 3) call pargc ("X") else if (qnova == 4) call pargc ("Q") else call pargc ("_") } } } # Single line report, including emission line information else if (rmode == 8) { spxvel = zvel[itmax] spxerr = czerr[itmax] spxr = czr[itmax] call vcombine (spxvel,spxerr,spxr,spevel,speerr,spnlf,spvel,sperr,debug) if (spvel != dindef) { icz = nint (spvel) icze = nint (sperr) } else { icz = 0 icze = 0 } if (spxvel != dindef) { iczxc = nint (spxvel) iczxce = nint (spxerr) } else { iczxc = 0 iczxce = 0 } if (spevel != dindef) { iczem = nint (spevel) iczeme = nint (speerr) } else { iczem = 0 iczeme = 0 } call imgspar (image,"INSTRUME",instrument,8) if (strlen (instrument) == 0) call strcpy ("________", instrument, 8) if (strlen (IM_TITLE(image)) == 0) call strcpy ("________________", IM_TITLE(image), SZ_IMTITLE) do j = 1, nlogfd { call fprintf(logfd[j],"%6s%s%-8s%s%-16s%s%15.5f") call pargstr (specid) call pargstr (spchar) call pargstr (instrument) call pargstr (spchar) call pargstr (IM_TITLE(image)) call pargstr (spchar) call pargd (dj) call fprintf(logfd[j],"%s%5d%s%3d%s%5d%s%3d%s%5.1f") call pargstr (spchar) call pargi (iczem) call pargstr (spchar) call pargi (iczeme) call pargstr (spchar) call pargi (iczxc) call pargstr (spchar) call pargi (iczxce) call pargstr (spchar) call pargd (spxr) call fprintf(logfd[j],"%s%5d%s%3d%sC%s%2d%s%2d%s%s\n") call pargstr (spchar) call pargi (icz) call pargstr (spchar) call pargi (icze) call pargstr (spchar) call pargstr (spchar) call pargi (spnl) call pargstr (spchar) call pargi (spnlf) call pargstr (spchar) call pargstr (tempid[1,itmax]) } } # Print one line per template with correlation output file name, if used else if (rmode == 9) { call imgspar (image,"INSTRUME",instrument,8) if (strncmp (instrument,"echelle",7) == 0) incode = 'T' else if (strncmp (instrument,"mmtech",6) == 0) incode = 'M' else if (strncmp (instrument,"oroech",6) == 0) incode = 'W' else incode = '_' nc = strldx (jdot,specid) - 1 call strcpy (specid,filename,nc) # call printf("%16s -> %16s\n") # call pargstr (specid) # call pargstr (filename) do itemp = 1, ntemp { if (taa[itemp] != 0) { dlogw = 1.d0 / (dlog (10.d0) * taa[itemp]) width = c0 * ((10.d0 ** (twdth[itemp] * dlogw)) - 1.d0) } else width = tvw[itemp] do j = 1, nlogfd { call fprintf(logfd[j],"%c %-14.14s %-16.16s %14.5f %8.3f") call pargc (incode) call pargstr (specid) call pargstr (tempid[1,itemp]) call pargd (djh) call pargd (zvel[itemp]) call fprintf(logfd[j]," %7.3f %4.1f %4.2f %5.1f %6.2f") call pargd (czerr[itemp]) call pargd (czr[itemp]) call pargd (thght[itemp]) call pargd (width) call pargd (spechcv) if (filexcor) { call fprintf(logfd[j]," %7.2f %7.2f %s") call pargd (tsig1[itemp]) call pargd (tsig2[itemp]) call pargstr (txfile[1,itemp]) } call fprintf(logfd[j],"\n") } } } # Print all templates on one line else if (rmode == 10) { do j = 1, nlogfd { call fprintf(logfd[j],"%-14.14s%s%14.5f%s%d") call pargstr (specid) call pargstr (spchar) call pargd (dj) call pargstr (spchar) call pargi (itmax) if (ntemp > 1) { call fprintf(logfd[j],"%s%-12.12s%s%7.1f%s%5.1f%s%4.2f") call pargstr (spchar) call pargstr (tempid[1,itmax]) call pargstr (spchar) call pargd (zvel[itmax]) call pargstr (spchar) call pargd (czerr[itmax]) call pargstr (spchar) call pargd (czr[itmax]) } do itemp = 1, ntemp { call fprintf(logfd[j],"%s%-12.12s%s%7.1f%s%5.1f%s%4.2f") call pargstr (spchar) call pargstr (tempid[1,itemp]) call pargstr (spchar) call pargd (zvel[itemp]) call pargstr (spchar) call pargd (czerr[itemp]) call pargstr (spchar) call pargd (czr[itemp]) } call fprintf(logfd[j],"\n") } } # Print all templates on one line with long file names else if (rmode == 11) { if (maxlength > 0) { call sprintf (nameform, 16, "%%-%d.%ds") call pargi (maxlength) call pargi (maxlength) } else { call strcpy ("%-32.32s", nameform, 16) } do j = 1, nlogfd { call fprintf(logfd[j],nameform) call pargstr (specid) call fprintf(logfd[j],"%s%14.5f%s%d") call pargstr (spchar) call pargd (dj) call pargstr (spchar) if (czr[itmax] < 1.d0) call pargi (0) else call pargi (itmax) if (ntemp > 1) { if (czr[itmax] < 1.d0) { call fprintf(logfd[j],"%s%-14.14s%s%7.1f%s%5.1f%s%4.2f") call pargstr (spchar) call pargstr ("none") call pargstr (spchar) call pargd (0.d0) call pargstr (spchar) call pargd (0.d0) call pargstr (spchar) call pargd (czr[itmax]) } else { call fprintf(logfd[j],"%s%-14.14s%s%7.1f%s%5.1f%s%4.2f") call pargstr (spchar) call pargstr (tempid[1,itmax]) call pargstr (spchar) call pargd (zvel[itmax]) call pargstr (spchar) call pargd (czerr[itmax]) call pargstr (spchar) call pargd (czr[itmax]) } } do itemp = 1, ntemp { call fprintf(logfd[j],"%s%-14.14s%s%7.7g%s%5.5g%s%4.2f") call pargstr (spchar) call pargstr (tempid[1,itemp]) call pargstr (spchar) call pargd (zvel[itemp]) call pargstr (spchar) call pargd (czerr[itemp]) call pargstr (spchar) call pargd (czr[itemp]) } call fprintf(logfd[j],"\n") } } # Print all templates on one line with long file names - no best velocity else if (rmode == 12) { ibr = stridx (rbr, specid) if (ibr > 0) specid[ibr] = ' ' ibl = stridx (lbr, specid) if (ibl > 0) specid[ibl] = ' ' do j = 1, nlogfd { call fprintf(logfd[j],"%-32.32s%s%14.5f%s%d") call pargstr (specid) call pargstr (spchar) call pargd (dj) call pargstr (spchar) call pargi (itmax) do itemp = 1, ntemp { call fprintf(logfd[j],"%s%-14.14s%s%7.7g%s%5.5g%s%4.2f") call pargstr (spchar) call pargstr (tempid[1,itemp]) call pargstr (spchar) call pargd (zvel[itemp]) call pargstr (spchar) call pargd (czerr[itemp]) call pargstr (spchar) call pargd (czr[itemp]) } call fprintf(logfd[j],"\n") } if (ibl > 0) specid[ibl] = '[' if (ibr > 0) specid[ibl] = ']' } # Print measured rather than fit center and height else if (rmode == 13) { call imgspar (image,"INSTRUME",instrument,8) if (strncmp (instrument,"echelle",7) == 0) incode = 'T' else if (strncmp (instrument,"mmtech",6) == 0) incode = 'M' else if (strncmp (instrument,"oroech",6) == 0) incode = 'W' else incode = '_' nc = strldx (jdot,specid) - 1 call strcpy (specid,filename,nc) # call printf("%16s -> %16s\n") # call pargstr (specid) # call pargstr (filename) do itemp = 1, ntemp { if (taa[itemp] != 0) { dlogw = 1.d0 / (dlog (10.d0) * taa[itemp]) width = c0 * ((10.d0 ** (tpwdth[itemp] * dlogw)) - 1.d0) z1 = (10.d0 ** (tpcent[itemp]*dlogw)) * (1.d0+(spechcv/c0)) vel = c0 * (z1 - 1.d0) } else { width = tvw[itemp] vel = cz[itemp] } do j = 1, nlogfd { call fprintf(logfd[j],"%c %-14.14s %-16.16s %14.5f %7.2f %5.3f %6.2f %6.2f") call pargc (incode) call pargstr (specid) call pargstr (tempid[1,itemp]) call pargd (djh) call pargd (vel) call pargd (tphght[itemp]) call pargd (width) call pargd (spechcv) if (filexcor) { call fprintf(logfd[j]," %7.2f %7.2f %s") call pargd (tsig1[itemp]) call pargd (tsig2[itemp]) call pargstr (txfile[1,itemp]) } call fprintf(logfd[j],"\n") } } } # Print emission line velocity plus multiple templates else if (rmode == 14) { do j = 1, nlogfd { call fprintf(logfd[j],"%-32.32s%s%14.5f") call pargstr (specid) call pargstr (spchar) call pargd (dj) call fprintf(logfd[j],"%s%7.1f%s%5.1f%s%d%s%d") call pargstr (spchar) call pargd (spevel) call pargstr (spchar) call pargd (speerr) call pargstr (spchar) call pargi (spnl) call pargstr (spchar) call pargi (spnlf) call fprintf(logfd[j],"%s%d%s%-14.14s") call pargstr (spchar) call pargi (itmax) call pargstr (spchar) call pargstr (tempid[1,itmax]) do itemp = 1, ntemp { call fprintf(logfd[j],"%s%-14.14s%s%7.1f%s%5.1f%s%4.2f") call pargstr (spchar) call pargstr (tempid[1,itemp]) call pargstr (spchar) call pargd (zvel[itemp]) call pargstr (spchar) call pargd (czerr[itemp]) call pargstr (spchar) call pargd (czr[itemp]) } call fprintf(logfd[j],"\n") } } # Like mode 6 but with longer template and more digits else if (rmode == 15) { call imgspar (image,"INSTRUME",instrument,8) if (strncmp (instrument,"echelle",7) == 0) incode = 'T' else if (strncmp (instrument,"mmtech",6) == 0) incode = 'M' else if (strncmp (instrument,"oroech",6) == 0) incode = 'W' else incode = '_' nc = strldx (jdot,specid) - 1 call strcpy (specid,filename,nc) # call printf("%16s -> %16s\n") # call pargstr (specid) # call pargstr (filename) do itemp = 1, ntemp { if (taa[itemp] != 0) { dlogw = 1.d0 / (dlog (10.d0) * taa[itemp]) width = c0 * ((10.d0 ** (twdth[itemp] * dlogw)) - 1.d0) } else width = tvw[itemp] if (width < 0.d0) width = 0.d0 do j = 1, nlogfd { call fprintf(logfd[j],"%c %-14.14s %-18.18s %14.5f %9.3f %7.3f %5.3g %5.3f %7.3f %7.3f") call pargc (incode) call pargstr (specid) call pargstr (tempid[1,itemp]) call pargd (djh) call pargd (zvel[itemp]) call pargd (czerr[itemp]) call pargd (czr[itemp]) call pargd (thght[itemp]) call pargd (width) call pargd (spechcv) if (filexcor) { call fprintf(logfd[j]," %7.2f %7.2f %s") call pargd (tsig1[itemp]) call pargd (tsig2[itemp]) call pargstr (txfile[1,itemp]) } call fprintf(logfd[j],"\n") } } } # Mode 16: One line per template else if (rmode == 16) { do itemp = 1, ntemp { do j = 1, nlogfd { call fprintf(logfd[j],"%-24.24s %-16.16s %6.2f %9.3f %8.3f %5.3f") call pargstr (specid) call pargstr (tempid[1,itemp]) call pargd (czr[itemp]) call pargd (zvel[itemp]) call pargd (czerr[itemp]) call pargd (thght[itemp]) call fprintf (logfd[j]," %7.1f %7.1f %7.1f\n") call pargd (tempwl1[itemp]) call pargd (tempwl2[itemp]) call pargd ((tempwl1[itemp]+tempwl2[itemp])*0.5d0) } } } # Mode 17: One line per template for Hectochelle else if (rmode == 17) { aperture = 1 if (mspec > 0) aperture = mspec else call imgipar (image,"APERTURE",aperture) fiber = 0 call imgipar (image,"FIBER",fiber) beam = 1 call imgipar (image,"BEAM",beam) do itemp = 1, ntemp { if (taa[itemp] != 0) { dlogw = 1.d0 / (dlog (10.d0) * taa[itemp]) width = c0 * ((10.d0 ** (twdth[itemp] * dlogw)) - 1.d0) } else width = tvw[itemp] if (width < 0.d0) width = 0.d0 # Keep only last 35 characters of template file name - .fits tempinfo[28] = EOS ltemp = strlen (tempid[1,itemp]) i = ltemp - 35 if (i < 0) { i = 0 nc = ltemp } else { nc = 35 } k = strldx ('/',tempid[1,itemp]) if (k > 0) { i = k nc = nc - (k - i) } do j = 1, nc { i = i + 1 tempinfo[j] = tempid[i,itemp] } do j = 1, nlogfd { call fprintf(logfd[j],"%03d %03d %d %-24.24s %-35.35s %14.5f %9.3f %8.3f %6.3f %6.4f %6.2f %7.3f\n") call pargi (aperture) call pargi (fiber) call pargi (beam) call pargstr (specname) call pargstr (tempinfo) call pargd (djh) call pargd (zvel[itemp]) call pargd (czerr[itemp]) call pargd (czr[itemp]) call pargd (thght[itemp]) call pargd (width) call pargd (spechcv) } } } # Mode 18: One line per template for TRES else if (rmode == 18) { aperture = 1 if (mspec > 0) aperture = mspec else call imgipar (image,"APERTURE",aperture) fiber = 0 call imgipar (image,"FIBER",fiber) beam = 1 call imgipar (image,"BEAM",beam) do itemp = 1, ntemp { ibl = stridx (lbr, tempid[1,itemp]) if (ibl > 0) call strcpy (tempid[1,itemp], tempfile, ibl-1) else call strcpy (tempid[1,itemp], tempfile, SZ_PATHNAME) do j = 1, nlogfd { call fprintf(logfd[j],"%02d %s %s %14.5f %9.5f %8.5f %6.3f %7.3f\n") call pargi (aperture) call pargstr (specfile) call pargstr (tempfile) call pargd (djh) call pargd (zvel[itemp]) call pargd (czerr[itemp]) call pargd (czr[itemp]) call pargd (spechcv) } } } end procedure xcrshead (rmode0) int rmode0 # Report format (1=normal,2=one-line...) int itemp, j int rmode char spchar[8] char dashes[40] char tstring[16] include "../lib/rvsao.com" begin if (rmode0 >= 0) { call strcpy (" ", spchar, 8) rmode = rmode0 } else { call strcpy ("\t", spchar, 8) rmode = -rmode0 } call strcpy ("--------------------------------", dashes, 40) # Print one-line report if (rmode == 8) { do j = 1, nlogfd { call fprintf(logfd[j],"%-32.32s%s%-8.8s%s%-16.16s%s%-15.15s") call pargstr ("specid") call pargstr (spchar) call pargstr ("instrument") call pargstr (spchar) call pargstr ("title") call pargstr (spchar) call pargstr ("julian_date") call fprintf(logfd[j],"%s%-5.5s%s%5.5s%s%-5.5s%s%5.5s%s%-5.5s") call pargstr (spchar) call pargstr ("emvel") call pargstr (spchar) call pargstr ("emerr") call pargstr (spchar) call pargstr ("xcvel") call pargstr (spchar) call pargstr ("xcerr") call pargstr (spchar) call pargstr ("xcr") call fprintf(logfd[j],"%s%5.5s%s%3.3s%sC%s%2.2s%s%2.2s") call pargstr (spchar) call pargstr ("vel") call pargstr (spchar) call pargstr ("err") call pargstr (spchar) call pargstr (spchar) call pargstr ("nl") call pargstr (spchar) call pargstr ("nf") call fprintf(logfd[j],"%s%-8.8s\n") call pargstr (spchar) call pargstr ("best") call fprintf(logfd[j],"%32.32s%s%8.8s%s%16.16s%s%15.15s") call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call fprintf(logfd[j],"%s%5.5s%s%5.5s%s%5.5s%s%5.5s%s%5.5s") call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call fprintf(logfd[j],"%s%5.5s%s%3.3s%s%1.1s%s%2.2s%s%2.2s") call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call fprintf(logfd[j],"%s%8.8s\n") call pargstr (spchar) call pargstr (dashes) } } else if (rmode == 10) { do j = 1, nlogfd { call fprintf(logfd[j],"%-14.14s%s%-14.14s%s%-4.4s") call pargstr ("specid") call pargstr (spchar) call pargstr ("julian_date") call pargstr (spchar) call pargstr ("best") if (ntemp > 1) { call fprintf(logfd[j],"%s%-12.12s%s%-7.7s%s%-7.7s%s%-5.5s") call pargstr (spchar) call pargstr ("besttemp") call pargstr (spchar) call pargstr ("bestvel") call pargstr (spchar) call pargstr ("besterr") call pargstr (spchar) call pargstr ("bestr") } do itemp = 1, ntemp { call sprintf (tstring,16,"temp%d") call pargi (itemp) call fprintf(logfd[j],"%s%-12.12s") call pargstr (spchar) call pargstr (tstring) call sprintf (tstring,16,"vel%d") call pargi (itemp) call fprintf(logfd[j],"%s%-7.7s") call pargstr (spchar) call pargstr (tstring) call sprintf (tstring,16,"err%d") call pargi (itemp) call fprintf(logfd[j],"%s%-5.5s") call pargstr (spchar) call pargstr (tstring) call sprintf (tstring,16,"xcr%d") call pargi (itemp) call fprintf(logfd[j],"%s%-4.4s") call pargstr (spchar) call pargstr (tstring) } call fprintf(logfd[j],"\n") call fprintf(logfd[j],"%14.14s%s%14.14s%s%2.2s") call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) if (ntemp > 1) { call fprintf(logfd[j],"%s%12.12s%s%7.7s%s%5.5s%s%4.4s") call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) } do itemp = 1, ntemp { call fprintf(logfd[j],"%s%12.12s%s%7.7s%s%5.5s%s%4.4s") call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) } call fprintf(logfd[j],"\n") } } # Print all templates on one line with long file names else if (rmode == 11) { do j = 1, nlogfd { call fprintf(logfd[j],"%-32.32s%s%-14.14s%s%s") call pargstr ("specid") call pargstr (spchar) call pargstr ("julian_date") call pargstr (spchar) call pargstr ("best") if (ntemp > 1) { call fprintf(logfd[j],"%s%-14.14s%s%-7.7s%s%-5.5s%s%4.4s") call pargstr (spchar) call pargstr ("besttemp") call pargstr (spchar) call pargstr ("xcvel") call pargstr (spchar) call pargstr ("xcerr") call pargstr (spchar) call pargstr ("xcr") } do itemp = 1, ntemp { call sprintf (tstring,16,"temp%d") call pargi (itemp) call fprintf(logfd[j],"%s%-14.14s") call pargstr (spchar) call pargstr (tstring) call sprintf (tstring,16,"vel%d") call pargi (itemp) call fprintf(logfd[j],"%s%-7.7s") call pargstr (spchar) call pargstr (tstring) call sprintf (tstring,16,"err%d") call pargi (itemp) call fprintf(logfd[j],"%s%-5.5s") call pargstr (spchar) call pargstr (tstring) call sprintf (tstring,16,"xcr%d") call pargi (itemp) call fprintf(logfd[j],"%s%-4.4s") call pargstr (spchar) call pargstr (tstring) } call fprintf(logfd[j],"\n") call fprintf(logfd[j],"%32.32s%s%14.14s%s%2.2s") call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) if (ntemp > 1) { call fprintf(logfd[j],"%s%14.14s%s%7.7s%s%5.5s%s%4.4s") call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) } do itemp = 1, ntemp { call fprintf(logfd[j],"%s%14.14s%s%7.7s%s%5.5s%s%4.4s") call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) } call fprintf(logfd[j],"\n") } } # Print all templates on one line with long file names - no best velocity else if (rmode == 12) { do j = 1, nlogfd { call fprintf(logfd[j],"%-32.32s%s%-14.14s%s%-4.4s") call pargstr ("specid") call pargstr (spchar) call pargstr ("julian_date") call pargstr (spchar) call pargstr ("best") do itemp = 1, ntemp { call sprintf (tstring,16,"temp%d") call pargi (itemp) call fprintf(logfd[j],"%s%-14.14s") call pargstr (spchar) call pargstr (tstring) call sprintf (tstring,16,"vel%d") call pargi (itemp) call fprintf(logfd[j],"%s%7s") call pargstr (spchar) call pargstr (tstring) call sprintf (tstring,16,"err%d") call pargi (itemp) call fprintf(logfd[j],"%s%-5s") call pargstr (spchar) call pargstr (tstring) call sprintf (tstring,16,"xcr%d") call pargi (itemp) call fprintf(logfd[j],"%s%4s") call pargstr (spchar) call pargstr (tstring) } call fprintf(logfd[j],"\n") call fprintf(logfd[j],"%32.32s%s%14.14s%s%4.4s") call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) do itemp = 1, ntemp { call fprintf(logfd[j],"%s%-14.14s%s%-7.7s%s%-5.5s%s%4.4s") call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) } call fprintf(logfd[j],"\n") } } # Print emission line velocity plus multiple templates else if (rmode == 14) { do j = 1, nlogfd { call fprintf(logfd[j],"%-32.32s%s%-14.14s") call pargstr ("specid") call pargstr (spchar) call pargstr ("julian_date") call fprintf(logfd[j],"%s%-7.7s%s%-5s%s%s%s%s") call pargstr (spchar) call pargstr ("emvel") call pargstr (spchar) call pargstr ("emerr") call pargstr (spchar) call pargstr ("nl") call pargstr (spchar) call pargstr ("nf") call fprintf(logfd[j],"%s%s%s%-14.14s") call pargstr (spchar) call pargstr ("best") call pargstr (spchar) call pargstr ("besttemp") do itemp = 1, ntemp { call sprintf (tstring,16,"temp%d") call pargi (itemp) call fprintf(logfd[j],"%s%-14.14s") call pargstr (spchar) call pargstr (tstring) call sprintf (tstring,16,"vel%d") call pargi (itemp) call fprintf(logfd[j],"%s%7s") call pargstr (spchar) call pargstr (tstring) call sprintf (tstring,16,"err%d") call pargi (itemp) call fprintf(logfd[j],"%s%-5s") call pargstr (spchar) call pargstr (tstring) call sprintf (tstring,16,"xcr%d") call pargi (itemp) call fprintf(logfd[j],"%s%4s") call pargstr (spchar) call pargstr (tstring) } call fprintf(logfd[j],"\n") call fprintf(logfd[j],"%32.32s%s%14.14s") call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call fprintf(logfd[j],"%s%7.7s%s%5.5s%s%2.2s%s%2.2s") call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call fprintf(logfd[j],"%s%2.2s%s%14.14s") call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) do itemp = 1, ntemp { call fprintf(logfd[j],"%s%14.14s%s%7.7s%s%5.5s%s%4.4s") call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) call pargstr (spchar) call pargstr (dashes) } call fprintf(logfd[j],"\n") } } end # Oct 1988 Stephen Levine wrote original version # Oct 1990 Add hcv or bcv from file # Nov 1990 Add 1 line/template output # Jan 1991 Use zvel computed by main program # Feb 1991 Print 16-character template names # May 1991 Make all velocities double # June 1991 Use best template for mode 3 # June 1991 Print Julian date for mode 3 # July 1991 Add mode 5 for echelle testing # Aug 1991 Add mode 6 for echelle # Aug 1991 Add mode 7 for error testing # Jun 29 1992 Left-justify mode 6 names and add one digit to velocity # Feb 12 1993 Print template filename in mode 4 correctly, fix mode 5 bug # Dec 2 1993 Print mspec if non-zero # Jan 20 1994 Print correct peak fitting mode # Feb 11 1994 Add extra information to type 6 report for echelles # Mar 23 1994 Pass template file id's through labelled common # Apr 13 1994 Drop unused variables it and rmax # Jun 24 1994 Add mode 8 to print both emission line and correlation results # Jun 28 1994 Add mode 9 to print correlation velocity and error to meters # Aug 3 1994 Change common and header from fquot to rvsao # Aug 19 1994 Use wavelength range of best template # Nov 17 1994 Add mode 10 to print multiple templates on one line # Dec 19 1994 Print filter and emission line chopping info in mode 1 # Jan 11 1995 Add filter mode 3 # Jan 25 1995 Add mode 10 to allow long file names # Feb 24 1995 Add quality flag to mode 7 # Mar 13 1995 Add absorption line removal note # May 9 1995 Print all of modes 10 and 11 at once # May 15 1995 Change all sz_fname to sz_line, which is 100 chars longer # May 15 1995 Add template-driven option to divide, not subtract, continuum # May 18 1995 Print 14-character templates in mode 11 # Jun 9 1995 Add mode 12 to avoid printing any template data twice # Jun 19 1995 Get SPECID from rvsao common # Jul 3 1995 Add mode 13 to print measured not fit numbers for echelle group # Jul 13 1995 Add debugging argument to vcombine # Jul 13 1995 Get Julian Date from JULDATE, not JULDAY # Jul 13 1995 (except echelle modes which get HJDN from header) # Jul 13 1995 Get UT from JULDATE # Jul 17 1995 Fix regular Julian Date computation # Aug 7 1995 Print heliocentric Julian Date if present, else gecoentric JD # Aug 22 1995 Use absolute value of PKFRAC # Sep 19 1995 Use width from header, not computed if TAA is zero # Sep 21 1995 Handle indef values of spvel, spxvel and spevel # Sep 25 1995 Fix mode 13 to print center correctly # Feb 2 1996 Fix mode 6 to avoid right shift for large R values # Jan 15 1997 Add JDH to JULDATE arguments # Feb 4 1997 Drop declaration of C0; it is now in rvsao.com # Apr 15 1997 Add mode 14 for template comparison to emission velocity # May 2 1997 Always test against dindef, not INDEFD # May 6 1997 Print message if no position or observation date # Oct 23 1997 Print position and observation time on separate lines in mode 1 # Dec 17 1997 Change order of date from dd-mmm-yyyy to yyyy-mmm-dd # Dec 17 1997 Use EQUINOX if it is present instead of EPOCH # Jan 21 1998 Add mode 15 for Dave Latham--longer template name, m/sec # Jul 14 1998 Increase filename length from 24 to 32 in modes 11, 12, and 14 # May 21 1999 Read DATE if DATE-OBS is no found # Jul 23 1999 Put _ in place of space in incode and null in instrument # Jul 29 1999 Add tab table option for single line report modes # Sep 15 1999 Clean up tab table output # Sep 20 2000 Print Shift instead of CZ if wavelength or pixel correlation # Sep 27 2000 Print mode 11 and 12 results in g, not f format # Feb 9 2001 Print aperture as separate column in report mode 12 # Aug 7 2002 Print template range and center as additional columns # Jun 1 2006 Add report mode 17 for Soren Meibold for Hectochelle # Dec 1 2006 Do not print best template info if only one template # Apr 5 2007 Print last 27 characters of template name in mode 17 (-.fits) # Apr 6 2007 Drop directory from template name # Jun 21 2007 Add oldres.com to save previous results for mode 3 output # Mar 10 2008 Add mode 18 for TRES multi-order echelle spectra # May 30 2008 Use string constants more efficiently for Solaris limits # Feb 20 2009 Assume decimal RA keyword value to be in degrees # Apr 9 2009 Allow mode 17 template names to be up to 35 characters long # Jul 21 2010 If no good template in mode 11, print zeroes # May 25 2012 Add maxlength to print long filenames in mode 11 # Mar 27 2015 Link to header and common files in lib/ rvsao-2.8.3/Xcsao/Readme0000644000016200001660000000252705577632253014143 0ustar minkoirsysRVSAO spectrum cross-correlation subroutines aspart.x Compute asymmetric noise component buffers.x Various vector manipulation subroutines correlate.x Various subroutines to perform correlations and filter them earlin.x Polynomial fitting subroutine pkfitc.x Fit cos(x)/(1+x^2) to correlation peak pkfitp.x Fit parabola to correlation peak pkfitq.x Fit quartic to correlation peak pknum.x Count peaks in correlation pkwidth.x Find approximate width of correlation peak plotsubs.x Subroutines to plot the summary page t_xcsao.x Main cross-correlation program XCSAO xcarch.x Write SAO TDC archive correlation record to a file xcfile.x Save the cross-correlation function to a file xcmin.x Fitting routines for pkfitc xcorfit.x Cross-correlation subroutine xcplot.x Plot correlation results to display and/or plotter xcrslts.x Print correlation results in any of various formats emv.h Header for emission line subroutines (used for line marking) fquot.h Header for all radial velocity tasks shdr.h Header for onedspect spectrum header ansum.com Common for SAO TDC archive analysis summary record corr.com Common for SAO TDC archive correlation record emv.com Common for emission line parameters fquot.com Common for radial velocity parameters and results getim.com Common for spectrum parameters read from IRAF image header results.com Common for XCSAO results rvsao-2.8.3/Xcsao/xcarch.x0000644000016200001660000001232712505352623014450 0ustar minkoirsys# File rvsao/Xcor/xcarch.x # March 27, 2015 # By Jessica Mink, Center for Astrophysics # Copyright(c) 1994-2015 Smithsonian Astrophysical Observatory # You may do anything you like with this file except remove this copyright. # The Smithsonian Astrophysical Observatory makes no representations about # the suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # Produce an archive record with the results of cross-correlations # of templates and the object spectrum. # Most input is in common in "rvsao.com" include "../lib/rvsao.h" procedure xcarch (specfile) char specfile[ARB] # name of archive file char header[48] char arcfile[SZ_FNAME] char osheader[48] double x,tx,y,erfy char tname[16] int it, nw, nh #int id int open(),strlen() int arc_fd int nbrec,lhead,npeaks real tmpwl1,tmpwl2 int i bool arcwrite include "../lib/rvsao.com" include "../lib/results.com" include "../lib/corr.com" include "../lib/ansum.com" #int outchop # number of emmision lines chopped #int choplist[2,10] # center pixel, +/- range in pixels #common/emch/ outchop,choplist begin # Set up analysis summary output file name call strcpy (specfile,arcfile,SZ_FNAME) call strcat (".ansum",arcfile,SZ_FNAME) if (debug) { call printf ("XCARCH: writing %s\n") call pargstr (arcfile) } arcwrite = TRUE iferr {arc_fd = open (arcfile, NEW_FILE, BINARY_FILE)} then { call printf ("XCARCH: Cannot write %s\n") call pargstr (arcfile) arcwrite = FALSE } if (arcwrite) { # Write analysis summary record header for (i=1; i<=48; i=i+8) { call strcpy (" ", header[i], 8) } call strcpy ("ANALYSIS_SUMMARY 40 ",header,20) if (debug) { call printf ("XCARCH: header is %s\n") call pargstr (header) } nh = 48 call strpak (header,osheader,nh) nw = 24 call write (arc_fd, osheader, nw) # Compute confidence of correlation velocity x = czr[itmax] / dsqrt (2.d0) tx = 1.d0 + 0.3275911d0 * x y = 1.d0 / tx erfy = 0.254829592d0*y - 0.284496736d0*y*y + 1.421413741d0*y*y*y - 1.453152027d0*y*y*y*y + 1.061405429*y*y*y*y*y npeaks = 20 cz0conf = (1.d0 - erfy) ** npeaks # Write analysis summary record nw = 2 qcstat = spvqual call write (arc_fd, qcstat, nw) spxvel = zvel[itmax] spxerr = czerr[itmax] spxr = czr[itmax] czxc = spxvel czxcerr = spxerr czxcr = spxr cz0 = spvel cz0err = sperr if (spevel != INDEFD) czem = spevel else czem = 0. if (speerr != INDEFD) czemerr = speerr else czemerr = 0. czemscat = 0. nw = 18 call write (arc_fd, cz0, nw) call close (arc_fd) } # Set up correlation output file name call strcpy (specfile,arcfile,SZ_FNAME) call strcat (".corr",arcfile,SZ_FNAME) if (debug) { call printf ("XCARCH: writing %s\n") call pargstr (arcfile) } arcwrite = TRUE iferr {arc_fd = open (arcfile, NEW_FILE, BINARY_FILE)} then { call printf ("XCARCH: Cannot write %s\n") call pargstr (arcfile) arcwrite = FALSE } if (arcwrite) { # Write correlation record header nchop = 0 nbrec = 16 + (nchop * 4) + (ntemp * 44) call sprintf (header, 48, "CORRELATION %d ") call pargi (nbrec) if (debug) { call printf ("XCARCH: header is %s\n") call pargstr (header) } lhead = strlen (header) for (i=lhead+1; i<=48; i=i+1) { header[i] = ' ' } nh = 48 call strpak (header,osheader,nh) nw = 24 call write (arc_fd, osheader, nw) # Set global information objrms = 0. ntmpl = ntemp nchop = 0 tmpwl1 = twl1[itmax] tmpwl2 = twl2[itmax] objrms = 0. call printf ("%fA - %fA %d templates %d lines\n") call pargr (tmpwl1) call pargr (tmpwl2) call pargs (ntmpl) call pargs (nchop) nw = 6 call write (arc_fd, tmpwl1, nw) nw = 2 call write (arc_fd, ntmpl, nw) # Save information for each emission line chopped # do il = 1, outchop { # if (specdc) # cchop = 10 ** (logw0 + (choplist[2,il] - 1.) * dlogw) # else { # dw = (tmpwl2 - tmpwl1) / (specpix - 1.d0) # cchop = tmpwl1 + (choplist[2,il] - 1.) * dw # } # nw = 1 # call write (arc_fd, cchop, nw) # rchop = choplist[2,il] # call write (arc_fd, rchop, nw) # } # Save cross-correlation results for each template used do it = 1, ntemp { call strpak (tempname[1,it], tname, 16) nw = 8 call write (arc_fd, tname, nw) tcenter = tcent[it] theight = thght[it] twidth = twdth[it] trmsa = tarms[it] trmss = tsrms[it] tshft = tempshift[it] - tempvel[it] - temphcv[it] tpw = taa[it] nw = 14 call write (arc_fd, tcenter, nw) } call close (arc_fd) } return end # Nov 14 1991 Move vcombine into t_xcsao.x # Aug 11 1992 Fix analysis summary velocity writing error # Apr 21 1994 Call WRITE as procedure, not function # Jun 23 1994 Pass velocities in fquot, not getim labelled common # Aug 3 1994 Change common and header from fquot to rvsao # Nov 16 1994 Set QCSTAT from SPVQUAL in rvsao common # Apr 6 1999 Change ntmp to ntmpl to avoid conflict # Nov 29 1999 Deal with INDEF values for emission line vel and err # Nov 29 1999 Print error message for each file unwritten # Aug 25 2005 Change tname to char # Mar 27 2015 Link to header and common files in lib/ rvsao-2.8.3/Xcsao/t_excsao.x0000644000016200001660000003145312505363160015004 0ustar minkoirsys# File rvsao/Xcor/t_excsao.x # March 27, 2015 # By Jessica Mink, Harvard-Smithsonian Center for Astrophysics # After Gerard Kriss, Johns Hopkins University and others # Copyright(c) 2007-2015 Smithsonian Astrophysical Observatory # You may do anything you like with this file except remove this copyright. # The Smithsonian Astrophysical Observatory makes no representations about # the suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # EXCSAO is an IRAF task for obtaining redshifts and velocity dispersions # using cross correlation methods. This version is for echelle spectra # For arguments, see parameter file excsao.par. # Information is shared in common blocks defined in "rvsao.com". # It differs from XCSAO only in that it saves the fit velocity as a parameter include include include include include "../lib/rvsao.h" include "../lib/xcv.h" include "../lib/emv.h" procedure t_excsao () int i char specfile[SZ_PATHNAME] # Object spectrum file name char specpath[SZ_PATHNAME] # Object spectrum path name char tempfiles[SZ_PATHNAME] # List of template spectra char specdir[SZ_PATHNAME] # Directory for object spectra #char filt_type[SZ_LINE] # Filter for transform # (ramp | welch | hanning | cos-bell) char svel_corr[SZ_LINE] # Type of velocity correction for spectrum # (none | file | heliocentric | barycentric) char tvel_corr[SZ_LINE] # Type of velocity correction for template # (none | file | heliocentric | barycentric) bool savevel0 # Save velocity, error, and R in data file header int rmode # Report format (1=normal,2=one-line) int logfiles # List of log files char logfile[SZ_PATHNAME] # Log file name char wtitle[20] # Title for wavelength plots of spectrum int mspec # Object aperture to read from multispec file int mband # Object band to read from multispec file pointer speclist # List of spectrum files char str[SZ_LINE] int fd char vel_plot[SZ_LINE] # type of velocity for redshifting plot # correlation|emission|combination|search int nmspec0 # Number of object multispec spectra int mspec_range[3,MAX_RANGES] int ip,jp,lfile # Limits for multispec aperture decoding char lbracket[3] # "[({" char rbracket[3] # "])}" double sumvel, sumerr, sumr, avgvel, avgerr, avgr, dnap double medvel, qvel1, qvel2 int nap pointer evel char vel_init[SZ_LINE] # type of velocity for initial value bool echelle # If true, template multispec numbers track object char tempnums[SZ_LINE] # List of multispec spectra to read int tspec_range[3,MAX_RANGES] int tspec int ntspec int oshift bool clgetb() int clpopnu(), clgeti(), clgfil(), open() int strdic(), stridx(), stridxs() real clgetr() int decode_ranges(),get_next_number() int imtgetim(), imaccess(), strlen(), ldir, clscan() pointer imtopenp() define newspec_ 10 define newap_ 20 define endxc_ 90 include "../lib/rvsao.com" include "../lib/results.com" include "../lib/emv.com" include "../lib/xcor.com" include "../lib/xcorf.com" include "../lib/xplt.com" begin c0 = 299792.5 qplot = FALSE nfound = 0 maxpix = 0 maxpts4 = 0 call sprintf (lbracket,3,"[({") call sprintf (rbracket,3,"])}") call sprintf (wtitle,20,"Wavelength") ntmp = 0 waverest = 0.d0 specref = 0 # Initialize various utility vector pointers xcor = NULL xvel = NULL shspec = NULL shtemp = NULL wltemp = NULL xind = NULL xifft = NULL ft1 = NULL ft2 = NULL ftcfn = NULL tft = NULL pft = NULL spexp = NULL xcont = NULL scont = NULL smspec = NULL cspec = NULL smcspec = NULL fraclev = NULL xlev = NULL evel = NULL wtsh = NULL wtwcs = NULL # Get task parameters. # Spectra to cross-correlate speclist = imtopenp ("spectra") # Multispec spectrum numbers (use only first if multiple files) call clgstr ("specnum",specnums,SZ_LINE) if (decode_ranges (specnums, mspec_range, MAX_RANGES, nmspec0) == ERR){ call sprintf (str, SZ_LINE, "T_XCSAO: Illegal multispec list <%s>") call pargstr (specnums) call error (1, str) } call clgstr ("specdir",specdir,SZ_PATHNAME) ldir = strlen (specdir) if (specdir[1] != EOS && specdir[ldir] != '/') { specdir[ldir+1] = '/' specdir[ldir+2] = EOS } mband = clgeti ("specband") mext = clgeti ("specext") # Templates against which to correlate spectra call clgstr ("templates",tempfiles,SZ_PATHNAME) # Optional correlation plot, where peak may be selected by cursor pltcor = clgetb ("xcor_plot") # Optional intermediate data plot switches pltspec = clgetb ("obj_plot") plttemp = clgetb ("temp_plot") pltcon = clgetb ("contsub_plot") pltapo = clgetb ("apodize_plot") pltfft = clgetb ("fft_plot") pltuc = clgetb ("uxcor_plot") plttft = clgetb ("tfft_plot") # Print processing information debug = clgetb ("debug") # Continuum fit parameter pset call cont_get_pars() # Number of times to smooth (1-2-1) final data plot nsmooth = clgeti ("nsmooth") # Velocity center and width of summary page cross-correlation plot xcr0 = clgetr ("cvel") xcrdif = clgetr ("dvel") # Type of fit for correlation peak and fraction of peak to fit pkmode0 = clgeti ("pkmode") # Type of heliocentric velocity correction to be used call clgstr ("svel_corr",svel_corr,SZ_LINE) svcor = strdic (svel_corr,svel_corr,SZ_LINE, HC_VTYPES) call clgstr ("tvel_corr",tvel_corr,SZ_LINE) tvcor = strdic (tvel_corr,tvel_corr,SZ_LINE, HC_VTYPES) # Type of velocity for initial redshift call clgstr ("vel_init",vel_init,SZ_LINE) vinit = strdic (vel_init,vel_init,SZ_LINE,XC_VTYPES) # Image header result flag savevel0 = FALSE savevel0 = clgetb ("save_vel") # Report mode for log file rmode = 1 rmode = clgeti ("report_mode") # Initialize emission and absorption lines for labelling call eminit (FALSE) # Open log files and write a header. logfiles = clpopnu ("logfiles") call fseti (STDOUT, F_FLUSHNL, YES) i = 0 call strcpy ("rvsao.xcsao",taskname,SZ_LINE) while (clgfil (logfiles, logfile, SZ_PATHNAME) != EOF) { fd = open (logfile, APPEND, TEXT_FILE) if (fd == ERR) break if (rmode == 1) { call loghead (taskname,str) call fprintf (fd, "%s\n") call pargstr (str) } i = i + 1 logfd[i] = fd } nlogfd = i call clpcls (logfiles) # Type of velocity for plotting emission and absorption lines if (clscan("vel_plot") != EOF) { call clgstr ("vel_plot",vel_plot,SZ_LINE) vplot = strdic (vel_plot,vel_plot,SZ_LINE,PL_VTYPES) } else vplot = VCORREL # Set echelle order shift, if any echelle = clgetb ("echelle") oshift = 0 if (echelle) { call clgstr ("tempnum",tempnums,SZ_LINE) if (strlen (tempnums) > 0) { if (decode_ranges (tempnums, tspec_range, MAX_RANGES, ntspec) == ERR) call error (1, "T_XCSAO: Illegal template multispec list") if (get_next_number (tspec_range, tspec) != EOF) { if (get_next_number (mspec_range, mspec) != EOF) { oshift = tspec - mspec if (debug) { call printf ("T_XCSAO: Shifting by %d orders\n") call pargi (oshift) } } } } call malloc (evel, nmspec0+5, TY_DOUBLE) } # Print tab table headers if (rmode < 0) call xcrshead (rmode) # Get next object spectrum file name from the list newspec_ if (imtgetim (speclist, specfile, SZ_PATHNAME) == EOF) go to endxc_ # Check for specified apertures in multispec spectrum file ip = stridxs (lbracket,specfile) if (ip > 0) { lfile = strlen (specfile) specfile[ip] = EOS jp = 0 ip = ip + 1 while (stridx (specfile[ip],rbracket) == 0 && ip <= lfile) { jp = jp + 1 specnums[jp] = specfile[ip] specfile[ip] = EOS ip = ip + 1 } if (jp > 0) specnums[jp+1] = EOS else call strcpy ("0",specnums,SZ_LINE) if (decode_ranges (specnums,mspec_range,MAX_RANGES,nmspec) == ERR){ call sprintf (str, SZ_LINE, "T_XCSAO: Illegal multispec list <%s>") call pargstr (specnums) call error (1, str) } } else nmspec = nmspec0 if (debug) { call printf ("XCSAO: next file is %s [%s] = %d aps\n") call pargstr (specfile) call pargstr (specnums) call pargi (nmspec) } # Check for readability of object spectrum call strcpy (specdir,specpath,SZ_PATHNAME) call strcat (specfile,specpath,SZ_PATHNAME) if (imaccess (specpath, READ_ONLY) == NO) { call eprintf ("XCSAO: cannot read spectrum file %s \n") call pargstr (specpath) go to newspec_ } # Get next multispec number from list mspec = -1 sumvel = 0.d0 sumerr = 0.d0 sumr = 0.d0 dnap = 0.d0 nap = 0 newap_ savevel = savevel0 if (nmspec <= 0) go to newspec_ if (get_next_number (mspec_range, mspec) == EOF) go to newspec_ call xcfit (specfile, specdir, mspec, mband, oshift) if (echelle) { nap = nap + 1 Memd[evel+nap-1] = zvel[itmax] sumvel = sumvel + zvel[itmax] sumerr = sumerr + czerr[itmax] sumr = sumr + czr[itmax] dnap = dnap + 1.d0 } # Move on to next aperture or next image nmspec = nmspec - 1 if (nmspec > 0) go to newap_ go to newspec_ # Close the log files endxc_ do i = 1, nlogfd { call close (logfd[i]) } if (debug) { call printf ("Best Template(%d) %s: %.3f (%.3f) R = %.4f\n") call pargi (itmax) call pargstr (tempid[1,itmax]) call pargd (zvel[itmax]) call pargd (czerr[itmax]) call pargd (czr[itmax]) } # Save some results in parameter file call clpstr ("besttemp", tempid[1,itmax]) if (echelle && dnap > 0.d0) { avgvel = sumvel / dnap call clputd ("velocity", avgvel) avgerr = sumerr / dnap call clputd ("velerr", avgerr) avgr = sumr / dnap call clputd ("r",avgr) if (debug) { call printf ("PXCSAO: Median of %d shifts\n") call pargi (nap) call flush (STDOUT) } call median (Memd[evel], nap, medvel, qvel1, qvel2) if (debug) { call printf ("PXCSAO: %d shifts mean=%.3f, median=%.3f\n") call pargi (nap) call pargd (avgvel) call pargd (medvel) call flush (STDOUT) } call clputd ("velmed",medvel) call clputd ("velq1",qvel1) call clputd ("velq2",qvel2) } else { call clputd ("velocity", zvel[itmax]) call clputd ("velerr", czerr[itmax]) call clputd ("r",czr[itmax]) } if (debug) { call printf ("PXCSAO: About to close speclist\n") call flush (STDOUT) } # Close spectrum list call imtclose (speclist) # Free processing vectors allocated in xcfit() if (debug) { call printf ("PXCSAO: About to free xcfit vectors\n") call flush (STDOUT) } if (xcor != NULL) { call mfree (xcor, TY_REAL) xcor = NULL } if (xcor != NULL) { call mfree (xvel, TY_REAL) xvel = NULL } if (shspec != NULL) { call mfree (shspec, TY_REAL) shspec = NULL } if (shtemp != NULL) { call mfree (shtemp, TY_REAL) shtemp = NULL } if (wltemp != NULL) { call mfree (wltemp, TY_REAL) wltemp = NULL } # Free processing vectors allocated in xcorfit() if (debug) { call printf ("PXCSAO: About to free xcorfit vectors\n") call flush (STDOUT) } if (xind != NULL) { call mfree (xind, TY_REAL) xind = NULL } if (xifft != NULL) { call mfree (xifft, TY_REAL) xifft = NULL } if (pft != NULL) { call mfree (pft, TY_REAL) pft = NULL } if (tft != NULL) { call mfree (tft, TY_COMPLEX) tft = NULL } if (ftcfn != NULL) { call mfree (ftcfn, TY_COMPLEX) ftcfn = NULL } if (ft1 != NULL) { call mfree (ft1, TY_COMPLEX) ft1 = NULL } if (ft2 != NULL) { call mfree (ft2, TY_COMPLEX) ft2 = NULL } if (spexp != NULL) { call mfree (spexp, TY_REAL) spexp = NULL } if (xcont != NULL) { call mfree (xcont, TY_REAL) xcont = NULL } # Free plotting vectors allocated in xcplot() if (debug) { call printf ("PXCSAO: About to free xcplot vectors\n") call flush (STDOUT) } if (scont != NULL) { call mfree (scont, TY_REAL) scont = NULL } if (smspec != NULL) { call mfree (smspec, TY_REAL) smspec = NULL } if (cspec != NULL) { call mfree (cspec, TY_REAL) cspec = NULL } if (smcspec != NULL) { call mfree (smcspec, TY_REAL) smcspec = NULL } # Free plotting vectors allocated in xcorplot() if (debug) { call printf ("PXCSAO: About to free xcorplot vectors\n") call flush (STDOUT) } if (xlev != NULL) { call mfree (xlev, TY_REAL) xlev = NULL } if (fraclev != NULL) { call mfree (fraclev, TY_REAL) fraclev = NULL } # Free vector used to compute echelle median shift in t_pxcsao if (debug) { call printf ("PXCSAO: About to free echelle result vector\n") call flush (STDOUT) } if (evel != NULL) { call mfree (evel, TY_DOUBLE) evel = NULL } if (debug) { call printf ("PXCSAO: Exiting\n") call flush (STDOUT) } end # Jul 15 2011 New task based on pxcsao which weights by blaze functions # Mar 27 2015 Link to header and common files in lib/ rvsao-2.8.3/Xcsao/mkpkg0000644000016200001660000000311512505371753014043 0ustar minkoirsys# Make RVSAO library cross-correlation subroutines $checkout librv.a ../bin $update librv.a $checkin librv.a ../bin $exit librv.a: t_xcsao.x ../lib/rvsao.h ../lib/xcv.h ../lib/rvsao.com ../lib/emv.h ../lib/emv.com ../lib/results.com ../lib/xcor.com ../lib/xcorf.com t_pxcsao.x ../lib/rvsao.h ../lib/xcv.h ../lib/rvsao.com ../lib/emv.h ../lib/emv.com ../lib/results.com ../lib/xcor.com ../lib/xcorf.com xcfit.x ../lib/rvsao.h ../lib/xcv.h ../lib/rvsao.com ../lib/results.com ../lib/xcor.com xcorfit.x ../lib/rvsao.h ../lib/rvsao.com ../lib/results.com ../lib/xcorf.com xcplot.x ../lib/rvsao.h ../lib/rvsao.com ../lib/results.com ../lib/emv.h ../lib/emv.com xciplot.x ../lib/rvsao.h ../lib/rvsao.com ../lib/results.com xcorplot.x ../lib/rvsao.h ../lib/rvsao.com ../lib/results.com xcsplot.x ../lib/rvsao.h ../lib/rvsao.com ../lib/results.com xcfile.x ../lib/rvsao.h ../lib/rvsao.com ../lib/results.com pkfitp.x ../lib/rvsao.h ../lib/rvsao.com pkfitq.x ../lib/rvsao.h ../lib/rvsao.com pkfitc.x pknum.x ../lib/rvsao.h ../lib/rvsao.com pkwidth.x ../lib/rvsao.h ../lib/rvsao.com xcrslts.x ../lib/rvsao.h ../lib/rvsao.com ../lib/results.com xcarch.x ../lib/rvsao.h ../lib/rvsao.com ../lib/results.com ../lib/corr.com ../lib/ansum.com xchead.x ../lib/rvsao.h ../lib/emv.h ../lib/rvsao.com ../lib/results.com ../lib/emv.com aspart.x buffers.x earlin.x correlate.x xcmin.x ; rvsao-2.8.3/Xcsao/aspart.x0000644000016200001660000000351307346226460014475 0ustar minkoirsys# File rvsao/Xcor/aspart.x # May 1, 1998 # By Doug Mink, Harvard-Smithsonian Center for Astrophysics # After John Tonry # Copyright(c) 1998 Smithsonian Astrophysical Observatory # You may do anything you like with this file except remove this copyright. # The Smithsonian Astrophysical Observatory makes no representations about # the suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. procedure aspartf (n, k1,k4, shift, x, arms,srms, tfilt) # Compute the anti- and symmetric parts of a complex buffer, shifted by shift # Assume a transform of a real function, and filter cuttoffs k1 and k2. int n int k, k1, k4 # Filter double shift # delta from zero of the correlation peak # in pixels of the log-wavelngth array. complex x[ARB] # Cross-correlation vector double arms # anti-symmetric rms double srms # symmetric rms int tfilt # If =1, template has already been filtered # If =2, turn off high pass filter # If =3, turn off high pass filter on object # and do not filter template double angle, f, aterm, sterm complex phase double pi int n4 begin pi = 3.1415926535897932d0 if (tfilt > 1) { n4 = n } else { n4 = k4 } arms = 0.d0 srms = 0.d0 do k = k1, n4 { angle = -2.d0 * pi * double (k) * shift / double (n) phase = complex (cos(angle), sin(angle)) if (k == 0 || k == n/2) f = 1.d0 else f = 2.d0 aterm = aimag (phase*x[k+1]) sterm = real (phase*x[k+1]) arms = arms + f * aterm * aterm srms = srms + f * sterm * sterm } # Divide by n since it is the transform arms = sqrt (arms) / n srms = sqrt (srms) / n return end # Jul 24 1990 New program # Dec 15 1994 Make high frequency filter optional # Sep 20 1995 Put in 16 digits of PI # May 1 1998 Drop old aspart subroutine rvsao-2.8.3/Xcsao/t_xcsao.x0000644000016200001660000004074012505370720014636 0ustar minkoirsys# File rvsao/Xcor/t_xcsao.x # May 1, 2014 # By Jessica Mink, Harvard-Smithsonian Center for Astrophysics # After Gerard Kriss, Johns Hopkins University and others # Copyright(c) 1989-2014 Smithsonian Astrophysical Observatory # You may do anything you like with this file except remove this copyright. # The Smithsonian Astrophysical Observatory makes no representations about # the suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # XCSAO is an IRAF task for obtaining redshifts and velocity dispersions # using cross correlation methods. For arguments, see parameter file xcsao.par. # Information is shared in common blocks defined in "rvsao.com". include include include include include "../lib/rvsao.h" include "../lib/xcv.h" include "../lib/emv.h" procedure t_xcsao () int i char specfile[SZ_PATHNAME] # Object spectrum file name char specpath[SZ_PATHNAME] # Object spectrum path name char tempfiles[SZ_PATHNAME] # List of template spectra char specdir[SZ_PATHNAME] # Directory for object spectra #char filt_type[SZ_LINE] # Filter for transform # (ramp | welch | hanning | cos-bell) char svel_corr[SZ_LINE] # Type of velocity correction for spectrum # (none | file | heliocentric | barycentric) char tvel_corr[SZ_LINE] # Type of velocity correction for template # (none | file | heliocentric | barycentric) bool savevel0 # Save velocity, error, and R in data file header int rmode # Report format (1=normal,2=one-line) int logfiles # List of log files char logfile[SZ_PATHNAME] # Log file name char wtitle[20] # Title for wavelength plots of spectrum int mspec # Object aperture to read from multispec file int mband # Object band to read from multispec file pointer speclist # List of spectrum files char str[SZ_LINE] int fd char vel_plot[SZ_LINE] # type of velocity for redshifting plot # correlation|emission|combination|search int nmspec0 # Number of object multispec spectra int mspec_range[3,MAX_RANGES] int ip,jp,lfile # Limits for multispec aperture decoding char lbracket[3] # "[({" char rbracket[3] # "])}" bool echelle # If true, template multispec numbers track object char tempnums[SZ_LINE] # List of multispec spectra to read int tspec_range[3,MAX_RANGES] int tspec int ntspec int oshift bool clgetb() int clpopnu(), clgeti(), clgfil(), open() int strdic(), stridx(), stridxs() real clgetr() int decode_ranges(),get_next_number() char vel_init[SZ_LINE] # type of velocity for initial value int imtgetim(), imaccess(), strlen(), ldir, clscan() pointer imtopenp() define newspec_ 10 define newap_ 20 define endxc_ 90 include "../lib/rvsao.com" include "../lib/results.com" include "../lib/emv.com" include "../lib/xcor.com" include "../lib/xcorf.com" include "../lib/xplt.com" begin c0 = 299792.5 qplot = FALSE nfound = 0 maxpix = 0 maxpts4 = 0 call sprintf (lbracket,3,"[({") call sprintf (rbracket,3,"])}") call sprintf (wtitle,20,"Wavelength") ntmp = 0 waverest = 0.d0 specref = 0 maxlength = 0 # Initialize various utility vector pointers xcor = NULL xvel = NULL shspec = NULL shtemp = NULL wltemp = NULL xind = NULL xifft = NULL ft1 = NULL ft2 = NULL ftcfn = NULL tft = NULL pft = NULL spexp = NULL xcont = NULL spexp = NULL xcont = NULL scont = NULL smspec = NULL cspec = NULL smcspec = NULL fraclev = NULL xlev = NULL # Get task parameters. # Spectra to cross-correlate speclist = imtopenp ("spectra") # Multispec spectrum numbers (use only first if multiple files) call clgstr ("specnum",specnums,SZ_LINE) if (decode_ranges (specnums, mspec_range, MAX_RANGES, nmspec0) == ERR){ call sprintf (str, SZ_LINE, "T_XCSAO: Illegal multispec list <%s>") call pargstr (specnums) call error (1, str) } call clgstr ("specdir",specdir,SZ_PATHNAME) ldir = strlen (specdir) if (specdir[1] != EOS && specdir[ldir] != '/') { specdir[ldir+1] = '/' specdir[ldir+2] = EOS } mband = clgeti ("specband") # Templates against which to correlate spectra call clgstr ("templates",tempfiles,SZ_PATHNAME) # Optional correlation plot, where peak may be selected by cursor pltcor = clgetb ("xcor_plot") # Optional intermediate data plot switches pltspec = clgetb ("obj_plot") plttemp = clgetb ("temp_plot") pltcon = clgetb ("contsub_plot") pltapo = clgetb ("apodize_plot") pltfft = clgetb ("fft_plot") pltuc = clgetb ("uxcor_plot") plttft = clgetb ("tfft_plot") # Print processing information debug = clgetb ("debug") # Continuum fit parameter pset call cont_get_pars() # Number of times to smooth (1-2-1) final data plot nsmooth = clgeti ("nsmooth") # Velocity center and width of summary page cross-correlation plot xcr0 = clgetr ("cvel") xcrdif = clgetr ("dvel") # Type of fit for correlation peak and fraction of peak to fit pkmode0 = clgeti ("pkmode") # Type of heliocentric velocity correction to be used call clgstr ("svel_corr",svel_corr,SZ_LINE) svcor = strdic (svel_corr,svel_corr,SZ_LINE, HC_VTYPES) call clgstr ("tvel_corr",tvel_corr,SZ_LINE) tvcor = strdic (tvel_corr,tvel_corr,SZ_LINE, HC_VTYPES) # Type of velocity for initial redshift call clgstr ("vel_init",vel_init,SZ_LINE) vinit = strdic (vel_init,vel_init,SZ_LINE,XC_VTYPES) # Image header result flag savevel0 = FALSE savevel0 = clgetb ("save_vel") # Report mode for log file rmode = 1 rmode = clgeti ("report_mode") # Initialize emission and absorption lines for labelling call eminit (FALSE) # Open log files and write a header. logfiles = clpopnu ("logfiles") call fseti (STDOUT, F_FLUSHNL, YES) i = 0 call strcpy ("rvsao.xcsao",taskname,SZ_LINE) while (clgfil (logfiles, logfile, SZ_PATHNAME) != EOF) { fd = open (logfile, APPEND, TEXT_FILE) if (fd == ERR) break if (rmode == 1) { call loghead (taskname,str) call fprintf (fd, "%s\n") call pargstr (str) } i = i + 1 logfd[i] = fd } nlogfd = i call clpcls (logfiles) # Type of velocity for plotting emission and absorption lines if (clscan("vel_plot") != EOF) { call clgstr ("vel_plot",vel_plot,SZ_LINE) vplot = strdic (vel_plot,vel_plot,SZ_LINE,PL_VTYPES) } else vplot = VCORREL # Set echelle order shift, if any echelle = clgetb ("echelle") oshift = 0 if (echelle) { call clgstr ("tempnum",tempnums,SZ_LINE) if (strlen (tempnums) > 0) { if (decode_ranges (tempnums, tspec_range, MAX_RANGES, ntspec) == ERR) call error (1, "T_XCSAO: Illegal template multispec list") if (get_next_number (tspec_range, tspec) != EOF) { if (get_next_number (mspec_range, mspec) != EOF) { oshift = tspec - mspec if (debug) { call printf ("T_XCSAO: Shifting by %d orders\n") call pargi (oshift) } } } } } # Print tab table headers if (rmode < 0) call xcrshead (rmode) # Get next object spectrum file name from the list newspec_ if (imtgetim (speclist, specfile, SZ_PATHNAME) == EOF) go to endxc_ # Check for specified apertures in multispec spectrum file ip = stridxs (lbracket,specfile) if (ip > 0) { lfile = strlen (specfile) specfile[ip] = EOS jp = 0 ip = ip + 1 while (stridx (specfile[ip],rbracket) == 0 && ip <= lfile) { jp = jp + 1 specnums[jp] = specfile[ip] specfile[ip] = EOS ip = ip + 1 } if (jp > 0) specnums[jp+1] = EOS else call strcpy ("0",specnums,SZ_LINE) if (decode_ranges (specnums,mspec_range,MAX_RANGES,nmspec) == ERR){ call sprintf (str, SZ_LINE, "T_XCSAO: Illegal multispec list <%s>") call pargstr (specnums) call error (1, str) } } else nmspec = nmspec0 if (debug) { call printf ("XCSAO: next file is %s [%s] = %d aps\n") call pargstr (specfile) call pargstr (specnums) call pargi (nmspec) } # Check for readability of object spectrum call strcpy (specdir,specpath,SZ_PATHNAME) call strcat (specfile,specpath,SZ_PATHNAME) if (imaccess (specpath, READ_ONLY) == NO) { call eprintf ("XCSAO: cannot read spectrum file %s \n") call pargstr (specpath) go to newspec_ } # Get next multispec number from list mspec = -1 newap_ savevel = savevel0 savespec = FALSE edited = FALSE if (nmspec <= 0) go to newspec_ if (get_next_number (mspec_range, mspec) == EOF) go to newspec_ call xcfit (specfile, specdir, mspec, mband, oshift) # Move on to next aperture or next image nmspec = nmspec - 1 if (nmspec > 0) go to newap_ go to newspec_ # Close the log files endxc_ do i = 1, nlogfd { call close (logfd[i]) } # Close spectrum list call imtclose (speclist) # Free processing vectors allocated in xcfit() if (debug) { call printf ("XCSAO: About to free xcfit vectors\n") call flush (STDOUT) } if (xcor != NULL) { call mfree (xcor, TY_REAL) xcor = NULL } if (xcor != NULL) { call mfree (xvel, TY_REAL) xvel = NULL } if (shspec != NULL) { call mfree (shspec, TY_REAL) shspec = NULL } if (shtemp != NULL) { call mfree (shtemp, TY_REAL) shtemp = NULL } if (wltemp != NULL) { call mfree (wltemp, TY_REAL) wltemp = NULL } # Free processing vectors allocated in xcorfit() if (debug) { call printf ("XCSAO: About to free xcorfit vectors\n") call flush (STDOUT) } if (xind != NULL) { call mfree (xind, TY_REAL) xind = NULL } if (xifft != NULL) { call mfree (xifft, TY_REAL) xifft = NULL } if (pft != NULL) { call mfree (pft, TY_REAL) pft = NULL } if (tft != NULL) { call mfree (tft, TY_COMPLEX) tft = NULL } if (ftcfn != NULL) { call mfree (ftcfn, TY_COMPLEX) ftcfn = NULL } if (ft1 != NULL) { call mfree (ft1, TY_COMPLEX) ft1 = NULL } if (ft2 != NULL) { call mfree (ft2, TY_COMPLEX) ft2 = NULL } if (spexp != NULL) { call mfree (spexp, TY_REAL) spexp = NULL } if (xcont != NULL) { call mfree (xcont, TY_REAL) xcont = NULL } # Free plotting vectors allocated in xcplot() if (debug) { call printf ("XCSAO: About to free xcplot vectors\n") call flush (STDOUT) } if (scont != NULL) { call mfree (scont, TY_REAL) scont = NULL } if (smspec != NULL) { call mfree (smspec, TY_REAL) smspec = NULL } if (cspec != NULL) { call mfree (cspec, TY_REAL) cspec = NULL } if (smcspec != NULL) { call mfree (smcspec, TY_REAL) smcspec = NULL } # Free plotting vectors allocated in xcorplot() if (debug) { call printf ("XCSAO: About to free xcorplot vectors\n") call flush (STDOUT) } if (xlev != NULL) { call mfree (xlev, TY_REAL) xlev = NULL } if (fraclev != NULL) { call mfree (fraclev, TY_REAL) fraclev = NULL } end # Mid 1970's Paul Schechter -- Data windowing routines. Some functions # from the IBM SSP library. # June 1987 Gerard Kriss -- Wrote major portions in SPP. # June 1988 Stephen Levine -- major revisions # Sept 1989 Doug Mink--add parameters for 2-d echelle # April 1990 add more fft filters and bcv # add option to resize velocity graph # June 1990 add emission line chopping # July 1990 rebin spectrum for each template # add John Tonry's fft # add Guillermo Torres' peak fit # Sept 1990 add optional archive record output # Oct 1990 add pixel limits for redshift # add normalization of spectra # add smoothing to spectrum display # Dec 1990 add archive flag # Jan 1991 write velocity to image header # add velocities or multiply 1+v/c's # Mar 1991 plot final velocity correlation # June 1991 make all velocities double # add IRAF continuum fitting # Sept 1991 add second pass to align template # add plot options at end # Nov 14 1991 Change label strings to char variables instead of literals # move vcombine and write combined velocities to header # Nov 15 1991 Clean up debug formats # Nov 18 1991 Change lsrplot calls to spplot and xcplot # Nov 20 1991 Free str and logfile if necessary # Dec 5 1991 Set velxc, vxerr, and vr for absorbtion line plot # Dec 12 1991 Free object and template spectra when done # Dec 16 1991 Set wavelength vector for region being cross-correlated # Feb 18 1992 If multispec, write results to aperture-dependent strings # Mar 27 1992 Get shift limits in velocity; get velocity vector from xcorfit # Apr 20 1992 Pass mspec as argument # Apr 22 1992 Put all cursor interaction and plotting into xcplot # May 22 1992 Initialize mspec and tspec to -1 # Aug 12 1992 Add HISTORY line about XCSAO; drop polynomial continuum option # Oct 9 1992 Read "echelle" parameter # Nov 30 1992 Move spectrum smoothing to xcplot # Feb 1 1993 Allow INDEF for wavelength limit parameters # Feb 2 1993 Exit if a zero spectrum is found when renormalizing # May 4 1993 Add option to save correlation to a file # May 10 1993 Fix correlation writing # May 18 1993 Move correlation file output to subroutine xcprint # Jun 2 1993 Move wavelength <-> pixel conversion to subroutines # Jun 14 1993 Use run-time allocation for all spectrum and wavelength vectors # Jun 16 1993 Set version to 1.1; use shdr for wavelength conversions # Jul 1 1993 Pass spectrum header structure to rebinl # Jul 7 1993 Add spectrum header to getspec and gettemp # Jul 8 1993 Close sh properly # Aug 4 1993 Print error message and exit if there is no overlap # Aug 20 1993 Deal with double wavelength vector # Dec 2 1993 Only write history line once for multispec files # Dec 2 1993 Pass mspec to xc_rslts # Dec 3 1993 Update to version 1.2 # Feb 3 1994 Proceed gracefully if files are not useable # Feb 11 1994 Add correlation file name list. # Mar 23 1994 Add multispec aperture specification for each image # Mar 23 1994 Update to version 1.3 # Apr 6 1994 Change smooth parameter to nsmooth for consistency # Apr 12 1994 Return MWCS header pointer from getspec and gettemp # Apr 13 1994 Drop unused variable imax # Apr 15 1994 Initialize world coordinate system for spectrum # Apr 19 1994 Pass object spectrum label as variable, not literal # Apr 20 1994 Drop 2nd argument from IMTOPEN call # Apr 26 1994 Use spectrum header wavelength vector directly # Apr 26 1994 Use arrays rather than pointers when possible # May 9 1994 Add number of times to smooth spectrum argument to PLOTSPEC call # May 23 1994 Fix error message when not able to write to file # May 23 1994 Keep smoothed spectrum local to XCPLOT # Jun 15 1994 Move filtered-template flag from parameter list to image file # Jun 15 1994 Ignore template directory for template names with / in them # Jun 23 1994 Keep MWCS pointer in SHDR structure # Jun 24 1994 Set spectrum velocity in common # Jun 24 1994 Update to version 1.4 # Jul 29 1994 Read version from fquot.h # Aug 3 1994 Change emission line chopping flags # Aug 3 1994 Change common and header from fquot to rvsao # Aug 4 1994 Keep nmspec in labelled common # Aug 8 1994 Add specdir as parameter # Aug 10 1994 Write log heading in one line instead of two # Aug 24 1994 Fix bug so SPECDIR can be null # Dec 19 1994 Move renorm and filter parameters to XCFIT # Jan 31 1995 Change lengths of file and directory names to sz_pathname # Mar 9 1995 Move zero-padding to XCFIT # Apr 5 1995 Change solar system velocity correction flags # May 15 1995 Change all sz_fname to sz_line, which is 100 chars longer # May 17 1995 Fix bug in bracket -> mspec code # Aug 11 1995 Move PKFRAC to XCFIT # Oct 4 1995 Default SPECNUMS to 0 if null string is input # Aug 7 1996 Use smw.h # Jan 24 1997 Drop phase plot; add transformed transform plot # Apr 9 1997 Deal with null aperture list in DECODE_RANGES, not here # Apr 14 1997 Add option to plot template spectra # Aug 27 1997 Add parameter for spectrum multspec band # Apr 6 1999 Initialize number of cached templates to zero # Jul 16 1999 Initialize qplot to FALSE # Jul 28 1999 Print tab table headers, if appropriate # Aug 19 1999 Set vplot from vel_plot parameter # Sep 17 2002 Initialize and free processing vectors (allocated in xcfit) # Dec 1 2006 Fix bug so apertures can be in brackets in file name # Jun 20 2007 Initialize and free transform vectors in xcorf.com # Jun 25 2007 Add xcont and spexp pointer initialization # Aug 2 2007 Drop nctemp as templates are no longer cached # Aug 13 2007 Free xcont and spexp at end of program # Aug 13 2007 Set maxpix = 0 so plot buffers are initialized when needed # Aug 13 2007 Include xplt.com to allocate buffers only when needed # Mar 13 2009 Compute order shift and send to xcfit # Jul 22 2010 Initialize all pointers and free any which are not set to NULL # May 1 2014 Initialize edited and savespec to FALSE for each spectrum # Mar 27 2015 Link to header and common files in lib/ rvsao-2.8.3/Xcsao/xcmin.x0000644000016200001660000001565611050413662014321 0ustar minkoirsys# File rvsao/Xcor/xcmin.x # August 12, 2008 # By Doug Mink, Harvard-Smithsonian Center for Astrophysics # After John Tonry's MINI (Revision 2.0, 11/17/82.) # Copyright(c) 1991-2008 Smithsonian Astrophysical Observatory # You may do anything you like with this file except remove this copyright. # The Smithsonian Astrophysical Observatory makes no representations about # the suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # Black box minimization (and fitting) program. procedure xcmin (npts,x,y,n,a,debug,covar,ierr) int npts # Dimension of data vector real x[ARB] # Independent variable vector real y[ARB] # Data vector including data to be fit int n # Number of parameters to be varied in searching # for a minimum. double a[ARB] # This vector serves three purposes: # it passes the initial estimate for the parameters # it passes arguments to the function to be minimized # it returns the minimum parameter values bool debug # Print diagnostic messages if TRUE double covar[ARB] # RETURNED diagonal of covariance matrix int ierr # RETURNED error condition: # 0 for no error # 1 for maximum iteration exceeded # 2 for singular matrix # descriptions of some of the variables: # a - argument for the function # a0 - current guess for the minimum # ai - increments for a0 in computing derivatives # da - vector from a0 to new guess for the minimum # df - first derivatives of the function # d2f - second derivatives of the function # lambda - governs mix of gradient and analytic searches # iter - maximum number of iterations # qfrac - maximum fractional change for successful exit # # The calling program should be as follows: #******************************************************** # real rdata[npts] # double a[4] # double covar[4] # ... (initialize a to the guess for the minimum) # call xcmin (npts,x,y,4,a,debug,covar,ier) # ... # procedure mfunk (npts,x,y,a,chi) # real x(npts),y(npts) # double a[4], chi # ... (define the function) #************************************************************ double df[16],a0[16],da[16],ai[16] double d2f[16,16],cov[16,16] double fnow, fthen, fminus, curve, qfrac, dfrac, places, vary, det double base, chi, err int lambda,itermax, i,j,k, ii, iter begin # Quit if n is greater than the space allocated if (n > 16) { call printf ("XCMIN: too many parameters, maximum = 16\n") return } if (debug) { call printf ("XCMIN: %d points fit with %d parameters\n") call pargi (npts) call pargi (n) } # Define a few parameters lambda = -3 base = 10.d0 # itermax = 20 itermax = 40 qfrac = 1.d-6 dfrac = .02d0 places = 1.d-7 vary = 1.d-5 # Initialize a0 call amovd (a, a0, n) call aclrd (cov,256) call aclrd (d2f,256) iter = 0 call mfunk (npts,x,y,a,fnow) # if (debug) call mvprint(n,a0,fnow,iter,lambda) # Initialize ai do i = 1, n { ai[i] = dabs (vary * a0[i]) if (ai[i] == 0) ai[i] = 1d-6 } # Begin iteration to find minimum do iter = 1, itermax { fthen = fnow # Initialize parameters call amovd (a0, a, n) # Numerical derivatives # 1st derivatives do j = 1,n { a[j] = a0[j] + ai[j] call mfunk (npts,x,y,a,df[j]) a[j] = a0[j] } # off-diagonal 2nd derivatives. do j = 2,n { do k = 1,j-1 { a[k] = a0[k] + ai[k] a[j] = a0[j] + ai[j] call mfunk (npts,x,y,a,chi) if (ai[j] == 0.0) { call printf ("XCMIN: ai[%d] is zero\n") call pargi (j) d2f[j,k] = 0.0 } else if (ai[k] == 0.0) { call printf ("XCMIN: ai[%d] is zero\n") call pargi (k) d2f[j,k] = 0.0 } else { d2f[j,k] = (chi - df[j] - df[k] + fnow) / (ai[j]*ai[k]) } d2f[k,j] = d2f[j,k] a[j] = a0[j] a[k] = a0[k] } } # On-diagonal 2nd derivatives, and fix the 1st ones. do j = 1,n { a[j] = a0[j] - ai[j] call mfunk (npts,x,y,a,fminus) if (ai[j] == 0.0) { call printf ("XCMIN: ai[%d] is zero\n") call pargi (j) d2f[j,j] = 0.0 } else { d2f[j,j] = (fminus + df[j] - 2*fnow) / (ai[j]*ai[j]) } df[j] = (df[j] - fminus) / (2*ai[j]) a[j] = a0[j] } # Compute better estimates for the increments. do j = 1, n { curve = d2f[j,j] if (curve == 0) curve = 1.d-5 ai[j] = sqrt ((df[j] * dfrac/curve)**2 + abs(fnow*places/curve)) } # Begin loop to find a direction along which function decreases do ii = 1, 15 { # Get weight matrix do j = 1, n { do k = 1, j-1 { cov[j,k] = d2f[j,k] cov[k,j] = d2f[j,k] } cov[j,j] = dabs (d2f[j,j] * (1.d0 + base**lambda)) } call matinv (cov,n,det) if (det == 0) { if (debug) call printf ("XCMIN: singular matrix\n") do j = 1, n { do k = 1, j-1 { cov[j,k] = d2f[j,k] cov[k,j] = d2f[j,k] } cov[j,j] = dabs(d2f[j,j]*(1 + base**lambda)) } ierr = 2 return } # Multiply to get dA do j = 1, n { da[j] = 0 do k = 1, n { da[j] = da[j] - (cov[j,k] * df[k]) } } # Get new function value do j = 1, n { a[j] = a0[j] + da[j] } call mfunk (npts,x,y,a,fnow) # Test for whether the function has decreased # If so, adopt the new point and decrement lambda # else, increment lambda, and get a new weight matrix if (fnow < fthen) break lambda = lambda + 1 } # normal exit, the function at a0 + da is less than at a0 call amovd (a,a0,n) lambda = lambda - 1 # print the current status and test to see whether the function # has varied fractionally less than qfrac. # if (debug) call mvprint(n,a0,fnow,iter,lambda) if (dabs ((fthen - fnow)/fnow) < qfrac) break } # this is the final computation of the covariance matrix # quit if no minimum was found in the allowed number of iterations if (iter > itermax) { if (debug) call printf ("XCMIN: maximum iteration exceeded\n") ierr = 1 } else ierr = 0 # finally, compute the covariance matrix do j = 1, n { do k = 1, n { cov[j,k] = d2f[j,k] / 2.d0 } } call matinv (cov,n,det) do j = 1, n { err = sqrt (abs (cov[j,j])) if (cov[j,j] < 0) err = -err cov[j,j] = err } do j = 2, n { do k = 1, j-1 { cov[j,k] = cov[j,k] / (cov[j,j]*cov[k,k]) cov[k,j] = cov[j,k] } } do j = 1, n { covar[j] = cov[j,j] } return end # simple subroutine to print the current parameters procedure mvprint (n,a,fnow,niter,lambda) int n double a[ARB] double fnow int niter int lambda int i begin call printf (" a(i) = ") do i = 1, n { call printf ("%10.4f ") call pargd (a[i]) } call printf ("\n f = %15.7g iter = %d lambda = %d\n") call pargd (fnow) call pargi (niter) call pargi (lambda) return end # Oct 31 1991 New program # Apr 13 1994 Drop unused variable n2 # Aug 12 2008 Fix error messages to report correct subroutine # Aug 12 2008 Add checks for divide by zero rvsao-2.8.3/Xcsao/buffers.x0000644000016200001660000000272007346226174014640 0ustar minkoirsys# File rvsao/Xcor/buffers.x # September 16, 1991 # By Doug Mink, Harvard-Smithsonian Center for Astrophysics # After John Tonry and Guillermo Torres # Copyright(c) 1991 Smithsonian Astrophysical Observatory # You may do anything you like with this file except remove this copyright. # The Smithsonian Astrophysical Observatory makes no representations about # the suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # Various subroutines to copy and flip buffers #--- Copy a real buffer to a complex one procedure rcvec (n,buf,x) int n # Length of vectors real buf[n] # Real vector complex x[n] # Complex vector (returned) int j begin do j = n,1,-1 { x[j] = complex (buf[j]) } return end #--- Copy a complex buffer to a real one procedure crvec (n,x,buf) int n # Length of vectors complex x[n] # Complex vector real buf[n] # Real*4 vector (returned) int j begin do j = 1, n { buf[j] = real (x[j]) } return end #--- Reverse the order of a real vector procedure flip (n,buf) int n # Length of vector real buf[n] int j real temp begin do j = 1, n/2 { temp = buf[j] buf[j] = buf[j+n/2] buf[j+n/2] = temp } return end #--- Reverse the order of a complex vector procedure cflip (n,buf) int n # Length of vector complex buf[n] complex temp int j begin do j = 1, n/2 { temp = buf[j] buf[j] = buf[j+n/2] buf[j+n/2] = temp } return end rvsao-2.8.3/Xcsao/earlin.x0000644000016200001660000001071011233675434014451 0ustar minkoirsys# File rvsao/Xcor/earlin.x # July 28, 2009 # By Doug Mink, Harvard-Smithsonian Center for Astrophysics # Copyright(c) 1991-2009 Smithsonian Astrophysical Observatory # You may do anything you like with this file except remove this copyright. # The Smithsonian Astrophysical Observatory makes no representations about # the suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. define NMAX 1024 procedure earlin (x, y, n, v, meg) real x[ARB] # Cross-correlation vector indices real y[ARB] # Cross-correlation vector int n # Number of points used in peak fit double v[ARB] # Fit vector (returned) int meg # Number of coefficients in fit double c[NMAX,NMAX],xx[NMAX],e[NMAX],det,xxx int m,mp1,i,j,k,jmi,nmx begin nmx = NMAX - 1 if (n > nmx) { call eprintf ("*** Too many points in correlation, %d -> %d\n") call pargi (n) call pargi (nmx) n = nmx } m = abs (meg) mp1 = m + 1 do i = 1, m { do j = 1, mp1 { c[i,j] = 0.d0 } } do i = 1, n { xxx = 1.d0 do j = 1, m { if (j != 1) xxx = xxx * x[i] xx[j] = xxx c[j,m+1] = c[j,m+1] + xx[j] * y[i] do k = 1,j { c[j,k] = c[j,k] + xx[j] * xx[k] } } } do j = 2, m { jmi = j - 1 do k = 1, jmi { c[k,j] = c[j,k] } } call dsimul (m,c,v,0.d0,0,NMAX,det) if (meg < 0) return do i = 1, m { e[i] = sqrt (c[i,i]) do j = 1, i { c[i,j] = c[i,j] / (e[i] * e[j]) } } return end procedure dsimul (n,a,x,eps,indic,nrc, deter) #--- This function returns the value of the determinant of a # matrix. in addition, the inverse matrix may be calculated # in place, and the solution vector of the corresponding linear # system computed. Gauss-jordan elimination with maximum # pivot strategy is employed, using double precision arithmetic. # if the matrix exceeds the maximum size (NMAX by NMAX), or if it is # singular, a true zero is returned. int n # Size of the matrix (n by n) double a[nrc,nrc] # Matrix double x[n] # Solution vector double eps # Small number to be used as a test for singularity int indic # Control parameter: # <0, the inverse is computed in place # =0, the matrix is assumed to be augmented # and the solution and inverse are computed # >0, only the solution is computed int nrc # Dimension of A in the calling program double deter # Determinant double y[NMAX],aijck,pivot int irow[NMAX],jcol[NMAX],jord[NMAX] int max,i,j,k,iscan,jscan,irowi,jcoli,intch,jtemp,km1,nm1,ip1 int irowj,jcolj,irowk,jcolk bool bflag begin max = n if (indic >= 0) max = n + 1 if (n > NMAX) { deter = 0.d0 return } deter = 1.0 d0 do k = 1, n { km1 = k - 1 pivot = 0.d0 do i = 1, n { do j = 1, n { bflag = FALSE if (k > 1) { do iscan = 1, km1 { if (i == irow[iscan]) { bflag = TRUE break } } do jscan = 1, km1 { if (j == jcol[jscan]) { bflag = TRUE break } } } if (dabs(a[i,j]) > dabs(pivot) && !bflag) { pivot = a[i,j] irow[k] = i jcol[k] = j } } } if (abs (pivot) <= eps) { deter = 0.d0 return } irowk = irow[k] jcolk = jcol[k] deter = deter * pivot do j = 1, max { a[irowk,j] = a[irowk,j] / pivot } a[irowk,jcolk] = 1.d0 / pivot do i = 1,n { aijck = a[i,jcolk] if (i != irowk) { a[i,jcolk] = -aijck / pivot do j = 1,max { if (j != jcolk) a[i,j] = a[i,j] - (aijck * a[irowk,j]) } } } } do i = 1,n { irowi = irow[i] jcoli = jcol[i] jord[irowi] = jcoli if (indic >= 0) x[jcoli] = a[irowi,max] } intch = 0 nm1 = n - 1 do i = 1, nm1 { ip1 = i + 1 do j = ip1, n { if (jord[j] < jord[i]) { jtemp = jord[j] jord[j] = jord[i] jord[i] = jtemp intch = intch + 1 } } } if (intch/2*2 .le. intch) deter = -deter if (indic > 0) { return } do j = 1, n { do i = 1, n { irowi = irow[i] jcoli = jcol[i] y[jcoli] = a[irowi,j] } do i = 1, n { a[i,j] = y[i] } } do i = 1, n { do j = 1, n { irowj = irow[j] jcolj = jcol[j] y[irowj] = a[i,jcolj] } do j = 1, n { a[i,j] = y[j] } } return end # Sep 16 1991 Program written # Feb 21 1995 Increase maximum dimension from 11 to 256 # Apr 21 1997 Use parameter NMAX for maximum dimension of 512 # Jul 28 2009 Increase maximum number of points, NMAX, from 512 to 1024 rvsao-2.8.3/Xcsao/correlate.x0000644000016200001660000001713210557674775015203 0ustar minkoirsys# File rvsao/Xcor/correlate.x # January 30, 2007 # By Doug Mink, Harvard-Smithsonian Center for Astrophysics # After John Tonry and Guillermo Torres # Copyright(c) 1993-2007 Smithsonian Astrophysical Observatory # You may do anything you like with this file except remove this copyright. # The Smithsonian Astrophysical Observatory makes no representations about # the suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # Various subroutines to perform correlations and other things procedure correl (n,ft1,ft2,cfn) int n complex ft1[ARB] complex ft2[ARB] complex cfn[ARB] int j begin do j = 1, n { cfn[j] = ft1[j] * conjg (ft2[j]) } return end procedure rmsfil (n, k1,k2,k3,k4, x, tflag, tfilt, debug, rms, sqnc) # return the rms of a real function passed through a bandpass filter in # fourier space. the bandpass is the square root of a cosine bell. int n # Number of point in transform int k1,k2,k3,k4 # Filter limits complex x[ARB] # Transform for which to compute RMS bool tflag # If yes, template, else object int tfilt # If =1, template has already been filtered # If =2, turn off high pass filter # If =3, turn off high pass filter on object # and do not filter template bool debug # True for debugging information double rms # RMS (returned) double sqnc # Square root of number of points in sigma double pi,arg,factor,f int n1,n2,n3,n4 # Filter limits used to compute RMS int k, nc begin # Turn off filter on template altogether, if requested if ((tfilt == 1 || tfilt == 3) && tflag) { n1 = 0 n2 = 0 n3 = n - 1 n4 = n - 1 } # Turn off high end filtering, if requested else if (tfilt > 1) { n1 = k1 n2 = k2 n3 = n n4 = n } # Otherwise, keep filter else { n1 = k1 n2 = k2 n3 = k3 n4 = k4 } nc = n4 - n1 + 1 if (nc > 0) sqnc = sqrt (double (nc)) else sqnc = 1.d0 if (debug) { call printf ("RMSFIL: filter is %d %d %d %d, nc = %f\n") call pargi (n1) call pargi (n2) call pargi (n3) call pargi (n4) call pargd (sqnc) } pi = 3.1415926535897932d0 rms = 0.d0 do k = n1, n4 { if (k == 0 || (k == n/2)) f = 1.d0 else f = 2.d0 if (k < n2) { arg = pi * double (k-n1) / double (n2-n1) factor = .5d0 * (1.d0 - cos (arg)) } else if (k > n3) { arg = pi * double (k-n3) / double (n4-n3) factor = .5d0 * (1.d0 + cos (arg)) } else factor = 1.d0 rms = rms + f * factor * (real(x[k+1])*real(x[k+1]) + aimag(x[k+1])*aimag(x[k+1])) } # because it is the transform rms = sqrt (rms) / double (n) if (debug) { call printf ("RMSFIL: rms is %f\n") call pargd (rms) } return end procedure rmsnorm (n, x1, x2, debug, rms1, rms2, fnorm) # return the correlation normalization based on two Fourier transforms # which have already been filtered int n # Number of points in each transform complex x1[ARB] # Spectrum transform complex x2[ARB] # Template transform bool debug # True for debugging information double fnorm # Normalization factor (returned) double rms1, rms2 # RMS for spectrum and template double f, dn, xr, xi, rms1n, rms2n int k, nc1 begin nc1 = n - 1 dn = double (n) rms1 = 0.d0 do k = 0, nc1 { if (k == 0 || (k == n/2)) f = 1.d0 else f = 2.d0 xr = real (x1[k+1]) xi = aimag (x1[k+1]) rms1 = rms1 + f * ((xr * xr) + (xi * xi)) } # because it is the transform rms1n = sqrt (rms1) rms1 = rms1n / dn rms2 = 0.d0 do k = 0, nc1 { if (k == 0 || (k == n/2)) f = 1.d0 else f = 2.d0 xr = real (x2[k+1]) xi = aimag (x2[k+1]) rms2 = rms2 + f * ((xr * xr) + (xi * xi)) } # because it is the transform rms2n = sqrt (rms2) rms2 = rms2n / dn # Compute the normalization factor if (rms1 != 0. && rms2 != 0.) fnorm = 2.d0 / (rms1 * rms2 * dn) else if (rms1 != 0.) fnorm = 2.d0 / rms1n else if (rms2 != 0.) fnorm = 2.d0 / rms2n else fnorm = 2.d0 / dn if (debug) { call printf ("RMSNORM: rms = %10g, %10g, n = %d, fnorm = %10g\n") call pargd (rms1) call pargd (rms2) call pargi (n) call pargd (fnorm) } return end # Filter a Fourier tranform by multiplying by a cosine bell procedure flter (n, k1,k2,k3,k4, x, tfilt) int n,k1,k2,k3,k4 complex x[ARB] int tfilt # If =1, do not filter template # If =2, turn off high pass filter # If =3, turn off high pass filter on object # and do not filter template int j, numa ,number, n1, n2, n3, n4 double arg, factor, pi begin pi = 3.1415926535897932d0 # Turn off high end filtering, if requested if (tfilt > 1) { n1 = k1 n2 = k2 n3 = n n4 = n } # Otherwise, keep filter else { n1 = k1 n2 = k2 n3 = k3 n4 = k4 } do j = 1, n { if (j < n/2+1) number = j - 1 else number = j - n - 1 numa = abs (number) if ((numa < n1) || (numa > n4)) x[j] = 0.d0 else if (numa < n2) { arg = pi * double (numa-n1) / double (n2-n1) factor = .5d0 * (1.d0 - cos (arg)) x[j] = x[j] * factor } else if (numa > n3) { arg = pi * double (numa-n3) / double (n4-n3) factor = .5d0 * (1.d0 + cos (arg)) x[j] = x[j] * factor } } return end procedure flter2 (n, k1,k2,k3,k4, x, tfilt) # filter a fourier tranform by multiplying by square-root cosine bell int n,k1,k2,k3,k4 complex x[ARB] int tfilt # If =1, do not filter template # If =2, turn off high pass filter # If =3, turn off high pass filter on object # and do not filter template int j, numa ,number int n1,n2,n3,n4 # Filter limits used double arg, factor, pi begin pi = 3.1415926535897932d0 # Turn off high end filtering, if requested if (tfilt > 1) { n1 = k1 n2 = k2 n3 = n n4 = n } # Otherwise, keep filter else { n1 = k1 n2 = k2 n3 = k3 n4 = k4 } do j = 1, n { if (j < n/2+1) number = j - 1 else number = j - n - 1 numa = abs (number) if ((numa < n1) || (numa > n4)) x[j] = 0.d0 else if (numa < n2) { arg = pi * double (numa-n1) / double (n2-n1) factor = .5d0 * (1.d0 - cos (arg)) x[j] = x[j] * sqrt (factor) } else if (numa > n3) { arg = pi * double (numa-n3) / double (n4-n3) factor = .5d0 * (1.d0 + cos (arg)) x[j] = x[j] * sqrt (factor) } } return end # compute the phase of a complex function procedure phband (n,shift,x,phase) int n double shift complex x[ARB] real phase[ARB] double pi,angle,npi int i,ncycle begin pi = 3.1415926535897932d0 do i = 1, n { angle = 2.d0 * pi * double (i-1) * shift / double (n) if ((aimag (x[i]) == 0.) || (real (x[i]) == 0.)) phase[i] = 0. else phase[i] = atan2 (aimag(x[i]), real(x[i])) npi = (phase[i] - angle) / pi if (npi > 0) ncycle = (npi + 1) / 2 else ncycle = (npi - 1) / 2 phase[i] = phase[i] - (2.d0 * pi * double (ncycle)) if (i < n/2) phase[i+n/2] = phase[i] - angle } return end # Feb 25 1993 change .or. to || in line 134 # Jun 23 1994 In FLTER, use TFILT to tell whether template hass been filtered # Dec 7 1994 In FLTER, also use TFILT to turn off high end of filter. # Dec 15 1994 In RMSFIL, use TFILT to turn off all or high end of filter. # Dec 16 1994 Return number of points used by RMSFIL # Dec 19 1994 Filter transforms, not correlation # Feb 10 1995 Really use square root in flter2 # May 10 1995 Limit length of diagnostic numbers in RMSNORM to 10 # May 11 1995 Print n in RMSNORM # Jan 30 2007 Remove unnecessary parentheses rvsao-2.8.3/Xcsao/xcplot.x0000644000016200001660000004672512505351764014527 0ustar minkoirsys# File rvsao/Xcor/xcplot.x # July 22, 2010 # By Doug Mink, Harvard-Smithsonian Center for Astrophysics # Copyright(c) 1992-2010 Smithsonian Astrophysical Observatory # You may do anything you like with this file except remove this copyright. # The Smithsonian Astrophysical Observatory makes no representations about # the suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # XCPLOT uses IRAF plot routines to plot a spectrum and its cross-correlation. # The spectrum can also be plotted with labelled absorption lines. ########################################################################### include include include include include include include include "../lib/rvsao.h" include "../lib/emv.h" procedure xcplot (wlspec, spectrum, npix, xvel, xcor, nvel, ncor2, specfile, mspec, specim, newfit) real wlspec[ARB] # Wavelengths for object spectrum real spectrum[ARB] # Object spectrum int npix # Number of pixels in object spectrum real xvel[ARB] # Velocities for cross-correlation real xcor[ARB] # Cross-correlation int nvel[ARB] # Number of points in cross-correlation int ncor2 # Maximum number of points in cross-correlation char specfile[ARB] # Spectrum file name int mspec # Number of spectrum to read from multispec file pointer specim # Spectrum image header structure bool newfit # Rerun correlation if true double strtwav # Wavelength of first correlation pixel double finwav # Wavelength of last correlation pixel char command[SZ_FNAME] double dtemp int jtemp, i, j, ip, it0, it char linebuf[SZ_LINE] int wc, key double pix1,pix2 real wx, wy int dispmod0 pointer gt, gfd, gfp char device[SZ_FNAME] # Display on which to plot data char plotter[SZ_FNAME] # Device on which to make hardcopy bool cursor # true if waiting for cursor after plotting bool hardcopy # true to make automatic hard copy and plot bool displot int dispmode pointer openplot() int ixi # Index into xvel and xcor for a given template int ipix1, ipix2, ix, npix0 int itemp # Template for which to plot cross-correlation peak double wl double wav1, wav2 # Wavelength limits for spectrum bool zfirst char xlab[SZ_LINE+1] int strlen() int getline() int gt_gcur() pointer gt_init(), gopen() bool clgetb() int clgeti(), ctoi(), clscan() double ctod() define endplot_ 90 int rcompx() extern rcompx() double wcs_p2w() include "../lib/rvsao.com" include "../lib/results.com" include "../lib/emv.com" include "../lib/xplt.com" begin # Set wavelength limts for line-labelled plot pix1 = 1.d0 pix2 = double (npix) call wcs_set (specsh) wav1 = wcs_p2w (pix1) wav2 = wcs_p2w (pix2) # Sort templates by R-value itemp = itmax do i = 1, ntemp { itr[i] = i } call gqsort (itr, ntemp, rcompx, czr) it0 = 1 # Allocate memory for continuum-substracted spectrum if (npix > maxpix) { if (scont != NULL) { call mfree (scont, TY_REAL) scont = NULL } if (cspec != NULL) { call mfree (cspec, TY_REAL) cspec = NULL } if (smspec != NULL) { call mfree (smspec, TY_REAL) smspec = NULL } if (smcspec != NULL) { call mfree (smcspec, TY_REAL) smcspec = NULL } maxpix = npix call malloc (scont, npix, TY_REAL) call malloc (cspec, npix, TY_REAL) call malloc (smspec, npix, TY_REAL) call malloc (smcspec, npix, TY_REAL) } # Subtract continuum and chop unwanted lines from spectrum using ICFIT call amovr (spectrum, Memr[cspec], npix) call icsubcon (npix,Memr[cspec],wlspec,specfile,1,nsmooth,Memr[scont]) # Smooth spectrum for plotting call amovr (spectrum,Memr[smspec],npix) call smooth (Memr[smspec],npix,nsmooth) call amovr (Memr[cspec], Memr[smcspec], npix) call smooth (Memr[smcspec],npix,nsmooth) strtwav = twl1[itemp] finwav = twl2[itemp] # strtwav = wav1 # finwav = wav2 if (clscan ("dispmode") == EOF) dispmode = 2 else dispmode = clgeti ("dispmode") dispabs = TRUE zfirst = TRUE if (spnl > 0 || plotem) dispem = TRUE else { dispem = FALSE do i = 1, ntemp { if (!tschop[i] && czr[i] > 4.0) { dispem = TRUE plotem = TRUE } } } ixi = (itemp-1) * ncor2 + 1 # Print hard copy, if requested hardcopy = clgetb ("hardcopy") if (hardcopy) { # Open plotter call clgstr ("plotter",plotter,SZ_FNAME) gfp = openplot (plotter) if (dispmode == 2) call emeplot(gfp,specfile,specim,mspec,Memr[smspec],wlspec,npix) else if (dispmode == 3) call emeplot(gfp,specfile,specim,mspec,Memr[smspec],wlspec,-npix) # Plot spectrum, cross-correlation, and template information else { call xcsplot (gfp,npix,wlspec,Memr[smspec],strtwav,finwav,dispmode) call xciplot (gfp,specfile,specim,mspec,strtwav,finwav) call xcorplot (gfp,nvel[itemp],xvel[ixi],xcor[ixi],it0) } if (debug) { call printf ("XCPLOT: Making hardcopy on %s\n") call pargstr (plotter) } # Close plotter call closeplot (gfp) } # If not displaying data, return displot = clgetb ("displot") if (!displot) { return } # Plot spectrum with absorption and emission lines labelled ipix1 = 1 ipix2 = npix if (dispmode > 1) { xfit = FALSE call emplot (specfile,specim,mspec,npix,spectrum, Memr[smspec],Memr[cspec],Memr[smcspec], wlspec,ipix1,ipix2) if (debug && savevel) call printf ("XCPLOTafterEMPLOT: Save new velocity\n"); if (debug && savespec) call printf ("XCPLOTafterEMPLOT: Save edited spectrum\n"); if (debug && !savespec) call printf ("XCPLOTafterEMPLOT: Not saving edited spectrum\n"); call flush (STDOUT) if (!plotcorr) { if (xfit) { call printf ("Rerun cross-correlation\n") newfit = TRUE } call flush (STDOUT) return } call printf ("Plotting correlation with summary\n") call flush (STDOUT) } # Open display call clgstr ("device",device,SZ_FNAME) gfd = openplot (device) # Plot spectrum, cross-correlation and template information call xcsplot (gfd,npix,wlspec,Memr[smspec],strtwav,finwav,dispmode) call xciplot (gfd,specfile,specim,mspec,strtwav,finwav) call xcorplot (gfd,nvel[itemp],xvel[ixi],xcor[ixi],it0) call gflush (gfd) # If not using cursor, return cursor = clgetb ("curmode") if (!cursor) { call closeplot (gfd) return } # Accept cursor commands newfit = FALSE gt = gt_init() npix0 = npix while (gt_gcur ("cursor", wx, wy, wc, key, command, SZ_FNAME) != EOF) { wl = wx ix = ipix1 do i = ipix1, ipix2 { if (wl >= wlspec[i] && wx < wlspec[i+1]) { if (wl - wlspec[i] > 0.5) ix = i else ix = i + 1 break } } switch (key) { # Toggle debug flag case 'd': call gclose (gfd) if (debug) { call printf ("debugging off\n") debug = FALSE } else { debug = TRUE call printf ("debugging on\n") } gfd = gopen (device, APPEND, STDGRAPH) # Display spectrum so that it can be edited case 'e': call gclose (gfd) call printf ("edit spectrum\n") call strcpy (LABEL(specsh),xlab,SZ_LINE) if (strlen (UNITS(specsh)) > 0) { call strcat (" in ",xlab,SZ_LINE) call strcat (UNITS(specsh),xlab,SZ_LINE) } call plotspec (npix,spectrum,specname,wlspec,xlab,nsmooth) gfd = gopen (device, APPEND, STDGRAPH) newfit = TRUE break # Set number of times to smooth spectrum case 'g': call gclose (gfd) call printf("Number of times to smooth spectrum (%d): ") call pargi (nsmooth) call flush (STDOUT) i = getline (STDIN,linebuf) if (i > 1) { ip = 1 i = ctoi (linebuf,ip,jtemp) nsmooth = jtemp call amovr (spectrum,Memr[smspec],npix) call smooth (Memr[smspec],npix,nsmooth) call amovr (Memr[cspec],Memr[smcspec],npix) call smooth (Memr[smcspec],npix,nsmooth) } gfd = gopen (device, APPEND, STDGRAPH) # Change display mode to specific one case 'm': call gclose (gfd) dispmod0 = dispmode call printf("Display mode (0-3) (%d): ") call pargi (dispmode) call flush (STDOUT) i = getline (STDIN,linebuf) if (i > 0) { ip = 1 j = ctoi (linebuf,ip,jtemp) if (jtemp > -4 && jtemp < 4) dispmode = jtemp } call printf ("Display mode %d -> %d (%d)\n") call pargi (dispmod0) call pargi (dispmode) call pargi (jtemp) call flush (STDOUT) if (dispmode != dispmod0) { if (dispmode > 1) { xfit = FALSE call emplot (specfile,specim,mspec,npix,spectrum, Memr[smspec],Memr[cspec],Memr[smcspec], wlspec,ipix1,ipix2) if (!plotcorr) { if (xfit) { newfit = TRUE call printf ("Rerun cross-correlation\n") } call gt_free(gt) return } call printf ("Plotting correlation with summary\n") } gfd = openplot (device) call xcsplot (gfd,npix,wlspec,Memr[smspec], strtwav,finwav,dispmode) call xciplot (gfd,specfile,specim,mspec,strtwav,finwav) call xcorplot (gfd,nvel[itemp],xvel[ixi],xcor[ixi],it0) call gflush (gfd) } else gfd = gopen (device, APPEND, STDGRAPH) # Select different velocity for final redshift # Repeat correlation plot to select peak using cursor case 'p': call gclose (gfd) call printf ("select correlation peak(s)\n") pltcor = TRUE newfit = TRUE gfd = gopen (device, APPEND, STDGRAPH) break # Plot spectrum with absorption lines marked case 'l': call gclose (gfd) call printf ("Plotting absorption lines with summary\n") # do i = 1, npix { # call printf ("%4d: %.3fA %9.2f -> %9.2f\n") # call pargi (i) # call pargr (wlspec[i]) # call pargr (Memr[smspec+i-1]) # call pargr (spectrum[i]) # } # call printf ("XCPLOT: %d pixels from %.4fA to %.4fA\n") # call pargi (npix) # call pargd (wav1) # call pargd (wav2) xfit = FALSE call emplot (specfile,specim,mspec,npix,spectrum, Memr[smspec],Memr[cspec],Memr[smcspec], wlspec,ipix1,ipix2) if (!plotcorr) { if (xfit) { newfit = TRUE call printf ("Rerun cross-correlation\n") } call gt_free(gt) return } call printf ("Plotting correlation with summary\n") gfd = openplot (device) call xcsplot (gfd,npix,wlspec,Memr[smspec],strtwav,finwav,dispmode) ixi = (itemp-1) * ncor2 + 1 call xciplot (gfd,specfile,specim,mspec,strtwav,finwav) call xcorplot (gfd,nvel[itemp],xvel[ixi],xcor[ixi],it0) call gflush (gfd) # Change peak fitting parameters case 'c': call gclose (gfd) call printf ("Correlation peak fitting parameters\n") call printf ("Peak-fitting mode (1-parabola 2-quartic 3-cosx/1+x^2) (%d) = ") call pargi (pkmode0) call flush (STDOUT) i = getline (STDIN,linebuf) if (i > 1) { ip = 1 i = ctoi (linebuf,ip,jtemp) pkmode0 = jtemp newfit = TRUE } call printf("Fraction of peak or number of points for peak fitting (%7.3f) = ") call pargd (pkfrac) call flush (STDOUT) i = getline (STDIN,linebuf) if (i > 1) { ip = 1 i = ctod (linebuf,ip,dtemp) pkfrac = dtemp newfit = TRUE } call printf ("Filter parameters for transform (%d %d %d %d) = ") call pargi (lo) call pargi (toplo) call pargi (nrun) call pargi (topnrn) call flush (STDOUT) i = getline (STDIN,linebuf) if (i > 1) { ip = 1 i = ctoi (linebuf,ip,jtemp) lo = jtemp if (i > 0) { i = ctoi (linebuf,ip,jtemp) toplo = jtemp } if (i > 0) { i = ctoi (linebuf,ip,jtemp) nrun = jtemp } if (i > 0) { i = ctoi (linebuf,ip,jtemp) topnrn = jtemp } newfit = TRUE } gfd = gopen (device, APPEND, STDGRAPH) if (newfit) break case 'f': call gclose (gfd) call printf ("Rerunning correlations\n") newfit = TRUE gfd = gopen (device, APPEND, STDGRAPH) break # Change template to use case 't': if (ntemp > 0) { call gclose (gfd) call printf("template for redshift = ") call flush (STDOUT) i = getline (STDIN,linebuf) if (i > 1) { ip = 1 i = ctoi (linebuf,ip,it) if (it < 1 || it > ntemp) it = it0 } else it = it0 itemp = itr[it] itmax = itr[it] ixi = (itemp-1) * ncor2 + 1 it0 = it spxvel = zvel[itemp] spxerr = czerr[itemp] spxr = czr[itemp] strtwav = twl1[itemp] finwav = twl2[itemp] # strtwav = wav1 # finwav = wav2 gfd = openplot (device) call xcsplot (gfd,npix,wlspec,Memr[smspec],strtwav,finwav,dispmode) call xciplot (gfd,specfile,specim,mspec,strtwav,finwav) call xcorplot (gfd,nvel[itemp],xvel[ixi],xcor[ixi],it0) call gflush (gfd) IM_UPDATE(specim) = YES } # Change velocity range over which to search for peak case 'v': call gclose (gfd) call printf ("Minimum allowable velocity in km/sec (%8.1f) = ") call pargd (minvel) call flush (STDOUT) i = getline (STDIN,linebuf) if (i > 1) { ip = 1 i = ctod (linebuf,ip,dtemp) minvel = dtemp newfit = TRUE } call printf ("Maximum allowable velocity in km/sec (%8.1f) = ") call pargd (maxvel) call flush (STDOUT) i = getline (STDIN,linebuf) if (i > 1) { ip = 1 i = ctod (linebuf,ip,dtemp) maxvel = dtemp newfit = TRUE } newfit = TRUE gfd = gopen (device, APPEND, STDGRAPH) break # Set quality flag in header case 'y': spvqual = 4 call gclose (gfd) call printf ("Setting quality flag to 4=good\n") call flush (STDOUT) gfd = gopen (device, APPEND, STDGRAPH) qplot = TRUE IM_UPDATE(specim) = YES case 'n': spvqual = 3 call gclose (gfd) call printf ("Setting quality flag to 3=bad\n") call flush (STDOUT) gfd = gopen (device, APPEND, STDGRAPH) qplot = TRUE IM_UPDATE(specim) = YES case 'j': spvqual = 1 call gclose (gfd) call printf ("Setting quality flag to 1=questionable\n") call flush (STDOUT) gfd = gopen (device, APPEND, STDGRAPH) qplot = TRUE IM_UPDATE(specim) = YES # Make a hard copy of the correlation summary display case '@': call gclose (gfd) call clgstr ("plotter",plotter,SZ_FNAME) call printf ("Making hard copy on %s\n") call pargstr (plotter) gfp = openplot (plotter) call xcsplot (gfp,npix,wlspec,Memr[smspec],strtwav,finwav,dispmode) call xcorplot (gfp,nvel[itemp],xvel[ixi],xcor[ixi],it0) call xciplot (gfp,specfile,specim,mspec,strtwav,finwav) call closeplot (gfp) gfd = gopen (device, APPEND, STDGRAPH) # Replot correlation summary case 'r': call gclose (gfd) call printf ("Replot XCSAO summary\n") gfd = openplot (device) call xcsplot (gfd,npix,wlspec,Memr[smspec],strtwav,finwav,dispmode) call xciplot (gfd,specfile,specim,mspec,strtwav,finwav) call xcorplot (gfd,nvel[itemp],xvel[ixi],xcor[ixi],it0) call gflush (gfd) # Exit without updating the image header case 'x': qplot = FALSE break # List available cursor commands case ' ','h','?': call gclose (gfd) call printf("XCSAO commands:\n") call printf(" e edit spectrum\n") call printf(" c change correlation peak fit parameters\n") call printf(" d toggle debug flag\n") call printf(" f rerun cross-correlation\n") call printf(" j conditional velocity\n") call printf(" l plot spectrum with absorption lines\n") call printf(" m change display mode to -1, 0, 1, or 2\n") call printf(" n disapprove velocity\n") call printf(" p refit correlation peak interactively\n") call printf(" q exit from this spectrum\n") call printf(" r replot summary\n") call printf(" t change template to use for xcor velocity\n") call printf(" v change velocity limits for result\n") call printf(" x Exit without updating header\n") call printf(" y approve velocity\n") call printf(" @ make hard copy\n") gfd = gopen (device, APPEND, STDGRAPH) default: break } } # Close graphics window endplot_ call gt_free(gt) call closeplot (gfd) if (debug && savevel) call printf ("XCPLOTreturn: Save new velocity\n"); if (debug && savespec) call printf ("XCPLOTreturn: Save edited spectrum\n"); if (debug && !savespec) call printf ("XCPLOTreturn: Not saving edited spectrum\n"); call flush (STDOUT) return end int procedure rcompx (rvalue, itemp1, itemp2) double rvalue[ARB] int itemp1 int itemp2 begin if (rvalue[itemp1] < rvalue[itemp2]) return (1) else if (rvalue[itemp1] > rvalue[itemp2]) return (-1) else return (0) end # Jun 2 1992 Fix peak selection mode bug--reopen gfd # Nov 30 1992 Smooth spectrum here so it can be resmoothed by EMPLOT # Jan 14 1993 Fix misspellings # Dec 3 1993 Pass mspec to EMPLOT # Mar 16 1994 Add option of editing spectrum # Apr 15 1994 Add wavelength limits to EMPLOT call # Apr 22 1994 Drop image structure from EMPLOT argument list # May 3 1994 Add smoothed vector argument to PLOTSPEC call # May 5 1994 Add correct smoothed vector argument to SPECPLOT call # May 9 1994 Drop smoothed vector argument from SPECPLOT call # May 9 1994 Add number of times to smooth spectrum to PLOTSPEC call # May 23 1994 Locally allocate and free smoothed spectrum # Aug 3 1994 Change common and header from fquot to rvsao # Aug 5 1994 Drop nvel as argument to INFOPLOT # Aug 10 1994 Plot spectrum over wavelength overlap with best template # Aug 17 1994 Change names of SPECPLOT and INFOPLOT to XCSPLOT and XCIPLOT # Dec 7 1994 Add multiple display modes; add x command # Feb 27 1995 Fix hard copy command # Mar 22 1995 Add options to change fitting parameters # Aug 18 1995 Set MINVEL and MAXVEL in common, not parameter file # Aug 25 1995 Add qplot velocity accepatance flags; remove unused variables # Aug 25 1995 Turn on emission line marking if R>4 for emission template # Sep 19 1995 Add g to change spectrum smoothing for display # Sep 25 1995 Use EMPLOT for interaction, not EMEPLOT # Jan 10 1996 Pass DISPMODE to XCSPLOT to allow more options # Feb 4 1997 Fix label on spectrum being edited # Mar 14 1997 Get dispersion axis label from spectrum header # Apr 7 1997 Pass all correlation vectors so any can be plotted # Apr 7 1997 Sort template indices by R-value # Apr 8 1997 Print template number as part of correlation header # Apr 14 1997 Pass IT0 to XCORPLOT instead of title # Nov 14 1997 Add arguments to emplot to fake continuum-subtracted spectra # Jan 13 1998 Add command to change to specific display mode # Feb 13 1998 Pass correlations and velocities as pointers # Apr 22 1998 Make boolean assignments consistent (suggested by Bryan Miller) # Jun 22 1999 Add debug statement showing plotter name # Jul 29 1999 Recompute continuum-subtraction to pass to emplot # Aug 19 1999 Set vplot in t_xcsao from vel_plot parameter # Sep 24 1999 Set IM_UPDATE to yes if quality flag is set # Jul 31 2001 Update spectrum header if xcor template changed # May 12 2004 If plotem is set by eminit(), always label emission lines # Jan 24 2007 Reset WCS before each plot subroutine call # Jan 30 2007 Always plot all of spectrum # Jan 31 2007 Send only limiting pixels to emplot(), not wavelength limits # Apr 27 2007 Send limiting wavelengths for template to xcsplot and xciplot # Aug 13 2007 Allocate all buffers only when needed # Oct 15 2007 Change tschop[i] == FALSE test to !tschop[i] # Jul 22 2010 Check individual pointers before freeing them rvsao-2.8.3/Xcsao/xcfile.x0000644000016200001660000001346412505353115014452 0ustar minkoirsys# File rvsao/Xcor/xcfile.x # March 27, 2015 # By Jessica Mink, Harvard-Smithsonian Center for Astrophysics # Copyright(c) 1993-2015 Smithsonian Astrophysical Observatory # You may do anything you like with this file except remove this copyright. # The Smithsonian Astrophysical Observatory makes no representations about # the suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # Print a portion of the filtered cross-correlation function include "../lib/rvsao.h" procedure xcfile (specfile,specim,mspec,tempfile,tspec,itemp,ncor,xvel, xcor,xcorfile) char specfile[SZ_PATHNAME] # Object spectrum file name pointer specim # Spectrum header structure int mspec # Number of object aperture (ignored if < 1) char tempfile[SZ_PATHNAME] # Template spectrum file name int tspec # Number of template aperture (ignored if < 1) int itemp # Index of template in template list int ncor # Number of points in cross-correlation real xvel[ARB] # Cross-correlation velocities from xcorfit real xcor[ARB] # Cross-correlation returned from xcorfit char xcorfile[SZ_PATHNAME] # Cross-correlation output file name (returned) real rindef real xcr # Center velocity in km/sec real dxcr # Half-width in velocity char title[SZ_PATHNAME] # Title line in output file char inst[SZ_LINE] # Instrument name from input file int xcfd # File descriptor for correlation output real vmin,vmax # Velocity limits for correlation output int i, ifile, open() double dj # Julian Day of observation int strncmp() char aperture[8] int stridx(), strldx(), strmatch() include "../lib/rvsao.com" include "../lib/results.com" begin rindef = INDEFR # If SAO echelle, prefix telescope code to file name call imgspar (specim, "INSTRUME",inst,SZ_LINE) if (strncmp (inst,"echelle",7) == 0) { xcorfile[1] = 'T' xcorfile[2] = EOS } else if (strncmp (inst,"mmtech",6) == 0) { xcorfile[1] = 'M' xcorfile[2] = EOS } else if (strncmp (inst,"oroech",6) == 0) { xcorfile[1] = 'W' xcorfile[2] = EOS } else xcorfile[1] = EOS # Make up a file name as .