Пример #1
0

if __name__ == "__main__":
    # Cluster your data
    CLUSTER_DATA = 0  # We don't generally run this code. We kept this for documentation
    # d1mice = studyparams.ASTR_D1_CHR2_MICE
    d1mice = studyparams.SINGLE_MOUSE
    if CLUSTER_DATA:  # SPIKE SORTING
        inforecFile = os.path.join(settings.INFOREC_PATH,
                                   '{}_inforec.py'.format(d1mice))
        clusteringObj = spikesorting.ClusterInforec(inforecFile)
        clusteringObj.process_all_experiments()
        pass

    # Generate_cell_database_filters cells with the followings: isi < 0.05, spike quality > 2
    basicDB = celldatabase.generate_cell_database_from_subjects(d1mice)

    d1DBFilename = os.path.join(settings.FIGURES_DATA_PATH,
                                '{}_d1mice.h5'.format(studyparams.STUDY_NAME))
    # Create and save a database, computing first the base stats and then the indices
    firstDB = calculate_base_stats(basicDB, filename=d1DBFilename)
    # bestCells = calculate_indices(firstDB, filename = d1DBFilename)

    if SAVE:
        dbpath = os.path.join(settings.FIGURES_DATA_PATH,
                              studyparams.STUDY_NAME,
                              '{}.h5'.format('_'.join(d1mice)))
        # dbpath = os.path.join(settings.FIGURES_DATA_PATH, studyparams.STUDY_NAME, '{}.h5'.format('temp'))
        if os.path.isdir(
                os.path.join(settings.FIGURES_DATA_PATH,
                             studyparams.STUDY_NAME)):
Пример #2
0
'''
Test generating databases for multiple subjects.
'''

from jaratoolbox import celldatabase

reload(celldatabase)

#subjects = ['band062','band072']
subjects = ['pinp019', 'pinp026']

celldb = celldatabase.generate_cell_database_from_subjects(subjects)
#dd = celldatabase.generate_cell_database_from_subjects(subjects,removeBadCells=False)
Пример #3
0
    SAVE = 1  # 1: Save database
    startTime = time.time()

    # -- Cluster your data --
    CLUSTER_DATA = 0  # We don't generally run this code. We kept this for documentation
    miceList = studyparams.MICE_LIST
    if CLUSTER_DATA:  #SPIKE SORTING
        inforecFile = os.path.join(settings.INFOREC_PATH,
                                   '{}_inforec.py'.format(d1mice))
        clusteringObj = spikesorting.ClusterInforec(inforecFile)
        clusteringObj.process_all_experiments()
        pass

    # -- Generate_cell_database_filters cells with the followings: isi < 0.05, spike quality > 2 --
    celldb = celldatabase.generate_cell_database_from_subjects(miceList)

    # Computing first the base stats and then the indices

    if SAVE:
        dbPath = os.path.join(settings.FIGURES_DATA_PATH,
                              studyparams.STUDY_NAME)
        dbFilename = os.path.join(
            dbPath, 'celldb_{}.h5'.format(studyparams.STUDY_NAME))
        if os.path.isdir(dbPath):
            celldatabase.save_hdf(celldb, dbFilename)
            print('Saved database to {}'.format(dbFilename))
        else:
            print(
                '{} does not exist. Please create this folder.'.format(dbPath))
Пример #4
0

def calculate_cell_locations(db):
    pass


if __name__ == "__main__":

    # -- Spike sort the data (code is left here for reference) --
    '''
    subject = 'testXXX'
    inforecFile = os.path.join(settings.INFOREC_PATH,'{}_inforec.py'.format(subject))
    clusteringObj = spikesorting.ClusterInforec(inforecFile)
    clusteringObj.process_all_experiments()
    '''
    
    # -- Generate cell database (this function excludes clusters with isi>0.05, spikeQuality<2 --
    celldb = celldatabase.generate_cell_database_from_subjects(studyparams.MICE_LIST)

    # -- Compute the base stats and indices for each cell --
    celldb = calculate_base_stats(celldb)  # Calculated for all cells
    celldb = calculate_indices(celldb)     # Calculated for a selected subset of cells

    dbPath = os.path.join(settings.FIGURES_DATA_PATH, studyparams.STUDY_NAME)
    dbFilename = os.path.join(dbPath,'celldb_{}.h5'.format(studyparams.STUDY_NAME))
    if os.path.isdir(dbPath):
        celldatabase.save_hdf(celldb, dbFilename)
        print('Saved database to {}'.format(dbFilename))
    else:
        print('{} does not exist. Please create this folder.'.format(dbPath))
Пример #5
0
# -- select which database to generate --
args = sys.argv[1:]
if len(args):
    dbsToGenerate = np.zeros(2)
    indsToGenerate = [int(x) for x in args]
    dbsToGenerate[indsToGenerate] = 1
else:
    print("Please select a database to generate (0: photoID, 1: inactivation)")

if dbsToGenerate[0]: 
    # cluster your data
    chr2mice = studyparams.PV_CHR2_MICE + studyparams.SOM_CHR2_MICE
    cluster_ephys_data.cluster_spike_data(chr2mice)
    
    # creates a basic database and performs cluster rescue
    basicDB = celldatabase.generate_cell_database_from_subjects(chr2mice)
    basicDB = cluster_ephys_data.cluster_rescue(basicDB, isiThreshold=studyparams.ISI_THRESHOLD)
    
    # creates and saves a database for photoidentified cells, computing first the base stats and then the indices
    photoDBFilename = os.path.join(settings.FIGURES_DATA_PATH, figparams.STUDY_NAME,'photoidentification_cells.h5')
    photoIDDB = database_photoidentification.photoID_base_stats(basicDB, filename = photoDBFilename)
    photoIDDB = database_photoidentification.photoID_indices(basicDB, filename = photoDBFilename)
 
if dbsToGenerate[1]:
    # cluster your data
    archTmice = studyparams.PV_ARCHT_MICE + studyparams.SOM_ARCHT_MICE
    cluster_ephys_data.cluster_spike_data(archTmice)
    
    # creates and saves a database for inactivation
    inactivationDBFilename = os.path.join(settings.FIGURES_DATA_PATH, figparams.STUDY_NAME,'inactivation_cells.h5')
    basicDB = celldatabase.generate_cell_database_from_subjects(archTmice)