image_height = ctrlfly.get_frame(0)[0].shape[0] + expfly.get_frame( 0)[0].shape[0] image_width = expfly.get_frame(0)[0].shape[1] * 3 for frame_number in range(9450): #ctrlfly.get_n_frames()): if os.path.exists(savedir + '/temp_png/_tmp%05d.png' % (frame_number)): continue fig = plt.figure(figsize=(image_width / 100, image_height / 100), dpi=200.399) make_panel(ctrlfly, 0, 0, frame_number, args.toplabel) make_panel(expfly, 30, 0, frame_number, args.bottomlabel) #plt.show() plt.savefig(savedir + '/temp_png/_tmp%05d.png' % (frame_number), bbox_inches='tight', pad_inches=0) plt.close('all') print 'added png: ', frame_number utilities.sendMail('*****@*****.**', 'movie is finished', ('Your awesome new video has finished.')) """ ffmpeg -f image2 -r 15 -i temp_png/_tmp%05d.png -vf 'scale=iw/2:-1' -vcodec mpeg4 -b 8000k -y 'movie.mp4' ffmpeg -f image2 -r 15 -i temp_png/_tmp%05d.png -vf 'scale=iw/2:-1' -vcodec mpeg4 -b 2000k -y 'movie.mp4' """
parser.add_argument('--lasermode', type=str, required=False, default='state', help='which laser value to use, "state" or "current" or "nolaser"') #parser.add_argument('--overlays', type=bool, required=False, default=False, help='turn on overlays to plot wing angles and distance bars') args = parser.parse_args() threadcount = 0 _filelist = [] for _directory in glob.glob(args.inputdir + '/*zoom*/*.fmf'): _filelist.append(_directory) for x in np.arange(len(_filelist)): png_stash = args.savedir + '/' + _filelist[x].split('/')[-1].split('.')[0] if not os.path.exists(png_stash + '.mp4'): if not os.path.exists(png_stash): os.makedirs(png_stash) p = Process(target=make_pngs, args=(_filelist[x], png_stash+'/',False)) p.start() print _filelist[x] threadcount +=1 if p.is_alive(): if threadcount >=8: threadcount = 0 p.join() elif _filelist[x] == _filelist[-1]: threadcount=0 p.join() utilities.sendMail('*****@*****.**','movie is finished', ('Your awesome new video has finished.'))
print exp_id if exp_id in experiment_list: continue else: experiment_list.append(exp_id) for experiment in experiment_list: if not os.path.exists(OUTPUT_DIR + '/SUMMARY_FILES/PNG/' + experiment+ '**' + binsize_str + '.png'): storage_location = OUTPUT_DIR + 'JAR/' + experiment if not os.path.exists(storage_location): os.makedirs(storage_location) if plots_only == False: for directory in glob.glob(INPUT_DIR + experiment + '*'): exp_id, timestamp = parse_tempdf_name(directory) process_matebook_data(directory, _paramlist, storage_location) compiled = compile_data(storage_location) _mean, _sem, _n = group_data(compiled) _mean = generate_cumulative_temperature(_mean, THRESHOLD) _sem = generate_cumulative_temperature(_sem, THRESHOLD) plot_behaviours_per_video(_mean, _sem, _n, experiment, OUTPUT_DIR + '/SUMMARY_FILES/', 'Time') plot_behaviours_per_video(_mean, _sem, _n, experiment, OUTPUT_DIR + '/SUMMARY_FILES/', 'Temperature') plot_behaviours_per_video(_mean, _sem, _n, experiment, OUTPUT_DIR + '/SUMMARY_FILES/', 'DegreeSeconds') utilities.sendMail(args.email, 'Matebook processing finished', ('Your files are available at: ' + OUTPUT_DIR)) print "Done."
experiment_list.append(exp_id) for experiment in experiment_list: if not os.path.exists(OUTPUT_DIR + '/SUMMARY_FILES/PNG/' + experiment + '**' + binsize_str + '.png'): storage_location = OUTPUT_DIR + 'JAR/' + experiment if not os.path.exists(storage_location): os.makedirs(storage_location) if plots_only == False: for directory in glob.glob(INPUT_DIR + experiment + '*'): exp_id, timestamp = parse_tempdf_name(directory) process_matebook_data(directory, _paramlist, storage_location) compiled = compile_data(storage_location) _mean, _sem, _n = group_data(compiled) _mean = generate_cumulative_temperature(_mean, THRESHOLD) _sem = generate_cumulative_temperature(_sem, THRESHOLD) plot_behaviours_per_video(_mean, _sem, _n, experiment, OUTPUT_DIR + '/SUMMARY_FILES/', 'Time') plot_behaviours_per_video(_mean, _sem, _n, experiment, OUTPUT_DIR + '/SUMMARY_FILES/', 'Temperature') plot_behaviours_per_video(_mean, _sem, _n, experiment, OUTPUT_DIR + '/SUMMARY_FILES/', 'DegreeSeconds') utilities.sendMail(args.email, 'Matebook processing finished', ('Your files are available at: ' + OUTPUT_DIR)) print "Done."