Skip to content

Commit

Permalink
Added updated current vs time script
Browse files Browse the repository at this point in the history
  • Loading branch information
j-a-foster committed Nov 29, 2024
1 parent f588da8 commit 31a5d7d
Showing 1 changed file with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
import matplotlib.pyplot as plt

# Define data points for each segment
x_red_blue = [0, 1, 2, 2.5, 5, 6]
x_red_blue = [0, 1, 2, 2.5, 5, 6] # x-coordinates for the red and blue dashed lines

y_red = [0, 3, 2.5, 2.5, 1.5, 0] # y-coordinates for the red solid line
y_red = [0, 3, 2.5, 2.5, 1.5, 0] # y-coordinates for the red dashed line

y_blue = [0, 4, -2, -2, -3, 0] # y-coordinates for the blue dashed line

x_black = x_red_blue[1:]
x_black = x_red_blue[1:] # x-coordinates for the black solid line

y_black = [0, 3.5, 3.5, 3.5, 0]
y_black = [0, 3.5, 3.5, 3.5, 0] # y-coordinates for the black solid line

# Create the figure and axis
fig, ax = plt.subplots(figsize=(10, 6))

# Plot the PF coil current
ax.plot(x_red_blue, y_red, "r-", linewidth=2, label="PF coil")
ax.plot(x_red_blue, y_red, "r--", linewidth=2, label="PF coil")

# Plot the central solenoid current
ax.plot(x_red_blue, y_blue, "b--", linewidth=2, label="Central solenoid")

# Plot the plasma current
ax.plot(x_black, y_black, "black", linewidth=2, label="Plasma")

# ax.axhline(y=-0.005, color="black", linestyle="-")

# Move the x-axis to 0 on the y-axis
ax.spines["bottom"].set_position("zero")

# Adjust the axes limits to allow space for labels
ax.set_xlim(0, 7.2)

ax.set_ylim(-3.5, 4.2)

# Annotate key points
Expand Down Expand Up @@ -72,7 +71,7 @@
xytext=(2, -3.2),
arrowprops={"arrowstyle": "|-|", "shrinkA": 0, "shrinkB": 0},
)
ax.annotate(r"$I_{\text{P}}$ Ramp-up", xy=(1.5, -3.4), ha="center", va="center")
ax.annotate(r"$I_{\text{P}}$ Ramp-Up", xy=(1.5, -3.4), ha="center", va="center")
ax.annotate(
"",
xy=(2, -3.2),
Expand Down Expand Up @@ -107,11 +106,12 @@
ax.xaxis.set_label_coords(0.97, 0.5)
ax.set_ylabel("Current", fontsize=12)

# Remove axes ticks
ax.set_xticklabels([])
ax.set_yticklabels([])

# Add a title
ax.set_title("Current Profiles over time", fontsize=14)
ax.set_title("Current Profiles Over Time", fontsize=14)

# Add a legend
ax.legend()
Expand All @@ -121,5 +121,4 @@

# Adjust layout and display the plot
plt.tight_layout()
plt.savefig("/testing/my_scripts/timings_plot.png")
# plt.show()
plt.savefig("/home/jg6173/testing/my_scripts/current_vs_time_plot.png")

0 comments on commit 31a5d7d

Please sign in to comment.