Mercurial > hg > webaudioevaluationtool
comparison python/generate_report.py @ 2946:c496aef6448b
Quick fixes; generate_report.py: prepend zero for single digit minute/second values in time
author | Brecht De Man <b.deman@qmul.ac.uk> |
---|---|
date | Fri, 13 Oct 2017 14:19:22 +0200 |
parents | c0854362d09d |
children | aa86f045d338 |
comparison
equal
deleted
inserted
replaced
2945:142df41a1aeb | 2946:c496aef6448b |
---|---|
150 hour = time_node.get("hour") | 150 hour = time_node.get("hour") |
151 minute = time_node.get("minute") | 151 minute = time_node.get("minute") |
152 second = time_node.get("secs") | 152 second = time_node.get("secs") |
153 date_array.append((int(year),int(month),int(day),\ | 153 date_array.append((int(year),int(month),int(day),\ |
154 int(hour),int(minute),int(second))) | 154 int(hour),int(minute),int(second))) |
155 | |
156 # prepend zero if needed | |
157 minute_string = str(minute) if int(minute)>9 else "0"+str(minute) | |
158 second_string = str(second) if int(second)>9 else "0"+str(second) | |
155 | 159 |
156 # date as section title | 160 # date as section title |
157 body = '\n\section{'+day+' '+month_array[int(month)-1]+' '+year+' '+hour+':'+minute+':'+second+'}\n' | 161 body = '\n\section{'+day+' '+month_array[int(month)-1]+' '+year+' '+hour+':'+\ |
162 minute_string+':'+second_string+'}\n' | |
158 | 163 |
159 # file name | 164 # file name |
160 body += '\t\tFile: '+file[:-4]+'\\\\ \n' | 165 body += '\t\tFile: '+file[:-4]+'\\\\ \n' |
161 | 166 |
162 # reset for new subject | 167 # reset for new subject |
445 yint = np.arange(int(np.floor(ylims[0])), int(np.ceil(ylims[1]))+1) | 450 yint = np.arange(int(np.floor(ylims[0])), int(np.ceil(ylims[1]))+1) |
446 plt.yticks(yint) | 451 plt.yticks(yint) |
447 plt.savefig(folder_name+"subjects_per_page.pdf", bbox_inches='tight') | 452 plt.savefig(folder_name+"subjects_per_page.pdf", bbox_inches='tight') |
448 plt.close() | 453 plt.close() |
449 | 454 |
450 # SHOW both figures | 455 # SHOW these figures |
451 body += r''' | 456 body += r''' |
452 \begin{figure}[htbp] | 457 \begin{figure}[htbp] |
453 \begin{center} | 458 \begin{center} |
454 \includegraphics[width=.65\textwidth]{'''+\ | 459 \includegraphics[width=.65\textwidth]{'''+\ |
455 folder_name+'time_per_order.pdf'+\ | 460 folder_name+'time_per_order.pdf'+\ |
484 ''' | 489 ''' |
485 #TODO add error bars | 490 #TODO add error bars |
486 #TODO layout of figures | 491 #TODO layout of figures |
487 | 492 |
488 # SHOW boxplot per page (in alphabetical order of page name) | 493 # SHOW boxplot per page (in alphabetical order of page name) |
494 #TODO get scale names (now hardcoded 'preference' automatically) | |
489 body += '\t\t\\clearpage \n\t\\subsection*{Ratings per page}\n' | 495 body += '\t\t\\clearpage \n\t\\subsection*{Ratings per page}\n' |
490 for page_name in sorted(page_names): # get each name | 496 for page_name in sorted(page_names): # get each name |
491 # plot boxplot if exists (not so for the 'alt' names) | 497 # plot boxplot if exists (not so for the 'alt' names) |
492 if os.path.isfile(folder_name+'ratings/'+page_name+'-ratings-box.pdf'): | 498 if os.path.isfile(folder_name+'ratings/'+page_name+'-preference-ratings-box.pdf'): |
493 body += r'''\begin{figure}[H] | 499 body += r'''\begin{figure}[H] |
494 \begin{center} | 500 \begin{center} |
495 \includegraphics[width=.65\textwidth]{'''+\ | 501 \includegraphics[width=.65\textwidth]{'''+\ |
496 folder_name+"ratings/"+page_name+'-ratings-box.pdf'+\ | 502 folder_name+"ratings/"+page_name+'-preference-ratings-box.pdf'+\ |
497 r'''} | 503 r'''} |
498 \caption{Box plot of ratings for page '''+\ | 504 \caption{Box plot of ratings for page '''+\ |
499 page_name+' ('+str(subject_count[real_page_names.index(page_name)])+\ | 505 page_name+' ('+str(subject_count[real_page_names.index(page_name)])+\ |
500 ''' participants).} | 506 ''' participants).} |
501 \label{fig:boxplot'''+page_name.replace(" ", "")+'''} | 507 \label{fig:boxplot'''+page_name.replace(" ", "")+'''} |