diff --git a/config.py b/config.py index 1b0af64..9e60130 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)", "Comments"] + return ["filename", "magnification", "atom number", "fitted shot", "tof_sequence", "time_sequence", "average_T (uK)", "threeroi", "a_b_ratio", "Comments"] config = Config("config.ini") diff --git a/presenters/application.py b/presenters/application.py index 659c673..d995d68 100644 --- a/presenters/application.py +++ b/presenters/application.py @@ -31,7 +31,8 @@ def set_view(self, view): plot_view=self.view.plot, fit_view=self.view.tabs.shot_fit, list_view=self.view.shot_list, - threeroi_view=self.view.tabs.three_roi_atom_count + threeroi_view=self.view.tabs.three_roi_atom_count, + settings_view=self.view.tabs.settings ) self.sequence_presenter = SequencePresenter( self, self.worker, plot_view=self.view.plot, fit_view=self.view.tabs.tof_fit diff --git a/presenters/shots.py b/presenters/shots.py index a3b1a5a..194773f 100644 --- a/presenters/shots.py +++ b/presenters/shots.py @@ -14,16 +14,16 @@ 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): + def __init__(self, app, worker, *, plot_view, fit_view, list_view, threeroi_view, settings_view): self.app = app self.worker = worker self.plot_view = plot_view self.fit_view = fit_view self.list_view = list_view self.threeroi_view = threeroi_view + self.settings_view = settings_view # Stores data for past (maxlen) shots self.recent_shots = deque(maxlen=15) self.current_shot = None @@ -50,11 +50,16 @@ def process_shot(self, name, paths): figure = Figure(figsize=(8, 5)) shot.plot(figure) figure.savefig(_output_path(name), dpi=150) - # Saves fit params to log file - cmnts = Settings.get_comment + # Saves fit params to log file + cmnts = self.settings_view.get_comment() + abratio = "" + threeroi_array = [] + if config.three_roi_enabled: # only appends value if threeroi is enabled + abratio = shot.three_roi_atom_number["a_b_ratio"] + threeroi_array = config.threeroi - logging.info("Updating logging.csv for shot %s with comment %s ", name, cmnts) + 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)): @@ -68,7 +73,10 @@ def process_shot(self, name, paths): writer.writerow({"filename" : name, "magnification" : config.magnification, "atom number" : shot.atom_number, - "fitted shot" : config.fit}) + "fitted shot" : config.fit, + "threeroi" : threeroi_array, + "a_b_ratio" : abratio, + "Comments" : cmnts}) # Check if ToF or optimization self.app.sequence_presenter.add_shot(shot) diff --git a/views/application.py b/views/application.py index 46fb8ba..76d5d0f 100644 --- a/views/application.py +++ b/views/application.py @@ -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 = Settings(self) + 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="Settings", padding=10) + self.add(self.settings, text="Settings", padding=10) diff --git a/views/settings.py b/views/settings.py index f0b2122..bbaad7c 100644 --- a/views/settings.py +++ b/views/settings.py @@ -51,7 +51,7 @@ def __init__(self, master): ).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) + ttk.Label(frame, text="Logging.csv comments").grid(row=2, column=0, columnspan=2) self.comment_string = "" self.var = tk.StringVar() comments_entry = ttk.Entry(frame, textvariable=self.var)