Skip to content

Commit

Permalink
03012021
Browse files Browse the repository at this point in the history
-rclick for setting date filter
-more general concat
  • Loading branch information
earnestt1234 committed Mar 2, 2021
1 parent b10e80d commit 6e2d41a
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 16 deletions.
Binary file modified FED3_Viz/__pycache__/_version.cpython-37.pyc
Binary file not shown.
28 changes: 28 additions & 0 deletions FED3_Viz/fed3viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,8 @@ def config_color_mac(widget):
self.r_menu_file_single.add_command(label='Create Group', command=self.create_group)
self.r_menu_file_single.add_command(label='Edit Group', command=self.edit_group)
self.r_menu_file_single.add_separator()
self.r_menu_file_single.add_command(label='Set date filter', command=self.r_set_datefilter_fromfiles)
self.r_menu_file_single.add_separator()
self.r_menu_file_single.add_command(label='Delete', command=self.delete_FEDs)

self.r_menu_file_multi = tkinter.Menu(self, tearoff=0,)
Expand All @@ -1155,6 +1157,8 @@ def config_color_mac(widget):
self.r_menu_file_multi.add_separator()
self.r_menu_file_multi.add_command(label='Concatenate', command=self.concat_feds)
self.r_menu_file_multi.add_separator()
self.r_menu_file_multi.add_command(label='Set date filter', command=self.r_set_datefilter_fromfiles)
self.r_menu_file_multi.add_separator()
self.r_menu_file_multi.add_command(label='Delete', command=self.delete_FEDs)

self.plot_listbox.bind(self.r_click, self.r_raise_menu)
Expand Down Expand Up @@ -3240,6 +3244,30 @@ def r_select_from_plot(self):
self.update_buttons_home(None)
self.tabcontrol.select(self.home_tab)

def r_set_datefilter_fromfiles(self):
selected = self.files_spreadsheet.selection()
feds = [self.LOADED_FEDS[int(i)] for i in selected]
if not feds:
return
s = min([fed.start_time for fed in feds])
e = max([fed.end_time for fed in feds])
shour = list(self.times_to_int.keys())[s.hour]
ehour = list(self.times_to_int.keys())[e.hour]
if str(self.date_filter_s_days.cget('state')) == 'disabled':
self.date_filter_s_days.configure(state=tk.NORMAL)
self.date_filter_s_days.set_date(s)
self.date_filter_s_days.configure(state=tk.DISABLED)
else:
self.date_filter_s_days.set_date(s)
if str(self.date_filter_e_days.cget('state')) == 'disabled':
self.date_filter_e_days.configure(state=tk.NORMAL)
self.date_filter_e_days.set_date(e)
self.date_filter_e_days.configure(state=tk.DISABLED)
else:
self.date_filter_e_days.set_date(e)
self.date_filter_s_hour.set(shour)
self.date_filter_e_hour.set(ehour)

root = FED3_Viz()
root.protocol("WM_DELETE_WINDOW", root.on_close)
root.bind('<Escape>', root.escape)
Expand Down
Binary file modified FED3_Viz/fed_inspect/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file modified FED3_Viz/fed_inspect/__pycache__/fed_inspect.cpython-37.pyc
Binary file not shown.
Binary file modified FED3_Viz/getdata/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file modified FED3_Viz/getdata/__pycache__/getdata.cpython-37.pyc
Binary file not shown.
Binary file modified FED3_Viz/load/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file modified FED3_Viz/load/__pycache__/load.cpython-37.pyc
Binary file not shown.
17 changes: 1 addition & 16 deletions FED3_Viz/load/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,25 +248,10 @@ def fed_concat(feds):
if not is_concatable(feds):
raise FedCannotConcat('FED file dates overlap, cannot concat')
output=[]
original_names = ['Device_Number',
'Battery_Voltage',
'Motor_Turns',
'Session_Type',
'Event',
'Active_Poke',
'Left_Poke_Count',
'Right_Poke_Count',
'Pellet_Count',
'Retrieval_Time',]
for fed in feds:
cols = fed.data.columns
for name in original_names:
if name not in cols:
original_names.remove(name)
offsets = {}
sorted_feds = sorted(feds, key=lambda x: x.start_time)
for i, fed in enumerate(sorted_feds):
df = fed.data.copy().loc[:,original_names]
df = fed.data.copy()
if i==0:
df['Concat_#'] = i
output.append(df)
Expand Down
Binary file modified FED3_Viz/plots/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file modified FED3_Viz/plots/__pycache__/plots.cpython-37.pyc
Binary file not shown.

0 comments on commit 6e2d41a

Please sign in to comment.