Skip to content

Commit

Permalink
checkerboard is now created as plaid
Browse files Browse the repository at this point in the history
  • Loading branch information
LynnSchmittwilken committed Jan 11, 2023
1 parent a0b60d4 commit 8ca9ca1
Show file tree
Hide file tree
Showing 8 changed files with 224 additions and 216 deletions.
79 changes: 62 additions & 17 deletions demo/illusions/checkerboard.ipynb
Expand Up @@ -30,15 +30,17 @@
"outputs": [],
"source": [
"params = {\n",
" \"shape\": None,\n",
" \"ppd\": 32,\n",
" \"visual_size\": None,\n",
" \"ppd\": 32,\n",
" \"shape\": None,\n",
" \"frequency\": None,\n",
" \"board_shape\": (5, 8),\n",
" \"check_visual_size\": 2.0,\n",
" \"targets\": ((2, 1), (2, 6)),\n",
" \"extend_targets\": False,\n",
" \"intensity_low\": 0.0,\n",
" \"intensity_high\": 1.0,\n",
" \"period\": \"ignore\",\n",
" \"rotation\": 0,\n",
" \"intensity_checks\": (0.0, 1.0),\n",
" \"intensity_target\": 0.5,\n",
"}\n",
"stim = checkerboard(**params)\n",
Expand Down Expand Up @@ -120,16 +122,18 @@
" intensity_low = intensity_range[1]\n",
" targets = [(target_row, target1_col), (target_row, target2_col)]\n",
" stim = checkerboard(\n",
" shape,\n",
" ppd,\n",
" visual_size,\n",
" board_shape,\n",
" check_visual_size,\n",
" targets,\n",
" extend_targets,\n",
" intensity_low,\n",
" intensity_high,\n",
" intensity_target,\n",
" visual_size=visual_size,\n",
" ppd=ppd,\n",
" shape=shape,\n",
" frequency=None,\n",
" board_shape=board_shape,\n",
" check_visual_size=check_visual_size,\n",
" targets=targets,\n",
" extend_targets=extend_targets,\n",
" period=\"ignore\",\n",
" rotation=0,\n",
" intensity_checks=(intensity_low, intensity_high),\n",
" intensity_target=intensity_target,\n",
" )\n",
" plot_stim(stim)\n",
"\n",
Expand Down Expand Up @@ -252,7 +256,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.5 64-bit ('stimuli-dev')",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -266,9 +270,50 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.5"
"version": "3.10.6"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "d79f930315d22092267204fc095ece7b80c939bb23fde6f7397d8c6352112825"
Expand Down
5 changes: 4 additions & 1 deletion stimuli/components/__init__.py
Expand Up @@ -318,8 +318,11 @@ def resolve_grating_params(
f"Grating frequency ({frequency}) should not exceed Nyquist limit {ppd/2} (ppd/2)"
)

# Accumulate edges of phases
# Accumulate edges of phases (rounding to avoid accumulation of
# floating point imprecisions)
edges = [*itertools.accumulate(itertools.repeat(phase_width, int(np.ceil(n_phases))))]
edges = np.round(np.array(edges), 8)
edges = list(edges)

return {
"length": length,
Expand Down

0 comments on commit 8ca9ca1

Please sign in to comment.