ds = Dataset(data_folder) colours={'i': 'b', 'l': 'r'} # instrumental = blue, lyrics = red print "Reminder: Lyrics = Red, Instrumental = Blue" pylab.figure() pylab.show() for songcounter,songname in enumerate(ds.metadata['songname']): # figureno will increment from 0 # songno will go through all the available songno's in the Dataset ds #pylab.figure(figureno) sample_file = ds.filter(songname=songname).next() pval_list = list() # list of P values (one for each time step) mean_diff_list = list() # set up a CSV file writer csv_file = open(sample_file.metadata['songname']+'.csv', 'w') # open a file for writing csv_out = csv.DictWriter(csv_file, ['t','imy','ivy','iny','lmy','lvy','lny','tstat','pval'], dialect='excel') labels = { 't': 'Time (s)', 'imy': 'Mean(Yi)', 'ivy': 'Var(Yi)', 'iny': 'N(Yi)', 'lmy': 'Mean(Yl)', 'lny': 'N(Yl)', 'lvy': 'Var(Yl)',
colours={'i': 'b', 'l': 'r'} # instrumental = blue, lyrics = red print "Reminder: Lyrics = Red, Instrumental = Blue" #do 4 in one animated plot #for i in [100]: pylab.figure(3) pylab.clf() pylab.subplot(221) pylab.axis([-400,400,-400,400]) sample_file = ds.filter(songno=songno).next() pylab.subplot(224) pylab.axis([0, sample_file.get_last_time(),-400,400]) for i in range(0, sample_file.get_frame_count(), 1 ): pylab.subplot(222).clear() pylab.subplot(223).clear() y_arrays=dict() # new dictionary for this time step for condition in ['i','l']: col = colours[condition] y_list=list() x_list=list()