Nicha1234 commited on
Commit
4f27e81
·
verified ·
1 Parent(s): 8a73f1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -11
app.py CHANGED
@@ -115,20 +115,22 @@ def draw_kspace_diagram():
115
 
116
  # ตัวอักษรบอกทิศทาง +kx, -kx, +ky, -ky
117
  ax.text(1.1, 0, '+kx', fontsize=20, fontweight='bold', va='center')
118
- ax.text(-1.1, 0, '-kx', fontsize=20, fontweight='bold', va='center', ha='right')
 
119
  ax.text(0, 1.1, '+ky', fontsize=20, fontweight='bold', ha='center')
120
  ax.text(0, -1.1, '-ky', fontsize=20, fontweight='bold', ha='center', va='top')
121
 
122
  # Label บอกชื่อแกน (เอาไว้ข้างนอกกรอบแบบในรูป)
123
- # Frequency axis ด้านล่าง
124
- ax.annotate('', xy=(1, -1.3), xytext=(-1, -1.3), arrowprops=dict(arrowstyle='<|-|>', color='black', lw=4))
125
- ax.text(0, -1.4, 'kx (Frequency)', ha='center', va='top', fontsize=16, fontweight='bold')
126
 
127
- # Phase axis ด้านซ้าย
128
- ax.annotate('', xy=(-1.3, 1), xytext=(-1.3, -1), arrowprops=dict(arrowstyle='<|-|>', color='black', lw=4))
129
- ax.text(-1.4, 0, 'ky (Phase)', ha='right', va='center', rotation=90, fontsize=16, fontweight='bold')
130
 
131
- ax.set_xlim(-1.8, 1.4)
 
132
  ax.set_ylim(-1.8, 1.4)
133
  ax.axis('off')
134
 
@@ -334,12 +336,15 @@ with col_main:
334
 
335
  st.progress((st.session_state.fill_step + 1) / total_anim_steps)
336
 
337
- # นำ st.empty() ออก และแสดงภาพโดยตรงเพื่อลดการเคลียร์หน้าจอที่จะทำให้เว็บกระตุก
338
  col_anim1, col_anim2 = st.columns([1, 1])
339
  with col_anim1:
340
- st.image(draw_pulse_sequence(st.session_state.fill_step, total_anim_steps))
 
 
341
  with col_anim2:
342
- st.image(draw_kspace_filling(st.session_state.fill_step, total_anim_steps))
 
 
343
 
344
  st.markdown("""
345
  ---
 
115
 
116
  # ตัวอักษรบอกทิศทาง +kx, -kx, +ky, -ky
117
  ax.text(1.1, 0, '+kx', fontsize=20, fontweight='bold', va='center')
118
+ # ขยับ -kx ให้อยู่ตรงกลางระหว่างกรอบและเส้นลูกศร Phase axis
119
+ ax.text(-1.15, 0, '-kx', fontsize=20, fontweight='bold', va='center', ha='center')
120
  ax.text(0, 1.1, '+ky', fontsize=20, fontweight='bold', ha='center')
121
  ax.text(0, -1.1, '-ky', fontsize=20, fontweight='bold', ha='center', va='top')
122
 
123
  # Label บอกชื่อแกน (เอาไว้ข้างนอกกรอบแบบในรูป)
124
+ # Frequency axis ด้านล่าง (ขยับเส้นให้ต่ำลง)
125
+ ax.annotate('', xy=(1, -1.4), xytext=(-1, -1.4), arrowprops=dict(arrowstyle='<|-|>', color='black', lw=4))
126
+ ax.text(0, -1.5, 'kx (Frequency)', ha='center', va='top', fontsize=16, fontweight='bold')
127
 
128
+ # Phase axis ด้านซ้าย (ขยับเส้นหนีออกไปทางซ้ายมากขึ้น เพื่อไม่ให้ทับ -kx)
129
+ ax.annotate('', xy=(-1.5, 1), xytext=(-1.5, -1), arrowprops=dict(arrowstyle='<|-|>', color='black', lw=4))
130
+ ax.text(-1.6, 0, 'ky (Phase)', ha='right', va='center', rotation=90, fontsize=16, fontweight='bold')
131
 
132
+ # ขยายขอบเขตการแสดงผลให้ครอบคลุม Label ที่ขยับออกไป
133
+ ax.set_xlim(-2.0, 1.4)
134
  ax.set_ylim(-1.8, 1.4)
135
  ax.axis('off')
136
 
 
336
 
337
  st.progress((st.session_state.fill_step + 1) / total_anim_steps)
338
 
 
339
  col_anim1, col_anim2 = st.columns([1, 1])
340
  with col_anim1:
341
+ img1_ph = st.empty()
342
+ # นำ use_container_width=True ออกเพื่อล็อกขนาดภาพไม่ให้สั่น
343
+ img1_ph.image(draw_pulse_sequence(st.session_state.fill_step, total_anim_steps))
344
  with col_anim2:
345
+ img2_ph = st.empty()
346
+ # นำ use_container_width=True ออกเพื่อล็อกขนาดภาพไม่ให้สั่น
347
+ img2_ph.image(draw_kspace_filling(st.session_state.fill_step, total_anim_steps))
348
 
349
  st.markdown("""
350
  ---