diff --git a/config.ini b/config.ini index de67ed7..3a626cb 100644 --- a/config.ini +++ b/config.ini @@ -8,18 +8,18 @@ detuning=1.0 linewidth=9.7946 [plot] -colormap=Greys +colormap=viridis [atoms] repump_time=0.3 mass=3.84e-26 [fit] -fix_theta=True +fix_theta=False roi=300,300,900,700 threeroi=300,300,900,700,400,400,900,700,0,0,200,200 tof=3.0,4.0,5.0,6.0,7.0 center=300.0,400.0 -fix_z0=True +fix_z0=False fit_optical_density=True diff --git a/config.py b/config.py index a3a28c7..1b0af64 100644 --- a/config.py +++ b/config.py @@ -169,7 +169,7 @@ def center(self, tup): @property def logheader(self): """Defines the headers of the logging.csv file saved in '../Raw Data/' folder.""" - return ["filename", "magnification", "atom number", "fitted shot", "tof_sequence", "time_sequence", "average_T (uK)"] + return ["filename", "magnification", "atom number", "fitted shot", "tof_sequence", "time_sequence", "average_T (uK)", "Comments"] config = Config("config.ini") diff --git a/presenters/shots.py b/presenters/shots.py index 0958e6a..a3b1a5a 100644 --- a/presenters/shots.py +++ b/presenters/shots.py @@ -14,7 +14,7 @@ from config import config from models import shots - +from views.settings import Settings class ShotPresenter: def __init__(self, app, worker, *, plot_view, fit_view, list_view, threeroi_view): @@ -51,8 +51,10 @@ def process_shot(self, name, paths): shot.plot(figure) figure.savefig(_output_path(name), dpi=150) # Saves fit params to log file - logging.info("Updating log for shot %s ", name) + cmnts = Settings.get_comment + + logging.info("Updating logging.csv for shot %s with comment %s ", name, cmnts) # Checks if log file already exists, if not creates a new one if not path.exists(_output_log_path(name)): diff --git a/views/application.py b/views/application.py index 0298eec..46fb8ba 100644 --- a/views/application.py +++ b/views/application.py @@ -5,7 +5,7 @@ import tkinter.ttk as ttk from views.logs import LogTextBox -from views.plots import MplFigure, PlotSettings +from views.settings import MplFigure, Settings from views.shots import ShotList, ShotFit, ExperimentParams, ThreeROI from views.sequences import ToFFit, AtomNumberOptimization @@ -90,11 +90,11 @@ def __init__(self, master, presenter): self.atom_number_fit = AtomNumberOptimization(self, self.presenter) self.three_roi_atom_count = ThreeROI(self, self.presenter) exp = ExperimentParams(self) - settings = PlotSettings(self) + settings = Settings(self) self.add(self.shot_fit, text="Gaussian", padding=10) self.add(self.tof_fit, text="Temperature", padding=10) self.add(self.atom_number_fit, text="Atom # Optimization", padding=10) self.add(self.three_roi_atom_count, text="Three ROIs", padding=10) self.add(exp, text="Experiment Settings", padding=10) - self.add(settings, text="Plot Settings", padding=10) + self.add(settings, text="Settings", padding=10) diff --git a/views/plots.py b/views/settings.py similarity index 58% rename from views/plots.py rename to views/settings.py index e9d9227..f0b2122 100644 --- a/views/plots.py +++ b/views/settings.py @@ -1,3 +1,5 @@ +import logging + import tkinter as tk import tkinter.ttk as ttk @@ -27,13 +29,14 @@ def display(self, obj): self.canvas.draw() -class PlotSettings(ttk.Frame): +class Settings(ttk.Frame): def __init__(self, master): super().__init__(master) frame = ttk.Frame(self) frame.pack(expand=True) + # Defines GUI for colormaps in plot self.colormap = tk.StringVar( frame, name="colormap", value=config.get("plot", "colormap") ) @@ -47,9 +50,31 @@ def __init__(self, master): command=lambda val: self.save_config("colormap", val), ).grid(row=0, column=1) + # Defines comment box for saving in logging.csv + ttk.Label(frame, text="Logging comments").grid(row=2, column=0, columnspan=2) + self.comment_string = "" + self.var = tk.StringVar() + comments_entry = ttk.Entry(frame, textvariable=self.var) + comments_entry.grid(row=3, column=0, columnspan=3, padx=5, pady=5) + #ttk.Label(frame, text="Any comments are automatically appended in 'logging.csv' .").grid(row=5, column=0, columnspan=3) + + # Updating comments strategy + self.update_comments = ttk.Button(frame, text="Update", command=self._update_comments) + self.update_comments.grid(row=4, column=1) + comments_entry.bind('', self._update_comments) + def save_config(self, name, val): if val == "Professor Mode": config.set("plot", name, value="Greys") else: config.set("plot", name, value=val) config.save() + + def get_comment(self): + return self.comment_string + + def _update_comments(self, event=None): + self.comment_string = self.var.get() + logging.info("Updated comments: %s", self.comment_string) + + # Include a comments section in GUI where the exported output goes to logging.csv.