Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0
This commit is contained in:
Arnar Flatberg 2007-09-03 17:51:22 +00:00
parent 5a1e225a08
commit 7ef01d37f0
3 changed files with 15 additions and 20 deletions

View File

@ -22,6 +22,7 @@ DATADIR = os.path.dirname(sys.modules['fluents'].__file__)
ICONDIR = os.path.join(DATADIR,"..","icons") ICONDIR = os.path.join(DATADIR,"..","icons")
GLADEFILENAME = os.path.join(DATADIR, 'fluents.glade') GLADEFILENAME = os.path.join(DATADIR, 'fluents.glade')
class IconFactory: class IconFactory:
"""Factory for icons that ensures that each icon is only loaded once.""" """Factory for icons that ensures that each icon is only loaded once."""
@ -43,6 +44,7 @@ class IconFactory:
icon_factory = IconFactory(ICONDIR) icon_factory = IconFactory(ICONDIR)
class TableSizeSelection(gtk.Window): class TableSizeSelection(gtk.Window):
def __init__(self): def __init__(self):

View File

@ -60,9 +60,7 @@ class Workflow:
description = "Workflow Description" description = "Workflow Description"
def __init__(self): def __init__(self):
print "Setting stages"
self.stages = [] self.stages = []
self.stages_by_id = {}
def get_data_file_name(self, filename): def get_data_file_name(self, filename):
"""Checks if a file with the given name exists in the data directory. """Checks if a file with the given name exists in the data directory.
@ -79,7 +77,7 @@ class Workflow:
def add_stage(self, stage): def add_stage(self, stage):
self.stages.append(stage) self.stages.append(stage)
self.stages_by_id[stage.id] = stage #self.stages_by_id[stage.id] = stage
def print_tree(self): def print_tree(self):
print self.name print self.name
@ -109,11 +107,9 @@ class Stage:
self.id = id self.id = id
self.name = name self.name = name
self.tasks = [] self.tasks = []
self.tasks_by_id = {}
def add_task(self, task): def add_task(self, task):
self.tasks.append(task) self.tasks.append(task)
#self.tasks_by_id[task.id] = task
class Task: class Task:
@ -151,7 +147,6 @@ class Validation:
class WorkflowView (gtk.VBox): class WorkflowView (gtk.VBox):
def __init__(self, wf): def __init__(self, wf):
gtk.VBox.__init__(self) gtk.VBox.__init__(self)
self.workflow = wf self.workflow = wf
@ -202,7 +197,6 @@ class WorkflowView (gtk.VBox):
task_result = task.run() task_result = task.run()
if task_result != None: if task_result != None:
main.project.add_data(parent_data, task_result, task.name) main.project.add_data(parent_data, task_result, task.name)
else: else:

View File

@ -1,11 +1,11 @@
import gtk import gtk
from fluents import dataset, logger, plots, workflow from fluents import dataset, logger, plots, workflow
#import geneontology
#import gostat
from scipy import array, randn, log, ones, newaxis from scipy import array, randn, log, ones, newaxis
import cPickle import cPickle
import networkx import networkx
class TestWorkflow (workflow.Workflow): class TestWorkflow (workflow.Workflow):
name = 'Test Workflow' name = 'Test Workflow'
@ -15,15 +15,14 @@ class TestWorkflow (workflow.Workflow):
def __init__(self): def __init__(self):
workflow.Workflow.__init__(self) workflow.Workflow.__init__(self)
load = workflow.Stage('load', 'Test Data') test_stage = workflow.Stage('test', 'Test Data')
load.add_task(TestDataTask) test_stage.tasks.append(TestDataTask)
load.add_task(TestPlot) test_stage.tasks.append(TestPlot)
self.add_stage(load) self.stages.append(test_stage)
class TestDataTask(workflow.Task): class TestDataTask(workflow.Task):
name = "Test data" name = "Test data"
def __init__(self, input): def __init__(self, input):
workflow.Task.__init__(self, input) workflow.Task.__init__(self, input)
@ -56,10 +55,10 @@ class TestPlot(workflow.Task):
workflow.Task.__init__(self, input) workflow.Task.__init__(self, input)
def run(self): def run(self):
logger.log('notice', 'Injecting foo test data') #logger.log('notice', 'Injecting % dataset') %self.input[0].get_name()
x = randn(500,15) X = self.input[0]
X = dataset.Dataset(x) ii = X.get_dim_name()[0]
ii = X.get_dim_name() ids = X.get_identifiers(ii, indices=[0,1])
p = plots.ScatterPlot(X, X, ii[0], ii[0], '0_1', '0_2',name='scatter') p = plots.ScatterPlot(X, X, ii, ii, ids[0], ids[1],name='scatter')
return [p] return [p]