This file contains 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
# -*- coding: utf-8 -*- | |
""" | |
Fit an ellipse for a point cloud | |
@author: Nicolas Guarin-Zapata | |
""" | |
from __future__ import division, print_function | |
import numpy as np | |
from numpy import sin, cos, arctan2, mean | |
from numpy.linalg import norm |
This file contains 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 | |
from numpy.polynomial import Polynomial | |
rng = np.random.default_rng() | |
x = np.arange(10) | |
y = np.arange(10) + 0.01*rng.standard_normal(10) | |
p_fitted = np.polynomial.Polynomial.fit(x, y, deg=1) |
This file contains 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
# -*- coding: utf-8 -*- | |
import matplotlib.pyplot as plt | |
from wordcloud import WordCloud, STOPWORDS | |
#%% | |
f = open('output_file.txt', 'r', encoding="utf8") | |
text = f.read() | |
f.close() |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 | |
import matplotlib.pyplot as plt | |
from skimage import measure | |
y, x, z = np.mgrid[-2:2:100j, -2:2:100j, -2:2:100j] | |
f = (x**2 + 9/4*y**2 + z**2 - 1)**3 - x**2 * z**3 - 9/80*y**2*z**3 | |
verts, faces, _, _ = measure.marching_cubes(f, 0, spacing=(0.1, 0.1, 0.1)) | |
fig = plt.figure() |
This file contains 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
# -*- coding: utf-8 -*- | |
""" | |
Plot the convex hull around a set of points as a | |
shaded polygon. | |
@author: Nicolas Guarin Zapata | |
@date: October 15, 2014 | |
""" | |
import numpy as np | |
from scipy.spatial import ConvexHull |
This file contains 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 | |
from matplotlib import pyplot as plt | |
def plotdf(f, xran=[-5, 5], yran=[-5, 5], grid=[21, 21], color='k'): | |
""" | |
Plot the direction field for an ODE written in the form | |
x' = F(x,y) | |
y' = G(x,y) | |
The functions F,G are defined in the list of strings f. |
This file contains 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
# -*- coding: utf-8 -*- | |
""" | |
Eigenvalues for matrices with random entries with values of 1 or -1 | |
@author: Nicolás Guarín-Zapata | |
@date: November 2022 | |
""" | |
import numpy as np | |
import matplotlib.pyplot as plt |
This file contains 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
""" | |
Mohr circle in 2D. | |
@author: Nicolás Guarín-Zapata | |
@date: May 2020 | |
""" | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib import rcParams | |
rcParams['font.family'] = 'serif' |
NewerOlder