badaoui HF Staff commited on
Commit
b057ebe
·
verified ·
1 Parent(s): cfef316

updating time_series.py

Browse files
Files changed (1) hide show
  1. time_series.py +156 -108
time_series.py CHANGED
@@ -4,32 +4,29 @@ import numpy as np
4
  from datetime import datetime
5
  from data import extract_model_data
6
 
7
- # Colors matching the existing theme
8
  COLORS = {
9
  'passed': '#4CAF50',
10
  'failed': '#E53E3E',
11
  'skipped': '#FFD54F',
12
- 'error': '#8B0000'
 
 
13
  }
14
 
15
- # Figure dimensions
16
  FIGURE_WIDTH = 20
17
  FIGURE_HEIGHT = 12
18
 
19
- # Styling constants
20
  BLACK = '#000000'
21
  LABEL_COLOR = '#CCCCCC'
22
  TITLE_COLOR = '#FFFFFF'
23
  GRID_COLOR = '#333333'
24
 
25
- # Font sizes
26
  TITLE_FONT_SIZE = 24
27
  LABEL_FONT_SIZE = 14
28
  LEGEND_FONT_SIZE = 12
29
 
30
 
31
  def create_time_series_summary(historical_df: pd.DataFrame) -> plt.Figure:
32
- """Create time-series visualization for overall failure rates over time."""
33
  if historical_df.empty or 'date' not in historical_df.columns:
34
  fig, ax = plt.subplots(figsize=(FIGURE_WIDTH, FIGURE_HEIGHT), facecolor=BLACK)
35
  ax.set_facecolor(BLACK)
@@ -40,23 +37,17 @@ def create_time_series_summary(historical_df: pd.DataFrame) -> plt.Figure:
40
  ax.axis('off')
41
  return fig
42
 
43
- # Convert date column to datetime
44
  historical_df['date_dt'] = pd.to_datetime(historical_df['date'])
45
  historical_df = historical_df.sort_values('date_dt')
46
 
47
- # Group by date and calculate overall statistics
48
  daily_stats = []
49
  dates = []
50
 
51
  for date in historical_df['date_dt'].unique():
52
  date_data = historical_df[historical_df['date_dt'] == date]
53
 
54
- total_amd_passed = 0
55
- total_amd_failed = 0
56
- total_amd_skipped = 0
57
- total_nvidia_passed = 0
58
- total_nvidia_failed = 0
59
- total_nvidia_skipped = 0
60
 
61
  for _, row in date_data.iterrows():
62
  amd_stats, nvidia_stats = extract_model_data(row)[:2]
@@ -64,12 +55,10 @@ def create_time_series_summary(historical_df: pd.DataFrame) -> plt.Figure:
64
  total_amd_passed += amd_stats['passed']
65
  total_amd_failed += amd_stats['failed']
66
  total_amd_skipped += amd_stats['skipped']
67
-
68
  total_nvidia_passed += nvidia_stats['passed']
69
  total_nvidia_failed += nvidia_stats['failed']
70
  total_nvidia_skipped += nvidia_stats['skipped']
71
 
72
- # Calculate failure rates
73
  amd_total = total_amd_passed + total_amd_failed
74
  nvidia_total = total_nvidia_passed + total_nvidia_failed
75
 
@@ -88,95 +77,113 @@ def create_time_series_summary(historical_df: pd.DataFrame) -> plt.Figure:
88
  })
89
  dates.append(date)
90
 
91
- # Create the plot with 3 subplots: failure rates, AMD stacked, NVIDIA stacked
92
- fig, (ax1, ax2, ax3) = plt.subplots(3, 1, figsize=(FIGURE_WIDTH, FIGURE_HEIGHT + 4), facecolor=BLACK)
93
- ax1.set_facecolor(BLACK)
94
- ax2.set_facecolor(BLACK)
95
- ax3.set_facecolor(BLACK)
 
 
 
 
 
 
96
 
97
- # Plot 1: Failure rates over time
98
  dates_array = np.array(dates)
99
  amd_rates = [stat['amd_failure_rate'] for stat in daily_stats]
100
  nvidia_rates = [stat['nvidia_failure_rate'] for stat in daily_stats]
101
 
102
- ax1.plot(dates_array, amd_rates, color='#FF6B6B', linewidth=3, label='AMD', marker='o', markersize=6)
103
- ax1.plot(dates_array, nvidia_rates, color='#4ECDC4', linewidth=3, label='NVIDIA', marker='s', markersize=6)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
- ax1.set_title('Overall Failure Rates Over Time', fontsize=TITLE_FONT_SIZE, color=TITLE_COLOR,
106
- fontfamily='monospace', fontweight='bold', pad=20)
107
  ax1.set_ylabel('Failure Rate (%)', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
108
  ax1.grid(True, color=GRID_COLOR, alpha=0.3, linestyle='-', linewidth=0.5)
109
  ax1.legend(fontsize=LEGEND_FONT_SIZE, loc='upper right', frameon=False,
110
  labelcolor=LABEL_COLOR, prop={'family': 'monospace'})
 
111
 
112
- # Format x-axis
113
- ax1.tick_params(colors=LABEL_COLOR, labelsize=LABEL_FONT_SIZE)
114
- ax1.xaxis.label.set_color(LABEL_COLOR)
115
- ax1.yaxis.label.set_color(LABEL_COLOR)
116
-
117
- # Plot 2: AMD Test counts over time (stacked area chart)
118
  amd_passed = [stat['amd_passed'] for stat in daily_stats]
119
  amd_failed = [stat['amd_failed'] for stat in daily_stats]
120
  amd_skipped = [stat['amd_skipped'] for stat in daily_stats]
121
 
122
- ax2.fill_between(dates_array, 0, amd_passed, color=COLORS['passed'], alpha=0.7, label='Passed')
123
- ax2.fill_between(dates_array, amd_passed, np.array(amd_passed) + np.array(amd_failed),
124
- color=COLORS['failed'], alpha=0.7, label='Failed')
125
- ax2.fill_between(dates_array, np.array(amd_passed) + np.array(amd_failed),
126
- np.array(amd_passed) + np.array(amd_failed) + np.array(amd_skipped),
127
- color=COLORS['skipped'], alpha=0.7, label='Skipped')
128
 
129
- ax2.set_title('AMD Test Results Over Time', fontsize=TITLE_FONT_SIZE, color=TITLE_COLOR,
130
- fontfamily='monospace', fontweight='bold', pad=20)
131
- ax2.set_ylabel('Number of Tests', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
132
  ax2.grid(True, color=GRID_COLOR, alpha=0.3, linestyle='-', linewidth=0.5)
133
- ax2.legend(fontsize=LEGEND_FONT_SIZE, loc='upper right', frameon=False,
134
- labelcolor=LABEL_COLOR, prop={'family': 'monospace'})
135
-
136
- # Format x-axis
137
- ax2.tick_params(colors=LABEL_COLOR, labelsize=LABEL_FONT_SIZE)
138
- ax2.xaxis.label.set_color(LABEL_COLOR)
139
- ax2.yaxis.label.set_color(LABEL_COLOR)
140
 
141
- # Plot 3: NVIDIA Test counts over time (stacked area chart)
142
  nvidia_passed = [stat['nvidia_passed'] for stat in daily_stats]
143
  nvidia_failed = [stat['nvidia_failed'] for stat in daily_stats]
144
  nvidia_skipped = [stat['nvidia_skipped'] for stat in daily_stats]
145
 
146
- ax3.fill_between(dates_array, 0, nvidia_passed, color=COLORS['passed'], alpha=0.7, label='Passed')
147
- ax3.fill_between(dates_array, nvidia_passed, np.array(nvidia_passed) + np.array(nvidia_failed),
148
- color=COLORS['failed'], alpha=0.7, label='Failed')
149
- ax3.fill_between(dates_array, np.array(nvidia_passed) + np.array(nvidia_failed),
150
- np.array(nvidia_passed) + np.array(nvidia_failed) + np.array(nvidia_skipped),
151
- color=COLORS['skipped'], alpha=0.7, label='Skipped')
152
 
153
- ax3.set_title('NVIDIA Test Results Over Time', fontsize=TITLE_FONT_SIZE, color=TITLE_COLOR,
154
- fontfamily='monospace', fontweight='bold', pad=20)
155
- ax3.set_ylabel('Number of Tests', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
156
  ax3.set_xlabel('Date', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
157
  ax3.grid(True, color=GRID_COLOR, alpha=0.3, linestyle='-', linewidth=0.5)
158
- ax3.legend(fontsize=LEGEND_FONT_SIZE, loc='upper right', frameon=False,
159
- labelcolor=LABEL_COLOR, prop={'family': 'monospace'})
160
-
161
- # Format x-axis
162
- ax3.tick_params(colors=LABEL_COLOR, labelsize=LABEL_FONT_SIZE)
163
- ax3.xaxis.label.set_color(LABEL_COLOR)
164
- ax3.yaxis.label.set_color(LABEL_COLOR)
165
-
166
- # Rotate x-axis labels for better readability
167
- for ax in [ax1, ax2, ax3]:
168
- ax.tick_params(axis='x', rotation=45)
169
-
170
- plt.tight_layout()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
 
172
- # Close any existing figures to prevent memory issues
173
  plt.close('all')
174
-
175
  return fig
176
 
177
 
178
  def create_model_time_series(historical_df: pd.DataFrame, model_name: str) -> plt.Figure:
179
- """Create time-series visualization for a specific model."""
180
  if historical_df.empty or 'date' not in historical_df.columns:
181
  fig, ax = plt.subplots(figsize=(FIGURE_WIDTH, FIGURE_HEIGHT), facecolor=BLACK)
182
  ax.set_facecolor(BLACK)
@@ -187,7 +194,6 @@ def create_model_time_series(historical_df: pd.DataFrame, model_name: str) -> pl
187
  ax.axis('off')
188
  return fig
189
 
190
- # Filter data for the specific model
191
  model_data = historical_df[historical_df.index.str.lower() == model_name.lower()]
192
 
193
  if model_data.empty:
@@ -200,12 +206,10 @@ def create_model_time_series(historical_df: pd.DataFrame, model_name: str) -> pl
200
  ax.axis('off')
201
  return fig
202
 
203
- # Convert date column to datetime and sort
204
  model_data = model_data.copy()
205
  model_data['date_dt'] = pd.to_datetime(model_data['date'])
206
  model_data = model_data.sort_values('date_dt')
207
 
208
- # Extract statistics for each date
209
  dates = model_data['date_dt'].values
210
  amd_stats_list = []
211
  nvidia_stats_list = []
@@ -215,54 +219,98 @@ def create_model_time_series(historical_df: pd.DataFrame, model_name: str) -> pl
215
  amd_stats_list.append(amd_stats)
216
  nvidia_stats_list.append(nvidia_stats)
217
 
218
- # Create the plot
219
- fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(FIGURE_WIDTH, FIGURE_HEIGHT), facecolor=BLACK)
220
- ax1.set_facecolor(BLACK)
221
- ax2.set_facecolor(BLACK)
 
 
 
 
 
 
222
 
223
- # Plot 1: AMD results over time
224
  amd_passed = [stats['passed'] for stats in amd_stats_list]
225
  amd_failed = [stats['failed'] for stats in amd_stats_list]
226
  amd_skipped = [stats['skipped'] for stats in amd_stats_list]
227
 
228
- ax1.plot(dates, amd_passed, color=COLORS['passed'], linewidth=3, label='Passed', marker='o', markersize=6)
229
- ax1.plot(dates, amd_failed, color=COLORS['failed'], linewidth=3, label='Failed', marker='s', markersize=6)
230
- ax1.plot(dates, amd_skipped, color=COLORS['skipped'], linewidth=3, label='Skipped', marker='^', markersize=6)
 
 
 
 
231
 
232
- ax1.set_title(f'{model_name.upper()} - AMD Results Over Time', fontsize=TITLE_FONT_SIZE, color=TITLE_COLOR,
233
- fontfamily='monospace', fontweight='bold', pad=20)
234
  ax1.set_ylabel('Number of Tests', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
235
  ax1.grid(True, color=GRID_COLOR, alpha=0.3, linestyle='-', linewidth=0.5)
236
- ax1.legend(fontsize=LEGEND_FONT_SIZE, loc='upper right', frameon=False,
237
  labelcolor=LABEL_COLOR, prop={'family': 'monospace'})
 
238
 
239
- # Plot 2: NVIDIA results over time
240
  nvidia_passed = [stats['passed'] for stats in nvidia_stats_list]
241
  nvidia_failed = [stats['failed'] for stats in nvidia_stats_list]
242
  nvidia_skipped = [stats['skipped'] for stats in nvidia_stats_list]
243
 
244
- ax2.plot(dates, nvidia_passed, color=COLORS['passed'], linewidth=3, label='Passed', marker='o', markersize=6)
245
- ax2.plot(dates, nvidia_failed, color=COLORS['failed'], linewidth=3, label='Failed', marker='s', markersize=6)
246
- ax2.plot(dates, nvidia_skipped, color=COLORS['skipped'], linewidth=3, label='Skipped', marker='^', markersize=6)
247
 
248
- ax2.set_title(f'{model_name.upper()} - NVIDIA Results Over Time', fontsize=TITLE_FONT_SIZE, color=TITLE_COLOR,
249
- fontfamily='monospace', fontweight='bold', pad=20)
 
 
 
 
250
  ax2.set_ylabel('Number of Tests', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
251
  ax2.set_xlabel('Date', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
252
  ax2.grid(True, color=GRID_COLOR, alpha=0.3, linestyle='-', linewidth=0.5)
253
- ax2.legend(fontsize=LEGEND_FONT_SIZE, loc='upper right', frameon=False,
254
- labelcolor=LABEL_COLOR, prop={'family': 'monospace'})
255
-
256
- # Format axes
257
- for ax in [ax1, ax2]:
258
- ax.tick_params(colors=LABEL_COLOR, labelsize=LABEL_FONT_SIZE)
259
- ax.xaxis.label.set_color(LABEL_COLOR)
260
- ax.yaxis.label.set_color(LABEL_COLOR)
261
- ax.tick_params(axis='x', rotation=45)
262
-
263
- plt.tight_layout()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
 
265
- # Close any existing figures to prevent memory issues
266
  plt.close('all')
267
-
268
- return fig
 
4
  from datetime import datetime
5
  from data import extract_model_data
6
 
 
7
  COLORS = {
8
  'passed': '#4CAF50',
9
  'failed': '#E53E3E',
10
  'skipped': '#FFD54F',
11
+ 'error': '#8B0000',
12
+ 'amd': '#ED1C24',
13
+ 'nvidia': '#76B900'
14
  }
15
 
 
16
  FIGURE_WIDTH = 20
17
  FIGURE_HEIGHT = 12
18
 
 
19
  BLACK = '#000000'
20
  LABEL_COLOR = '#CCCCCC'
21
  TITLE_COLOR = '#FFFFFF'
22
  GRID_COLOR = '#333333'
23
 
 
24
  TITLE_FONT_SIZE = 24
25
  LABEL_FONT_SIZE = 14
26
  LEGEND_FONT_SIZE = 12
27
 
28
 
29
  def create_time_series_summary(historical_df: pd.DataFrame) -> plt.Figure:
 
30
  if historical_df.empty or 'date' not in historical_df.columns:
31
  fig, ax = plt.subplots(figsize=(FIGURE_WIDTH, FIGURE_HEIGHT), facecolor=BLACK)
32
  ax.set_facecolor(BLACK)
 
37
  ax.axis('off')
38
  return fig
39
 
 
40
  historical_df['date_dt'] = pd.to_datetime(historical_df['date'])
41
  historical_df = historical_df.sort_values('date_dt')
42
 
 
43
  daily_stats = []
44
  dates = []
45
 
46
  for date in historical_df['date_dt'].unique():
47
  date_data = historical_df[historical_df['date_dt'] == date]
48
 
49
+ total_amd_passed = total_amd_failed = total_amd_skipped = 0
50
+ total_nvidia_passed = total_nvidia_failed = total_nvidia_skipped = 0
 
 
 
 
51
 
52
  for _, row in date_data.iterrows():
53
  amd_stats, nvidia_stats = extract_model_data(row)[:2]
 
55
  total_amd_passed += amd_stats['passed']
56
  total_amd_failed += amd_stats['failed']
57
  total_amd_skipped += amd_stats['skipped']
 
58
  total_nvidia_passed += nvidia_stats['passed']
59
  total_nvidia_failed += nvidia_stats['failed']
60
  total_nvidia_skipped += nvidia_stats['skipped']
61
 
 
62
  amd_total = total_amd_passed + total_amd_failed
63
  nvidia_total = total_nvidia_passed + total_nvidia_failed
64
 
 
77
  })
78
  dates.append(date)
79
 
80
+ fig = plt.figure(figsize=(FIGURE_WIDTH, FIGURE_HEIGHT + 4), facecolor=BLACK)
81
+ gs = fig.add_gridspec(3, 2, height_ratios=[1.2, 1, 1], width_ratios=[2, 1],
82
+ hspace=0.3, wspace=0.25)
83
+
84
+ ax1 = fig.add_subplot(gs[0, :])
85
+ ax2 = fig.add_subplot(gs[1, 0])
86
+ ax3 = fig.add_subplot(gs[2, 0])
87
+ ax4 = fig.add_subplot(gs[1:, 1])
88
+
89
+ for ax in [ax1, ax2, ax3, ax4]:
90
+ ax.set_facecolor(BLACK)
91
 
 
92
  dates_array = np.array(dates)
93
  amd_rates = [stat['amd_failure_rate'] for stat in daily_stats]
94
  nvidia_rates = [stat['nvidia_failure_rate'] for stat in daily_stats]
95
 
96
+ ax1.fill_between(dates_array, 0, amd_rates, color=COLORS['amd'], alpha=0.15)
97
+ ax1.fill_between(dates_array, 0, nvidia_rates, color=COLORS['nvidia'], alpha=0.15)
98
+ ax1.plot(dates_array, amd_rates, color=COLORS['amd'], linewidth=3,
99
+ label='AMD', marker='o', markersize=7, markeredgewidth=2, markeredgecolor=BLACK)
100
+ ax1.plot(dates_array, nvidia_rates, color=COLORS['nvidia'], linewidth=3,
101
+ label='NVIDIA', marker='s', markersize=7, markeredgewidth=2, markeredgecolor=BLACK)
102
+
103
+ if len(amd_rates) > 2:
104
+ z_amd = np.polyfit(range(len(amd_rates)), amd_rates, 1)
105
+ p_amd = np.poly1d(z_amd)
106
+ ax1.plot(dates_array, p_amd(range(len(amd_rates))),
107
+ color=COLORS['amd'], linestyle='--', alpha=0.5, linewidth=2)
108
+
109
+ z_nvidia = np.polyfit(range(len(nvidia_rates)), nvidia_rates, 1)
110
+ p_nvidia = np.poly1d(z_nvidia)
111
+ ax1.plot(dates_array, p_nvidia(range(len(nvidia_rates))),
112
+ color=COLORS['nvidia'], linestyle='--', alpha=0.5, linewidth=2)
113
 
114
+ ax1.set_title('Overall Failure Rates Over Time', fontsize=TITLE_FONT_SIZE,
115
+ color=TITLE_COLOR, fontfamily='monospace', fontweight='bold', pad=20)
116
  ax1.set_ylabel('Failure Rate (%)', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
117
  ax1.grid(True, color=GRID_COLOR, alpha=0.3, linestyle='-', linewidth=0.5)
118
  ax1.legend(fontsize=LEGEND_FONT_SIZE, loc='upper right', frameon=False,
119
  labelcolor=LABEL_COLOR, prop={'family': 'monospace'})
120
+ ax1.tick_params(colors=LABEL_COLOR, labelsize=LABEL_FONT_SIZE, axis='x', rotation=45)
121
 
 
 
 
 
 
 
122
  amd_passed = [stat['amd_passed'] for stat in daily_stats]
123
  amd_failed = [stat['amd_failed'] for stat in daily_stats]
124
  amd_skipped = [stat['amd_skipped'] for stat in daily_stats]
125
 
126
+ ax2.stackplot(dates_array, amd_passed, amd_failed, amd_skipped,
127
+ colors=[COLORS['passed'], COLORS['failed'], COLORS['skipped']],
128
+ alpha=0.8, labels=['Passed', 'Failed', 'Skipped'])
 
 
 
129
 
130
+ ax2.set_title('AMD Test Results', fontsize=TITLE_FONT_SIZE - 2,
131
+ color=TITLE_COLOR, fontfamily='monospace', fontweight='bold', pad=15)
132
+ ax2.set_ylabel('Tests', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
133
  ax2.grid(True, color=GRID_COLOR, alpha=0.3, linestyle='-', linewidth=0.5)
134
+ ax2.tick_params(colors=LABEL_COLOR, labelsize=LABEL_FONT_SIZE - 1, axis='x', rotation=45)
 
 
 
 
 
 
135
 
 
136
  nvidia_passed = [stat['nvidia_passed'] for stat in daily_stats]
137
  nvidia_failed = [stat['nvidia_failed'] for stat in daily_stats]
138
  nvidia_skipped = [stat['nvidia_skipped'] for stat in daily_stats]
139
 
140
+ ax3.stackplot(dates_array, nvidia_passed, nvidia_failed, nvidia_skipped,
141
+ colors=[COLORS['passed'], COLORS['failed'], COLORS['skipped']],
142
+ alpha=0.8, labels=['Passed', 'Failed', 'Skipped'])
 
 
 
143
 
144
+ ax3.set_title('NVIDIA Test Results', fontsize=TITLE_FONT_SIZE - 2,
145
+ color=TITLE_COLOR, fontfamily='monospace', fontweight='bold', pad=15)
146
+ ax3.set_ylabel('Tests', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
147
  ax3.set_xlabel('Date', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
148
  ax3.grid(True, color=GRID_COLOR, alpha=0.3, linestyle='-', linewidth=0.5)
149
+ ax3.tick_params(colors=LABEL_COLOR, labelsize=LABEL_FONT_SIZE - 1, axis='x', rotation=45)
150
+
151
+ latest = daily_stats[-1]
152
+ metrics = [
153
+ ('Latest AMD Failure Rate', f"{latest['amd_failure_rate']:.1f}%", COLORS['amd']),
154
+ ('Latest NVIDIA Failure Rate', f"{latest['nvidia_failure_rate']:.1f}%", COLORS['nvidia']),
155
+ ('', '', None),
156
+ ('Total AMD Tests', str(latest['amd_passed'] + latest['amd_failed'] + latest['amd_skipped']), '#888888'),
157
+ ('Total NVIDIA Tests', str(latest['nvidia_passed'] + latest['nvidia_failed'] + latest['nvidia_skipped']), '#888888'),
158
+ ]
159
+
160
+ ax4.axis('off')
161
+ y_pos = 0.9
162
+ ax4.text(0.5, 0.95, 'SUMMARY', ha='center', va='top', fontsize=TITLE_FONT_SIZE - 2,
163
+ color=TITLE_COLOR, fontfamily='monospace', fontweight='bold',
164
+ transform=ax4.transAxes)
165
+
166
+ for label, value, color in metrics:
167
+ if label:
168
+ ax4.text(0.1, y_pos, label, ha='left', va='center', fontsize=LABEL_FONT_SIZE,
169
+ color=LABEL_COLOR, fontfamily='monospace', transform=ax4.transAxes)
170
+ ax4.text(0.9, y_pos, value, ha='right', va='center', fontsize=LABEL_FONT_SIZE + 2,
171
+ color=color or LABEL_COLOR, fontfamily='monospace', fontweight='bold',
172
+ transform=ax4.transAxes)
173
+ y_pos -= 0.15
174
+
175
+ handles = [plt.Rectangle((0,0),1,1, fc=COLORS['passed'], alpha=0.8),
176
+ plt.Rectangle((0,0),1,1, fc=COLORS['failed'], alpha=0.8),
177
+ plt.Rectangle((0,0),1,1, fc=COLORS['skipped'], alpha=0.8)]
178
+ ax4.legend(handles, ['Passed', 'Failed', 'Skipped'],
179
+ loc='lower center', fontsize=LEGEND_FONT_SIZE,
180
+ frameon=False, labelcolor=LABEL_COLOR, prop={'family': 'monospace'})
181
 
 
182
  plt.close('all')
 
183
  return fig
184
 
185
 
186
  def create_model_time_series(historical_df: pd.DataFrame, model_name: str) -> plt.Figure:
 
187
  if historical_df.empty or 'date' not in historical_df.columns:
188
  fig, ax = plt.subplots(figsize=(FIGURE_WIDTH, FIGURE_HEIGHT), facecolor=BLACK)
189
  ax.set_facecolor(BLACK)
 
194
  ax.axis('off')
195
  return fig
196
 
 
197
  model_data = historical_df[historical_df.index.str.lower() == model_name.lower()]
198
 
199
  if model_data.empty:
 
206
  ax.axis('off')
207
  return fig
208
 
 
209
  model_data = model_data.copy()
210
  model_data['date_dt'] = pd.to_datetime(model_data['date'])
211
  model_data = model_data.sort_values('date_dt')
212
 
 
213
  dates = model_data['date_dt'].values
214
  amd_stats_list = []
215
  nvidia_stats_list = []
 
219
  amd_stats_list.append(amd_stats)
220
  nvidia_stats_list.append(nvidia_stats)
221
 
222
+ fig = plt.figure(figsize=(FIGURE_WIDTH, FIGURE_HEIGHT), facecolor=BLACK)
223
+ gs = fig.add_gridspec(2, 2, height_ratios=[1, 1], width_ratios=[3, 1],
224
+ hspace=0.3, wspace=0.2)
225
+
226
+ ax1 = fig.add_subplot(gs[0, 0])
227
+ ax2 = fig.add_subplot(gs[1, 0])
228
+ ax3 = fig.add_subplot(gs[:, 1])
229
+
230
+ for ax in [ax1, ax2, ax3]:
231
+ ax.set_facecolor(BLACK)
232
 
 
233
  amd_passed = [stats['passed'] for stats in amd_stats_list]
234
  amd_failed = [stats['failed'] for stats in amd_stats_list]
235
  amd_skipped = [stats['skipped'] for stats in amd_stats_list]
236
 
237
+ ax1.stackplot(dates, amd_passed, amd_failed, amd_skipped,
238
+ colors=[COLORS['passed'], COLORS['failed'], COLORS['skipped']],
239
+ alpha=0.7, labels=['Passed', 'Failed', 'Skipped'])
240
+
241
+ ax1.plot(dates, amd_failed, color=COLORS['failed'], linewidth=2.5,
242
+ marker='o', markersize=7, markeredgewidth=2, markeredgecolor=BLACK,
243
+ linestyle='-', label='_nolegend_')
244
 
245
+ ax1.set_title(f'{model_name.upper()} - AMD Results', fontsize=TITLE_FONT_SIZE,
246
+ color=TITLE_COLOR, fontfamily='monospace', fontweight='bold', pad=20)
247
  ax1.set_ylabel('Number of Tests', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
248
  ax1.grid(True, color=GRID_COLOR, alpha=0.3, linestyle='-', linewidth=0.5)
249
+ ax1.legend(fontsize=LEGEND_FONT_SIZE, loc='upper left', frameon=False,
250
  labelcolor=LABEL_COLOR, prop={'family': 'monospace'})
251
+ ax1.tick_params(colors=LABEL_COLOR, labelsize=LABEL_FONT_SIZE, axis='x', rotation=45)
252
 
 
253
  nvidia_passed = [stats['passed'] for stats in nvidia_stats_list]
254
  nvidia_failed = [stats['failed'] for stats in nvidia_stats_list]
255
  nvidia_skipped = [stats['skipped'] for stats in nvidia_stats_list]
256
 
257
+ ax2.stackplot(dates, nvidia_passed, nvidia_failed, nvidia_skipped,
258
+ colors=[COLORS['passed'], COLORS['failed'], COLORS['skipped']],
259
+ alpha=0.7, labels=['Passed', 'Failed', 'Skipped'])
260
 
261
+ ax2.plot(dates, nvidia_failed, color=COLORS['failed'], linewidth=2.5,
262
+ marker='s', markersize=7, markeredgewidth=2, markeredgecolor=BLACK,
263
+ linestyle='-', label='_nolegend_')
264
+
265
+ ax2.set_title(f'{model_name.upper()} - NVIDIA Results', fontsize=TITLE_FONT_SIZE,
266
+ color=TITLE_COLOR, fontfamily='monospace', fontweight='bold', pad=20)
267
  ax2.set_ylabel('Number of Tests', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
268
  ax2.set_xlabel('Date', fontsize=LABEL_FONT_SIZE, color=LABEL_COLOR, fontfamily='monospace')
269
  ax2.grid(True, color=GRID_COLOR, alpha=0.3, linestyle='-', linewidth=0.5)
270
+ ax2.tick_params(colors=LABEL_COLOR, labelsize=LABEL_FONT_SIZE, axis='x', rotation=45)
271
+
272
+ ax3.axis('off')
273
+ latest_amd = amd_stats_list[-1]
274
+ latest_nvidia = nvidia_stats_list[-1]
275
+
276
+ amd_total = latest_amd['passed'] + latest_amd['failed']
277
+ nvidia_total = latest_nvidia['passed'] + latest_nvidia['failed']
278
+ amd_fail_rate = (latest_amd['failed'] / amd_total * 100) if amd_total > 0 else 0
279
+ nvidia_fail_rate = (latest_nvidia['failed'] / nvidia_total * 100) if nvidia_total > 0 else 0
280
+
281
+ ax3.text(0.5, 0.95, 'LATEST RESULTS', ha='center', va='top',
282
+ fontsize=TITLE_FONT_SIZE - 4, color=TITLE_COLOR, fontfamily='monospace',
283
+ fontweight='bold', transform=ax3.transAxes)
284
+
285
+ y = 0.80
286
+ sections = [
287
+ ('AMD', [
288
+ ('Pass Rate', f"{(latest_amd['passed']/amd_total*100) if amd_total > 0 else 0:.1f}%", COLORS['passed']),
289
+ ('Fail Rate', f"{amd_fail_rate:.1f}%", COLORS['failed']),
290
+ ('Total', str(latest_amd['passed'] + latest_amd['failed'] + latest_amd['skipped']), '#888888'),
291
+ ]),
292
+ ('NVIDIA', [
293
+ ('Pass Rate', f"{(latest_nvidia['passed']/nvidia_total*100) if nvidia_total > 0 else 0:.1f}%", COLORS['passed']),
294
+ ('Fail Rate', f"{nvidia_fail_rate:.1f}%", COLORS['failed']),
295
+ ('Total', str(latest_nvidia['passed'] + latest_nvidia['failed'] + latest_nvidia['skipped']), '#888888'),
296
+ ])
297
+ ]
298
+
299
+ for section_name, metrics in sections:
300
+ ax3.text(0.5, y, section_name, ha='center', va='center',
301
+ fontsize=LABEL_FONT_SIZE + 2, color=TITLE_COLOR,
302
+ fontfamily='monospace', fontweight='bold', transform=ax3.transAxes)
303
+ y -= 0.08
304
+
305
+ for label, value, color in metrics:
306
+ ax3.text(0.15, y, label, ha='left', va='center',
307
+ fontsize=LABEL_FONT_SIZE - 1, color=LABEL_COLOR,
308
+ fontfamily='monospace', transform=ax3.transAxes)
309
+ ax3.text(0.85, y, value, ha='right', va='center',
310
+ fontsize=LABEL_FONT_SIZE, color=color,
311
+ fontfamily='monospace', fontweight='bold', transform=ax3.transAxes)
312
+ y -= 0.07
313
+ y -= 0.05
314
 
 
315
  plt.close('all')
316
+ return fig