add: axis label

This commit is contained in:
liuyihui 2022-07-27 09:36:15 +08:00
parent ad45620c0f
commit 8cbcc431f1
3 changed files with 31 additions and 0 deletions

21
main.py Normal file
View File

@ -0,0 +1,21 @@
import numpy as np
from qdx import Process
p1 = Process("coef1.csv", n=5)
p2 = Process("coef2.csv", n=5)
# Mg25 + d -> Mg26* + p
angles = [i for i in np.arange(8, 64, 4)] + [10]
for angle in angles:
task = "Mg25(dp)Mg26/angle-{:d}.csv".format(angle)
print("Processing Task :", task)
p1.read_data(task)
p1.energy_filter(12, 30)
p1.draw_filter("Mg25(dp)Mg26/figure/filter/angle-{:d}.png".format(angle))
p1.draw_result("Mg25(dp)Mg26/figure/result/angle-{:d}.png".format(angle))
p2.read_data(task)
p2.energy_filter(12, 30)
p2.draw_filter("Mg25(dp)Mg26/figure/filter/angle-{:d}-o.png")
p2.draw_result("Mg25(dp)Mg26/figure/result/angle-{:d}-o.png".format(angle))

View File

@ -1 +1,3 @@
from .Bind import Bind from .Bind import Bind
from .process import Process
from .calibration import Calibration

View File

@ -123,6 +123,9 @@ class Process(object):
ax.scatter(self.pX_n, self.eng_n, s=0.01, color="orange") ax.scatter(self.pX_n, self.eng_n, s=0.01, color="orange")
ax.plot(px_x, self.reg(px_x)) ax.plot(px_x, self.reg(px_x))
ax.set_xlabel("x (mm)")
ax.set_ylabel("Energy (MeV)")
fig.savefig(path) fig.savefig(path)
plt.close() plt.close()
@ -147,5 +150,10 @@ class Process(object):
ax1.set_xticks(np.arange(px_min, px_max, 50)) ax1.set_xticks(np.arange(px_min, px_max, 50))
ax2.set_xticks(np.arange(px_min, px_max, 50)) ax2.set_xticks(np.arange(px_min, px_max, 50))
ax1.set_xlabel("x (mm)")
ax1.set_ylabel("Energy (MeV)")
ax2.set_xlabel("x (mm)")
ax2.set_ylabel("Count per bin")
fig.savefig(path) fig.savefig(path)
plt.close() plt.close()