def f2ttl_ok() -> bool: # Check Frame2TTL (by setting the thresholds) out = False try: pars = _grep_param_dict() f = Frame2TTL(pars["COM_F2TTL"]) out = f.ser.isOpen() f.close() except BaseException as e: log.warning(f"{e} \nCan't connect to Frame2TTL.") return out
import datetime import logging import time import iblrig.params as params import task_settings import user_settings from iblrig.frame2TTL import Frame2TTL from session_params import SessionParamHandler log = logging.getLogger("iblrig") sph = SessionParamHandler(task_settings, user_settings) f2ttl = Frame2TTL(sph.PARAMS["COM_F2TTL"]) sph.start_screen_color() sph.set_screen(rgb=[255, 255, 255]) time.sleep(1) f2ttl.measure_white() sph.set_screen(rgb=[0, 0, 0]) time.sleep(1) f2ttl.measure_black() resp = f2ttl.calc_recomend_thresholds() if resp != -1: f2ttl.set_recommendations() patch = { "COM_F2TTL": f2ttl.serial_port, "F2TTL_DARK_THRESH": f2ttl.recomend_dark, "F2TTL_LIGHT_THRESH": f2ttl.recomend_light, "F2TTL_CALIBRATION_DATE": datetime.datetime.now().date().isoformat(),
PARAMS["WATER_CALIBRATION_DATE"] # F2TTL CALIBRATION: check f2ttl values from params, warn if old calibration # WATER CALIBRATION: check water calibration values from params, warn if old calibration # Check RE log.debug("RE: Connect") m = RotaryEncoderModule(PARAMS["COM_ROTARY_ENCODER"]) log.debug("RE: set 0 position") m.set_zero_position() # Not necessarily needed log.debug("RE: Close") m.close() # Check Bpod log.debug("Bpod Connect") ser = serial.Serial(port=PARAMS["COM_BPOD"], baudrate=115200, timeout=1) log.debug("Bpod lights OFF") ser.write(struct.pack("cB", b":", 0)) log.debug("Bpod lights ON") ser.write(struct.pack("cB", b":", 1)) log.debug("Bpod Close") ser.close() # Check Frame2TTL (by setting the thresholds) f = Frame2TTL(PARAMS["COM_FRAME2TTL"]) # Create missing session folders # Run fast task to check IO # Create Alyx session reference? # Open Alyx session notes in browser? print(".")
import datetime import logging import time import iblrig.params as params import task_settings import user_settings from iblrig.frame2TTL import Frame2TTL from session_params import SessionParamHandler log = logging.getLogger('iblrig') sph = SessionParamHandler(task_settings, user_settings) f2ttl = Frame2TTL(sph.PARAMS['COM_F2TTL']) sph.start_screen_color() sph.set_screen(rgb=[255, 255, 255]) time.sleep(1) f2ttl.measure_white() sph.set_screen(rgb=[0, 0, 0]) time.sleep(1) f2ttl.measure_black() resp = f2ttl.calc_recomend_thresholds() if resp != -1: f2ttl.set_recommendations() patch = { 'COM_F2TTL': f2ttl.serial_port, 'F2TTL_DARK_THRESH': f2ttl.recomend_dark, 'F2TTL_LIGHT_THRESH': f2ttl.recomend_light, 'F2TTL_CALIBRATION_DATE': datetime.datetime.now().date().isoformat()
PARAMS['WATER_CALIBRATION_DATE'] # F2TTL CALIBRATION: check f2ttl values from params, warn if old calibration # WATER CALIBRATION: check water calibration values from params, warn if old calibration # Check RE log.debug("RE: Connect") m = RotaryEncoderModule(PARAMS['COM_ROTARY_ENCODER']) log.debug("RE: set 0 position") m.set_zero_position() # Not necessarily needed log.debug("RE: Close") m.close() # Check Bpod log.debug("Bpod Connect") ser = serial.Serial(port=PARAMS['COM_BPOD'], baudrate=115200, timeout=1) log.debug("Bpod lights OFF") ser.write(struct.pack('cB', b':', 0)) log.debug("Bpod lights ON") ser.write(struct.pack('cB', b':', 1)) log.debug("Bpod Close") ser.close() # Check Frame2TTL (by setting the thresholds) f = Frame2TTL(PARAMS['COM_FRAME2TTL']) # Create missing session folders # Run fast task to check IO # Create Alyx session reference? # Open Alyx session notes in browser? print('.')
import logging import time import iblrig.alyx as alyx import task_settings import user_settings from iblrig.frame2TTL import Frame2TTL from session_params import SessionParamHandler log = logging.getLogger('iblrig') sph = SessionParamHandler(task_settings, user_settings) f2ttl = Frame2TTL(sph.COM['FRAME2TTL']) sph.start_screen_color() sph.set_screen(rgb=[255, 255, 255]) time.sleep(1) f2ttl.measure_white() sph.set_screen(rgb=[0, 0, 0]) time.sleep(1) f2ttl.measure_black() resp = f2ttl.calc_recomend_thresholds() if resp != -1: f2ttl.set_recommendations() patch = { 'F2TTL_COM': f2ttl.serial_port, 'F2TTL_DARK_THRESH': f2ttl.recomend_dark, 'F2TTL_LIGHT_THRESH': f2ttl.recomend_light }