Note: The Mac Maverick (10.9) OS broke almost everything concerned 
with compiling software, using GTK, GLIB and X11. They really want you to 
use their XCode environment. For example /usr/include no longer exists 
at all. Given this, until I have the time to work something out, or
learn XCode, I will no longer support Macs. I advise you to download
a copy of VirtualBox and install a copy of Linux.

1. Make a directory called etc somewhere in your file system, your home 
directory should be a fine place. For example

mkdir /foo/bar/etc

2. Copy the files starlist, environ, telescopes.chara and system.chara
into that new etc directory.

3. Make sure you have an environment variable called BASE_DIRECTORY pointing
at the directory in which you created etc. For example, in bash, you add to 
your .bashrc file

export BASE_DIRECTORY=/foo/bar

4. Copy all other files into a bin directory, often off your home directory.

5. Move to the directory that contains your data

6. Run reduceir.

7. Shake and Bake.

The files that may/will be installed are listed below. Those that are not 
installed are now obsolete

ampvir 		Amplitude visibility estimator - obsolete except for SFP
astromod 	Obsolete astrometric model program
breakir 	Break data file into parts - obsolete except for SFP
calcbox		Fit a gaussian and tophat to the power spectra *.noise.ps
calcuvb 	Calculate UV points of a data file - obsolete except for SFP
calcvir 	Calculate V using power spectrum - obsolete except for SFP
calibclimb 	Calibrate CLIMB data
calibir 	Calibrate CLASSIC data and create an OIfits file
ccbrief 	Extract CLASSIC data as text
ccphot 		Work out expected CLASSIC counts for given magnitude
chara_plan2 	Help plan an observation - it's better to use Aspro2
chara_plan 	Help plan an observation - it's better to use Aspro2
climb_classic_math.pdf Technical report on the theory of CLASSIC/CLIMB
climb_classic_pipeline.pdf Technical report on using the software.
delpos 		Work out the delay and position of a star on a given night
editir 		Edit data file - obsolete except for SFP
environ 	CHARA environmental data
extractir 	Try and get named items out of local info files
fakebin 	Make a fake SFP file
fakecc 		Make a fake CLASSIC data file
fakecl 		Make a fake CLIMB data file
fakeir 		Make a fake IR data file - Obsolete
fakeud 		Creates a series of fake files including object and calibrator
findfrgir 	Look for a fringe event in a data file
findmjd 	List MJD of all info files
info2oif	Put the data in a list of INFO files into an OIFits file
irbrief 	Extract IR data as text - Obsolete
manbinir 	Manual version of ampvir - obsolete except for SFP
mancalcvir 	Manual version of calcvir - obsolete except for SFP
oifedit 	Edit an OIFits file
oifits-check 	Check an OIFits file
oifits-filter 	Filter an OIFits file
oifits-merge 	Merge several OIFits files
oifud 		Fit a uniform disk to OIFits data
psir 		Calculate power spectra of data - obsolete except for SFP
readoif 	Read an OIFits file
redfluor 	Reduce FLUOR/CLASSIC data - Use this instead of older reduceir
redclimb 	Reduce CLIMB data
redfluor 	Reduce FLUOR data
reduceir 	GTK interface to reduction - obsolete except for SFP
reduceir_howto.txt Old HOWTO on data reduction.... new one coming soon.
		Now obsolete.
sfpastrom 	Fit SFP data in an OIFits file
starlist 	List of stars in CHARA database
summaryir 	Make a summary of all local info files
system.chara 	CHARA system parameters
telescopes.chara Baseline solution
truncateir	Truncation of IR data
cis2.fit	Example OIFITs file with V^2 data.
truncateir 	Truncate the scans in a data file - obsolete except for SFP
vis2.fit 	Example vis^2 data

Note on PLPLOT:

On older systems, like Centos 5, you will need to make and install the 
cmake and plplot packages for some of these programs to work. Check to see if
these exist before building them of course. The versions used to compile this code can be found in this package.

To build cmake:

cd builddir (Some directory where you wish to put the source)
tar xvfz cmake-3.0.2.tar.gz
cd cmake-3.0.2/
./configure
make
make install

To build plplot:

cd builddir
tar xvfz plplot--5.10.0.tar.gz 
cd plplott-5.10.0/
mkdir build
cmake ..
make

You may see an error like

../src/libplplotd.so.12.0.1: undefined reference to `cairo_ps_surface_set_eps'

which means you have an old version of the pango library. You can skip this
package using

cmake -DDEFAULT_NO_CAIRO_DEVICES=ON ..

instead of the command above.

Another possible error is something like

1. ERROR in /chara/theo/temp/plplot-5.10.0/examples/java/x00.java (at line 29)
        import static plplot.core.plplotjavacConstants.*;

which means you have an old version of JAVA. You can skip the building of
the examples and avoid this error by editing the file

CMakelists.txt

and removing or commenting out the line 

add_subdirectory(examples)

and then going back to the cmake command.

you can then

make install

and things should be OK.

		REDFLUOR 2016-8-5
		-----------------

		Theo ten Brummelaar
		Paul Nunez

This directory contains the software for the program "redfluor", the data 
reduction pipeline for Fluor data, both old and new. Older data needs to
be first saved in in ASCII form, and then converted into the newer FITs 
format using the program flascii2fits.

The redfluor program will output the following text if invoked without 
arguments:

usage: redfluor [-flags] ir_datafile
Flags:
-a              Toggle apodize for FFT (ON)
-A              Use shutter sequence A for noise (TRUE)
-b              Bootstrap to estimate the Median Error (OFF)
-c              Force this to be treated as CLASSIC data (OFF)
-C[scroll_length]       Size of scroll window (300)
-d[0,1,2,3,4]   Set display level(1)
-D[Dir]         Directory for results (Basename)
-e              Toggle edit scans (ON)
-E[min_weight]  Edit scans by fringe weight (OFF)
-f              Force this to be treated as JOUFLU data (OFF)
-F[env_mult]    Change # of envelopes to include (3)
-g              Toggle GTK (OFF)
-h              Print this message
-H[n]           Set percentage definition of high frequency (20)
                Use 0.0 to force using upper integration limit.
-i              Toggle manual integration range (OFF)
-I[start-stop]  Set integration range of data (AUTO)
-j              Toggle adjusting filter width using Vg (ON)
-J              Toggle ignoring photometric data (OFF)
-k[0,1] Set method of calculating Kappa (KAPPA_BY_SCAN)
                        0 - Calculate for each scan.
                        1 - Calculate for total mean.
-l[freq-fwhm]   Use low pass instead of Wiener filter (0).
-L              Toggle use photometry for noise estimate (OFF)
-O              Toggle Photometry Only (OFF)
-o[n_sigma]     Number (float) of standard deviations for outlier removal (OFF, <=0 to turn off)
-p              Toggle use postscript (OFF)
-P[smooth_noise_size]   Change noise PS +-smooth size (5)
-R              Toggle remote mode (OFF)
-s[spec-chan]   Change spectral channel (0=ALL)
-S[smooth_signal_size]  Change +-smooth size (1)
-t[start,stop]  Truncate scans (OFF)
-u              Toggle noise PS multiplier (OFF)
-U[freq]        Set DC suppression frequency (20.0 Hz)
-v              Toggle PLPLOT verbose mode (OFF)
-V              Toggle REDFLUOR verbose mode (OFF)
-x              Toggle use dither freq for fringes (OFF)
-X[stddevmult]  Set stddev multiplier (3)
-y              Toggle use fringe signal for waterfall (OFF)
-Y              Toggle use filter for waterfall (ON)
-z[pixmult]     Set pixel multiplier (2)

Redfluor uses the PLPLOT package to produce the plots it makes, and
therefore will also understand any standard Plplot command line
arguments. For example, it would be very common to use

redfluor -dev xwin

on an X windows machine, or

redfluor -dev psc

to produce a color postscript output.

Redfluor uses the "standard" data reduction techniques as set out in the
seminal A&A Vol 121 p379 paper, along with a few additions, in
particular there are some new ways of estimating the background noise.

Note that arguments to flags, except for those associated with Plplot,
do not have a space between the flag and the data. So, for example, a
common way of invoking redlfuor is

redfluor -dev xwin -e -d2 -F3 datafile.fit

which will start redfluor for an X windows display, bypass fringe
editing, display an intermediate amount of plots, and use a scan width of 3
times the envelope width.

The flags available for redfluor are:

-a		Toggle apodize for FFT (ON)

	Since redfluor uses an FFT, it is normal to apodize the data
	before calculating power spectra or filtering the data. This is
	by default on, and is rarely turned off.

-A		Use shutter sequence A for noise (OFF)

	The background noise power is. by default, calculated by first
	working out the camera noise from the dark scans at the end of
	the data collection, and then by estimating the photon noise by
	looking at the last part of the scan. This is by default 10% but
	can be changed using the '-H flag. The -A tells redfluor to instead 
	use the initial shutter sequence to estimate the noise power.
	This is probably a much better way of doing this, and may one
	day soon become the default. It's worth trying this if the power
	spectra of the fringes do not hover around zero away from the	
	fringe peak.

-b	Bootstrap to estimate the Median Error (OFF)

	The bootstrap method consists in generating many bootstrap samples, 
        calculating the median of each sample, and finding the 68% confidence 
        interval of the distribution of medians. When this flag is NOT 
	switched on, the default (quick) method to estimate the error of the 
	median is to find the median of the absolute deviations from the 
	sample median, and multiply this by 1.4826 (which assumes that the 
	data are mostly Gauss distributed). This method is very resiliant to 
	outliers, but assumes that the data are Gauss distributed. 

-c      Force this to be treated as CLASSIC data (OFF)

	Normally redfluor will work out what kind of data file you have
	thrown at it, but you can force it to pretend that it is CLASSIC
	data. This is normally only used during software tests.

-d[0,1,2,3,4]	Set display level(1)
	
	Sets how much you will see. The levels are:

	0 - Display nothing
	1 - Display a minimal amount of plots. These include the
	    photometry, the mean power spectra, histograms of the
	    results and some waterfall plots.
	2 - Adds a few more plots concerning calculation of the Kappa
	    matrix and the optimum fringe filters.
	3 - Plots details of the reduction of each fringe scan. There
	    will be lots of these, but it can be useful for debugging,
	    for example to see that the amount of data being requested
	    and re-centered for each scan is too large or too small,
	    or that the minimum threshold for the photometry is too high
	    or too low.
	4 - Plot everything above, as well as the so called "direct"
	    method. This is an experimental method that uses the raw
	    fringe power spectra, that is it is not corrected for the
	    photometry, but the photometric signals are used for
	    estimating the background noise power.

-D[Dir]		Directory for results (Basename)

	Set the directory in which you want the output files to go. 
	It is very uncommon to change this from the default, which is
	based on the file name of the data.

-e		Toggle edit scans (ON)

	By default redfluor assumes you wish to edit the scans, this flag
	allows you to bypass this. This is commonly used when you
	re-reduce data and you have already edited out bad scans.

-E[min_weight]	Edit scans by fringe weight (OFF)

	It is possible to have redlfuor automatically all edit scans based on 
	the so called fringe weight. Fringe weight is the amount of
	power in the band containing the fringes compared to the amount
	of power in a similar band away from the fringe frequency. This
	is not commonly used.

-F[env_mult]	Change # of envelopes to include (4)

	By default redfluor looks in each scan to identify the center of
	the fringe packet and takes a small part of the scan around this
	center for analysis. The size of this is a number, 4 by default,
	of theoretical fringe envelope widths as calculated from the
	wavelength of band-pass of the optical filter. Setting this value
	to 0 or less forces redfluor to always use the entire scan.
	Choosing this value can be tricky. If it is too large you can
	loose scans because there either isn't enough data, or it makes
	it more likely to have a problem with the photometry. If it is
	too small, you might loose fringe information and bias the
	measurement. You would only change this width if you find that
	no scans are being included in the analysis, and this is only
	likely to happen to older data sets.
	
-h		Print this message

-H[n]		Set percentage definition of high frequency (10)
		Use 0.0 to force using upper integration limit.

	See commands on the -A flag above.

-i		Toggle manual integration range (OFF)

	This flag let's you choose the integration range manually, using
	mouse clicks on the power spectrum plot. Otherwise the
	integration is set by fitting a Gaussian to the fringe peak, or
	if you have reduced these data before, using the same range as 
	last time. 

-I[start-stop]	Set integration range of data (AUTO)

	Often it is a good idea to force the system to use a single range 
	of integration for all data files in a cluster by using this
	flag.

-j		Toggle adjusting filter width using Vg (ON)

	As the seeing changes the group velocity of the fringe packet
	for each scan the equivalent width of the optical band-pass is 
	also changing. By default this is tracked and adjusted, but you
	can turn this off. This is only helpful in extremely poor seeing
	when it is no longer easy to track these changes.

-J		Toggle ignoring photometric data (OFF)

	In some cases, commonly in poor seeing, there are no scans
	in a data set that pass all the tests of the photometry. In
	these cases you can still extract a correlation estimate by
	ignoring the photometric signals and processing the data in the
	same way we process CLASSIC data. Naturally, the error bars
	will be much bigger.

-k[0,1]		Set method of calculating Kappa (KAPPA_BY_SCAN)
			0 - Calculate for each scan.
			1 - Calculate for total mean.

	You can choose if the mean is performed on the photometric data
	before calculating the Kappa matrix, or if the matrix is
	calculated for each scan and then a mean of the matrix itself
	is used. The later is the default.

-l[freq-fwhm]	Use low pass instead of Wiener filter (0).

	By default a Wiener filter is used on the photometric signals. 
	This options lets you force the program to use a low pass filter 
	instead. This is sometimes help in poor SIR data.

-L		Toggle use photometry for noise estimate (OFF)

	See the comments above on noise estimates above for the -A flag. This
	is another alternative method that uses the photometric data
	itself to estimate the noise power. Again, this is probably
	better than the default, but is still largely experimental.

-O		Toggle Photometry Only (OFF)

	Sometimes you just wish to redo the photometry. This flag runs
	the reduction and stops after the photometric analysis.

-o[n_sigma]	Number (float) of standard deviations for outlier 
		removal (0) (OFF)

	Outliers that are beyond or below n_sigma standard deviations 
	from the Median visibility (which is less sensitive to outliers) 
	are removed from the visibility estimation. The median in then 
	re-calculated and outliers again removed. This is done a total of
	three times. Set this to <=0 to force it not to remove outliers.

-P[smooth_noise_size]	Change noise PS +-smooth size (5)

	The background noise power spectra are smoothed using a boxcar
	algorithm. This flag lets you change the size of the box.
	Increasing the size of the box can be useful in low SNR data.

-R	Toggle remote mode (OFF)

	This flag is obsolete.

-s[spec-chan]	Change spectral channel (0=ALL)

	This flag lets you choose which spectra channel to reduce. 

-S[smooth_signal_size]	Change +-smooth size (1)

	The signal can also be smoothed using a boxcar integration. This 
	is sometimes helpful in low SNR data.

-t[start,stop]	Truncate scans (OFF)

	There are times, for example when using non-destructive reads,
	that one part of a scan or another is saturated or noisy. This
	flag allows you to use a mouse to set limits on how much of 
	each scan is included in the reduction.

-u		Toggle noise PS multiplier (OFF)

	This is largely obsolete, and tells redfluor to multiply the
	background noise by a constant that best fits the high frequency
	noise.

-U[freq]	Set DC suppression frequency (20.0 Hz)

	Low frequencies contain a great deal of scintillation noise and
	so are ignored during many operations. This flag lets you set
	the lowest frequency used by the reduction.

-V		Toggle verbose mode (OFF)

	Turns on lots of output text telling you what is going on.

-x		Toggle use dither freq for fringes (OFF)

	Normally, the fringe frequency is set by fitting a Gaussian to
	the signal power. In low SNR data this can fail and so it is
	sometimes helpful to simply use the theoretical frequency as
	used during the observation.

-X[stddevmult]	Set stddev multiplier (3)

	For each scan the photometry is filtered and checked against
	some multiple of the standard deviation of the camera noise.
	If at any point the photometry goes below this value the scan
	is rejected. In low SNR data it is sometimes helpful to reduce
	this threshold, but note that if you make it too low things can
	go very wrong. If you do this, it's best to use the -d3 flag so
	you can see what is going on.

-y      Toggle use fringe signal for waterfall (OFF)

	By default the final waterfall plot is donw using the fringe
	envelope. Using this flag you can see the fringe signal itself.

-Y      Toggle use filter for waterfall (ON)

	Simmilar to the -y flag, by default the fringes are bandpass filtered
	before the waterfall plot is created at the end of the processing.
	You can turn this off using this flag.

-z[pixmult]	Set pixel multiplier (2)

	Sets a pixel multiplier for some displays. Increasing this
	number will make the display larger. This is largely obsolete
	now as you can change this dynamically while reducing data.


Note that the redfluor program is designed for use in scripts and on a 
command line and has as yet no GUI. You can not move backwards through
the reduction, only forwards, so if you need to change something you
need to start from the beginning.

A normal reduction process would be to choose an example file in a bracket 
and run it with the -d3 flag so you can check how things go. You would 
also want to use the -i flag so you can find a good integration range. 
So for example, the first file might be reduced using

redfluor -dev xwin -i -d3 datafile.fit

You might then see that 75-125 Hz is a good integration range, and that
you end to reduce the width of the fringe packet used. You would then
reduce all the data files with a command like

for i in *.fit
do
redfluor -dev xwin -d0 -I75-125 $i
done

You would then be able to start trying to reduce the data using the 
calibir program. This is the same calibration program as used for CLASSIC data
so it would be best to read the document on CLASSIC reduction to find out
how this works.

There is also a GUI interface called redfluorgtk, that allows you to select 
difference features and try many things, as well as process whole directories
of data. Note that you should not run this as a background task or as part of
a script and that you will still need to type responses to the redfluor program
in the text terminal.
		Calibir - Calibration of FLUOR/CLASSIC data
		-------------------------------------------

			Theo ten Brummelaar.

The calibir program tries to read INFO files in the directories in the current
location and calibrate the data. It assumes the fits object is the target and
the rest are calibrators. No output file is saved unless you ask for one using
the -f or -F flags.

A common use would be

calibir -F -H -s0.45-0.01,0.34-0.03 19733 18567 18778

There are numerous flags of course:

Version: V2.3 Wed Apr  6 13:54:48 PDT 2016
usage: ./calibir [-flags] {OBJ CAL1 CAL2 CAL3...}
Flags:
-b[beta]		Visibility multiplier (1.0)

	When in self calibration mode, that is for separrated fringe packet data
	you can set the "beta" value, that is the ratio of brightness between
	the object and the calibrator.

-B[Vis Type]		Set Vis estimator for Object and Calibrator (V2_MEDIAN)

	Set which type of visibility estimator to use. 

	Visibility estimators available are:

		V_CMB V_FIT V_ENV V_MEAN_ENV_PEAK 
		V_MEAN_ENV_FIT BINARY_V_A BINARY_V_B BINARY_ENV_V_A 
		BINARY_ENV_V_B V2_SCANS V_SCANS V_NORM 
		V_LOGNORM V2_MEDIAN V_MEDIAN V2_SCANS_DIR 
		V_SCANS_DIR V_NORM_DIR V_LOGNORM_DIR 

-c			Use CHARA number for identifier (OFF)

	BY default uses the info to determine what is a calibrator and what is
	a target, which is probably rarely actually going to work. 
	You can instead force it to use the CHARA catalogue number.

-C[Cal Vis Type]	Set Vis estimator for Calibrator (V2_MEDIAN)

	Set the visibility estimator type for the Calibrator only

-D[spec chan]		Change spectral channel 

	Set which sepctral chanel we are using - only for FLUOR data.

-f[oif]			Set OIFITS filename (From object)

	Force calibir to output an OIFITs file with a specific name.

-F			Toggle saving OIFITS file (OFF)

	Force calibir to output an OIFITs file with a name based on the object.

-h			Print this message

	Probably actually prints the help for PLPLOT. If you want this meassage
	it would be best to invokve calibir with an illegal flag of some kind.

-H			Use HD number for identifier (OFF)

	BY default uses the info to determine what is a calibrator and what is
	a target, which is probably rarely actually going to work. 
	You can instead force it to use the HD catalogue number.

-i			Use ID/Name for identifier (OFF)

	BY default uses the info to determine what is a calibrator and what is
	a target, which is probably rarely actually going to work. 
	You can instead force it to use the object "names".


-J[mjdmin,mjdmax]	Restrict MJD range (All)

	Set a minimum and maximum MJD number to include.

-l			Assumes a linear variation of the cals (OFF). 
		 	Otherwise also takes into account the cal errors

	Normally calibir uses the calibrator error bars to help estimate the
	final error bars, but you can turn that off.

-n			Use standard error instead of standard deviation (ON)

	The standard error is always smaller than the stdandard deviation and
	is used for errors by default. This forces calibir to use the 
	standard deviation instead.

-N[min_n_Scans]		Minimum number of scans (0)

	Forces calibir to reject data files that have less than a given 
	number of scans.

-o			Invert the sign of the UV coords (OFF)

	Multiply the UV coordinates by -1 before saving the OIFITs file.

-O[Obj Vis Type]	Set Vis estimator for Object (V2_MEDIAN)

	Set the visiblity estimator to use for the obejct.

-p[detector chan]	Change detector channel (0=diff, 1, 2, 3=weighted mean) 

	Choose which output channel to use for the visiblity amplitude
	estimator. BY default we use teh difference signal, but sometimes
	one channel is not good.

-P{dev}		Toggle plotting, or set device (ON/xwin)

	Set the PLPLOT plotting device. Rarely used.

-r			Print raw data (ON)

	Print out in text the raw data. Helpful for checking how things
	are going.

-s[diam1-err,diam2-err,...]	Size of calibrators in mas (0.0)

	Ser the sizes and errors for the calibrators. if No error is given 
	it assumes 0.0 for the error. If not used assumes the calibrators
	are all unresolved.

-t			Includes varriablity of the co-Transfer in error.
			If error left out it is set to zero.

	We don't normally include the systematic error in the co-Transfer
	function. This is rarely used.

-S			Self Calibrate mode (OFF)

	forces self calibration mode, that is for separrated fringe packet data.

-V			Verbose mode (OFF)

	Turn on verbose mode. Also prints out this list.

-2			Output V^2 table based on V estimator (ON)

	Normally the OIFITs file is always saved as V^2, even if the estimator
	used was for V. This will turn that off.

		Redclimb 2016_04_13
		-------------------

		Theo ten Brummelaar

This directory contains the software for the program "redclimb", the data 
reduction pipeline for CLIMB data. 

The redclimb program will output the following text if invoked without 
arguments:

usage: ./redclimb [-flags] ir_datafile
Flags:
-a		Toggle apodize for FFT (OFF)
-A		Use only shutter sequence A (OFF)
-b		Toggle redo background and beams (OFF)
-B		Use only shutter sequence B (OFF)
-c		Toggle pixels must agree (ON)
-d[0,1,2,3,4,5]	Set display level(1)
-D[Dir]		Directory for results (Basename)
-e		Toggle edit scans (ON)
-E[weight]	Use fringe weight to edit for AMP (OFF)
-f[width_frac]	Envelope width fraction (0.35)
-g[0-1]		Fraction of Gaussian to include in CP (0.1)
-G		Toggle using AMP editing for CP (ON)
-h		Print this message
-H		Toggle use complete scan for closure (OFF)
-i		Toggle manual integration range (OFF)
-I[12-12,23-23,31-31]	Set integration range
-J		Toggle filtering of signal (ON)
-k		Toggle skip visibility calculation (OFF)
-K		Toggle skip overlap test (ON)
-l[freq]	Use lowpass filter signal for normalization (10Hz)
-m		Toggle save means as text (ON)
-n		Toggle use noise instead of signal (OFF)
-Nndata		Force data segment size (AUTOMATIC)
-O		Toggle photometry only (OFF)
-p		Toggle use postscript (OFF)
-P[smooth_noise_size]	Change noise PS +-smooth size (4)
-r		Toggle save raw data as text (OFF)
-R		Toggle remote mode (OFF)
-s[n]		Scans to skip after shutter change (0)
-S[smooth_size]	Change +-smooth size (1)
-t[start,stop]	Truncate scans (OFF)
-u		Toggle noise PS multiplier (ON)
-U[freq]	Set DC suppression frequency (10.0 Hz)
-V		Toggle verbose mode (OFF)
-w[weight]	Set minimum fringe weight for CP (0.5)
-W[width]	Set PS peak width for fit (10.0 Hz)
-x		Toggle use dither freqs for fringes (OFF)
-z[pixmult]	Set pixel multiplier (2)
-#[start,stop]	Set range of scan to include (ALL)

Redfluor uses the PLPLOT package to produce the plots it makes, and
therefore will also understand any standard Plplot command line
arguments. 

Redfluor uses the "standard" data reduction techniques as set out in the
seminal A&A Vol 121 p379 paper, along with a few additions, in
particular there are some new ways of estimating the background noise.

Note that arguments to flags, except for those associated with Plplot,
do not have a space between the flag and the data. So, for example, a
common way of invoking redclimb is

redclimb -e -d2 datafile.fit

which will start redclimb for an X windows display, bypass fringe
editing, and display an intermediate amount of plots 

The flags available for redclimb are:

-a		Toggle apodize for FFT (ON)

	Since redclimb uses an FFT, it is normal to apodize the data
	before calculating power spectra or filtering the data. This is
	by default on, and is rarely turned off.

-A		Use shutter sequence A for noise (OFF)

	The background noise power is by default, calculated by using
	the off fringe  scans if they are present or the long shutter sequence
	at the end of the data collectio0n cycle. The -A tells redclimb to 
	instead use the initial shutter sequence to estimate the noise power.
	It's worth trying this if the power spectra of the fringes do not 
	hover around zero away from the	fringe peak.

-b		Toggle redo background and beams (OFF)

	Force redclimb to recalculate the background formthe data rather
	than use anythijng it finds in the INFO file.

-d[0,1,2,3,4,5]	Set display level(1)
	
	Sets how much you will see. The levels are:

	0 - Display nothing
	1 - Display a minimal amount of plots. These include the
	    photometry, the mean power spectra, fitting of Gaussian to 
	    the power spectra, the integration range and the closure phases
	    results. 
	2 - Adds a few more plots concerning calculation of the Kckground
	    noise.
	3 - Plots details of the reduction of each fringe scan. There
	    will be lots of these, but it can be useful for debugging,
	    for example to see that the amount of data being requested
	    and re-centered for each scan is too large or too small,
	    or that the minimum threshold for the photometry is too high
	    or too low.
	4 - Like level 3, but instead of plotting the fringe amplitude 
	    calculation steps plot the closure phase calculation steps.

	5 - Plot everything.

-D[Dir]		Directory for results (Basename)

	Set the directory in which you want the output files to go. 
	It is very uncommon to change this from the default, which is
	based on the file name of the data.

-e		Toggle edit scans (ON)

	By default redclimb assumes you wish to edit the scans, this flag
	allows you to bypass this. This is commonly used when you
	re-reduce data and you have already edited out bad scans.

-E[weight]	Use fringe weight to edit for AMP (OFF)

	It is possible to have redclimb automatically edit all scans based on 
	the so called fringe weight. Fringe weight is the amount of
	power in the band containing the fringes compared to the amount
	of power in a similar band away from the fringe frequency. This
	is not commonly used.

-f[width_frac]	Envelope width fraction (0.35)

	Controls the fraction of the envelopes that must overlap before
	a closure phase calculation is done. You rarely need to change this.

-h		Print this message

-H		Toggle use complete scan for closure (OFF)

	Normally closure is calculated only in the parts the program believes
	fringes exists. You can force it to do the calculation for the entire
	scan. This is normally only used for testing the code.

-i		Toggle manual integration range (OFF)

	This flag let's you choose the integration range manually, using
	mouse clicks on the power spectrum plot. Otherwise the
	integration is set by fitting a Gaussian to the fringe peak, or
	if you have reduced these data before, using the same range as 
	last time. 

-I[12-12,23-23,31-31]	Set integration range

	Often it is a good idea to force the system to use a single range 
	of integration for all data files in a cluster by using this
	flag.

-J		Toggle filtering of signal (ON)

	Before closure phase calculations the fringes can be bandpass filtered. 	You can turn this off if you wish, but you will not do so often.

-k		Toggle skip visibility calculation (OFF)

	Used when you are playing with teh closure phase paramteres and don't
	wish to constantly see the amplitude plots.

-K		Toggle skip overlap test (ON)

	During closure phase calculation, the code will try and test to see
	if the fringes overlap in a scan, and skip the scan if they do not.
	This flag bypasses that test.

-l[freq]	Use lowpass filter signal for normalization (5Hz)

	Set the frequency of the low poss filter used to calculate the
	mean signal in a scan.

-m		Toggle save means as text (ON)

	The backgrounds calculated for each scan are normally saved in a
	file with the extension .backgound, but you can turn that off.

-n		Toggle use noise instead of signal (OFF)

	Bypasses all checks on overlap in closure calculation. This option
	is now obsolete and very rarely used, and was used only for 
	testing the code.

-Nndata		Force data segment size (AUTOMATIC)

	The closure phse is calculate for a standard number of samples across
	each scan. Normally this is set to the number of samples that contains
	one fringe of the 31 baseline, that is, the lowest frequency fringe.
	Most often this is 15 samples, and is determined from the data, but 
	can be forced to a particular number using this flag.

-O		Toggle photometry only (OFF)

	Sometimes you just wish to redo the photometry. This flag runs
	the reduction and stops after the photometric analysis.

-p		Toggle use postscript (OFF)

	Instead of displaying everything on the X windows screen, send
	all plots to a postscipr file.

-P[smooth_noise_size]	Change noise PS +-smooth size (4)

	The background noise power spectra are smoothed using a boxcar
	algorithm. This flag lets you change the size of the box.
	Increasing the size of the box can be useful in low SNR data.

-r		Toggle save raw data as text (OFF)

	You can save the raw data to a text file. Manly used for tests.

-R		Toggle remote mode (OFF)

	This flag is obsolete.

-s[n]		Scans to skip after shutter change (0)

	Sometimes you can see changes in photometry during shutter moves. This
	allows you to skip a few scans after each shutter change to avoid this.

-S[smooth_size]	Change +-smooth size (1)

	The signal can also be smoothed using a boxcar integration. This 
	is sometimes helpful in low SNR data.

-t[start,stop]	Truncate scans (OFF)

	There are times, for example when using non-destructive reads,
	that one part of a scan or another is saturated or noisy. This
	flag allows you to use a mouse to set limits on how much of 
	each scan is included in the reduction.

-u		Toggle noise PS multiplier (ON)

	This is largely obsolete, and tells redclimb to multiply the
	background noise by a constant that best fits the high frequency
	noise.

-U[freq]	Set DC suppression frequency (10.0 Hz)

	Low frequencies contain a great deal of scintillation noise and
	so are ignored during many operations. This flag lets you set
	the lowest frequency used by the reduction.

-V		Toggle verbose mode (OFF)

	Turns on lots of output text telling you what is going on.
	If you use '-v' it will tell the plotting package plplot
	to print out it's version number.

-w[weight]	Set minimum fringe weight for CP (0.5)

	Closure calculations are only done on high SNR fringes, but this can be
	changed with this flag.

-W[width]	Set PS peak width for fit (10.0 Hz)

	In order to work out the fringe frequency a Gaussian is fitted
	to the power spectrum. This flag controls the amount of each
	peak used to perform this fit.

-x		Toggle use dither freqs for fringes (OFF)

	Rather than use a fit to the power spectrum this flag forces the
	program to use the dither frequencies found in the FITs file.

-z[pixmult]	Set pixel multiplier (2)

	Sets a pixel multiplier for some displays. Increasing this
	number will make the display larger. This is largely obsolete
	now as you can change this dynamically while reducing data.

-#[start,stop]	Set range of scan to include (ALL)

	Manually set the range of scans to include in the reduction.

Note that the redclimb program is designed for use in scripts and on a 
command line has as yet no GUI. You can not move backwards through
the reduction, only forwards, so if you need to change something you
need to start from the beginning.

A normal reduction process would be to choose an example file in a bracket 
and run it with the -d3 flag so you can check how things go. You would 
also want to use the -i flag so you can find a good integration range. 
So for example, the first file might be reduced using

redclimb -i -d3 datafile.fit

You might then see that 75-125 Hz is a good integration range, and that
you end to reduce the width of the fringe packet used. You would then
reduce all the data files with a command like

for i in *.fit
do
	redclimb -d0 -I75-125 $i
done

You would then be able to start trying to reduce the data using the 
calibir program. This is the same calibration program as used for CLASSIC data
so it would be best to read the document on CLASSIC reduction to find out
how this works.

There is of course also a calibration program, very simmilar to calibir:
A common use would be

calibclimb -F -H -s0.45-0.01,0.34-0.03 19733 18567 18778

There are numerous flags of course:

./calibclimb : V2.4 Wed Apr 13 16:12:42 PDT 2016
usage: ./calibclimb [-flags] {OBJ CAL1,CAL2,CAL3...}
Flags:
-B[Vis Type]		Set Vis estimator for Object and Calibrator (V_LOGNORM)
-c			Use CHARA number for identifier (OFF)
-C[Cal Vis Type]	Set Vis estimator for Calibrator (V_LOGNORM)
-f[oiffile]		Set OIFITS filename (From object)
-F			Toggle saving OIFITS file (OFF)
-h			Print this message
-H			Use HD number for identifier (OFF)
-i			Use ID/Name for identifier (OFF)
-I			Invert the sign of the closure phase (OFF)
-J[mjdmin,mjdmax]	Restrict MJD range (All)
-l			Assumes a linear variation of the cals (OFF). Otherwise also takes into account the cal errors
-n			Use standard error instead of standard deviation (ON)
-o			Invert the sign of the UV coords (OFF)
-O[Obj Vis Type]	Set Vis estimator for Object (V_LOGNORM)
-p[0, 2 or 3]		Use both or only pixel 2 or 3 for closure (0-Both)
-r			Print raw data (ON)
-s[diam1-err,diam2-err,...]	Size of calibrators in mas (0.0)
			If error left out it is set to zero.
-t			Includes varriablity of the co-Transfer in error.
-V			Print version and verbose mode.
-2			Output V^2 table based on V estimator (ON)

Visibility estimators available are:
V2_SCANS V_SCANS V_NORM V_LOGNORM 
V2_MEDIAN V_MEDIAN 

Flags:

-B[Vis Type]		Set Vis estimator for Object and Calibrator (V2_MEDIAN)

	Set which type of visibility estimator to use. 

	Visibility estimators available are:

		V_CMB V_FIT V_ENV V_MEAN_ENV_PEAK 
		V_MEAN_ENV_FIT BINARY_V_A BINARY_V_B BINARY_ENV_V_A 
		BINARY_ENV_V_B V2_SCANS V_SCANS V_NORM 
		V_LOGNORM V2_MEDIAN V_MEDIAN V2_SCANS_DIR 
		V_SCANS_DIR V_NORM_DIR V_LOGNORM_DIR 

-c			Use CHARA number for identifier (OFF)

	BY default uses the info to determine what is a calibrator and what is
	a target, which is probably rarely actually going to work. 
	You can instead force it to use the CHARA catalogue number.

-C[Cal Vis Type]	Set Vis estimator for Calibrator (V2_MEDIAN)

	Set the visibility estimator type for the Calibrator only

-f[oif]			Set OIFITS filename (From object)

	Force calibir to output an OIFITs file with a specific name.

-F			Toggle saving OIFITS file (OFF)

	Force calibir to output an OIFITs file with a name based on the object.

-h			Print this message

	Probably actually prints the help for PLPLOT. If you want this meassage
	it would be best to invokve calibir with an illegal flag of some kind.

-H			Use HD number for identifier (OFF)

	BY default uses the info to determine what is a calibrator and what is
	a target, which is probably rarely actually going to work. 
	You can instead force it to use the HD catalogue number.

-i			Use ID/Name for identifier (OFF)

	BY default uses the info to determine what is a calibrator and what is
	a target, which is probably rarely actually going to work. 
	You can instead force it to use the object "names".


-I			Invert the sign of the closure phase (OFF)

	We sued to get consfused about the sign of closure phase, but
	we now hope we have that right.

-J[mjdmin,mjdmax]	Restrict MJD range (All)

	Set a minimum and maximum MJD number to include.

-l			Assumes a linear variation of the cals (OFF). 
		 	Otherwise also takes into account the cal errors

	Normally calibir uses the calibrator error bars to help estimate the
	final error bars, but you can turn that off.

-n			Use standard error instead of standard deviation (ON)

	The standard error is always smaller than the stdandard deviation and
	is used for errors by default. This forces calibir to use the 
	standard deviation instead.

-o			Invert the sign of the UV coords (OFF)

	Multiply the UV coordinates by -1 before saving the OIFITs file.

-O[Obj Vis Type]	Set Vis estimator for Object (V2_MEDIAN)

	Set the visiblity estimator to use for the obejct.

-p[0, 2 or 3]		Use both or only pixel 2 or 3 for closure (0-Both)

	Choose which output channel to use for the closure phase
	estimator. By default we use both pixels 2 and 3.

-P{dev}		Toggle plotting, or set device (ON/xwin)

	Set the PLPLOT plotting device. Rarely used.

-r			Print raw data (ON)

	Print out in text the raw data. Helpful for checking how things
	are going.

-s[diam1-err,diam2-err,...]	Size of calibrators in mas (0.0)

	Ser the sizes and errors for the calibrators. if No error is given 
	it assumes 0.0 for the error. If not used assumes the calibrators
	are all unresolved.

-t			Includes varriablity of the co-Transfer in error.
			If error left out it is set to zero.

	We don't normally include the systematic error in the co-Transfer
	function. This is rarely used.

-V			Verbose mode (OFF)

	Turn on verbose mode. Also prints out this list.

-2			Output V^2 table based on V estimator (ON)

	Normally the OIFITs file is always saved as V^2, even if the estimator
	used was for V. This will turn that off.
