Skip to content

Instantly share code, notes, and snippets.

@nicoguaro
nicoguaro / cylinder.vtk
Last active April 26, 2020 03:53
Example of isosurfaces using (indirectly) VTK in Python.
This file has been truncated, but you can view the full file.
@nicoguaro
nicoguaro / curva_normal.png
Last active April 19, 2020 22:47
Gráfico de una curva normal con anotaciones.
curva_normal.png
@nicoguaro
nicoguaro / pendulum.py
Created April 5, 2020 22:58
Solve a nonlinear pendulum for a trajectory on the separatrix.
# -*- coding: utf-8 -*-
"""
Solve a nonlinear pendulum for a trajectory on the separatrix.
@author: Nicolás Guarín-Zapata
@date: April 2020
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import solve_ivp
@nicoguaro
nicoguaro / image_poster.py
Created January 9, 2020 18:36
Posterization of an image using k-means
"""
Posterization of an image using k-means
It can be used to create color palettes from pictures.
@author:Nicolás Guarín-Zapata
@date: January 2020
"""
import numpy as np
from scipy import misc
@nicoguaro
nicoguaro / inflacion_vs_derechos-log.png
Last active November 28, 2019 16:45
Correlacion entre "inflación" y "número de derechos" a partir de los datos presentados en el siguiente Tweet: https://mobile.twitter.com/clarroulet/status/730931861384507392
inflacion_vs_derechos-log.png
@nicoguaro
nicoguaro / polynote.yml
Last active October 25, 2019 16:17
Pre-configured conda environments
# Environment for polynote
#
#
name: polynote
channels:
- default
dependencies:
- python>=3.6
- pip
- jedi
@nicoguaro
nicoguaro / hello_anim.py
Last active September 12, 2019 20:58
Examples of plots in Matplotlib
"""
Hello world (of animation)!
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
def update(data):
line.set_ydata(data)
@nicoguaro
nicoguaro / plot_inset_rect.py
Created June 12, 2019 23:55
Plot with an inset and a background color for the inset
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
x = np.linspace(0, 1, 100)
y = np.sin(4*np.pi*x)
# Big plot
ax = plt.subplot(111)
plt.plot(x, y, "k", zorder=3, alpha=0.4)
@nicoguaro
nicoguaro / astro_sound.wav
Last active November 7, 2018 21:59
Convert from ordering in a Hilbert-like curve and a 1D array and vice-versa.
This file has been truncated, but you can view the full file.