Skip to content

Commit

Permalink
Min weight plot threshold a constant in lab settings
Browse files Browse the repository at this point in the history
  • Loading branch information
k1o0 committed Apr 15, 2024
1 parent bc219ad commit 8e95d76
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 4 additions & 1 deletion alyx/actions/water_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from operator import attrgetter, itemgetter
import os.path as op

from django.conf import settings
from django.urls import reverse
from django.utils.html import format_html
from django.http import HttpResponse
Expand Down Expand Up @@ -563,7 +564,9 @@ def water_control(subject):
implant_weight=subject.implant_weight
)
wc.add_threshold(percentage=rw_pct + zw_pct, bgcolor=PALETTE['orange'], fgcolor='#FFC28E')
wc.add_threshold(percentage=.7, bgcolor=PALETTE['red'], fgcolor='#F08699', line_style='--')
if absolute_min := settings.WEIGHT_THRESHOLD:
wc.add_threshold(
percentage=absolute_min, bgcolor=PALETTE['red'], fgcolor='#F08699', line_style='--')
# Water restrictions.
wrs = sorted(list(subject.actions_waterrestrictions.all()), key=attrgetter('start_time'))
# Reference weight.
Expand Down
2 changes: 1 addition & 1 deletion alyx/alyx/settings_lab_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
DEFAULT_PROTOCOL = '1'
SUPERUSERS = ('root',)
STOCK_MANAGERS = ('root',)
WEIGHT_THRESHOLD = 0.75
WEIGHT_THRESHOLD = 0.8 # Absolute minimum weight threshold (red line in plots)
DEFAULT_LAB_NAME = 'defaultlab'
WATER_RESTRICTIONS_EDITABLE = False # if set to True, all users can edit water restrictions
DEFAULT_LAB_PK = '4027da48-7be3-43ec-a222-f75dffe36872'
Expand Down
3 changes: 1 addition & 2 deletions scripts/sync_ucl/prune_cortexlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@

# the sessions should also have the cortexlab lab field properly labeled before import
if Lab.objects.using('cortexlab').filter(name='cortexlab').count() == 0:
lab_dict = {'pk': CORTEX_LAB_PK,
'name': 'cortexlab'}
lab_dict = {'pk': CORTEX_LAB_PK, 'name': 'cortexlab'}
lab = Lab.objects.using('cortexlab').create(**lab_dict)
lab.save()
else:
Expand Down

0 comments on commit 8e95d76

Please sign in to comment.