예제 #1
0
파일: trace.py 프로젝트: carinaj/pyrocko
def co_downsample_to(deltat):

    decimators = {}
    newtr = None
    try:
        while True:
            tr = yield newtr
            ratio = deltat / tr.deltat
            rratio = round(ratio)
            if abs(rratio - ratio)/ratio > 0.0001:
                raise util.UnavailableDecimation('ratio = %g' % ratio)
            
            deci_seq = tuple( x for x in util.decitab(int(rratio)) if x != 1 )
            if deci_seq not in decimators:
                decimators[deci_seq] = chain( *[ co_downsample(q) for q in deci_seq ] )
               
            newtr = decimators[deci_seq].send( tr )

    except GeneratorExit:
        for g in decimators.values():
            g.close()
예제 #2
0
def co_downsample_to(deltat):

    decimators = {}
    newtr = None
    try:
        while True:
            tr = yield newtr
            ratio = deltat / tr.deltat
            rratio = round(ratio)
            if abs(rratio - ratio) / ratio > 0.0001:
                raise util.UnavailableDecimation('ratio = %g' % ratio)

            deci_seq = tuple(x for x in util.decitab(int(rratio)) if x != 1)
            if deci_seq not in decimators:
                decimators[deci_seq] = chain(
                    *[co_downsample(q) for q in deci_seq])

            newtr = decimators[deci_seq].send(tr)

    except GeneratorExit:
        for g in decimators.values():
            g.close()
예제 #3
0
파일: trace.py 프로젝트: megies/pyrocko
def co_downsample_to(target, deltat):

    decimators = {}
    try:
        while True:
            tr = (yield)
            ratio = deltat / tr.deltat
            rratio = round(ratio)
            if abs(rratio - ratio) / ratio > 0.0001:
                raise util.UnavailableDecimation('ratio = %g' % ratio)

            deci_seq = tuple(x for x in util.decitab(int(rratio)) if x != 1)
            if deci_seq not in decimators:
                pipe = target
                for q in deci_seq[::-1]:
                    pipe = co_downsample(pipe, q)

                decimators[deci_seq] = pipe

            decimators[deci_seq].send(tr)

    except GeneratorExit:
        for g in decimators.values():
            g.close()
예제 #4
0
파일: trace.py 프로젝트: kshramt/pyrocko
def co_downsample_to(target, deltat):

    decimators = {}
    try:
        while True:
            tr = (yield)
            ratio = deltat / tr.deltat
            rratio = round(ratio)
            if abs(rratio - ratio)/ratio > 0.0001:
                raise util.UnavailableDecimation('ratio = %g' % ratio)
            
            deci_seq = tuple( x for x in util.decitab(int(rratio)) if x != 1 )
            if deci_seq not in decimators:
                pipe = target
                for q in deci_seq[::-1]:
                    pipe = co_downsample(pipe, q)

                decimators[deci_seq] = pipe
               
            decimators[deci_seq].send( tr )

    except GeneratorExit:
        for g in decimators.values():
            g.close()