\subsection{Clustering}
\label{sec:clustering}

We compared three clustering algorithms applied to the original
substitute vectors using many-to-one accuracy on the PTB24K.
Hierarchical agglomerative clustering with complete linkage (HAC)
starts with each instance in its own cluster and iteratively combines
the two closest groups (measured by their most distant points) at each
step \cite{manning2008introduction}.  K-medoids minimizes sum of
pairwise distances between each data-point to the exemplar at the
center of its cluster \cite{kaufman2005finding}.  Spectral
clustering\footnote{We used the implementation in
  \cite{chen2011parallel} with a symmetric sparse affinity matrix of
  550 nearest neighbors.} uses the eigenvalues of the graph Laplacian
$L=D^{-1/2} W D^{-1/2}$ to reduce the number of dimensions (similar to
Laplacian eigenmaps) and uses simple k-means clustering on the
resulting representation \cite{ng2002spectral}.  All three algorithms
accept the distance matrix based on the KL2 distance (see
Section~\ref{sec:dist}) as input.

\begin{figure}[h] \centering
  \includegraphics[width=0.6\textwidth]{clustering_graph_mono.png}
\caption{Many-to-one score for three clustering algorithms on the
  45-tag 24K word corpus.}
\label{fig:clustering}
\end{figure}

% #cluster kmedoid spectral hac
% 2          0.20795 0.17781 0.135762
% 4          0.29413 0.33439 0.155579
% 8          0.36615 0.39550 0.159076
% 16        0.43830 0.46116 0.263988
% 32        0.43318 0.54192 0.329850
% 45        0.46245 0.59413 0.401832
% 64        0.46965 0.59151 0.438843
% 128      0.48235 0.63106 0.506703
% 256      0.53709 0.65000 0.558659
% 512      0.58464 0.66520 0.616653
% 1024     0.62985 0.67523 0.658576
% 2048     0.66107 0.68414 0.696878
% 4096     0.69842 0.71286 0.744338

Figure~\ref{fig:clustering} plots the many-to-one score versus number
of clusters for the three algorithms on the PTB24K.  The many-to-one
score naturally increases as we approach the one cluster per word
limit, however we find the evolution of the curves informative.  At
the high end (more than 2000 clusters) HAC performs best with its
conservative clusters, but its performance degrades fast as we reduce
the number of clusters because it cannot reverse the accumulating
mistakes.  At the low end (less than 16 clusters) k-medoids and
spectral have similar performance.  However for the region of interest
(between 16 to 2000 clusters) spectral clustering is clearly superior
with \spectralResult\ \mto\ accuracy at 45 clusters.

To demonstrate that the clustering algorithm can scale, we performed
spectral clustering on the full PTB.  We calculated the substitute
vectors of each position in the PTB by using an efficient algorithm
described in Section~\ref{sec:expset}\footnote{The algorithm in
  Section~\ref{sec:expset} only calculates the top 100 substitutes and
  their unnormalized probabilities which results in sparse substitute
  vectors.  As a result the new model is computationally more
  efficient than the one in this section and it is more appropriate
  for large datasets like the PTB.}.  We used the Manhattan
distance\footnote{KL2 is undefined on sparse vectors, therefore we use
  Manhattan whose performance is close to KL2 on both the PTB24K and
  PTB.}  to compute the vector similarities and achieve
\spectralMtoPTB\ \mto\ accuracy.

We noted that the 45 cluster spectral clustering result assigned many
more tags to each word than the gold standard.  To increase the
sparsity of the solution we enforced a one-tag-per-word restriction by
re-tagging each word with its most frequent tag in the original
assignment (we break ties randomly).  One-tag-per-word re-tagging
improves the \mto\ accuracy from \spectralMtoPTB\ to \collapseMtoPTB.

The re-tagging experiment shows that the one-tag-per-word restriction
improves the model performance in terms of the \mto\ accuracy by
explicitly incorporating the word type information into the model.  In
the next section we suggest an alternative method that models the
co-occurrence of word types and their contexts as represented by
substitutes and improves the results on the PTB.

%% Section~\ref{sec:dist} reveals that using the language model described
%% in Section~\cite{sec:lm}.  Using the top 100 substitutes results in
%% sparse substitute vectors on which KL2 is undefined.  However scores
%% of similarity metrics on PTB found to be in line with results on
%% PTB24K from Section~\ref{sec:dist}. Thus KL2's successor Manhattan
%% metric is chosen for spectral clustering.

%% Spectral clustering on 1M word data set scored ??\mto accuracy.  To
%% enforce one-tag-per-word assumption we assigned each word to its most
%% observed cluster which increased the \mto accuracy to ??.

% LocalWords:  PTB


%%#fixtex% for html/pdf   -*-latex-*-
\section{The Basics of {\ifeffit}} \label{Ch:Basics}

{\ifeffit} is a command-based program. That is, you tell {\ifeffit} to do
something, it does that and then waits for you to tell it what to do next.
The commands that {\ifeffit} accepts are simple statements (there are no
loops or conditional statements) useful for data manipulation, and
especially for XAFS analysis.  Most commands tell {\ifeffit} to manipulate
arrays of numerical data.  There are commands for reading arrays from
files, writing arrays to files, plotting arrays, doing simple mathematical
manipulation of arrays, and more XAFS-specific commands such as
background-spline removal and Fourier transforms.  It can also fit XAFS
data using theoretical standards from {\feff} with complex modeling
abilities and automated error analysis.  This chapter gives a quick
overview of {\ifeffit} with a simple annotated example.  Much of this
material is also covered in {\IFFtut}.

\subsection{Starting the program} \label{Ch:Basics-starting}

Typing {\tt{ifeffit}} at the system command prompt will start the basic
{\ifeffit} command-line program.  You should get a set of messages and a
command prompt that looks like this:

{\small\begin{verbatim}
  Ifeffit 1.2.7  Copyright (c) 2005 Matt Newville, Univ of Chicago
                   command-shell version 1.1 with GNU Readline
  Ifeffit>
\end{verbatim}}
\noindent
At this point, you're ready to start typing {\ifeffit} commands at the
prompt.  If you don't get such a prompt, the installation on your machine
is probably corrupted. Detailed installation instructions are available
with the {\ifeffit} distribution.

\subsection{A Sample Run} \label{Ch:Basics-sample}

We start with a fairly complete example (see the tutorial for a more gentle
introduction). Let's say you have some raw data from a beamline in a
plain-text column format, and you want to convert it to $\mu(E)$, do a
background subtraction, and then a Fourier Transform to see what the data
looks like in $R$-space.  Though a very practical request, it's really
quite a bit of data processing, so this is a fairly intense example.
Here's what the session might look like:

{\small{
%%#VerbSBox%
\begin{VerbSBox}
 Ifeffit> read_data(file=Cu.dat, type=raw, group= cu)
 Ifeffit> cu.energy  = cu.1 * 1000.0
 Ifeffit> cu.xmu     = ln(cu.2 / cu.3)
 Ifeffit> spline(energy = cu.energy, xmu = cu.xmu,
 Ifeffit>        rbkg=1.1, kweight=1., kmin=0)
 Ifeffit> plot(cu.energy, cu.xmu)
 Ifeffit> plot(cu.energy, cu.bkg, xmin=8850, xmax=9300,
 Ifeffit>                         color=red)
 Ifeffit> kweight = 2.0,  cu.chi_kw = cu.chi * cu.k^kweight
 Ifeffit> newplot(cu.k,  cu.chi_kw)
 Ifeffit> fftf(real = cu.chi, kmin = 2.0, kmax = 13.0,
 Ifeffit>      dk = 1.0, kweight=2)
 Ifeffit> newplot(cu.r, cu.chir_mag, xmax=8)
 Ifeffit> $title1 = "Test: writing out  k, chi, chi*k"
 Ifeffit> $title2 = "   data from Cu.dat,   rbkg = 1.0"
 Ifeffit> write_data(file = Out.chi,  cu.k, cu.chi,
 Ifeffit>            cu.chi_kw, $title1, $title2)
\end{VerbSBox}
%%#VerbSBox%
}}\noindent

One important aspect of {\ifeffit} is that you can save commands into a
file and execute all commands in that file at one time.  By saving the
above commands into the file {\file{process.iff}}, we could simply type
{\tt{load process.iff}} at the {\ifeffit} command line.  These two methods
of running these commands are completely equivalent.

We'll now go through each of these lines in detail.  At times there may be
{\emph{too}} much detail here.  If so, please go through the {\textsl{The
    {\ifeffit} Tutorial}} and be patient.

\begin{verbatim}
 Ifeffit> read_data(file=Cu.dat, type=raw, group= cu)
\end{verbatim}
\noindent
This command reads in data arrays from the ASCII column file
{\file{Cu.dat}}.  The arguments {\tt{type=raw}} and {\tt{group=cu}} help
{\cmnd{read\_data()}} name the arrays it reads in.  Because arrays are often
read in and processed together, it is convenient to give them names that
are related.  Arrays names always have two parts -- a prefix and suffix,
with a dot '.' in between.  The prefix gives the group name, and the suffix
explains what the data contains.  Here, {\tt{cu}} is used as the group name
(prefix).  The type {\tt{raw}} is the simplest type, so the suffixes will
just be the column index.  To make a long story short, we just read in the
arrays {\tt{cu.1}}, {\tt{cu.2}}, and {\tt{cu.3}}.

\begin{verbatim}
 Ifeffit> cu.energy  = cu.1 * 1000.
 Ifeffit> cu.xmu     = ln(cu.2 / cu.3)
\end{verbatim}
\noindent
Presumably, we know what the contents of our data file. For this
{\file{Cu.dat}} file, the column contained energy in keV, the second
contained $I_0$ and the third $I$, for absorption data measured in
transmission.  There might have been more columns in the file, but this is
all we need at this point. {\ifeffit} prefers to think about energy in eV
not keV, so we make an array {\tt{cu.energy}} that has energy in eV, and
then we calculate $\mu(E)$ and call that {\tt{cu.xmu}}.  Note
that the math here is done on all elements of the array.

\begin{verbatim}
 Ifeffit>  spline(energy = cu.energy, xmu = cu.xmu,
 Ifeffit>         rbkg=1.1,kweight=1.,kmin=0)
\end{verbatim}
\noindent
This computes the background spline $\mu_0(E)$ for our $\mu(E)$ using the
{\autobk} algorithm.  The argument {\tt{energy = cu.energy}} names the
array to use as the energy values, and {\tt{xmu = cu.xmu}} names the
$\mu(E)$ array.  {\tt{rbkg=1.1}} sets the value of $R_{\rm bkg}$, while
{\tt{kweight=1.}} sets the $k$-weighting, and {\tt{kmin=0}} sets the value
of $k_{\rm min}$.

Like many other commands, {\cmnd{spline}} uses, modifies, and (if necessary)
creates several arrays and scalars.  The complete list of what
{\cmnd{spline}} uses is listed in section~{\ref{Ch:Command:spline}}.  For now a
partial list will do: {\cmnd{spline}} sets the arrays {\tt{cu.bkg}} to
contain $\mu_0(E)$, {\tt{cu.k}} to contain the $k$ values, and
{\tt{cu.chi}} to contain $\chi(k)$.  Several scalar values (including
{\tt{rbkg}}, {\tt{kweight}}, {\tt{kmin}}, and {\tt{e0}}) are also set by
{\cmnd{spline}}.  You can see the values of these variables with the
{\cmnd{show}} command -- try {\tt{show(e0, kmax)}} for example.

\begin{verbatim}
 Ifeffit>  plot(cu.energy, cu.xmu)
\end{verbatim}
\noindent
This plots $\mu(E)$.  That is a plot window should appear and a trace of
$\mu(E)$ should be drawn on it.  If this does not happen, please consult
the installation instructions.  The {\cmnd{plot}} command has many optional
arguments, but here we're just giving the array names for the ordinate
{\tt{cu.energy}} and the abscissa {\tt{cu.xmu}}.

% Actually, we could have even dropped the group name in the argument.  This
% is a common feature -- When a command expects to read an array name and
% doesn't find a name with a '.' in it, it uses the name given as the suffix
% and uses the default group name (which gets set by all array-processing
% commands,  so is likely to be set already).  This means that we could have
% typed {\tt{plot(energy, xmu)}} and gotten the same plot.

\begin{verbatim}
 Ifeffit>  plot(cu.energy, cu.bkg, xmin= 8850, xmax= 9300,
 Ifeffit>       color=red)
\end{verbatim}
\noindent
This adds a plot of $\mu_0(E)$ to the previous plot.
We specify the x range of the
plot with {\tt{xmin = 8850, xmax = 9300}} to look at just the near-edge
region, and explicitly give the color to use for $\mu_0(E)$.  Note that
overplotting is the default behavior.  See section~{\ref{Ch:Command:plot}} for
all the plotting options, and chapter~{\ref{Ch:Plot}} for even more
information about plotting with {\ifeffit}.

\begin{verbatim}
 Ifeffit>  kweight = 2.0,  cu.chi_kw = cu.chi * cu.k^kweight
\end{verbatim}
\noindent
This sets the value of {\tt{kweight}} and uses the new value to create the
array {\tt{cu.chi\_kw}} which contains $k^2\chi(k)$.  Note that multiple
``set variable'' commands were put on a single line.

\begin{verbatim}
 Ifeffit>  newplot(cu.k,  cu.chi_kw)
\end{verbatim}
\noindent
This plots the $k$-weighted $\chi(k)$ that we just calculated.
{\cmnd{newplot}} is a variation of {\cmnd{plot}} command that reinitializes
the plot, so that it won't be plotted over the current window (which was
still showing $\mu(E)$ and $\mu_0(E)$).

\begin{verbatim}
 Ifeffit>  fftf(real = cu.chi, kmin = 2.0, kmax = 13.0,
 Ifeffit>        dk = 1.0, kweight=2)
\end{verbatim}\noindent
This does the forward XAFS Fourier transform of $\chi(k)$.  The argument
{\tt{real = cu.chi}} tells {\cmnd{fftf}} to use {\tt{cu.chi}} (which is the
un-$k$-weighted $\chi(k)$ from {\cmnd{spline}}) as the real part of the
function to Fourier transform.  We could have said {\tt{imag = cu.chi}} to
use $\chi(k)$ as the imaginary part.  This is, to some extent, a matter of
convention -- see {\XAIBook} for more details.

The Fourier transform window was specified with the parameters {\tt{kmin}},
{\tt{kmax}}, and {\tt{dk}}.  The $k$-weight parameter for the Fourier
transform will be read from the variable {\tt{kweight}}, which we just
defined as 2.  {\cmnd{fftf}} creates arrays {\tt{cu.r}} for $R$, and
{\tt{cu.chir\_re}}, {\tt{cu.chir\_im}}, and {\tt{cu.chir\_mag}} for the
real part, imaginary part, and magnitude of $\tilde\chi(R)$, among other
things.

\begin{verbatim}
 Ifeffit>  newplot(cu.r, cu.chir_mag, xmax = 8)
\end{verbatim}\noindent
Now we plot $|\chi(R)|$, explicitly limiting the $R$-range to $8
{\rm{\AA}}$.  By default, the $R$-based arrays from {\cmnd{fftf}} will
extend to $10 {\rm{\AA}}$.

\begin{verbatim}
 Ifeffit>  $title1 = "Test: writing out  k, chi, chi*k"
 Ifeffit>  $title2 = "   data from Cu.dat,   rbkg = 1.1"
\end{verbatim}\noindent
Here we define a pair of {\emph{text string}} variables, which always have
names starting with a dollar sign.  These are useful for doing
things like
\begin{verbatim}
 Ifeffit>  write_data(file = out.chi,  cu.k, cu.chi,
 Ifeffit>             cu.chi_kw, $title1, $title2,e0,rbkg)
\end{verbatim}\noindent
in which we save the $\chi(k)$ and $k$-weighted $\chi(k)$ data to the file
{\file{out.chi}}.  The rest of the arguments list the arrays, text strings,
and scalars to write to the output file.  Text strings will be written
first, then the scalars, and finally the data arrays will be written, all
given in the order listed.  This ends the annotated example.

\subsection{The {\texttt{show}} and {\texttt{print}}  Commands}
\label{Ch:Basics-show}

Two very important commands that you definitely want to know about were
left out of the above example.  These are the {\cmnd{show}} and
{\cmnd{print}} commands, which will write out information about Program
Variables, including their values.  The {\cmnd{show}} command takes a
simple list of program variables, like this:
\begin{verbatim}
 Ifeffit>  show e0, kmin, $title1, cu.chi
\end{verbatim}\noindent
%%%-------------------------------------------------------------------------$
and will print something like
\begin{verbatim}
 e0            =  8982.315
 kmin          =  2.000000
 $title1       = Test: writing out  k, chi, chi*k
 cu.chi        = 302 pts [ -0.3232080 : 1.233829 ]
\end{verbatim}
%%%----------------------------------------$
\noindent
{\cmnd{show}} doesn't print out entire arrays but gives just enough
information (the number of points, and the minimum and maximum value) to
convince you that an array exists.  The {\cmnd{show}} command can also be
used to show all current scalars, arrays, and strings.  You can read more
about the {\cmnd{show}} command in section~{\ref{Ch:Command:show}}.

Whereas the {\cmnd{show}} command will only report about existing variables,
and will not do any processing, the {\cmnd{print}} command is a bit more
literal, printing out the {\emph{values}} of variables or expressions.
That is, {\tt{print(e0)}} will just print the numerical value of {\tt{e0}}
to the screen:
\begin{verbatim}
 Ifeffit>  print e0
      8982.315
 Ifeffit>  print "sqrt(25) + 1.001"
       6.00100
\end{verbatim}\noindent
Note that in the last example, the math expression was enclosed in double
quotes.  This (or equivalently, enclosing braces ``\{\}'') tells {\ifeffit}
to evaluate the expression, instead of printing it literally, and tells
{\ifeffit} where the expression ends.  Using single quotes would print
the expression literally:
\begin{verbatim}
 Ifeffit>  print 'sqrt(25) + 1.001 = ', "sqrt(25) + 1.001"
   sqrt(25) + 1.001 =  6.00100
\end{verbatim}\noindent
You can also {\cmnd{print}} out several expressions at once:
\begin{verbatim}
 Ifeffit>  print "sqrt(25) + 1.001", "pi / 2"
       6.001000      1.570796
\end{verbatim}\noindent
Using {\cmnd{print}} for arrays (or an expression that gives an array) will
print all the values of the arrays:
\begin{verbatim}
 Ifeffit>  print indarr(4)/5
     0.2000000     0.4000000     0.6000000     0.8000000
\end{verbatim}

Section~{\ref{Ch:Structure-info}} gives a more complete description of all
the ways of getting information back from {\ifeffit}.  We'll come back to
{\cmnd{show}} and {\cmnd{print}} in section~{\ref{Ch:Structure-Logging}},
where the ability to change where these outputs are printed will be
discussed.

At this point, you may find it useful to repeat the above example session
mixing in {\cmnd{show}} or {\cmnd{print}} commands after every line, and
plotting some of the other arrays.  That should give you enough of a feel
for {\ifeffit} to be able to use it for simple data processing and allow
you to use the rest of this document as a reference guide.


\section{CLOUD PHYSICS VARIABLES}

\subsection{Measurements of Liquid Water Content}
\begin{hangparagraphs}
\textbf{Raw Output PMS/CSIRO (King) Liquid Water Content} (W):\nop{PLWC}\nop{PLWC1}{}\textbf{
}\textbf{\uline{PLWC}}\sindex[var]{PLWC}\textbf{\index{PLWC},
}\textbf{\uline{PLWC1}}\index{PLWC1}\sindex[var]{PLWC1}\label{punch:5-3}\\
\emph{The power\index{King probe} dissipated by the sensor of a PMS/CSIRO
(King) liquid water\index{liquid water content} probe (in watts).
}PLWC is the power required to maintain constant temperature in a
heated element as that element is cooled by convection and evaporation
of impinging liquid water. The convective heat losses are determined
by calibration in dry air over a range of airspeeds and temperatures,
so that the remaining power can be related to the liquid water content.
The instrument is described in \href{https://opensky.ucar.edu/islandora/object/archives\%3A8155}{RAF Bulletin 24}\index{Bulletin 24}
and at \href{http://www.eol.ucar.edu/instruments/king-csiro-liquid-water-sensor}{this URL}.
See \nameref{PLWCC} (which follows) for processing.\\

\textbf{\label{PLWCC}PMS/CSIRO (King) Liquid Water Content} (g/m$^{3}$):\nop{PLWCC}{}\nop{PLWCC1}{}\textbf{
}\textbf{\uline{PLWCC}}\sindex[var]{PLWCC}\textbf{\index{PLWCC},
}\textbf{\uline{PLWCC1}}\index{PLWCC1}\sindex[var]{PLWC1}\\
\emph{The liquid water content}\index{liquid water content!King probe}
\emph{measured by a King probe.} This is calculated by relating the
power consumption required to maintain a constant temperature to the
liquid water content, taking into account the effect of convective
heat losses. The instrument and processing are described by King et
al. (1978)\footnote{King, W. D., D. A. Parkin and R. J. Handsworth, 1978 A hot-wire liquid
water device having fully calculable response characteristics. J.
Appl. Meteorol., 17, 1809--1813. See also Bradley, S. G., and W.
D. King, 1979 Frequency response of the CSIRO Liquid Water Probe.
J. Appl. Meteorol., 18, 361--366.} and in a note available at \href{https://github.com/NCAR/aircraft_ProcessingAlgorithms/blob/master/www/PLWCCrev140214.pdf}{this URL}.
Because the temperature of the sensing wire is typically well above
the boiling point of water\index{water!boiling point}, the assumption
made in processing is that the water collected on the sensing wire
is vaporized at the boiling point $T_{b}$. The boiling point is represented
as a function of pressure as described below. \\
\\
\\
\\
{[}see the algorithmn box on the next page{]}\\
\vfill

~~\\
\fbox{\begin{minipage}[t]{0.95\textwidth}%
PLWC = total power dissipated by the probe (W)\\
$P_{D}$ = power dissipated\index{King probe!power dissipated}\sindex[lis]{Power@$P$=power}
by the cooling effect of dry air alone\\
$P_{W}$ = power needed to heat and vaporize the liquid water that
hits the probe element\\
$L$ = length\sindex[lis]{L@$L$ =length (of a King-probe element)}
of the probe sensitive element\index{King probe!element dimensions},
typically 0.021\,m\\
$d$= diameter\sindex[lis]{d@$d$=diameter} of the probe sensitive
element, typically 1.805$\times10^{-3}$m\\
$T_{s}$= sensor temperature\index{King probe!sensor temperature}\sindex[lis]{Ts@$T_{s}$=temperature of a sensor}
($^{\circ}$C)\\
$T_{a}$= ambient temperature ($^{\circ}$C) = ATX\\
$T_{b}$\sindex[lis]{Tb@$T_{b}$= boiling temperature of water} =
boiling temperature of water (dependent on pressure):

~~~~~~~~~with $x=\log_{10}(p/(1$hPa)), $B=1^{\circ}C$,
and \{$b_{0},$ $b_{1}$, $b_{2}$, $b_{3}$\} = \{0.03366503, 1.34236135,
-0.33479451, 0.0351934\}: $T_{b}=B\times10^{(b_{0}+b_{1}x+b_{2}x^{2}+b_{3}x^{3})}$\\
$T_{m}=(T_{a}+T_{s})/2$ = mean temperature for air properties\\
$L_{v}(T_{b})$ = latent heat of vaporization of water\sindex[lis]{Lv@$L_{v}$=latent heat of vaporization of water}\index{latent heat of vaporization}
= (2.501-0.00237$T_{b}$)$\times10^{6}$J\,kg$^{-1}$\\
$c_{w}$\sindex[lis]{cw@$c_{w}$= specific heat of liquid water} =
specific heat of water = 4190~J\,kg$^{-1}$K$^{-1}$ (mean value,
0--90$^{\circ}$C)\\
$U_{a}$ = true airspeed (m/s) = TASX\\
$\lambda_{c}$\sindex[lis]{lambdac@$\lambda_{c}$= thermal conductivity, dry air}
= thermal conductivity\index{thermal conductivity|see {conductivity, thermal}}\index{conductivity!thermal}
of dry air (2.38+0.0071$T_{m}$)$\times10^{-2}$J\,m$^{-1}$s$^{-1}$K$^{-1}$\\
$\mu$\sindex[lis]{mu_{a}= dynamic viscosity of air@$\mu_{a}$= dynamic viscosity of air}
=viscosity of air =\index{viscosity} (1.718+0.0049$T_{m})\times10^{-5}$
kg\,~m$^{-1}$s$^{-1}$\\
$\rho_{a}$\sindex[lis]{rhoa@$\rho_{a}$= density of air} = density
of air = $p/(R_{d}(T_{a}+T_{0}))$\\
Re\sindex[lis]{Re= Reynolds number} = Reynolds number = $\rho_{a}U_{a}d/\mu_{a}$\\
Nu\sindex[lis]{Nu= Nusselt number} = Nusselt Number relating conduction
heat loss to the total heat loss for dry air:

~~~~~~~~~~%
\fbox{\begin{minipage}[t]{0.9\textwidth}%
typically Nu=$a_{0}\mathrm{Re}^{a_{1}}$ where, for the GV, $\{a_{0},\,a_{1}\}=1.868,\,0.343$
for Re<7244 and $\{0.135,\,0.638\}$ otherwise, except when TASX <
150 m/s; then use $\{0.133,\,0.382\}$. For the C-130 $\{a_{0},\,a_{1}\}=\{0.118,\,0.675\}$.%
\end{minipage}}, \\
$C_{kg2g}=1000$\sindex[lis]{Ckg2g@$C_{kg2g}$= conversion factor, g to kg}
= grams per kilogram

~~~~~~~~~~(unit conversion to conventional units for liquid
water content)\\
$\chi$ \sindex[lis]{chi@$\chi$=liquid water content}= liquid water
content (g/m$^{3}$) = PLWCC

\rule[0.5ex]{1\linewidth}{1pt}
\[
\mathrm{PLWC}=P_{D}+P_{W}
\]
where
\[
P_{D}=\pi\mathrm{Nu}\,L\lambda_{c}(T_{s}-T_{a})
\]
\[
P_{W}=L\,d[L_{v}(T_{b})+c_{w}(T_{b}-T_{a})]\,U_{a}\chi
\]
Result:
\[
\mathrm{PLWCC}=\chi=\frac{C_{kg2g}(\mathrm{\{PLWC\}}-P_{D})}{L\,d\,U_{a}[L_{v}(T_{b})+c_{w}(T_{b}-T_{a})]}
\]
%
\end{minipage}}\\
\\
In addition, a processing step is used to remove drift by calculating
the offset required to zero measurements obtained outside cloud. This
is done by adjusting the coefficient $a_{0}$ by nudging toward the
value required to give zero liquid water content outside cloud (as
indicated by another instrument, often a CDP showing droplet concentration
of <1 cm$^{-3}$). Specifically, when out-of-cloud, Nu$^{\prime}$
is calculated from Nu$^{\prime}=\mathrm{\{PLWC\}}/(\pi L\lambda_{c}(T_{s}-T_{a}))$.
Then the value of $a_{0}$ is updated via $a_{0}$ += (Nu$^{\prime}/Re^{a_{1}}-a_{0})/\tau$
(using, for the GV, separate coefficients for each of the three branches).
In this formula, $\tau$ should be the number of updates in a fixed
period, e.g., for a 100 s time constant and for 25-Hz processing,
$\tau=100\times25$. In addition, to avoid jumps when switching among
the branches, the linear coefficients \{$a_{0}$\} are adjusted with
each transition between branches to provide a continuous estimate
of the zero value.

\textbf{PVM-100 Liquid Water Content} (g/m$^{-3}$):\nop{PLWCG}{}\textbf{
}\textbf{\uline{PLWCG}}\textbf{\sindex[var]{PLWCG}}\index{PLWCG}\\
\emph{Cloud liquid water content for cloud droplets in the approximate
size range from 3--50 $\mu$m. }The PVM produces a measure of the
liquid water content directly, but a baseline value is sometimes subtracted
by reference to another cloud droplet instrument such as an FSSP or
CDP, such that when the other instrument measures a very low droplet
concentration the baseline value for the PVM-100 is updated at the
corresponding time and that average is then subtracted from the measurements
directly produced by the PVM-100.\label{punch:5-1}

\textbf{Rosemount Icing Detector Signal} (V):\nop{RICE}{}\textbf{
}\textbf{\uline{RICE}}\sindex[var]{RICE}\index{RICE}\\
\emph{The voltage related to loading on the element of a Rosemount
871F\index{Rosemount 871F icing probe} ice-accretion probe.} This
instrument (see \href{https://www.eol.ucar.edu/instruments/rosemount-icing-detector}{this URL})
consists of a rod set in vibration by a piezoelectric crystal. The
oscillation frequency of the probe changes with ice loading, so in
supercooled cloud ice accumulates on the sensor and the change in
oscillation frequency is transmitted as a DC voltage. When the rod
loads to a trigger point, the probe heats the rod to remove the ice.
The rate of voltage change can be converted to an estimate of the
supercooled liquid water content\index{liquid water content!supercooled},
as described in connection with the obsolete variable SCLWC. This
calculation is no longer provided routinely but can be duplicated
by a user on the basis of the SCLWC algorithm (see page \pageref{SCLWC})
or one of several other published algorithms.
\end{hangparagraphs}

\subsection{Sensors of Individual Particles (1-D Probes)\label{subsec:1DProbes}}

The RAF operates a set of hydrometeor detectors\index{hydrometeor detector}
that provide single-dimension measurements (i.e., not images) of individual
particle sizes. \href{https://opensky.ucar.edu/islandora/object/archives\%3A8155}{RAF Bulletin 24}
contains extensive information on the operating principles and characteristics
of some of the older instruments. Here the focus will be on the meanings
of the variables in the archived data files.\index{Bulletin 24}\label{punch:5-2}

\label{VariableNames1DProbes}Four- and five-character variable names\index{variable names!hydrometeor probes}
shown in this section are generic. The actual names appearing in NIMBUS-generated
production output data sets have appended to them an underscore (\_)
and three or four more characters that indicate a probe's specific
aircraft mounting location. For example, AFSSP\_RPI refers to a variable
from an FSSP-100 probe mounted on the inboard, right-side pod. The
codes presently in use are given in the following table. For the GV,
there are 12 locations available, characterized by three letters.
The first is the wing (\{L,R\} for \{port,starboard\}), the second
is the pylon (\{I,M,O\} for inboard, middle, outboard\}), the third
is which of the two possible canister locations at the pylon is used
(\{I,O\} for \{inboard, outboard\}).

\begin{center}
\begin{tabular}{|c|c|c|}
\hline
\textbf{Code} & \textbf{Location} & \textbf{Aircraft}\tabularnewline
\hline
\hline
OBL  & Outboard Left  & C-130Q \tabularnewline
\hline
IBL  & Inboard Left  & C-130Q \tabularnewline
\hline
OBR  & Outboard Right  & C-130Q \tabularnewline
\hline
IBR  & Inboard Right  & C-130Q \tabularnewline
\hline
LPO  & Left Pod Outboard  & C-130Q \tabularnewline
\hline
LPI  & Left Pod Inboard  & C-130Q \tabularnewline
\hline
LPC  & Left Pod Center  & C-130Q \tabularnewline
\hline
RPO  & Right Pod Outboard  & C-130Q \tabularnewline
\hline
RPI  & Right Pod Inboard  & C-130Q \tabularnewline
\hline
RPC  & Right Pod Center  & C-130Q \tabularnewline
\hline
OBL  & Left Wing  & Electra \tabularnewline
\hline
IBL  & Left Pylon  & Electra \tabularnewline
\hline
WDL  & Window Left  & Electra \tabularnewline
\hline
OBR  & Right Wing  & Electra \tabularnewline
\hline
IBR  & Right Pylon  & Electra \tabularnewline
\hline
WDR  & Window Right  & Electra \tabularnewline
\hline
\{L,R\}W\{I,M,O\}\{I,O\} & see discussion above & GV\tabularnewline
\hline
\end{tabular}
\par\end{center}

The probe type also is coded into each variable's name, sometimes
using four characters, sometimes only one: FSSP-100 (FSSP or F), FSSP-300
(F300 or 3), CDP (CDP or D), UHSAS (UHSAS or U), PCASP (PCAS or P),
OAP-200X (200X or X), OAP-260X (260X or 6) and OAP-200Y (200Y or Y).
Prefix letters are used to identify the type of measurement (A=accumulated
particle counts per time interval per channel, C = concentration per
channel, CONC = Concentration from all channels, DBAR = mean diameter,
DISP = dispersion, PLWC =liquid water content, DBZ = radar reflectivity
factor).

Some of the probes discussed in this section are primarily aerosol
spectrometers but are described here, rather than in Section \ref{sec:AEROSOL-PARTICLE-MEASUREMENTS},
because they are similar to the hydrometeor spectrometers and so are
most economically discussed here. However, see Sect.~\ref{sec:AEROSOL-PARTICLE-MEASUREMENTS}
for the processing algorithms that lead to concentrations from the
UHSAS and PCASP/SPP-200. The following table and discussion includes
some obsolete variables (for the 200X and 200Y) for the same reason.
The table also includes some variables derived from imaging spectrometers
(the 2DC and 2DP probes) to highlight that the primary variables are
similar to those discussed in this sub-section. Those variables are
discussed in the next sub-section. In two cases, the FSSP and PCASP,
two versions are listed, an obsolete version and a current version
with a revised processing package (SPP-100 for the FSSP, SPP-200 for
the PCASP). Both are included for historical completeness, but algorithms
in this document discuss the current versions.

The archived data files sometimes have ``housekeeping'' variables\index{housekeeping variables}
included that provide information on the operating state and data
quality from the probes. For example, the CDP provides information
on the average transit time, the voltage from the nominal 5-V source,
the control board temperature, the laser block temperature, the laser
current, the laser power monitor, the qualifier bandwidth, the qualifier
baseline, the qualifier threshold, the sizer baseline, the wing-board
temperature, an A-to-D overflow flag, and a count of particles rejected
as being outside the depth of field. The netCDF variables and attributes
should be consulted for this housekeeping information. The large number
of housekeeping variables will not be included in this document, so
appropriate manuals and the netCDF files should be consulted when
interpreting this information.

\index{hydrometeor probes!table of}

\begin{center}
\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{center}
\textbf{Probes that produce size distributions of particles (with
links to descriptions):\label{TableOfProbes}}
\par\end{center}
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
\textbf{\small{}Generic Name} &  & \textbf{\small{}Probe}\footnote{Probes without links are described at this URL\href{https://opensky.ucar.edu/islandora/object/archives\%3A8155}{this URL}.} & \textbf{\small{}Channels} & \textbf{\small{}Usable}\footnote{Channels may be unusable because the first channel is a historical
carry-over and should be ignored, or because in the case of 2D probes
the entire-in sizing technique reduces the number of bins where particles
can be sized. Also, when some channels have been considered unreliable
the netCDF header may specify that the usable bins are smaller than
indicated here.} & \textbf{\small{}Diameter Range} & \textbf{\small{}Bin Width}\tabularnewline
\hline
\hline
{\small{}FSSP-100/original} & {\small{}F} & {\small{}FSSP-100}\footnote{Now obsolete but present in many archived data sets} & {\small{}0--15} & {\small{}1-{}-15} & \multicolumn{2}{c|}{{\small{}(See FRNG below)}}\tabularnewline
\hline
FSSP/SPP-100 & F & \href{http://www.eol.ucar.edu/instruments/forward-scattering-spectrometer-probe-model-100}{SPP-100} & 0--30 & 1-{}-30 & \multicolumn{1}{c||}{3--45 $\mu$m } & 3 $\mu$m (typ.)\tabularnewline
\hline
UHSAS & U & \href{https://www.eol.ucar.edu/instruments/ultra-high-sensitivity-aerosol-spectrometer}{UHSAS} & 0--99 & 1-{}-99 & \multicolumn{1}{c||}{0.06--1.0 $\mu$m} & variable\tabularnewline
\hline
CDP & D & \href{https://www.eol.ucar.edu/instruments/cloud-droplet-probe}{CDP} & 0--30 & 1---30 & \multicolumn{1}{c||}{2.0--50} & variable\tabularnewline
\hline
{\small{}F300} & {\small{}3} & {\small{}\href{https://www.eol.ucar.edu/instruments/forward-scattering-spectrometer-probe-model-300}{FSSP-300}$^{b}$} & {\small{}0--30} & {\small{}1-{}-30} & {\small{}0.3--20.0 $\mu m$} & {\small{}variable}\tabularnewline
\hline
PCASP/original & P & PCASP$^{b}$ & 0--15 & 1-{}-15 & 0.1--3.0 $\mu$m & variable\tabularnewline
\hline
PCASP/SPP-200 & P & {\small{}\href{https://www.eol.ucar.edu/instruments/signal-processing-package-200-passive-cavity-aerosol-spectrometer-probe}{SPP-200}} & {\small{}0--30} & {\small{}1-{}-30} & {\small{}0.1--3.0 $\mu m$} & {\small{}variable}\tabularnewline
\hline
{\small{}200X} & {\small{}X} & OAP-200X{\small{}$^{b}$} & {\small{}0--15} & {\small{}1-{}-15} & {\small{}40--280 $\mu m$} & {\small{}10 $\mu m$}\tabularnewline
\hline
{\small{}260X} & {\small{}6} & OAP-260X & {\small{}0-63} & {\small{}3-{}-62} & {\small{}40-620 $\mu m$} & {\small{}10 $\mu m$}\tabularnewline
\hline
{\small{}200Y} & {\small{}Y} & {\small{}OAP-200Y$^{b}$} & {\small{}0-15} & {\small{}1-{}-15} & {\small{}300--4500 $\mu m$} & {\small{}300 $\mu m$}\tabularnewline
\hline
1DC\footnote{See p.~\pageref{Despite-the-'1D'} for an explanation of this name
convention}  &  & 2DC$^{b,}$\footnote{Measurements from this and the next three 2D probes are discussed
in section \vref{subsec:Hydrometeor-Imaging-Probes}} (old) & 0-32 & 1-30$^{e}$ & 25--800 $\mu$m  & 25 $\mu$m\tabularnewline
\hline
1DP &  & 2DP$^{b}$ (old) & 0-32 & 1-30 & 200--6400 $\mu$m & 200 $\mu$m\tabularnewline
\hline
1DC  &  & \href{https://www.eol.ucar.edu/instruments/two-dimensional-optical-array-cloud-probe}{2DC}
(fast) & 0-63 & 1-62\footnote{Some of the lowest channels are often considered unreliable and excluded
in processing} & 25--1600 $\mu$m & 25 $\mu$m\tabularnewline
\hline
1DP &  & \href{https://www.eol.ucar.edu/instruments/two-dimensional-optical-array-precipitation-probe}{2DP}
(new) & 0-63 & 1-62 & 100--6400 $\mu$m & 100 $\mu$m\tabularnewline
\hline
\end{tabular}
\par\end{center}%
\end{minipage}\\
\par\end{center}
\begin{hangparagraphs}
\textbf{Count Rate Per Channel }(number per time interval):\textbf{\uline{\label{punch:5-4}\label{punch:5-7}}}\nop{AFSSP}{}\nop{AS200}{}\nop{AS100}{}\nop{AF300}{}\nop{APCAS}{}\nop{A200X}{}\nop{A260X}{}\nop{A200Y}{}\nop{ACDP}{}\nop{AUHSAS}{}\textbf{\uline{}}\\
\textbf{\uline{AFSSP}}\textbf{\sindex[var]{AFSSP}\index{AFSSP},
}\textbf{\uline{AS100\index{AS100}}}\sindex[var]{AS100}\textbf{\uline{,
AF300}}\sindex[var]{AF300}\textbf{\index{AF300}, }\textbf{\uline{AS200}}\index{AS200}\sindex[var]{AS200},\textbf{
}\textbf{\uline{APCAS}}\textbf{\sindex[var]{APCAS}\index{APCAS},
}\textbf{\uline{A200X}}\textbf{\sindex[var]{A200X}\index{A200X},
}\textbf{\uline{A260X}}\textbf{\sindex[var]{A260X}\index{A260X},
}\textbf{\uline{A200Y}}\sindex[var]{A200Y}\index{A200Y}, \textbf{\uline{ACDP}}\sindex[var]{ACDP}\index{ACDP},
\textbf{\uline{AUHSAS\sindex[var]{AUHSAS}\index{AUHSAS}}}\\
\emph{The size distribution of the number of particles detected by
a 1D hydrometeor probe per unit time.} These measurements have ``vector''
character in the NetCDF\index{NetCDF!vector} output files, with dimension
equal to the number of channels in the table above and with one entry
per channel. The first element in the vector is a historical remnant
from a time when housekeeping information was stored here and should
be ignored. For the size limits of the channels, see the netCDF attributes
of the following variables for ``Size Distribution''.

\textbf{}%
\noindent\begin{minipage}[t]{1\columnwidth}%
\textbf{Size Distribution} ($\mathrm{cm}{}^{-3}$channel$^{-1}$)\textbf{:}\nop{CFSSP}{}\nop{CS100}{}\nop{CF300}{}\nop{CPCAS}{}\nop{CS200}{}\nop{CCDP}{}\nop{CUHSAS}{}\nop{C200X}{}\nop{C260X}{}\nop{C200Y}{}\textbf{
}\textbf{\uline{CFSSP}}\textbf{\index{CFSSP}\sindex[var]{CFSSP},
}\textbf{\uline{CS100}}\textbf{\index{CS100}}\sindex[var]{CS100}\textbf{,
}\textbf{\uline{CF300}}\textbf{\index{CF300}\sindex[var]{CF300},
}\textbf{\uline{CS200}}\index{CS200}\sindex[var]{CS200},\textbf{
}\textbf{\uline{CPCAS\index{CPCAS}}}\textbf{\sindex[var]{CPCAS},
}\textbf{\uline{CCDP\index{CCDP}\sindex[var]{CCDP}}}\textbf{,
}\textbf{\uline{CUHSAS\index{CUHSAS}\sindex[var]{CUHSAS}}}\\
\textbf{Size Distribution }(L\textbf{$^{-1}$}channel$^{-1}$):\textbf{
}\textbf{\uline{C200X}}\textbf{\index{C200X}\sindex[var]{C200X},
}\textbf{\uline{C260X}}\textbf{\index{C260X}\sindex[var]{C260X},
}\textbf{\uline{C200Y\index{C200Y}\sindex[var]{C200Y}}}%
\end{minipage}\textbf{\label{CUHSAS}}\\
\emph{The particle concentrations}\index{concentration!hydrometeor}\index{concentration!hydrometeor, size distribution}\index{FSSP-100!size distribution}
\emph{in each usable bin of the probe.} These netCDF variables have
``vector'' character with dimension equal to the number of channels
in the table above. The first vector member should be ignored. For
some scattering spectrometer\index{spectrometer!hydrometeor}\index{hydrometeor spectrometer}
probes (FSSP-100, FSSP-300\index{FSSP-300}, PCASP\index{PCASP})
the concentration value is modified by the probe activity (FACT, PACT)
as described below. The concentration is obtained from the total number
of particles detected and a calculated, probe-dependent sample volume
that is specified in recent projects by attributes (e.g., depth of
field and beam diameter) of this variable in the netCDF file. For
additional details, see the links in the table \vpageref{TableOfProbes}
or, for older probes, \href{https://opensky.ucar.edu/islandora/object/archives\%3A8155}{RAF Bulletin 24}\index{Bulletin 24}.

\begin{singlespace}
\textbf{}%
\noindent\begin{minipage}[t]{1\columnwidth}%
\begin{hangparagraphs}
\begin{singlespace}
\textbf{Concentration }(cm$^{-3}$):\nop{CONCF}{}\nop{CONC3}{}\nop{COMCP}{}\nop{CONCD}{}\nop{CONCU}{}\textbf{
}\textbf{\uline{CONCF}}\textbf{\sindex[var]{CONCF}\index{CONCF},
}\textbf{\uline{CONC3}}\sindex[var]{CONC3}\textbf{\index{CONC3},
}\textbf{\uline{CONCP\sindex[var]{CONCP}\index{CONCP}, CONCD\sindex[var]{CONCD}\index{CONCD}}}\textbf{,
}\textbf{\uline{CONCU\sindex[var]{CONCU}\index{CONCU}}}

\textbf{Concentration (}L\textbf{$^{-1}$):}\nop{CONCX}{}\nop{CONC6}{}\nop{CONCY}{}\textbf{
}\textbf{\uline{CONCX}}\textbf{\sindex[var]{CONCX}\index{CONCX},
}\textbf{\uline{CONC6}}\sindex[var]{CONC6}\textbf{\index{CONC6},
}\textbf{\uline{CONCY\sindex[var]{CONCY}\index{CONCY}}}
\end{singlespace}
\end{hangparagraphs}

%
\end{minipage}\textbf{}\\
\emph{The particle concentrations}\index{FSSP-100!concentration}\index{concentration!FSSP}
\emph{summed over all channels to give the total concentration in
the size range of the probe.} For example, \{CONCF\} = $\sum_{i}\mathrm{\{CFSSP\}_{i}}$.
For additional details, see \href{https://opensky.ucar.edu/islandora/object/archives\%3A8155}{RAF Bulletin 24}.\\
\end{singlespace}

\textbf{Mean Diameter }($\mu m$):\nop{DBARF}{}\nop{DBAR3}{}\nop{DBARP}{}\nop{DBARX}{}\nop{DBAR6}{}\nop{DBARY}{}\nop{DBARD}{}\nop{DBARU}{}\textbf{
}\textbf{\uline{DBARF}}\textbf{\index{DBARF}, }\textbf{\uline{DBAR3}}\textbf{\index{DBAR3},
}\textbf{\uline{DBARP}}\textbf{\index{DBARP}, }\textbf{\uline{DBARX}}\textbf{\index{DBARX},
}\textbf{\uline{DBAR6}}\textbf{\index{DBAR6}, }\textbf{\uline{DBARY}}\index{DBARY},
\textbf{\uline{DBARD}}\index{DBARD}, \textbf{\uline{}}\\
\textbf{\uline{DBARU}}\index{DBARU}\\
\emph{The arithmetic average of all measured particle diameters from
a particular probe.}\index{diameter!mean, 1D probes}\index{FSSP-100!mean diameter}
This mean is calculated as follows: \\
\\
\fbox{\begin{minipage}[t]{0.9\textwidth}%
\{Cy$_{i}$\} = concentration\sindex[lis]{Cyi@$Cy_{i}$= concentration from hydrometeor probe y in channel i}
from probe y in channel i\label{MeanDiameter}\\
\hspace*{0.6cm}(e.g., y=FSSP to calculate DBARF)\\
i1 = lowest usable channel for the probe\\
i2 = highest usable channel for the probe\\
$d_{i}$\sindex[lis]{di@$d_{i}$= diameter of hydrometeor in channel $i$}
= diameter of particles in channel i for this probe ($\mu m$)\\
\hspace*{0.6cm}(calculated as the average of the lower and upper
size limits for the channel)\\
\rule[0.5ex]{1\linewidth}{1pt}

\begin{equation}
\mathrm{\{DBARx\}}=\frac{{\textstyle \sum_{i=i1}^{i2}}{\displaystyle {\displaystyle \left\{ \mathrm{Cy}_{i}\right\} d_{i}}}}{\sum_{i=i1}^{i2}\left\{ \mathrm{Cy}_{i}\right\} }\label{eq:dbar1d}
\end{equation}
%
\end{minipage}}\\

\textbf{Dispersion }(dimensionless)\textbf{:}\nop{DISPF}{}\nop{DISP3}{}\nop{DISPP}{}\nop{DISPX}{}\nop{DISP6}{}\nop{DISPY}{}\nop{DISPD}{}\nop{DISPU}{}\textbf{
}\textbf{\uline{DISPF}}\textbf{\sindex[var]{DISPF}\index{DISPF},
}\textbf{\uline{DISP3}}\textbf{\sindex[var]{DISP3}\index{DISP3},
}\textbf{\uline{DISPP}}\textbf{\sindex[var]{DISPP}\index{DISPP},
}\textbf{\uline{DISPX}}\textbf{\sindex[var]{DISPX}\index{DISPX},
}\textbf{\uline{DISP6}}\textbf{\sindex[var]{DISP6}\index{DISP6},
}\textbf{\uline{DISPY}}\sindex[var]{DISPY}\index{DISPY}, \textbf{\uline{DISPD}}\sindex[var]{DISPD}\index{DISPD},
\textbf{\uline{}}\\
\textbf{\uline{DISPU}}\sindex[var]{DISPU}\index{DISPU}\\
\index{dispersion}\emph{The ratio of the standard deviation of particle
diameters to the mean particle diameter.}\index{FSSP-100!dispersion}\index{dispersion!1D probes}
\\
\\
\fbox{\begin{minipage}[t]{0.9\textwidth}%
\{DBARx\} = mean particle diameter ($\mu m$)\\
\{Cy$_{i}$\}, i1, i2, $d_{i}$ as for mean diameter \vpageref{MeanDiameter}\\
\rule[0.5ex]{1\linewidth}{1pt}

\begin{equation}
\mathrm{\{DISPx\}}==\frac{1}{\{\mathrm{DBARx}\}}\,\left\{ \frac{{\textstyle \sum_{i=i1}^{i2}}{\displaystyle {\displaystyle \left\{ \mathrm{Cy}_{i}\right\} d_{i}^{2}}}}{\sum_{i=i1}^{i2}\left\{ \mathrm{Cy}_{i}\right\} }-\{\mathrm{DBARx}\}^{2}\right\} ^{1/2}\label{eq:disp1d}
\end{equation}
%
\end{minipage}}

\textbf{Liquid Water Content }(g\,m\textbf{$^{-3}$}):\nop{PLWCF}{}\nop{PLWCX}{}\nop{PLWC6}{}\nop{PLWCY}{}\nop{PLWCD}{}\textbf{
}\textbf{\uline{PLWCF}}\textbf{\sindex[var]{PLWCF}\index{PLWCF},
}\textbf{\uline{PLWCX}}\textbf{\sindex[var]{PLWCX}\index{PLWCX},
}\textbf{\uline{PLWC6}}\textbf{\sindex[var]{PLWC6}\index{PLWC6},
}\textbf{\uline{PLWCY}}\sindex[var]{PLWCY}\index{PLWCY}, \textbf{\uline{PLWCD}}\sindex[var]{PLWCD}\index{PLWCD}\\
\index{liquid water content!1D probes}\emph{The density of liquid
water represented by the size distribution measured by a hydrometeor
probe.}\index{liquid water content}\index{FSSP-100!liquid water content}\index{liquid water content!FSSP-100}
These variables are calculated from the measured concentration (CONCx)
and the third moment of the particle diameter, with the assumption
that the particle is a water drop. The following box describes the
calculation in terms of an equivalent droplet diameter\index{diameter!equivalent},
the diameter that represents the mass in the detected particle. The
equivalent droplet diameter is normally the measured diameter for
liquid hydrometeors, but some processing has used other assumptions
and this is a choice that can be made based on project needs. Using
this definition allows for the approximate estimation of \index{ice water content}ice
water content in cases where it is known that all hydrometeors are
ice. \\
:\\
\fbox{\begin{minipage}[t]{0.9\textwidth}%
$d_{e,i}$\sindex[lis]{dei@$d_{e,i}$= equivalent melted diameter for channel i of a hydrometeor
spectrometer} = equivalent melted diameter for channel $i$ of probe x\\
\{Cy$_{i}$\}, i1, i2 as for mean diameter \vpageref{MeanDiameter}\\
$\varrho_{w}$\sindex[lis]{rhow@$\rho_{w}$= density of liquid water}
= density of water ( $10^{3}kg/m^{3}$)\\
\rule[0.5ex]{1\linewidth}{1pt}
\begin{equation}
\mathrm{\{PLWCx\}}=\frac{\pi\varrho_{w}}{6}{\textstyle \sum_{i=i1}^{i2}}{\displaystyle {\displaystyle \left\{ \mathrm{Cy}_{i}\right\} d_{e,i}^{3}}}\label{eq:lwc1d}
\end{equation}
(units and a scale factor are selected so that the output variable
is in units of g\,m$^{-3}$)%
\end{minipage}}\\

\textbf{Radar Reflectivity Factor }(dbZ)\textbf{:}\nop{DBZ}{}\textbf{
}\textbf{\uline{DBZF}}\textbf{\sindex[var]{DBZF}\index{DBZF},
}\textbf{\uline{DBZX}}\textbf{\sindex[var]{DBZX}\index{DBZX},
}\textbf{\uline{DBZ6}}\textbf{\sindex[var]{DBZ6}\index{DBZ6},
}\textbf{\uline{DBZY}}\sindex[var]{DBZY}\index{DBZY}, \textbf{\uline{DBZD\sindex[var]{DBZD}\index{DBZD}}}\\
\emph{The radar reflectivity factor}\index{reflectivity factor}\index{dBz}\index{radar reflectivity factor!1D probes}
\emph{calculated from the measured size distribution from a hydrometeor
probe.} This is calculated from the measured concentration and the
sixth moment of the size distribution, with the assumption that the
particles are water drops. An equivalent radar reflectivity factor
can be calculated from the hydrometeor size distribution if another
assumption is made about composition of the particles, but this variable
is not part of normal data files. The radar reflectivity factor is
a characteristic only of the hydrometeor size distribution; it is
\emph{not }a measure of radar reflectivity, because the latter also
depends on wavelength, dielectric constant, and other characteristics
of the hydrometeors. The normally used radar reflectivity factor is
measured on a logarithmic scale that depends on a particular choice
of units, so (although it is not conventional) an appropriate scale
factor $Z_{r}$ is included in the following equation to satisfy the
convention that arguments of logarithms should be dimensionless\index{dimensions in equations}.
\\
\\
\fbox{\begin{minipage}[t]{0.9\textwidth}%
$d_{i}$ = diameter for channel $i$ of probe x\\
\{Cy$_{i}$\}, i1, and i2 as for mean diameter \vpageref{MeanDiameter}\\
$Z_{r}$ \sindex[lis]{Zr@$Z_{r}$= scale factor for calculation of the radar reflectivity
factor}= reference factor for units = 1~mm$^{6}$m$^{-3}$\\
\rule[0.5ex]{1\linewidth}{1pt}

\begin{equation}
\mathrm{\{DBZx\}}=10\log_{10}\left({\textstyle \frac{1}{Z_{r}}\sum_{i=i1}^{i2}}{\displaystyle {\displaystyle \left\{ \mathrm{Cy}_{i}\right\} d_{i}^{6}}}\right)\label{eq:dbz1d}
\end{equation}
%
\end{minipage}}

\label{punch:5-5}

\textbf{Effective Radius }($\mu$m):\nop{REFFD}{}\nop{REFFF}{} \textbf{\uline{REFFD}}\index{REFFD}\sindex[var]{REFFD}\textbf{\uline{,
REFFF}}\index{REFFF}\sindex[var]{REFFF}\\
\index{radius, effective}\emph{One-half the ratio of the third moment
of the diameter measurements to the second moment.} This variable
is useful in some calculations that relate the liquid water content
of a cloud layer to its optical properties.\\
\fbox{\begin{minipage}[t]{0.9\textwidth}%
$d_{i}$ = diameter for channel $i$ of probe x\\
\{Cy$_{i}$\}, i1, and i2 as for mean diameter \vpageref{MeanDiameter}\\
\rule[0.5ex]{1\linewidth}{1pt}

\begin{equation}
\mathrm{\{REFFx\}}=\frac{1}{2}\frac{\sum{\displaystyle {\displaystyle \left\{ \mathrm{Cy}_{i}\right\} d_{i}^{3}}}}{\sum{\displaystyle {\displaystyle \left\{ \mathrm{Cy}_{i}\right\} d_{i}^{2}}}}\label{eq:reff1d}
\end{equation}
%
\end{minipage}}

\textbf{FSSP-100 Range }(dimensionless):\nop{FRNG}{}\nop{FRANGE}{}\textbf{
}\textbf{\uline{FRNG}}\textbf{\sindex[var]{FRNG}\index{FRNG},
}\textbf{\uline{FRANGE}}\sindex[var]{FRANGE}\index{FRANGE}\\
\emph{The size range in use for the FSSP-100}\index{FSSP-100!range}\index{range!FSSP}
\emph{probe}.

\begin{minipage}[t]{0.9\textwidth}%
\hspace*{0.7in}%
\begin{tabular}{|c|c|c|}
\hline
Range & \textbf{Nominal Size Range} & \textbf{Nominal Bin Width}\tabularnewline
\hline
\hline
0 & 2--47 $\mu m$ & 3 $\mu m$\tabularnewline
\hline
1 & 2--32 $\mu m$ & 2 $\mu m$\tabularnewline
\hline
2 & 1--15 $\mu m$ & 1 $\mu m$\tabularnewline
\hline
3 & 0.5--7.5 $\mu m$ & 0.5 $\mu m$\tabularnewline
\hline
\end{tabular}%
\end{minipage}\\
\\
In recent NETCDF data files, the actual bin boundaries used for processing
are recorded in the header. That header should be consulted because
processing sometimes uses non-standard sizes selected to adjust for
Mie scattering, which causes departures from the nominal linear bins.
Recent projects have all used range 0, but other choices have been
made in some older projects and other ranges are still available to
future projects.
\end{hangparagraphs}

\subsection{Hydrometeor Imaging Probes\label{subsec:Hydrometeor-Imaging-Probes}}

Instruments used to obtain hydrometeor images include the two-dimensional
imaging probes (\href{https://www.eol.ucar.edu/instruments/two-dimensional-optical-array-cloud-probe}{2DC}
and \href{https://www.eol.ucar.edu/instruments/two-dimensional-optical-array-precipitation-probe}{2DP})
and some others that require special processing and separate data
records. The former are described in this subsection. The latter include
a three-view cloud particle imager (\href{https://www.eol.ucar.edu/instruments/three-view-cloud-particle-imager}{3V-CPI}),
a small ice detector (\href{https://www.eol.ucar.edu/instruments/small-ice-detector-version-2-hiaper}{SID-2H}),
and a holographic imager (\href{https://www.eol.ucar.edu/instruments/holographic-detector-clouds}{HOLODEC}).
For information regarding use of data from the latter set of instruments,
consult EOL/RAF data management via \href{mailto:mailto:raf-dm\%40eol.ucar.edu}{this email address}.

In addition to the standard processing that produces the variables
in this subsection, an alternate processor is available that provides
some additional options and capabilities, including the production
of two sets of variables that include either all particles or all
particles that pass a roundness test. Additional options include different
ways of defining the particle size (including circle fitting or sizing
based on the dimension along the direction of flight. Corrections
to sizing are made to account for diffraction, and a shattering correction
can be applied based on interarrival times. Some categories of spurious
images (e.g., ``streakers'') can be recognized and rejected. This
processing is described in \href{https://github.com/NCAR/aircraft_ProcessingAlgorithms/blob/master/www/Bansemer2DProcessing.pdf}{this document}
and at \href{https://www.eol.ucar.edu/software/process2d}{this web page}
and is made available by special arrangement.

Measurements based on the two 2D probes will be discussed together
in this section because the 2DC and 2DP probes function similarly,
differing primarily in the size resolution (typically 25 $\mu$m or
less for the 2DC and 100 or 200 $\mu$m for the 2DP). The following
variables have names like CONC1DC or CONC1DP to designate the two
types of hydrometeor imagers. In addition, variables normally have
location designations like '\_LWIO' as described at the beginning
of section \prettyref{subsec:1DProbes}; see page \pageref{VariableNames1DProbes}.
In the following 'y' is sometimes used to designate either 'C' or
'P'.

For the images from the 2D probes, separate data files need to be
used. RAF provides a routine ``\href{https://www.eol.ucar.edu/software/xpms2d}{XPMS2D}''
that can be used to view the images and calculate various properties
of the hydrometeor population based on these separate  files.

\label{Despite-the-'1D'}Despite the '1D' nomenclature, the following
variables are measured by 2D instruments; the '1D' designation is
used to indicate that this is the dimension that would be sized by
an equivalent 1D probe using a test that requires unshadowed end diodes
so that the full dimension of the particle can be determined. As a
consequence, the effective sample volume becomes smaller as the measured
dimension increases.
\begin{hangparagraphs}
\textbf{2D Count Rate Per Channel }(count per time interval)\textbf{:}\nop{A1DC}{}\nop{A1DP}{}\textbf{
}\textbf{\uline{A1DC}}\index{A1DC}\sindex[var]{AIDC}, \textbf{\uline{A1DP}}\index{A1DP}\sindex[var]{AIDP}\\
\index{count rate!2D}\emph{The number of particles counted by a 2D
probe in each of 62 size bins in a specified time interval, usually
1 s.} These are used to calculate the derived variables like CONC1DC,
C1DC, and others that follow, but are provided to allow re-calculation
if a user wants to use different sample volumes or sizing assumptions.\\

\textbf{2D Size Distribution }(L$^{-1}$channel$^{-1}$):\nop{C1DC}{}\nop{C1DP}{}\textbf{
}\textbf{\uline{C1DC}}\index{C1DC}\sindex[var]{C1DC}, \textbf{\uline{C1DP}}\index{C1DP}\sindex[var]{C1DP}\\
\index{size distribution!2D}\emph{The concentration of particles
measured by a 2D probe in each of 62 bins in a specified time interval,
usually 1 s.} These are calculated from A1DC by application of an
assumed size-dependent sample volume based on probe characteristics
and the flight speed. These are provided in a 64-element array for
historical convention; the first element should be ignored, and the
technique requires that the end elements be unshadowed and so precludes
any measurement with width of 63 bins, so the 64-element vector has
valid information only in bins 1--63. The cell boundaries are specified
in the netCDF header as an attribute of C1DC or C1DP, and they specify
the end points of the bin; e.g,, in the 64-element array of provided
cell boundaries, the first element is the lower size limit of the
first data cell which is the second element in C1DC. For a typical
2DC with 25-$\mu$m size resolution, the cell sizes increase by 25
$\mu$m per bin for each of the C1DC bins. Also included as attributes
with the netCDF variable C1DC or C1DP are the size-dependent depth
of field (mm) and effective sample area\footnote{commonly called ``EffectiveAreaWidth'' in the netCDF files}
(mm), the latter having values of zero for the first and last elements
in the 64-value vector. \\

\textbf{2D Concentration }(L$^{-1}$):\nop{CONC1DC}{}\nop{CONC1DC100}{}\nop{CONC1DC150}{}\nop{CONC1DP}{}\textbf{
}\textbf{\uline{CONC1DC}}\textbf{\index{CONC1DC}\sindex[var]{CONC1DC},
}\textbf{\uline{CONC1DC100}}\textbf{\sindex[var]{CONC1DC100},
}\textbf{\uline{CONC1DC150\sindex[var]{CONC1DC150},}}\textbf{
}\textbf{\uline{CONC1DP}}\textbf{\index{CONC1DP}\sindex[var]{CONC1DP}}\textbf{\uline{}}\\
\index{concentration!2D}\emph{The total concentration of all particles
detected by a 2D hydrometeor imager,} or in the case of CONC1DC100
or CONC1DC150, the concentration of all particles sized to be at least
xxx $\mu$m in the dimension perpendicular to the direction of flight,
where xxx may be 100 150. These concentrations are the sum of the
particle size distribution given below (C1DC or C1DP), with appropriate
channels excluded for CONC1DC100 and CONC1DC150.\\

\textbf{2D Dead Time }(ms):\nop{DT1DC}{}\textbf{ }\textbf{\uline{DT1DC}}\index{DT1DC}\sindex[var]{DT1DC}\\
\index{dead time}\emph{The time in the sample interval during which
the data rate exceeded the recording capability of a 2DC probe.} This
is used as a correction factor when concentrations like CONC1DC or
C1DC are calculated. The variable does not apply to measurements from
a 2DP probe.\\

\textbf{2D Mean Diameter }($\mu$m):\nop{DBAR1DC}{}\nop{DBAR1DP}{}\textbf{
}\textbf{\uline{DBAR1DC}}\index{DBAR1DC}\sindex[var]{DBAR1DC},
\textbf{\uline{DBAR1DP}}\index{DBAR1DP}\sindex[var]{DBAR1DP}\\
\index{diameter!mean, 2D probes}\emph{The mean diameter calculated
from the measured size distribution. }In this calculation, the bin
sizes are taken to be the averages of the lower and upper limits of
the size bins\emph{. }The calculation is as described by \eqref{eq:dbar1d}.\emph{
}\\

\textbf{2D Dispersion (dimensionless):}\nop{DISP1DC}{}\nop{DISP1DP}{}\textbf{
}\textbf{\uline{DISP1DC}}\index{DISP1DC}\sindex[var]{DISP1DC},
\textbf{\uline{DISP1DP}}\index{DISP1DP}\sindex[var]{DISP1DP}\\
\index{dispersion}\emph{The standard deviation in particle diameter
divided by the mean diameter.} The formula used is given by \eqref{eq:disp1d}.\\

\textbf{2D Liquid Water Content} (g\,m$^{-3}$):\nop{PLWC1DC}{}\nop{PLWC1DP}{}\textbf{
}\textbf{\uline{PLWC1DC}}\index{PLWC1DC}\sindex[var]{PLWC1DC},
\textbf{\uline{PLWC1DP}}\index{PLWC1DP}\sindex[var]{PLWC1DP}\\
\emph{\index{liquid water content}The liquid water content (mass
per volume) calculated from C1DC or C1DP.} The calculation is as described
by \eqref{eq:lwc1d}, To conform to common usage, the liquid water
content is expressed in non-MKS units of g\,m$^{-3}$. \\

\textbf{2D Radar Reflectivity Factor (dBZ):}\nop{DBZ1DC}{}\nop{DBZ1DP}{}\textbf{
}\textbf{\uline{DBZ1DC}}\index{DBZ1DC}\sindex[var]{DBZ1DC}, \textbf{\uline{DBZ1DP}}\index{DBZ1DP}\sindex[var]{DBZ1DP}\\
\index{radar reflectivity factor}\emph{The radar reflectivity factor
calculated from the measured size distribution under the assumption
that all particles are spherical water drops. }The calculation is
as described by\emph{ }\eqref{eq:dbz1d}.\\

\textbf{2D Effective Radius ($\mu$m):}\nop{REFF2DC}{}\nop{REFF2DP}{}\textbf{
}\textbf{\uline{REFF2DC}}\index{REFF2DC}\sindex[var]{REFF2DC},
\textbf{\uline{REFF2DP}}\index{REFF2DP}\sindex[var]{REFF2DP}\\
\index{radius, effective}\emph{One-half the ratio of the third moment
of the particle diameter to the second moment. }The formula used is
given by \eqref{eq:reff1d}.\label{punch:5-6}\\

\end{hangparagraphs}


\documentclass[]{article}
\usepackage{fontspec}
\usepackage{parskip}
\usepackage{graphicx}
\usepackage{amsmath}

\renewcommand{\familydefault}{\sfdefault}

\begin{document}

%title
\begingroup
	\raggedright
	\LARGE Art of Electronics\\
	\LARGE Exercise Solutions Chapter 1\\
	\vspace{3mm} %3 mm vertical space
	\normalsize Henrik Samuelsson\\
	\normalsize henrik.samuelsson@gmail.com
\endgroup

\section*{About}
	This is my personal solutions to exercises from the book Art of Electronics Third Edition. Very much appreciated if you mail me if you find errors in the solutions. My mail address can be found above this section.

\section*{Resistors}

\begin{enumerate}

	%Exercise 1.1
	\item Assume a 5k and a 10k resistor.

	\begin{enumerate}

		%(a)
		\item The combined resistance if connecting these resistors in series is calculated by adding the resistances.

		\begin{equation*}
		R = R_{5k} + R_{10k} = 5k + 10k = 15k
		\end{equation*}

		%(b)
		\item The combined resistance if connecting these resistors in parallel can calculated in two different ways.

		\begin{equation*}
				R = \dfrac{ R_{5k} R_{10k} }{ R_{5k} + R_{10k} } = \dfrac{ 5k \times 1k }{ 5k + 10k } = 3.3k
		\end{equation*}

		\begin{equation*}
			R = \dfrac{ 1 }{ \dfrac{ 1 }{ R_{5k} } + \dfrac { 1 } { R_{10k} } }
			= \dfrac{ 1 }{ \dfrac{ 1 }{ 5k } + \dfrac { 1 } { 10k } }
			= \dfrac {1k}{0.2 + 0.1}= 3.3k
		\end{equation*}

	\end{enumerate}

	%Exercise 1.2
	\item We shall calculate the power dissipated when connecting a 12V car battery across a 1 ohm resistor.

	Ohm's law gives the current that will flow through the resistor.

	\begin{equation*}
		I =\dfrac{ V }{ R } = \dfrac{ 12 }{ 1 } = 12A
	\end{equation*}

	The dissipated power is calculated by multiplying the voltage across the resistor with the current that flows through it.
	\begin{equation*}
		P = VI = 12 \times 12 = 144W
	\end{equation*}

\end{enumerate}

\end{document}


\PassOptionsToPackage{usenames,dvipsnames}{xcolor}
\documentclass[twocolumn,twocolappendix]{aastex63}

% Add your own macros here:
\pdfoutput=1 %for arXiv submission
%\usepackage{amsmath,amssymb,amstext}
\usepackage{amsmath,amstext}
\usepackage[T1]{fontenc}
\usepackage{apjfonts}
\usepackage{ae,aecompl}
\usepackage[utf8]{inputenc}
\usepackage[figure,figure*]{hypcap}

\usepackage{url}
\urlstyle{same}

\usepackage{lineno}
\linenumbers
%\modulolinenumbers[2]

\newcommand{\placeholder}[1]{\textit{PLACEHOLDER: #1}}

\newcommand{\EiffL}[1]{{\color{cyan}FL: #1}}

% header settings
\shorttitle{Differentiable Lensing Simulations}
\shortauthors{Lanzieri et al.\ (LSST~DESC)}

% ======================================================================

\begin{document}
\title{Forecasting the power of Higher Order Weak Lensing Statistics with automatically differentiable simulations}
\input{authors}

\begin{abstract}
In this project we investigate the relative constraining power of various map-based higher order weak lensing statistics in an LSST setting. Such comparisons are typically very costly as they require a large number of simulations, and become intractable for more than 3 or 4 cosmological parameters. Instead we propose a new methodology based on the TensorFlow framework for automatic differentiation, and more specifically the public FlowPM N-body simulation code. By implementing ray-tracing in this framework, we will be able to simulate lensing lightcones, and compute Higher Order lensing statistics on the resulting maps. These statistics can then be differentiated with respect to cosmology, or any systematics included in the simulations, thus allowing, for exact Fisher forecasts.
\end{abstract}

\keywords{methods: statistical -- dark energy}

%\accepted{}
%\submitjournal{the Astrophysical Journal Supplement}

%\tableofcontents%-----------------------------
%===========================
% BEGINNING OF THE MAIN TEXT
%===========================

\section{Introduction}

\section{FlowPM}

\section{Ray-tracing}
In this section, we provide a brief overview of the lensing convergence and the basic concepts of cosmic shear.
Weak gravitational lensing is a promising observational technique to infer the projected matter density distribution between an observer and a source by measuring galaxy shape correlations.

In a homogeneous FLRW Universe, the geodesic equation of Light ray trajectories induced by the density fluctuations are expressed as :
\begin{equation}\label{geod}
    \frac{d^2\textbf{x}_{\bot}(\chi)}{d\chi^2}
    = -2 \nabla_{\bot} \Phi(\textbf{x}_{\bot},\chi).
\end{equation}
If we integrate Eq.\ref{geod} over the line of sight along $\chi'$ the solution $\textbf{x}_{\bot}$ for the radial comoving distance becomes:
\begin{equation}
    \textbf{x}(\chi)=f_k(\chi)\boldsymbol{\theta}-\frac{2}{c^2}
    \int_0^{\chi} d\chi'f_k(\chi-\chi')[\boldsymbol{\nabla}_{\bot}\Phi(\textbf{x},\chi')-\boldsymbol{\nabla}_{\bot}\Phi^{(0)}(\chi')]
\end{equation}
 where we indicate as $f_k(\chi)$ and $\chi$ the angular and radial comoving distance, respectively.
 In the absence of lensing the observer would see the distance \textbf{x} under an angle $\boldsymbol{\beta}$$=\textbf{x}(\chi)/f_k(\chi)$.

 In the presence of lensing the separation vector \textbf{x} will be seen under an angle $\boldsymbol{\alpha}$, defining as:
 \begin{equation}
     \boldsymbol{\alpha}=\frac{2}{c^2} \int_0^{\chi} d\chi'
     \frac{f_k(\chi-\chi')}{f_k(\chi)}
     [\boldsymbol{\nabla}_{\bot}\Phi(\textbf{x},\chi')-\boldsymbol{\nabla}_{\bot}\Phi^{(0)}(\chi')].
 \end{equation}
 So that, the difference between the apparent angle $\theta$ and the source position $\beta$ defines the lens equation:
 \begin{equation}
 \boldsymbol{\alpha=\theta - \beta}.
 \end{equation}
In the next section we will infer the lensing potential  $\Phi$ by solving the Poisson equation from the three dimensional density contrast $\delta$:
\begin{equation}\label{Poisson}
    \nabla_{\bot}^2 \Phi(x_{\bot},\chi)=
    \frac{3H_0^2 \Omega_m}{2c^2a(\chi)}
    \delta(x_{\bot},\chi)
\end{equation}
where we indicate as $a$ the scale factor, and  as $\Omega_m$ and $H_0$ the matter density and the Hubble parameter, respectively.

\subsection{The Born approximation}

We know that the knowledge of the lensing potential and the use of accurate solvers for light ray trajectories could be computationally expensive.
For this reason, in this work we implement the Born approximation, integrating the potential gradient along the unperturbed ray. If we consider the series expansion in powers of $\Phi$, assuming that the $\Phi$ is small and considering just the first-order approximation, the gravitational potential  can be written as:
\begin{equation}
    \Phi(f_k(\chi')\boldsymbol{\theta},\chi').
\end{equation}
We can now define the Jacobian matrix \textbf{A}$=\partial\boldsymbol{\beta}/\partial\boldsymbol{\theta}$, describing the linear mapping from the lensed image to the unlensed source:
\begin{align}
    A_{ij}=& \frac{\partial\beta_i}{\partial\theta_j}=
    \delta_{ij}-\frac{\partial\alpha_i}{\partial\theta_j} \\
     & =\delta_{ij}-\frac{2}{c^2}
    \int_0^{\chi} d\chi'
     \frac{f_k(\chi-\chi')f_k(\chi')}{f_k(\chi)}
     \frac{\partial^2}{\partial x_i \partial x_j} \Phi(f_k(\chi')\boldsymbol{\theta},\chi').
\end{align}
From the parametrization of the symmetrical matrix \textbf{A}, we can define the spin-two shear $\gamma=(\gamma_1,\gamma_2)$ and the scalar convergence field, $\kappa$.
Considering this definition the convergence and the shear are defined as second derivative of the potential:
\begin{equation}\label{kshear}
    \kappa=\frac{1}{2}(\partial_1\partial_1+\partial_2\partial_2)\psi; \ \gamma_1=\frac{1}{2}(\partial_1\partial_1-\partial_2\partial_2)\psi; \
    \gamma_2=\partial_1\partial_2\psi;
\end{equation}
where we define the 2D \textit{lensing potential} $\psi$,
\begin{equation}
    \psi(\boldsymbol{\theta},\chi)=
    -\frac{2}{c^2}
    \int_0^{\chi} d\chi'
     \frac{f_k(\chi-\chi')f_k(\chi')}{f_k(\chi)}
    \Phi(f_k(\chi')\boldsymbol{\theta},\chi').
\end{equation}
The two fields $\gamma$ and $\kappa$ describe the distortion in the shape of the image, and the change in the angular size, respectively.
Considering the Eq.\ref{Poisson} and the Eq.\ref{kshear} the convergence $\kappa$ becomes:
\begin{equation}
    \kappa_{born}(\boldsymbol{\theta},\chi_s)= \frac{3H_0^2 \Omega_m}{2c^2}
    \int_0^{\chi_s}
    \frac{d\chi'}{a(\chi')}
     \frac{f_k(\chi-\chi')}{f_k(\chi)}
     f_k(\chi')
    \delta(f_k(\chi')\boldsymbol{\theta},\chi').
\end{equation}

%\begin{equation}
%where $n(\chi)$ is a redshift independent factor of normalization from Poisson equation.
 %   n(\chi)=(AB)(\chi^2)
%\end{equation}
%where $A$ is the two dimensional mesh area in $rad^2$ per pixel and $B$ is the mean 3 dimensional particle density in the all cube.

\section{Methods}

Our weak lensing simulation tool is based on FlowPM (/cite Modi, Lanusse et al. ), a fast particle-mesh solver that implements the time integration for gravitational evolution starting from the Gaussian initial conditions of the Universe to the observed large scale structures through a Kick-Drift scheme.

After instantiating the $\Lambda$CDM cosmology with our desired parameters, (the initial power spectrum and the evolution of the particles depend from $\sigma_8$ and $\Omega_{c}$) we created the initial condition for the N-body simulation using the normalised linear matter power spectrum as implemented by (/cite Eisenstein and Hu of '98 ) and generated the linear field at requested scale. After that, we implemented the N-body. As said before, The N-body simulation does the time integration of a given initial linear field  across a given array of scale factors implementing a series of Kick-Drift-Kick operations.
During the \textit{Kick} operation we estimate the gravitational force experienced by every particles implementing Fast Fourier Transform and update their momentum. In the next state, \textit{Drift}, the particles are displaced and their positions is updated with the velocity estimated in the previous step. This operation is continued until the observed large scale structures at the final time-step.
To perform the lightcone computation and extract the lens planes,  we export several intermediate state from the N-body simulation. From a given intermediate state we extract a slice and project it as a density plane by painting the particles on a 2D mesh.
After creating a grid of coordinates, the lens planes are interpolated onto sky coordinates.
 At this point, we have constructed a ray tracer object, to compute the convergence, we directly integrate the lensing density along the unperturbed line of sight.

\section{Additional validation for our ray-tracing implementation }
As an additional test to validate our ray-tracing, instead of running the N-body simulation to generate the snapshots of particles for different scale factors, we create these snapshots by using a linear matter power spectrum at a given fixed redshift $z=0.52$ . \\
Specifically, we estimate the initial LPT displacement given an input linear (real) field.

As we said, the aim of this test is to prove the validity of our ray-tracing. In principle, without the N-body simulations and his possible approximations and systematics, any disagreement between the angular power spectrum computed from the final convergence map
and the angular power spectrum we use as reference can be attributable to the ray-tracing.

Fig. shows a comparison between the theoretical linear matter power spectrum computed using the Jax-cosmo library at the redshift $0.52$ and the matter power spectrum computed from the resulting snapshots, after applying the painting operations. As we can see the matter power spectrum start to lack in power for $k$(maggiore o circa uguale)1. This is probably due to the paint operation and is something to take into account when we will study the final power spectrum.

Then, we exported the lens planes, created the Convergence map and computed the angular power spectrum from it. The final angular power spectrum is obtained averaging over 20 samples.
We also tried to investigate the behaviour of the angular power spectrum for large scale for different values of the field and Box size.

\section{Potential Gradient Descendent (PGD)}
Fast N-body simulations can be used as viable alternative to full N-body to model the galaxy statistics and create fast and low computational costs realizations of the large scale structure. Nevertheless, this kind of simulations lack resolution on small scale and can't give accurate halo matter profiles or matter power spectrum.

To recover this missing accuracy, we employs the PGD scheme (\citet{Dai_2018}).
The main goal is to mimic the physics lost in the low resolution simulations by computing the short range force operation as an additional correction displacements in a post-processing step. \\
The additional displacement is computed by pointing the particles towards a filtered potential minimum of the particle mesh solver:
\begin{equation}
    \textbf{S}=4\pi G \bar{\rho}\alpha_{PM}/H_0^2 \nabla(
   \hat{\textbf{O}}_l(k)
     \hat{\textbf{O}}_s(k)
    \nabla^{-2}\delta),
\end{equation}
where $\hat{\textbf{O}}_l(k)= \exp{(\frac{k^2}{k^4_l})}$ and $\hat{\textbf{O}}_s(k)= \exp{(-\frac{k^4}{k^4_s}})$ are the low and high pass filter introduced to remove the long range force and to reduce the numerical effect induced by the mesh resolution. \\
As we can see, PGD introduces control parameters ($k_s$,$k_l$,$\alpha$) that can be tuned comparing high and low resolution simulations.
Specifically, $\alpha$ is scale factor dependent according the following relation: $\alpha=\alpha_0a^{\mu}$, where $\alpha_0$ and $\mu$ are two free parameters that can be varied to match the power spectrum against the higher resolution N-body simulations.

We see from the Figure that, at fixed $k_l,k_s,\mu$, increasing $\alpha_0$ the power spectrum increases at small scale. For $\alpha_0$ between 0.008 and 0.01 the power spectrum reaches the maximum power. For lower values the power spectrum starts to decrease at small scale.

Fig. shows that the PGD scheme allows to achieve higher accuracy at the same computational cost. We compare the low resolution DLL matter power spectra (128 particles, 128 $Mpc/h$, $B=2$) complemented by the PGD scheme to a conventional DLL simulation with the same resolution. Both the outputs are computed using $\alpha_0=0.01$ and showed for different redshift.

\section{Summary statistics}

\subsection{Lensing Angular Power Spectrum}

\subsection{Wavelet Peak Counts}

\EiffL{Explain wavelets}

One of the difficulties with traditional peak counting is that it relies on building
an histogram of peak intensities, and histograms, due to the discrete nature of the bins, are not differentiable. However, the underlying idea of peak counting is just to build an estimate of the density distribution of number of peaks as a function of their intensity. Histograms are one way to build such an estimate, and have been historically preferred, but for no particular reason. To circumvent the non-differentiability of histograms, we prefer here to estimate this density using an alternative method: Kernel Density Estimation (KDE). As a continuous equivalent to an histogram, KDEs are differentiables and can just as well be used to define the peak counts statistic.

\begin{figure}
    \centering
    \includegraphics[width=\columnwidth]{figures/peakcounts.png}
    \caption{Comparison of traditional histogram-based peak counts, against our  KDE-based peak counts statistic. The two statistics are similar, but our KDE-based statistics is differentiable.}
    \label{fig:comp_statistics}
\end{figure}

\subsection{Wavelet $\ell_1$-norm}

\EiffL{Explain what's the deal with this l1 norm}

\section{Results}

\section{Discussion}

\subsection{Future directions}

\section{Conclusions}

%=====================
% END OF THE MAIN TEXT
%=====================

\end{document}


\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{geometry}
\usepackage{enumerate}
\usepackage{natbib}
\usepackage{float}%稳定图片位置
\usepackage{graphicx}%画图
\usepackage[english]{babel}
\usepackage{a4wide}
\usepackage{indentfirst}%缩进
\usepackage{enumerate}%加序号
\usepackage{multirow}%合并行
\title{\large UM-SJTU JOINT INSTITUTE\\Advanced Lasers and Optics Laboratory\\(VE438)\\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\
Post Lab Assignment\\\ \\\ LAB 6\\\ Acoustic-Optic Modulator \\\ \\\ \\\ \\\ \\\ }
\author{Name: Pan Chongdan \\ID: 516370910121}
\date{Date: \today}

\begin{document}
\maketitle
\newpage
\section{Answers for Post Lab Questions}
\subsection{(a)}
$f_{laser}=\frac{c}{\lambda}=\frac{3\times10^8}{632.8\times10^{-9}}=4.74\times10^{14}$Hz
\par $f'=f_{laser}\pm f_{RF}=4.74\times10^{14}\pm10^{8}$Hz
\par $2\theta=\frac{\lambda_{light}f_{RF}}{v_{sound}}$
\par$v_{sound}=\frac{\lambda_{light}f_{RF}}{\theta}=\frac{632.8\times10^{-9}*10^{8}}{0.25^o}=252.8(m/s)$
\subsection{(b)}
Since the light is perpendicular to the direction of propagation of the sound, the sound causes a moving grating with period equals to the wavelength of sound in one plane. Then the grating can cause many orders of diffraction patterns which are symmetric to the zero order pattern.
\end{document}