open-fdd 0.1.6__py3-none-any.whl → 0.1.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,9 @@ class HelperUtils:
11
11
  def set_config_dict(self, config_dict):
12
12
  self.config_dict = config_dict
13
13
 
14
+ def clean_nan_values(self, df):
15
+ return SharedUtils.clean_nan_values(df)
16
+
14
17
  def float_int_check_err(self, col):
15
18
  return SharedUtils.float_int_check_err(col)
16
19
 
@@ -48,8 +48,10 @@ class SharedUtils:
48
48
  """
49
49
 
50
50
  print(
51
- "Warning: If data has a one minute or less sampling frequency a rolling average will be automatically applied"
51
+ "Warning: If data has a one minute or less sampling \n"
52
+ "frequency a rolling average will be automatically applied"
52
53
  )
54
+
53
55
  sys.stdout.flush()
54
56
 
55
57
  time_diff = df.index.to_series().diff().iloc[1:]
@@ -73,3 +75,16 @@ class SharedUtils:
73
75
  )
74
76
  sys.stdout.flush()
75
77
  return df
78
+
79
+ @staticmethod
80
+ def clean_nan_values(df: pd.DataFrame) -> pd.DataFrame:
81
+ for col in df.columns:
82
+ if df[col].isnull().any():
83
+ print(f"NaN values found in column: {col}")
84
+
85
+ # Remove rows with any NaN values, then forward and backfill
86
+ df = df.dropna().ffill().bfill()
87
+ print("DataFrame has been cleaned for NaNs")
88
+ print("and has also been forward and backfilled.")
89
+ sys.stdout.flush()
90
+ return df
@@ -914,16 +914,8 @@ class FaultCodeSixteenReport(BaseFaultReport):
914
914
  # Calculate the efficiency before plotting using FaultConditionSixteen method
915
915
  df = self.fc16.calculate_erv_efficiency(df)
916
916
 
917
- print("=" * 50)
918
- print("Info: ERV calculated efficiency ")
919
- print("summary statistics ")
920
- print(df["erv_efficiency_oa"].describe())
921
- print("=" * 50)
922
-
923
- sys.stdout.flush()
924
-
925
- # Create the plot with four subplots
926
- fig, (ax1, ax2, ax3, ax4) = plt.subplots(4, 1, figsize=(25, 10))
917
+ # Create the plot with five subplots
918
+ fig, (ax1, ax2, ax3, ax4, ax5) = plt.subplots(5, 1, figsize=(25, 14))
927
919
  fig.suptitle("Fault Conditions 16 Plot")
928
920
 
929
921
  # Plot ERV Outdoor Air Side Temps
@@ -953,6 +945,27 @@ class FaultCodeSixteenReport(BaseFaultReport):
953
945
  ax4.set_ylabel("Fault Flags")
954
946
  ax4.legend(loc="best")
955
947
 
948
+ # New Plot: Compare Distribution of OAT (Overall vs Fault True)
949
+ fault_true_df = df[df[self.fault_col] == 1]
950
+ data_to_plot = [
951
+ df[self.erv_oat_enter_col].dropna(), # Overall OAT
952
+ fault_true_df[self.erv_oat_enter_col].dropna(), # OAT when Fault is True
953
+ ]
954
+ ax5.boxplot(
955
+ data_to_plot,
956
+ vert=False,
957
+ patch_artist=True,
958
+ labels=["Overall OAT", "OAT when Fault 16 is True"],
959
+ boxprops=dict(facecolor="lightblue"),
960
+ medianprops=dict(color="red"),
961
+ showmeans=True,
962
+ meanline=True,
963
+ meanprops=dict(color="green"),
964
+ )
965
+ ax5.set_xlabel("Outside Air Temperature (°F)")
966
+ ax5.set_title("Comparison of OAT Distribution")
967
+ ax5.grid(True)
968
+
956
969
  plt.tight_layout(rect=[0, 0.03, 1, 0.95])
957
970
  plt.show()
958
971
  plt.close()
File without changes