%-----------------------------------------------------------------------
%;  Copyright (C) 2022
%;  Associated Universities, Inc. Washington DC, USA.
%;
%;  This program is free software; you can redistribute it and/or
%;  modify it under the terms of the GNU General Public License as
%;  published by the Free Software Foundation; either version 2 of
%;  the License, or (at your option) any later version.
%;
%;  This program is distributed in the hope that it will be useful,
%;  but WITHOUT ANY WARRANTY; without even the implied warranty of
%;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%;  GNU General Public License for more details.
%;
%;  You should have received a copy of the GNU General Public
%;  License along with this program; if not, write to the Free
%;  Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
%;  MA 02139, USA.
%;
%;  Correspondence concerning AIPS should be addressed as follows:
%;          Internet email: aipsmail@nrao.edu.
%;          Postal address: AIPS Project Office
%;                          National Radio Astronomy Observatory
%;                          520 Edgemont Road
%;                          Charlottesville, VA 22903-2475 USA
%-----------------------------------------------------------------------
%Body of intermediate AIPSletter for 30 June 2021 version

\documentclass[twoside]{article}
\usepackage{graphics}

\newcommand{\AIPRELEASE}{June 30, 2022}
\newcommand{\AIPVOLUME}{Volume XLII}
\newcommand{\AIPNUMBER}{Number 1}
\newcommand{\RELEASENAME}{{\tt 31DEC22}}
\newcommand{\NEWNAME}{{\tt 31DEC22}}
\newcommand{\OLDNAME}{{\tt 31DEC21}}
\newcommand{\THISYEAR}{2022}
\newcommand{\NEWYEAR}{2023}
\newcommand{\OLDYEAR}{2021}

%macros and title page format for the \AIPS\ letter.
\input LET98.MAC
%\input psfig

\newcommand{\MYSpace}{-11pt}

\normalstyle

\section{Happy 43$^{\rm rd}$ birthday \AIPS\ and FITS}

The FITS format was devised in a meeting at the VLA site on March 27
and 28, 1979.  Don Wells (then of NOAO) and Eric Greisen (still of
the NRAO) were the primary authors while Barry Clark and other NRAO
staff members provided valuable suggestions.  The FITS format, enhanced
by later extensions, is still in wide spread use in astronomy and is the
envy of other scientific fields.  Then the FITS format colored the
design of the \AIPS\ internal formats.  The \AIPS\ project was begun
officially on July 1, 1979 and has stood the test of time remarkably
well.

There is less to say about Covid-19 these days.  In-person access to
NRAO facilities is now limited to those who are fully vaccinated with
at least one booster shot.  Mask use inside is determined on a weekly
basis and varies from none, to suggested, to required.  There is still a
lot more work done from home and all meetings have a virtual component.

Your editor does find times when he would like interesting things to do.
If you find any problems with \AIPS\ or have any suggestions for new or
improved functions, please do not hesitate to e-mail me.

\subsection{\Aipsletter\ publication}

We have discontinued paper copies of the \Aipsletter\ entirely, at least
for this issue.  The \Aipsletter\ will be available in PostScript and
pdf forms as always from the web site listed above.  New issues will be
announced in the NRAO eNews mailing and on the bananas and MNJ list
server.

\subsection{Current and future releases}

We have formal \AIPS\ releases on an annual basis.  While all
architectures can do a full installation from the source files,
Linux (32- and 64-bit), and MacIntosh OS/X (Intel {\bf and ARM}) systems
may install binary versions of recent releases.  Binary versions for
Solaris and MacIntosh (PPC) are no longer available.  The last,
``frozen'' release is called \OLDNAME\ while \RELEASENAME\ remains under
active development.  You may fetch and install a copy of these versions
at any time using {\it anonymous} {\tt ftp} for source-only copies and
{\tt rsync} for binary copies.  This \Aipsletter\ is intended to advise
you of improvements to date in \RELEASENAME\@.  Having fetched
\RELEASENAME, you may update your installation whenever you want by
running the so-called ``Midnight Job'' (MNJ) which copies and compiles
the code selectively based on the changes and compilations we have done.
The MNJ will also update sites that have done a binary installation.
There is a guide to the install script and an \AIPS\ Manager FAQ page on
the \AIPS\ web site.

The MNJ for binary versions of \AIPS\ now uses solely the tool {\tt
  rsync} as does the initial installation.  For locally compiled
(``source'') installations, the Unix tool {\tt cvs} running with
anonymous ftp is used for the MNJ\@. Linux sites will almost
certainly have {\tt cvs} installed; but other sites may have to
install it from the web.  We have found that {\tt cvs} works very well,
although it has one quirk. If a site modifies a file locally, but in an
\AIPS-standard directory, {\tt cvs} will detect the modification and
attempt to reconcile the local version with the NRAO-supplied version.
This usually produces a file that will not compile or run as intended.
For local versions, use a copy of the task and its help file in a
private disk area instead.

\AIPS\ is now copyright \copyright\ 1995 through \THISYEAR\ by
Associated Universities, Inc., NRAO's parent corporation, but may be
made freely available under the terms of the Free Software Foundation's
General Public License (GPL)\@.  This means that User Agreements are no
longer required, that \AIPS\ may be obtained via anonymous ftp without
contacting NRAO, and that the software may be redistributed (and/or
modified), under certain conditions.  The full text of the GPL can be
found in the \texttt{15JUL95} \Aipsletter, in each copy of \AIPS\
releases, and on the web at {\tt http://www.aips.nrao.edu/COPYING}.


\section{Improvements of interest in \RELEASENAME}

We expect to continue publishing the \Aipsletter\ approximately every
six months, but the publication is now primarily electronic.  The most
significant change, so far, in \RELEASENAME\ has been the addition of a
release for the new Apple ARM chips.  That required a very large number
of changes to the software, with, one hopes, no changes to the outputs
of that software.  Closure phase and amplitude received attention,
resulting in two new tasks called {\tt EVACL} to look at closure
statistics in continuum data and {\tt CLOSE} to compute and plot closure
statistics as functions of spectral channel.  The RFI study software for
the VLBA received attention as well.  A new task, {\tt VLBRF} was
written to evaluate the median and rms over uncalibrated autocorrelation
data.  Numerous bug fixes and minor improvements have also been made.

{\tt 31DEC20} contains a change to the TV display program {\tt XAS} that
makes it incompatible with previous releases when characters are
displayed.  {\tt 31DEC14} contains a change to the ``standard'' random
parameters in $uv$ data and adds columns to the {\tt SN} table.  Note,
however, that the random parameters written to FITS files have not been
changed.  Older releases of \AIPS\ cannot handle the new {\it internal}
$uv$ format and might be confused by the {\tt SN} table as well.  {\tt
  31DEC09} contains a significant change in the format of the antenna
files, which will cause older releases to do wrong things to data
touched by {\tt 31DEC09} and later releases.  You are encouraged to
use a relatively recent version of \AIPS, whilst those with recent VLA
data to reduce should get release \OLDNAME\ or, preferably, the latest
development release.

\subsection{Mac ARM port}

Apple has stopped using chips manufactured by Intel and started using
their own ``ARM'' chips.  NRAO purchased a Mac mini with this new
architecture that has been used to enable an \AIPS\ port to a ``{\tt
  MACARM''} architecture.  Since this chip is so new, we were forced to
use a very recent version of {\tt gfortran} (11.0.0) and {\tt gcc}
(clang 13.0.0) to compile the code.  These versions turn out to be
rather more fussy about some older Fortran (and C) constructs and
apparent code discrepancies (that actually were handled carefully) than
were older compiler versions.

In 2018, the Fortran conventions were changed to outlaw three previously
legal constructs.  Two of these were deprecated in \AIPS\ conventions,
but were present in some of the code.  The most pernicious was the
``arithmetic IF'' statement, \eg\\
\hspace*{1.5in}{\tt IF (A-B) 100 110 120}\hfill\\
where the code branches to 100 if {\tt A < B}, to 110 if {\tt A = B},
and 120 if {\tt A > B}\@.  Early Fortran math routines used this a lot
in code that was almost unreadable.  It remained in clones of {\tt
  FUDGE} and in sort routines mostly.  The other construct deprecated by
\AIPS\ was ending a {\tt DO} loop with an executable statement, \eg\\
\vspace{-2.3em}
\begin{tabbing}
\hspace*{1.0in}\={\tt 123456 }\={\tt A(I) = B*I*I + C*I + D}\= \kill
  \>  \> {\tt DO 100 I = 1,23}\\
  \> {\tt }100 \> \hspace{1.5em}{\tt A(I) = B*I*I + C*I + D}\end{tabbing}
\vspace{-1.4em}
{\tt DO} loops must now end with either {\tt END DO} or, in \AIPS,
{\tt CONTINUE}\@.  The third construct, widely used in \AIPS, was the
use of a single {\tt CONTINUE} statement to end multiple {\tt DO} loops,
\eg\\
\vspace{-2.3em}
\begin{tabbing}
\hspace*{1.0in}\={\tt 123456 }\={\tt A(I) = B*I*I + C*I + D}\= \kill
  \>  \> {\tt DO 100 J2 = 1,N2}\\
  \>  \> {\tt DO 100 J1 = 1,N1}\\
  \>  \> \hspace{1.5em}{\tt A(J1,J2) = FUNC(J1,J2)}\\
  \> {\tt 100} \> {\tt CONTINUE}\end{tabbing}
\vspace{-1.4em}
This does create some confusion as to which {\tt DO} loop is accessed
with a {\tt GO TO 100} statement among other issues.  The compiler was
willing to let us use these constructs, but they were all corrected to
avoid future issues.

Causing far more work, however, was the fact that the new compiler
regarded apparent inconsistencies in call sequences as hard errors.
Working only within the given Fortran file, the compiler would discover
that certain call arguments would differ in type and/or number from one
call to another.  Fortran actually only passes addresses and so does not
care about type or number so long as the calling and called routine
know how to handle the types and array dimensions (or don't care in the
case of passed work buffers).  However, modern {\tt gfortran} insists
that apparent mismatches are errors rather than merely warnings (if
that).  In a few cases, the mismatches were in fact actual errors.  But
most forced the creation of {\tt EQUIVALENCE}s and additional movement
of data.  In some cases, declaring a variable to be an ``array'' of (1)
``solved'' the number mismatch.  The OOP code libraries were the most
affected.  For example, the simple line\\
\hspace*{1.5in}{\tt CALL CLNGET (NAME, 'CHANNEL', TYPE, IDIM, CHANN,
              CDUMMY, IERR)}\\
had to be changed to\\
\vspace{-2.3em}
\begin{tabbing}
\hspace*{1.0in}\={\tt 123456 }\={\tt A(I) = B*I*I + C*I + D}\= \kill
  \>  \> {\tt CALL CLNGET (NAME, 'CHANNEL', TYPE, IDIM, DDUM, CDUMMY,
              IERR)}\\
  \>  \> {\tt CHANN = IDUM(1)}\end{tabbing}
\vspace{-1.4em}
where {\tt IDUM}, {\tt LDUM}, {\tt RDUM}, and {\tt DDUM} are {\tt
  EQUIVALENCE}d arrays large enough for the maximum parameter values.
The {\tt TYPE} and {\tt IDIM} variables already specified the variable
type and array dimensions.  For example, this issue caused the large
file {\tt QCLEAN.FOR}, which does the Clean object for {\tt IMAGR} and
other tasks, to have 695 old lines of code removed and 1016 lines
added.

The actual port from Intel to ARM was very easy.  The operating system
seems not to have changed significantly.  The installation script and
numerous system control files needed {\tt MACARM} to be added.  The Z
routines were simply copied from Intel with a slight change to identify
the architecture.  The result was a system that runs the {\tt Y2K} large
test in 31 seconds (\AIPS\ mark 1290)!  The Intel load modules, using
Apple's Rosetta capability, run the test in 40 seconds (\AIPS\ mark
1000), which is already pretty spectacular.  Such high speeds suggested
a change to the internal parameter which scales wait times in various
places within \AIPS\@.  The default value was raised from 20 to 500 and
{\tt SETPAR}, where one can set the computer's \AIPS\ mark, had limits
and formats changed to handle these large numbers.

\subsection{Visibility closure}

The ``closure'' phase and amplitude are functions of the visibility 
defined by
\begin{eqnarray*}
  \Phi_{\rm 123} & = & \phi_{\rm 12} - \phi_{\rm 13} + \phi_{\rm 23} \\
  A_{\rm 1234}   & = & \log ( (a_{\rm 12} a_{\rm 34}) / ( a_{\rm 13}
                        a_{\rm 24}) )
\end{eqnarray*}
where $\Phi_{abc}$ is the closure phase for the three antennas $a, b,
c$, $A_{abcd}$ is the closure amplitude for the four antennas $a, b, c,
d$, $\phi_{ab}$ is the visibility phase on baseline $a b$, and $a_{ab}$
is the amplitude on baseline $a b$.  So long as the instrumental complex
gains are antenna based, these parameters are independent of those
gains.  In this case, the closure parameters differ from zero solely due
to source structure (plus any non-closing noise).  For this reason,
early VLBI observations made extensive use of closure in model fitting.
With the advent of the VLBA, however, closure has become less
necessary.  Nonetheless, closure can be useful in examining the quality
of source models.  The statistics of closure are also used to evaluate
the use of sources as calibrators, \ie\ point sources for which closure
should be zero\footnote{Xu, M.H., Anderson, J.M., Heinkelmann, R., Lunz,
  S., Schuh, H., Wang, G.L., 2019, ``Structure Effects for 3417
  Celestial Reference Frame Radio Sources,'' ApJ Supp., {\bf 242}, 5.}

\AIPS\ has had, for a long time, two tasks, {\tt CLPLT} and {\tt CAPLT},
which plot individual closure triangles and quadrangles as functions of
time.  These tasks can also plot the same parameter for a source model.
The tasks were cleaned up and control over the number of points in the
model was added.  New task {\tt EVACL} evaluates closure statistics over
all selected triangles and quadrangles, reporting the rms as a function
of IF and the 3 different weighting schemes used in the Xu paper.  This
computation was also added to {\tt EVAUV}, being done on the model
divided data set (without the subtraction of 1.0).  To evaluate the
failure of closure as a function of spectral channel, another new task
{\tt CLOSE} was written.  The noise in spectral image cubes often
reflects this closure statistic.

\subsection{Miscellaneous}

The RFI evaluation procedures for the VLBA were given the {\tt DOCALIB}
option to control whether the standard calibrations are found and
applied to the output autocorrelation data before the statistical
computations.  It is suggested that RFI may be complicating the system
temperatures and bandpass functions, which would make the uncalibrated
autocorrelations possibly more useful in evaluating RFI\@..  A new task,
appropriate to uncalibrated autocorrelation spectra was added.  {\tt
  VLBRF} evaluates the median autocorrelation and rms (via median
absolute deviation) as functions of spectral channel.  It makes the same
output text file and plots as the previous {\tt VBRFI} task.  Procedures
{\tt VLBAWIDE} and {\tt VLBARFI} offer the choice of statistical task
(and {\tt DOCALIB})\@.

\begin{description}
\myitem{RFLAG} was given the option to write out the newly flagged data
               set with a very large flagging work area.  The writing
               of single-channel flags when too much of that channel
               was flagged was corrected to work on single-source files
               and to write fewer flag records.
\myitem{APCLN} and other tasks were corrected for a problem reading
               model images.
\myitem{Polarization}\hspace{1em} calibration had a bug that could
               over-write visibility data following a blanked channel.
               If the last channel was blanked, the $u$ of the next
               visibility sample was zeroed.
\myitem{SNPLT} was revised to allow re-referencing independent of the
               choice of the X axis parameter.  Previously it only
               worked for a time axis.
\myitem{POSSM} was corrected to plot all polarizations when {\tt NPLOTS}
               was zero and {\tt APARM(9)} was 2 or 3.  An abort when
               the data included more than 50 antennas was corrected.
               The display of IF numbers was changed for greater
               visibility.
\myitem{PCEDT} was changed to initialize the delay-phase residuals at
               the start.  The previous requirement to do this with a
               menu item was confusing.
\myitem{XAS} was changed to not use shared memory on both Mac
               architectures.  The severe limitation imposed on Macs for
               the size of shared memory has been causing installation
               problems.
\myitem{CookBook} was updated along with other documentation.
\myitem{Progress} messages have been added to a variety of tasks.
\myitem{TRUEP} was corrected to solve for absolute polarization.
\end{description}

\subsection{dave}

The computer named {\tt dave} has been used for many years to support
the main \AIPS\ code repository including the {\tt cvs} (code versioning
system) that allows us to access older versions of any module.  It
turns out that the repository sat on a disk local to {\tt dave} and was
never backed up!  Fortunately, {\tt dave} has been very reliable,
although it is now so old that it can run only RedHat 5.  The
repository has been moved to a file server machine and is now regularly
backed up.  The compilation procedures had to be changed to write to
the transaction files even though they are not on a local disk.  It was
found that {\tt readline}, used by {\tt AIPS} to allow in-line editing,
was based on a 2005 version of {\tt READLINE.SHR} for the Linux
versions.  That was changed to use a dynamic library instead.  Our Mac
systems come with a static library ({\tt libreadline.a}) which we use.


\section{Patch Distribution for \OLDNAME}

Normally, this section lists the patches that have been released for
\OLDNAME\@.  This was based on the assumption that users would want to
download individual files to compile them locally.  However, the 
``Midnight Job'' ({\tt \$HOME/do\_daily.}{\it hostname}) will do this
for you on locally-compiled installations.  It will also do a proper
update for binary installations.  Therefore there is no reason to
continue the old procedure.  Major bug corrections will be moved to
\OLDNAME\ as they occur and users should use the MNJ on occasion on both
the {\tt NEW} and {\tt TST} versions of \AIPS\@.  Note that a number of
bug fixes were moved to \OLDNAME\ on June 27, 2022.

\section{\AIPS\ Distribution}

We log apparent MNJ accesses and downloads of the tar balls and binary
installations.  We count these by unique IP address.  Since some systems 
assign the same computer different IP addresses at different times,
this will be a bit of an over-estimate of actual sites/computers.
However, a single IP address is often used to provide \AIPS\ to a
number of computers, so these numbers are probably an under-estimate
of the number of computers running current versions of \AIPS\@.  Our
counting of apparent MNJs (not shown on the plot below) failed for a
number of weeks due to a partly incomplete switch from dave.  So far
in 2022 more than 159 IP addresses have downloaded the slushy form of
\OLDNAME, while more than 311 IP addresses have downloaded
\RELEASENAME\@.  A total of 569 different IP addresses have appeared in
one of our transaction log files.  These numbers are lower than those of
last year at this time, although the {\tt TST} version is catching up.

\vspace{1em}
\centerline{\resizebox{!}{4.5in}{\includegraphics{FIG/Plot2122a.eps}}}

\vfill\eject
% mailer page
% \cleardoublepage
\pagestyle{empty}
 \vbox to 4.4in{
  \vspace{12pt}
%  \vfill
\centerline{\resizebox{!}{3.2in}{\includegraphics{FIG/Mandrill.eps}}}
%  \centerline{\rotatebox{-90}{\resizebox{!}{3.5in}{%
%  \includegraphics{FIG/Mandrill.color.plt}}}}
  \vspace{12pt}
  \centerline{{\huge \tt \AIPRELEASE}}
  \vspace{12pt}
  \vfill}
\phantom{...}
\centerline{\resizebox{!}{!}{\includegraphics{FIG/AIPSLETS.PS}}}

\end{document}
