Skip to content

Commit

Permalink
commit change for how time averaged data are pulled from logs
Browse files Browse the repository at this point in the history
  • Loading branch information
fanchercm committed Oct 3, 2024
1 parent b86da68 commit 545542c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pyrs/core/nexus_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Convert HB2B NeXus file to Hidra project file for further reduction
"""
import h5py
from mantid.api import Run
from mantid.kernel import Logger, BoolTimeSeriesProperty, FloatFilteredTimeSeriesProperty, FloatTimeSeriesProperty
from mantid.kernel import Int32TimeSeriesProperty, Int64TimeSeriesProperty, Int32FilteredTimeSeriesProperty
from mantid.kernel import Int64FilteredTimeSeriesProperty, StringTimeSeriesProperty, StringFilteredTimeSeriesProperty
Expand Down Expand Up @@ -57,7 +58,11 @@ def calculate_sub_run_time_average(log_property, time_filter) -> float:
if log_property.size() == 1: # single value property just copy
time_average_value = log_property.value
elif time_filter is None: # no filtering means use all values
time_average_value = log_property.timeAverageValue()
time_averaged_Run = Run()
time_averaged_Run.addProperty('filtered_log', log_property, False)
time_average_value = time_averaged_Run.getTimeAveragedValue(log_property.name)
del time_averaged_Run

else:
# filter and get time average value
if isinstance(log_property, FloatTimeSeriesProperty):
Expand All @@ -72,9 +77,11 @@ def calculate_sub_run_time_average(log_property, time_filter) -> float:
raise NotImplementedError('TSP log property {} of type {} is not supported'
''.format(log_property.name, type(log_property)))

time_average_value = filtered_tsp.timeAverageValue()
time_averaged_Run = Run()
time_averaged_Run.addProperty('filtered_log', filtered_tsp, False)
time_average_value = time_averaged_Run.getTimeAveragedValue(log_property.name)

del filtered_tsp
del filtered_tsp, time_averaged_Run

return time_average_value

Expand Down

0 comments on commit 545542c

Please sign in to comment.