Compare commits

..

2 commits

Author SHA1 Message Date
Nicolas Rohrbeck
0dbd1efe91 Improved plot method 2025-04-08 13:40:22 +02:00
Nicolas Rohrbeck
55c07be548 added plots/ directory 2025-04-08 12:13:01 +02:00
2 changed files with 17 additions and 4 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
data/ data/
plots/

View file

@ -72,7 +72,7 @@ class ads:
data = np.delete(data, 0, 0) # deletes the zeroes line data = np.delete(data, 0, 0) # deletes the zeroes line
return data return data
def plot(self) -> None: def plot(self, show: bool = True, save: bool = False) -> None:
dataarray = self.read_file() dataarray = self.read_file()
plt.rcParams.update({'figure.autolayout': True}) plt.rcParams.update({'figure.autolayout': True})
x = [] x = []
@ -95,9 +95,21 @@ class ads:
ax2.legend() ax2.legend()
ax1.grid() ax1.grid()
ax2.grid() ax2.grid()
plt.show() plt.title(f"{self.filename}.png")
ax1.set_ylabel("Measured magnetic field in Gs")
ax2.set_ylabel("Measured acceleration in $g$")
ax2.set_xlabel("Time in YYYY-MM-DD HH:MM:SS")
if save:
plt.savefig(fr"C:/Users/nicol/OneDrive/Dokumente/Python Scripts/ADS/plots/{self.filename}.png", format="png")
if show:
plt.show()
if __name__ == "__main__" : if __name__ == "__main__" :
instance = ads(r"C:/Users/nicol/OneDrive/Dokumente/Python Scripts/ADS/data/junior/2025-03-27T11-21-07Z.EI") # filenames on windows may not have a colon (:)
instance.plot()
#calibration27mar = ads(r"C:/Users/nicol/OneDrive/Dokumente/Python Scripts/ADS/data/junior/2025-03-27T11-21-07Z.EI")
#calibration27mar.plot()
flight01apr = ads(r'C:/Users/nicol/OneDrive/Dokumente/Python Scripts/ADS/data/junior/2025-04-01T07_32_37Z.EI')
flight01apr.plot()