added proper range
This commit is contained in:
parent
8968691622
commit
0ae4c6920c
@ -70,32 +70,39 @@ def result(request):
|
|||||||
radius = 2.5
|
radius = 2.5
|
||||||
center = (0, 0)
|
center = (0, 0)
|
||||||
w = Wedge(center, radius, theta1, theta2, fc='#D5D9FFB2', edgecolor='black')
|
w = Wedge(center, radius, theta1, theta2, fc='#D5D9FFB2', edgecolor='black')
|
||||||
|
w_upper = Wedge((0,2.5), radius, theta1, theta2, fc='#D5D9FF42', edgecolor='black')
|
||||||
|
w_lower = Wedge((0,-2.5), radius, theta1, theta2, fc='#D5D9FF42', edgecolor='black')
|
||||||
|
|
||||||
|
ax.set_xlim([-8, 8])
|
||||||
|
ax.set_ylim([-8, 8])
|
||||||
|
ax.grid(True)
|
||||||
|
|
||||||
|
ax.add_patch(w_upper)
|
||||||
|
ax.add_patch(w_lower)
|
||||||
ax.add_patch(w)
|
ax.add_patch(w)
|
||||||
|
|
||||||
sample_diameter = 5e-3
|
sample_diameter = 5e-3
|
||||||
gradient = float(request.GET.get('gradient'))
|
gradient = float(request.GET.get('gradient'))
|
||||||
freq_range = sample_diameter/2 * gradient * isotope1.gamma
|
|
||||||
close_isotopes = []
|
close_isotopes = []
|
||||||
for isotope in Isotope.objects.all():
|
for isotope in Isotope.objects.all():
|
||||||
if isotope.gamma == 0: continue
|
if isotope.gamma == 0: continue
|
||||||
if not isotope.stable: continue
|
if not isotope.stable: continue
|
||||||
f_Larmor = field_T*isotope.gamma
|
|
||||||
z = (freq/isotope.gamma-field_T)/gradient
|
z = (freq/isotope.gamma-field_T)/gradient
|
||||||
if abs(z) <= sample_diameter/2:
|
if abs(z) <= sample_diameter:
|
||||||
i_info = isotope_info(isotope, field_T)
|
i_info = isotope_info(isotope, field_T)
|
||||||
#i_info[3] = f"{z*1e3:.1f} mm"
|
#i_info[3] = f"{z*1e3:.1f} mm"
|
||||||
close_isotopes.append(i_info)
|
close_isotopes.append(i_info)
|
||||||
|
|
||||||
arr = FancyArrowPatch((np.sqrt(2.5**2-(z*1e3)**2),z*1e3), (-np.sqrt(2.5**2-(z*1e3)**2), z*1e3),
|
arr = FancyArrowPatch((-2.5,z*1e3), (2.5, z*1e3),
|
||||||
arrowstyle='<->,head_width=.1', mutation_scale=20)
|
arrowstyle='<->,head_width=.1', mutation_scale=20, linewidth=2)
|
||||||
ax.add_patch(arr)
|
ax.add_patch(arr)
|
||||||
ax.annotate(f"{isotope.n_nucleons}{isotope.symbol}", (1.05, 0), xycoords=arr, ha='left', va='center',fontsize=7)
|
ax.annotate(f"{isotope.n_nucleons}{isotope.symbol}", (1.1, 0), xycoords=arr, ha='left', va='center',fontsize=8)
|
||||||
|
|
||||||
ax.set_aspect('equal')
|
ax.set_aspect('equal')
|
||||||
ax.set_xlim([-4, 4])
|
|
||||||
ax.set_ylim([-4, 4])
|
|
||||||
ax.set_ylabel('z (mm)')
|
ax.set_ylabel('z (mm)')
|
||||||
ax.grid(True)
|
|
||||||
buf = BytesIO()
|
buf = BytesIO()
|
||||||
plt.savefig(buf, format='png')
|
plt.savefig(buf, format='png')
|
||||||
figure = base64.b64encode(buf.getvalue()).decode('utf-8').replace('\n', '')
|
figure = base64.b64encode(buf.getvalue()).decode('utf-8').replace('\n', '')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user