def main(args=None): """ main function call for the simba3d print utility """ if args is None: args=sys.argv[:] if ('--help' in args) | ('-h'in args): printhelp() return 0; filename=None; if '-i' in args: filename=args[args.index('-i')+1] del args[args.index('-i')+1] del args[args.index('-i')] del args[0] summary=[] if filename is None: printhelp() else: try: summary=load_result(filename) except: print("\tError loading "+filename) if args: for key in args: if key in summary: print(key+"="+str(summary[key])) else: print('keys='+str(summary.keys()))
def create_images_from_task(task): ''' Will load the individual task (if possible) and plot the relavent images ''' outputfile = get_outputfilepath(task) if outputfile is not None: summary = mp.load_result(outputfile)
Compute the total computation time from a list of simba3d output report files. @author: Michael Rosenthal """ import os import simba3d.mp_manager as mp # specify the directory where the results are stored report_directory = 'results/' # manually enter a list of files to add coputation times report_files = [ 'simulated_data_b7b1fe84-8b80-4bb4-9af8-8f0f9e7aa3b7_50.npz', 'simulated_data_b7b1fe84-8b80-4bb4-9af8-8f0f9e7aa3b7_100.npz', 'simulated_data_b7b1fe84-8b80-4bb4-9af8-8f0f9e7aa3b7_200.npz', 'simulated_data_b7b1fe84-8b80-4bb4-9af8-8f0f9e7aa3b7_400.npz' ] total_time = 0.0 # initialize the total time for report_file in report_files: # load the summary report outputfile = os.path.join(report_directory, report_file) # path the file summary = mp.load_result(outputfile) print(outputfile + "\n\t" + str(summary['computation_time']) + " seconds") # for each report_file, load it into memory total_time += summary['computation_time'] print("total time: " + str(total_time) + " seconds") print("total time: " + str(total_time / 60) + " minutes")
def main(args=None): """ main simba3d task run call """ if args is None: args = sys.argv[:] #print args inputfiles = [] cores = 1 ii = 1 override_output_filename = False UUID = uuid.uuid4() task = { # task parameters 'taskname': str(UUID), 'uuid': str(UUID), # assign a unique identifier to resume tasklists # initialization settings 'randomize_initialization': False, # Randomize the initialized curve #'seed' : int(np.random.rand()*4294967295), # fixed seed for randomizing inititialization # debug options 'check_jacobian': False, # check analytical gradient with numerical gradient 9 # data file names to load 'file_names': { 'inputdir': './', # location of data input files 'outputdir': './', # directory where to output results # the following are relative to the inputdir directory #"initialized_curve" : '', #"pairwise_contact_matrix" : '', #"population_contact_matrix" : '', #"prior_shape_model" : 'prior_shape_model.npy', "output_filename": str(UUID), }, # data # if all the tasks use the same data, it may be better to load it once 'data': { #'initialized_curve' : initialized_curve, #'t' : t, # optional #'pairwise_contact_matrix' : [], #'index' : index, #'population_contact_matrix' : pairwise_contact_pop, #'prior_shape_model' : prior_shape_model, }, # parameter settings 'parameters': { 'a': -3.0, 'b': 1.0, # not identifiable with unconstrained scale 'term_weights': { 'data': 1.0e0, # weight for the data term 'uniform spacing': 0.0, # scaled first order penalty 'smoothing': 0.0, # scaled second order penalty 'lamina': 0.0, # keep curve within unit length 'population prior': 0.0, # weight for the population matrix prior 'shape prior': 0.0, # weight for the shape prior # below are unsupported penalties #'firstroughness' :0.0e3, # weight for the fist order roughness #'secondroughness' :0.0e-16, # weight for the second order roughness #'scaledfirstroughness' :0.0, # weight for the scaled second order roughness #'scaledsecondroughness' :0.0, # weight for the scaled second order roughness #'parameterization' :0, # not implemented }, 'lamina_radius': 1.0 # radius everything must fit inside of }, # options 'options': { 'maxitr': 100000, # set maximum number of iterations 'display': True, # display function values at each iteration 'store': False, # store iterative curves 'method': 'BFGS', # Broyden, Fletcher, Goldfarb, and Shanno (quasi-Newton, only first derivatives are used) #'method' :'Nelder-Mead',# robust but slow numerical approach #'method' :'CG',# nonlinear conjugate gradient algorithm by Polak and Ribiere (only first derivatives are used) #'method' :'Newton-CG',# (truncated Newton method) }, } if len(args) == 1: printhelp() sys.exit() threads = 4 while ii < len(args): if args[ii] == '-h': printhelp() sys.exit() elif args[ii] == '-c': ii += 1 cores = int(args[ii]) elif (args[ii] == '-r') | (args[ii] == '-i'): ii += 1 inputfiles = [args[ii] for ii in range(ii, len(args))] #FILE SETTINGS elif args[ii] == '--inputdir': ii += 1 task['file_names']['inputdir'] = args[ii] elif args[ii] == '--outputdir': ii += 1 task['file_names']['outputdir'] = args[ii] elif args[ii] == '--cm_file': ii += 1 task['file_names']['pairwise_contact_matrix'] = args[ii] elif args[ii] == '--pairwise_contact_matrix': ii += 1 task['file_names']['pairwise_contact_matrix'] = args[ii] elif args[ii] == '--population_contact_matrix': ii += 1 task['file_names']['population_contact_matrix'] = args[ii] elif args[ii] == '--init_structure_file': ii += 1 task['file_names']['initialized_curve'] = args[ii] elif args[ii] == '--initialized_curve': ii += 1 task['file_names']['initialized_curve'] = args[ii] elif args[ii] == '--o': ii += 1 task['file_names']['output_filename'] = args[ii] elif args[ii] == '--output_filename': ii += 1 task['file_names']['output_filename'] = args[ii] elif args[ii] == '--override-output_filename': override_output_filename = True #PARAMETER SETTINGS elif args[ii] == '--param_a': ii += 1 task['parameters']['a'] = np.float(args[ii]) elif args[ii] == '--param_b': ii += 1 task['parameters']['b'] = np.float(args[ii]) elif args[ii] == '--term_weight_data': ii += 1 task['parameters']['term_weights']['data'] = np.float(args[ii]) elif args[ii] == '--lambda_1_value': ii += 1 task['parameters']['term_weights']['uniform spacing'] = np.float( args[ii]) elif args[ii] == '--term_weight_uniform_spacing': ii += 1 task['parameters']['term_weights']['uniform spacing'] = np.float( args[ii]) elif args[ii] == '--lambda_2_value': ii += 1 task['parameters']['term_weights']['smoothing'] = np.float( args[ii]) elif args[ii] == '--term_weight_smoothing': ii += 1 task['parameters']['term_weights']['smoothing'] = np.float( args[ii]) elif args[ii] == '--lambda_3_value': ii += 1 task['parameters']['term_weights']['population prior'] = np.float( args[ii]) elif args[ii] == '--term_weight_population_prior': ii += 1 task['parameters']['term_weights']['population prior'] = np.float( args[ii]) ii += 1 print('Input file is ', inputfiles) print('number of processess', str(cores)) print('number of threads', str(threads)) if not inputfiles: # check that the file already exist if override_output_filename: mp.run_task(task) else: outputfilepath = mp.get_outputfilepath(task) ext = os.path.splitext(outputfilepath)[-1].lower() if (ext != '.npz') | (ext == '.mat') | (ext == '.json'): outputfilepath += '.json' if not mp.load_result(outputfilepath): mp.run_task(task) else: print("Skipping task with same output file") else: taskss = [] for inputfile in inputfiles: with open(inputfile, 'r') as tasklist: tasks = json.load(tasklist) for task in tasks: taskss.append(task) t = time.time() mp.mp_handler(taskss, cores) elapsed = time.time() - t print('Total %s seconds elapsed' % (elapsed))
import numpy as np import simba3d.mp_manager as mp import simba3d.srvf_open_curve_Rn as srvf import simba3d.plotting_tools as pt #%% load ground truth curve ground_truth_curve=np.load("data/ground_truth_curves/double_spiral_400.npy") #remove translation and scale of the ground truth curve center_curve,mu=srvf.center_curve(ground_truth_curve) # remove translation center_curve,scale=srvf.scale_curve(center_curve) # remove scale #%% load the output report file curve report_file ='results/simulated_data_b7b1fe84-8b80-4bb4-9af8-8f0f9e7aa3b7_400.npz' summary=mp.load_result(report_file) curves=summary['X_evol'] #remove translation and scale of the ground truth curve curve,mu=srvf.center_curve(curves[-1]) # remove translation curve,scale=srvf.scale_curve(curve) # remove scale #align estimated curve to the ground truth curve curve,rot=srvf.find_best_rotation(center_curve,curve)# align to the first curve # plot the estimated curve d,n=np.shape(curve); t=np.linspace(0,1,n) fig1,ax1=pt.plot_curve(curve,t) pt.plot_pts(curve,t,ax=ax1,fig=fig1) fig1.suptitle('Estimated Curve',fontsize=18) fig1.savefig('images/estimated_curve.png');
def main(args=None): """ main function for the simba3d display command line utility """ if args is None: args = sys.argv[:] ii = 1 param_name = [] param_min = [] param_max = [] center_to_filename = None report_directory = '.' image_ext = 'png' summary_name = 'results_summary' print_each = False latex_print = False inputfiles = [] while ii < len(args): print(args[ii]) if (args[ii] == '-h') | (args[ii] == '--help'): printhelp() sys.exit() if (args[ii] == '-p') | (args[ii] == '--print-each'): ii += 1 summary_name = str(args[ii]) print('\t' + args[ii]) print_each = True latex_print = True if (args[ii] == '-o') | (args[ii] == '--output-directory'): ii += 1 report_directory = str(args[ii]) print('\t' + args[ii]) print_each = True latex_print = True if (args[ii] == '-f') | (args[ii] == '--format'): ii += 1 image_ext = str(args[ii]) print('\t' + args[ii]) print_each = True latex_print = True if (args[ii] == '-c') | (args[ii] == '--center-to'): ii += 1 center_to_filename = str(args[ii]) print('\t' + args[ii]) if (args[ii] == '-i') | (args[ii] == '--input-files'): inputfiles = [] ii += 1 while ii < len(args): inputfiles.append(args[ii]) print('\t' + args[ii]) ii += 1 ii += 1 image_directory = os.path.join(report_directory, 'figures') # create the report directory if it does not exist if print_each: try: if not os.path.exists(report_directory): os.mkdir(report_directory) print("Directory ", report_directory, " Created ") if not os.path.exists(image_directory): os.mkdir(image_directory) print("Directory ", image_directory, " Created ") except: print("Potentially failed to create report directories") #print inputfiles curves = [] scurves = [] scurves_init = [] length = [] energy = [] if not inputfiles: print('No inputs provided') printhelp() else: # specify the file all the other figures will rotate to if center_to_filename is None: center_to_filename = inputfiles[0] summary = mp.load_result(center_to_filename) X0 = np.array(summary['X_evol'][-1]) # get the last curve # get dimension if 'd' in summary: d = summary['d'] else: d, n0 = np.shape(X0) if 'n' in summary: n = summary['n'] else: d, n = np.shape(X0) X0 = X0.reshape((d, n)) # correct dimensions center_curve, mu = srvf.center_curve(X0) scenter_curve, scale = srvf.scale_curve(center_curve) latex = make_latex_report_header('figures') for inputfile in inputfiles: summary = mp.load_result(inputfile) if result_passes_filter(summary, param_name, param_min, param_max): #print summary.keys() if 'uuid' in summary: print(summary['uuid']) if 'E_evol' in summary: energy.append(summary['E_evol']) #print summary.keys() if 'X_evol' in summary: X0 = np.array(summary['X_evol'][-1]) # get the last curve # get dimension if 'd' in summary: d = summary['d'] else: d, n = np.shape(X0) if 'n' in summary: n = summary['n'] else: d, n = np.shape(X0) X0 = X0.reshape((d, n)) # correct dimensions curves.append(X0) length.append(n) curve, mu = srvf.center_curve(X0) scurve, scale = srvf.scale_curve(curve) scurves.append(scurve) scurve, rot = srvf.find_best_rotation(scenter_curve, scurve) scurves[-1] = scurve weight_uniform_spacing = None if "weight_uniform_spacing" in summary: weight_uniform_spacing = summary['weight_uniform_spacing'] weight_smoothing = None if "weight_smoothing" in summary: weight_smoothing = summary['weight_smoothing'] weight_population_prior = None if "weight_population_prior" in summary: weight_population_prior = summary['weight_population_prior'] computation_time = None if "computation_time" in summary: computation_time = summary['computation_time'] nonspecified_zeros_as_missing = None if "nonspecified_zeros_as_missing" in summary: nonspecified_zeros_as_missing = summary[ 'nonspecified_zeros_as_missing'] if 'initialized_curve' in summary: X0 = np.array( summary['initialized_curve']) # get the last curve # get dimension if 'd' in summary: d = summary['d'] else: d, n = np.shape(X0) if 'n' in summary: n = summary['n'] else: d, n = np.shape(X0) X0 = X0.reshape((d, n)) # correct dimensions curves.append(X0) length.append(n) curve, mu = srvf.center_curve(X0) scurve, scale = srvf.scale_curve(curve) scurves_init.append(scurve) scurve, rot = srvf.find_best_rotation(scenter_curve, scurve) scurves_init[-1] = scurve plt.close('all') fig1 = plt.figure() plt.figure(fig1.number) plt.plot(energy[-1]) plt.title("Energy Evolution") fig3 = plt.figure() plt.subplots_adjust(left=0.0, right=1.0, bottom=0.0, top=1.0, wspace=0.0, hspace=0.0) #fig2.tight_layout() ax3 = fig3.add_subplot(111, projection='3d') ax3.set_axis_off() (m, n) = np.shape(scurves_init[-1]) t = np.linspace(0, 1, n) pt.plot_curve(scurves_init[-1], t, ax=ax3, fig=fig3) pt.plot_pts(scurves_init[-1], t, ax=ax3, fig=fig3) plt.title("Initialized Curve") plt.figure(fig3.number) fig2 = plt.figure() plt.subplots_adjust(left=0.0, right=1.0, bottom=0.0, top=1.0, wspace=0.0, hspace=0.0) #fig2.tight_layout() ax2 = fig2.add_subplot(111, projection='3d') ax2.set_axis_off() (m, n) = np.shape(scurves[-1]) t = np.linspace(0, 1, n) pt.plot_curve(scurves[-1], t, ax=ax2, fig=fig2) pt.plot_pts(scurves[-1], t, ax=ax2, fig=fig2) plt.figure(fig2.number) plt.title("Estimated Curve") if not print_each: plt.show() if print_each: if image_ext not in ["png", 'pdf', 'svg', 'ps', 'eps']: print('invalid image format:' + image_ext) else: base = os.path.basename(inputfile) base = base.split('.')[0] image_name_tmp = os.path.join(image_directory, base) print(image_name_tmp) try: fig1.savefig(image_name_tmp + '_energies.' + image_ext) fig3.savefig(image_name_tmp + '_initial_curves.' + image_ext) fig2.savefig(image_name_tmp + '_estimated_curves.' + image_ext) if latex_print: params = dict() params['inputfile'] = inputfile params['table width'] = 3 params['images'] = [ base + '_energies.' + image_ext, base + '_initial_curves.' + image_ext, base + '_estimated_curves.' + image_ext ] params['statistics'] = { 'Final Energy': energy[-1][-1], 'Total Iterations': len(energy[-1]), 'Total Computation Time': computation_time, 'Uniform Spacing Penalty': weight_uniform_spacing, 'Smoothing Penalty': weight_smoothing, 'Population Penalty': weight_population_prior, 'Nonspecified Zeros As Missing': nonspecified_zeros_as_missing } latex_table = make_latex_table(params) latex += latex_table except: print("unable to create image for:" + inputfile) if latex_print: latex += make_latex_report_footer() print(latex) with open(os.path.join(report_directory, summary_name + '.tex'), 'w') as result: result.write(latex)
def main(args=None): """ main function for the simba3d display command line utility """ if args is None: args = sys.argv[:] ii = 1 report_directory = '.' image_ext = 'png' summary_name = 'tasks_summary' print_each = False latex_print = False colormap_name = 'pink' p = 100 while ii < len(args): print(args[ii]) if (args[ii] == '-h') | (args[ii] == '--help'): printhelp() sys.exit() if (args[ii] == '-p') | (args[ii] == '--print-each'): ii += 1 summary_name = str(args[ii]) print('\t' + args[ii]) print_each = True latex_print = True if (args[ii] == '-o') | (args[ii] == '--output-directory'): ii += 1 report_directory = str(args[ii]) print('\t' + args[ii]) print_each = True latex_print = True if (args[ii] == '-f') | (args[ii] == '--format'): ii += 1 image_ext = str(args[ii]) print('\t' + args[ii]) print_each = True latex_print = True if (args[ii] == '-c') | (args[ii] == '--colormap'): ii += 1 colormap_name = str(args[ii]) print('\t' + args[ii]) if (args[ii] == '-i') | (args[ii] == '--input-files'): inputfiles = [] ii += 1 while ii < len(args): inputfiles.append(args[ii]) print('\t' + args[ii]) ii += 1 ii += 1 image_directory = os.path.join(report_directory, 'figures') # create the report directory if it does not exist if print_each: try: if not os.path.exists(report_directory): os.mkdir(report_directory) print("Directory ", report_directory, " Created ") if not os.path.exists(image_directory): os.mkdir(image_directory) print("Directory ", image_directory, " Created ") except: print("Potentially failed to create report directories") latex = lr.make_latex_report_header('figures') tasks = [] scenter_curve = None for inputfile in inputfiles: curves = [] scurves = [] scurves_init = [] length = [] energy = [] print('Reading:' + inputfile) basename = os.path.basename(inputfile) filepath = os.path.dirname(inputfile) latex += r'\pagebreak' + u'\n' latex += lr.make_latex_section('Task Summary', inputfile) with open(inputfile, 'r') as tasklist: tasks = json.load(tasklist) number_of_tasks = str(len(tasks)) number_of_tasks_remaining = str(len(check_tasks_index( tasks))) # find which tasks still need to run for task in tasks: index_remaining = check_tasks_index(task) number_of_subtasks = str(len(task)) number_of_subtasks_remaining = str(len(check_tasks_index( task))) # find which tasks still need to run for subtask in task: UUID = None if 'uuid' in subtask: UUID = subtask['uuid'] latex += lr.make_latex_subsection('Subtask Summary', UUID) if UUID is None: UUID = str(uuid.uuid4()) matrix_files = [] is_sparse = [] initialized_curve_files = [] data = load_data(subtask) # # get the file input names latex += r'\subsubsection{Inputs}' + u'\n' if 'file_names' in subtask: inputdir = '.' if 'inputdir' in subtask['file_names']: inputdir = subtask['file_names']['inputdir'] input_parameters = '' for key in subtask.keys(): skip = 'data' in key skip += 'file_names' in key if skip == 0: if type(subtask[key]) == type(dict()): for subkey in subtask[key].keys(): if type(subtask[key][subkey]) == type( dict()): for subsubkey in subtask[key][ subkey].keys(): name = key + ' ' + subkey + ' ' + subsubkey input_parameters += name + ':' + str( subtask[key][subkey] [subsubkey]) + u'\n' else: name = key + ' ' + subkey input_parameters += name + ':' + str( subtask[key][subkey]) + u'\n' else: name = key input_parameters += name + ':' + str( subtask[key]) + u'\n' latex += lr.make_latex_table( {'inputfile': input_parameters}) for key in subtask['file_names'].keys(): if 'output' not in key: params = dict() params['inputfile'] = key + ':' + subtask[ 'file_names'][key] params['table width'] = 2 if key in data: filename = UUID + key if 'initialized_curve' in key: curve, mu = srvf.center_curve( data[key]) scurve, scale = srvf.scale_curve(curve) if scenter_curve is None: scenter_curve = scurve else: scurve, rot = srvf.find_best_rotation( scenter_curve, scurve) fig3 = plt.figure() plt.subplots_adjust(left=0.0, right=1.0, bottom=0.0, top=1.0, wspace=0.0, hspace=0.0) #fig2.tight_layout() ax3 = fig3.add_subplot(111, projection='3d') ax3.set_axis_off() (m, n) = np.shape(scurve) t = np.linspace(0, 1, n) pt.plot_curve(scurve, t, ax=ax3, fig=fig3) pt.plot_pts(scurve, t, ax=ax3, fig=fig3) plt.title("Initialized Curve") if not print_each: plt.show() else: imagename = os.path.join( image_directory, filename + '.' + image_ext) fig3.savefig(imagename) params['images'] = [ filename + '.' + image_ext ] params['statistics'] = { 'm': str(m), 'n': str(n), } if '_matrix' in key: # you have a matrix if 'sparse_' in key: # it is sparse matrix = data[key].todense() else: # it is not sparse matrix = data[key] q = np.percentile(matrix, p) plt.close('all') fig1 = plt.figure() plt.figure(fig1.number) plt.imshow(matrix, colormap_name) plt.clim([0, q]) plt.colorbar() if not print_each: plt.show() else: imagename = os.path.join( image_directory, filename + '.' + image_ext) fig1.savefig(imagename) (m, n) = np.shape(matrix) params['images'] = [ filename + '.' + image_ext ] params['statistics'] = { 'Row Length': str(m), 'Column Length': str(n), 'Total Entries': str(n * m), 'Non-zero Entries': str(np.sum(matrix > 0)), 'Sum': str(np.sum(matrix)), 'Max': str(np.max(matrix)), 'Non-trivial Rows': str(np.sum( sum(matrix > 0) > 0)) } latex += lr.make_latex_table(params) # summarize input files\ latex += r'\subsubsection{Results}' + u'\n' summary = mp.load_result(get_outputfilepath(subtask)) if not summary: latex += u'No output result file found.\n' else: if 'uuid' in summary: print(summary['uuid']) if 'E_evol' in summary: energy.append(summary['E_evol']) #print summary.keys() if 'X_evol' in summary: X0 = np.array( summary['X_evol'][-1]) # get the last curve # get dimension if 'd' in summary: d = summary['d'] else: d, n = np.shape(X0) if 'n' in summary: n = summary['n'] else: d, n = np.shape(X0) X0 = X0.reshape((d, n)) # correct dimensions curves.append(X0) length.append(n) curve, mu = srvf.center_curve(X0) scurve, scale = srvf.scale_curve(curve) scurves.append(scurve) scurve, rot = srvf.find_best_rotation( scenter_curve, scurve) scurves[-1] = scurve weight_uniform_spacing = None if "weight_uniform_spacing" in summary: weight_uniform_spacing = summary[ 'weight_uniform_spacing'] weight_smoothing = None if "weight_smoothing" in summary: weight_smoothing = summary['weight_smoothing'] weight_population_prior = None if "weight_population_prior" in summary: weight_population_prior = summary[ 'weight_population_prior'] computation_time = None if "computation_time" in summary: computation_time = summary['computation_time'] if 'initialized_curve' in summary: X0 = np.array(summary['initialized_curve'] ) # get the last curve # get dimension if 'd' in summary: d = summary['d'] else: d, n = np.shape(X0) if 'n' in summary: n = summary['n'] else: d, n = np.shape(X0) X0 = X0.reshape((d, n)) # correct dimensions curves.append(X0) length.append(n) curve, mu = srvf.center_curve(X0) scurve, scale = srvf.scale_curve(curve) scurves_init.append(scurve) scurve, rot = srvf.find_best_rotation( scenter_curve, scurve) scurves_init[-1] = scurve plt.close('all') fig1 = plt.figure() plt.figure(fig1.number) plt.plot(energy[-1]) plt.title("Energy Evolution") fig3 = plt.figure() plt.subplots_adjust(left=0.0, right=1.0, bottom=0.0, top=1.0, wspace=0.0, hspace=0.0) #fig2.tight_layout() ax3 = fig3.add_subplot(111, projection='3d') ax3.set_axis_off() (m, n) = np.shape(scurves_init[-1]) t = np.linspace(0, 1, n) pt.plot_curve(scurves_init[-1], t, ax=ax3, fig=fig3) pt.plot_pts(scurves_init[-1], t, ax=ax3, fig=fig3) plt.title("Initialized Curve") plt.figure(fig3.number) fig2 = plt.figure() plt.subplots_adjust(left=0.0, right=1.0, bottom=0.0, top=1.0, wspace=0.0, hspace=0.0) #fig2.tight_layout() ax2 = fig2.add_subplot(111, projection='3d') ax2.set_axis_off() (m, n) = np.shape(scurves[-1]) t = np.linspace(0, 1, n) pt.plot_curve(scurves[-1], t, ax=ax2, fig=fig2) pt.plot_pts(scurves[-1], t, ax=ax2, fig=fig2) plt.figure(fig2.number) plt.title("Estimated Curve") if not print_each: plt.show() else: fig1.savefig( os.path.join( image_directory, UUID + '_energies.' + image_ext)) fig3.savefig( os.path.join( image_directory, UUID + '_initial_curves.' + image_ext)) fig2.savefig( os.path.join( image_directory, UUID + '_estimated_curves.' + image_ext)) if latex_print: params = dict() params['inputfile'] = get_outputfilepath( subtask) params['table width'] = 3 params['images'] = [ UUID + '_energies.' + image_ext, UUID + '_initial_curves.' + image_ext, UUID + '_estimated_curves.' + image_ext ] params['statistics'] = { 'Final Energy': energy[-1][-1], 'Total Iterations': len(energy[-1]), 'Total Computation Time': computation_time, } latex_table = lr.make_latex_table(params) latex += latex_table if latex_print: latex += r'\end{document}' + u'\n' print(latex) with open(os.path.join(report_directory, summary_name + '.tex'), 'w') as result: result.write(latex)