Ejemplo n.º 1
0
import numpy as np
from depends import fix_path
fix_path(skip_matlab=True)

NOISE_CLUSTER = 0
UNCLASSIFIED = -1

def simple_binned_clustering(D, min_val):
  next_cluster = 1
  shape = D.shape
  out = np.ones(shape) * UNCLASSIFIED
  for index in np.ndindex(*shape):
    if out[index] == UNCLASSIFIED:
  next_cluster = 1
  shape = D.shape
  out = np.ones(shape) * UNCLASSIFIED
  for index in np.ndindex(*shape):
    if out[index] == UNCLASSIFIED:
      sum_neighbors, neighbors_idx = get_neighbors_idx(index)
      #print neighbors_idx
      if sum_neighbors < min_points:
        out[index] = NOISE_CLUSTER
      else:
        print 'index: %d %d, sum:' % index, sum_neighbors
        print neighbors_idx
        #print neighbors
        out[index] = next_cluster
        neighbors_idx = set(
            [i for i in neighbors_idx if out[i]==UNCLASSIFIED])
        expand_cluster(out, next_cluster, neighbors_idx)
        next_cluster += 1
Ejemplo n.º 2
0
#!/usr/bin/env python
from depends import fix_path
fix_path()
import sys
import time
import logging
import pygtk
import os.path
pygtk.require('2.0')
import gtk
import gtksourceview2
import gobject
import pango
gobject.threads_init()
from script import Script
from textviewhandler import TextViewHandler
from scriptserver import ScriptServer
from filemanager import FileManager
from spacemanager import SpaceManager
from controlboxmanager import ControlBoxManager
from parameterchanger import ParameterChangerManager
from scriptservices import ScriptServices
from scriptservices import services
#from gtkcodebuffer import CodeBuffer
#from gtkcodebuffer import SyntaxLoader


class Gui(object):
    def __init__(self):
        builder = gtk.Builder()
        builder.add_from_file('gui.glade')
Ejemplo n.º 3
0
#!/usr/bin/env python
import unittest
import logging
import sys
sys.path.insert(0, '../src')
from depends import fix_path
fix_path()
from parameterchanger_test import TestParameterChanger
from script_test import TestScript
from kdtree_test import TestKDTree
from depends_test import TestDepends

if __name__ == '__main__':
    logging.getLogger('').setLevel(logging.DEBUG)
    fix_path()
    unittest.main()
Ejemplo n.º 4
0
    print '*************************************************************************'
    print 'matplotlib seems to be missing, please install it from:'
    if is_mac:
      print 'http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.0/matplotlib-1.1.0-py2.7-python.org-macosx10.3.dmg'
    if is_win:
      print 'http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.0/matplotlib-1.1.0.win32-py2.7.exe'
    print '*************************************************************************'
    return False
  return True
  

if not startup_tests():
  sys.exit()
from depends import fix_path
print 'Fixing Path'
fix_path(True)
print 'Done'
import matplotlib
matplotlib.use('Agg')
import urllib
import logging
import web
import cPickle as pickle
import settings
from time import gmtime, strftime
from widgets.graph import Graph
from report import REPORTS
from reportrunner import ReportRunner
from widgets.population_report import PopulationReport
from widgets.histogram_report import HistogramReport
from widgets.correlation_report import CorrelationReport
Ejemplo n.º 5
0
#!/usr/bin/env python
import logging
import os
import sys
# uncomment when using the main:
sys.path.insert(0, '.')
from depends import fix_path
from tagorder import tag_sort_key
fix_path(True)

from scriptservices import services
from cache import cache
from biology.datatable import DataTable
from biology.datatable import combine_tables
from biology.loaddatatable import load_data_table
from biology.loaddatatable import get_num_events
from odict import OrderedDict


class DataIndexEntry:
    def __init__(self, filename, tags):
        self.filename = filename
        self.tags = tags

    def get_tag_value(self, tag_name):
        if not tag_name in self.tags:
            return None
        return self.tags[tag_name]

    def __str__(self):
        tags = ['\t%s: %s\n' % (k, self.tags[k]) for k in self.tags]