In [23]:
from IPython.display import YouTubeVideo
from IPython.display import VimeoVideo
VimeoVideo("53052481",height= 500, width=800)


Out[23]:

In [15]:
def func(n):
    d = 0.0
    for i in range(n):
        d += (i%3 -1)*i
    return d

In [16]:
%timeit func(10000)


1000 loops, best of 3: 1.68 ms per loop

In [17]:
%%file dunc_fortran.f

    subroutine func_fort(n,d)
        integer, intent(in) :: n 
        double precision, intent(out) :: d
        integer :: i
        d = 0
        do i=0, n-1
            d = d + (mod(i,3) - 1) * i
        end do
    end subroutine func_fort


Writing dunc_fortran.f

In [21]:
!f2py -c dunc_fortran.f -m dunc_fortran > C:\Users\Peyman.n\Downloads


Access is denied.

In [30]:
import qgis

In [31]:
import numpy

In [32]:
import numba

In [33]:
import scipy

In [34]:
from osgeo import gdal

In [35]:
import numpy as np

In [37]:
np.zeros((3,4))


Out[37]:
array([[ 0.,  0.,  0.,  0.],
       [ 0.,  0.,  0.,  0.],
       [ 0.,  0.,  0.,  0.]])

In [39]:
np.c*?

In [41]:
a =np.eye(3)

In [42]:
a.strides


Out[42]:
(24, 8)

In [43]:
a


Out[43]:
array([[ 1.,  0.,  0.],
       [ 0.,  1.,  0.],
       [ 0.,  0.,  1.]])

In [44]:
a.dtype


Out[44]:
dtype('float64')

In [49]:
a.mean(), a.max(), a.reshape((1,9))


Out[49]:
(0.33333333333333331,
 1.0,
 array([[ 1.,  0.,  0.,  0.,  1.,  0.,  0.,  0.,  1.]]))

In [64]:
x = np.random.normal(0,1,size = 8)

In [66]:
import matplotlib.pyplot as plt
plt.hist(x)


Out[66]:
(array([1, 1, 0, 0, 1, 1, 0, 0, 3, 1]),
 array([-2.72735763, -2.25489083, -1.78242403, -1.30995723, -0.83749042,
       -0.36502362,  0.10744318,  0.57990998,  1.05237678,  1.52484358,
        1.99731038]),
 <a list of 10 Patch objects>)

In [67]:
plt.hist(x)


Out[67]:
(array([1, 1, 0, 0, 1, 1, 0, 0, 3, 1]),
 array([-2.72735763, -2.25489083, -1.78242403, -1.30995723, -0.83749042,
       -0.36502362,  0.10744318,  0.57990998,  1.05237678,  1.52484358,
        1.99731038]),
 <a list of 10 Patch objects>)

In [61]:
import skimage


---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-61-dd3d86a55524> in <module>()
----> 1 import skimage

ImportError: No module named skimage

In [68]:
x[2]


Out[68]:
1.0547454516521078

In [70]:
x = np.linspace(-1, 1 , 512)

In [72]:
p = np.polynomial.Polynomial([3, -3,2, 5])

In [73]:
plt.plot(p(x))


Out[73]:
[<matplotlib.lines.Line2D at 0x982d150>]

In [ ]: