from jaratest.nick.database import dataloader from jaratest.nick.database import dataplotter from jaratest.nick.database import cellDB from jaratest.nick.database import clusterfuncs from jaratoolbox import spikesorting from matplotlib import pyplot as plt from jaratoolbox import behavioranalysis from jaratoolbox import spikesanalysis reload(cellDB) reload(clusterfuncs) figdb = cellDB.CellDB() figdbFn = '/home/nick/data/database/pinp003_thalamus_cells.json' figdb.load_from_json(figdbFn) loader = dataloader.DataLoader('offline', experimenter='nick') figdb[0].get_session_types() clusterfuncs.plot_cluster_tuning(figdb[1], 3) spikeData, eventData, behavData = loader.get_cluster_data(figdb[1], 3) currentFreq = behavData['currentFreq'] possibleFreq = np.unique(currentFreq) currentIntensity = behavData['currentIntensity'] possibleIntensity = np.unique(currentIntensity) spikeTimestamps = spikeData.timestamps eventOnsetTimes = loader.get_event_onset_times(eventData)
from jaratest.nick.database import cellDB dbFn = '/home/nick/data/database/nick_thalamus_cells.json' db = cellDB.CellDB() db.load_from_json(dbFn) figuredb = cellDB.CellDB() figuredb.append(db[0]) figuredb.append(db[8]) figuredb.append(db[10]) figuredb.append(db[1]) figuredb[0].comments='B/C/D Option - site 1 T6c3 (Thalamus)' figuredb[1].comments='B/C/D (our favorite so far), also possibly J - site 6 T6c3 (Thalamus)' figuredb[2].comments='J - site4 T3c10 (Thalamus)' figuredb[3].comments='K - site1 T6c6 (Thalamus)' cortexFn = '/home/nick/Desktop/cortexdb.json' cortexdb = cellDB.CellDB() cortexdb.load_from_json(cortexFn) for cell in cortexdb: figuredb.append(cell)
def setUp(self): self.database = cellDB.CellDB()
d2site1.add_session('11-15-56', None, sessionTypes['nb']) d2site1.add_session('11-18-36', None, sessionTypes['lp']) d2site1.add_session('11-21-26', None, sessionTypes['lt']) d2site1.add_session('11-25-58', 'a', sessionTypes['tc']) d2site1.add_session('11-39-46', None, sessionTypes['bf']) d2site1.add_session('11-42-37', None, sessionTypes['3p']) d2site1.add_session('11-45-22', None, sessionTypes['1p']) d2site1.add_clusters({3: [2, 3, 5], 6:[3, 7]}) # ---------------------- ##Initializing the database and adding clusters # ---------------------- db = cellDB.CellDB() db.add_clusters(d1site1.clusterList) db.add_clusters(d2site1.clusterList) # ---------------------- ##Saving and loading databases # ---------------------- #Writing currently overwrites the file. The proper way is to load the database, #append new clusters to it, and then rewrite the file with the new contents added #However, I am currently asking for confirmation unless you pass force=True. dbfile = '/tmp/allcells.json' db.write_to_json(dbfile)