Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions Scope_lidar
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation

# 실제 장비 연결을 위한 라이브러리 (실제 사용 시 주석 해제)
# import pyvisa
# import serial

# -----------------------------
# 오실로스코프 연결 (예시)
# -----------------------------
# rm = pyvisa.ResourceManager()
# oscilloscope = rm.open_resource('USB0::0x0699::0x0363::C000000::INSTR') # 예시 주소

# -----------------------------
# 라이다 센서 연결 (예시)
# -----------------------------
# lidar = serial.Serial('COM3', 115200, timeout=1) # Windows의 경우; Linux는 '/dev/ttyUSB0' 등

# 시각화를 위한 기본 설정
fig, ax = plt.subplots()
line, = ax.plot([], [], lw=2, label='Oscilloscope Waveform')
scat = ax.scatter([], [], s=100, c='red', label='LiDAR Data')

ax.set_xlim(0, 1000)
ax.set_ylim(-2, 2)
ax.set_title("예술-기술 상호작용")
ax.set_xlabel("시간 (샘플)")
ax.set_ylabel("신호 진폭")
ax.legend(loc='upper right')

def init():
line.set_data([], [])
scat.set_offsets([[500, 0]])
return line, scat

def animate(frame):
# 오실로스코프 데이터 읽기 (실제 사용 시, oscilloscope.query_binary_values() 등 사용)
# 예제에서는 sine wave를 시뮬레이션 데이터로 사용합니다.
x = np.linspace(0, 1000, 1000)
# 파형의 주파수를 frame에 따라 미세하게 변화시켜 동적인 효과 표현
y = np.sin(2 * np.pi * (0.005 + frame/10000) * x)
line.set_data(x, y)

# 라이다 센서 데이터 읽기 (실제 사용 시, lidar.readline() 등을 활용)
# 예제에서는 거리 값을 시뮬레이션: 주기적으로 50cm ~ 150cm 사이 값을 변동
# 실제 값은 센서에서 읽은 문자열을 float형으로 변환하여 사용합니다.
simulated_distance = 100 + 50 * np.sin(2 * np.pi * frame/50)

# 라이다 데이터를 활용하여 중심에 원의 크기를 변화시킵니다.
# 예: 거리가 가까울수록 원의 크기가 커짐
circle_size = max(10, 500 / (simulated_distance + 1))
scat.set_offsets([[500, 0]])
scat.set_sizes([circle_size])

return line, scat

ani = animation.FuncAnimation(fig, animate, init_func=init, frames=200, interval=50, blit=True)
plt.show()
90 changes: 90 additions & 0 deletions Transcendental_words
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import random

def transcendental_translation(text):
"""
텍스트 변환-융합
"""
dad_jokes = {
'사랑': 'ggg',
'힘': 'www',
'성공': 'sss',
'인생': 'kkk'
}

wordplay_dict = {
'바나나': 'aaa',
'커피': 'bbb',
'사과': 'xxx',
'수박': 'ddd'
}

def transcend_word(word):
if word in wordplay_dict:
return wordplay_dict[word]

if word in dad_jokes:
return dad_jokes[word]

transformations = [
lambda w: w + w[-1] * 2,
lambda w: w[::-1],
lambda w: ''.join(random.sample(w, len(w))),
lambda w: w + '~~~' if len(w) > 3 else w
]

return random.choice(transformations)(word)

translated_words = [transcend_word(word) for word in text.split()]
return ' '.join(translated_words)

def dad_joke_analyzer(text):
"""
텍스트를 분석하고 해석
"""
pun_potential = {
'~다': 0.7,
'~요': 0.5,
'~군': 0.6,
'긴': 0.8,
'언어': 0.9
}

joke_styles = [
"wordplay",
"언어",
"더블리언스",
"중의적 표현"
]

joke_potential = sum(
pun_potential.get(keyword, 0.1)
for keyword in pun_potential
if keyword in text
)

analysis = {
"원본 텍스트": text,
"점수": min(joke_potential * 100, 100),
"스타일": random.choice(joke_styles),
"해석": f"이 문장의 잠재력은 {min(joke_potential * 100, 100):.2f}%입니다."
}

return analysis

def ultimate_linguistic_transformer(text):
"""
언어 변환기
"""
translated = transcendental_translation(text)
joke_analysis = dad_joke_analyzer(text)

return {
"원본": text,
"번역": translated,
"분석": joke_analysis
}

# 사용 예시
example_text = "바나나"
result = ultimate_linguistic_transformer(example_text)
print(result)