update
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# 循环参数计算
|
||||
|
||||
import guan
|
||||
import numpy as np
|
||||
|
||||
def test_1(x):
|
||||
return 2*x
|
||||
|
||||
x_array = np.arange(0, 5, 1)
|
||||
result_array = guan.loop_calculation_with_one_parameter(test_1, x_array)
|
||||
print(result_array)
|
||||
guan.plot(x_array, result_array)
|
||||
print()
|
||||
|
||||
def test_2(x, y):
|
||||
return x+y
|
||||
|
||||
x_array = np.arange(0, 5, 1)
|
||||
y_array = np.arange(0, 3, 1)
|
||||
result_array = guan.loop_calculation_with_two_parameters(test_2, x_array, y_array)
|
||||
print(result_array)
|
||||
guan.plot_contour(x_array, y_array, result_array)
|
||||
print()
|
||||
|
||||
def test_3(x, y, z):
|
||||
return x+y+z
|
||||
|
||||
x_array = np.arange(0, 5, 1)
|
||||
y_array = np.arange(0, 3, 1)
|
||||
z_array = np.arange(0, 2, 1)
|
||||
result_array = guan.loop_calculation_with_three_parameters(test_3, x_array, y_array, z_array)
|
||||
print(result_array)
|
||||
guan.plot_contour(y_array, z_array, result_array[:, :, 4])
|
@@ -1,22 +1,22 @@
|
||||
import guan
|
||||
|
||||
@guan.try_decorator
|
||||
def test1(a, b):
|
||||
print(a)
|
||||
bug_code
|
||||
print(b)
|
||||
return 'return_message1'
|
||||
|
||||
result1 = guan.try_except(test1, 10, b=20)
|
||||
result1 = test1(10, b=20)
|
||||
print(result1)
|
||||
|
||||
print()
|
||||
|
||||
@guan.try_decorator
|
||||
def test2(a, b):
|
||||
print(a)
|
||||
bug_code
|
||||
print(b)
|
||||
return 'return_message2'
|
||||
|
||||
result2 = test2(100, b=200)
|
||||
result2 = guan.try_except(test2, 100, b=200)
|
||||
print(result2)
|
Reference in New Issue
Block a user