Skip to content

Commit 3d59deb

Browse files
committed
Print program name when using the database.
1 parent b1a9bf9 commit 3d59deb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ocr_utils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ class DataSets(object):
408408
5) construct training and test set TruthedCharacters classes and return them
409409
'''
410410
engine_type = engine_type.lower()
411-
411+
print (program_name())
412412
print('\nparameter: input_filters_dict\n\t{}'.format(input_filters_dict))
413413
print('parameter: output_feature_list\n\t{}'.format(output_feature_list))
414414

@@ -684,6 +684,10 @@ def compute_column_sum(npx,h,w):
684684
################# Miscellaneous Plot Routines ##############################
685685

686686
num_fig = 0 # used to give each saved plot a unique name
687+
def program_name():
688+
pg = sys.argv[0]
689+
pg2 = os.path.split(pg)
690+
return os.path.splitext(pg2[1])[0]
687691

688692
def show_figures(plt, title="untitled"):
689693
'''
@@ -717,10 +721,7 @@ def show_figures(plt, title="untitled"):
717721
os.mkdir(plot_dir)
718722
except:
719723
pass
720-
pg = sys.argv[0]
721-
pg2 = os.path.split(pg)
722-
pg3 = os.path.splitext(pg2[1])[0]
723-
save_file_name= '{}/{}_{}_{}.png'.format(plot_dir, pg3, num_fig, title)
724+
save_file_name= '{}/{}_{}_{}.png'.format(plot_dir, program_name(), num_fig, title)
724725
plt.savefig(save_file_name, dpi=300)
725726
plt.clf() # savefig does not clear the figure like show does
726727
plt.cla()

0 commit comments

Comments
 (0)