\documentclass{article}
\pagestyle{empty}
\usepackage[ps2pdf,colorlinks=true]{hyperref}
\usepackage{html}
\setlength{\textwidth}{415pt}
\setlength{\textheight}{610pt}
\setlength{\hoffset}{-40pt}
\setlength{\parindent}{0cm}
\newcommand{\AWE}{\texttt{awe}}
\newcommand{\dpu}{\texttt{DPU}}


\title{\texttt{ScienceTask} exercises}
\begin{document}
\maketitle

\section*{Locate \texttt{RawScienceFrames}}

{\it Question 1:} You have been given a list of dates and object names or
filenames.  Locate the \texttt{RawScienceFrames} at the \AWE\ prompt.

\vspace{0.3cm}
\noindent
Instruction: Use information in the 
\htmladdnormallink{Python database querying HOW-TO}{http://www.astro-wise.org/portal/howtos/man\_howto\_queries/man\_howto\_queries.shtml} 
at the ASTRO-WISE portal (http://portal.astro-wise.org/) to construct a query 
that contains your and only your \texttt{RawScienceFrames}.

\begin{verbatim}
Answer:
awe> date = DateTime.DateTimeFrom('2001-01-01')
awe> q  = (RawScienceFrame.DATE_OBS == date)
awe> q &= (RawScienceFrame.instrument.name == 'WFI') 
awe> q &= (RawScienceFrame.filter.name == '#877'))
awe> q &= (RawScienceFrame.OBJECT.like('Science*'))
awe> len(q)
<some number of frames>
awe> for f in q: print f.filename, f.DATE_OBS, f.filter.name, f.OBJECT
.
.
.
\end{verbatim}

\noindent
A more direct way would be to use the select method:

\begin{verbatim}
Answer:
awe> q = RawScienceFrame.select(date='2001-01-01', instrument='WFI', filter='#877',
         object='Science*')
awe> len(q)
<some number of frames>
awe> for f in q: print f.filename, f.DATE_OBS, f.filter.name, f.OBJECT
.
.
.
\end{verbatim}

\section*{Process \texttt{RawScienceFrames}}

{\it Question 2:} Process the \texttt{RawScienceFrames} that you found in the
previous question.

\vspace{0.3cm}
\noindent
Instruction: Follow the instructions in the 
\htmladdnormallink{\texttt{ScienceTask} HOW-TO}{http://www.astro-wise.org/portal/howtos/man\_howto\_science/man\_howto\_science.shtml} 
at the ASTRO-WISE portal (http://portal.astro-wise.org/) to process your \texttt{RawScienceFrames} into \texttt{ReducedScienceFrames}.

\begin{verbatim}
Answer:
awe> dpu.run('Science', d='2001-01-01', i='#877', f='#877', o='Science*')
\end{verbatim}

{\it Question 3:} Retrieve and inspect the logs from the \dpu.

\vspace{0.3cm}
\noindent
Instruction: Follow the instructions in the 
\htmladdnormallink{\texttt{ScienceTask} HOW-TO}{http://www.astro-wise.org/portal/howtos/man\_howto\_science/man\_howto\_science.shtml} 
at the ASTRO-WISE portal (http://portal.astro-wise.org/) to retrieve the logs.

\begin{verbatim}
Answer:
awe> dpu.get_logs()
.
.
.
\end{verbatim}


\section*{Inspect \texttt{ReducedScienceFrame}}

{\it Question 4:} How well did the calibration correct for instrumental 
effects?

\vspace{0.3cm}
\noindent
Instruction: Use the instructions in the 
\htmladdnormallink{\texttt{ScienceTask} HOW-TO}{http://www.astro-wise.org/portal/howtos/man\_howto\_science/man\_howto\_science.shtml} 
at the ASTRO-WISE portal (http://portal.astro-wise.org/) to view one of your 
\texttt{ReducedScienceFrames} (one CCD only).

\begin{verbatim}
Answer:
awe> rq = ReducedScienceFrame.raw == q[0]
awe> os.system('skycat %s' % (rq[0].filename))
\end{verbatim}


\section*{Determine which calibration frames were used}

{\it Question 5:} After visual inspection, the \texttt{ReducedScienceFrames}
may not look optimal.  Determine what calibration frames were used.

\vspace{0.3cm}
\noindent
Instruction: Use the instructions in the 
\htmladdnormallink{\texttt{ScienceTask} HOW-TO}{http://www.astro-wise.org/portal/howtos/man\_howto\_science/man\_howto\_science.shtml} 
at the ASTRO-WISE portal (http://portal.astro-wise.org/) to ask the \texttt{ReducedScienceFrame} which calibration files were used in its creation.

\begin{verbatim}
Answer:
awe> red = rq[0]
awe> red.filename
<some output filename>
awe> red.raw.filename
'WFI.2000-12-20T01:21:43.805_7.fits'
awe> red.bias.filename
'2000-04-26cal541_ccd56.fits'
awe> red.flat.filename
'2000-04-21cal546-#845_ccd56.fits'
\end{verbatim}


\end{document}
