Skip to content

Instantly share code, notes, and snippets.

View astrojuanlu's full-sized avatar

Juan Luis Cano Rodríguez astrojuanlu

View GitHub Profile
@astrojuanlu
astrojuanlu / matplotlibrc
Created August 15, 2013 23:37
Mi archivo matplotlibrc
### MATPLOTLIBRC FORMAT
# This is a sample matplotlib configuration file - you can find a copy
# of it on your system in
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it
# there, please note that it will be overridden in your next install.
# If you want to keep a permanent local copy that will not be
# over-written, place it in HOME/.matplotlib/matplotlibrc (unix/linux
# like systems) and C:\Documents and Settings\yourname\.matplotlib
# (win32 systems).
@astrojuanlu
astrojuanlu / juego_vida2.ipynb
Last active December 21, 2015 05:59
Juego de la vida en Python: revisión y mejoras He estado explorando métodos matriciales para calcular pasos sucesivos en el juego de la vida y he obtenido incrementos sustanciales de la velocidad (resultados preliminares).
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@astrojuanlu
astrojuanlu / pool_futures.py
Last active June 20, 2019 11:28
Comparison between multiprocessing Pool and ProcessPoolExecutor from concurrent.futures.
def hard_work(n):
""" A naive factorization method. Take integer 'n', return list of
factors.
"""
# Do some CPU bond work here
if n < 2:
return []
factors = []
p = 2
@astrojuanlu
astrojuanlu / sympy_example.txt
Created September 22, 2013 19:34
SymPy example session
In [1]: from sympy import symbols
In [2]: x, y = symbols('x, y')
In [3]: c, d = symbols('c, d')
In [4]: x ** 2 + 2 * y
Out[4]:
2
x + 2⋅y
@astrojuanlu
astrojuanlu / numba_filter2d.py
Created September 30, 2013 22:28
Numba Filter 2D test
import numpy
def filter2d(image, filt):
M, N = image.shape
Mf, Nf = filt.shape
Mf2 = Mf // 2
Nf2 = Nf // 2
result = numpy.zeros_like(image)
for i in range(Mf2, M - Mf2):
for j in range(Nf2, N - Nf2):
@astrojuanlu
astrojuanlu / bezier_curves.py
Last active September 25, 2023 13:09
Interactive Bézier curves with Python using just matplotlib.
import matplotlib
matplotlib.use('webagg')
import numpy as np
from scipy.special import binom
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
@astrojuanlu
astrojuanlu / colonop.m
Created November 9, 2013 10:04
MATLAB colon operator source code, obtained from http://www.mathworks.com/support/solutions/attachment.html?resid=1-4FLIOY&solution=1-4FLI96 as of 2013-11-09.
function v = colonop(a,d,b)
% COLONOP Demonstrate how the built-in a:d:b is constructed.
%
% v = colonop(a,b) constructs v = a:1:b.
% v = colonop(a,d,b) constructs v = a:d:b.
%
% v = a:d:b is not constructed using repeated addition. If the
% textual representation of d in the source code cannot be
% exactly represented in binary floating point, then repeated
% addition will appear to have accumlated roundoff error. In
@astrojuanlu
astrojuanlu / sympy_algebra_vectorial.ipynb
Last active December 28, 2015 01:09
Experimentos con SymPy para álgebra vectorial.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@astrojuanlu
astrojuanlu / pandas_github.ipynb
Created November 20, 2013 10:15
Analizando datos de GitHub en Python usando pandas.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@astrojuanlu
astrojuanlu / gh_apiv3_issue.ipynb
Last active December 28, 2015 21:19
GitHub API v3 issue. The returned commits depend on the limiting dates.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.