Example #1
0
def step_impl(context, detector, ftones):
    """
    :type context: behave.runner.Context
    :type detector: str
    :type ftones: str
    """
    context.result = [[] for i in ftones]
    context.fletters = list(ftones.upper())
    context.ffreq = [context.params.selcal_tones[l] for l in context.fletters]
    if detector == "Goertzel filter":
        context.scanner = gf.scanner(context.result, context.ffreq,
                                       context.samprate, context.n)
    else:
        context.scanner = gf.scanner(context.result, context.ffletters,
                                       context.samprate, context.n)
    next(context.scanner)
Example #2
0
def step_impl(context, ftype):
    """
    :type context: behave.runner.Context
    :type ftype: str
    """
    # This rigamarole is necessary because Banks' example uses integral bins
    # but Geortzel doesn't require integral bins.
    context.target_freq = round(context.n*941/context.sample_rate) * \
                          context.sample_rate/context.n
    context.results = [[]]
    context.ftype = ftype
    context.scanner = scanner(context.results, [context.target_freq],
                              context.sample_rate, context.n,
                              optimized=(ftype == "optimized"))
    next(context.scanner)