In [1]:
import os
from lightning import Lightning
from numpy import random, asarray, linspace, corrcoef
from colorsys import hsv_to_rgb
from sklearn import datasets
import networkx as nx
In [5]:
import matplotlib.pyplot as plt
import cPickle as pickle
import numpy as np
In [3]:
lgn = Lightning(ipython=True, local=True)
Lightning.enable_ipython(lgn)
In [8]:
#lgn.graph(M)
#M = np.loadtxt(open("/Users/etaralova/data/steph_225_tree/steph_90_01_tree_neuron_analysis/bm_adj_483061828.csv","rb"),delimiter=",")
#P = np.loadtxt(open("/Users/etaralova/data/steph_225_tree/steph_90_01_tree_neuron_analysis/rois_xy_483061828.csv","rb"),delimiter=",")
#lgn.graph(P[:,0], P[:,1],M)
In [9]:
#bm_adj_steph_90_01_tree.csv
#lgn.force(M)
In [11]:
M = np.loadtxt(open("/Users/etaralova/data/steph_225_tree/steph_90_01_tree_neuron_analysis/bm_adj_483061828.csv","rb"),delimiter=",")
P = np.loadtxt(open("/Users/etaralova/data/steph_225_tree/steph_90_01_tree_neuron_analysis/rois_xy_483061828.csv","rb"),delimiter=",")
C = np.loadtxt(open("/Users/etaralova/data/steph_225_tree/steph_90_01_tree_neuron_analysis/colors_483061828.csv","rb"),delimiter=",")
C = C*255
lgn.force(M, color=C) #-- use
#lgn.graph(P[:,0], P[:,1],M)
Out[11]:
In [13]:
lgn.graph(P[:,0], P[:,1],M,color=C)
#if you don't want edges, use an empty matrix: Z = np.zeros_like(M)
Out[13]:
In [ ]:
viz = lgn.force(M,color=C,
description="steph_"+str(ORIENT)+"_"+"%02d"%depth_ids+"_tree + high response")
viz.save_html("steph_"+str(ORIENT)+"_"+
"%02d"%depth_ids+"_tree_hi_resp.html",
overwrite=True)
print "SAVED: " + "steph_"+str(ORIENT)+"_"+"%02d"%depth_ids+"_tree_hi_resp.html"
In [307]:
from IPython.display import display, Javascript, HTML
In [308]:
ORIENT = 90
for depth_ids in (i for i in range(1,8)):
e_i = 0
#for expt_id,value in all_roi_info.iteritems():
#print expt_id
#e_i+=1
expt_id = EXPT_IDS_STRING[depth_ids-1]
print "EXpt: ", expt_id, "depth: ", depth_ids
#"483061828"
high_resp = np.array(all_roi_info[expt_id].ROI)
high_resp
M = np.loadtxt(open(viz_path+"/bm_adj_steph_"+str(ORIENT)+"_"+"%02d"%depth_ids+"_tree.csv","rb"),delimiter=",")
C = np.loadtxt(open(viz_path+"/colors_steph_"+str(ORIENT)+"_tree.csv","rb"),delimiter=",")
C = C*255
C_orig = C.copy()
#lgn.force(M,color=C)
C = C_orig.copy()
C[high_resp,...] = [255, 0, 0]
viz = lgn.force(M,color=C,
description="steph_"+str(ORIENT)+"_"+"%02d"%depth_ids+"_tree + high response")
viz.save_html("steph_"+str(ORIENT)+"_"+
"%02d"%depth_ids+"_tree_hi_resp.html",
overwrite=True)
print "SAVED: " + "steph_"+str(ORIENT)+"_"+"%02d"%depth_ids+"_tree_hi_resp.html"
orient_sel = np.where(all_roi_info[expt_id].Orientation == ORIENT)[0]
orient_sel
C = C_orig.copy()
C[orient_sel,...] = [0, 255, 0]
viz = lgn.force(M,color=C,
description="steph_90_01_tree + orient select")
#viz.save_html("steph_"+str(ORIENT)+"_"+
# "%02d"%depth_ids+"_tree_orient_sel.html",
# overwrite=True)
display(HTML(viz.get_html()))
#print "SAVED: " + "steph_"+str(ORIENT)+"_"+"%02d"%depth_ids+"_tree_orient_sel.html"