Skip to content

Commit

Permalink
Merge branch 'remove-dead-code' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
remram44 committed Sep 16, 2014
2 parents a347af5 + ef8f5b1 commit e027790
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 110 deletions.
84 changes: 0 additions & 84 deletions vistrails/core/analogy/eigen.py
Expand Up @@ -309,90 +309,6 @@ def update_elements(spec):
remove_descriptions(outputs)
return (inputs, outputs)

##############################################################################
# EigenPipelineSimilarity

class EigenPipelineSimilarity(EigenBase):

##########################################################################
# Constructor and initialization

def __init__(self,
pipeline1,
pipeline2):
EigenBase.__init__(self, pipeline1, pipeline2)
self.init_operator()

def init_operator(self):
num_verts_p1 = len(self._p1.graph.vertices)
num_verts_p2 = len(self._p2.graph.vertices)
def ix(a,b): return num_verts_p2 * a + b
self._operator = mzeros((num_verts_p1 * num_verts_p2,
num_verts_p1 * num_verts_p2))

u = 0.85

for i in xrange(num_verts_p1):
v1_id = self._g1_vertex_map.inverse[i]
for j in xrange(num_verts_p2):
ix_ij = ix(i,j)
self._operator[ix_ij, ix_ij] = u
v2_id = self._g2_vertex_map.inverse[j]
def edges(pip, v_id):
return chain(imap(lambda (f, t, i): (t, i),
self._p1.graph.iter_edges_from(v1_id)),
imap(lambda (f, t, i): (f, i),
self._p1.graph.iter_edges_to(v1_id)))
p1_edges = edges(self._p1, v1_id)
p2_edges = edges(self._p2, v2_id)
running_sum = 0.0
for (_, p1_edge) in p1_edges:
for (_, p2_edge) in p2_edges:
e1_id = self._g1_edge_map[p1_edge]
e2_id = self._g2_edge_map[p2_edge]
running_sum += self._edge_s8y[e1_id, e2_id]
p1_edges = edges(self._p1, v1_id)
p2_edges = edges(self._p2, v2_id)
if not running_sum:
continue
for (p1_v, p1_edge_id) in p1_edges:
for (p2_v, p2_edge_id) in p2_edges:
e1_id = self._g1_edge_map[p1_edge_id]
e2_id = self._g2_edge_map[p2_edge_id]
p1_v_id = self._g1_vertex_map[p1_v]
p2_v_id = self._g2_vertex_map[p2_v]
value = self._edge_s8y[e1_id, e2_id]
value *= (1.0 - u) / running_sum
self._operator[ix_ij, ix(p1_v_id, p2_v_id)] = value

##############################################################################
# Solve

def step(self, m):
v = m.reshape(len(self._p1.modules) *
len(self._p2.modules))
v = scipy.dot(self._operator, v)
v = v.reshape(len(self._p1.modules),
len(self._p2.modules)).transpose()
v = (v / v.sum(0)).transpose()
return v

def solve(self):
i = 0
while i < 50:
i += 1
v = self.step(self._vertex_s8y)
residue = self._vertex_s8y - v
residue *= residue
if residue.sum() < 0.0001:
break
self._vertex_s8y = v
mp = [(self._g1_vertex_map.inverse[ix],
self._g2_vertex_map.inverse[v])
for (ix, v) in
enumerate(self._vertex_s8y.argmax(1))]
return dict(mp)

##############################################################################
# EigenPipelineSimilarity2

Expand Down
2 changes: 1 addition & 1 deletion vistrails/core/api.py
@@ -1,7 +1,7 @@
import itertools

import vistrails.core.application
from vistrails.core.db.locator import FileLocator, untitled_locator
from vistrails.core.db.locator import FileLocator
import vistrails.core.db.io
from vistrails.core import debug
from vistrails.core.modules.basic_modules import identifier as basic_pkg
Expand Down
6 changes: 0 additions & 6 deletions vistrails/core/db/locator.py
Expand Up @@ -753,9 +753,3 @@ def guess_extension_from_contents(contents):
mashuptrail=mashuptrail,
mashupVersion=mashupVersion,
parameterExploration=parameterExploration)


##########################################################################

def untitled_locator():
return UntitledLocator()
2 changes: 0 additions & 2 deletions vistrails/core/interpreter/cached.py
Expand Up @@ -214,7 +214,6 @@ def create(self):
self._file_pool = FilePool()
self._persistent_pipeline = vistrails.core.vistrail.pipeline.Pipeline()
self._objects = {}
self._executed = {}
self.filePool = self._file_pool
self._streams = []

Expand All @@ -224,7 +223,6 @@ def clear(self):
for obj in self._objects.itervalues():
obj.clear()
self._objects = {}
self._executed = {}

def __del__(self):
self.clear()
Expand Down
7 changes: 0 additions & 7 deletions vistrails/core/interpreter/job.py
Expand Up @@ -56,13 +56,6 @@
JOBS_FILENAME = "jobs.json"


class BaseMonitor(object):
def finished(self):
"""Indicates whether the job has completed (module can resume).
"""
raise NotImplementedError


class JobMixin(NotCacheable):
""" Mixin for suspendable modules.
Expand Down
1 change: 0 additions & 1 deletion vistrails/core/modules/config.py
Expand Up @@ -435,7 +435,6 @@ def parse_documentation():
field, field_type = line.strip().split(':', 1)
(cls_name, field_name) = field.split('.')
doc_lines = []
done_with_doc = False
line = line_iter.next()
while True:
line = line_iter.next()
Expand Down
4 changes: 0 additions & 4 deletions vistrails/core/modules/output_modules.py
Expand Up @@ -82,10 +82,6 @@ def get_all_fields(cls):
fields.sort()
return fields

@classmethod
def get_local_fields(cls):
return sorted(cls._fields)

@classmethod
def get_default(cls, k):
f = cls.get_field(k)
Expand Down
5 changes: 0 additions & 5 deletions vistrails/core/vistrail/module_function.py
Expand Up @@ -52,11 +52,6 @@

################################################################################

PipelineElementType = enum('PipelineElementType',
['Module', 'Connection', 'Function', 'Parameter'])

################################################################################

class ModuleFunction(DBFunction):
__fields__ = ['name', 'returnType', 'params']
""" Stores a function from a vistrail module """
Expand Down

0 comments on commit e027790

Please sign in to comment.