diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 38fbde5..7ab3ecc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ Before anything else, please install the git hooks that run automatic scripts during each commit and merge to strip the notebooks of superfluous metadata (and avoid merge conflicts). After cloning the repository, run the following command inside it: ``` -nbdev_install_git_hooks +nbdev_install_hooks ``` ## Did you find a bug? diff --git a/nbs/shift.ipynb b/nbs/shift.ipynb index 5103259..c172580 100644 --- a/nbs/shift.ipynb +++ b/nbs/shift.ipynb @@ -44,7 +44,9 @@ "def shift_array(input_array: np.ndarray, offset: int) -> np.ndarray:\n", " n_samples = input_array.size\n", " output_array = np.full_like(input_array, np.nan)\n", - " for i in range(n_samples - offset):\n", + " ub = n_samples - offset if offset > 0 else n_samples\n", + " lb = offset * -1 if offset < 0 else 0\n", + " for i in range(lb, ub):\n", " output_array[i + offset] = input_array[i]\n", " return output_array" ] @@ -77,9 +79,21 @@ ], "metadata": { "kernelspec": { - "display_name": "python3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.12" } }, "nbformat": 4,