{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "Effective computation in Biomechanics\n", "\n", "Romain Martinez " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "\n", "| [Contents](index.ipynb) | [Introduction to Python](01.00-why-python.ipynb) >" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Preface" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import altair as alt\n", "import pandas as pd\n", "\n", "%load_ext lab_black" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Logistic\n", "\n", "Today's material is available on [github.com/pyomeca/tutorials](https://github.com/pyomeca/tutorials).\n", "\n", "You can follow the materials:\n", "- By running the code using the Jupyter notebooks available in this repository's notebooks directory.\n", "- By launching executable versions of these notebooks using binder: [![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/pyomeca/tutorials/master?filepath=notebooks%2FIndex.ipynb)\n", "- By reading the online (non-executable) version of the notebooks using nbviewer: [![Nbviewer](https://raw.github.com/jupyter/design/master/logos/Badges/nbviewer_badge.svg?sanitize=true)](https://nbviewer.jupyter.org/github/pyomeca/tutorials/blob/master/notebooks/Index.ipynb)\n", "\n", "Stop me anytime if you have any questions.\n", "\n", "Feel free to contact me to:\n", "- Setup up your development environment (_python, pyomeca, libraries, IDE_)\n", "- Get help with your research projects" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Course Outline\n", "\n", "The main goal is to give you **practical advice** that will be useful in your projects." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "jupyter": { "source_hidden": true } }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "" ], "text/plain": [ "alt.LayerChart(...)" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "seances_list = [\n", " (\"Romain\", \"2020-01-08\", \"Programming with Python in biomechanics\"),\n", " (\"François\", \"2020-01-15\", \"Rigid bodies, kinematics and dynamics\"),\n", " (\"François\", \"2020-01-22\", \"Rigid bodies, kinematics and dynamics - application\",),\n", " (\"François\", \"2020-01-29\", \"Optimal control\"),\n", " (\"François\", \"2020-02-05\", \"Optimal control - application\",),\n", " (\"François\", \"2020-02-12\", \"Optimal control in biomechanics\"),\n", " (\"Romain\", \"2020-02-19\", \"Musculoskeletal Modelling\"),\n", " (\"Étienne\", \"2020-02-26\", \"Introduction to descriptive statistics\",),\n", " (\"Spring Break\", \"2020-03-04\", \"\",),\n", " (\"Romain\", \"2020-03-11\", \"Statistics and machine learning in biomechanics\",),\n", " (\"Étienne\", \"2020-03-18\", \"Kinematics\"),\n", " (\"Étienne\", \"2020-03-25\", \"IMU signal processing\"),\n", " (\"Étienne\", \"2020-04-01\", \"EMG\"),\n", " (\"Project\", \"2020-04-08\", \"\"),\n", " (\"Project\", \"2020-04-15\", \"\"),\n", " (\"Exam\", \"2020-04-22\", \"\"),\n", "]\n", "\n", "seances = pd.DataFrame(seances_list, columns=[\"instructor\", \"date\", \"subject\"])\n", "\n", "base = alt.Chart(seances).encode(alt.Y(\"monthdate(date):O\", title=None))\n", "\n", "scale = alt.Scale(\n", " domain=seances[\"instructor\"].unique().tolist(),\n", " range=[\"#B0BEC5\", \"#FFAB91\", \"#A5D6A7\", \"#80CBC4\", \"#EF9A9A\", \"#F48FB1\"],\n", ")\n", "color = base.mark_rect().encode(alt.Color(\"instructor\", legend=None, scale=scale))\n", "\n", "text_args = {\"fontSize\": 20, \"color\": \"#263238\"}\n", "subject = base.mark_text(align=\"left\", dx=-370, **text_args).encode(alt.Text(\"subject\"))\n", "instructor = base.mark_text(align=\"right\", dx=370, **text_args).encode(\n", " alt.Text(\"instructor\")\n", ")\n", "\n", "(color + subject + instructor).properties(width=800, height=600)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This first course has three parts:\n", "1. __Getting started__: jump into Python, data containers, functions, flow control and classes\n", "2. __Getting it done__: learn about Numpy and Pyomeca, making analysis and visualization\n", "3. __Getting it right__: learn to use local and remote version control, debug and test your code" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Evaluation" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "jupyter": { "source_hidden": true }, "slideshow": { "slide_type": "slide" } }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "" ], "text/plain": [ "alt.LayerChart(...)" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "evaluations = pd.DataFrame(\n", " [(\"Examen\", 60, 70), (\"Presentations\", 20, 30), (\"Project\", 20, 10)],\n", " columns=[\"cat\", \"%\", \"textPos\"],\n", ")\n", "\n", "base = alt.Chart(evaluations)\n", "bar = base.mark_bar(size=60).encode(\n", " alt.X(\"%\", title=\"%\", axis=alt.Axis(values=[0, 20, 40, 100])),\n", " alt.Color(\"cat\", legend=None),\n", ")\n", "text = base.mark_text(**text_args).encode(alt.X(\"textPos\"), alt.Text(\"cat\"))\n", "\n", "(bar + text).properties(height=62, width=800)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "| [Contents](index.ipynb) | [Introduction to Python](01.00-why-python.ipynb) >" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "conda-env-tutorials-py" }, "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.8.1" }, "pycharm": { "stem_cell": { "cell_type": "raw", "metadata": { "collapsed": false }, "source": [] } }, "toc-showtags": false }, "nbformat": 4, "nbformat_minor": 4 }