Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ channels:
dependencies:
- python>=3.6,<3.10
- pip
- numpy>1.16
- scipy
- matplotlib
- sympy
13 changes: 12 additions & 1 deletion envtest/builtins.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
numpy>1.16
scipy
Matplotlib
sympy
Pandas
5 changes: 5 additions & 0 deletions scripts/my_pandas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import numpy as np
import pandas as pd

s = pd.Series([1, 3, 5, np.nan, 6, 8])
print(s)
17 changes: 15 additions & 2 deletions scripts/smooth_image.py
Original file line number Diff line number Diff line change
@@ -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))
8 changes: 8 additions & 0 deletions scripts/solve_matrix_equation.py
Original file line number Diff line number Diff line change
@@ -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)