#!/usr/bin/env python # ----------------------------------------------------------------------------------- # # # ROOT macro for reading data for the Applied Statistics problem set 2017 problem 5.1, # regarding Luke Lightning's Lights. # # 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: # ----------------------------------------------------------------------------------- # # Define input data lists: x = [] y = [] ex = [] ey = [] with open( 'data_LukeLightningLights.txt', 'r' ) as infile : for line in infile: line = line.strip().split() x.append(float(line[0])) ex.append(float(line[1])) y.append(float(line[2])) ey.append(float(line[3])) # Print the numbers as a sanity check (only 41 in total): print(" Read data: {0:6.3f} {1:6.3f} {2:6.3f} {3:6.3f}".format(x[-1], ex[-1], y[-1], ey[-1])) #---------------------------------------------------------------------------------- # Your analysis... #-------------------------------------------------------------------------- try: __IPYTHON__ except: raw_input('Press Enter to exit')