コード例 #1
0
ファイル: numpy_base.py プロジェクト: zenki2001cn/SnippetCode
def other():
    # 根据说明文档的关键字查找相关函数
    # np.lookfor('sort')
    # 获取函数的帮助信息
    # np.info('fft')
    # 打印函数、类或模块的源码
    np.source(np.info)
コード例 #2
0
    def test_nanquantile_1(self):

        a = np.array([[10., 7., 4.], [3., 2., 1.]])
        a[0][1] = np.nan
        print(a)
        
        b = np.quantile(a, 0.5)
        print(b)

        print(np.source(np.nanquantile))

        c = np.nanquantile(a,  0.5)
        print(c)

        d = np.nanquantile(a,  0.5, axis=0)
        print(d)

        e = np.nanquantile(a,  0.5, axis=1, keepdims=True)
        print(e)
        
        m = np.nanquantile(a,  0.5, axis=0)
        out = np.zeros_like(m)
        f = np.nanquantile(a,  0.5, axis=0, out=out)
        print(f)
        print(m)
 

        g = a.copy()
        h = np.nanquantile(g,  0.5, axis=1, overwrite_input=True)
        print(h)
        assert not np.all(a==g)

        return
コード例 #3
0
import scipy as sp
from scipy import integrate
from scipy import cluster
from scipy import fftpack
import numpy as np

#Help/doc
help(integrate)
np.info(fftpack)

#Source code of subpackages
np.source(cluster)
コード例 #4
0
from __future__ import annotations

from io import StringIO
from typing import Any

import numpy as np

FILE = StringIO()
AR: np.ndarray[Any, np.dtype[np.float64]] = np.arange(10).astype(np.float64)


def func(a: int) -> bool:
    ...


np.deprecate(func)
np.deprecate()

np.deprecate_with_doc("test")
np.deprecate_with_doc(None)

np.byte_bounds(AR)
np.byte_bounds(np.float64())

np.info(1, output=FILE)

np.source(np.interp, output=FILE)

np.lookfor("binary representation", output=FILE)
コード例 #5
0
import numpy as np

np.source(np.interp)
np.source(np.array)                         
コード例 #6
0
integralSegunda = np.polyint(f3grau, 2)

integralTerceira = np.polyint(f3grau, 3)


#Tratamento de sinais - convolucao
#%%
sinalConvoluido = np.convolve([1, 2, 3], [0, 1, 0.5])
plt.hist(sinalConvoluido, bins=3, density=100) #altere os bins
plt.show()

#Pesquisa

print(np.info(np.polyval))
print(np.lookfor('binary representation'))
print(np.source(np.interp))#funcao Valida apenas para objetos escritos em python


'''Scipy

É uma biblioteca de computação científica, que junto ao Numpy é capaz
de realizar operações poderosas, tanto para o processamento de dados 
quanto para a prototipagem de sistemas.'''



#%%
import scipy as sp

grafo = [[0,1,2,0],[0,0,0,1],[0,0,0,3],[0,0,0,0]] 
コード例 #7
0
def main():
    np.source(ff.fft)
コード例 #8
0
from io import StringIO
from typing import Any, Dict

import numpy as np

AR: np.ndarray[Any, np.dtype[np.float64]]
AR_DICT: Dict[str, np.ndarray[Any, np.dtype[np.float64]]]
FILE: StringIO

def func(a: int) -> bool: ...

reveal_type(np.deprecate(func))  # E: def (a: builtins.int) -> builtins.bool
reveal_type(np.deprecate())  # E: _Deprecate

reveal_type(np.deprecate_with_doc("test"))  # E: _Deprecate
reveal_type(np.deprecate_with_doc(None))  # E: _Deprecate

reveal_type(np.byte_bounds(AR))  # E: Tuple[builtins.int, builtins.int]
reveal_type(np.byte_bounds(np.float64()))  # E: Tuple[builtins.int, builtins.int]

reveal_type(np.who(None))  # E: None
reveal_type(np.who(AR_DICT))  # E: None

reveal_type(np.info(1, output=FILE))  # E: None

reveal_type(np.source(np.interp, output=FILE))  # E: None

reveal_type(np.lookfor("binary representation", output=FILE))  # E: None

reveal_type(np.safe_eval("1 + 1"))  # E: Any
コード例 #9
0
def main():
    np.info(ff.fft)  # <1>

    print('-' * 60)

    np.source(ff.fft)  # <2>
コード例 #10
0
 #    (   52.292984,  -183.492294,  1586.229614)]
 # polygon_coordinates2 = [[   52.40876 ,  -183.389725,  1586.93689 ],
 #    [   52.143188,  -183.361359,  1586.970337],
 #    [   51.883614,  -183.387726,  1586.961182],
 #    [   51.659508,  -183.51033 ,  1586.876221],
 #    [   51.502106,  -183.61142 ,  1586.804932],
 #    [   51.338387,  -183.783966,  1586.678711],
 #    [   51.181816,  -184.001953,  1586.517212],
 #    [   51.176094,  -184.210297,  1586.356445],
 #    [   51.301521,  -184.390747,  1586.21167 ],
 #    [   51.513306,  -184.485138,  1586.129517],
 #    [   51.759201,  -184.515472,  1586.095459],
 #    [   52.098442,  -184.500259,  1586.092529],
 #    [   52.315491,  -184.499954,  1586.083252],
 #    [   52.619354,  -184.382645,  1586.160767],
 #    [   52.790848,  -184.238586,  1586.264526],
 #    [   52.845612,  -184.011871,  1586.437378],
 #    [   52.805977,  -183.746689,  1586.643921],
 #    [   52.657982,  -183.519531,  1586.825806]]
 # x1 = [i[0] for i in polygon_coordinates1]
 # y1 = [i[1] for i in polygon_coordinates1]
 # z1 = [i[2] for i in polygon_coordinates1]
 # x2 = [i[0] for i in polygon_coordinates2]
 # y2 = [i[1] for i in polygon_coordinates2]
 # z2 = [i[2] for i in polygon_coordinates2]
 # plot3DScatter(x1 + x2, y1 + y2, z1 + z2)
 contour_point_list = get3DContourPointsList(vessels,
                                             'Left Circumflex Artery')
 drawSurfacePlt(contour_point_list)
 (np.source(Axes3D.plot_trisurf))