added parser for cluster analysis
@@ -65,6 +65,25 @@ def _link(files, d_max, tolerance):
io.save_locs(base + '_link.hdf5', linked_locs, info)
+def _cluster(files):
+ import glob
+ paths = glob.glob(files)
+ if paths:
+ from . import io, postprocess
+ for path in paths:
+ try:
+ locs, info = io.load_locs(path)
+ except io.NoMetadataFileError:
+ continue
+ linked_locs = postprocess.link(locs, info, d_max, tolerance)
+ base, ext = os.path.splitext(path)
+ link_info = {'Maximum Distance': d_max,
+ 'Maximum Transient Dark Time': tolerance,
+ 'Generated by': 'Picasso Link'}
+ info.append(link_info)
+ io.save_locs(base + '_link.hdf5', linked_locs, info)
+
+
def _undrift(files, segmentation, display, fromfile):
import glob
from . import io, postprocess
@@ -344,6 +363,9 @@ def main():
link_parser.add_argument('-t', '--tolerance', type=int, default=1,
help='maximum dark time between localizations to still consider them the same binding event (default=1)')
+ cluster_parser = subparsers.add_parser('cluster', help='link cluster data')
+ cluster_parser.add_argument('files', help='one or multiple hdf5 localization files specified by a unix style path pattern')
+
# undrift parser
undrift_parser = subparsers.add_parser('undrift', help='correct localization coordinates for drift')
undrift_parser.add_argument('files', help='one or multiple hdf5 localization files specified by a unix style path pattern')
@@ -454,6 +476,8 @@ def main():
average3.main()
elif args.command == 'link':
_link(args.files, args.distance, args.tolerance)
+ elif args.command == 'cluster':
+ _cluster(args.files)
elif args.command == 'undrift':
_undrift(args.files, args.segmentation, args.nodisplay, args.fromfile)
elif args.command == 'density':
