Skip to content

Instantly share code, notes, and snippets.

@sneakers-the-rat
Created April 17, 2021 01:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sneakers-the-rat/eebe675326a157df49f66f62c4e33a6e to your computer and use it in GitHub Desktop.
Save sneakers-the-rat/eebe675326a157df49f66f62c4e33a6e to your computer and use it in GitHub Desktop.
typical autopilot params
protocol = [
{
"allow_repeat": False,
"graduation": {
"type": "n_trials",
"value": {
"current_trial": "0",
"n_trials": "200",
"type": "n_trials"
}
},
"reward": {
"type": "volume",
"value": 5.0
},
"step_name": "Free Water",
"task_type": "Free Water"
},
{
"bias_mode": 0,
"correction": True,
"correction_pct": "40",
"graduation": {
"type": "n_trials",
"value": {
"current_trial": "0",
"n_trials": "300",
"type": "n_trials"
}
},
"punish_dur": "1000",
"req_reward": True,
"reward": {
"type": "volume",
"value": 3.0
},
"step_name": "request_rewards",
"stim": {
"sounds": {
"L": [
{
"duration": "256",
"type": "Gap"
}
],
"R": [
{
"duration": "0",
"type": "Gap"
}
]
},
"tag": "Sounds",
"type": "sounds"
},
"task_type": "2AFC_Gap"
},
{
"bias_mode": 0,
"correction": True,
"correction_pct": "40",
"graduation": {
"type": "accuracy",
"value": {
"threshold": "0.75",
"type": "accuracy",
"window": "500"
}
},
"punish_dur": "2000",
"req_reward": False,
"reward": {
"type": "volume",
"value": 3
},
"step_name": "long_gap",
"stim": {
"sounds": {
"L": [
{
"duration": "256",
"type": "Gap"
}
],
"R": [
{
"duration": "0",
"type": "Gap"
}
]
},
"tag": "Sounds",
"type": "sounds"
},
"task_type": "2AFC_Gap"
},
{
"bias_mode": 0,
"correction": True,
"correction_pct": "40",
"graduation": {
"type": "accuracy",
"value": {
"threshold": "0.75",
"type": "accuracy",
"window": "500"
}
},
"punish_dur": "2000",
"req_reward": False,
"reward": {
"type": "volume",
"value": 3
},
"step_name": "gap_128",
"stim": {
"sounds": {
"L": [
{
"duration": "256",
"type": "Gap"
},
{
"duration": "128",
"type": "Gap"
}
],
"R": [
{
"duration": "0",
"type": "Gap"
}
]
},
"tag": "Sounds",
"type": "sounds"
},
"task_type": "2AFC_Gap"
},
{
"bias_mode": 0,
"correction": True,
"correction_pct": "40",
"graduation": {
"type": "accuracy",
"value": {
"threshold": "0.75",
"type": "accuracy",
"window": "500"
}
},
"punish_dur": "3000",
"req_reward": False,
"reward": {
"type": "volume",
"value": 3
},
"step_name": "gap_64",
"stim": {
"sounds": {
"L": [
{
"duration": "256",
"type": "Gap"
},
{
"duration": "128",
"type": "Gap"
},
{
"duration": "64",
"type": "Gap"
}
],
"R": [
{
"duration": "0",
"type": "Gap"
}
]
},
"tag": "Sounds",
"type": "sounds"
},
"task_type": "2AFC_Gap"
},
{
"bias_mode": 0,
"correction": False,
"correction_pct": "0",
"graduation": {
"type": "accuracy",
"value": {
"threshold": "0.70",
"type": "accuracy",
"window": "1000"
}
},
"punish_dur": "5000",
"req_reward": False,
"reward": {
"type": "volume",
"value": 3
},
"step_name": "gap_all",
"stim": {
"manager": "proportional",
"type": "sounds",
"management":{"frequency_type":"within_side"},
"sounds": {
"L": [
{
"duration": "256",
"type": "Gap",
"management":{"frequency":10}
},
{
"duration": "128",
"type": "Gap",
"management":{"frequency":10}
},
{
"duration": "64",
"type": "Gap",
"management":{"frequency":10}
},
{
"duration": "32",
"type": "Gap",
"management":{"frequency":10}
},
{
"duration": "24",
"type": "Gap",
"management":{"frequency":10}
},
{
"duration": "16",
"type": "Gap",
"management":{"frequency":10}
},
{
"duration": "8",
"type": "Gap",
"management":{"frequency":1}
},
{
"duration": "6",
"type": "Gap",
"management":{"frequency":1}
},
{
"duration": "4",
"type": "Gap",
"management":{"frequency":1}
},
{
"duration": "2",
"type": "Gap",
"management":{"frequency":1}
},
{
"duration": "1",
"type": "Gap",
"management":{"frequency":1}
}
],
"R": [
{
"duration": "0",
"type": "Gap",
"management":{"frequency":1}
}
]
},
"tag": "Sounds"
},
"task_type": "2AFC_Gap"
},
{
"arena_led_mode": "STIM",
"bias_mode": False,
"correction": False,
"graduation": {
"type": "n_trials",
"value": {
"current_trial": "0",
"n_trials": "9999999",
"type": "n_trials"
}
},
"laser_durations": 100,
"laser_duty_cycle": [
0.125,
0.25,
0.5,
1.0
],
"laser_freq": 200,
"laser_mode": "L",
"laser_probability": 0.1,
"noise_amplitude": 0.01,
"punish_dur": 5000,
"req_reward": False,
"reward": {
"type": "volume",
"value": 3
},
"step_name": "2AFC_Gap_Laser",
"stim": {
"sounds": {
"L": [
{
"duration": "256",
"type": "Gap",
"management":{"frequency":10}
},
{
"duration": "128",
"type": "Gap",
"management":{"frequency":10}
},
{
"duration": "64",
"type": "Gap",
"management":{"frequency":10}
},
{
"duration": "32",
"type": "Gap",
"management":{"frequency":10}
},
{
"duration": "24",
"type": "Gap",
"management":{"frequency":10}
},
{
"duration": "16",
"type": "Gap",
"management":{"frequency":10}
},
{
"duration": "8",
"type": "Gap",
"management":{"frequency":1}
},
{
"duration": "6",
"type": "Gap",
"management":{"frequency":1}
},
{
"duration": "4",
"type": "Gap",
"management":{"frequency":1}
},
{
"duration": "2",
"type": "Gap",
"management":{"frequency":1}
},
{
"duration": "1",
"type": "Gap",
"management":{"frequency":1}
}
],
"R": [
{
"duration": "0",
"type": "Gap",
"management":{"frequency":1}
}
]
},
"tag": "Sounds",
"type": "sounds"
},
"task_type": "2AFC_Gap_Laser"
}
]
# --------------------
pilot_params = {
"AGENT": "PILOT",
"AUDIOSERVER": True,
"BASEDIR": "/home/pi/autopilot",
"CHILDID": "",
"CONFIG": "",
"DATADIR": "/home/pi/autopilot/data",
"FS": 96000,
"HARDWARE": {
"FLAGS": {
"L": "",
"R": ""
},
"LEDS": {
"C": {
"pins": [
22,
18,
16
],
"polarity": 0
},
"L": {
"pins": [
11,
13,
15
],
"polarity": 0
},
"R": {
"pins": [
19,
21,
23
],
"polarity": 0
},
"TOP": {
"name": "LED_TOP",
"pin": 32
}
},
"LASERS": {
"LR": {
"name": "LASER",
"pin": 36
}
},
"POKES": {
"C": {
"pin": 8,
"polarity": 0
},
"L": {
"pin": 24,
"polarity": 0
},
"R": {
"pin": 10,
"polarity": 0
}
},
"PORTS": {
"C": 33,
"L": 31,
"R": 37
}
},
"JACKDSTRING": "jackd -P75 -p16 -t2000 -dalsa -dhw:sndrpihifiberry -P -rfs -n3 -s &",
"LINEAGE": "NONE",
"LOGDIR": "/home/pi/autopilot/logs",
"LOGLEVEL": "DEBUG",
"MSGPORT": 5565,
"NAME": "pilot_1",
"NCHANNELS": 1,
"OUTCHANNELS": [
1
],
"PARENTID": "",
"PARENTIP": "",
"PARENTPORT": "",
"PIGPIOARGS": "-t 0 -l",
"PIGPIOMASK": "1111110000111111111111110000",
"PROTOCOLDIR": "/home/pi/autopilot/protocols",
"PULLDOWNS": "",
"PULLUPS": [
7
],
"PUSHPORT": 5560,
"REPODIR": "/home/pi/git/autopilot",
"SOUNDDIR": "/home/pi/autopilot/sounds",
"TERMINALIP": "192.168.0.100",
"VENV": "/home/pi/git/autopilot/venv",
"VIZDIR": "/home/pi/autopilot/viz",
"HASH": "638d585d5aa284fc05e33028f05e1d3457a2ebcc",
"PORT_CALIBRATION": {
"C": {
"slope": 6.465517241379311,
"intercept": 1.2499999999999964
},
"R": {
"slope": 5.795391705069124,
"intercept": 3.4348387096774218
},
"L": {
"slope": 6.65605556359427,
"intercept": 2.527854145565037
}
},
"SUBJECT": "35"
}
def recursive_len(recursed):
total_len = 0
iterate_this = recursed
if isinstance(recursed, dict):
iterate_this = recursed.values()
for i in iterate_this:
if isinstance(i, (dict, list)):
total_len += recursive_len(i)
else:
total_len += 1
return total_len
recursive_len(protocol) + recursive_len(pilot_params)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment