Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.eso.org/~chummel/midi/ews/guide.html
Дата изменения: Thu Oct 21 18:03:45 2004
Дата индексирования: Sat Dec 22 20:11:06 2007
Кодировка:

Поисковые слова: trifid nebula
Homepages of Christian A. Hummel

Walter's User Guide

Gentlemen and Ladies

Below a description of the EWS (Expert Work Station:
pronounced "Ooze") software for coherent estimation
of MIDI visibilities.  The package consists of C-routines
that do most of the work and IDL front-ends for selecting
data and viewing results.

Walter
11-Aug-2003

CONTENTS:

I.    Summary of C-Language programs
II.   Summary of tcsh scripts calling C-Language Programs
III.  Summary of IDL routines calling tch scripts
IV.   More details about (I)
V.    More details about (II)
VI.   More details about (III)
VII.  Description of file selection GUI (Gorgonzola)
VIII.  Standard file names and contents used by scripts

I.  Summary of C-language programs and calling sequences:

   1.  oir1dCompressData    "inFiles" maskFile    outFile
   2.  oirFormFringes        infile   outfile    [smooth]
   3.  oirRotateInsOpd       infile   outfile
   4.  oirGroupDelay         infile   outfile    -s gSmooth
   5.  oirRotateGroupDelay   infile   delayFile  outfile
   6.  oirAutoFlag           infile   delayFile  flagFile [deltaOpd] [jumpOpd] 
                             [nDrop]
   7.  oirAverageVis         infile   flagFile   outFile

   8.  oirChopPhotometry     "Afiles" "BFiles"   maskFile outFile [nDrop]

   9.  oirRedCal             sourceTag flux10
  10.  oirCalibrateVis       targTag   "calTags"

II. Summary of tcsh scripts that call these routines in an orderly fashion:
   
   1.  dispVis     "infiles"  maskFile  outTag [fringeSmooth] [delaySmooth]
   2.  dispPhot    "AFiles"  "Bfiles"   maskFile  outTag
   3.  dispVisPhot "inFiles" "AFiles"  "BFiles"   maskfile outTag
   4.  dispVisSP "inFiles" refCoordFile crossFile outTag \
          [-ndrop nDrop] [-smooth fringeSmooth] [-gsmooth delaySmooth] \
          [-sigmaY sigmaY]

III. Summary of IDL procedures that call the oirRoutines

   1. midiPipe, tag, mask=maskfile, files=filelist, smooth=smooth, 
         gsmooth=gsmooth
   2. midiCalibrate, sourceTag, calTag, [photoTag=photoTag] 
      [,calFlux10=calFlux10], [,diam=diam] [,/noPoint] [,/print]


IV.  More complete description of the oirRoutines:

   1.  oir1dCompressData      "inFiles" maskFile    outFile
    
      Purpose:
         Compress MIDI raw (PRISM/GRISM) files by multiplying each MIDI
         window by a floating point mask (which has zeros in rows
         not containing useful data) and summing in the y-direction
         (perpendicular to the PRISM/GRISM dispersion).  The result
         is a 1-dimensional spectrum for each window region.

      Parameters:

     "inFiles"  a list of raw MIDI (PRISM/GRISM) input files representing
        one exposure.  There may be more than one file because they
        were broken up into 100MB files by the on-line system.
        If there is more than one file they should be separated
        by spaces and included between double quotes: "file1 file2 file3"

      maskFile: a MIDI style FITS binary table whose imaging_data section
        contains the masks described above.  If this is not
        specified it defaults to an environmental variable specified
        externally (typically in the vltisetup script):

        for PRISM/HIGH_SENS   $prismhmask
        for PRISM/SCI_PHOT    $prismsmask
        for GRISM/HIGH_SENS   $grismhmask
        for GRISM/SCI_PHOT    $grismsmask

      outFile:  the name of the output file.  This will be a MIDI style
         FITS binary table in exactly the same format as "inFiles" and
         maskFile except that the y-dimension of each DATA array is 1.


   2.  oirCompressSPData -data "inFiles" -out outFile [-mask maskFile] \
          [-ref refCoordFile] [-nDrop dropPoints]

       Purpose: Compress SCI_PHOT interferometry data as input to
          oirFormFringes

       Parameters:

       "inFiles": blank-separated string of file names containing
          input interferometric/photometric data in SCI_PHOT mode.

       outFile:  name of file to contain compressed data

       maskFile (optional) file indicating relative weight
         of pixels in compressing signal.  This is typically
         the output of oirSciPhotometry.  If not specified,
         no masking is applied.

      refCoordFile: (optional) a FITS file containing an "imaging_detector" 
         table specifying the wavelength scale and curvature information for 
         the detector in the observed mode.  If not specified this is taken
         from "inFiles", but this is not sufficient for old input files where this
         information was not correctly supplied at Paranal.

      dropPoints: (optional) After a switch of chopping state 
         (Target-Sky-Target...) flag this many frames as "unknown" 
         state, in case there are small errors in the chopping timing.  
         Defaults to 0.

   3.  oirFormFringes        inFile   outFile    [smooth]

      Purpose:
        Take the output of oirCompressSpec and form spectrally dispersed
        fringes by subraction of the two interferometic channels and
        supression of background.  The latter is accomplished by
        the subtraction itself and then by a high-pass filter (in
        the time domain) applied to the individual spectral channels.
        This removes instrumental and sky backgrounds that vary
        more slowly than the fringe.  The fringe should vary quickly
        because of the OPD modulation imposed by the MIDI piezos.

      Parameters:

      inFile:  name of the output from oirCompressSpec

      outFile: output file name.  The format is a MIDI style FITS table 
         imaging_data file with only one DATA region (
         the combined I1-I2 channels).

      smooth  (optional) width of boxcar used in highpass filtering.  
         Default = 50
         Data is smoothed with boxcar, and this smoothed version is subtracted
         from input data yielding a highpass filter.

   4.  oirRotateInsOpd       infile   outfile

      Purpose:
         Remove the known Instrumental OPD components from the fringe spectra
         that oirFormFringes produced.  Each data point at frequency
         k (in spatial units: 2 pi/lambda) is multiplied by exp(-i*k* OPD)
         where OPD is the sum of the OPD from the MIDI piezos and the
         VLTI delay lines.

         Special Notes:  
            1. The result is a FITS imaging_data file in
            "pseudo-complex" format.  I.e.  it is in REAL format
            but each row is twice as long as the original data:
            each value is a (real, imaginary) pair.

            2.  The VLTI Delay values may contain large fictitious
            offsets of up to 1cm if the system was not correctly
            zeroed at setup.  To avoid applying these large
            fictitious offsets, the program determines the
            MODE of the tracking positions during the run and
            subtracts this before applying the OPD shift.  This
            modal value is printed by the program and also
            stored in the output header as "OPD0" in meters.

      Parameters:

      inFile:  name of the output from oirFormFringes

      outFile: output file name.  The format is a MIDI style FITS table 
        imaging_data file in pseudo-complex format.


   5.  oirGroupDelay         infile   outfile    -s gSmooth

      Purpose:
         Estimate the group delay for each measured spectrum.  The
         group delay is the peak of the Fourier Transform of the
         spectrum (thus in the delay domain, not the frequency
         domain).  Each spectrum is fourier transformed.  Note
         that because the MIDI beam-combiner has only two output
         phases it is essentially a cosine correlator and not
         a complex correlator.  This means that the group-delay
         has TWO peaks: at positive and negative delays.

         Because the actual OPD was modulated by the MIDI piezos
         and this modulation was deRotated in oirRotateInsOpd,
         one of the two peaks is nearly stationary from frame
         to frame (only atmospheric OPD movement remains) while
         the other peak moves around with TWICE the instrumental
         modulation.  Thus if we average a few frames together
         the wrong side band is strongly suppressed.  In this
         program a gaussian smoothing of sigma = gSmooth frames
         (default 4) used in this averaging.

      Parameters:
         
         infile: output of oirRotateInsOpd

         outFile: output file containing TWO interesting tables:
            1.  A pseudo-complex imaging_data table containing
            the raw FFTs of the input data

            2.  A DELAY table containing the value of the peak
            delay (after smoothing) of the above table at
            each frame.  This DELAY table has three columns:
            TIME (same as raw data), TELESCOPE (always 1,2)
            and DELAY (peak of group delay, with OPD0 added),
            in seconds (IAU standard).  Thus you have to
            multiply by the speed of light to get meters.


            3.  gSmooth if specified can change the smoothing
            in the frame domain before looking for a delay
            peak.  Default is gaussian sigma = 4 frames.
            Choose larger for weak sources in good weather,
            shorter for strong sources in bad weather.

   6.  oirRotateGroupDelay   infile   delayFile  outfile

      Purpose:
         Remove the group delay measured by oirGroupDelay as
         well as the instrumental OPD from fringe data
         (the output of oirFormFringes).  Same algorithm
         as specified in oirRotateInsOpd.

         Additionally estimate an offset PHASE for each
         frame and remove it.  This phase is primarily
         the result of water vapor dispersion (i.e.
         non-constant index of refraction).  Several
         spectra are averaged together to remove the
         beats from the off-side-band, then the
         phase offset is determined and removed.  The
         smoothing is a rolling gaussian filter with
         sigma = 6 pixels.

      Parameters:

        infile: output of oirFormFringes

        delayFile: output of oirGroupDelay

        outfile: output, in format identical with
           output of oirRotateInsOpd

   7.  oirAutoFlag           infile   delayFile  flagFile [deltaOpd] [jumpOpd] 
                             [nDrop]

      Purpose:
         Try to choose (automatically) which frames to include in the output
         visibility estimation:  This is currently NOT done on the basis of
         estimated amplitude since this biases the result.  The current
         criteria are:

           1.  OPD tracking distance from 0-point.  Experience shows significant
           attenuation of fringe (a few procent) for PRISM if this is larger 
           than about 150 microns.  So if ABS(instrumental OPD-group OPD) > 
           deltaOpd the frame is flagged.

           2.  Jumps in OPD.  There are some instrumental OPD jumps (due to
           telescope refocusing) where the fringe is presumably attenuated.
           If the 2nd difference in the group OPD is > jumpOpd the frame is
           flagged.

           3.  In addition, nDop points on either side of jumps are flagged.


         Output is written into a FLAG Fits table that specifies the flagged
            time intervals. 
      Parameters:

          inFile:    output of oirFormFringes (only used to read instrumental 
                     OPD)

          delayFile: output of oirGroupDelay

          flagFiile: name of file to contain FLAG tables

   8.  oirAverageVis         infile   flagFile   outFile

      Purpose:
          Average all unflagged but phase rotated frames together to arrive
          at a single (complex) visibility.

          Output is in IAU/ESO OI_VIS format FITS tables which is different
          from imaging_data.  These can be accessed with my IDL oirGetVis
          routine: data_array = oirGetVis(file, wave=wave) where
          wave contains the channel wavelengths in microns.  data_array
          is an array of structures containing (among other things)
          visamp and visphi  (amplitude and phase).

      Parameters:

         infile: output of oirRotateGroupDelay

         flagFile: output of oirAutoFlag (or manual flagging)

         outFile: name of OI_VIS file

   9.  oirChopPhotometry     "Afiles" "BFiles"   maskFile outFile [nDrop]

      Purpose:
         Reduce separate chopping photometry observations for use
         in normalizing visibilities.  An estimate of sky is made
         and removed from arrays.  They these are summed in the y-direction
         both with and without Masking (as described in oirCompressSpec).
         The mask should be IDENTICAL with the one specified there.

         Input are two separate (sets of) files containing raw chopping
         data for AOPEN and BOPEN shutter positions.

         Output is a imaging_data FITS table file with 12 rows, each row
         containing a single DATA1 array:

         1. Total Flux (ADU/s/channel) for AOPEN shutter position
         2. Total Flux (ADU/s/channel) for BOPEN shutter position
         3. Total Flux GeometricMean of A&B (i.e. of rows 1 and 2).
         4. Masked Flux (ADU/s/channel) for AOPEN shutter position
         5. Masked Flux (ADU/s/channel) for BOPEN shutter position
         6. Masked Flux GeometricMean of A&B (i.e. of rows 4 and 5).

         7-12 are the (poorly) estimated rms of the above quantities.

      Parameters:
         "AFiles"  black separated list of AOPEN chopped photometry files
         "BFiles"  black separated list of BOPEN chopped photometry files
         maskFile  mask as described in oirCompressSPec
         outFile   FITS imaging_data file containing output


   10.  oirRedCal             sourceTag 

      Purpose:
         This program is somewhat different in purpose than the previous.  It
         takes the output files from several of the previous steps, as
         applied to a calibrator and computes the instrumental visibility
         and spectrophotometric calibration.

         In this and the programs described below I use "tags" to identify
         all the files belonging to one observation set.  The full file
         names are tag.type.fits where type describes the file type 
         (see complete listing below).  Thus oirRedCal expects all
         input files to have this type of name.

         The output of oirRedCal is an OI_VIS table with 3 rows:

         1.  Instrumental visibility (amplitude and phase)
         2.  Spectrophotometric calibration (ADU/s/Jy)
         3.  "Strehl Ratio": not really, but the ratio of masked 
             counts/total counts per spectral channel.


      Parameters:

         sourceTag: the initial part of input file names, may also include a
            directory.  e.g.  hd10380   or /strw11/jaffe/ngc4151

            The type flags actually used are photometry (output of 
            oirChopPhotometry), and correlated flux (output of oirAverageVis), 
            thus the real file names would be hd10380.photometry.fits 
            and hd10380.corr.fits.

        output:  is not specified.  The output is written into a file named
           sourceTag.redcal.fits and contains the abovemention OI_VIS table.

  11.  oirSciPhotometry -data "inData" -ref refCoordDef -cross cross \
          -out outFile -mask outMaskFile [-ndrop nDrop] [-sigma sigmaY]

      Purpose:
         Measure source photometry from chopped data in non-interferometric
         SCI_PHOT channels.  Simultaneously determine the best "mask" for
         selecting photometric and interferometric data.

      Parameters:

         "data": blank-separated list of SCI_PHOT input data files

         refCoordDef: FITS file containing "imaging_detector" table specifying
            wavelength and curvature date for SCI_PHOT areas on detector
  
         cross: FITS file containing cross-coupling coefficients ("kappa-coefficients")
            between photometric and interferometric channels.  Produced by
            oirCrossCoeff

         outFile:  file name to receive photometry output.  In same format as
            output of oirChopPhotometry.

         outMaskFile: file name to receive calculated mask.  To be used as
            input to oirCompressSPData

         nDrop: (optional) as in oirCompressSPData, drop this many points
            after change of chopping state

         sigmaY: (optional) sigma (standard deviation) width of gaussian mask weights 
            in the Y-direction.  Defaults to 2.0

  12.  oirCalibrateVis       targetTag calTag [-sp spTag] [-calflux calFlux10] 
                             [-cald calDiameter] [-noPoint]

      Purpose:
         Combine reductions of a target and calibrator observations to produce
         calibrated visibilities and plots.  The output is two FITS table files.

         1.  An OI_VIS table file: targetTag.calvis.fits containing one
             row per input row in the file targetTag.corr.fits
             This contains calibrated visamp and visphi.

         2.  An imaging_data file: targetTag.calphot.fits containing two
             rows:  
               1. calibrated photometry (Jy) under mask
               2. calibrated photometry (Jy) total


      Parameters:

         targetTag: descriptor for science target.  The types actually
            used are .photometry and .corr

         calTag: descriptor for calibrator.  The type actually used
            is .redcal

         output is as described above: targetTag.calvis and .calphot

         -sp spTag :  if specified use this calibrator tag to define
            a spectrophotometric calibrator different from the visibility
            calibrator.  Use this if the flux/spectrum of the visibility
            calibrator are unknown are inappropriate for photometric
            calibration.

         -calflux calFlux10: specify the flux of the calibrator used
            for flux calibration in Jansky at 10 microns.  A Rayleigh-
            Jeans spectrum is assumed.  If not specified 1 Jy is used.

         -cald calDiameter: visibility calibrator diameter in milliarcsec.
            If not specified 0.0 mas is used.

         -noPoint:  Do not assume that the target is unresolved by the
            single telescope PSF.  The effect is that correlated
            fluxes are computed as: visibility*(flux under mask) instead
            of visibility * (total flux in window)

 13. oirCrossCoeff "Afiles" "Bfiles" coordFile outFile nDrop

     Purpose: calculate cross-coupling coefficients (kappa coefficients)
       for SCI_PHOT mode data

     Parameters:
        "Afiles"  blank-separated string of input files of a star
           taking in chopping photometry mode with the B-shutter closed
        
        "Bfiles"  blank-separated string of input files of a star
           taking in chopping photometry mode with the A-shutter closed
       
        coordFile: FITS file containing "imaging_detector" table specifying
           distortions and wavelength information for this SCI_PHOT detector
           mode.

        outFile: output file name.  Used by oirSciPhotometry.

        nDrop:  see oirCompressSPData or oirSciPhotometry



V. tcsh scripts that call the oir routines in an orderly fashion using the
   "tag"."type" fields to communicate file names:

   
   1.  dispVis     "infiles"  maskFile  outTag [fringeSmooth] [delaySmooth]

      Performs in sequence:

         oir1dCompressData+oirFormFringes+oirRotateInsOpd+oirGroupDelay+
            oirRotateGroupDelay+ oirAutoFlag+oirAverageVis

      Parameters:  
         "infiles"  blank separated list of interferometric files
         maskFile   as described in oirCompressSpec
         outTag     first component of file names to use for output; 
                    may include directory path
         fringeSmooth  high pass filter width used in oirFormFringes 
                       (c.f. above)
         delaySmooth   smoothing gaussian width used in oirGroupDelay 
                       (c.f. above)

   2.  dispPhot    "AFiles"  "Bfiles"   maskFile  outTag

      Performs oirChopPhotometry using outTag to identify output file

      Parameters:
        see oirChopPhotometry except that outTag is only the first component
        of output file name

   3.  dispVisPhot 
  
       Combines dispVis and dispPhot
  
     Parameters:

   "inFiles" "AFiles"  "BFiles"   maskfile outTag


   4.  dispVisSP "inFiles" refCoordFile crossFile outTag \
          [-ndrop nDrop] [-smooth fringeSmooth] [-gsmooth delaySmooth] \
          [-sigmaY sigmaY]

      Performs in sequence:

         oirSciPhotometry+oirCompressSPData+oirFormFringes+oirRotateInsOpd+oirGroupDelay+
            oirRotateGroupDelay+ oirAutoFlag+oirAverageVis

         to reduce SCI_PHOT mode data.

      Parameters:  
         "infiles"    blank separated list of interferometric files
         refCoordFile file containing "imaging_detector" table with
            optical distortion information

         crossFile    file containing kappa coefficients

         outTag        first component of file names to use for output; 
                       may include directory path

         fringeSmooth  high pass filter width used in oirFormFringes 
                       (defaults to 50)

         delaySmooth   smoothing gaussian width used in oirGroupDelay 
                       (defaults to 6.0)

         sigmaY        s.d. width in y-direction of mask function
                       (defaults to 2.0)

VI.  IDL procedures that call the above programs:

    1. midiPipe, tag [,files=filelist]  [,mask=maskfile] [,smooth=sm] 
                 [,gsmooth=gsm]

    Purpose:

    run dispVisPhot and oirRedCal on 3 files specifying interferometric and
       photometric raw data. 

    Parameters:

      tag:  output tag to identify files to dispVisPhot

      files (optional) a string array of 3 input file names, each of which 
         may be a blank-separated list of files.

         If files is not specified, the GORGONZOLA GUI will come up to allow
         manual specification of files

      mask (optional):  mask file name.  If not specified a default 
         depending on the instrumental setup.  For old prism high_sens
         files (before Dec 2003) use: mask=getenv('prismomask')


      smooth:Delay high-pass smoothing width to supress background 
         fluctuations.  Default is 50 but use a smaller value if 
         your source is very weak.

      gsmooth: group delay estimation averageing half-width (frames).  Default
         is 4 but use larger value for weak sources during stable atmospher,
         smaller for strong sources during rapid OPD changes.  For weak
         sources during rapid OPD changes, give up.

   2.  midiSPipe, tag, files [,smooth=smooth] [,gsmooth=gsmooth] $
          [,coord=coord] [,cross=cross] [,ndrop=ndrop] [,sigmay=sigmay]


       Purpose: run dispVisSP to reduce SCI_PHOT data

       Parameters: as in midiPipe with the addition of:

          coord: file containing distortion/wavelength information
             for individual MIDI channels, not yet included automatically
             with data from Paranal.  Defaults to either of :
                $drsRoot/software/minrts/config/mioSetup_FIELD_PRISM_SCI_PHOT_SLIT.tmp
                $drsRoot/software/minrts/config/mioSetup_SPECTRAL_GRISM_SCI_PHOT_SLIT.tmp

          cross: file containing kappa/cross-coupling coefficients.
             defaults to one of:

             $drsRoot/software/minrts/config/mioKappa_FIELD_PRISM_SCI_PHOT.fits
             $drsRoot/software/minrts/config/mioKappa_SPECTRAL_GRISM_SCI_PHOT.fits

   3.  midiCalibrate sourceTag calTag

       Purpose:
          run oirCalibrateVis  with specified parameters.  In addition a whole
          bunch of plots is produced in a file named sourceTag.ps.




VII. File Selection GUI: Gorgonzola 
   EWS includes a data selection GUI, somewhat like GASGANO.
   To browse your raw data, and select some of it type:

   FileList = midiGui()

   There are alternate versions described below.
   There is a faster version that caches the contents of the file
   headers on disk, but it only works if you have write permission
   on the data disks:

   FileList = midiGuis()

   Note that IDL is indifferent to upper/lower case letters in commands
   and variable names (but not indifferent to case in FileNames)

   It brings up a GUI and returns a list of files selected.

*******************************************************************
USING THE GUI.

The gui is pretty spartan.  Up at the top there are 10 buttons that
let you select files, modify the display a bit, and quit.

Below this there is a scrollable area that shows information on
each of the available files and on the left
a column of ASTERISKs (*) showing which files are currently selected,
or blanks if they are not.  Initially files are brought up all un-selected.

In the next column you see the file name.  
NOTE: Due to ESO limitations on file lengths, MIDI files cannot be 
longer than 100 MB or so, while a single observations may generate
Gigabytes of data.  The on-line data system breaks the data up
into 100 MB files.  Gorgonzola recognizes this process, and the
displayed file name is only the FIRST file of all the files that
constitute an observation.  When Gorgonzola returns, all the sub-files
for an observations are concatenated into a single character string
with spaces between the file names.  Most of the EWS programs can
recognize such a string and process the files sequentially.  
NOTE further, however, that if you use such a string to call a
C-program directly (e.g. oir1dCompressData), you have to enclose
the concatenated string in double quotes "...".

The other columns show keyword values for each observations, gleaned from
the file primary FITS headers.


WHAT YOU CAN DO IN THE LOWER scrollable AREA with all the keyword data:

Two things:  

1. If you click on the leftmost raised button you 
can manually select or deselect single files.

2. If you click on one of the data cells that show
   keyword values, that value is "caught" and displayed
   up on the top; both its keyword and its value.
   The "caught" values can be used for massive selection
   and de-selection as described under BOOLEAN buttons below.

WHAT THE TOP BUTTONS DO:

We start with the easy ones:
QUIT     causes the GUI to leave without making a selection
SELECT   causes the GUI to leave and returns the selected files

UP/DOWN  IDL and X-windows crash if thousands of widgets are put
	 on the screen, so I have limited the display to 100 rows.
	 If the rows you want to see are outside this range you
	 can push UP or DOWN to scroll.  NOTE that the scroll bar
	 on the right only allows scrolling within the 100 displayed
	 rows.

HIDE     Remove all currently unselected rows from the display.  This
	 can considerably simplify things if you've already de-selected
	 a lot of files.
SHOW     Reverse of HIDE: show all files, selected or not.  This gives
	 you the opportunity to selectively re-select unselected files.
         Sometimes the first few non-selected files are not displayed
         after hitting the SHOW button.  Try clicking the UP button.

         To the right of this row the current HIDE/SHOW mode is displayed

Then the real meat: the BOOLEAN buttons.
These are not strictly boolean but sort of.
When you click one of them, the "caught" value
is compared to all other values in the same column
and the currently list of selected files is modified:

In the second row down on the GUI are six comparison operators:

=        Equal
!=       Not Equal
>        Greater than
<        Less than
<=       Greater than or equal
>        Less than or equal

To the right of this row the currently selected comparison is shown.

In the third row two combination operators:

AND      The results of the comparison are
         logically ANDed with the current selection

OR       The results of the comparison are
         logicall ORed with the current selection


Confused?  It actually works fairly intuitively.

Suppose you have made a hundred or so exposures during a day, and
suppose you are looking for a group of exposures with the PRISM
in HIGH_SENS mode.  The fifth column of selction buttons is labelled
"INSGRIS" (shortend from INS GRIS NAME).  Look down this column, with
the slider if necessary until you find a button with PRISM displayed.
Click on this and the words INGRIS and PRISM should appear below the
AND/OR buttons to indicate your selection.  Now click on the OR
button.  All observations with GRIS=PRISM are ORed with the
initial selection (i.e. nothing), and asterisks should appear in
the left hand column of all PRISM observations.

Now click on HIDE and all non-PRISM observations should disappear.

Now go down the INSOPT1 column and find an observations with
OPT1=HIGH_SENS.  Click on this, and then on AND.  This will
AND the set of HIGH_SENS observations with the current PRISM selection
and any SCI_PHOT or OPEN observations should disappear.  You
can continue by selecting on OBSTARG (target name as given by
the observer) or NRTSMODE (what the online program thought it
was doing), or FILTER or SHUTTER position.  

Using the other relational buttons, you can also select by time, because
the file names are ordered by time.
For example you can click on the file name of first observation you want, then
click on the >= button and then on AND.  All the earlier files will be
deselected.  Then you can click on the last observation, the <= button
and AND, and the later observations will disappear.

When you have made the selection you want, click on SELECT.

At the top right the total number of files in the list,
and the total number currently selected, are displayed.



COMMON PITFALLS:

If you click on a data item and then click HIDE, not much
will happen (except that previously de-selected rows may
disappear). You first have to press on of the boolean
buttons to make something change.

******************************************************************
ALTERNATIVE calling sequences:

files = midiGuiS()
   Look for a file in the search directory called midiGui.SAV, and
   if you find it, assume that it contains the keyword values for
   all the MIDI files in this directory.  This speeds things up
   a lot.  If you don't find it, parse all the headers and store
   the summary in the abovenamed file upon exit.  This will
   crash if you don't have write privliges.

   If you can added/deleted files in the directory, so that the
   cached version is not up to date, just delete it and
   try midiGuiS again.

files = midiGui(dir=datadir) or midiGuiS(dir=datadir)
   gorgonzola assumes that idl is running in the directory
   where the data is.  If this is not the case you can
   use the above forms to specify a different data directory.
   You can also use the IDL utility pushd:

   pushd, datadir
   files = midigui()
   popd



******************************************************************


VIII.  Standard file names and types, and lower level access programs

   The following standard file types are produced by the specified programs.  
      Some notes indicate how to access the contents of the programs:

Some of the lower level programs to access this data are described below
   but almost all are listed here:

      oirGetData(dataFileName [,rows] [,col=col],[ierr=ierr])
         Get raw or semi-reduced detector data
      oirGetVis(visFileName [,wave=wave])
         Get reduced visibility data and wavelength information
      oirGetDelay(groupDelayFileName)
         Get estimated group delay for each reduced frame
      oirGetOpd(fileName)
         From raw or partially reduced data get piezo+VLTI delay
         line OPD position
      oirGetMeanRMS(inputfile)
         Take pixel by pixel mean and rms of all frames in an observation
      oirGetDetector(fileName)
         Get data from IMAGING_DETECTOR table, specifying detector layout
      oirGetWaveNo(detectorFile, region)
         Get wavenumbers (here defined as 2*!pi/lambda(micron)) for
         each pixel in specified detector region (1-relative)
      midChopImage (datafile)
         Return 2-row structure with mean of Target- mean of Sky 
         detector images in first row, and mean of Sky in 2nd row.

File types:

   .compressed
      Produced by oirCompressSpec, contains a header, an imaging_detector table 
      and a floating point imaging_data table.  The last has a 1-dimensional 
      DATAn array for each input frame for each detector window.  
      
      This can be accessed with oirGetData(dataFileName).  
      dataArray = oirGetData(dataFileName)  
      
      oirGetData works on raw and partially reduced detector data.
      It returns an array of structures.  Each structure corresponds to
      one data frame, and corresponds to ESO FITS interferometry
      data tables.  Each row of the table contains information on
      the time of exposure (MJD days), exposure time (sec), OPD positions,
      chopping mirror positions, and finally the data itself.

      dataArray[15].time contains the MJD time of the 16th frame
      (IDL is 0-relative). 
      dataArray.data1 is in general a 3-dimensional data cube, where
      each plane represents the detector data from the 1st specified
      detector region, and the 3rd dimension is frame number.

      The data arrays are INT for raw data and FLOAT for partially
      reduced data.  Note that the raw data (16-bit integers) is
      offset by -32768 from the true detector zero values.



   .fringes
      Produced by oirFormFringes, contains a header, an imaging_detector table 
      and a imaging_data table with a single DATA1 array for each input frame.
         
      This can be accessed with 
         table = oirGetData(dataFileName)
         data = table.data1

   .insopd
      Produced by oirRotateInsOpd. Contains a header and imaging_detector table,
      and a pseudo-complex imaging_data table with a single DATA1 array per row.
      Header contains keyword OPD0 describing offset subtracted from all
      OPDs before rotation (=mode of tracking OPDs).
         
      This can be accessed with 
         table = oirGetData(dataFileName).
         data  = pseudocomplex(table.data1)

         data is them COMPLEX(nFrames, nFreq)

   .groupdelay
      Produced by oirGroupDelay.  Contains a header and imaging_detector table,
      and a pseudo-complex imaging_data table with the FFT of .insopd.  The
      header contains some special keywords:

      OPD0:  as in .insopd
      OPD1,OPD2: coordinates of delay direction in output FFT.  The delays
        = OPD1 + OPD2*(xpix-1).

      This table can be accessed with oirGetData(dataFileName).  The
      data section can be accessed using a call to pseudoComplex.  
      E.g.  
         gd = oirGetData('mydata.groupdelay.fits')
         gdc = pseudocomplex(gd.data1)

         gdc is COMPLEX(nFrames, 512), with the y-axis representing
         delay.

      Additionally there is a 3rd table DELAY containing (per frame) the
      time (MJD days), telescope numbers and estimated OPD (seconds).  This
      can be accessed with oirGetDelay(fileName)

   .ungroupdelay
      Produced by oirRotateGroupDelay.  Contains the usual header and 
      detector tables and a imaging_data table in pseudo-complex format.  
      Can be accessed with 
         ugd = oirGetData(filename) 
         ugdc = pseudocomplex(ugd.data1)  which is COMPLEX(nFrame, nFreq)

      Additionally there is a 3rd table DISPERSION containing (per frame)
      the value of the average phase subtracted from each row.  The
      table has three columns "TIME" "TELESCOPE" and "DISPERSION", which
      for the purpose at hand, is the subtracted mean phase in degrees.

      This is accessed by the generic fitstable routines:
         t = obj_new('fitstable', filename, extname='DISPERSION')
         dispData = t->readrows()
         obj_destroy,t

   .flag
      Produced by oirAutoFlag.  Contains a header and a FLAG table with the
      time intervals that have been flagged.  There is no oirGetFlag routine.
      You can use:  
         t = obj_new('fitstable', filename, extname='FLAG')
         flagData = t->readrows()
         obj_destroy,t

   .corr
      Produced by oirAverageVis.  Contains a header, an OI_WAVELENGTH table 
      specifying the wavelength for each channel, and an OI_VIS table 
      containing averaged correlated fluxes.

      Can be accessed with 
         visTable = oirGetVis(filename, wave=wave)  with wave optional

         visTable.visamp is an array of (nWave) correlated fluxes (Jy)
         visTable.visphi is an array of (nWave) differential phases (degree)
         visTable.visamperr contains the estimated rms of visamp
         visTable.visphierr contains the estimated rms of visphi

         wave contains nWave values of the wavelength (microns)

   .photometry
      Produced by oirChopPhotometry.  Header, detector tables, and 
      imaging_data table in float format

      Can be accessed with photData = oirGetData(filename)

      photData[0].data1 contains the photometry data for telescope A
      photData[1].data1 contains the photometry data for telescope B
        and so forth (see heading oirChopPhotometry above)

   .redcal
      Produced by oirRedCal.  Header, OI_WAVELENGTH and OI_VIS tables
      Can be accessed with oirGetVis(filename, wave=wave)

   .calphot
      Produced by oirCalibrateVis.  Header, detector, imaging_data table
      Can be accessed with oirGetData(filename)

   .calvis
      Produced by oirCalibrateVis.  Header, detector, imaging_data table
      Can be accessed with oirGetVis(filename, wave=wave)