Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Added scaling to navigator menu, moved transformations to a separate sub menu

This commit is contained in:
Arnar Flatberg 2007-08-07 11:42:07 +00:00
parent 168384f266
commit 916fc4c046
1 changed files with 40 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import plots
import time import time
import fluents import fluents
import dataset, logger, plots, project, workflow, main import dataset, logger, plots, project, workflow, main
import scipy
class NavigatorView (gtk.TreeView): class NavigatorView (gtk.TreeView):
def __init__(self): def __init__(self):
@ -187,7 +188,7 @@ class NavigatorMenu(gtk.Menu):
self.dataset = None self.dataset = None
self.tree_iter = None self.tree_iter = None
# Populate menu # Populate main menu
self.load_item = gtk.MenuItem('Load dataset') self.load_item = gtk.MenuItem('Load dataset')
self.load_item.connect('activate', self.on_load_dataset, navigator) self.load_item.connect('activate', self.on_load_dataset, navigator)
self.append(self.load_item) self.append(self.load_item)
@ -198,12 +199,30 @@ class NavigatorMenu(gtk.Menu):
self.append(self.save_item) self.append(self.save_item)
self.save_item.show() self.save_item.show()
self.trans_item = gtk.MenuItem('Transpose') # Build transform sub menu
self.trans_item.connect('activate', self.on_transpose, navigator) self.trans_menu = gtk.Menu()
self.trans_tr_item = gtk.MenuItem('Transpose')
self.trans_tr_item.connect('activate', self.on_transpose, navigator)
self.trans_menu.append(self.trans_tr_item)
self.trans_tr_item.show()
self.trans_stdr_item = gtk.MenuItem('Std. rows')
self.trans_stdr_item.connect('activate', self.on_standardise_rows, navigator)
self.trans_menu.append(self.trans_stdr_item)
self.trans_stdr_item.show()
self.trans_stdc_item = gtk.MenuItem('Std. cols')
self.trans_stdc_item.connect('activate', self.on_standardise_cols, navigator)
self.trans_menu.append(self.trans_stdc_item)
self.trans_stdc_item.show()
self.trans_item = gtk.MenuItem("Transformation")
self.append(self.trans_item) self.append(self.trans_item)
self.trans_item.set_submenu(self.trans_menu)
self.trans_item.show() self.trans_item.show()
# Build plot menu # Build plot sub menu
self.plot_menu = gtk.Menu() self.plot_menu = gtk.Menu()
self.plot_image_item = gtk.MenuItem('Image Plot') self.plot_image_item = gtk.MenuItem('Image Plot')
@ -297,3 +316,20 @@ class NavigatorMenu(gtk.Menu):
ds = self.dataset.transpose() ds = self.dataset.transpose()
icon = fluents.icon_factory.get("dataset") icon = fluents.icon_factory.get("dataset")
project.data_tree_insert(self.tree_iter, self.dataset.get_name()+".T", ds, None, "black", icon) project.data_tree_insert(self.tree_iter, self.dataset.get_name()+".T", ds, None, "black", icon)
def on_standardise_rows(self, item, navigator):
project = main.project
ds = self.dataset.copy()
axis = 1
ds._array = ds._array/scipy.expand_dims(ds._array.std(axis), axis)
icon = fluents.icon_factory.get("dataset")
project.data_tree_insert(self.tree_iter, self.dataset.get_name()+".rsc", ds, None, "black", icon)
def on_standardise_cols(self, item, navigator):
project = main.project
ds = self.dataset.copy()
axis = 0
ds._array = ds._array/scipy.expand_dims(ds._array.std(axis), axis)
icon = fluents.icon_factory.get("dataset")
project.data_tree_insert(self.tree_iter, self.dataset.get_name()+".csc", ds, None, "black", icon)