NREL / flasc

A rich floris-driven suite for SCADA analysis
https://nrel.github.io/flasc/
BSD 3-Clause "New" or "Revised" License
30 stars 18 forks source link

`find_sensor_stuck_faults` only returns indices of faults for the last column #175

Closed DanielKerrigan closed 5 months ago

DanielKerrigan commented 6 months ago

Is there an existing issue for this?

Current Behavior

The find_sensor_stuck_faults function has a parameter for a list of columns, but it only returns the stuck indices for the last column in the list.

Expected Behavior

My expectation is that the function would return the indices where the values in any of the columns are stuck and that the order of the columns in the list would not matter.

Steps To Reproduce

import pandas as pd
from flasc.turbine_analysis.find_sensor_faults import find_sensor_stuck_faults

df = pd.DataFrame({"a": [0, 0, 0, 1, 2, 3], "b": [4, 5, 6, 7, 7, 7]})

results_a = find_sensor_stuck_faults(df, columns=["a"], ti=0, plot_figures=False)
print("columns=['a']:", results_a)

results_b = find_sensor_stuck_faults(df, columns=["b"], ti=0, plot_figures=False)
print("columns=['b']:", results_b)

results_ab = find_sensor_stuck_faults(df, columns=["a", "b"], ti=0, plot_figures=False)
print("columns=['a', 'b']:", results_ab)

results_ba = find_sensor_stuck_faults(df, columns=["b", "a"], ti=0, plot_figures=False)
print("columns=['b', 'a']:", results_ba)

# Output:
# columns=['a']: [0 1 2]
# columns=['b']: [3 4 5]
# columns=['a', 'b']: [3 4 5]
# columns=['b', 'a']: [0 1 2]

Environment

- OS: MacOS 14.2.1
- pip environment:
    - flasc 1.5

Anything else?

No response

misi9170 commented 6 months ago

Hi @DanielKerrigan, thank you for raising this issue. I've run your example script (which is very useful, thank you for providing it) and confirmed the outputs you are seeing. I've also tracked down the issue in find_sensor_stuck_faults() and will work on a bugfix in the coming days.

misi9170 commented 5 months ago

Closed by #177