#!/usr/bin/env python # ----------------------------------------------------------------------------------- # # # Python macro for Applied Statistics 2017/18 exam, problem 5.1 on Hulse-Taylor pulsar. # # Author: Troels C. Petersen (NBI) # Email: petersen@nbi.dk # Date: 16th of January 2018 # # ----------------------------------------------------------------------------------- # with open( 'data_HulseTaylor.txt', 'r' ) as infile : header = infile.readline() # Read (and ignore) the first line, which is a header line! counter = 0 for line in infile: columns = line.strip().split() counter += 1 # Print some numbers as a sanity check: if (counter < 10) : print(" Time: {:8.4f} Amplitude: {:8.4f}".format(float(columns[0]), float(columns[1]))) print(" The total number of data points read is: {:d}".format(counter))