-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubsetter.py
More file actions
52 lines (38 loc) · 1.65 KB
/
Copy pathsubsetter.py
File metadata and controls
52 lines (38 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# -*- coding: utf-8 -*-
"""
Created on Fri May 25 11:07:27 2018
@author: James Rig
"""
metafile_males = 'G:\kp259/DPCP_ALL\DPCP12Masterfile.csv'
metafile_females = 'G:\kp259\DPCP_ALL\DPCP3_Metafile.csv'
extract_males = MetaExtractor(metafile_males)
extract_females = MetaExtractor(metafile_females)
# Folder with all medfiles (DPCP1, DPCP2, DPCP3)
medfolder = 'G://kp259//DPCP_ALL//'
"""dates and drug should be lists"""
def subsetter(dictionary, dates, drug, verbose=False):
subset = []
for ind, filename in enumerate(dictionary['MedFilenames']):
path = medfolder + filename
onsets, offsets, med_dis_times, dis_type = medfilereader(path, ['e', 'f', 'i', 'j'], remove_var_header = True) # e onset, f offset
if dictionary['Date'][ind] in dates and dictionary['Drug'][ind] == drug:
subset.append([onsets, offsets, dictionary['RatID'][ind]])
if verbose: #assumes true
print('filename, or comment ...')
return subset
#last_lick_pcp_F = subsetter(extract_females, ['171125'], 'PCP', verbose=True)
## Could have 2 funcs, one for the for to give onsets/offsets that takes a dict
def lickanalysis(lickdata, burstThreshold=0.25, runThreshold=10):
analysis = []
for lists in lickdata:
lickon = lists[0]
offset = lists[1]
lick_analysis = lickCalc(lickon, offset, burstThreshold=burstThreshold, runThreshold=runThreshold)
analysis.append(lick_analysis)
return analysis
lick_analysis_sal_M = lickanalysis(last_lick_sal_M)
#for lists in last_lick_sal_M:
# licks = lists[0]
# offset = lists[1]
#
# lick_analysis_sal_M.append(lick_analysis)