Exemple #1
0
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)
Exemple #2
0
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)
Exemple #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)]
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),