#!/usr/bin/env python # ----------------------------------------------------------------------------------- # # # ROOT macro for reading data for the Applied Statistics problem set 2017 problem 4.1, # regarding Fisher's Syndrome. # # 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, , , Extended plt.close('all') # ----------------------------------------------------------------------------------- # # Read data: # ----------------------------------------------------------------------------------- # data = [] with open( 'data_FisherSyndrome.txt', 'r' ) as infile : counter = 0 for line in infile: line = line.strip().split() data.append([float(line[2]), float(line[3]), float(line[4]), int(line[0])]) isIll = data[-1][3] A = data[-1][0] B = data[-1][1] C = data[-1][2] # Print some numbers as a sanity check: if (counter < 10) : print(" Reading data: Is the person ill? {0:d} A = {1:5.2f} B = {2:5.2f} C = {3:5.2f}".format(isIll, A, B, C)) counter += 1 #---------------------------------------------------------------------------------- # Your analysis... #-------------------------------------------------------------------------- try: __IPYTHON__ except: raw_input('Press Enter to exit')