%N setxy %F $MIR/src/subs/calsubs.for
%D Extract timeaveraged ph/amp from calibration data
%: calibration
%P pjt
%B
        SUBROUTINE setxy( bp, b, p, count, x, y ,taver)

        INTEGER bp, b, p, count
        REAL    x(*), y(*), taver(2)

  setxy -- initialize X and Y to requested data:
       It returns only the data within a segment bounded by
       breakpoints (or infinity) and pays attention to both 
       Rflags() and Sflags() as set by previous selections/
       programs. (e.g. setsflag)
     Note: it could be considered a bug, but this routine does
       not pay attention when the sourceflag changes....
       Normally you really don't want to continue to vector average
       when the source changes!!!

  Inputs:
       bp    -- where in break  (0..bcount(p1,b))
       b     -- the current baseline (1..nbl)
       p     -- slotcode (1-4), depending on LSB/USB/phase/amplitude
       taver -- parameter array for Vector averaging (passed to VECTAV)

  Outputs:
       count -- number of data points
       X     -- independent variable: time 
       Y     -- dependent variable: correllation data (P/A) 
                If amplitude, its scale is modified by /calscal/scalmode
                by VECTAV (see also SCALUNIT).
