Skip to content

Commit

Permalink
Merge pull request #3 from amtelford/master
Browse files Browse the repository at this point in the history
Update cv.py
  • Loading branch information
amtelford authored Jun 5, 2018
2 parents 361bfe8 + eee4ef7 commit 82c8554
Showing 1 changed file with 24 additions and 34 deletions.
58 changes: 24 additions & 34 deletions Experiments/cv.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def create_menu_bar(self):
def new_batch(self, batch_mode):
""" Shows current batch window or, if a different batch is chosen, destroys the old one and creates a new one
for the new batch mode
:param batch_mode: the selected type of batch
:return: None
"""
Expand All @@ -94,8 +93,8 @@ def new_batch(self, batch_mode):
self.batch = Batch(self.master, self.dm, fileheader=self.header, mode=batch_mode)

def create_interface(self):
""" Create GUI for the CV experiment
:return: None
""" Create GUI for the CV experiment
:return: None
"""
# Add elements to the menu bar
self.create_menu_bar()
Expand Down Expand Up @@ -221,8 +220,8 @@ def create_interface(self):
self.run_button.grid(column=1, row=98, sticky=( tk.E, tk.SW, tk.S))

def update_header(self):
""" Updates header in output text file
:return: None
""" Updates header in output text file
:return: None
"""
top0 = self.fixed_var.get()
top1 = self.fixed_value_var.get()
Expand All @@ -240,7 +239,6 @@ def update_header(self):

def fill_devices(self):
""" Fills the device selectors with the corresponding type of devices
:return: None
"""
self.za_box['values'] = self.dm.get_devices(['ZA'])
Expand All @@ -251,7 +249,6 @@ def fill_devices(self):
def select_za(self, *args):
""" When the Z analyser selector changes, this function updates some variables and the graphical interface
to adapt it to the selected device.
:param args: Dummy variable that does nothing but must exist (?)
:return: None
"""
Expand Down Expand Up @@ -285,7 +282,7 @@ def refresh_buttons(self):
""" Updates button features when different experimental setups are selected
:return: None
"""
if self.fixed_var.get() == 'freq':
if self.fixed_var.get() == 'freq':
self.x_scale_var.set('linear')
self.scan_scale() ## Updates plot_format, which is used to pass parameters to the device
self.xlog_button.configure(state='disabled')
Expand All @@ -303,7 +300,6 @@ def refresh_buttons(self):

def mode(self):
""" When the experimental setup is changed, this function updates some internal variables and the graphical interface
:return: None
"""

Expand Down Expand Up @@ -334,7 +330,6 @@ def mode(self):

def channel_param(self):
""" When the channel parameters are changed, this function updates some internal variables and the graphical interface
:return: None
"""
## Channel 1 labels ----------------------------------
Expand Down Expand Up @@ -363,7 +358,6 @@ def channel_param(self):

def scan_scale(self):
""" When the scan scales are changed, this function updates some internal variables and the graphical interface
:return: None
"""
## X-axis scale ----------------------------------
Expand All @@ -387,7 +381,6 @@ def scan_scale(self):

def start_stop_scan(self):
""" Starts and stops a scan
:return: None
"""
self.run_check()
Expand Down Expand Up @@ -415,7 +408,6 @@ def prepare_scan(self):
""" Any scan is divided in three stages:
1) Prepare the conditions of the scan (this function), creating all relevant variables.
2) Calls the 'start_scan' function to begin the measurement
:return: None
"""
## If inputs are OK, fill up the options dictionary and proceed.
Expand Down Expand Up @@ -444,19 +436,18 @@ def prepare_scan(self):

def start_scan(self):
""" Begins the experiment
:return: None
"""
:return: None
"""

self.za.setup_measurement(self.plot_format, self.options)
self.za.setup_measurement(self.plot_format, self.options)
self.za.measure(self.options)
self.get_data()


def get_data(self):
""" Retireves the data collected during the scan
:return: None
"""
""" Retireves the data collected during the scan
:return: None
"""

data0, data1, data2 = self.za.return_data()

Expand All @@ -471,7 +462,6 @@ def get_data(self):
def finish_scan(self):
""" Finish the scan, updating some global variables, saving the data in the temp file and offering to save the
data somewhere else.
:return: None
"""

Expand All @@ -493,14 +483,14 @@ def finish_scan(self):
self.prepare_scan()

def check_inputs(self, parameter, value, min, max):
""" Check the values of relevant scan parameters and gives an error if they are out of range
""" Check the values of relevant scan parameters and gives an error if they are out of range
:param parameter: the name of the parameter to check
:param: value: the value stored in the parameter variable
:param: min: the minimum value allowed for the parameter
:param: max: the maximum value allowed for the parameter
:return: Error: parameter out of range
"""
:param parameter: the name of the parameter to check
:param: value: the value stored in the parameter variable
:param: min: the minimum value allowed for the parameter
:param: max: the maximum value allowed for the parameter
:return: Error: parameter out of range
"""

if value < min or value > max:
messagebox.showerror("Error", parameter+" is out of range!")
Expand All @@ -512,10 +502,10 @@ def check_inputs(self, parameter, value, min, max):


def run_check(self):
""" Calls the 'check_inputs' function on all of relevant scan parameters
""" Calls the 'check_inputs' function on all of relevant scan parameters
:return: Error - parameter out of range
"""
:return: Error - parameter out of range
"""

self.mode = self.fixed_var.get()
self.fixed_value = float(self.fixed_value_var.get())
Expand Down Expand Up @@ -543,9 +533,9 @@ def run_check(self):


def abort(self):
""" Aborts scan
""" Aborts scan
:return: None
"""
:return: None
"""
self.za.abort_sweep()
self.get_data()

0 comments on commit 82c8554

Please sign in to comment.