\documentclass{article}[12pt]

\usepackage[utf8]{inputenc} \usepackage{votutorial}
\usepackage{graphicx}

% set directory for images (topcat-icons, screenshots etc.)
% This is required for logo images etc.!!!
\newcommand{\imgdir}{../images}

\title {Compute Redshifts of Quasars Using SPLAT-VO}
\author{M. Castro Neves, \\based on the VOSpec Tutorial by\\ Phil Furneaux and Deborah Baines}

\begin{document}
\maketitle


\begin{abstract}
In this tutorial you will use SPLAT-VO to search for spectra of galaxies and quasars in the VO, and compute their redshifts and velocity, using 
the  Hydrogen Lyman Alpha line. 
\end{abstract}

\usedsoftware{\SPLAT}

\section*{Before you start}
SPLAT has to be installed on the system. If you don't have it already, please download it. You can either download the
jar package or install it via Webstart. You'll also need a calculator or another application for computing the final 
redshift.
If you use the jar package: After downloading it, start the installer with:
\\ \emph{java -jar splat-vo.jar}
\\
After installation, SPLAT can be started (from the directory where SPLAT has been installed) with
\\
\emph{bin/splat/splat}

\section*{Search for and retrieve a spectrum}
We will now get a spectrum of an object to compute its redshift.

\tutstep On the main SPLAT window, click on the SSAP button to open the VO browser window.
\frame{\includegraphics[scale=.8]{\imgdir/ssap.png}}


\tutstep[Choosing a SSAP service] On the left part of the VO browser window, you see a server selection frame. It contains a list of SSAP services and some checkboxes.
There you can see the available SSAP services and what type of information they have. If you click on a service with the right mouse button,
 (or, in older versions, click on the icon left of it) information about the service will appear. 
Check the \key{Observed Data} button on the left upper side of the frame. Only services containing observational spectra will be queried. \\
\tutstep[Setting waveband range] In this tutorial we are looking for
spectra on the ultra-violet waveband range, so see that only the
\key{UV}  box is checked. Only the services offering spectra in this
range will be queried. Notice that the services list has changed. Below
the list of services in the lower left, click
on \key{Select all} to select the services. In older versions of SPLAT
this is not necessary.\\
%\includegraphics[scale=.4]{\imgdir/Splat_uv_services.png}

\tutstep[Enter objec parameters]
On the \emph{search parameters} frame, add \emph{3C 273} as
\key{Object}. It is a quasar, actually one of the closest, and
(optically) brightest. Click on \key{Lookup}, to get its coordinates.
Click the green \key{SEND QUERY} button on the right. In the \emph{Query results} frame you will get a card box with answers from some services. Each tab contains the list of query results for the service.

\tutstep[Selecting spectra] 
For this example, choose the \emph{IUE} (International Ultraviolet Explorer) tab. Scroll the table of spectra to the right until you see the \textbf{min\_wavelength} and \textbf{max\_wavelength} columns. We will use the Lyman alpha line, which has a rest wavelength of 1215.67 Angstroms, so chose a spectrum containing this wavelength within its range. Double-click on the chosen line where to display the spectrum.\\
You can zoom in using the middle mouse button, and zoom out using the right button. You can also zoom only the X, or the Y scale. When moving the mouse over the plot, the current position's values will be displayed (\textbf{Wavelength} and \textbf{DataCount}).\\\\
\includegraphics[scale=.3]{\imgdir/spectraList.png}

%\section*{Loading the spectral line identifiers}
%Splat has some locally stored spectral lines. In the future they can be retrieved using SLAP (Spectral Line Access Protocol).
%\tutstep On the main SPLAT-VO window, click on \key{Options$\rightarrow$Line Identifiers}. A list of files containing pre-stored line identifiers will appear.  Chose \emph{SDSS\_reflines.ids} from this list. It will appear in the \textbf{Global List of Spectra}. You can drag this entry to your plot to see the lines. \\
%\item On the plot window, see that thethe option \textbf{positions track the current spectra} in \textbf{Options$\rightarrow$Line identifiers}. This tracking can be confusing if the spectrum is shifted.

\tutstep[Finding the Lyman Alpha line] The strongest peak in the plot corresponds to the Hydrogen Lyman alpha line. The Lyman alpha line's rest wavelength is at 1215.67 Angstroms.
Notice that  the observed  Ly-alpha line peak lies to the right of the
emitted Lyman-Alpha line. For calculating the redshift, it's necessary to get the position of the center of the peak. \\
%\includegraphics[scale=.3]{\imgdir/spectrum_with_lines.png}
\includegraphics[scale=.4]{\imgdir/Spectrum.png}

%\tutstep If you want to remove the lines from the plot, just go to the main SPLAT-VO window, click on \emph{SDSS\_reflines} and uncheck the box in the \key{Views of the current spectra}. To visualize it again, just drag it to the plot window.

\section*{Continuum fitting and measuring the peak's wavelength}
\tutstep[Fitting the curve] 
First of all, we need to fit the curve to a continuum. Open the \frame{\includegraphics[scale=.8]{\imgdir/fitback.pdf}} \key{Fit polynomial to a spectrum} window. 
Chose \key{Degree of polynomial:}  3; \key{Subtract fit from spectrum: } No. Leave \key{Divide Spectrum by fit } unchecked.\\
\includegraphics[scale=.3]{\imgdir/cont_fitting.png}\\\\

Click on \textbf{Add} and select several coordinate ranges where the spectrum is relatively flat, leave the strong peaks out. When you are ready, click on the \key{Fit (Replace)} button. The polynomial fit curve will be shown on the plot, and will be listed on the \textbf{Global list of spectra} in the main SPLAT-VO window. Close the  \frame{\includegraphics[scale=.8]{\imgdir/fitback.pdf}} \textbf{Fit polynomial to a spectrum} window to remove the green marked ranges. You'll see the fit curve  on the plot window.\\\\
\includegraphics[scale=.3]{\imgdir/cont_fit_plot.png}\\

\tutstep [Finding the peak centre]
On the plot window, open the \frame{\includegraphics[scale=.8]{\imgdir/fitline.pdf}}  \key{Measure Spectral Lines} window. Check \key{Types of fit: } Gaussian, \key{Background type:} polynomial, and \key{Background fit:}  the previously computed fit (it has a name starting with "Polynomial Fit".
Click on \key{Add} button to add the frequency range. Mark the area of the plot you want to select (the area containing the peak - yellow in the example figure).
You may want to zoom for better visualisation. When finished, click on \key{Fit}. You will get the fitting results for quick fit and Gaussian.
The \textbf{Centre} value is the frequency of the peak, which is your observed Lyman alpha wavelength.\\
\begin{figure}[!tbp]
  \centering
  \begin{minipage}[b]{0.65\textwidth}
    \includegraphics[width=\textwidth]{\imgdir/center_plot.png}
  \end{minipage}
  \hfill
  \begin{minipage}[b]{0.30\textwidth}
    \includegraphics[width=\textwidth]{\imgdir/measure_center.png}\\
  \end{minipage}
\end{figure}

\section*{Computing the redshift}
\tutstep Now the redshift can be computed using the following equation:
\begin{equation}
z = \frac{\lambda_{obs} - \lambda_{emit}}{\lambda_{emit}}
\end{equation}
where $\lambda_{obs}$is the centre wavelength and $\lambda_{emit}$ is the rest wavelength of the Lyman alpha emission line (1215.67 Angstroms).
After computing the redshift, you can compare it to the value from the NASA/IPAC  Extragalactic Database (NED), \url{http://ned.ipac.caltech.edu/forms/byname.html}.

%\tutstep The radial velocity can be computed with:
%\begin{equation}
%rv = c * z.
%\end{equation}
%where $c$ is the speed of light and $z$ the previously computed redshift.\\
% ???Explain about  relativistic velocities? Do we need them (for higher redshifts)?

\section*{Other examples to try}
As an exercise, you can do the same for the following galaxies: 3C 186, PKS 1127-14, 3C 286, 3C 298, PKS 1143-245 

%\begin{table}[]
%\caption{Redshifts and Velocities}
%\begin{center}
%\begin{tabular}{|c|c|c|}\hline
%Object & Redshift & Velocity\\
%\hline
%3C 273& & \\
%\hline
%3C 186& &\\
%\hline
%PKS 1127-14& &\\
%\hline
%3C 286& &\\
%\hline
%3C 298& &\\
%\hline
%PKS 1143-245& &\\
%\hline

%\end{tabular}
%\end{center}
%label{default}
%\end{table}


\end{document}
