Skip to content

Commit cb248f3

Browse files
committed
LIC : change license from GPL -> 3 clause BSD
They promised me cookies!
1 parent 1658f01 commit cb248f3

File tree

8 files changed

+95
-863
lines changed

8 files changed

+95
-863
lines changed

LICENSE

Lines changed: 28 additions & 674 deletions
Large diffs are not rendered by default.

examples/legacy_link_usage.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
#Copyright 2012 Thomas A Caswell
2-
3-
#http://jfi.uchicago.edu/~tcaswell
4-
#
5-
#This program is free software; you can redistribute it and/or modify
6-
#it under the terms of the GNU General Public License as published by
7-
#the Free Software Foundation; either version 3 of the License, or (at
8-
#your option) any later version.
9-
#
10-
#This program is distributed in the hope that it will be useful, but
11-
#WITHOUT ANY WARRANTY; without even the implied warranty of
12-
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13-
#General Public License for more details.
14-
#
15-
#You should have received a copy of the GNU General Public License
16-
#along with this program; if not, see <http://www.gnu.org/licenses>.
17-
181
from __future__ import division
192
import matplotlib
203
matplotlib.use('qt4agg')

trackpy/__init__.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,3 @@
1-
# Copyright 2012 Daniel B. Allan
2-
3-
# http://pha.jhu.edu/~dallan
4-
# http://www.danallan.com
5-
#
6-
# This program is free software; you can redistribute it and/or modify
7-
# it under the terms of the GNU General Public License as published by
8-
# the Free Software Foundation; either version 3 of the License, or (at
9-
# your option) any later version.
10-
#
11-
# This program is distributed in the hope that it will be useful, but
12-
# WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14-
# General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU General Public License
17-
# along with this program; if not, see <http://www.gnu.org/licenses>.
18-
19-
# Configure logging for all modules in this package.
201
import logging
212
FORMAT = "%(name)s.%(funcName)s: %(message)s"
223
logging.basicConfig(level=logging.WARN, format=FORMAT)

trackpy/feature.py

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
# Copyright 2012 Daniel B. Allan
2-
3-
# http://pha.jhu.edu/~dallan
4-
# http://www.danallan.com
5-
#
6-
# This program is free software; you can redistribute it and/or modify
7-
# it under the terms of the GNU General Public License as published by
8-
# the Free Software Foundation; either version 3 of the License, or (at
9-
# your option) any later version.
10-
#
11-
# This program is distributed in the hope that it will be useful, but
12-
# WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14-
# General Public License for more details.
15-
#
16-
# You should have received a copy of the GNU General Public License
17-
# along with this program; if not, see <http://www.gnu.org/licenses>.
18-
191

202
from __future__ import division
213
import warnings
@@ -120,7 +102,7 @@ def refine(raw_image, image, radius, coords, max_iterations=10, engine='auto',
120102
Characterize the neighborhood of a local maximum, and iteratively
121103
hone in on its center-of-brightness. Return its coordinates, integrated
122104
brightness, size (Rg), eccentricity (0=circular), and signal strength.
123-
105+
124106
Parameters
125107
----------
126108
raw_image : array (any dimensions)
@@ -146,15 +128,15 @@ def refine(raw_image, image, radius, coords, max_iterations=10, engine='auto',
146128
engine = 'python'
147129
if engine == 'python':
148130
coords = np.array(coords) # a copy, will not modify in place
149-
results = _refine(raw_image, image, radius, coords, max_iterations,
131+
results = _refine(raw_image, image, radius, coords, max_iterations,
150132
characterize, walkthrough)
151133
elif engine == 'numba':
152134
if not NUMBA_AVAILABLE:
153135
warnings.warn("numba could not be imported. Without it, the "
154136
"'numba' engine runs very slow. Use the 'python' "
155137
"engine or install numba.", UserWarning)
156138
if image.ndim != 2:
157-
raise NotImplementedError("The numba engine only supports 2D "
139+
raise NotImplementedError("The numba engine only supports 2D "
158140
"images. You can extend it if you feel "
159141
"like a hero.")
160142
if walkthrough:
@@ -225,7 +207,7 @@ def _refine(raw_image, image, radius, coords, max_iterations,
225207
# If we're off by less than half a pixel, interpolate.
226208
else:
227209
# Here, coord is a float. We are off the grid.
228-
neighborhood = ndimage.shift(neighborhood, -off_center,
210+
neighborhood = ndimage.shift(neighborhood, -off_center,
229211
order=2, mode='constant', cval=0)
230212
new_coord = coord + off_center
231213
# Disallow any whole-pixels moves on future iterations.
@@ -357,7 +339,7 @@ def _numba_refine(raw_image, image, radius, coords, max_iterations,
357339
# TODO Implement this for numba.
358340
# Remember to zero cm_n somewhere in here.
359341
# Here, coord is a float. We are off the grid.
360-
# neighborhood = ndimage.shift(neighborhood, -off_center,
342+
# neighborhood = ndimage.shift(neighborhood, -off_center,
361343
# order=2, mode='constant', cval=0)
362344
# new_coord = np.float_(coord) + off_center
363345
# Disallow any whole-pixels moves on future iterations.
@@ -420,7 +402,7 @@ def _numba_refine(raw_image, image, radius, coords, max_iterations,
420402
def locate(raw_image, diameter, minmass=100., maxsize=None, separation=None,
421403
noise_size=1, smoothing_size=None, threshold=1, invert=False,
422404
percentile=64, topn=None, preprocess=True, max_iterations=10,
423-
filter_before=True, filter_after=True,
405+
filter_before=True, filter_after=True,
424406
characterize=True, engine='auto'):
425407
"""Locate Gaussian-like blobs of a given approximate size.
426408
@@ -449,7 +431,7 @@ def locate(raw_image, diameter, minmass=100., maxsize=None, separation=None,
449431
default.
450432
percentile : Features must have a peak brighter than pixels in this
451433
percentile. This helps eliminate spurrious peaks.
452-
topn : Return only the N brightest features above minmass.
434+
topn : Return only the N brightest features above minmass.
453435
If None (default), return all features above minmass.
454436
455437
Returns
@@ -554,7 +536,7 @@ def locate(raw_image, diameter, minmass=100., maxsize=None, separation=None,
554536
if maxsize is not None:
555537
approx_size = np.empty(count_maxima)
556538
for i in range(count_maxima):
557-
approx_size[i] = estimate_size(image, radius, coords[i],
539+
approx_size[i] = estimate_size(image, radius, coords[i],
558540
approx_mass[i])
559541
condition &= approx_size < maxsize
560542
coords = coords[condition]
@@ -644,7 +626,7 @@ def batch(frames, diameter, minmass=100, maxsize=None, separation=None,
644626
default.
645627
percentile : Features must have a peak brighter than pixels in this
646628
percentile. This helps eliminate spurrious peaks.
647-
topn : Return only the N brightest features above minmass.
629+
topn : Return only the N brightest features above minmass.
648630
If None (default), return all features above minmass.
649631
650632
Returns
@@ -688,7 +670,7 @@ def batch(frames, diameter, minmass=100, maxsize=None, separation=None,
688670
References
689671
----------
690672
.. [1] Crocker, J.C., Grier, D.G. http://dx.doi.org/10.1006/jcis.1996.0217
691-
673+
692674
"""
693675
# Gather meta information and save as YAML in current directory.
694676
timestamp = pd.datetime.utcnow().strftime('%Y-%m-%d-%H%M%S')
@@ -698,12 +680,13 @@ def batch(frames, diameter, minmass=100, maxsize=None, separation=None,
698680
source = None
699681
meta_info = dict(timestamp=timestamp,
700682
trackpy_version=trackpy.__version__,
701-
source=source, diameter=diameter, minmass=minmass,
702-
maxsize=maxsize, separation=separation,
703-
noise_size=noise_size, smoothing_size=smoothing_size,
704-
invert=invert, percentile=percentile, topn=topn,
683+
source=source, diameter=diameter, minmass=minmass,
684+
maxsize=maxsize, separation=separation,
685+
noise_size=noise_size, smoothing_size=smoothing_size,
686+
invert=invert, percentile=percentile, topn=topn,
705687
preprocess=preprocess, max_iterations=max_iterations,
706688
filter_before=filter_before, filter_after=filter_after)
689+
707690
if meta:
708691
if isinstance(meta, str):
709692
filename = meta

trackpy/linking.py

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
#Copyright 2012 Thomas A Caswell
2-
3-
#http://jfi.uchicago.edu/~tcaswell
4-
#
5-
#This program is free software; you can redistribute it and/or modify
6-
#it under the terms of the GNU General Public License as published by
7-
#the Free Software Foundation; either version 3 of the License, or (at
8-
#your option) any later version.
9-
#
10-
#This program is distributed in the hope that it will be useful, but
11-
#WITHOUT ANY WARRANTY; without even the implied warranty of
12-
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13-
#General Public License for more details.
14-
#
15-
#You should have received a copy of the GNU General Public License
16-
#along with this program; if not, see <http://www.gnu.org/licenses>.
171
from __future__ import (absolute_import, division, print_function,
182
unicode_literals)
193

@@ -333,7 +317,7 @@ def __str__(self):
333317
def __repr__(self):
334318
coords = '(' + (', '.join(["{:.3f}"]*len(self.pos))).format(*self.pos) + ')'
335319
track = " in Track %d" % self.track.indx if self.track else ""
336-
return "<%s at %d, " % (self.__class__.__name__, self.t) + coords + track + ">"
320+
return "<%s at %d, " % (self.__class__.__name__, self.t) + coords + track + ">"
337321

338322
class IndexedPointND(PointND):
339323

@@ -366,7 +350,7 @@ def link(levels, search_range, hash_generator, memory=0, track_cls=None,
366350
algorithm used to resolve subnetworks of nearby particles
367351
'auto' uses numba if available
368352
369-
Returns
353+
Returns
370354
-------
371355
tracks : list of Track (or track_cls) objects
372356
@@ -384,7 +368,7 @@ def link(levels, search_range, hash_generator, memory=0, track_cls=None,
384368
label_generator = link_iter(iter(levels), search_range, memory=memory,
385369
neighbor_strategy=neighbor_strategy,
386370
link_strategy=link_strategy,
387-
track_cls=track_cls,
371+
track_cls=track_cls,
388372
hash_generator=hash_generator)
389373
labels = list(label_generator)
390374
points = sum(map(list, levels), []) # flatten levels: a list of poits
@@ -421,7 +405,7 @@ def link_df(features, search_range, memory=0,
421405
algorithm used to resolve subnetworks of nearby particles
422406
'auto' uses numba if available
423407
424-
Returns
408+
Returns
425409
-------
426410
trajectories : DataFrame
427411
This is the input features DataFrame, now with a new column labeling
@@ -437,7 +421,7 @@ def link_df(features, search_range, memory=0,
437421
For 'BTree' mode only. Define the shape of the search region.
438422
If None (default), infer shape from range of data.
439423
box_size : sequence
440-
For 'BTree' mode only. Define the parition size to optimize
424+
For 'BTree' mode only. Define the parition size to optimize
441425
performance. If None (default), the search_range is used, which is
442426
a reasonable guess for best performance.
443427
verify_integrity : boolean
@@ -640,7 +624,7 @@ def link_iter(levels, search_range, memory=0,
640624
For 'BTree' mode only. Define the shape of the search region.
641625
(Higher-level wrappers of link infer this from the data.)
642626
box_size : sequence
643-
For 'BTree' mode only. Define the parition size to optimize
627+
For 'BTree' mode only. Define the parition size to optimize
644628
performance. If None (default), the search_range is used, which is
645629
a reasonable guess for best performance.
646630
track_cls : class (optional)
@@ -692,7 +676,7 @@ def link_iter(levels, search_range, memory=0,
692676

693677
try:
694678
# Start ID numbers from zero, incompatible with multithreading.
695-
track_cls.reset_counter()
679+
track_cls.reset_counter()
696680
except AttributeError:
697681
# must be using a custom Track class without this method
698682
pass
@@ -728,7 +712,7 @@ def link_iter(levels, search_range, memory=0,
728712
p.forward_cands = []
729713

730714
# Sort out what can go to what.
731-
assign_candidates(cur_level, prev_hash, search_range,
715+
assign_candidates(cur_level, prev_hash, search_range,
732716
neighbor_strategy)
733717

734718
# sort the candidate lists by distance
@@ -790,7 +774,7 @@ def link_iter(levels, search_range, memory=0,
790774

791775
spl, dpl = subnet_linker(s_sn, len(d_sn), search_range)
792776

793-
# Identify the particles in the destination set that
777+
# Identify the particles in the destination set that
794778
# were not linked to.
795779
d_remain = set(d for d in d_sn if d is not None) # TODO DAN
796780
d_remain -= set(d for d in dpl if d is not None)
@@ -872,6 +856,7 @@ def assign_candidates(cur_level, prev_hash, search_range, neighbor_strategy):
872856
p.back_cands.append((wp, dists[i,j]))
873857
wp.forward_cands.append((p, dists[i,j]))
874858

859+
875860
class SubnetOversizeException(Exception):
876861
'''An :py:exc:`Exception` to be raised when the sub-nets are too
877862
big to be efficiently linked. If you get this then either reduce your search range

0 commit comments

Comments
 (0)