Skip to content

Triggering multiple recorder blocks at different times based on IO channels. #31

Answered by Dad0u
magnus-haw asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @magnus-haw !
Recording data on a specific condition seems to be the perfect job for modifiers. You can use a modifier to alter or drop the data going through a link.
For the example you described (only recording when a given value is above a threshold) you can use a simple function as a modifier like this :

def only_above_0(data):
    """
    Only returns the data if the value of the label src is > 0
    """
    if data['label_to_compare'] > 0:
        return data
    return None

Then, the link between your data source and Recorder block can be done with crappy.link(data_source, recorder_block, modifier=only_above_0)

Hope this helps !
Victor

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@magnus-haw
Comment options

Comment options

You must be logged in to vote
1 reply
@jeffwitz
Comment options

Answer selected by magnus-haw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
4 participants