Mercurial > hg > webaudioevaluationtool
diff scripts/score_plot.py @ 1066:a2a245542ae6
Scripts: test if folder name (default or provided via command line) exists
author | Brecht De Man <BrechtDeMan@users.noreply.github.com> |
---|---|
date | Tue, 11 Aug 2015 10:15:17 +0200 |
parents | b2492aeafe8b |
children | 8d0061336b90 |
line wrap: on
line diff
--- a/scripts/score_plot.py Mon Aug 10 18:45:45 2015 +0200 +++ b/scripts/score_plot.py Tue Aug 11 10:15:17 2015 +0200 @@ -55,9 +55,10 @@ print " Enables plot of individual ratings" print "" print "PLOT OPTIONS" - print " legend | -l" + print " leg | legend | -l" print " For individual plot: show legend with individual file names" - print " " + print " numeric value between 0 and 1, e.g. 0.95" + print " For confidence interval plot: confidence value" assert False, ""# stop immediately after showing help #TODO cleaner way # PLOT TYPES @@ -81,6 +82,8 @@ "confidence plot is enabled" if float(arg)>0 and float(arg)<1: confidence = float(arg) + else: + print "WARNING: The confidence value needs to be between 0 and 1" # FOLDER NAME else: @@ -92,11 +95,18 @@ if not enable_boxplot and not enable_confidence and not enable_individual: enable_boxplot = True +# check if folder_name exists +if not os.path.exists(rating_folder): + #the file is not there + print "Folder '"+rating_folder+"' does not exist." + sys.exit() # terminate script execution +elif not os.access(os.path.dirname(rating_folder), os.W_OK): + #the file does exist but write rating_folder are not given + print "No write privileges in folder '"+rating_folder+"'." + + # CONFIGURATION -# Enter folder where rating CSV files are (generated with score_parser.py or same format). -rating_folder = '../saves/ratings/' # folder with rating csv files - # Font settings font = {'weight' : 'bold', 'size' : 10}