This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# 2nd order identity tensor | |
I = np.eye(3) | |
# Lamé Constants | |
lam_0 = 456 | |
mu_0 = 123 | |
print(f"G = {mu_0}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Recommended to run in a clean environment | |
export EMAIL="builder@localhost" | |
apt update | |
apt dist-upgrade -y | |
apt install -y git git-buildpackage --no-install-recommends | |
git config --global user.name "Bob the Builder" | |
git config --global user.email "$EMAIL" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This programmable filter can be used on an unstructured grid to display the | |
# numerical value of the cell type (i.e., tet, hex, wedge, ...) | |
output.CellData.append(inputs[0].CellTypes, 'Cell_type') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Fun with stiffness matrices! | |
The plotting routine is inspired by https://github.com/coudertlab/elate | |
The Voigt-Reuss-Hill Averaging was directly copied from there. | |
Note the following relationships of stresses and strains: | |
sigma_ij ... stress tensor | |
epsilon_ij ... strain tensor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
# do plotting: | |
#plt.dosomething(...) | |
# pil_kwargs can be used to pass things to PIL. | |
# the save function has **params which then passes the kwargs to the file format save function, for example: | |
# See https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#saving-tiff-images | |
# LZW compression is called tiff_lzw in pil... | |
plt.savefig('foobaz.tiff', pad_inches=0.05, bbox_inches='tight', pil_kwargs=dict(compression='tiff_lzw')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# Numpy array is xyz | |
img = np.zeros((10,20,30)) | |
a = slice(None) # all items, same as ':' | |
faces = { | |
'top': (-1, a, a), | |
'bottom': (0, a, a), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
A = np.array([[2,1,2.5], [1,3,1], [2.5,1,4]]) | |
# Eigenvalues and -vectors have the property such that: Ax = lx | |
# x ... Eigenvectors | |
# l ... Eigenvalues | |
l, x = np.linalg.eig(A) | |
# it follows: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"ColorSpace": "RGB", | |
"DefaultMap": true, | |
"Name": "Turbo", | |
"RGBPoints": [ | |
0.0, | |
0.18823529411764706, | |
0.07058823529411765, | |
0.23137254901960785, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# What you would normaly do: | |
def some_divison(): | |
flag = True | |
val = 23 | |
divisor = 42 | |
if flag: | |
return val / divisor | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
################################# | |
# NOTE: | |
# This assumes you have a user `builder` and a folder `/home/builder/packages`. | |
# it will clone FreeCAD there and start pbuilder using pdebuild. | |
# For me this works using debian sid. (stretch/buster will probably not work!) | |
# | |
# After the build has finished, it will import the packes into a reprepro | |
# which is setup at /srv/repo |
NewerOlder