Skip to content

Commit

Permalink
Merge pull request #880 from neutrons/fix_Run
Browse files Browse the repository at this point in the history
commit change for how time averaged data are pulled from logs
  • Loading branch information
fanchercm authored Oct 3, 2024
2 parents b86da68 + 545542c commit cb1ce88
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

1 comment on commit cb1ce88

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitLab pipeline for pyrs-qa has been submitted for this commit: "https://code.ornl.gov/sns-hfir-scse/deployments/pyrs-deploy/-/pipelines/623601"

Please sign in to comment.