cosmetics

This commit is contained in:
Markus Rosenstihl 2025-04-07 07:52:26 +02:00
parent 7fa6f0a015
commit 0a902eb619

View File

@ -192,20 +192,30 @@ def position(request):
for p in indices: for p in indices:
#vline = Span(location=_z_coords[p]*1e3, dimension='height', line_color='gray', line_width=1) #vline = Span(location=_z_coords[p]*1e3, dimension='height', line_color='gray', line_width=1)
#plot.renderers.extend([vline]) #plot.renderers.extend([vline])
label = Label(x=_z_coords[p]*1e3+25, label = Label(
y=-(np.sign(_z_coords[p]) *10) +(_gradients[p]), text=f"{_z_coords[p]*1e3:.2f},{_gradients[p]:.1f}T/m", text_baseline="middle", x=_z_coords[p]*1e3+25,
text_align="center", text_font_size="11pt", y=-(np.sign(_z_coords[p])*30) + (_gradients[p]),
border_line_color="#D5D9FF", background_fill_color="white", text=f"{_z_coords[p]*1e3:.2f},{_gradients[p]:.1f}T/m",
y_range_name="gradient") text_baseline="middle",
text_align="center", text_font_size="11pt",
border_line_color="#D5D9FF",
background_fill_color="white",
background_fill_alpha=0.7,
y_range_name="gradient",
)
plot.add_layout(label) plot.add_layout(label)
#plot.circle(x=_z_coords[indices]*1e3, y=_fields[indices], radius=2, color="gray") #plot.circle(x=_z_coords[indices]*1e3, y=_fields[indices], radius=2, color="gray")
plot.circle(x=_z_coords[indices]*1e3, y=_gradients[indices], radius=2, color="gray",y_range_name="gradient" ) plot.circle(x=_z_coords[indices]*1e3, y=_gradients[indices], radius=2, color="gray",y_range_name="gradient" )
# plot the B0 field hlines # plot the B0 field hlines
hline0 = Span(location=0, dimension='width', line_color='black', line_width=4)
hline1 = Span(location=field_T, dimension='width', line_color='gray', line_width=2) hline1 = Span(location=field_T, dimension='width', line_color='gray', line_width=2)
label1 = Label(x=frame_right, y=field_T, text=f"{field_T:.1f}T/m", label1 = Label(x=frame_right, y=field_T, text=f"{field_T:.1f}T/m",
text_baseline="middle") text_baseline="middle")
hline2 = Span(location=-field_T, dimension='width', line_color='gray', line_width=2) hline2 = Span(location=-field_T, dimension='width', line_color='gray', line_width=2)
plot.renderers.extend([hline1, hline2, label1]) plot.renderers.extend([hline0, hline1, hline2, label1])
for i in indices:
plot.line(x=[_z_coords[i]*1e3, _z_coords[i]*1e3], y=[_fields[i], _gradients[i]/20. ] , color="gray", line_dash="dashed" )
close_isotopes = [] close_isotopes = []
for isotope in Isotope.objects.all(): for isotope in Isotope.objects.all():