Created
March 19, 2019 09:20
-
-
Save killxin/830001db7266d19c9c8a87d48e414f55 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| df = pd.read_excel('/Users/rhjiang/IdeaProjects/nlp2model/out/res2.xlsx', sheet_name='Sheet1') | |
| print("Column headings:") | |
| print(df.columns) | |
| tcons = [] | |
| tcode = [] | |
| candidate = [] | |
| valid = [] | |
| time = [] | |
| for i in df.index: | |
| if df['#Candidate'][i] < 200000: | |
| candidate.append(df['#Candidate'][i]) | |
| else: | |
| candidate.append(200001) | |
| valid.append(df['#Valid'][i]) | |
| time.append(df['Time (ms)'][i]/1000) | |
| if df['isSubject'][i] and df['#Tcons'][i] != 0 and df['#Tcode'][i] != 0 and df['Correct'][i]: | |
| tcons.append(df['#Tcons'][i]) | |
| tcode.append(df['#Tcode'][i]) | |
| print(tcons) | |
| print(tcode) | |
| print(time) | |
| fig, axes = plt.subplots(nrows=4) | |
| # the histogram of the data | |
| ax0, ax1, ax2, ax3 = axes.flatten() | |
| _, _, patches = ax0.hist([tcons,tcode], 10, histtype='bar', align="mid", color = ['black', 'gray'], label=['#TCons','#TCode']) | |
| ax0.set_xlabel('#T') | |
| ax0.set_ylabel('#Correct') | |
| ax0.set_title('Test Case Number Distributions') | |
| fig.tight_layout() | |
| for i in range(0,2): | |
| for b in patches[i]: | |
| h = b.get_height() | |
| if h > 0: | |
| ax0.text(b.get_x()+b.get_width()/2, h, '%d'%int (h),ha='center',va='bottom') | |
| ax0.legend() | |
| plt.sca(ax0) | |
| plt.xticks(np.arange(0, 101, 10)) | |
| _, _, patches = ax1.hist(candidate, 20, histtype='bar', align="mid", color='black', label='#Candidate') | |
| ax1.set_xlabel('#Candidate') | |
| ax1.set_ylabel('#TM') | |
| ax1.set_title('Candidate OCL Distributions') | |
| for b in patches: | |
| h = b.get_height() | |
| if h > 0: | |
| ax1.text(b.get_x()+b.get_width()/2, h, '%d'%int (h),ha='center',va='bottom') | |
| plt.sca(ax1) | |
| plt.xticks(np.arange(0, 200000, 25000)) | |
| _, _, patches = ax2.hist(valid, np.arange(0,35,1), histtype='bar', align="mid", color='black', label='#Valid') | |
| ax2.set_xlabel('#Valid') | |
| ax2.set_ylabel('#TM') | |
| ax2.set_title('Valid OCL Distribution') | |
| for b in patches: | |
| h = b.get_height() | |
| if h > 0: | |
| ax2.text(b.get_x()+b.get_width()/2, h, '%d'%int (h),ha='center',va='bottom') | |
| plt.sca(ax2) | |
| plt.xticks(np.arange(0, 36, 5)) | |
| _, _, patches = ax3.hist(time, np.arange(0,250,12.5), histtype='bar', align="mid", color='black', label='Time(s)') | |
| ax3.set_xlabel('Time(s)') | |
| ax3.set_ylabel('#TM') | |
| ax3.set_title('Generating Time') | |
| for b in patches: | |
| h = b.get_height() | |
| if h > 0: | |
| ax3.text(b.get_x()+b.get_width()/2, h, '%d'%int (h),ha='center',va='bottom') | |
| plt.sca(ax3) | |
| plt.xticks(np.arange(0, 250, 25)) | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment