Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data characteristics plugin #107

Merged
merged 1 commit into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions QtBrainChartGUI/plugins/data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,6 @@ def ReadData(self,filename):
self.datamodel.SetMUSEDictionaries(MUSEDictNAMEtoID, MUSEDictIDtoNAME)

#set data in model
self.datamodel.SetDataFilePath(filename)
self.datamodel.SetData(d)

36 changes: 31 additions & 5 deletions QtBrainChartGUI/plugins/datacharacteristics/datacharacteristics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,39 @@
from PyQt5 import QtGui, QtCore, QtWidgets, uic
import sys, os

class DataCharacteristics(IPlugin):
class DataCharacteristics(QtWidgets.QWidget,IPlugin):
priority = 0

def init(self, dataModel=None):
self.datamodel = dataModel
root = os.path.dirname(sys.argv[0])
self.ui = uic.loadUi(os.path.join(root, 'plugins', 'DataCharacteristics', 'datacharacteristics.ui'))
def __init__(self):
super(DataCharacteristics,self).__init__()
self.datamodel = None
root = os.path.dirname(__file__)
self.ui = uic.loadUi(os.path.join(root, 'datacharacteristics.ui'),self)

def getUI(self):
return self.ui

def SetupConnections(self):
self.datamodel.data_changed.connect(lambda: self.OnDataChanged())

def UpdateDataCharacteristics(self):
#get data statistics from model
stats = self.datamodel.GetDataStatistics()

#add statistics values to UI
self.numParticipantsValue_label.setText(str(stats['numParticipants']))
self.numObservationsValue_label.setText(str(stats['numObservations']))
ageVal = "[" + str(round(stats['minAge'],2)) + "," + str(round(stats['maxAge'],2)) + "]"
self.ageValue_label.setText(ageVal)
sexVal = "[" + str(stats['countsPerSex']['M']) + "," + str(stats['countsPerSex']['F']) + "]"
self.sexValue_label.setText(sexVal)

dataFilePath = self.datamodel.GetDataFilePath()
harmonizationModelFilePath = self.datamodel.GetHarmonizationModelFilePath()
self.datafileValue_label.setText(QtCore.QFileInfo(dataFilePath).fileName())
self.datafileValue_label.setToolTip(QtCore.QFileInfo(dataFilePath).absoluteFilePath())
self.harmonizationfileValue_label.setText(QtCore.QFileInfo(harmonizationModelFilePath).fileName())
self.harmonizationfileValue_label.setToolTip(QtCore.QFileInfo(harmonizationModelFilePath).absoluteFilePath())

def OnDataChanged(self):
self.UpdateDataCharacteristics()
112 changes: 99 additions & 13 deletions QtBrainChartGUI/plugins/datacharacteristics/datacharacteristics.ui
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,105 @@
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>90</x>
<y>60</y>
<width>171</width>
<height>81</height>
</rect>
</property>
<property name="text">
<string>Data characteristics</string>
</property>
</widget>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QLabel" name="numParticipants_label">
<property name="text">
<string>Number of Participants:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="sexValue_label">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="numParticipantsValue_label">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="numObservations_label">
<property name="text">
<string>Number of Observations:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="age_label">
<property name="text">
<string>Age[min,max]:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="harmonizationfile_label">
<property name="text">
<string>Harmonization File:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="harmonizationfileValue_label">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="sex_label">
<property name="text">
<string>Sex[M,F]:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="datafile_label">
<property name="text">
<string>Data File:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="datafileValue_label">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="numObservationsValue_label">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="ageValue_label">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Core]
Name = datacharacteristics
Name = Data Characteristics
Module = datacharacteristics

[Documentation]
Expand Down