Skip to content

Instantly share code, notes, and snippets.

@nicoguaro
nicoguaro / shading_surf3d.py
Created July 22, 2015 20:27
3D surface with light shading using matplotlib.
"""
Example showing shaded 3d plots. It is based on the [shading example](
http://matplotlib.org/examples/pylab_examples/shading_example.html).
The surface used is the Matlab `peaks()`.
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
@nicoguaro
nicoguaro / viridis.xml
Created August 6, 2015 21:33
Viridis colormap in XML format.
<ColorMaps>
<ColorMap space="RGB" indexedLookup="false" name="Viridis">
<Point x="0" r="0.267004" g="0.004874" b="0.329415"/>
<Point x="0.003922" r="0.26851" g="0.009605" b="0.335427"/>
<Point x="0.007843" r="0.269944" g="0.014625" b="0.341379"/>
<Point x="0.011765" r="0.271305" g="0.019942" b="0.347269"/>
<Point x="0.015686" r="0.272594" g="0.025563" b="0.353093"/>
<Point x="0.019608" r="0.273809" g="0.031497" b="0.358853"/>
<Point x="0.023529" r="0.274952" g="0.037752" b="0.364543"/>
<Point x="0.027451" r="0.276022" g="0.044167" b="0.370164"/>
@nicoguaro
nicoguaro / rainbow_desaturated.txt
Last active August 23, 2019 13:52
Tecplot utilities.
# Rainbow Desaturated colormap
0 0.278431 0.278431 0.858824
0.143 0 0 0.360784
0.285 0 1 1
0.429 0 0.501961 0
0.571 1 1 0
0.714 1 0.380392 0
0.857 0.419608 0 0
1 0.878431 0.301961 0.301961
@nicoguaro
nicoguaro / bouligand_FreeCAD.py
Last active May 16, 2016 20:30
Scripts for automation of FreeCAD entities.
from __future__ import division
import FreeCAD as FC
import Part
import numpy as np
def gen_fibers(nlines, nlayers, radius, hor_gap, vert_gap, theta, length):
"""Generate fibers forming the Herringbone pattern
Parameters
@nicoguaro
nicoguaro / data.tsv
Created August 28, 2015 19:24
Vertical barchart using D3 and reading data from a tab separated fiel.
name value
Locke 4
Reyes 8
Ford 12
Jarrah 16
Shephard 23
Kwon 42
@nicoguaro
nicoguaro / index.html
Created August 28, 2015 20:59
Ashby chart showing Young Modulus vs density for some materials. It was done using D3
<!DOCTYPE html>
<meta charset="utf-8">
<!--
Example based on http://bl.ocks.org/weiglemc/6185069
-->
<style>
.circ {
fill: steelblue;
@nicoguaro
nicoguaro / README.md
Last active September 27, 2015 17:08
@nicoguaro
nicoguaro / Abaqus-Default.xml
Last active June 28, 2022 14:49
Zenburn color theme for Abaqus input files in Notepad++
<!--
File name: Abaqus-Default.xml
Style Name: Abaqus-Default
Description: Syntax highlighting for Abaqus in Notepad++. Derived
from the Abaqus template
present in:
http://docs.notepad-plus-plus.org/index.php?title=User_Defined_Language_Files
Supported languages: All the languages supported by release 6.2.3
Created by: Nicolas Guarin-Zapata (nicoguarin dot gmail dot com)
@nicoguaro
nicoguaro / Batman curve.png
Last active April 18, 2018 16:48
Gist with some satiric plots
Batman curve.png
@nicoguaro
nicoguaro / neo_hookean_fit.py
Created June 9, 2016 23:07
Fitting experimental data to a Neo-Hookean solid.
# -*- coding: utf-8 -*-
"""
Compute the material parameters for a neo-hookean solid from
data obtained from a uniaxial stress test. The used expressions
are from _[1]
@author: Nicolas Guarin-Zapata
References
----------