|
53 | 53 | else: |
54 | 54 |
|
55 | 55 | SENSORS_TO_PLOT_NAMES = [ |
56 | | - "PT-OX-02", |
57 | | - "PT-OX-04", |
58 | | - "PT-OX-201", |
59 | | - "PT-OX-202", |
| 56 | + "PT_OX_02", |
| 57 | + "PT_OX_04", |
| 58 | + "PT_OX_201", |
| 59 | + "PT_OX_202", |
60 | 60 |
|
61 | | - "TC-OX-02", |
62 | | - "TC-OX-04", |
63 | | - "TC-OX-202", |
64 | | - "TC-OX-201", |
65 | | - "RTD-OX", |
| 61 | + "TC_OX_02", |
| 62 | + "TC_OX_04", |
| 63 | + "TC_OX_202", |
| 64 | + "TC_OX_201", |
| 65 | + "RTD_OX", |
66 | 66 |
|
67 | | - "PI-OX-02", |
68 | | - "PI-OX-03", |
| 67 | + "PI_OX_02", |
| 68 | + "PI_OX_03", |
69 | 69 |
|
70 | | - "PT-FU-06", |
71 | | - "PT-FU-04", |
72 | | - "PT-FU-02", |
73 | | - "PT-FU-201", |
74 | | - "PT-FU-202", |
| 70 | + "PT_FU_06", |
| 71 | + "PT_FU_04", |
| 72 | + "PT_FU_02", |
| 73 | + "PT_FU_201", |
| 74 | + "PT_FU_202", |
75 | 75 |
|
76 | | - "TC-FU-04", |
77 | | - "TC-FU-02", |
78 | | - "TC-FU-202", |
79 | | - "TC-FU-201", |
80 | | - "RTD-FU", |
| 76 | + "TC_FU_04", |
| 77 | + "TC_FU_02", |
| 78 | + "TC_FU_202", |
| 79 | + "TC_FU_201", |
| 80 | + "RTD_FU", |
81 | 81 |
|
82 | | - "PI-FU-02", |
83 | | - "PI-FU-03", |
84 | | - "PI-FU-04", |
| 82 | + "PI_FU_02", |
| 83 | + "PI_FU_03", |
| 84 | + "PI_FU_04", |
85 | 85 |
|
86 | | - "PT-HE-01", |
87 | | - "PT-HE-201", |
88 | | - "TC-HE-201", |
| 86 | + "PT_HE_01", |
| 87 | + "PT_HE_201", |
| 88 | + "TC_HE_201", |
89 | 89 |
|
90 | | - "SV-N2-02_STATE", |
91 | | - "SV-N2-02", |
| 90 | + "SV_N2_02_STATE", |
| 91 | + "SV_N2_02", |
92 | 92 |
|
93 | | - "TC-BATTERY", |
| 93 | + "TC_BATTERY", |
94 | 94 |
|
95 | 95 | "FMS", |
96 | 96 | ] |
@@ -272,68 +272,68 @@ def SensorTypeToAxis(name: str) -> str: |
272 | 272 | # source: https://github.com/Purdue-Space-Program/PSPL_DAQ/tree/525aad863caa300921295408a1d6e08e39765564/daq_system/inputs |
273 | 273 | DEV5_CHANNELS = [ |
274 | 274 | # Control Wiring |
275 | | - "PV-FU-02", |
276 | | - "PV-OX-02", |
277 | | - "PV-FU-03", |
278 | | - "PV-OX-03", |
279 | | - "SV-BP-01", |
280 | | - "SV-N2-01", |
281 | | - "PV-HE-01", |
282 | | - "PI-HE-01", |
283 | | - "SV-HE-201", |
284 | | - "SV-HE-202", |
285 | | - "SV-HE-201-state", |
286 | | - "SV-HE-201-state_time", |
287 | | - "SV-HE-202-state", |
288 | | - "SV-HE-201-position", |
289 | | - "SV-HE-202-position", |
290 | | - "SV-QD-03", |
| 275 | + "PV_FU_02", |
| 276 | + "PV_OX_02", |
| 277 | + "PV_FU_03", |
| 278 | + "PV_OX_03", |
| 279 | + "SV_BP_01", |
| 280 | + "SV_N2_01", |
| 281 | + "PV_HE_01", |
| 282 | + "PI_HE_01", |
| 283 | + "SV_HE_201", |
| 284 | + "SV_HE_202", |
| 285 | + "SV_HE_201_state", |
| 286 | + "SV_HE_201_state_time", |
| 287 | + "SV_HE_202_state", |
| 288 | + "SV_HE_201_position", |
| 289 | + "SV_HE_202_position", |
| 290 | + "SV_QD_03", |
291 | 291 | "DELUGE", |
292 | | - "SV-QD-01", |
| 292 | + "SV_QD_01", |
293 | 293 | "ACTUATOR", |
294 | 294 | "IGNITOR", |
295 | 295 |
|
296 | 296 | # Data Wiring |
297 | | - "PT-FU-04", |
298 | | - "PT-HE-01", |
299 | | - "PT-OX-04", |
300 | | - "PT-N2-01", |
301 | | - "PT-FU-02", |
302 | | - "PT-OX-02", |
303 | | - "TC-OX-04", |
304 | | - "TC-FU-04", |
305 | | - "TC-OX-02", |
306 | | - "TC-FU-02", |
| 297 | + "PT_FU_04", |
| 298 | + "PT_HE_01", |
| 299 | + "PT_OX_04", |
| 300 | + "PT_N2_01", |
| 301 | + "PT_FU_02", |
| 302 | + "PT_OX_02", |
| 303 | + "TC_OX_04", |
| 304 | + "TC_FU_04", |
| 305 | + "TC_OX_02", |
| 306 | + "TC_FU_02", |
307 | 307 | "FMS", |
308 | | - "RTD-OX", |
309 | | - "RTD-FU", |
310 | | - "PT-FU-202", |
311 | | - "PT-OX-202", |
312 | | - "TC-HE-201", |
| 308 | + "RTD_OX", |
| 309 | + "RTD_FU", |
| 310 | + "PT_FU_202", |
| 311 | + "PT_OX_202", |
| 312 | + "TC_HE_201", |
313 | 313 | ] |
314 | 314 |
|
315 | 315 | # source: https://github.com/Purdue-Space-Program/PSPL_DAQ/tree/525aad863caa300921295408a1d6e08e39765564/daq_system/inputs |
316 | 316 | DEV6_CHANNELS = [ |
317 | 317 | # Control Wiring |
318 | | - "PV-FU-04", |
| 318 | + "PV_FU_04", |
319 | 319 | "HS_CAMERA", |
320 | | - "SV-N2-02", |
321 | | - "SV-N2-03", |
| 320 | + "SV_N2_02", |
| 321 | + "SV_N2_03", |
322 | 322 |
|
323 | 323 | # Data Wiring |
324 | | - "TC-BATTERY", |
325 | | - "TC-OX-202", |
326 | | - "TC-FU-202", |
327 | | - "TC-FU-VENT", |
328 | | - "PT-CHAMBER", |
329 | | - "PT-FU-06", |
330 | | - "PT-FU-6", |
| 324 | + "TC_BATTERY", |
| 325 | + "TC_OX_202", |
| 326 | + "TC_FU_202", |
| 327 | + "TC_FU_VENT", |
| 328 | + "PT_CHAMBER", |
| 329 | + "PT_FU_06", |
| 330 | + "PT_FU_6", |
331 | 331 | ] |
332 | 332 |
|
333 | 333 |
|
334 | 334 | channels = [ |
335 | 335 | [DEV5_CHANNELS, DEV5_TIME], |
336 | | - # [DEV6_CHANNELS, DEV6_TIME] |
| 336 | + [DEV6_CHANNELS, DEV6_TIME] |
337 | 337 | ] |
338 | 338 |
|
339 | 339 |
|
@@ -407,17 +407,20 @@ def MakePIPairs(csv_columns, already_paired_sensors): |
407 | 407 |
|
408 | 408 |
|
409 | 409 | def BCLSPairs(csv_columns, already_paired_sensors): |
| 410 | + |
410 | 411 | print("\nBCLSPairs") |
411 | 412 |
|
412 | 413 | pairs = defaultdict(list) # dictionary that automatically creates list whenever new key is attempted |
413 | 414 |
|
414 | 415 | for channel, time in channels: |
415 | 416 | if time in csv_columns: |
416 | 417 | for sensor_name in channel: |
417 | | - |
418 | | - if sensor_name in csv_columns: |
419 | | - if sensor_name not in already_paired_sensors: |
420 | | - pairs[time].append(sensor_name) |
| 418 | + # if sensor_name == "PT-FU-02": |
| 419 | + # pass |
| 420 | + |
| 421 | + if sensor_name in csv_columns: |
| 422 | + if sensor_name not in already_paired_sensors: |
| 423 | + pairs[time].append(sensor_name) |
421 | 424 |
|
422 | 425 |
|
423 | 426 | # ########### compare with old version |
@@ -479,11 +482,16 @@ def ConvertCSVToParquet(input_csv: str) -> str: |
479 | 482 | f"Found {len(groups)} time column groups, {len(data_columns_to_plot)} total columns to process" |
480 | 483 | ) |
481 | 484 |
|
| 485 | + data_columns_to_plot = set(data_columns_to_plot) |
| 486 | + data_columns_to_plot.remove("Dev5_state") |
| 487 | + data_columns_to_plot.remove("Dev6_state") |
| 488 | + |
| 489 | + |
482 | 490 | # Read entire CSV at once with optimizations |
483 | 491 | print("Reading CSV data...") |
484 | 492 | df = pd.read_csv( |
485 | 493 | input_csv, |
486 | | - usecols=list(data_columns_to_plot), |
| 494 | + usecols=set(data_columns_to_plot), |
487 | 495 | low_memory=False, |
488 | 496 | on_bad_lines="warn", |
489 | 497 | engine="c", |
@@ -605,36 +613,37 @@ def PlotParquet(parquet_path: str, html_out: str, start: str | None, end: str | |
605 | 613 | try: |
606 | 614 | y = pd.to_numeric(df[column], errors="coerce") |
607 | 615 | mask = y.notna() |
608 | | - except KeyError: |
609 | | - print(f"🚫 {column} not found in data!") |
610 | | - |
611 | | - if not mask.any(): |
612 | | - continue |
| 616 | + if not mask.any(): |
| 617 | + continue |
613 | 618 |
|
614 | | - x_vals, y_vals = _thin(df.index[mask], y[mask], MAX_POINTS_PER_TRACE) |
615 | | - y_axis_key = sensor.get("yaxis", "y1").lower() |
| 619 | + x_vals, y_vals = _thin(df.index[mask], y[mask], MAX_POINTS_PER_TRACE) |
| 620 | + y_axis_key = sensor.get("yaxis", "y1").lower() |
616 | 621 |
|
617 | | - if y_axis_key not in used_axes: |
618 | | - used_axes.append(y_axis_key) |
| 622 | + if y_axis_key not in used_axes: |
| 623 | + used_axes.append(y_axis_key) |
619 | 624 |
|
620 | 625 |
|
621 | | - unit_name = re.search(r"(\[[^\]]+\]|\([^)]+\))\s*$", Y_AXIS_LABELS[y_axis_key]).group(1) |
622 | | - |
623 | | - |
624 | | - fig.add_trace( |
625 | | - go.Scatter( |
626 | | - x=x_vals, |
627 | | - y=y_vals, |
628 | | - mode="lines", |
629 | | - name=sensor.get("name", column), |
630 | | - line=dict(color=sensor.get("color")), |
631 | | - yaxis=y_axis_key, |
632 | | - visible=True, |
633 | | - hovertemplate=f"%{{y:.2f}} {unit_name}", |
| 626 | + unit_name = re.search(r"(\[[^\]]+\]|\([^)]+\))\s*$", Y_AXIS_LABELS[y_axis_key]).group(1) |
| 627 | + |
| 628 | + |
| 629 | + fig.add_trace( |
| 630 | + go.Scatter( |
| 631 | + x=x_vals, |
| 632 | + y=y_vals, |
| 633 | + mode="lines", |
| 634 | + name=sensor.get("name", column), |
| 635 | + line=dict(color=sensor.get("color")), |
| 636 | + yaxis=y_axis_key, |
| 637 | + visible=True, |
| 638 | + hovertemplate=f"%{{y:.2f}} {unit_name}", |
| 639 | + ) |
634 | 640 | ) |
635 | | - ) |
636 | | - traces_added += 1 |
637 | | - print(f"✅ Added trace: {sensor.get('name', column)} ({len(y_vals)} points)") |
| 641 | + traces_added += 1 |
| 642 | + print(f"✅ Added trace: {sensor.get('name', column)} ({len(y_vals)} points)") |
| 643 | + |
| 644 | + except KeyError: |
| 645 | + print(f"🚫 {column} not found in data!") |
| 646 | + |
638 | 647 |
|
639 | 648 |
|
640 | 649 | fig.update_layout( |
|
0 commit comments