\section{Bragg Crystal Spectrometer (BCS)}

\subsection{Routines for Data Selection}
\index{data selection, BCS}
\subsubsection{LIST\_BDA}

A sample call would be:
%
\idlinputa{list\_bda, roadmap, start, nrec, ss=ss}\index{LIST\_BDA}
%
where {\it roadmap} is the input.

\subsubsection{SELECT\_BDA}

\begin{sloppy}
Use SELECT\_BDA to plot the roadmap light curve of a selected channel
and  select  the  time  period  of  interest using the cursors.  (Note:
there is an option to read the data in with \mbox{SELECT\_BDA} if required).
A sample call would be:
\end{sloppy}
%
\idlinputa{.run select\_bda}\index{SELECT\_BDA}
%
where {\it roadmap} is the input.

\subsection{Routines for Making Time Plots}

\subsubsection{BCS\_24HR\_PLOT}

If  you  interested  only  in whether  the  BCS   has   seen   anything,   use
BCS\_24HR\_PLOT.  This works using only roadmap data and allows intervals
to de selected by date (all files covering this data are  then  used).   By
default,  channel  3  (Ca XIX) is plotted.  Note:  YODAT does NOT need to
have been run before BCS\_24HR\_PLOT.  In its default mode, BCS\_24HR\_PLOT uses the 
observing log files.  Samples are:
%
\idlinputa{bcs\_24hr\_plot, '15-nov-91'}	\index{BCS\_24HR\_PLOT}
\idlinputc{bcs\_24hr\_plot, '15-nov-91', chan=4} 
%
\subsubsection{PLOTT\_BDA}

PLOTT\_BDA will make a light curve plot using either the index or
roadmap.  The second `T' signifies that it is a time plotting routine.
Four plots are made on the page, one for each channel.  Some sample calls are:
%
\idlinputa{plott\_bda, index}	\index{PLOTT\_BDA}
\idlinputb{plott\_bda, roadmap}	
\idlinputc{plott\_bda, roadmap(100:200), psym=10} 
%
\subsubsection{LCBDA [*]}

LCBDA will make a light curve plot using either the index or
roadmap.  It is almost identical to PLOTT\_BDA except that you can
specify a channel and only get that channel plotted.  Some sample calls are:
%
\idlinputa{lcbda, index}	\index{LCBDA}
\idlinputc{lcbda, roadmap, chan=1} 
%

\subsection{Routines for Making Spectral Plots}

\subsubsection{PLOTS\_BDA}

PLOTS\_BDA allows for the spectra for all four channels to be plotted 
to one page.  A sample calling sequence is:
%
\idlinputd{plots\_bda, index, data}\index{PLOTS\_BDA} 
%
\subsubsection{PLOTBDA  }

The light curve and spectra from the BDA file may be plotted using PLOTBDA.
This is an interactive program and it will read its own data.
%
\idlinputd{.run plotbda}\index{PLOTBDA} 
%
\subsubsection{BCS\_MULTI  }

Many spectra may be plotted on a page with BCS\_MULTI.
%
\idlinputa{bcs\_multi, index, data}	\index{BCS\_MULTI}
\idlinputc{bcs\_multi, index, data, chan=1} 
%
\subsubsection{BCS\_CONT  }

The evolution of  spectra  against  time  can  be  displayed  as
a contour map using the routine BCS\_CONT.  Note:  The time axis of BCS\_CONT is uniform, but
those of DISP\_BDA and GS are not.
%
\idlinputa{bcs\_cont, index, data}	\index{BCS\_CONT}
\idlinputc{bcs\_cont, index, data, chan=1} 
%
\subsection{Routines for 2-D Spectral Display}

\subsubsection{DISP\_BDA  }

The evolution of  spectra  against  time  can  be  displayed  as a pseudo-image 
using the routine DISP\_BDA.  Note:  The time axis of DISP\_BDA is not uniform.
%
\idlinputd{disp\_bda, index, data}\index{DISP\_BDA} 
%

\subsubsection{BCS\_SPMOVIE  }

After selecting a time interval, a movie of  the  changing  spectra  for  a
given  channel  may  be  displayed by BCS\_SPMOVIE.  Note:  This program
will only run on an X-windows workstation.
%
\idlinputa{bcs\_spmovie, index, data}	\index{BCS\_SPMOVIE}
\idlinputc{bcs\_spmovie, index, data, chan=1} 
%
\subsubsection{GS   [*]}

If you are interested in more detail of what spectra the BCS has  observed,
use  GS  ---  this  routine  must be run after the data has been read in with
YODAT.  There is an upper limit on how much data can be handled at  a  time 
(about 900 spectra), and some selection of the required time interval may be
needed using the methods described above, but for the per-orbit files, this
limit may not be a problem.  The advantage of GS is that you can get a good
idea of what has been seen in the spectra --- a particularly useful  tool  if
you are trawling for data.
Warning:  The time axis on the greyscale plot is not uniform!
%
\idlinputa{.run gs}\index{GS}
%
All the routines that run from GS require that spectra  be  selected  first
using the cursor routine.
%
\idlinputd{.run gs\_cur}\index{GS\_CUR}

\subsection{Routines for Data and Information Extraction}

\subsubsection{EXT\_BCSCHAN  }

The spectra for a single channel may be extracted with EXT\_BCSCHAN
%
\idlinputd{data\_out = ext\_bcschan(index, data, chan)}\index{EXT\_BCSCHAN} 
%
\subsubsection{LIST\_BDA}

If you are interested in what modes the BCS  was  executing,  or  what  the
count rate  in  a particular channel has observed at a particular time, this
can be determined by using LIST\_BDA.  By default the count rate for  channel
3 (Ca XIX) is given in the listing.  Sample calls are:
%
\idlinputa{list\_bda, roadmap, start, nrec}\index{LIST\_BDA}	
\idlinputb{list\_bda, roadmap, start, nrec, chan=4}
%
where {\it roadmap} is the input.

\subsubsection{GT\_TOTAL\_CNTS}

GT\_TOTAL\_CNTS extracts the information from the TOTAL\_CNTS field which used
the actual spectra to calculate the total number of counts.  The routine also
normalizes so that it returns counts/sec.  In the first example below, all
four channels are returned, so the output is 4xN.  In the second example,
only channel 1 is extracted.  It is possible to get a string defining the
channel selected by using the {\it title} keyword option.
%
\idlinputa{x = gt\_total\_cnts(roadmap)}	\index{GT\_TOTAL\_CNTS}
\idlinputb{x = gt\_total\_cnts(roadmap,1)}	
\idlinputc{x = gt\_total\_cnts(index,2,title=title)} 
%
\subsubsection{GT\_BLOCKID}

GT\_BLOCKID returns information on how the BCS data were blocked.
%
\idlinputa{x = gt\_blockid(roadmap)}\index{GT\_BLOCKID}
%
\vspace{0.2in}\begin{tabular}{|l|l|} \hline
        0 & { Normal Queue Data Block } \\
        1 & { Fast Queue Data Block } \\
        2 & { Micro Dump Block (fixed extraction) } \\
        3 & { Cal Data Block (fixed extraction) } \\
        4 & { Queue data where the modeID in the header is not recognized } \\
        5 & { Normal or fast queue data which have fill data (garbage)  } \\ \hline
\end{tabular}

\subsection{Routines for Calibration and Analysis}

\subsubsection{BCS\_DECOMP}

The BCS data are normally compressed from a 12-bit word to an 8-bit word.
BCS\_DECOMP takes the compressed data array ({\it data}) and creates a floating point
array ({\it ndat}) of the decompressed numbers by typing:
%
\idlinputd{ndat = bcs\_decomp(data)} \index{BCS\_DECOMP} 
%
\subsubsection{BCS\_NORM}

BCS\_NORM normalizes data recorded by the BCS for integration time, and extracts the
Fast Queue data if present.  A sample call is:
%
\idlinputd{dspec = bcs\_norm(index, data)}\index{BCS\_NORM} 
%
\subsubsection{SUM\_BDA}

All spectra with mode ID {\it modeid} will be summed by SUM\_BDA with the following command:
%
\idlinputd{data\_out = sum\_bda(index, data, modeid, nsum)}\index{SUM\_BDA} 
%
\subsubsection{PLOT\_REF [*]}

Overplot several spectra to show evolution of blue wing and line width.
%
\idlinputd{plot\_ref, index, data, channel, dset\_arr} \index{PLOT\_REF} 
%
\subsubsection{BCS\_DTFAC}
The dead-time correction factors can be calculated with BCS\_DTFAC:
%
\idlinputd{dd = bcs\_dtfac(index,dp\_sync,type,stime,etime)}\index{BCS\_DTFAC}
%
\subsubsection{BCS\_POINT}
The position of a source on the solar disk may be determined from  the  bin
number  of  the  resonance  line with BCS\_POINT.  If the epoch is provided,
this routine will also return the heliocentric latitude:
%
\idlinputd{dd = bcs\_point(wbin [,chan=n [,date=date, etc.]])}\index{BCS\_POINT}
%
\subsubsection{BCS\_SYNTHETIC}
\index{BCS synthetic spectra}
\index{synthetic spectra, BCS}
\index{spectra, synthetic, BCS}

BCS\_SYNTHETIC is a simple main program to compute BCS synthetic spectra in 
flux units.  The program will prompt the user for the BCS channel number 
(1,2,3,4 = Fe XXVI, Fe XXV, Ca XIX, S XV), the electron temperature (MK) 
and the Doppler temperature (MK).  To run the program type:
%
\idlinputa{.run bcs\_synthetic}\index{BCS\_SYNTHETIC}
%
The program calls the procedure BCS\_SPEC to perform the spectral 
calculations.  It defaults to a wavelength coverage which is appropriate 
for mid-latitude observations.  The BCS\_SPEC defaults for atomic code, 
ionization balance and abundance will be used.  The computation is made for
an emission measure of EM = 10$^{50}$ cm$^{-3}$.

\subsubsection{BCS\_SPEC}

BCS\_SPEC is a procedure to compute a BCS synthetic spectrum in flux units.  
Sample calling sequences are:
%
\idlinputa{flux = bcs\_spec(Chan,Te6)  ; Use Td6=Te6 and default wavelengths} \index{BCS\_SPEC}
\idlinputb{flux = bcs\_spec(Chan,Te6,Td6,Wave,Waveo=Waveo,Ainfo=Ainfo,Vel=Vel)}
%
where the inputs are {\it Chan} (the BCS channel number of a BSC structure), {\it Te6} 
and {\it Td6} (electron and ``Doppler'' temperatures in MK), and {\it Wave} is a vector of 
the edges of the BCS wavelength bins.  Returned will be {\it flux} (assuming 
EM = 10$^{50}$ cm$^{-3}$), {\it Waveo} (wavelengths at the centers of the bins), and 
{\it Ainfo} (a structure variable containing information about the calculated 
spectrum).  {\it Vel} is an optional input keyword to specify the bulk velocity in km/s.  
More information is available in the documentation header.
BCS\_SPEC is called by BCS\_SYNTHETIC and FIT\_BSC.  \index{FIT\_BSC}

Three routines control the defaults for the atomic data used in the calculation.  
These are GET\_ELEMABUN (abundances), GET\_IONBAL (ionization balance) and 
GET\_ATOMIC (the atomic data for the line calculation).

\subsection{BSC Routines}
\index{BSC (BCS Spectrally Calibrated)}

\subsubsection{HELP\_BSC}

To get quick on-line help for various BSC procedures and functions,
type:
%
\idlinputd{help\_bsc}\index{HELP\_BSC}
%
\subsubsection{MK\_BSC}
\index{BSC files, creating}
\index{calibrated spectra, BSC}

MK\_BSC makes BSC\_INDEX and BSC\_DATA structures from the BDA INDEX and DATA.
These structures contain instrumentally corrected BCS data for selected
channels and accumulation times. A typical run would look like:
%
\idlinputa{mk\_bsc,index,data,bsc\_index,bsc\_data,dp\_sync=dp\_sync}\index{MK\_BSC}
%
To analyze BCS data, you would begin by using YODAT to read the BDA
data file for the dates and times you are interested in. Yodat will return
a BDA index structure INDEX, a BDA data array DATA, and a structure DP\_SYNC
which contains the DP synchronous data needed for deadtime corrections.

MK\_BSC will prompt for various inputs such as start and stop times, channels to
process, integration times, and which corrections (deadtime, crystal curvature,
flux calibration) to apply. The DP\_SYNC keyword is optional, but must be
entered the first time if deadtime corrections are required. Subsequent calls
to MK\_BSC will use the last values of DP\_SYNC data passed via this keyword.

The following keywords are also accepted:

\vspace{0.2in}\begin{tabular}{ll}
{\tt /LAST   } & {\raggedright  -- run using the information stored in the latest BSC\_INDEX.}\\
{\tt /DEF    } & {\raggedright  -- run using the default settings. }\\
{\tt /WID    } & {\raggedright  -- run via a widget interface.}\\
{\tt /BSA    } & {\raggedright  -- run to make BSA index only (do not make BSC\_DATA).}\\
{\tt /SAVE   } & {\raggedright  -- save BSC (or BSA) index (and data) in a file.}\\
{\tt         } & {\raggedright    (The file will be named BSCyymmdd.hhmm, based on the time of the }\\
{\tt         } & {\raggedright     first data interval).}\\
{\tt /VERBOSE} & {\raggedright  -- echo extra information about SAA/NIGHT or MODEID/BLOCKID }\\
{\tt BDAFILE } & {\raggedright  -- input BDAFILE to read.}\\
\end{tabular}\vspace{0.1in}

The instrumentally corrected data will be output to a new set of structures
BSC\_INDEX and BSC\_DATA. The data in BSC\_DATA are stored as 256 element floating
point arrays in fields with the following definitions: 

\vspace{0.2in}\begin{tabular}{ll}
{\tt .COUNTS  } & {\raggedright  -- accumulated counts (per detector bin) }\\
{\tt .BIN     } & {\raggedright  -- physical detector position}\\
{\tt .ERROR   } & {\raggedright  -- spectral uncertainties (in counts) }\\
{\tt .WAVE    } & {\raggedright  -- nominal wavelength array (\AA) }\\
{\tt .FLUX    } & {\raggedright  -- flux-calibrated data (ph cm$^{-2}$ s$^{-1}$ \AA$^{-1)}$}\\
{\tt .WAVE\_FIT} & {\raggedright  -- wavelength array for the fitted spectra (\AA)}\\
{\tt .FLUX\_FIT} & {\raggedright  -- fitted spectra}\\
\end{tabular}\vspace{0.1in}

Not all the above fields will be present. The fields that are present
will depend on the corrections requested in MK\_BSC. The actual data
in each field array will occupy the first 0:NBINS-1 locations, 
where NBINS is the number of actual detector bins containing
valid data. The value of NBINS is stored in BSC\_INDEX.BSC.NBINS.

\subsubsection{SEL\_BSC}

SEL\_BSC extracts wavelength and flux fields from BSC\_DATA.
%
\idlinputa{sel\_bsc,bsc\_index,bsc\_data,new\_index,new\_data,wave,flux,eflux}\index{SEL\_BSC}
%
The selected index and data structures are returned in NEW\_INDEX and NEW\_DATA.
The wavelength, flux, and uncertainties in the flux are returned in the arrays
WAVE, FLUX, and EFLUX.

The following keywords are also accepted:

\vspace{0.2in}\begin{tabular}{ll}
{\tt CHAN (in)    } & {\raggedright - BCS channel (def is all)}\\
{\tt TSTART (in)  } & {\raggedright - start time to extract (UTPLOT format)}\\
{\tt TEND (in)    } & {\raggedright - end time to extract}\\
{\tt BIN  (out)   } & {\raggedright - Physical detector positions}\\
{\tt COUNTS (out) } & {\raggedright - observed counts (per bin) in the accumulation interval}\\
{\tt SS   (out)   } & {\raggedright - indices matching requested channel}\\
{\tt FWAVE (out)  } & {\raggedright - fitted wavelength array}\\
{\tt FIT (out)    } & {\raggedright - fitted spectrum array}\\
{\tt SFIT (out)   } & {\raggedright - fitted second component array}\\
\end{tabular}

\subsubsection{LIST\_BSC}

LIST\_BSC lists times, total counts, and accumulation times of BSC spectra.
%
\idlinputa{list\_bsc,bsc\_index,chan}\index{LIST\_BSC}
%
where CHAN is the desired channel to list.

\subsubsection{SAV\_BSC}

To save BSC index and data to a BSC file, use:
%
\idlinputa{sav\_bsc,'bsc\_file\_name',bsc\_index,bsc\_data}
%
Note that MK\_BSC will also save the data if the {\it /FILE} switch is set.

\subsubsection{RD\_BSC}
\index{BSC data, reading}

To read a BSC file, use:
%
\idlinputa{rd\_bsc,'bsc\_file\_name',ss,bsc\_index,bsc\_data}\index{RD\_BSC}
%
This procedure will return the BSC index and data structures. SS is a
vector with indices of a particular subset of data within the BSC file. For
example, using SS=INDGEN(10) will extract the first 10 data sets from the
BSC file.  To extract ALL the data sets, use $SS=-1$.

\subsubsection{BSC2BSD}

To convert a BSC file to a BSD file, use:
% 
\idlinputa{bsc2bsd,'bsc\_file\_name','bsd\_file\_name'}\index{BSC2BSD}
%
The BSD file name is optional, and will be created from the
BSC file name if not supplied.

\subsubsection{MAP\_BSC}

MAP\_BSC plots a pseudo-map of BSC spectra by stacking successive
spectra.
%
\idlinputa{map\_bsc,bsc\_index,bsc\_data}\index{MAP\_BSC}
%
The following keywords are accepted:


\vspace{0.2in}\begin{tabular}{ll}
{\tt CHAN    } & {\raggedright BCS channel to plot.}\\
{\tt XSPACE  } & {\raggedright the value by which to shift successive spectra in the x-direction.}\\
{\tt         } & {\raggedright [def=0]}\\
{\tt YSPACE  } & {\raggedright the value by which to shift successive spectra in the y-direction.}\\
{\tt         } & {\raggedright [def=0] }\\
{\tt TSTART  } & {\raggedright the time of the first spectrum to plot (with date optional).}\\
{\tt         } & {\raggedright [sample format,TSTART='9:32', def = first spectrum in BSC\_DATA]}\\
{\tt TEND    } & {\raggedright the time of the last spectrum to plot.}\\
{\tt         } & {\raggedright [def = last spectrum in BSC\_DATA]}\\
\end{tabular}

\subsubsection{LC\_BSC}

LC\_BSC plots light curves of selected spectral regions.
%
\idlinputa{lc\_bsc, bsc\_index, bsc\_data,  t, y, chan=chan,/flux}\index{LC\_BSC}
%
This program first plots a spectrum at the peak of the flare. The user can
select a spectral region with the cursor. The light curve derived from the sum
of wavelength points within this region is returned in the array $Y$. The time (UT)
is returned in $T$. If the BSC data are flux calibrated, then using the {\it FLUX}
keyword will return the light curve in units of photons cm$^{-2}$ s$^{-1}$.
The optional keyword {\it over} will overplot successive light curves.

\subsubsection{WBDA}

WBDA provides a simple widget interface that allows browsing of BDA files.
It is invoked by:
%
\idlinputa{wbda}\index{WBDA}
%
The program will provide a set of menus from which BDA files can be selected
either by date, filename, or directory location. WBDA will plot light curves and
spectra for a specific channel, accumulate spectra for selected  integration
times, and apply dead-time, curvature, and flux corrections. The BDA INDEX and
DATA variables produced by YODAT can be also input directly to WBDA:
%
\idlinputd{wbda,index,data}
%
\subsubsection{GT\_BSC\_BINCAL}
\index{calibration data, BCS}

This function returns a structure containing miscellaneous calibration
information for specified BCS channels:
For example, for channel 1,
%
\idlinputa{bincal=gt\_bsc\_bincal(1)}\index{GT\_BSC\_BINCAL}
%
will return the following structure:

\vspace{0.2in}\begin{tabular}{ll}
{            .CHAN         } & {\raggedright     - channel number}\\
{            .NBINS        } & {\raggedright     - number of bins per channel}\\
{            .MODEID       } & {\raggedright     - mode id}\\
{            .WAVE         } & {\raggedright     - nominal wavelength array (\AA)}\\
{            .PHYSPOS      } & {\raggedright     - physical detector position array}\\
{            .FLUXFAC      } & {\raggedright     - conversion factor array for counts/bin to photons/cm/\AA}\\
{            .SENSIT       } & {\raggedright     - mean sensitivity array for grouped bins}\\
{            .DBIN         } & {\raggedright     - detector bin width}\\
{            .W0           } & {\raggedright     - start wavelength of spectrum}\\
{            .DW           } & {\raggedright     - dispersion (angstrom/bin)}\\
{            .BINARC       } & {\raggedright     - conversion factor for arcmin to bin (bins/arcmin)}\\
{            .GAUSSW       } & {\raggedright     - FWHM Gaussian detector width (\AA)}\\
{            .RWID         } & {\raggedright     - FWHM rocking width (\AA)}\\
{            .EFAREA       } & {\raggedright     - effective area (cm$^2$)}\\
{            .NSTART       } & {\raggedright     - first valid bin}\\
{            .NEND         } & {\raggedright     - last valid bin }\\
{            .VERSION      } & {\raggedright     - version number of BCS calibration file used}\\
\end{tabular}

\subsubsection{FIT\_BSC}
\index{spectral fitting, BCS}

FIT\_BSC fits synthetic spectra to observed spectra in BSC\_DATA:
%
\idlinputa{fit\_bsc,bsc\_index,bsc\_data,fit\_index,fit\_data,chan=chan}
%
In the above call, the fitted results are returned in the new structures
FIT\_INDEX and FIT\_DATA for the channel specified by the keyword CHAN. 
If CHAN is not specified, then all channels will be fit (not recommended).

The FIT\_DATA structure contains two additional fields:

\vspace{0.2in}\begin{tabular}{lp{10.0cm}}
        .FLUX\_FIT & {\raggedright a 256-element floating point array containing 
			the fitted model spectrum matching the observed 
			spectrum in the .FLUX field} \\
        .WAVE\_FIT & {\raggedright a 256-element floating point array containing 
			computed wavelengths of the fitted model spectrum 
			in .FLUX\_FIT. } \\
        .FLUX\_FIT2 & {\raggedright a 256-element floating point array containing 
                      the fitted model spectrum corresponding to 
                      a secondary velocity shifted spectrum in the .FLUX field }

\end{tabular}

The FIT\_INDEX structure contains an additional .FIT field that contains
important fit information (parameters fit, number of iterations, chi squared,
etc).

FIT\_BSC accepts the following optional keywords:

\vspace{0.2in}\begin{tabular}{lp{12.0cm}}
{\tt         SS       } & {\raggedright  index selection vector or scalar 
			(e.g. SS=[45,46] to fit only spectra 45 and 46)}\\
{\tt         TSTART   } & {\raggedright  UT string (e.g. '9:45'). Only spectra at or 
			after TSTART will be fit. }\\
{\tt         TEND     } & {\raggedright  Only spectra at or before TEND will be fit.} \\
{\tt         LRANGE   } & {\raggedright  2-element wavelength vector range (\AA) within which to 
			limit line fitting [Default is entire range]}\\
{\tt         CRANGE   } & {\raggedright  2-element wavelength vector range (\AA) within which to 
			limit continuum fitting [Default is entire range]}\\
{\tt         TE6      } & {\raggedright  input starting guess for electron temperature (MK) 
			~ [Default is to use internal values] }\\
{\tt          TD6     } & {\raggedright  input starting guess for resonance line Doppler 
			broadening (MK) [Default is to infer from observed width] }\\
\end{tabular}

\begin{tabular}{lp{12.0cm}}
{\tt          ATTEMPT } & {\raggedright  level of fit attempt \\
\EEnumerate
\item solve only for primary emission measure (EM50) 
and line to continuum normalization factor (CNORM). 
Electron temperature and (TE6) and total Doppler 
broadening (TD6) fixed. 
\item solve for TE6, TD6, EM50, CNORM. 
\item solve for primary+secondary shifted component.
\end{enumerate}} \\
{\tt         /BLUE    } & {\raggedright equivalent to attempt=3} \\
{\tt         /NEWGUES } & {\raggedright set to NOT use results of previous fit as starting 
			input for fit to next spectrum} \\
{\tt         /PLOT    } & {\raggedright  set to plot progress of fits} \\
{\tt         /VERB    } & {\raggedright set for more information about fitting progress} \\
{\tt         /LAST    } & {\raggedright  set to use last converged parameters as starting 
			guess for fitting next spectrum. }\\
\end{tabular}

For example, to fit a Ca XIX spectrum at UT='09:04' use:
%
\idlinputa{fit\_bsc,index,data,findex,fdata,chan=3,tstart='09:04'}
%
To fit a blueshifted secondary component:
%
\idlinputd{fit\_bsc,index,data,findex,fdata,chan=3,tstart='09:04',/blue} \index{FIT\_BSC}

\subsubsection{BCS\_BROAD}
\index{velocity, BCS}\index{BCS\_BROAD}\index{determining velocities, BCS}

The relation between BCS line broadening and
velocity can be computed with BCS\_BROAD.  Some example calling sequences are:
%
\idlinputA{4.1}{Td6 = bcs\_broad(Chan,TDoppw=TDoppw)     }{; Return temperature in (MK)}
\idlinputB{4.1}{Vel = bcs\_broad(Chan,Td6=Td6,/vel)      }{; Return velocity (km/s)}
\idlinputB{4.1}{TDoppw = bcs\_broad(Chan,Td6=Td6,/Gauss) }{; Return Doppler FWHM (Ang)}
%
where $TD6$ is the equivalent Doppler Temperature (MK) and $CHAN$ is the
BCS channel number.  The parameter $TDOPPW$ does not include the
contribution due to the crystal (Lorentz) broadening, but is included
by BCS\_BROAD when it makes its calculations, based on the value of
$CHAN$.  There are several additional options available and there is a
keyword to return the crystal rocking curve width.  Most conversions
between BCS line width and velocity or between line width and
temperature can probably be accomplished using this routine. 

\subsubsection{PLOT\_BSC}
\index{BSC data, plotting}

The results of MK\_BSC and FIT\_BSC can be examined with PLOT\_BSC.
%
\idlinputa{plot\_bsc,bsc\_index,bsc\_data}\index{PLOT\_BSC}
%
PLOT\_BSC will plot light curves and spectra for user selected channels
and times, as well as fitted spectra from FIT\_BSC.

Optional keywords:

\vspace{0.2in}\begin{tabular}{ll}
{\tt CHAN  } & {\raggedright - channel to plot}\\
{\tt SS    } & {\raggedright - selected indicies of spectra to plot (default is all)}\\
{\tt /NOWID} & {\raggedright - to not use widget mode (def is widgets, if more than 1 spectrum)}\\
\end{tabular}\vspace{0.1in}

The following keywords apply only when /NOWID is set:

\vspace{0.2in}\begin{tabular}{ll}
{\tt /EBAR} & {\raggedright - oplot spectral uncertainties}\\
{\tt /HC  } & {\raggedright - make a hard copy (single spectrum only)}\\
{\tt /PS  } & {\raggedright - make a PostScript file (single spectrum)}\\
\end{tabular}\vspace{0.1in}

The following keywords apply only when /NOWID is set, and BSC\_INDEX and DATA
contain fitted spectra:

\vspace{0.2in}\begin{tabular}{ll}
{\tt /BLUE } & {\raggedright - to oplot second blueshift component (if fitted by FIT\_BSC)}\\
{\tt /VUNIT} & {\raggedright - to print fitted Doppler widths in km/s units (default is MK)}\\
{\tt /NOFIT} & {\raggedright - inhibit oplot of fitted spectra (default is oplot fit)}\\
{\tt /NOOBS} & {\raggedright - inhibit plot of observed spectra (default is plot obs)}\\
\end{tabular}

\subsubsection{FIT\_BSC\_PLOT}

FIT\_BSC\_PLOT produces time series plot results from FIT\_BSC{}.  The
routine will plot total counts, electron temperature, emission measure,
and turbulent velocity as a function of time.  Example calling
statements are:
%
\idlinputa{fit\_bsc\_plot,bsc\_index}\index{FIT\_BSC\_PLOT}
\idlinputb{fit\_bsc\_plot,bsc\_index,tstart=tstart}
\idlinputB{3}{fit\_bsc\_plot,bsc\_index,/hc         }{ ; Produce hardcopy output}
%
Consult the document header for additional options.

\subsubsection{MK\_FIT\_BSC\_EPS}\index{MK\_FIT\_BSC\_EPS}

MK\_FIT\_BSC\_EPS will produce a BCS spectrum in portrait mode.  It optionally
will specify the output file to be an EPS (encapsulated PostScript file). Some
sample calls are given below:
%
\idlinputA{4}{mk\_fit\_bsc\_eps, index, data, /hc        }{; Send plot to the printer}
\idlinputB{4}{mk\_fit\_bsc\_eps, index, data, /ps        }{; Make file but don't print}
\idlinputB{4}{mk\_fit\_bsc\_eps, index, data, /eps       }{; Create an EPS file}
\idlinputB{4}{mk\_fit\_bsc\_eps, index, data, /noatomic  }{; Suppress atomic code label}
%
MK\_FIT\_BSC\_EPS sets up the parameters to call BCS\_SPEC\_PLOT correctly.

The default X and Y size is about right for an A4 page.  The optional {\it
xoffs=xoffs} and {\it yoffs=yoffs} enable the user to position the plot
at the desired location on the page. 
