#!/usr/bin/env python # ----------------------------------------------------------------------------------- # # # ROOT macro for reading data for the Applied Statistics problem set 2017 problem 5.2, # regarding timing residuals. # # Author: Troels C. Petersen (NBI) # Email: petersen@nbi.dk # Date: 11th of November 2017 # # ----------------------------------------------------------------------------------- # from __future__ import division, print_function import numpy as np import matplotlib.pyplot as plt from iminuit import Minuit from probfit import Chi2Regression , BinnedChi2, BinnedLH, UnbinnedLH plt.close('all') # ----------------------------------------------------------------------------------- # # Read data: # ----------------------------------------------------------------------------------- # data = [] counter = 0 with open( "data_TimingResiduals.txt", 'r' ) as infile : for line in infile: line = line.strip().split() data.append(float(line[0])) if (counter < 10) : print(" {0:4d}: {1:6.3f} seconds".format(counter, data[-1])) counter += 1 print(" Number of measurements in total: ", counter) #---------------------------------------------------------------------------------- # Your analysis... #-------------------------------------------------------------------------- try: __IPYTHON__ except: raw_input('Press Enter to exit')