-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f8ad5cb
Showing
3,757 changed files
with
9,969,712 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
演示Wing IDE 101的goto define功能。使用Wing IDE 101或Spyder打开本程序之后, | ||
按住Ctrl的同时点击signal, pl, HasTraits等跳转到定义它们的程序。 | ||
""" | ||
from scipy import signal | ||
import pylab as pl | ||
from enthought.traits.api import HasTraits, Instance | ||
from enthought.traits.ui.api import View, Item | ||
|
||
signal.lfilter | ||
pl.plot | ||
pl.title |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
本程序有BUG,不能正常运行。在IPython中执行本程序进行调试。 | ||
""" | ||
import pylab as pl | ||
import numpy as np | ||
|
||
def test_debug(): | ||
x = np.linspace(1, 50, 10000) | ||
img = np.sin(x*np.cos(x)) | ||
pl.imshow(img) | ||
pl.show() | ||
|
||
test_debug() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
一个简单模块,在usemode.py中使用其中的x和y。 | ||
""" | ||
x = 100 | ||
y = 200 |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
载入几个重量级的扩展库。在IPython中使用run命令可以缩短 | ||
第二次运行程序启动时间。 | ||
""" | ||
import numpy as np | ||
from scipy import signal | ||
import pylab as pl | ||
|
||
t = np.linspace(0, 10, 1000) | ||
x = signal.chirp(t, 5, 10, 30) | ||
pl.plot(t, x) | ||
pl.show() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
对图像进行浮雕处理 | ||
""" | ||
import pylab as pl | ||
import scipy as sp | ||
img = sp.lena() | ||
pl.imshow(img, cmap=pl.cm.gray) | ||
img2 = img[:-2,1:-1]-img[2:,1:-1]+img[1:-1, :-2]-img[1:-1,2:] | ||
pl.figure() | ||
pl.imshow(img2, cmap=pl.cm.gray) | ||
pl.show() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
演示Spyder的Workspace,在Spyder中运行本程序之后,可以使用 | ||
Workspace查看x, y和img数组。 | ||
""" | ||
import numpy as np | ||
x = np.linspace(0.1, 10, 100) | ||
y = np.sin(x)/x | ||
img = np.random.random((10,10)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
输出mymodel.py模块中的x和y,为了显示最新的值,使用reload()强制 | ||
重新载入模块。 | ||
""" | ||
import mymodel | ||
import imp | ||
imp.reload(mymodel) | ||
from mymodel import * | ||
|
||
print((x, y)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
输出mymodel.py模块中的x和y,为了显示最新的值,使用reload()强制 | ||
重新载入模块。 | ||
""" | ||
import mymodel | ||
import imp | ||
imp.reload(mymodel) | ||
from mymodel import * | ||
|
||
print(x, y) |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
使用TraitsUI制作的简单的界面程序。使用Wing IDE 101可以查看 | ||
按钮点击事件处理函数_button_fired的调用堆栈。 | ||
""" | ||
from enthought.traits.api import HasTraits, Instance, Button, Int | ||
from enthought.traits.ui.api import View, Item | ||
|
||
class Demo(HasTraits): | ||
count = Int(0) | ||
button = Button("Click Me") | ||
view = View(Item("button"), Item("count")) | ||
|
||
def _button_fired(self): | ||
self.count += 1 | ||
|
||
demo = Demo() | ||
demo.configure_traits() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
创建一个1000*1000的24bit的BMP图像。 | ||
""" | ||
header = 'BM\xf6\xc6-\x00\x00\x00\x00\x006\x00\x00\x00(\x00\x00\x00\xe8\x03\x00\x00\xe8\x03\x00\x00\x01\x00\x18\x00\x00\x00\x00\x00\xc0\xc6-\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' | ||
f = file("tmp.bmp","wb") | ||
f.write(header) | ||
f.write("\x00"*(1000*1000*3)) | ||
f.close() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
18.0, 173.4 | ||
7.8, 126.2 | ||
8.5, 131.2 | ||
12.5, 155.0 | ||
7.4, 126.8 | ||
15.0, 170.4 | ||
7.1, 121.8 | ||
15.2, 169.3 | ||
19.2, 176.8 | ||
16.6, 175.2 | ||
18.7, 175.9 | ||
13.3, 160.4 | ||
19.1, 174.6 | ||
15.1, 169.9 | ||
16.7, 173.1 | ||
12.7, 155.8 | ||
19.3, 175.4 | ||
18.6, 174.4 | ||
11.8, 148.5 | ||
15.5, 172.5 | ||
17.2, 175.2 | ||
18.3, 175.6 | ||
7.1, 123.1 | ||
18.5, 170.8 | ||
7.4, 125.0 | ||
7.4, 128.4 | ||
9.8, 140.9 | ||
16.8, 175.8 | ||
10.0, 142.8 | ||
10.9, 146.3 | ||
9.4, 137.2 | ||
13.5, 163.2 | ||
15.8, 174.7 | ||
18.4, 174.3 | ||
10.4, 143.6 | ||
12.4, 153.3 | ||
7.1, 127.2 | ||
16.2, 171.9 | ||
12.2, 156.6 | ||
9.4, 135.4 | ||
16.6, 172.4 | ||
18.6, 176.8 | ||
9.9, 140.2 | ||
11.0, 148.0 | ||
18.3, 173.0 | ||
18.9, 172.0 | ||
10.1, 143.1 | ||
13.7, 165.0 | ||
15.2, 169.9 | ||
12.5, 153.6 | ||
15.9, 178.2 | ||
10.4, 143.7 | ||
17.2, 173.9 | ||
11.5, 151.1 | ||
12.5, 154.1 | ||
19.2, 178.8 | ||
8.6, 132.1 | ||
12.3, 153.6 | ||
9.3, 137.2 | ||
13.0, 161.0 | ||
18.3, 173.8 | ||
15.7, 176.3 | ||
13.0, 161.3 | ||
13.3, 160.0 | ||
18.8, 174.6 | ||
14.4, 166.6 | ||
14.0, 164.9 | ||
19.9, 173.9 | ||
8.8, 134.5 | ||
16.3, 171.4 | ||
8.0, 133.0 | ||
12.6, 153.2 | ||
7.9, 126.4 | ||
7.6, 131.2 | ||
13.4, 161.0 | ||
15.7, 172.7 | ||
10.7, 144.1 | ||
18.9, 175.7 | ||
15.6, 173.4 | ||
17.6, 175.3 | ||
17.8, 176.7 | ||
19.0, 173.0 | ||
10.2, 142.1 | ||
10.7, 143.5 | ||
11.5, 147.2 | ||
8.4, 130.6 | ||
9.6, 139.7 | ||
12.0, 151.4 | ||
12.1, 147.8 | ||
8.3, 131.0 | ||
9.4, 134.2 | ||
7.3, 123.5 | ||
13.7, 163.3 | ||
11.2, 145.9 | ||
13.8, 164.2 | ||
19.6, 175.9 | ||
19.0, 172.2 | ||
14.7, 169.1 | ||
15.8, 173.9 | ||
10.8, 145.0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
演示一维数组的下标存取。 | ||
""" | ||
import numpy as np | ||
|
||
a = np.arange(10) | ||
print(("a[5]", a[5])) | ||
print(("a[3:5]", a[3:5])) | ||
print(("a[:5]", a[:5])) | ||
print(("a[:-1]", a[:-1])) | ||
a[2:4] = 100,101 | ||
print(("a", a)) | ||
print(("a[1:-1:2]", a[1:-1:2])) | ||
print(("a[::-1]", a[::-1])) | ||
print(("a[5:1:-2]", a[5:1:-2])) | ||
|
||
b = a[3:7] | ||
print(b) | ||
b[2] = -10 | ||
print(b) | ||
print(a) | ||
|
||
x = np.arange(10,1,-1) | ||
print(x) | ||
print(("x[[3, 3, 1, 8]]", x[[3, 3, 1, 8]])) | ||
b = x[np.array([3,3,-3,8])] | ||
b[2] = 100 | ||
print(b) | ||
print(x) | ||
x[[3,5,1]] = -1, -2, -3 | ||
print(x) | ||
|
||
x = np.arange(5,0,-1) | ||
print(x) | ||
print((x[np.array([True, False, True, False, False])])) | ||
print((x[[True, False, True, False, False]])) | ||
print((x[np.array([True, False, True, True])])) | ||
x[np.array([True, False, True, True])] = -1, -2, -3 | ||
print(x) | ||
|
||
x = np.random.rand(10) | ||
print(x) | ||
print((x>0.5)) | ||
print((x[x>0.5])) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
演示一维数组的下标存取。 | ||
""" | ||
import numpy as np | ||
|
||
a = np.arange(10) | ||
print("a[5]", a[5]) | ||
print("a[3:5]", a[3:5]) | ||
print("a[:5]", a[:5]) | ||
print("a[:-1]", a[:-1]) | ||
a[2:4] = 100,101 | ||
print("a", a) | ||
print("a[1:-1:2]", a[1:-1:2]) | ||
print("a[::-1]", a[::-1]) | ||
print("a[5:1:-2]", a[5:1:-2]) | ||
|
||
b = a[3:7] | ||
print(b) | ||
b[2] = -10 | ||
print(b) | ||
print(a) | ||
|
||
x = np.arange(10,1,-1) | ||
print(x) | ||
print("x[[3, 3, 1, 8]]", x[[3, 3, 1, 8]]) | ||
b = x[np.array([3,3,-3,8])] | ||
b[2] = 100 | ||
print(b) | ||
print(x) | ||
x[[3,5,1]] = -1, -2, -3 | ||
print(x) | ||
|
||
x = np.arange(5,0,-1) | ||
print(x) | ||
print(x[np.array([True, False, True, False, False])]) | ||
print(x[[True, False, True, False, False]]) | ||
print(x[np.array([True, False, True, True])]) | ||
x[np.array([True, False, True, True])] = -1, -2, -3 | ||
print(x) | ||
|
||
x = np.random.rand(10) | ||
print(x) | ||
print(x>0.5) | ||
print(x[x>0.5]) |
Oops, something went wrong.