cgdat package¶
Subpackages¶
Submodules¶
cgdat.cgdat_gui module¶
This file contains the main GUI class that is used in the Conditional game data analyse tool (CGDAT) was created for a friend of mine to help him with the data analysis he had to do for his graduation project. This tool is licensed under the GPL open source license. You are therefore free use the source code in any way provided that you the original copyright statements.
-
class
cgdat.cgdat_gui.
DataAnalyserGUI
[source]¶ Bases:
cgdat.qt_ui.cgdat_ui.Ui_MainWindow
This is the qt class used to create the general user interface for the CGDAT data analysis tool. It inherits from the Ui_MainWindow class that is automatically created by the PyQt5.uic.pyuic converter.
- Args:
- Ui_MainWindow (CGDAT_ui.Ui_MainWindow): Python GUI class created out of the CGDAT.ui file by the PyQt5.uic.pyuic converter.
-
action_about_slot
()[source]¶ Qt slot function created to display the about window. This slot is triggered when the about menu item is clicked or the user uses the F1 keyboard shortcut.
-
action_doc_slot
()[source]¶ Qt slot function displays the documentation. This slot is triggered when the docs menu item is clicked or the user uses the F2 keyboard shortcut.
-
add_conditions_row
()[source]¶ Qt slot function created to add an extra condition row to the condition grid. It is linked to the condition_add_row_btn and triggered when the button is clicked.
-
analyse_data
(*args, **kwargs)[source]¶ The function in which the data analysis is performed. The function uses the data present in the csv file which is specified in the input_file_path member variable. The data analysis is performed using the
pandas.read_csv()
function which returns a pandas dataframe. Following the data in this dataframe is checked against the conditional statements specified in the conditions grid of the main GUI window.- Args:
- player_name (str, optional): The name of the player that needs to be analysed. Put “” if you don’t want to filter by player. If
player_name
=None
the player is not used as a condition. progress_callback (str): The worker progress string which needs to be printed to the dialog console. - Returns:
- Bool: Descriptor specifying whether the data analyse was successfully.
-
analyse_input_data_file
(*args, **kwargs)[source]¶ Qt slot function that is used to check if the data file is valid and following add the available players to the player filter comboBox. This slot function is run in a worker thread so it does not freeze the GUI.
-
analyse_input_time_data_file
(*args, **kwargs)[source]¶ Qt slot function that is used to check if the time sections data file is valid. This slot function is run in a worker thread so it does not freeze the GUI.
-
catch_thread_errors
(error_tuple)[source]¶ This function catches errors in worker threads and outputs them to the user.
- Args:
- error_tuple (tuple): The error tuple that was send by the worker tread.
-
check_condition
()[source]¶ Qt slot function created to check whether the conditions have the right format.
- Args:
- condition_text (str): The condition text.
- Returns:
- bool: Boolean specifying whether the condition format is correct.
-
closeEvent
()[source]¶ This function is run when the GUI interface is closed. It saves the current settings so that they can be loaded the next time the GUI is opened.
-
data_analyse_dialog_finished
(result)[source]¶ This function is used to check whether the data analysis was completed successfully or that the user cancelled the data analysis. When the data analysis was cancelled it terminates any running workers.
- Args:
- result (int): Bool specifying whether the QDialog was accepted (1) or rejected (0)
-
data_input_worker_finished
(result)[source]¶ QT slot function used to check whether the data file import was successful. If successful it updates the player filter choicer menu by adding the available players to the menu options.
- Args:
- bool: Boolean specifying whether the data file import was successfully.
-
get_input_file
()[source]¶ Qt slot function created to get a user specified input file. It is linked to the input_file_browser_btn and displays a file choicer dialog in which the user can specify the input data file.
-
get_output_dir
()[source]¶ Qt slot function created to get a user specified output folder. It is linked to the output_file_browser_btn_btn and displays a folder choicer dialog in which the user can specify the input data file. If no folder is specified the output files will be placed in a CGDAT/results folder which is placed in the windows documents folder.
-
get_time_sections_file
()[source]¶ Qt slot function created to get a user specified time sectsions input file. In this file the
begin times
andEnd times
of the sections where the data analysis has to be performed are specified. It is linked to the time_file_browser_btn and displays a file choicer dialog in which the user can specify the input data file.
-
import_dialog_finished
(result)[source]¶ This function is used to check whether the data import was successful or whether the user cancelled the import using the cancel button present on the dialog window.
- Args:
- result (int): Bool specifying whether the QDialog was accepted (1) or rejected (0)
-
load_settings
(*args, **kwargs)[source]¶ This function is used to load possible earlier specified settings out of the
settings_sav.ini
config file.- Returns:
- [bool]: Bool specifying whether the config file could be loaded.
-
load_settings_finished
(result)[source]¶ This function is called when the load settings worker is finished. It is used to apply the old settings onto the GCDAT GUI.
- Args:
- result (bool): Boolean specifying whether the config file could be loaded successfully.
-
output_settings_dialog_finished
(result)[source]¶ Qt slot that is triggered when the output settings dialog is finished. This function updates the settings the user changed into the GUI member variables.
-
remove_conditions_row
()[source]¶ Qt slot function created to add an extra condition row to the condition grid. It is linked to the condition_remove_row_btn and triggered when the button is clicked.
-
reset_conditions
()[source]¶ Qt slot function created to reset the condition grid to its original state in which only condition row is present. It is linked to the reset_conditions_grid_btn.
-
set_output_settings
()[source]¶ Qt slot used to open the output_settings UI which can be used to set some additional settings for the output file. Currently the following additional settings are supported:
- Change the input file frequency: By default this will be around 600 hz.
- Set the columns to include in the output file: By default the CGDAT tool only keeps the variables (csv columns) that are specified in your conditions.
-
setupUi
(MainWindow)[source]¶ The function which is used to set up the parts of the GUI that were not already defined in the CGDAT.ui file. Further it is also used to add functionalities to the objects in the generated qt GUI python class.
- Args:
- MainWindow (PyQt5.QtWidgets.QMainWindow): Python Main window object created out of the CGDAT_ui.Ui_MainWindow class.
-
splash_screen_finished
(result)[source]¶ This slot function is called when the splash screen emits a finished signal.
-
start_data_analysis
()[source]¶ Qt slot function that is used to start the data analysis in a number of worker threads so that the GUI does not freeze when the data analysis is performed. The actual data analysis is performed by the
analyse_data()
function.
-
timeDelta2DateTime
(time_delta_list)[source]¶ This method converts a list containing the time since measurement onset [seconds] into a list containing dateTime objects counting up from 00:00:00.
- Args:
- time_delta_list (list): List containing the times since the measurement has started.
- Returns:
- list: A list with the time in the DateTime format.
-
time_import_dialog_finished
(result)[source]¶ This function is used to check whether the file specifying the time sections was imported successfully or whether the user cancelled the import using the cancel button present on the dialog window.
- Args:
- result (int): Bool specifying whether the QDialog was accepted (1) or rejected (0)
-
time_input_worker_finished
(result)[source]¶ QT slot function used to check whether the time section file was successfully imported. If successful it updates the player filter choicer menu by adding the available players to the menu options.
- Args:
- bool: Boolean specifying whether the data file import was successfully.
cgdat.create_shortcut_cl module¶
This function creates a shortcut which can be used to run the CGDAT tool
cgdat.start_cl module¶
This script is used to starts the cgdat gui out of the command line
Module contents¶
This package contains a simple GUI for analysing csv game data. It contains the DataAnalyserGUI gui class and all the modules and functions that are used in creating this class.