Skip to content

Commit 599d6b5

Browse files
authored
Merge pull request #1536 from AllenNeuralDynamics/develop
[production merge] 2025-05-09
2 parents 834988c + bc4f4bc commit 599d6b5

File tree

4 files changed

+82
-8
lines changed

4 files changed

+82
-8
lines changed

src/foraging_gui/Foraging.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1556,12 +1556,30 @@ def _check_line_terminator(self, file_path):
15561556
def _LoadSchedule(self):
15571557
if os.path.exists(self.Settings["schedule_path"]):
15581558
schedule = pd.read_csv(self.Settings["schedule_path"])
1559+
1560+
# Find the correct week on the schedule
1561+
dividers = schedule[[isinstance(x,str)and('/' in x) for x in schedule['Mouse ID'].values]]
1562+
today = datetime.now().strftime('%m/%d/%Y')
1563+
1564+
# Multiple weeks on the schedule
1565+
if len(dividers) > 1:
1566+
first = dividers.iloc[0]['Mouse ID']
1567+
if datetime.strptime(today, "%m/%d/%Y") < datetime.strptime(first,"%m/%d/%Y"):
1568+
# Use last weeks schedule
1569+
schedule = schedule.loc[dividers.index.values[1]:]
1570+
else:
1571+
# Use this weeks schedule
1572+
schedule = schedule.loc[0:dividers.index.values[1]]
1573+
1574+
# Determine what mice are on the schedule
15591575
self.schedule_mice = [
15601576
x
15611577
for x in schedule["Mouse ID"].unique()
15621578
if isinstance(x, str) and (len(x) > 3) and ("/" not in x)
15631579
]
1564-
self.schedule = schedule.dropna(subset=["Mouse ID", "Box"]).copy()
1580+
1581+
# Clear rows without a mouse
1582+
self.schedule = schedule.dropna(subset=["Mouse ID"]).copy()
15651583
logging.info("Loaded behavior schedule")
15661584
else:
15671585
self.schedule_mice = None

src/foraging_gui/ForagingGUI.ui

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,28 @@
262262
</property>
263263
</widget>
264264
</item>
265+
<item row="2" column="3">
266+
<widget class="QSpinBox" name="hab_time_box">
267+
<property name="sizePolicy">
268+
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
269+
<horstretch>0</horstretch>
270+
<verstretch>0</verstretch>
271+
</sizepolicy>
272+
</property>
273+
<property name="minimum">
274+
<number>0</number>
275+
</property>
276+
<property name="maximum">
277+
<number>90</number>
278+
</property>
279+
<property name="suffix">
280+
<string> min</string>
281+
</property>
282+
<property name="prefix">
283+
<string> Habituation: </string>
284+
</property>
285+
</widget>
286+
</item>
265287
<item row="2" column="1">
266288
<widget class="QPushButton" name="Save">
267289
<property name="sizePolicy">

src/foraging_gui/ForagingGUI_Ephys.ui

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<widget class="QComboBox" name="Task">
7070
<property name="geometry">
7171
<rect>
72-
<x>620</x>
72+
<x>650</x>
7373
<y>20</y>
7474
<width>152</width>
7575
<height>20</height>
@@ -2763,6 +2763,40 @@
27632763
<bool>false</bool>
27642764
</property>
27652765
</widget>
2766+
<widget class="QSpinBox" name="hab_time_box">
2767+
<property name="enabled">
2768+
<bool>true</bool>
2769+
</property>
2770+
<property name="geometry">
2771+
<rect>
2772+
<x>240</x>
2773+
<y>20</y>
2774+
<width>110</width>
2775+
<height>23</height>
2776+
</rect>
2777+
</property>
2778+
<property name="sizePolicy">
2779+
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
2780+
<horstretch>0</horstretch>
2781+
<verstretch>0</verstretch>
2782+
</sizepolicy>
2783+
</property>
2784+
<property name="styleSheet">
2785+
<string notr="true"/>
2786+
</property>
2787+
<property name="minimum">
2788+
<number>0</number>
2789+
</property>
2790+
<property name="maximum">
2791+
<number>90</number>
2792+
</property>
2793+
<property name="suffix">
2794+
<string> min</string>
2795+
</property>
2796+
<property name="prefix">
2797+
<string> Habituation: </string>
2798+
</property>
2799+
</widget>
27662800
<widget class="QPushButton" name="NewSession">
27672801
<property name="enabled">
27682802
<bool>true</bool>
@@ -3263,7 +3297,7 @@
32633297
<widget class="QLineEdit" name="ID">
32643298
<property name="geometry">
32653299
<rect>
3266-
<x>324</x>
3300+
<x>380</x>
32673301
<y>20</y>
32683302
<width>71</width>
32693303
<height>20</height>
@@ -3282,7 +3316,7 @@
32823316
<widget class="QLabel" name="label_72">
32833317
<property name="geometry">
32843318
<rect>
3285-
<x>300</x>
3319+
<x>350</x>
32863320
<y>20</y>
32873321
<width>21</width>
32883322
<height>20</height>
@@ -3658,7 +3692,7 @@
36583692
<widget class="QLabel" name="label_74">
36593693
<property name="geometry">
36603694
<rect>
3661-
<x>400</x>
3695+
<x>450</x>
36623696
<y>20</y>
36633697
<width>71</width>
36643698
<height>20</height>
@@ -3683,7 +3717,7 @@
36833717
<widget class="QLineEdit" name="Experimenter">
36843718
<property name="geometry">
36853719
<rect>
3686-
<x>474</x>
3720+
<x>524</x>
36873721
<y>20</y>
36883722
<width>121</width>
36893723
<height>20</height>
@@ -5016,4 +5050,4 @@
50165050
</tabstops>
50175051
<resources/>
50185052
<connections/>
5019-
</ui>
5053+
</ui>

src/foraging_gui/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.6.39"
1+
__version__ = "1.6.42"

0 commit comments

Comments
 (0)