polo.threads package

Submodules

polo.threads.thread module

class polo.threads.thread.ClassificationThread(run_object, parent=None)[source]

Bases: polo.threads.thread.thread

Thread that is specifically for classifying images using the MARCO model. This is a very CPU intensive process so it cannot be run on the GUI thread.

Parameters

run_object (Run or HWIRun) – Run who’s images are to be classified

change_value
estimated_time
run()[source]

Method that actually does the classification work. Emits the the change_value signal everytime an image is classified. This is primary to update the progress bar widget in the RunOrganizer widget to notify the user how many images have been classified. Additionally, every five images classified the estimated_time signal is emitted which includes a tuple that contains as the first item the time in seconds it took to classify the last five images and the number of images that remain to be classified as the second item. This allows for making an estimate on about how much time remains in until the thread finishes.

class polo.threads.thread.FTPDownloadThread(ftp_connection, file_paths, save_dir_path, parent=None)[source]

Bases: polo.threads.thread.thread

Thread specific for downloading files from a remote FTP server.

Parameters
  • ftp_connection (FTP) – FTP connection object to download files from

  • file_paths (list) – List absolute filepaths on the FTP server to download

  • save_dir_path (str or Path) – Path on the local machine to store all downloaded files in

download_path
file_downloaded
run(self)[source]
class polo.threads.thread.QuickThread(job_func, parent=None, **kwargs)[source]

Bases: polo.threads.thread.thread

QuickThreads are very similar to thread objects except instead of you writing code that would be executed by the run method directly, the function that the QuickThread will execute is passed as an argument to the __init__. Any arguments that the passed function requires are passed as key word arguments. Once the thread finished any values returned by the passed function are stored in the QuickThread’s polo.threads.thread.QuickThread.results attribute.

my_func = lambda x, y: x + y
x, y = 40, 60
my_thread = QuickThread(job_func=my_func, x=x, y=y)
# set up the thread with my_func and the args we want to pass
my_thread.start()
# my_thread.result will = 100 (x + y)
Parameters

job_func (func) – Function to execute on the thread

run(self)[source]
class polo.threads.thread.thread(parent=None)[source]

Bases: PyQt5.QtCore.QThread

Very basic wrapper class around QThread class. Should be inherited by a more specific class and then the run method can be overwritten to provide functionality. Whatever code is in the run() method will be executed when start() is called. The run() method should not be called explicitly.

Parameters

parent (QWidget, optional) – parent widget, defaults to None

run(self)[source]

Module contents