mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-29 10:59:19 +08:00
ENH: Add freq_filter argument to HistoryContainer.update_digest_panels.
Adds a new argument, `freq_filter`, to `HistoryContainer.update_digest_panels`, which can be used to supply a predicate determining which digest panels are updated by the call. This is useful for supporting initialization/backfilling of multi-frequency panels in subclasses.
This commit is contained in:
@@ -305,14 +305,20 @@ class HistoryContainer(object):
|
||||
sid in self.buffer_panel.minor_axis)})
|
||||
self.buffer_panel.add_frame(algo_dt, frame)
|
||||
|
||||
def update_digest_panels(self, algo_dt, buffer_panel):
|
||||
def update_digest_panels(self, algo_dt, buffer_panel, freq_filter=None):
|
||||
"""
|
||||
Check whether @algo_dt is greater than cur_window_close for any of our
|
||||
frequencies. If so, roll a digest for that frequency using data drawn
|
||||
from @buffer panel and insert it into the appropriate digest panels.
|
||||
|
||||
If @freq_filter is specified, only use the given data to update
|
||||
frequencies on which the filter returns True.
|
||||
"""
|
||||
for frequency in self.unique_frequencies:
|
||||
|
||||
if freq_filter is not None and not freq_filter(frequency):
|
||||
continue
|
||||
|
||||
# We don't keep a digest panel if we only have a length-1 history
|
||||
# spec for a given frequency
|
||||
digest_panel = self.digest_panels.get(frequency, None)
|
||||
|
||||
Reference in New Issue
Block a user