Skip to content

unit test for rescaling code #2

Description

@lionfish0

When we get around to making unit tests, this would be one:

from btretrodetect import rescalePatch

def slowRescalePatch(im,x,y,patchSize,blocksize):
    a = im.repeat(blocksize,axis=0).repeat(blocksize,axis=1)
    return a[y-patchSize:y+patchSize,x-patchSize:x+patchSize]


im = np.random.randn(300,200)
for blocksize in [1,2,4,8]:
    for patchSize in [1,2,4,8,16,32]:
        for x in [101,160,54]:
            for y in [56,61,72]:
                im1 = slowRescalePatch(im,x,y,patchSize,blocksize)
                im2 = rescalePatch(im,x,y,patchSize,blocksize)
                assert np.all(im1==im2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions