Skip to content

Commit 38971ad

Browse files
committed
Python: remove unnecessary renaming of variables in loop
1 parent dc89813 commit 38971ad

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

Utilities/Python/fdsplotlib.py

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -346,30 +346,20 @@ def read_csv_cached(path, **kwargs):
346346
csv_rownum = int(row[col_orig_idx]) + header_rows + 1
347347
pp = define_plot_parameters(C, pos, lightweight=fast_mode)
348348

349-
# --- Inline simple attribute access for speed ---
350-
switch_id = pp.switch_id
351-
Dataname = pp.Dataname
352-
d1_file = pp.d1_Filename
353-
d2_file = pp.d2_Filename
354-
plot_filename = pp.Plot_Filename
355-
quantity = pp.Quantity
356-
metric = pp.Metric
357-
flip_axis_flag = str(pp.Flip_Axis or '').strip().lower() in ['yes', 'true', '1']
358-
359349
# --- Handle MATLAB dataplot switch_id behavior (d, f, o, g, s) ---
360-
if switch_id == 's':
350+
if pp.switch_id == 's':
361351
continue
362352

363-
if otest_active and switch_id != 'o':
353+
if otest_active and pp.switch_id != 'o':
364354
continue
365355

366-
gtest = (switch_id == 'g')
367-
dtest = (switch_id == 'd')
368-
ftest = (switch_id == 'f')
356+
gtest = (pp.switch_id == 'g')
357+
dtest = (pp.switch_id == 'd')
358+
ftest = (pp.switch_id == 'f')
369359

370-
if not (dtest or ftest or gtest or switch_id == 'o'):
360+
if not (dtest or ftest or gtest or pp.switch_id == 'o'):
371361
if verbose:
372-
print(f"[dataplot] Skipping unrecognized switch_id '{switch_id}' on line {csv_rownum}")
362+
print(f"[dataplot] Skipping unrecognized switch_id '{pp.switch_id}' on line {csv_rownum}")
373363
continue
374364

375365
# Track drange (MATLAB-style 1-based CSV row index)
@@ -378,13 +368,13 @@ def read_csv_cached(path, **kwargs):
378368

379369
# Append metadata only for rows that should appear in scatplot
380370
if not gtest:
381-
Save_Dataname.append(Dataname)
382-
Save_Plot_Filename.append(plot_filename)
371+
Save_Dataname.append(pp.Dataname)
372+
Save_Plot_Filename.append(pp.Plot_Filename)
383373
Save_Dep_Title.append(pp.Dep_Title)
384374
Save_Error_Tolerance.append(pp.Error_Tolerance)
385-
Save_Metric_Type.append(metric)
375+
Save_Metric_Type.append(pp.Metric)
386376
Save_Group_Key_Label.append(pp.Group_Key_Label)
387-
Save_Quantity.append(quantity)
377+
Save_Quantity.append(pp.Quantity)
388378
Save_Group_Style.append(pp.Group_Style)
389379
Save_Fill_Color.append(pp.Fill_Color)
390380

0 commit comments

Comments
 (0)