REDUCE POLAR Command List

last updated 04/06/1993 by K. Nordsieck



To enter the POLAR REDUCE module, type "POLAR".  Commands available
from POLAR are: 


I) Halfwave Polarimetry

HCAL < calname > 
  Loads halfwave polarimetric calibration file "calname.hcal", 
  including halfwave filter positions, filter efficiency vs wavelength, 
  PA calibration, and telescope and spectrograph instrumental 
  polarization.  Once this file is loaded, you never need to reload 
  it, even after exitting POLAR or REDUCE (as long as you don't
  restart REDUCE).  The hcal file name you are using is placed in 
  the DISK2 header of each new polarimetric scan on line 10.  It
  is also written on the right of each polarimetric plot.  EG:

  HCAL pbo2c3


HRECAL < calname > < qscan > < qscan > ... 
  Recalibrates q,u,err scans with a new halfwave polarimetric calibration 
  file.  "calname.hcal" is the name of the new calibration file.  For each
  q,u,err set named in the list, the calibration listed in the
  header is removed, the new one applied, and a new q,u,err set
  is created on DISK2 (with the calibration field updated).  At the
  end the new calibration file is loaded for later reductions.  
  HRECAL will properly update old reductions whenever the calibration 
  is updated with a new instrumental polarization or position angle 
  zero-point.  It does not work if the calibration update changes 
  the polarimetric efficiency model or makes use of a new "wing" 
  correction.  EG:

  HRECAL pbo2c3 1 4 7


A LOW-LEVEL COMMAND WHICH YOU PROBABLY WON'T NEED IS: 

HPOL ( residual save ) < scan list > 
  Calculates polarization from ADDPOL spectra taken through 
  different halfwave filter positions.  Scan list should contain one 
  (and only one) DISK2 spectrum of at least two filter pairs (all 
  four advised) in both arrays.  EG, one complete filter pair 
  contains filter 0/ Array A, filter 0/Array B, filter 4/Array A, 
  and filter 4/Array B, so 16 scans are required for a complete list. 
  Scans may be in any order.  These scans should NOT be normalized or 
  fluxed, but they SHOULD be scrunched.  A "Q" spectrum, "U" spectrum, 
  and Error spectrum are put in DISK2.  If the optional "residual" is
  present, the residual from the fit for each filter pair is also
  saved.  If the optional "save" is present, the scans in the scan
  list are not overwritten (to be avoided, as it clutters up disk2).
  E.G:

  HPOL 65 -80

  reduces the 16 ADDPOLed, SCRUNCHed DISK2 scans, and stores the
  resulting Q, U, Err triplet in disk2 slots 65 -67.  The original
  disk2 scans are lost (since the "save" option was not invoked).


USE THIS HIGH-LEVEL COMMAND: 

HRED ( resi save ) < s1 list > ; < s2 list > ; < s3 list > ; < s4 list > 
  Performs a "script" which does ADDPOL, SCRUNCH, and HPOL starting
  from disk1 raw scans.  < s1 list > lists the scans for one filter
  pair, etc.  No intermediate scans are normally saved.  HPOL options 
  apply.  The NORM and FLUX flags should be OFF for ADDPOL, but there 
  should be an applicable wavelength calibration for SCRUNCH.
  E.G:

  HRED 5 -12 ; 13 -20 ; 21 -28 ; 29 -36

  performs the reductions for the 32 disk1 scans produced by a 
  standard "4 DOPOL" run, and stores the resulting Q,U,Err spectrum
  triplet in the next three DISK2 positions.  A better procedure
  would be

  HRED  5  -9 ; 13 -16 ; 21 -24 ; 29 -32
  HRED 10 -12 ; 17 -20 ; 24 -28 ; 33 -36
  HCOMB < qscan1 > < qscan2 >

  which reduces the first four and second four of each filter pair
  separately, and combines the results see HCOMB below).  This 
  minimizes spikes due to cosmic ray and detector ion events.


HROT < qscan > 
  Saves a new Q, U, and Error spectrum, with coordinate system rotated
  by an input number of degrees ( Asks "Please enter degrees to rotate" ).  
  "QSCAN" is assumed to be the first of a Q,U, Error spectrum triplet.
  EG, if the mean PA for the original data starting in "qscan" is 54 
  degrees, entering  " -54 " will cause a new Q, U, Error triplet to be
  saved, with the polarization at PA 54 rotated into the q spectrum.
  E.G:

  HROT 100


HCOMB < qscan1 > < qscan2 > ... 
  Combines the Q, U, ERR spectrum triplets starting in Qscan1, Qscan2,
  etc, using a pixel-by-pixel error-weighted mean, and produces a new 
  Q, U, and ERR spectrum.  Scans are registered in wavelength to qscan1, 
  and the qscan1 header is used as a header model.  EG:

  HCOMB 2 5 8 11

  Might produce a new Q, U, ERR set combining four independent sets 
  from four HRED results in a single night or for four different nights.
  See HADD below for situations where HADD should be used instead.


HADD < qscan1 > < qscan2 > ... 
  Do vector addition of halfwave pol scans.  Asks:

  Please enter weight for each scan (default=1)

  For each pol scan, the program takes one number from the weight
  line to weight the entire scan; if none is found, it uses a weight of 1.  
  The scans are registered in wavelength to qscan1, and the qscan1 header 
  is used as a header model.  EG, to obtain the vector mean of two pol 
  scans:

  HADD 2 5
  Please enter weight for each scan (default=1)
  0.5 0.5

  This might produce an unweighted vector mean of the polarization of a 
  star at two epochs.  A vector difference is produced by using weights of
  1.0 and -1.0.  It is advised to use a weighted vector mean instead
  of an HCOMBINE to combine scans where the polarization is very
  different (the mean polarization differs by more than the error
  in a single pixel).  Otherwise the pixel-by-pixel weighting in
  HCOMBINE could introduce error into the result.


HPRINT < qscan1 qscan2 ... > 
  Prints out Q, U, Err, Pol, and PA between limits entered in
  WSCALE and PSCALE.  If data is binned, or if there are fewer than
  60 unbinned pixels between the limits, the data for each pixel or 
  bin are printed out.  Otherwise, only the mean for the whole 
  scan is printed out.


HSCOP(OVER),HPLOT(OVER) < qscan > < q,u,p,t, or qu > (e,b) 
  Plots halfwave polarimetry results, with optional halfwave
  error-dependent binning.  "qSCAN" is the first scan of a Q, U, and ERR
  spectrum triplet.  One of the plot types  q, u, p (polarization), 
  t (position angle), or "qu" (U vs Q) must be present.  Optional "b" 
  indicates halfwave data is to be binned; "e" then also causes 
  the error bars to be plotted.  If binning is requested, the program 
  requests "Bin (% Err),  Save (Y/N), and Protected Wavelengths".  
  Data will be binned until the binned error is less than "BIN" %.  
  If "Save" is requested, the binned Q, U, and ERR spectra will also 
  be saved; these can be used subsequently in plots without re-
  entering the binning parameters each time.  The binning value 
  will be put in the DISK2 header and printed on the right 
  on polarization plots.  Any wavelengths or 
  wavelength ranges (stated as "lam1 -lam2") requested to be 
  "protected" will be exempted from binning.  If PEN is "DOWN",
  the points will be connected.  For QU plots, a circle/cross 
  symbol will be plotted at the origin of Q and U, if it is on the 
  plot.  Users units for scaling are percent for q, u, p, and qu;
  and degrees for t.  For "QU" plots the "Q" axis is scaled by the 
  command XSCALE and the "U" axis by YSCALE, and the plotting
  symbol is controlled by the SYMBOL command described below.  
  Auto-scaling functions in all modes.

  E.G:

  HSCOP 118 p e b
  (BIN = 0.1, SAVE = Y, Protect = 3640 -3660)

  Assuming 118, 119, and 120 are unbinned Q, U, and ERR spectra, this
  makes a terminal plot of polarization with error bars, binned to 0.1 
  percent, with the Balmer Jump protected from binning, and saves binned 
  versions of this data in the next three DISK2 slots.  Subsequent HSCOP's
  with these new scans will not require the "b" option and parameters.


SYMBOL < symbol > ( wavelength symbol wavelength symbol . . . )
  Requests alernate symbols for QU plots:
  symbol = 0 (or blank): default filled circle.
  symbol = -1 to -50: symbols 1 -50 from the plot package symbol font.
    Not all of these symbols are useful (see Marilyn for the full list).
    I find the following ones best: 
      1, 41, 18, 2, 15 give an open diamond, square, circle, triangle, 
	and upside-down triangle.
      12, 16, 17, 21, 20 give "hatched" versions of the above.
      45, 46, and 47 give large cross, x, and asterisk.
  symbol = any single character (except 0).  Plots that character -
    anything you can enter from your keyboard (upper or lower case).
  The optional "wavelength"  parameter allows wavelength-dependent
    symbols.  The wavelengths must be in ascending order, and the
    symbol entered is used between the wavelengths as entered on
    the command line.
  NOTES: No matter what symbol is used, the bluest point will be 
    plotted double-size.  The symbol command line is not retained
    between REDUCE sessions - it reverts to default when you exit.

  EXAMPLES:

  symbol 1             [ plots the character "1" ]
  symbol -1            [ plots an open diamond ]
  symbol a             [ plots a lower-case "a" ]
  symbol 3 4000 4 5000 5 6000 6 7000 7
		       [ plots the thousands digit of the wavelength ]
  symbol               [ reverts to default filled point ]


XYLOG <0,1> <0,1>
  Requests linear (0) or log (1) scales for X and Y axes, respectively.
  (Except for QU plots, which are linear only).  Default is linear/
  linear.  For log plotting, all values between the minimum and
  maximum values must be positive, or an error message is generated.


REMARK, ENDPL, PSCALE, WSCALE, YSCALE, CAPTION, PEN UP, PEN DOWN  
  Work as in the mainline REDUCE.


II) Lyot Polarimetry 

DIFFSUM < scan1 > < scan2 > 
  Puts ( s1 - s2 ) / ( s1 + s2 ) in next available DISK2 slot.  Scans
    are registered first if scrunched.


LCAL < calname >
  Loads Lyot polarimetric calibration file "calname.lcal", 
  including Lyot filter constants, modulation efficiency and wavelength
  shift, PA calibration, and telescope instrumental polarization.  
  This file needs to be reloaded every time you start REDUCE and every 
  time you go to a different filter/aperture configuration.  However, 
  lcal and hcal calibrations are stored separately, so a calibration 
  may be loaded for each mode simultaneously.  The lcal file name you 
  are using is placed in the DISK2 header of each new polarimetric scan 
  on line 10.  It is also written on the right of each polarimetric 
  plot.  Lcal files are conventionally named (prefix)(filter)_(aper).
  v2_4.lcal is the WUPPE VCF calibration for filter 4, aperture 2.  EG:

  LCAL v2_4  
  

LRECAL < calname > < vscan > < vscan > ... 
  Recalibrates v,q,u,err scans with a new Lyot polarimetric calibration 
  file.  "calname.lcal" is the name of the new calibration file.  For each
  v,q,u,err set named in the list, the calibration listed in the
  header is removed, the new one applied, and a new v,q,u,err set
  is created on DISK2 (with the calibration field updated).  At the
  end the new calibration file is loaded for later reductions.  
  LRECAL will properly update old reductions whenever the calibration 
  is updated with a new instrumental polarization or position angle 
  zero-point.  It does not work if the calibration update changes 
  the polarimetric efficiency model or makes use of a new "wing" 
  correction.  EG:

  LRECAL w2_st  1 4 7


LPOL ( resi ) < diffsum sum > 
  Calculates Lyot v,q,u,err scan quartet for normed, scrunched Lyot
  diffsum.  An unnormed, scrunched spectrum sum is also required to
  compute CHISQ for the result.  Uses the currently loaded lcal 
  file; if the filter number in the header of the diffsum scan 
  disagrees with the lcal file, the operation is aborted.  The data
  is stored in binned format, with the bin edges determined by the
  calibration.  The results go in the next four DISK2 slots, and
  a summary printout is given.  In Lyot data, the error in Q and in
  U and V differ by a factor of 1.41: this factor is stored in the 
  header as "ERFAC" on line 11.  If the optional "resi" is given, a 
  residual of the diffsum from the computed "fringe" pattern for this 
  data is stored in the next DISK2 slot; it is not stored by wavelength, 
  but equally spaced in retardation, with 16 pixels per Q fringe for
  this filter.


The following "H" commands described above also work with Lyot data,
  with the "qscan" number replaced by the "vscan" number - that is,
  always name the first scan number in the polarization set:

HROT  
  Same function.  A new v,q,u,err set is stored, but the V scan is
  of course unaffected by the rotation.  "ERFAC" is updated accordingly.

HCOMB < vscan1 > < vscan2 > ... 
  Combines Lyot data reduced with the same lcal only.

HADD < vscan1 > < vscan2 > ... 
  Adds Lyot data reduced with the same lcal only.

HPRINT < vscan1 vscan2 ... > 
  Prints out binned V, Q, U, Err, Pol, and PA between WSCALE and PSCALE
  limits.

HSCOP(OVER) HPLOT(OVER) < vscan >  < v,q,u,p,t, or qu > (e) 
  Works like in the halfwave case, except 1) the additional "v"
  option is available, and 2) the data is already binned.

SYMBOL, XYLOG, ENDPL, PSCALE, WSCALE, YSCALE, CAPTION, PEN UP/DOWN 
  Work as above.


III) POLARIZATION ANALYSIS COMMANDS  


PMAKE < qscan or vscan > 
  Import filter polarimetry or spectropolarimetry from other 
    observatories into REDUCE.
  Reads in an ascii mongo-like file containing wavelength,bin,q,u,err,
    ("halfwave" mode) or wavelength,bin,v,q,u,err ("lyot" mode).
  Uses header (with name, wavecal, and scan type) from listed qscan or 
    vscan as a model for the header of the new scans.
  Asks: 'PLEASE ENTER INPUT FILENAME'.  The file must be in the current
    working directory.

  The input file must have the following columns:
    Wave Dwave %q %u %err        if using qscan or  
    Wave Dwave %v %q %u %err     if using vscan

    If Dwave=0 (it cannot be blank), the data is assumed to be continuous 
      and in order of increasing wavelength (e.g., spectropolarimetric 
      data).  It is interpolated into pixels defined by the wavecal in the
      header, and the error is adjusted to the new pixel width.
    IF Dwave>0, bins are created centered on the effective wavelength 
      "Wave", with total width "Dwave" (e.g., filter data).
      These bins should be non-overlapping. 
    All wavelengths are in Angstroms.

    Sample filter files for UBVRI, and for JHKL data are:

     ! Visible filter polarimetry for HD62542
     !
     ! Wav Dwav   %q     %u     %err  comment (anything out
      3790  680  0.673  0.919  0.020   U   here is OK)
      4410  980  0.708  1.087  0.022   B
      5610  890  0.878  1.087  0.022   V
      6680 1000  0.839  1.096  0.017   R
      7920 1000  0.816  0.998  0.023   I

     ! Infrared filter polarimetry for HD197770
     !
     ! Wav   Dwav    %q      %u    %err  comment
      12500  3800  -0.248  -1.763  0.07   J
      16000  4400  -0.138  -0.980  0.04   H
      22000  4800   0.007  -0.550  0.03   K (2 Obs)
      36000  7000  -0.201  -0.298  0.30   L
     
    The UBVRI filter data is compatible with the wavecal in the header
      of any scrunched PBO-2 halfwave spectropolarimetry scan, 
      covering 3000-9000 Angstroms.  
    The model header for the JHKL data would have to be edited to values
      in the IR, for instance C(1) = 30000, C(2) = 50 Angstroms,
      which covers 0.5-5.5 microns.


The following commands work for both unbinned halfwave data and binned
  halfwave, Lyot, or filter data; 
  

ISREMOVE  < ps1 -ps2 ... > 
  Removes Serkowski-law interstellar polarization from
    polarization scans in list ("ps" = qscan for halfwave 
    polarimetry) and stores results as new scans of same type in 
    DISK2.  For each resulting "intrinsic polarization", prints mean 
    intrinsic pol and Chisq of fit to constant intrinsic PA.

  At beginning, asks 
  'PLEASE ENTER PA(deg) Pmax(%) Wmax(ang) DPA(deg) K(bl=WLR)'

  DPA is an optional PA rotation with wavelength.  If it is specified, 

       PA(lam) = PA + DPA*((1 micron)/lam - (1 micron)/Wmax)

    so that the specified "PA" is the value at Wmax and DPA is the slope
    in deg/(inverse microns).

  If K is blank, use WLR formula relating K to Wmax.  
  
  The same interstellar polarization is removed from all the polarization 
    scans in the list.

  EXAMPLE. Scan 3 -5 contains Q,U,E for Phi Cas, a pol standard:

  isrem 3                                                                         
    Please Enter:
     PA(deg) Pmax(%) Wmax(ang) DPA(deg) K(def=WLR)
      93      3.4     4700 

     Residual Polarization for Scan     3

       Wav1    Wav2      % Q     % U    % Err   % Pol     PA 

      3099.0  7797.0    -0.066   0.100   0.009   0.119   61.68

     Chisq par  to  IS   Pol =      2.4
     Chisq resi to  Intr Pol =      2.4
     Best fit PA of Intr Pol =     51.3

     Q         TO DISK2 POSITION   21
     U         TO DISK2 POSITION   22
     ERROR     TO DISK2 POSITION   23


ISFIT < ps1 ps2 ... > 
  Perform fit of Serkowski Interstellar polarization simultaneously to 
    scans in polarization scan list.

  Asks 'PLEASE ENTER:
    'ISM    PA(deg) Pmax(%) Wmax(ang) DPA(deg) K(bl=WLR)'
    'Vary?  DPA/0   DPM/0   DWM/0     DDPA/0   DK/0=WLR'

  The fit is performed by searching for the minimum CHISQ residual
    as a function of the ISREM parameters.  In the first line enter
    your first guess for PA, Pmax, and Wmax, and (optionally) DPA and K.
    If K is not given, it will be varied per the WLR relation,
    which ties it to Wmax: this is advised for all PBO data.
    On the second line, give a step size to vary these parameters.
    It is best to give a step size which is AT LEAST TWICE the
    ultimate error in the parameter: otherwise, the search may end
    too soon and give unrealistically small error estimates.

  Note that the program requires TWO LINES of input before it will
    proceed.

  The minimized fit parameter is the sum of chisq of the residual Q and U 
    after removal of the ISM.  The fit is done in three passes, a major
    search, a check search around the result of the first pass, and an
    error estimate search.  Iteration details are printed out at terminal
    level 4 and printer level 5.

  EXAMPLE: ISM fit to Phi Cas polarimetry.  An hprint is done first
    to get a good first guess:

    hprint 3                                                                        
   
          Wav1    Wav2      % Q     % U    % Err   % Pol     PA 
   
         3099.0  7797.0    -3.344  -0.245   0.009   3.353   92.09
   
    isfit 3

      PLEASE ENTER:
      ISM    PA(deg) Pmax(%) Wmax(ang) DPA(deg) K(bl=WLR)
      Vary?  DPA/0   DPM/0   DWM/0     DDPA/0   DK/0=WLR
	     92      3.4     5000      0
	      1      0.1      200      1

    [ Progress of fit iteration: takes about 1 sec/iteration.  15-25
      iterations for Pmax,Wmax fit (try this first).  25 -50 iterations
      for PA, Pmax, Wmax, DPA.  A full PA, Pmax, Wmax, DPA, K fit would only 
      be used on combined WUPPE-PBO data.  Note that when both PA and Pmax 
      are selected for variation, the actual iteration variables are 
      Qmax and Umax to make the search better behaved ]
   
    Iter   1  Chisq   4.684  Vars    -3.39   -0.24 5000.00    0.
    Iter   2  Chisq   5.556  Vars    -3.29   -0.24 5000.00    0.
    Iter   3  Chisq   5.318  Vars    -3.39   -0.14 5000.00    0.
    Iter   4  Chisq   4.915  Vars    -3.39   -0.24 5200.00    0.
    Iter   5  Chisq   4.397  Vars    -3.39   -0.24 5000.00    1.00
    Iter   6  Chisq   4.922  Vars    -3.49   -0.19 5100.00    0.50
    Iter   7  Chisq   4.706  Vars    -3.44   -0.31 5150.00    0.75
    Iter   8  Chisq   5.409  Vars    -3.32   -0.32 5075.00    0.38

    [ Continue first pass . . . ]
   
    Iter  48  Chisq   3.975  Vars    -3.44   -0.32 4703.70    2.70

	Iterations:    48
          Chisq,Dchisq =  3.9728 0.0023

    [ Second pass . . . ]

    Iter  35  Chisq   3.976  Vars    -3.45   -0.30 4714.76    2.78

        Iterations:    35
          Chisq,Dchisq =  3.9728 0.0026

    [ Several more iterations around the optimal fit are used to estimate
     the errors, then the answer is printed out: ]
   
                Value   Error
     PA   =     92.58    0.10
     Pmax =      3.463   0.013
     Wmax =   4695.     41.
     DPA  =      2.733   0.198
     K    =      0.773   0.

    [ This may now be removed via ISREM above ]
   

STFIT < ps1 ps2 ... ( ; ps3 ps4 ... ; ... )  > 
  Attempt to determine Serkowski interstellar polarization contribution
    to intrinsic polarization scans.  Observations grouped by ";"
    delimiter are assumed to have the same intrinsic polarization
    position angle (but not necessarily the same *degree* of intrinsic
    polarization).  All scans are assumed to have the same interstellar
    polarization.

  Asks 'PLEASE ENTER:
    'ISM    PA(deg) Pmax(%) Wmax(ang) DPA(deg) K(bl=WLR)'
    'Vary?  DPA/0   DPM/0   DWM/0     DDPA/0   DK/0=WLR'

  Note that the program requires TWO LINES of input before it will
    proceed.

  Minimized fit parameter is sum of chisq of a fit of the residuals
    of each ';' group to a constant intrinsic position angle, after
    removal of ISM.  Iteration details are printed out at terminal
    level 4 and printer level 5.

  EXAMPLE: WUPPE psim scans for HD50896.  Scans 120 and 135 have 
    intrinsic continuum polarization at PA 106 and 136, respectively,
    with unpolarized emission lines.  To this has been added inter-
    stellar polarization of 0.473% at PA 161.46, and both were
    "observed" in halfwave mode for 2000 sec.  The fit attempts
    to find the interstellar PA and Pmax with an assumed Wmax of
    5000 Ang and no PA rotation.  
    
    In general, you should beware of overmodelling the interstellar
    polarization: you will get an answer, but it may not be unique.
    A Wmax fit would require at least combined WUPPE and PBO data,
    since only then would the curvature of the interstellar curve be
    separable from intrinsic polarization.  DPA should not be used 
    if the intrinsic polarization has no features, since this will be 
    put into interstellar PA rotation. A full 5-parameter fit is 
    probably never justified.

    stfit 120 ; 135                                                                 
       PLEASE ENTER:
       ISM    PA(deg) Pmax(%) Wmax(ang) DPA(deg) K(bl=WLR)
       Vary?  DPA/0   DPM/0   DWM/0     DDPA/0   DK/0=WLR
              140     .4      5000                                                 
                1     .1                                                           
    Iter   1  Chisq   1.789  Vars     0.07   -0.39
    Iter   2  Chisq   1.723  Vars     0.17   -0.39
    Iter   3  Chisq   1.844  Vars     0.07   -0.29
    Iter   4  Chisq   1.775  Vars     0.17   -0.49
    Iter   5  Chisq   1.780  Vars     0.27   -0.49
   
    [ ... ]
   
    Iter  16  Chisq   1.686  Vars     0.42   -0.20
   
       Iterations:    16
         Chisq,Dchisq =  1.6858 0.0004
   
    Iter   1  Chisq   1.688  Vars     0.38   -0.18
    Iter   2  Chisq   1.689  Vars     0.48   -0.18
    Iter   3  Chisq   1.701  Vars     0.38   -0.08
   
                 Value   Error
       PA   =    167.11   11.33
       Pmax =      0.421   0.166
       Wmax =   5000.      0.
       K    =      0.830   0.   


The following commands currently work only for unbinned halfwave data:


PSEP  < qscan > 
  "Separates" a polarization scan into two pol scans with known
    position angles whose sum is the original scan.  Asks:

    PLEASE ENTER TWO POSITION ANGLES TO SEPARATE:

    The two angles must be different.  The result pol scans have
    all their linear polarization rotated into Q.  E.G:

      PSEP 137
      PLEASE ENTER TWO POSITION ANGLES TO SEPARATE:
      12.5 175.0
      (Results to 210-212 and 213-215)

    The following sequence will return the values in scan 137-139
    exactly:

      HROT 210 
      Please enter degrees to rotate
      12.5
      (Results to 216-218)
      HROT 213
      Please enter degrees to rotate
      175.0
      (Results to 219-221)
      HADD 216 219
      Please enter weight for each scan (default=1)
      (Carriage return - gives default)

    This is useful in cases where the polarization is the sum
    of two processes whose position angles are known from some
    external evidence (e.g., binary orbits or a position angle
    derived from PFEW).  Only the two PAs are required to
    seqarate these two processes uniquely.


PFLUX  < qscan fscan > 
  Compute "polarized flux" scans from polarization*flux.
    Qscan is the scan number of the first of a q,u,err
    scan set, and fscan is the number of a corresponding
    flux calibrated scan (either Fnu or Flam is OK).
    Output is a "polarized" flux set: q*flux, u*flux, err*flux.
    Polarized flux scans may be manipulated with regular
    REDUCE spectrum analysis tools (scope/plot, line analysis,
    etc), or with any polar commands that can handle q,u,err
    scans.  For instance, hscope may be used with any of the
    usual options, although bin errors and plot scales should
    be specified in the appropriate flux units.

  For example, an overplot of an EW Lac spectrum and polarized
    flux spectrum was created as follows.  The polarization
    scans are in 12, 13, and 14, and the flux scan is in 15:

    polar
    pflux 12 15                                                                     
        Q *REL. FL TO DISK2 POSITION   16
        U *REL. FL TO DISK2 POSITION   17
        ER*REL. FL TO DISK2 POSITION   18

    C NEXT, A PRELIMINARY EXPLORATION FOR SCALING:

    wscale 3000.  8000.                                                             
       WAVELENGTH LIMITS =  3000.00,  8000.00
    hscope 16 p                                                                     
    retu
    scope 15

    C FINALLY, THE OVERPLOT:

    polar
    caption                                                                         
       TYPE CAPTION
       :EW Lac  090289                                                                  :
    yscale 0  1e-23                                                         
       Y LIMITS = 0.000e+00, 1.000e-23
    hplot 16 p                                                                      
       EW Lac  090289                                                                 
    PLOT FILE NAME = ewlacpf1.plt           
    retu 
    yscale  0 5e-22 
       Y LIMITS = 0.000e+00, 5.000e-22
    plotover 15                                                
       EW Lac  090289                                                                 

  Polarized flux is most useful in looking for features in
    intrinsic polarization; it will be very confusing on
    mixed ISM and intrinsic polarization.  With intrinsic
    polarization, the polarized flux is just the spectrum of
    the illuminating source as seen by the polarizing scatterer.
    Any emission feature which is in the spectrum but not in the
    polarized flux must be external to the scatterer.


PFEW < qscan fscan> 
  Performs an "equivalent width" analysis on spectral features in
  the intensity and polarized flux spectrum. Qscan is the scan
  number of the first member of a q,u,err halfwave triplet, and
  fscan is the number of the corresponding flux calibrated scan
  (either Fnu or Flam is OK).  The program asks:
    
    PLEASE ENTER CONT, LINE, CONT WAVL, EW0:
      C1  C2    L1  L2    C3   C4    EW0 (CR TO QUIT)

  C1, C2 and C3, C4 are wavelength limits for continuum samples to
  the left and right of the line, and L1, L2 are the line limits.
  EW0 is an optional equivalent width of an underlying line 
  which will be considered to be part of the continuum (positive
  for emission, negative for absorbtion).  The program then
  integrates over the three intervals in the flux, q*flux, and
  u*flux curves and removes the continuum from the line to give
  pure line properties.  This may then be repeated for other lines
  on the same data until terminated by a null input line.  For 
  example, the output below is for the H-alpha line in the EW-Lac 
  run described above:

  pfew 12 15

    PLEASE ENTER CONT, LINE, CONT WAVL, EW0:
      C1  C2    L1  L2    C3   C4    EW0 (CR TO QUIT)
    6100 6500 6520 6600  6620 6820                                              

                   I          Q          U         Err        Pol        PA 
    Flam Left   1.778e-11 -1.800e-13  2.008e-13  5.200e-15  2.697e-13   65.94
    Flam Cntr   2.094e-11 -1.457e-13  1.607e-13  1.462e-14  2.169e-13   66.10
    Flam Right  1.487e-11 -1.409e-13  1.602e-13  9.058e-15  2.133e-13   65.67
    Flam Cont   1.597e-11 -1.557e-13  1.756e-13  5.963e-15  2.347e-13   65.79

    Flux Line   3.878e-10  7.830e-13 -1.157e-12  1.231e-12  1.397e-12  152.04
    EW Line          24.3      0.049     -0.072      0.077      0.087

    % Cont                    -0.975      1.099      0.037      1.469   65.79
    % Line                     0.202     -0.298      0.318      0.360  152.04
    % Cnt-Lne                 -1.177      1.397      0.320      1.827   65.05

  The output is defined as follows.  The spectral fluxes (in erg/s*cm2*Ang) 
  are Fc1lam and Fc2lam (the mean flux for the left and right continuum 
  intervals), Ftlam (the *total* mean flux (continuum+line) in the line 
  interval), and Fclam (the mean continuum flux under the line).
  Qc1, Qc2, Qt, and Qc are the mean (flux-weighted) degree of polarization
  in the Q sense for the same intervals, with a similar definition for
  U.  Finally, Fl, Ql, and Ul are the total flux in the line and the
  degree of polarization in the line with continuum removed.  Dlam is
  the width of thelne interval.  "Equivalent widths" based on the line 
  values are all normalized to the mean continuum flux.  These quantities 
  are calculated as in the following table:

  line   formula     Title             I           Q              U

   1=mean(pflux)  "Flam Left"      Fc1lam     Fc1lam*Qc1     Fc1lam*Uc1
   2=mean(pflux)  "Flam Cntr"      Ftlam      Ftlam *Qt      Ftlam *Ut
   3=mean(pflux)  "Flam Right"     Fc2lam     Fc2lam*Qc2     Fc2lam*Uc2
   4=interp(1,3)  "Flam Cont"      Fclam      Fclam *Qc      Fclam *Uc

   5=(2-4)*dlam   "Flux Line"      Fl         Fl * Ql        Fl * Ul
   6=5/Fclam      "EW Line"        Fl/Fclam  (Fl/Fclam)*Ql  (Fl/Fclam)*Ul

   7=4/Fclam      "% Cont"                    Qc             Uc
   8=5/Fl         "% Line"                    Ql             Ul
   9=7-8          "% Cnt-Lne"                 Qc-Ql          Uc-Ul

  "Flam Cont" is determined by linear interpolation between the two 
  continuum points.  For the common case of interstellar polarization 
  overlying a star with intrinsically polarized continuum and unpolarized 
  emission lines, % Cont will be ISM + Intrinsic, % line will be ISM, and
  % Cnt-Lne will be Intrinsic.  With interstellar polarization
  removed, % Cont and % Line are just the intrinsic polarization of
  the continuum and line, and % Cnt-Lne is not useful.


PFIL < qscan > < flux-scan > 
  Compute synthetic filter polarimetry from halfwave spectro- 
    polarimetry.
  Asks: "  Filter(s) (.fil assumed) "
  Computes filter polarization data from specified scan.
  Reads in filter bandpass curve from file FILE.fil in USERDATA
    directory, computes value of integrands at each diode, and
    performs integral using linear interpolation and trapezoid
    rule.  

  File.fil is in mongo format:  one wavelength and one
     bandpass point (relative to 1.) per ascii line.
  A list of filters available is in filters.doc in USERDATA directory


PHAR 
  Finds the second harmonic variability component in a series of Q,U,Err
  scans of a binary star with known ephemeris.  For each phase observation,
  the program asks,

    PLEASE ENTER  QSCAN  PHASE  (CR TO QUIT)
  
  Respond with the DISK2 scan number of the Q scan, and the binary phase
  (0 < phase < 1) of the observation.  Repeat for each observation and end 
  the series with a carriage return.  (This is most easily done as a script
  which just has "phar" in the first line, followed by a two-column table
  of scan numbers and phases, and finishing with a blank line.) The program 
  calculates a weighted least squares fit for each pixel of Q and U to,

    Y(lam) = A(lam) + B(lam)*cos(2*twopi*phase) + C(lam)*sin(2*twopi*phase).

  Each pixel is weighted by the individual pixel error of the observation.
  The  Q,U,Err  result for the constant A, the cosine harmonic B, and the 
  sine harmonic C are then put in the next 9 disk2 positions.   The CHISQ 
  for each pixel is calculated from the residual to the fit and put in a 
  CHISQ scan in a tenth disk2 position.  The mean CHISQ across the spectrum 
  is also printed out.  The expected CHISQ for a good fit is

    CHISQ(expected) = 2 * (N - 3).

  where N is the number of observations, there are three adjustable 
  parameters for each fit, and there are two independent fits (Q and U).

  If the fit is good (CHISQ = expected +/- 1), then the McLean and Brown 
  binary reflection model may be used.  For instance, the 
  wavelength dependence of the harmonic amplitude is related to the 
  wavelength dependence of the scattering modified by competing absorption, 
  unpolarized emission, etc.  If all the amplitude is in the cosine, then 
  the scattering path is at the same angle as the line between the two 
  stars (maximum polarization at quadrature); otherwise there is a non-zero 
  angle between the two (eg, scattering from mass transfer plume).


MAKE2 < scan > 
  Creates a new DISK2 scan based on user-input data.  Header and
    wavelength coefficients are obtained from the header of the named
    DISK2 scan.  Asks:

    PLEASE ENTER FILENAME OR POLY COFS:

    Enter either the filename of a mongo-style text table residing in
    the current working directory, or up to 6 polynomial coefficients.
    The file should have two columns, wavelength (in Angstroms) and value.  
    The table is interpolated for the value of each pixel; pixels out of 
    range are given the value of the nearest wavelength.  Polynomial coef-
    icients are used to construct a polynomial in wavelength, where
    the wavelength is in Angstroms.

			POLAR COMMAND SUMMARY


I) Halfwave Polarimetry 


HCAL < calname >
HRECAL < calname > < qscan > < qscan > ...
HPOL ( residual save ) < scan list >
HRED ( resi save ) < s1 list > ; < s2 list > ; < s3 list > ; < s4 list >
HROT < qscan >
HCOMB < qscan1 > < qscan2 > ...
HADD < qscan1 > < qscan2 > ...
HPRINT < qscan1 qscan2 ... >
HSCOP(OVER),HPLOT(OVER) < qscan > < q,u,p,t, or qu > (e,b)
SYMBOL < symbol > ( wavelength symbol wavelength symbol . . . )
XYLOG <0,1> <0,1>
REMARK, ENDPL, PSCALE, WSCALE, YSCALE, CAPTION, PEN UP, PEN DOWN 


II) Lyot Polarimetry

DIFFSUM < scan1 > < scan2 >
LCAL < calname >
LRECAL < calname > < vscan > < vscan > ...
LPOL ( resi ) < diffsum sum >

The following "H" commands described above also work with Lyot data:
HROT 
HCOMB < vscan1 > < vscan2 > ...
HADD < vscan1 > < vscan2 > ...
HPRINT < vscan1 vscan2 ... >
HSCOP(OVER) HPLOT(OVER) < vscan >  < v,q,u,p,t, or qu > (e)
SYMBOL, XYLOG, ENDPL, PSCALE, WSCALE, YSCALE, CAPTION, PEN UP/DOWN


III) POLARIZATION ANALYSIS COMMANDS 

PMAKE < qscan or vscan >
ISREMOVE  < ps1 -ps2 ... >
ISFIT < ps1 ps2 ... >
STFIT < ps1 ps2 ... ( ; ps3 ps4 ... ; ... )  >

The following commands currently work only for unbinned halfwave data;
PSEP  < qscan >
PFLUX < qscan fscan >
PFEW < qscan fscan >
PFIL < qscan fscan >
PHAR

MAKE2 < scan >