Skip to content

Commit 964d78a

Browse files
committed
16 Jan
1 parent dac9721 commit 964d78a

9 files changed

Lines changed: 702 additions & 10 deletions

File tree

System/System_commandline_test.ipynb

Lines changed: 393 additions & 10 deletions
Large diffs are not rendered by default.

System/helloshell.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# a Python script
2+
print('The Meaning of Life')

System/testargv.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import sys
2+
print(sys.argv)

System/testargv2.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
def getopts(argv):
2+
opts = {}
3+
while argv:
4+
if argv[0][0] == '-':
5+
opts[argv[0]] = argv[1]
6+
argv = argv[2:]
7+
else:
8+
argv = argv[1:]
9+
return opts
10+
11+
if __name__ == '__main__':
12+
from sys import argv
13+
myargs = getopts(argv)
14+
if '-i' in myargs:
15+
print(myargs['-i'])
16+
print(myargs)

System/whereami.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import os, sys
2+
print("my os.getcwd =>", os.getcwd())
3+
print("my sys.path =>", sys.path[:3])
4+
input()

general_test/Normalizer_test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import numpy as np
2+
from sklearn.preprocessing import Normalizer
3+
4+
x = np.array([1, 2, -3, 6], dtype='float32').reshape(1, -1)
5+
6+
print('before normalization: ', x)
7+
8+
options = ['l1', 'l2', 'max']
9+
10+
for opt in options:
11+
norm_x = Normalizer(norm=opt).fit_transform(x)
12+
print('after %s normalization: ' % opt.capitalize(), norm_x)

general_test/mpl_3D.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import numpy as np
2+
import matplotlib.pyplot as plt
3+
from mpl_toolkits.mplot3d.axes3d import Axes3D
4+
5+
# 创建 3D 图形对象
6+
fig = plt.figure()
7+
ax = Axes3D(fig)
8+
9+
# 生成数据
10+
X = np.arange(0, 2, 0.1)
11+
Y = np.arange(0, 2, 0.1)
12+
X, Y = np.meshgrid(X, Y)
13+
Z = np.sqrt(X ** 2 + Y ** 2)
14+
15+
# 绘制曲面图,并使用 cmap 着色
16+
ax.plot_surface(X, Y, Z)
17+
18+
plt.show()

general_test/plot_test.ipynb

Lines changed: 224 additions & 0 deletions
Large diffs are not rendered by default.

general_test/plotly_3D_cluster.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import plotly.plotly as py
2+
import pandas as pd
3+
4+
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/alpha_shape.csv')
5+
df.head()
6+
7+
scatter = dict(
8+
mode = "markers",
9+
name = "y",
10+
type = "scatter3d",
11+
x = df['x'], y = df['y'], z = df['z'],
12+
marker = dict( size=2, color="rgb(23, 190, 207)" )
13+
)
14+
clusters = dict(
15+
alphahull = 7,
16+
name = "y",
17+
opacity = 0.1,
18+
type = "mesh3d",
19+
x = df['x'], y = df['y'], z = df['z']
20+
)
21+
layout = dict(
22+
title = '3d point clustering',
23+
scene = dict(
24+
xaxis = dict( zeroline=False ),
25+
yaxis = dict( zeroline=False ),
26+
zaxis = dict( zeroline=False ),
27+
)
28+
)
29+
fig = dict( data=[scatter, clusters], layout=layout )
30+
# Use py.iplot() for IPython notebook
31+
py.iplot(fig, filename='3d point clustering')

0 commit comments

Comments
 (0)