
       REAL FUNCTION GetStudentT(P,Nf)
       IMPLICIT NONE
   INTEGER Nf,P,df    
   REAL ST_90(100)
   REAL ST_95(100)
   REAL ST_99(100)
   REAL T
   DATA ST_90/6.314,2.920,2.353,2.132,2.015,1.943,1.895,1.860,
    .           1.833,1.812,1.796,1.782,1.771,1.761,1.753,1.746,
    .           1.740,1.734,1.729,1.725,1.721,1.717,1.714,1.711,
    .           1.708,1.706,1.703,1.701,1.699,1.697,1.696,1.694,
    .           1.692,1.691,1.690,1.688,1.687,1.686,1.685,1.684,
    .           1.683,1.682,1.681,1.680,1.679,1.679,1.678,1.677,
    .           1.677,1.676,1.675,1.675,1.674,1.674,1.673,1.673,
    .           1.672,1.672,1.671,1.671,1.670,1.670,1.669,1.669,
    .           1.669,1.668,1.668,1.668,1.667,1.667,1.667,1.666,
    .           1.666,1.666,1.665,1.665,1.665,1.665,1.664,1.664,
    .           1.664,1.664,1.663,1.663,1.663,1.663,1.663,1.662,
    .           1.662,1.662,1.662,1.662,1.661,1.661,1.661,1.661,
    .           1.661,1.661,1.660,1.660/
   DATA ST_95/12.706,4.303,3.182,2.776,2.571,2.447,2.365,2.306,2.262,
    .           2.228,2.201,2.179,2.160,2.145,2.131,2.120,2.110,2.101,
    .           2.093,2.086,2.080,2.074,2.069,2.064,2.060,2.056,2.052,
    .           2.048,2.045,2.042,2.040,2.037,2.035,2.032,2.030,2.028,
    .           2.026,2.024,2.023,2.021,2.020,2.018,2.017,2.015,2.014,
    .           2.013,2.012,2.011,2.010,2.009,2.008,2.007,2.006,2.005,
    .           2.004,2.003,2.002,2.002,2.001,2.000,2.000,1.999,1.998,
    .           1.998,1.997,1.997,1.996,1.995,1.995,1.994,1.994,1.993,
    .           1.993,1.993,1.992,1.992,1.991,1.991,1.990,1.990,1.990,
    .           1.989,1.989,1.989,1.988,1.988,1.988,1.987,1.987,1.987,
    .           1.986,1.986,1.986,1.986,1.985,1.985,1.985,1.984,1.984,1.984/
   DATA ST_99/63.657,9.925,5.841,4.604,4.032,3.707,3.499,3.355,3.250,
    .           3.169,3.106,3.055,3.012,2.977,2.947,2.921,2.898,2.878,
    .           2.861,2.845,2.831,2.819,2.807,2.797,2.787,2.779,2.771,
    .           2.763,2.756,2.750,2.744,2.738,2.733,2.728,2.724,2.719,
    .           2.715,2.712,2.708,2.704,2.701,2.698,2.695,2.692,2.690,
    .           2.687,2.685,2.682,2.680,2.678,2.676,2.674,2.672,2.670,
    .           2.668,2.667,2.665,2.663,2.662,2.660,2.659,2.657,2.656,
    .           2.655,2.654,2.652,2.651,2.650,2.649,2.648,2.647,2.646,
    .           2.645,2.644,2.643,2.642,2.641,2.640,2.640,2.639,2.638,
    .           2.637,2.636,2.636,2.635,2.634,2.634,2.633,2.632,2.632,
    .           2.631,2.630,2.630,2.629,2.629,2.628,2.627,2.627,2.626,2.626/

   IF(P.NE.90.AND.P.NE.95.AND.P.NE.99)THEN
          P=90
      WRITE(6,*)'WARNING::P must be 90,95 or 99'
          WRITE(6,*)'         in SUBROUTINE PhaseConfidenceLimits'
          WRITE(6,*)'  '
          WRITE(6,*)'P set to 90%'
   ENDIF

       df=Nf-1

   IF(df.GT.100)THEN
          IF(P.EQ.90)THEN
       T=1.645
         ELSEIF(P.EQ.95)THEN
       T=1.96
     ELSE  !  P.EQ.99
       T=2.576
     ENDIF
   ELSE ! df <= 100
     IF(P.EQ.90)THEN
       T=ST_90(df)
         ELSEIF(P.EQ.95)THEN
       T=ST_95(df)
     ELSE  !  P.EQ.99
       T=ST_99(df)
     ENDIF
   ENDIF
   GetStudentT=T
   END
