diff --git a/environment.yml b/environment.yml index b2bce14..27f6a5a 100644 --- a/environment.yml +++ b/environment.yml @@ -5,3 +5,7 @@ channels: dependencies: - python>=3.6,<3.10 - pip + - numpy>1.16 + - scipy + - matplotlib + - sympy diff --git a/envtest/builtins.py b/envtest/builtins.py index caae7bb..48718e3 100644 --- a/envtest/builtins.py +++ b/envtest/builtins.py @@ -1,8 +1,19 @@ import numpy as np +from scipy.ndimage import gaussian_filter +from scipy import misc -__all__ = ['rand_array'] +__all__ = ['rand_array','smooth_image','my_mat_solve','my_pandas'] def rand_array(shape): return np.random.rand(*shape) + +def smooth_image(a, sigma=1): + return gaussian_filter(a, sigma=sigma) + +def my_mat_solve(A, b): + return A.inv()*b + +def my_pandas(s): + return s \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index d22bd8e..d21b47d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,5 @@ numpy>1.16 +scipy +Matplotlib +sympy +Pandas \ No newline at end of file diff --git a/scripts/my_pandas.py b/scripts/my_pandas.py new file mode 100644 index 0000000..68284b3 --- /dev/null +++ b/scripts/my_pandas.py @@ -0,0 +1,5 @@ +import numpy as np +import pandas as pd + +s = pd.Series([1, 3, 5, np.nan, 6, 8]) +print(s) \ No newline at end of file diff --git a/scripts/smooth_image.py b/scripts/smooth_image.py index d282d61..a5d2a16 100644 --- a/scripts/smooth_image.py +++ b/scripts/smooth_image.py @@ -1,5 +1,18 @@ -from envtest import rand_array +from email.mime import image +from envtest import smooth_image +from scipy import misc +import matplotlib.pyplot as plt -shape = (3, 3) +image = misc.ascent() +sigma = 5 + +smoothed_image = smooth_image(image, sigma) + +f = plt.figure() +f.add_subplot(1,2,1) +plt.imshow(image) +f.add_subplot(1,2,2) +plt.imshow(smoothed_image) +plt.show(block=True) print(rand_array(shape)) diff --git a/scripts/solve_matrix_equation.py b/scripts/solve_matrix_equation.py new file mode 100644 index 0000000..bd43f88 --- /dev/null +++ b/scripts/solve_matrix_equation.py @@ -0,0 +1,8 @@ +from envtest import my_mat_solve +from sympy.matrices import Matrix, MatrixSymbol + +A = Matrix([[2,1,3],[4,7,1],[2,6,8]]) +b = Matrix(MatrixSymbol('b',3,1)) +x = my_mat_solve(A,b) + +print(x) \ No newline at end of file