Skip to content

Commit

Permalink
Edge alignment standalone file
Browse files Browse the repository at this point in the history
  • Loading branch information
MDecarabas committed Mar 8, 2024
1 parent fecde0e commit 01ac22a
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions apstools/plans/edge_align.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt

# Eample data
xpos = np.array([
-0.89500,
-0.78900,
-0.68400,
-0.57900,
-0.47400,
-0.36800,
-0.26300,
-0.15800,
-0.05300,
0.05300,
0.15800,
0.26300,
0.36800,
0.47400,
0.57900,
0.68400,
0.78900,
0.89500,
1.00000,
])

sig = np.array([
5225.44680,
10406.54446,
29364.11991,
91847.11330,
39397.99591,
12719.50183,
5950.02145,
3483.21205,
2210.18858,
1552.42419,
1088.73029,
882.58759,
680.85617,
562.82269,
466.21100,
385.87965,
315.28561,
284.60984,
246.65506,
])


dy_dx = np.gradient(sig, xpos)

# Plotting
plt.figure(figsize=(10, 5))

# Plot the original curve
plt.subplot(1, 2, 1)
plt.plot(xpos, sig, label='Original curve')
plt.legend()

# Plot the derivative
plt.subplot(1, 2, 2)
plt.plot(xpos, dy_dx, label='Derivative', color='red')
plt.legend()

plt.tight_layout()
plt.show()

0 comments on commit 01ac22a

Please sign in to comment.