import sys import os sys.path.append('../..') from OpenElectrophy.core.tools import * from OpenElectrophy.spikesorting import SpikeSorter, generate_block_for_sorting from OpenElectrophy.core import OEBase, open_db import quantities as pq url = 'sqlite:///' dbinfo = open_db(url=url, use_global_session=True) #~ session = dbinfo.Session() def test1(): bl1 = generate_block_for_sorting( nb_unit=2, duration=3. * pq.s, nb_segment=2, ) oebl1 = OEBase.from_neo(bl1, dbinfo.mapped_classes, cascade=True) oebl1.save() bl2 = generate_block_for_sorting( nb_unit=3, duration=2.5 * pq.s, nb_segment=1, ) oebl2 = OEBase.from_neo(bl2, dbinfo.mapped_classes, cascade=True)
import sys import os sys.path.append('../..') from OpenElectrophy.core.tools import * from OpenElectrophy.spikesorting import SpikeSorter, generate_block_for_sorting from OpenElectrophy.core import OEBase, open_db import quantities as pq url = 'sqlite:///' dbinfo = open_db(url = url, use_global_session = True) #~ session = dbinfo.Session() def test1(): bl1 = generate_block_for_sorting(nb_unit = 2, duration = 3.*pq.s, nb_segment = 2, ) oebl1 = OEBase.from_neo(bl1, dbinfo.mapped_classes, cascade =True) oebl1.save() bl2 = generate_block_for_sorting(nb_unit = 3, duration = 2.5*pq.s, nb_segment = 1, ) oebl2 = OEBase.from_neo(bl2, dbinfo.mapped_classes, cascade =True) oebl2.save()
from OpenElectrophy.gui.guiutil.picklesettings import PickleSettings from OpenElectrophy.spikesorting import SpikeSorter, generate_block_for_sorting from OpenElectrophy.core import OEBase, open_db #~ from OpenElectrophy.core.base import OEBase import os import quantities as pq import numpy as np #~ if os.path.exists('test_spikesorting.sqlite'): #~ os.remove('test_spikesorting.sqlite') url = 'sqlite:///test_spikesorting.sqlite' dbinfo = open_db(url = url, use_global_session = True, myglobals = globals(),) session = dbinfo.Session() oebl = session.query(Block).first() if oebl is None: print 'do not exists: so create' bl = generate_block_for_sorting(nb_unit = 6, duration = 30.*pq.s, noise_ratio = 0.2, nb_segment = 2, ) #~ for s, seg in enumerate(bl.segments): #~ for k, sptr in enumerate(seg.spiketrains): #~ print 's', s, 'k', k, sptr.size print bl.recordingchannelgroups oebl = OEBase.from_neo(bl, dbinfo.mapped_classes, cascade =True) print oebl.recordingchannelgroups
from OpenElectrophy.gui.guiutil.picklesettings import PickleSettings from OpenElectrophy.spikesorting import SpikeSorter, generate_block_for_sorting from OpenElectrophy.core import OEBase, open_db #~ from OpenElectrophy.core.base import OEBase import os import quantities as pq import numpy as np #~ if os.path.exists('test_spikesorting.sqlite'): #~ os.remove('test_spikesorting.sqlite') url = 'sqlite:///test_spikesorting.sqlite' dbinfo = open_db( url=url, use_global_session=True, myglobals=globals(), ) session = dbinfo.Session() oebl = session.query(Block).first() if oebl is None: print 'do not exists: so create' bl = generate_block_for_sorting( nb_unit=6, duration=30. * pq.s, noise_ratio=0.2, nb_segment=2, ) #~ for s, seg in enumerate(bl.segments): #~ for k, sptr in enumerate(seg.spiketrains): #~ print 's', s, 'k', k, sptr.size