Skip to content

Commit

Permalink
transfer repo
Browse files Browse the repository at this point in the history
  • Loading branch information
romainmartinez committed Nov 20, 2018
0 parents commit a709df2
Show file tree
Hide file tree
Showing 42 changed files with 33,747 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# DotEnv configuration
.env

# Database
*.db
*.rdb

# Pycharm
.idea

# VS Code
.vscode/

# Spyder
.spyproject/

# Jupyter NB Checkpoints
.ipynb_checkpoints/

# Mac OS-specific storage files

reports
.DS_Store

# Ignore Pycharm files
.idea
10 changes: 10 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

The MIT License (MIT)
Copyright (c) 2018, pyomeca

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

127 changes: 127 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
.PHONY: test cover data clean lint create_env export_nb_to_html update_notebooks

#################################################################################
# GLOBALS #
#################################################################################

REPO_NAME = tutorials
EXCLUDES_LINT = --exclude=bin/,src/rebuydsutils/,docs/conf.py
EXCLUDES_PYTEST = --ignore src/rebuydsutils
SHELL=/bin/bash

ifeq (,$(shell which conda))
$(error conda must be installed)
endif

# Define utility variable to help calling Python from the virtual environment
ifeq ($(CONDA_DEFAULT_ENV),$(REPO_NAME))
ACTIVATE_ENV := true
else
ACTIVATE_ENV := source activate $(REPO_NAME)
endif

# Execute python related functionalities from within the project's environment
define execute_in_env
$(ACTIVATE_ENV) && $1
endef

#################################################################################
# PROJECT RULES #
#################################################################################

## Update notebooks (repo info, navigation bar, index)
update_notebooks:
cd notebooks;\
$(call execute_in_env, python update_notebooks.py)

## Export all notebooks in ./notebooks to html
export_nb_to_html:
rm -rf reports/nb_html;\
jupyter nbconvert --to html notebooks/*.ipynb --output-dir reports/nb_html/;\
sed -i -- 's/ipynb/html/g' reports/nb_html/*

## Run pytest on the project
test:
$(call execute_in_env, pytest $(EXCLUDES_PYTEST))

## Run coverage test on the project
cover:
$(call execute_in_env, pytest --cov=. tests/ $(EXCLUDES_PYTEST))

## Make Dataset
data:
$(call execute_in_env, python src/data/make_dataset.py)

## Delete all compiled Python files
clean:
find . -name "*.pyc" -exec rm {} \;

## Lint using flake8; Excluding $EXCLUDES_LINT
lint:
$(call execute_in_env, flake8 $(EXCLUDES_LINT) .)

## Set up python interpreter environment
create_env:
conda env create -n $(REPO_NAME) -f environment.yml
rm -rf *.egg-info

#################################################################################
# Self Documenting Commands #
#################################################################################

.DEFAULT_GOAL := help

# Inspired by <http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html>
# sed script explained:
# /^##/:
# * save line in hold space
# * purge line
# * Loop:
# * append newline + line to hold space
# * go to next line
# * if line starts with doc comment, strip comment character off and loop
# * remove target prerequisites
# * append hold space (+ newline) to line
# * replace newline plus comments by `---`
# * print line
# Separate expressions are necessary because labels cannot be delimited by
# semicolon; see <http://stackoverflow.com/a/11799865/1968>
.PHONY: help
help:
@echo "$$(tput bold)Available rules:$$(tput sgr0)"
@echo
@sed -n -e "/^## / { \
h; \
s/.*//; \
:doc" \
-e "H; \
n; \
s/^## //; \
t doc" \
-e "s/:.*//; \
G; \
s/\\n## /---/; \
s/\\n/ /g; \
p; \
}" ${MAKEFILE_LIST} \
| LC_ALL='C' sort --ignore-case \
| awk -F '---' \
-v ncol=$$(tput cols) \
-v indent=19 \
-v col_on="$$(tput setaf 6)" \
-v col_off="$$(tput sgr0)" \
'{ \
printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
n = split($$2, words, " "); \
line_length = ncol - indent; \
for (i = 1; i <= n; i++) { \
line_length -= length(words[i]) + 1; \
if (line_length <= 0) { \
line_length = ncol - indent - length(words[i]) - 1; \
printf "\n%*s ", -indent, " "; \
} \
printf "%s ", words[i]; \
} \
printf "\n"; \
}' \
| more $(shell test $(shell uname) = Darwin && echo '--no-init --raw-control-chars')
28 changes: 28 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Pyomeca tutorials

This repository contains some tutorials on the [pyomeca](https://github.com/pyomeca/pyomeca) python library and some tips to make effective computations in Biomechanics.

<img src="https://github.com/pyomeca/design/blob/master/logo/logo_plain.svg" width="70%" height="70%">

## How to Use this repo
- By running the code using the Jupyter notebooks available in this repository's notebooks directory.
- 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)
- By launching executable versions of these notebooks using Google Colab: [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/pyomeca/tutorials/blob/master/notebooks/Index.ipynb)
- 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)

## About
See [Index.ipynb](https://nbviewer.jupyter.org/github/pyomeca/tutorials/blob/master/notebooks/Index.ipynb) for an index of the notebooks available to accompany the text.

## Software
The packages we used to run the code in these tutorials are listed in [environment.yml](environment.yml).

To create a stand-alone environment named `tutorials` with Python 3 and all the required package versions, run the following:

```bash
$ conda env create -n tutorials -f environment.yml
```

You can read more about using conda environments in the [Managing Environments](http://conda.pydata.org/docs/using/envs.html) section of the conda documentation.

---
Project based on the romainmartinez's [cookiecutter jupyter notebooks template](https://github.com/romainmartinez/cookiecutter-jupyter-notebooks).
10 changes: 10 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repo_name: 'tutorials'
repo_info: >
<img style="float: right; width: 100px" src="https://raw.github.com/pyomeca/design/master/logo/logo_cropped.svg?sanitize=true">
# Effective computation in Biomechanics
## with [pyomeca](https://github.com/pyomeca/pyomeca)
Romain Martinez ([email protected] | [GitHub](https://github.com/romainmartinez))
Empty file added data/.gitkeep
Empty file.
Loading

0 comments on commit a709df2

Please sign in to comment.