Skip to content

Commit fc005f2

Browse files
committed
Copilot suggestions, spelling fixes and only interpolating when the two theta values aren't exactly equal
1 parent f6cd1cf commit fc005f2

File tree

1 file changed

+7
-5
lines changed
  • src/datalab_app_plugin_insitu/apps/xrd

1 file changed

+7
-5
lines changed

src/datalab_app_plugin_insitu/apps/xrd/utils.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def process_local_xrd_data(
194194
direction="nearest",
195195
)
196196

197-
# Adding scan_number to the echem data to be used for the lengend later.
197+
# Adding scan_number to the echem data to be used for the legend later.
198198
# Note: Timestamp column is already standardized to "Timestamp" in process_echem_data()
199199
echem_merged = pd.merge_asof(
200200
xrd_data["Time_series_data"]["data"],
@@ -283,10 +283,12 @@ def process_xrd_data(
283283
LOGGER.warning(
284284
f"Inconsistent 2θ values found in file {file}: {missing_values}."
285285
)
286-
interpolater = interp1d(
287-
new_two_theta_values, intensity_values, bounds_error=False, fill_value=0
288-
)
289-
all_patterns.loc[file, two_theta] = interpolater(two_theta)
286+
interpolator = interp1d(
287+
new_two_theta_values, intensity_values, bounds_error=False, fill_value=0
288+
)
289+
all_patterns.loc[file, two_theta] = interpolator(two_theta)
290+
else:
291+
all_patterns.loc[file, two_theta] = intensity_values
290292
except Exception as e:
291293
print(f"Error processing file {file}: {e}")
292294

0 commit comments

Comments
 (0)