Skip to content

Commit

Permalink
This is a bit more complicated…
Browse files Browse the repository at this point in the history
  • Loading branch information
titodalcanton committed Aug 6, 2024
1 parent 227b8ab commit 96e0586
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions pycbc/frame/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,12 @@ def advance(self, blocksize):
self.null_advance(blocksize)
return None

def attempt_advance(self, blocksize, timeout=10):
result = super().attempt_advance(blocksize, timeout)
if result is None:
return None
return self.check_valid(result)


class iDQBuffer(object):

Expand Down
11 changes: 8 additions & 3 deletions pycbc/strain/strain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1848,15 +1848,18 @@ def null_advance_strain(self, blocksize):
self.taper_immediate_strain = True

def advance(self, blocksize, timeout=10):
"""Advanced buffer blocksize seconds.
"""Advance buffer blocksize seconds.
Add blocksize seconds more to the buffer, push blocksize seconds
from the beginning.
Parameters
----------
blocksize: int
The number of seconds to attempt to read from the channel
The number of seconds to attempt to read from the channel.
timeout: {int, 10}
Maximum time (in seconds) to wait before declaring frame files are
too late and reporting unusable data.
Returns
-------
Expand All @@ -1866,7 +1869,9 @@ def advance(self, blocksize, timeout=10):
if self.state:
# We are using information from the state vector, so check what is
# says about the new strain data.
state_advance_result = self.state.advance(blocksize)
state_advance_result = self.state.attempt_advance(
blocksize, timeout=timeout
)
if not state_advance_result:
# Something about the state vector indicates a problem.
if state_advance_result is None:
Expand Down

0 comments on commit 96e0586

Please sign in to comment.