mainly play in plots
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#import logger
|
||||
import logger
|
||||
from scipy import array,take,asarray,shape
|
||||
import project
|
||||
#from sets import Set as set
|
||||
from itertools import izip
|
||||
|
||||
|
||||
@@ -30,19 +29,25 @@ class Dataset:
|
||||
enum_ids = {}
|
||||
if dim_name not in project.c_p.dim_names:
|
||||
dim_name = project.c_p.suggest_dim_name(dim_name)
|
||||
if not ids:
|
||||
ids = self._create_identifiers(axis)
|
||||
if not ids:
|
||||
ids = self._create_identifiers(axis)
|
||||
for num,name in enumerate(ids):
|
||||
enum_ids[name] = num
|
||||
self.ids[dim_name] = enum_ids
|
||||
self._ids_set = self._ids_set.union(set(ids))
|
||||
self._dim_num[dim_name] = axis
|
||||
self._dim_names.append(dim_name)
|
||||
for df,d in izip(def_list,self.dims):
|
||||
#if dim_name in project.c_p.dim_names:
|
||||
# if ids:
|
||||
# # check that identifers are same as before
|
||||
# raise NotImplementedError
|
||||
# else:
|
||||
|
||||
for df,d in izip(def_list,self.dims): #check that data and labels match
|
||||
df=df[1]
|
||||
if len(df)!=d and df:
|
||||
raise ValueError,"dim size and identifyer mismatch"
|
||||
|
||||
|
||||
def names(self,axis=0):
|
||||
"""Returns identifier names of a dimension. NB: not in any order! """
|
||||
|
||||
@@ -69,7 +74,11 @@ class Dataset:
|
||||
"""Creates identifiers along an axis"""
|
||||
n_dim = self.dims[axis]
|
||||
return [str(axis) + '_' + str(i) for i in range(n_dim)]
|
||||
|
||||
|
||||
def index_to_id(self,dim_name,index):
|
||||
dim_ids = self.ids[dim_name]
|
||||
return [id for id,ind in dim_ids.items() if ind in index]
|
||||
|
||||
class Selection:
|
||||
"""Handles selected identifiers along each dimension of a dataset"""
|
||||
def __init__(self):
|
||||
|
Reference in New Issue
Block a user