\documentclass[psfig,preprint]{aastex}
\usepackage{graphicx}
\usepackage[verbose]{wrapfig}
\begin{document}
\tolerance=10000
\def\simlt{\lower.5ex\hbox{$\; \buildrel < \over \sim \;$}}
\def\simgt{\lower.5ex\hbox{$\; \buildrel > \over \sim \;$}}

\title{MAPPING THE HI LINE: THE GALAXY AND SUPERSHELLS}

\tableofcontents

\section{GOALS} 

The goals of this lab consist of some collection of the following,
depending on the project chosen: \begin{itemize}

  \item Perform a large-scale observing survey project balancing
    considerations of telescope time, integration time, sky coverage,
    data reduction, report writing, and personal time commitment versus
    research goals and quality of results and their presentation.

\item Use the collected data to infer astrophysical phenomenae or
  quantities such as the properties of supernova-driven interstellar
  supershells and the Galaxy.

\item Present data and/or using greyscale and/or color images.

\item Learn about using colors in computer graphics including plots and
  images. 

\item Learn about problems in using color for presentations,
  specifically contrast issues and colorblindness.

\end{itemize}


\section{INTRODUCTION}

	Diffuse atomic gas permeates all corners of interstellar space.
On the largest scales, its distribution reveals a lot about Galactic
structure and dynamics. On smaller scales, its morphology is dominated
by shocks from energetic stellar winds and supernovae. On still smaller
scales, magnetic fields, pressure differences, and thermal instability
shape the gas into thin filaments and sheets. On still smaller scales,
the densities get large from self-gravitation; the gas turns molecular
and stars form. 
The dense regions where Star formation occurs occupy a
small fraction of the interstellar volume. In contrast, the atomic gas
(HI) resides in less-dense regions that occupy large fractions of
interstellar space and you see Galactic HI wherever you point the
telescope. 

For this lab, we outline several projects to map interesting structures
in HI using our 4.5-m diameter Leuschner dish. The HI projects
fall into two categories. One explores large-scale Galactic structure
and dynamics by obtaining HI spectra along great circles, presenting the
data as position-velocity images, and interpreting those maps as
discussed below. The other category maps specific interstellar
structures (e.g., expanding shells produced by multi-supernovae) by
sampling a grid of spectra over a large area, presenting the data as
grey-scale images of velocity-integrated line intensity (i.e., antenna
temperature $T_A$) or as images in which image brightness indicates
velocity-integrated $T_A$ and color indicates velocity.

We'd like each group to pick a single project and carry it through to
completion by the time the lab reports are due, which is the last day of
class (May 5). All of the HI projects involve making maps and
images. One of the features of this lab is to learn about image
processing and using colors in images.

For the great-circle projects (\S \ref{galacticplane} and \S
\ref{galacticpoles}), we gain large angular scale information
in the sky by observing on great circles. Getting nice results
requires data over the largest portions of the great circles you can
get. For a full 360-degree circle, that's 180 pointings at $2^\circ$
spacings.  Mostly, though, we can't cover a full great circle because
some of the circle lies too far south, so we do as much as we can. 

\section{SCHEDULE}

The end of the semester is approaching like a freight train. Here's our
schedule.  \begin{enumerate}

\item Week 1, 05apr-12apr: Pick a group project. Figure out the RA and
  Dec boundaries of your object, when the object is up, and how you
  sample the area with telescope pointings. Coordinate with other groups
  to figure out how you can share telescope time.

Devise a scheme for scheduling observations of all the points in your
map.  Obtain and reduce some frequency-switched test spectra, in
particular at our canonical comparison position at Galactic coordinates
$(\ell, b) = (120^\circ, 0^\circ)$.  We will compare the spectra of all
groups at the class on 12 April, and if your group doesn't have a
spectrum to show this will be considered very bad form.

\item Week 2, 12apr-19apr: Get as much data as you can. Reduce the data.
You won't have all of your data, but begin the map-making process anyway
(\S \ref{datadisplay}); this process begins with making a data cube.

\item Week 3, 19apr-26apr: Get the rest of your data. Figure out
  how you want to present the data as images. Make some first-try
  images. 

\item Week 4, 66apr-03may: Finalize data. Make final images. Write
report. Report is due the last day of class, 03 May.
\end{enumerate}

\section {IDL PROCEDURES }
\subsection{For Controlling the Dish}
\begin{enumerate}
\item {\tt pointl} moves the telescope to a specified (alt,az)
\item {\tt pointl\_radec} moves the telescope to a specified (ra,dec),
  sun, or moon
\item {\tt follow} tracks a given (ra,dec), sun, or moon and can write a
  file containing relevant pointing data.
\item {\tt maint} moves the telescope to maintenance position
\item {\tt stow} moves the telescope to stow position
\end{enumerate}

\subsection{For Taking Data}
\begin{enumerate}
\item {\tt noise} turns on or off the calibration noise diode.
\item {\tt set\_lhp} sets the frequency and level of the l.o.\ {\it
  Important:} the resolution of the l.o.\ is 10 KHz; see the
  documentation for this procedure.
\item {\tt rxpwr} returns the channel-integrated spectral power from the
  ROACH box as input.
\item {\tt startchart1} runs a `chart recorder' using the
  channel-integrated spectral power from the ROACH box as input. 
\item {\tt getspect} sets the l.o.\ and the noise diode, then averages a
  specified number of spectra from the ROACH box and optionally plots or
  saves the result in an IDL save file, which contain ancillary info
  such as Julian day. ra, dec, etc.
\item {\tt leuschner\_rx} Take and record spectra with the ROACH box.
\item {\tt filename} generate a filename of the form:
  {\tt jjjjjjj.jjjjjj\_sn0000\_nd1\_1270123456}
\item {\tt fits\_to\_sav} converts a fits file, which contains nrspectra
  spectra, into a sav file with a single spectrum equal to the avg,
  also the median. Also lots of ancillary info, all in a structure
\item {\tt frq} calculate the array of IF or RF freqs from the tags in
  the standard output structure.
\end{enumerate}

\subsection{Our Standard Output Structure}
If you use our recommended commands for mapping (\S
\ref{mappingcommands}), then you will use {\tt fits\_to\_sav} to write
your datafiles. It saves your data in the following structure:
\begin{verbatim}
   SRCNR           INT           9999           you choose the source number
   SRCNAME         STRING    '-9999'            you choose the source name
   JD              DOUBLE           2457483.5   Julian day
   RA              FLOAT          0.430058      RA
   DEC             FLOAT           62.7256      Dec
   SPCT_AVG        FLOAT     Array[8192, 4]     Average spectrum
   PWR_AVG         FLOAT     Array[4]           chnl-avg of spct_avg
   SPCT_MED        FLOAT     Array[8192, 4]     median spectrum
   PWR_MED         FLOAT     Array[4]           chnl-avg of spct_med
   NRSPECTRA       LONG               100       nrspectra in avg/med
   FREQ_IF_CHNL0   DOUBLE       1.4400000e+08   IF freq chnl 0
   FREQ_IF_CHNL8191
                   DOUBLE       1.5599854e+08   IF freq chnl 8191
   FREQ_RF_CHNL0   DOUBLE       1.4144000e+09   RF freq chnl 0
   FREQ_RF_CHNL8191
                   DOUBLE       1.4263985e+09   RF freq chnl 8191
   LO1             DOUBLE       1.2704000e+09   LO freq
   SB              DOUBLE           1.0000000   sideband
   ND              INT              0           noise diode on/off
   UGDOPP          FLOAT     Array[4]           ugdoppler output
   PANGLE          DOUBLE           97.123027   parallactic angle
   LST             DOUBLE           4.3368460   LST
   AZ              DOUBLE           324.82700   Az
   ALT             DOUBLE           47.232719   Alt
   GL              DOUBLE           120.00000   Galactic longitude
   GB              DOUBLE       5.9575176e-05   Galactic latitude
   FREQARR         STRING    '=  fst.freq_if_chnl0 + (dindgen(8192)*'...
\end{verbatim}
 
\section{ON MAPPING AREAS: HOW TO SPATIALLY SAMPLE} \label{sampling} 

\subsection{Sampling Your Sky Area}
All of the HI projects examine the angular dependence of the 21-cm line
profile, so you need closely-spaced observations to make a map or an
image. How closely should the observations be spaced?  The usual
criterion is two samples per HPBW (Half-Power BeamWidth), because
observing at more closely spaced angles just gives redundant information
and takes extra time, while more widely spaced angles loses small-scale
structural information. (This statement can be justified more exactly by
Fourier transforming the structure of the sky in terms of angular
frequency and then imposing the Nyquist criterion\dots).  The HPBW is
almost $4^\circ$; so a spacing of $2^\circ$ is about right.

For the mapping projects (not the great-circle ones), we need to cover
areas of 1000 to 2000 square degrees. Consider the Orion-Eridanus
Superbubble (\S \ref{eridanus} below), which wants to map the the region
covering roughly $(\ell=160^\circ \rightarrow 220^\circ, b=-70^\circ
\rightarrow -10^\circ)$. You might think you'd set up a regular grid in
$(\ell,b)$ with $(\Delta \ell, \Delta b)$ both equal to
$2^\circ$. That's find for $\Delta b$, but you'd be sampling too closely
in $\ell$. That's because the true (great-circle) angular distance
between two points is $\Delta \ell \cdot \cos(b)$; there's a
foreshortening for $b \neq 0^\circ$ (e.g.: when you're at the Earth's
North Pole, you can go completely around a small circle of constant $b$
with just a few steps.). So you can save lots of observing time by
observing at $\Delta \ell = {2^\circ \over \cos(b)}$ instead of $\Delta
\ell = 2^\circ$.

The true angular area is not the total extent in $\ell$ times the total
extent in $b$ because of the foreshortening discussed in the above
paragraph. So the actual angular area of the Orion-Eridanus area area
isn't the range in $\ell$ times the range in $b$, i.e.\ $60^\circ
\times 60^\circ = 3600$ square degrees (which would require 900
pointings), but rather only about 2800 square degrees.  At $2^\circ$
sampling, that's about 700 pointings.

These projects require what seems like a lot of pointings,
but---hey!---the telescope is automated. With the magic of a
computer-controlled telescope you can do these observations in just one
or two days. But it will require planning and coordination with other
groups---all of you are in the same boat! (Or should we say, ``in the
same dish''?)

\subsection{Recommended IDL Commands} \label{mappingcommands}

For actually taking the data at a particular position, we recommend the
following sequence of commands for each position:
\begin{verbatim}
        find the (ra, dec) for your position. you can use 'glactc' if you wish
        strin=mk_strin(ra=ra, dec=dec) (defines input structure)
        nrspectra=100 (number of 0.7-sec spectra to obtain--pick an appropriate number)
        pointl_radec, strin.ra, strin.dec (point the telesccope
           You should point the dish to r.a.\ smaller than the position's r.a.\ by
           half the observing time so that the midpoint of the integration
           coincides with the position of the source.
        getspect, strin, nrspectra (takes and records the data)
\end{verbatim}
\noindent You are srongly advised to look at the documentation of these procedures before using them!

\subsection{Beware Operating near Azimuth 0/360!!}

If the azimuth of the current position is $1^\circ$ and of the next one
is $359^\circ$, the telescope has to rotate $360^\circ$ in azimuth,
which takes a long time! You don't want to make this transition more
than once! (or at all, if you can manage it)

\subsection{Beware Operating Above Altitude 85 and Below/Near 14!!}

The telescope cannot point above altitude $85^\circ$. And it cannot
point below $14^\circ$. When you are at low altitude, you might be
seeing the ground!

\section{THE GALACTIC PLANE: THE GREAT CIRCLE AT LATITUDE ZERO 
\boldmath{$(b=0^\circ$)}} 
\label{galacticplane}

	Point the telescope at a series of Galactic longitudes ($\ell$)
along the Galactic plane (Galactic latitude $b = 0^\circ$), over the
full longitude range that is observable for our telescope.  Getting nice
results requires data over the largest section of the Galactic plane you
can get, which is roughly (or somewhat less than) $\sim -10^\circ \simlt
\ell \simlt 250^\circ$. This observation has two science goals:
\begin{enumerate}

	\item {\it The Galactic rotation curve}. Determine the rotation
curve of the Galaxy for the portion of the Galaxy inside the Sun and use
the result to estimate the {\it gravitational} mass $M_{grav}$ of the
Galaxy that lies inside the Solar circle; for this, you just assume the
usual $v^2 = {G M_{grav} \over R}$.  In fact, you can even get the
radial dependence $M_{grav}(R)$! Also, use your observations to estimate
the {\it gaseous} mass $M_{gas}(R)$ of the Galaxy.  What fraction of the
total Galactic mass comes from interstellar gas? For this you'll need to
know the radius of the Solar circle: it's 8.5 kpc.  See {\it Commentary}
below for a discussion. 

\item {\it The Galactic center.} Our Galactic center, like others, has a
  big black hole, with infalling matter and jets and lots of anomalous
  velocities. You can see a lot of this activity in  your map. Using the
  spatial extents and the velocities, you can estimate a black hole
  mass. To get an accurate estimate, you need to look at motions of
  matter lying really close to the black hole, which you can't do
  because you don't have the angular resolution. But you can at least
  make an estimate!

	\item {\it Spiral Structure of the Galaxy}. All your life,
you've been told that we live in a spiral galaxy.  Are they lying? In
principle, to detect spiral structure you make a position-velocity plot
along the Galactic plane [that's the image $T_A(\ell,V_{LSR})$ for
$b=0^\circ$].  Bright regions are regions of excess density---or regions in
which lots of HI is packed into a narrow velocity range (see \S
\ref{coldensity} below). 

	Do you see spirals in your position-velocity plot? How do you
tell? There's only one easy way.  Make a model of a spiral arm and see
how it projects onto position-velocity space.  To do this, you need to
know the rotation curve.  You've measured it for the inner Galaxy; for
the outer Galaxy (outside the Solar circle) assume that the rotation
curve is constant beyond the solar circle [$V(R)$=220 km/s for $R > 8.5$
kpc].  In polar coordinates, the equation for a spiral arm is

\begin{equation}
R_{arm}  =  R_0 e^ {\kappa (\phi - \phi_0)} 
\end{equation}

\noindent where $R_0$, $\kappa$, and $\phi_0$ are free parameters;
$\kappa$ is the tangent of the {\it pitch angle}.  You project this into
position-velocity space using equation \ref{vdopp} and your knowledge of
the Galactic geometry.  

{\it Comment:} Finding spiral arms inside the Solar circle is very
difficult, and has thwarted efforts by astronomers over the past several
decades. Finding them in the outer Galaxy is not so bad.

\end{enumerate}

\section{IS THE GALACTIC PLANE FLAT?}

External galaxies are often distorted (like the brim of a Fedora). 
These distortions are probably produced primarily by nearby neighbors. 
How about our own Galaxy? To determine this we want to look at the
vertical structure of the Galactic plane and see where the peaks occur;
a flat Galaxy would everywhere have the peaks at $b=0^\circ$. 

The most comprehensive way to observe and display these distortions is
with a map that covers the biggest possible swath in Galactic longitude
$\ell$ for the range of Galactic latitude ($b$) from $-20^\circ$ to
$+20^\circ$. This is a huge area---almost $10^4$ square degrees! At
$2^\circ$ sampling, you'd need $\sim 2500$ profiles.  To make the
project more manageable, you can increase the increment in $\ell$, say
to 4 degrees, while keeping the same, fully-sampled increment in
$b$. Resolution is $l$ is less important because---like a
fedora---the warp doesn't change rapidly with $l$.

This project affords a great opportunity to make a spectacular color
image in $(\ell,b)$ coordinates: brightness showing the amount of gas,
color the Galactic rotation.  Officially, the science goals here are to
estimate the thicknesses of the Galactic disk and, also, to obtain an
approximate Fourier representation of the warp---which is not so
straightforward given the absence of data in the ``Southern'' Galaxy.

\section{THE GALACTIC POLES: GREAT CIRCLES AT CONSTANT LONGITUDE $\ell$}
\label{galacticpoles}

How is the interstellar gas distributed within the Galaxy---for example,
is it ``disklike'' or more spherically distributed? Are there any
systematic motions other than just ``Galactic rotation''? (You'd be
surprised!).  To answer these questions, determine the column density
and mean velocity of interstellar gas as a function of Galactic latitude
$b$. 

	To answer this completely you'd need to do a sky survey! That's
a big job.  So let's do something easier. We have one project (\S
\ref{galacticplane}) that looks around a great circle, the Galactic
equator (constant $b$). Other projects could check out one or more
orthogonal great circles (at constant longitudes $\ell$) going from one
Galactic pole to the other and back again (or, if not the whole 360
degree circle, as much as possible).  Particularly appropriate sets of
constant-longitude great circles are the pairs $\ell = (220^\circ,
40^\circ)$ (partly because you can get the whole great circle) and $\ell
= (130^\circ, 310^\circ)$ (because at positive latitudes there's weak
high-velocity gas).

	The science goals here are to characterize the thickness of the
gas layer and to determine the vertical kinematics of the gas, and if
possible an estimate of the energy involved in the vertical motions.

\section{MAPPING THE NORTH CELESTIAL POLE} \label{celestial}

The region near the North Celestial pole contains a large shell,
probably produced by one or more supernovae, and also to has angular
scales that are well-matched to our telescope and the available time for
your project. For this, you'd map the region covering roughly
$(\ell=105^\circ \ {\rm to} \ 160^\circ), (b=15^\circ \ {\rm to}
\ 50^\circ)$. Interesting features should produce antenna temperatures
$\sim 10$ K. This is about 1600 square degrees and, with 2 degree
spacing, requires about 400 profiles. With our telescope, this is
probably the most spectacular and contrasty object we can map in the
sky.

\section{MAPPING THE ORION-ERIDANUS SUPERBUBBLE} \label{eridanus}

The ``Orion-Eridanus Superbubble'' was, and continues to be, produced by
energetic stellar winds and supernovae that were located in immediate
vicinity of the Orion nebula. For this, you'd map the region covering
roughly $(\ell=160^\circ \rightarrow 220^\circ, b=-70^\circ \rightarrow
-10^\circ)$. Interesting features should produce antenna temperatures
$\sim 20$ K. This is almost 2800 square degrees and, with 2 degree
spacing, requires almost 700 profiles. See \S \ref{sampling}!

The goal here is to map the HI in the 3-d space of $(l, b, v)$ (that's
Galactic longitude, latitude, and velocity) and then present the results
in one or more color images to show the hollowed-out shell with the
swept-up gas piled up at the edges.

\section{MAPPING THE NORTH POLAR SPUR and its associated EXPANDING HI SHELL}

This is a huge shell produced (and continuing) by several energetic
stellar winds and supernovae that were located in the Sco/Oph
association of stars. The shell contains not only HI but also
relativistic electrons, so the shell is visible in both the 21-cm line
and synchrotron emission. We can't easily see the latter, but we can see
the HI---and the pattern of its velocity follows that of an expanding
shell.

For this, you'd map the region covering roughly $(\ell=210^\circ
\rightarrow 20^\circ, b=0^\circ \rightarrow 90^\circ)$. (The longitude
range is $170^\circ$: $210^\circ \rightarrow 360^\circ$ plus $0^\circ
\rightarrow 20^\circ$). This is roughly 1/4 of the whole sky, so this is
a huge area---almost 10000 square degrees! (This shell has an angular
diameter of $120^\circ$). But (unfortunately) you can't measure the
equivalent 2000 HI profiles because most of this area is too far
south. At least, this makes the project do-able! In doing your
observations, you need to cover as far south as you possibly can. See
\S \ref{sampling}!

The goal here is to map the HI in the 3-d space of ${l, b, v}$ (that's
Galactic longitude, latitude, and velocity) and then present the results
in one or more color images to show the hollowed-out shell with the
expanding swept-up gas piled up at the edges.

\section{MAPPING A BIG HIGH-VELOCITY CLOUD}

When we look up, away from the Galactic plane, we see infalling
gas---some a very high velocities. It's called ``High-Velocity Gas''.
The line is weak (about 1 to 1.5 K), so you need high sensitivity---you
need to use much longer integration times than for the above projects,
at least a few minutes per point.  This project needs to map the region
bounded roughly by $(\ell=60^\circ \rightarrow 180^\circ), b=20^\circ
\rightarrow 60^\circ)$. This is about 3700 square degrees and needs
about 900 profiles at $2^\circ$ spacing. See
\S \ref{sampling}!

The goal here is to map the HI in the 3-d space of ${l, b, v}$ (that's
Galactic longitude, latitude, and velocity) and then present the results
in one or more color images.

\section{MAPPING THE MAGELLANIC STREAM}

The Magellanic Stream is an intergalactic tidal stream produced by
gravitational interaction between the Magellanic Clouds and the Milky
Way. The signal is weak ($\sim$ a few tenths K), so you need to use much
longer integration times than for the above projects---a minimum of 10
minutes per point. You need to map the pie-shaped area bounded roughly
by $(\ell=60^\circ \rightarrow 110^\circ), b=-90^\circ \rightarrow
-30^\circ)$. This is about 1250 square degrees and needs about 310
profiles at $2^\circ$ spacing. See \S \ref{sampling}!  Also, the LSR
velocity of this gas ranges from roughly $-400 \ {\rm to} \ -100$ km/s
along its length, so you need frequency switch by a large enough
interval!

The goal here is to map the HI in the 3-d space of ${l, b, v}$ (that's
Galactic longitude, latitude, and velocity) and then present the results
in one or more color images.

\section{BASICS OF THE 21-CM LINE.} \label{basics}

\subsection{Column Density and Mass} \label{coldensity}

	The 21-cm line, with frequency 1420.405751786 MHz, comes from
atomic hydrogen (HI).  In the terrestrial environment, H atoms quickly
become H$_2$ molecules; in interstellar space, where densities are far
lower than in the best vacuum systems on Earth and there are ``lots'' of
UV photons that dissociate H$_2$, H remains atomic unless it resides
inside dark clouds where it is shielded from starlight.

	The intensity of the 21-cm line is directly proportional to the
column density of H atoms as long as the opacity of the line is small;
this is a reasonably good approximation (but not perfect, particularly
in the Galactic plane where the line is strong). With this
approximation, 

\begin{equation} \label{nh1}
N_{HI} = 1.8 \times 10^{18} \int T_{B}(v) dv \ {\rm cm^{-2}}. 
\end{equation}

\noindent Here $N_{HI}$ is the column density of H atoms---the number of
atoms in a 1 cm$^2$ column along the line of sight; $T_{B}(v)$ is the
brightness temperature of the 21-cm line, which is a function of 
velocity $v$; and $v$ is the velocity in km s$^{-1}$. The velocity $v$
is produced by the Doppler effect, so a frequency shift $\Delta \nu$
from line center corresponds to velocity $v = - c {\Delta \nu \over
\nu}$ or, for the 21-cm line, $v = -{\Delta \nu \over 4.73 {\rm kHz}}$ km/s.
Note the minus sign! It means that positive velocities are receding---a
very convenient convention for astronomy, because of the expansion of
the Universe. 

          Note an important corollary to equation \ref{nh1}: If we
consider a small velocity interval $\Delta v$, then the number of H
atoms in the column in that velocity range is just 

\begin{equation} \label{nh2}
N_{HI}(v \rightarrow v + \Delta v) = 1.8 \times 10^{18} T_{B}(v) \Delta
v \ {\rm cm^{-2}} \ .  
\end{equation}

\noindent This is very important, because it gives us the opportunity to
make maps of the interstellar gas at different velocities and to
determine how it moves.

	To get the column density we need to get the brightness
temperature $T_B$, which is not the same as our antenna temperature
$T_A$. The relationship between these depends on the relative size of
the source and the beam. This is equation (9) in the ``Fount of All
Knowledge!'' handout, namely 

\begin{equation} \label{taeqn}
T_A \approx T_B {\Omega_s \over \Omega_s + \Omega_b} \ ,
\end{equation}

\noindent where $\Omega_s$ and $\Omega_b$ are the solid angles of the
source and beam, respectively. From this, we see that if the source
fills the beam ($\Omega_s \gtrsim \Omega_b$) then $T_A \approx \langle
T_B\rangle$ (the brackets denote the average over solid angle);
while if it is much smaller ($\Omega_s \ll \Omega_b$) then $T_A \approx
{\langle T_B \Omega_s\rangle \over \Omega_b}$, i.e.\ $T_A$ is smaller by the ratio of
the solid angles. 

	To get the mass of HI from the column density, you need to know
the area of the region in {\it linear} measure, which is just $\Omega \
d^2$, where $d$ is the distance.  Each HI atom has mass $m_H$, so the
total mass of HI in a region of size $\Omega$ is just

\begin{mathletters} \label{masseqn}
\begin{equation} 
M_{HI} = m_H \ d^2 \ \langle N_{HI} \Omega\rangle \ .
\end{equation}

\noindent Here $\langle N_{HI} \Omega \rangle$ is shorthand for the
general relation, which uses an integral:

\begin{equation}
\langle N_{HI} \Omega \rangle = \int_{\rm region} N_{HI} d \Omega
\end{equation}
\end{mathletters}

\noindent Substituting for $N_{HI}$ from equation \ref{nh2}, we have

\begin{equation}  \label{telemass}
M_{HI}(v) = 1.8 \times 10^{18} \Delta v \ d^2 \  m_H \ \langle T_B  \Omega\rangle \ {\rm
gm} \ . 
\end{equation}

\noindent Units are cgs. Sometimes there is a well-defined source with
boundaries; in this case, to get the mass of the whole source, we use
the solid angle occupied by the source, $\Omega_s$.

	Sometimes (in fact, often) we want to know the mass seen {\it by
the telescope} for some particular observation.  For an extended region
with $\Omega \gg \Omega_b$, $T_A = T_B$ and the telescope sees the solid
angle $\Omega_b$, so the product $\langle T_B \Omega\rangle = T_A
\Omega_b$ because angular area seen by the telescope is limited by its
beam size.  In contrast, if the HI emission is limited to a small
region---a small source with $\Omega_s \ll \Omega_b$---then $T_A \approx
{\langle T_B \Omega_b\rangle \over \Omega_s}$ so the product $\langle
T_B \Omega_s\rangle = T_A \Omega_b$; the telescope sees the whole
source.  

For both extremes, the product $T_B \Omega = T_A \Omega_b$. 
It's not only these two extremes, but for {\it all} sources the
product $\langle T_B \Omega \rangle= T_A \Omega_b$.  Thus, it is always true that the
mass seen by the telescope is

\begin{equation}  \label{telemass1}
M_{HI}(v) = 1.8 \times 10^{18} \Delta v \ d^2 \ m_H \ T_A  \Omega_b  \ {\rm
gm} \ . 
\end{equation}

\noindent The distance $d$ is usually a function of velocity $v$,
especially in the Galactic plane. 

	$T_A(v)$ is directly measured and $\Omega_b$ is the telescope
beam area, which is known, so it's easy to calculate $M_{HI}(v)$---but
only if you know the distance! Often you don't know the distance, but
you might have a hunch for a reasonable value for the distance. Suppose
this is 100 parsecs. In this case, people usually evaluate the mass for
this distance and, when giving the mass, say ``The mass is $xxx \times
d_{100}^2$, where $d_{100}$ is the distance in units of 100 pc''.

\subsection{Converting Galactic Rotation to Doppler Velocity}

          Measurement of the Doppler shift caused by differential
Galactic rotation for $0^\circ < \ell < 90^\circ$ allows a direct
determination of the Galactic rotation curve inside the Solar circle,
using the ``tangent point'' method. See Burton's article ``Structure
of our Galaxy from Observations of HI'' in {\it Galactic and
Extragalactic Radio Astronomy, second edition} (editors: G.L. Verschuur
and K.I. Kellermann). In essence, you use the following equation.

	We won't go through the derivation here; we cover it in class,
and it is also done in Burton's article,
page 303-304.  Let $V_{Dopp}$ be the Doppler velocity (this is also the
observed LSR velocity), $V(R)$ be the Galactic rotation velocity at
Galactocentric distance $R$, and let the subscript $\odot$ denote values
at the Solar circle.  Then we have
\begin{equation} \label{vdopp}
V_{Dopp} = \left[ {V(R) \over R} - {V(R_\odot) \over R_\odot}\right]
R_\odot \sin(\ell)
\end{equation}
\noindent The values at the solar circle are $V(R_\odot) \approx 220$
km/s, $R_\odot \approx 8.5$ kpc.

\section{DISPLAYING YOUR DATA} \label{datadisplay}

Before actually working with imaages on the computer, you need to
familiarize yourself with our imaging handouts:
\begin{enumerate}

\item MAP PROJECTIONS: REPRESENTING A SPHERICAL SURFACE ON A COMPUTER
  SCREEN.

\item 1d2d3d: ONE, TWO, AND THREE DIMENSIONAL COLOR IMAGES. This
is not IDL oriented, but rather discusses general principles of imaging:
gray-scale imaging, pseudocolor imaging, 2d color imaging (intensity
and a color table), 3d color imaging (red-green-blue, or rgb,
imaging). Read this first!

\item IMAGE DISPLAY AND MANIPULATION; AND COLORBARS. This covers
  the basics of imaging and is mainly oriented toward using IDL for
  imaging and imaging processing.
\end{enumerate}

\subsection{MAP PROJECTIONS: REPRESENTING A SPHERICAL SURFACE ON A COMPUTER SCREEN}

Computer screens consist of an array of dots that can glow in various
colors. The dots are arranged in a square array and are called {\it
  pixels}. PostScript images are the same, with the added feature that
the pixels need not be square; that is, then horizontal distance can
differ from the vertical one. To display our data as an image on the
screen, we must populate these pixels with observed data. 

Our observed positions do not lie on this grid. Rather, our observations
lie on the celestial sphere. We need to represent this spherical surface
on our 2d pixellated computer screen---or as a 2d PostScript image on
a flat piece of paper. There are innumerable ways to do this
{\it projection}, each of which has its own
desirable properties. No projection is perfect; each is a compromise 
among various desirable and undesirable properties. 

Our handout MAP PROJECTIONS describes the most common projections. Two
examples:
\begin{enumerate}

\item The simplest is the {\it cylindrical
equidistant projection}, for which the entire sky is represented by
longitude horizontally and latitude vertically with square pixels each
having the same size in $(\Delta \ell, \Delta b)$. Near the equator this
is a very nice projection because it has many desirable qualities: it
is nearly conformal, the pixels are nearly of equal solid angle. But as
you move away from the equator, these properties decay with increasing
severity because of foreshortening.

\item Suppose we want to be as conformal as possible, particularly with
  respect to representing small circles (supernova remnants or
  supershell walls). This is the {\it stereographic projection}, which
  is centered on its own defined pole and for which the conversion
  between its $(long, lat)$ and the pixel values $(x,y)$ is
%
\begin {mathletters}
\begin{equation}
   R = \tan[ 0.5 \times (90.-lat)] 
\end{equation}
\begin{equation}
   x= R \; \cos(long) 
\end{equation}
\begin{equation}
   y= R \; \sin(long) 
\end{equation}
\end {mathletters}
%
(see our {\tt stereographic.pro}). Here, you have previously defined a
new coordinate system by specifying the pole of the map, which ideally
is the center of the supershell being mapped, and have converted
$(ra,dec)$ or $(\ell,b)$ to the $(long,lat)$ of that new system.

\end{enumerate}

\subsection{Regridding}


How do we populate this $(x,y)$ grid
with our data? This process is called {\it regridding}. There are
several ways to regrid; we describe the one that loses least
information (but requires the most computer resources---our
philosophy is `computers are cheap').

To regrid proceed as
follows: \begin{enumerate}

\item Set the angular $(x,y)$ pixel size. The size must be smaller than
  the smallest great-circle distance between observed points. For
  example, if the separation between observed points is 2 degrees, a
  pixel size of 1 degree (or 0.1 degree) is OK. For the cylindrical
  equidistant projection with a pixel size of 1 degree there are 360
  horizontal pixels and 180 vertical ones, for a total of 64800 pixels.

\item Create an empty 3-d data cube of the appropriate dimensions. The
  first two dimensions are $(x,y)$ and the third is velocity. If you
  have 256 velocity channels, the above cylindrical equidistant cube
  would have dimensions $360 \times 180 \times 256$. The cells in this
  cube are 3-d and are called {\it voxels}.

\item For each pixel, find the nearest observed position. For the angles
  on the sky, a suitable approximation for the distance squared is $[
    (\cos (b) \Delta \ell)^2 + \Delta b^2]$. Populate that pixel with
  the nearest observed data value. For the velocity, use linear
  interpolation.  (IDL's {\tt interpol} procedure is convenient for
  this purpose).

\end{enumerate}

\subsection{Displaying Your Data---The Exploratory Phase}

For public presentation, you may want to display your data cube in its
full 3d glory with a 2d image where brightness represents `amount'
(e.g., the integrated area of the HI line) and color the mean
velocity. Or by describing each pixel by 3 numbers (e.g., the integrated
intensity
within 3 different velocity ranges) and writing them on the same
image plane as the 3 independent colors red, green, blue. 

However, making effective use of color requires defining what color
means, and the best `exploratory' work uses gray-scale imaging. Set up
an IDL imaging window and look at successive $(x,y)$ grayscale images at
different velocities. That is, make a `movie'. For our above example
$360 \times 180 \times 256$ data cube, in IDL a bare-bones way
is:

\begin{verbatim}
window, 0, xs=600, ys=400  (any convenient size will do) 
for nc = 0, 255 do begin
display, image[*,*,nc], min=0, max=33, top=240
wait, 0.2
endfor
\end{verbatim}

\noindent Here the keywords {\tt (min, max)} mean a data value of {\tt
  min} gives black and {\tt max} gives white, with shades of gray in
between, and {\tt top} means use color table entries below 240 (our
default colortable reserves the upper entries for non-gray colors.).
This movie `flashes'; there are ways to prevent this, but the following
is easiest:

\begin{verbatim}
window,0,xs=360,ys=180  (sizes should match 2d pixel size or integer
multiples thereof)
for nc = 0, 255 do begin
tv, bytscl(img[*,*,nc], min=0, max=33., top=240)
xyouts, .01, .01, strtrim(string(nc),2), color=!red, /norm, charsize=4, charthick=4
wait,  0.2
endfor
\end{verbatim}

\noindent
This latter way gives a one-to-one relation between pixel location and
the $(x,y)$ array indices, which is best for further image analysis
using the tools described in \S 5 and \S 6 in our handout {\bf IDIDL}.


\end{document}

