Skip to content

Commit

Permalink
bugfixes: register version number and water administration mL in Alyx
Browse files Browse the repository at this point in the history
  • Loading branch information
oliche committed Jul 14, 2023
1 parent 2302187 commit bc18d72
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions iblrig/alyx.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
from one.registration import RegistrationClient
import iblrig

log = logging.getLogger("iblrig")

Expand All @@ -24,7 +25,7 @@ def ensure_list(x):
'n_correct_trials': settings_dict['NTRIALS_CORRECT'],
'n_trials': settings_dict['NTRIALS'],
'projects': ensure_list(settings_dict['PROJECTS']),
'task_protocol': settings_dict['PYBPOD_PROTOCOL'],
'task_protocol': settings_dict['PYBPOD_PROTOCOL'] + iblrig.__version__,
'lab': settings_dict['ALYX_LAB'],
'start_time': settings_dict['SESSION_START_TIME'],
'end_time': settings_dict['SESSION_END_TIME']
Expand All @@ -51,8 +52,8 @@ def ensure_list(x):
session=ses['url'][-36:],
subject=settings_dict['SUBJECT_NAME'],
water_type=settings_dict.get('REWARD_TYPE', None),
water_administered=settings_dict['TOTAL_WATER_DELIVERED'],
water_administered=settings_dict['TOTAL_WATER_DELIVERED'] / 1000,
)
one.alyx.rest('water-administrations', 'create', data=wa_data)
log.info(f"Water administered registered in Alyx database: {ses['subject']},"
f"{settings_dict['TOTAL_WATER_DELIVERED']}mL")
f"{settings_dict['TOTAL_WATER_DELIVERED'] / 1000}mL")
2 changes: 1 addition & 1 deletion iblrig/test/tasks/test_biased_choice_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_task_biased(self):
date=task.session_info['SESSION_START_TIME'][:10], number=task.session_info['SESSION_NUMBER'])
full_session = self.one.alyx.rest('sessions', 'read', id=ses[0]['id'])
# and the water administered
assert full_session['wateradmin_session_related'][0]['water_administered'] == init_water
assert full_session['wateradmin_session_related'][0]['water_administered'] == init_water / 1000
# and the related weighing
wei = self.one.alyx.rest('weighings', 'list', nickname=self.kwargs['subject'],
date=task.session_info['SESSION_START_TIME'][:10])
Expand Down

0 comments on commit bc18d72

Please sign in to comment.