예제 #1
0
def example2():
#  
  binaryFile = open("milleBinaryISN.dat", "rb")
  nRec = 0
  maxRec = 10  #: maximum number of records to read
  Chi2Sum = 0.
  NdfSum = 0
  LostSum = 0.
  start = time.clock()
  
  try:
    while(nRec < maxRec):
# create trajectory
      traj = GblTrajectory(0)
# read from file      
      traj.milleIn(binaryFile)  # get data blocks from file
      nRec += 1
# fit trajectory      
      Chi2, Ndf, Lost = traj.fit()
      print " Record, Chi2, Ndf, Lost", nRec, Chi2, Ndf, Lost
# sum up      
      Chi2Sum += Chi2
      NdfSum += Ndf
      LostSum += Lost 
         
  except EOFError:
    pass    
  
  print " records read ", nRec
  end = time.clock()
  print " Time [s] ", end - start
  print " Chi2Sum/NdfSum ", Chi2Sum / NdfSum
  print " LostSum/nTry ", LostSum / nRec
예제 #2
0
def example2():
    #
    binaryFile = open("milleBinaryISN.dat", "rb")
    nRec = 0
    maxRec = 10  #: maximum number of records to read
    Chi2Sum = 0.
    NdfSum = 0
    LostSum = 0.
    start = time.clock()

    try:
        while (nRec < maxRec):
            # create trajectory
            traj = GblTrajectory(0)
            # read from file
            traj.milleIn(binaryFile)  # get data blocks from file
            nRec += 1
            # fit trajectory
            Chi2, Ndf, Lost = traj.fit()
            print " Record, Chi2, Ndf, Lost", nRec, Chi2, Ndf, Lost
            # sum up
            Chi2Sum += Chi2
            NdfSum += Ndf
            LostSum += Lost

    except EOFError:
        pass

    print " records read ", nRec
    end = time.clock()
    print " Time [s] ", end - start
    print " Chi2Sum/NdfSum ", Chi2Sum / NdfSum
    print " LostSum/nTry ", LostSum / nRec