-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
86 lines (63 loc) · 1.63 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
"""
This is sample code to showcase this colorscheme.
"""
from scipy.interpolate import interp1d
import numpy as np
import matplotlib.pyplot as plt
class ParentClass:
def __init__(self, name):
self.name = name
print("Parent:", name)
class ChildClass(ParentClass):
def name(self):
return self.name
obj = ChildClass("John")
# breakpoint()
import asyncio
async def async_function():
print("Asynchronous function")
await asyncio.sleep(1)
return "Completed"
def sync_function():
result = asyncio.run(async_function())
# result = async_function()
print(result)
# sync_function()
def f2(a):
a += np.array([1, 1])
a = np.array([1, 0])
b = np.array([1, 2])
f2(b)
print(b)
# Number of points and random seed for reproducibility
num_points = 100
np.random.seed(0)
# Generate random points
x = np.sort(np.random.rand(num_points) * 100)
y = np.random.rand(num_points) * 100
# Create a smooth line using cubic interpolation
f = interp1d(x, y, kind='cubic')
x_smooth = np.linspace(x.min(), x.max(), 500)
y_smooth = f(x_smooth)
# Plotting
plt.plot(x_smooth, y_smooth)
plt.scatter(x, y, color='red') # original points
plt.title("Smooth Random Line")
# plt.show()
class ParentClass:
"""
Parent class to be inherited
"""
def __init__(self, name):
self.name = name
print("Parent:", name)
class ChildClass(ParentClass):
"""
Children class to inherit from parent class
"""
def name(self):
return self.name
obj = ChildClass("John")
arr = [1, 0.2, .3, -4, 0x5, 06, 1e100]
a0 = int(arr[0])
print(f"a0 is: {a0} and array is {arr} escape {{arr}}")