コード例 #1
0
ファイル: basic_test.py プロジェクト: Resonanz/trackpy
def test_iden():
    SEED = 314
    random.seed(SEED)

    X = range(10, 200, 20)
    Y = range(10, 200, 20)
    random.shuffle(X)
    random.shuffle(Y)
    img = tid.gen_fake_data(np.vstack([X, Y]), 5, 2.5, (210, 210))
    bp_img = tid.band_pass(img, 2, 2.5)

    res_lm = tid.find_local_max(bp_img, 3, .5)

    locs, mass, r2 = tid.subpixel_centroid(bp_img, res_lm, 3)
    assert np.all(np.abs(locs - res_lm) < .05)
コード例 #2
0
ファイル: basic_test.py プロジェクト: elizan/trackpy
def test_iden():
    SEED = 314
    random.seed(SEED)

    X = range(10, 200, 20)
    Y = range(10, 200, 20)
    random.shuffle(X)
    random.shuffle(Y)
    img = tid.gen_fake_data(np.vstack([X, Y]), 5, 2.5, (210, 210))
    bp_img = tid.band_pass(img, 2, 2.5)

    res_lm = tid.find_local_max(bp_img, 3, .5)

    locs, mass, r2 = tid.subpixel_centroid(bp_img, res_lm, 3)
    assert np.all(np.abs(locs - res_lm) < .05)
コード例 #3
0
from __future__ import division
import matplotlib

import trackpy.tracking as pt
import trackpy.identification as tid
import matplotlib.pyplot as plt
import random
import numpy as np

X = range(10, 200, 20)
Y = range(10, 200, 20)
random.shuffle(X)
random.shuffle(Y)

img = tid.gen_fake_data(np.vstack([X, Y]), 5, 2.5, (210, 210))
bp_img = tid.band_pass(img, 2, 2.5)

res_lm = tid.find_local_max(bp_img, 3, .5)

locs, mass, r2 = tid.subpixel_centroid(bp_img, res_lm, 3)

# make figure
fig = plt.figure()
ax = fig.gca()
# display image
ax.imshow(bp_img, cmap='gray', interpolation='nearest')

# add pixval like output
ax.format_coord = lambda x, y: 'r=%d,c=%d,v=%0.2f' % (
    int(x + .5), int(y + .5), bp_img[int(x + .5), int(y + .5)]
コード例 #4
0
from __future__ import division
import matplotlib

import trackpy.tracking as pt
import trackpy.identification as tid
import matplotlib.pyplot as plt
import random
import numpy as np

X = range(10, 200, 20)
Y = range(10, 200, 20)
random.shuffle(X)
random.shuffle(Y)

img = tid.gen_fake_data(np.vstack([X, Y]), 5, 2.5, (210, 210))
bp_img = tid.band_pass(img, 2, 2.5)


res_lm = tid.find_local_max(bp_img, 3, .5)

locs, mass, r2 = tid.subpixel_centroid(bp_img, res_lm, 3)

# make figure
fig = plt.figure()
ax = fig.gca()
# display image
ax.imshow(bp_img, cmap='gray', interpolation='nearest')

# add pixval like output
ax.format_coord = lambda x, y: 'r=%d,c=%d,v=%0.2f' % (int(x + .5),