Skip to content

Commit

Permalink
Merge pull request #48 from introlab/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
SBriere authored Nov 1, 2019
2 parents ec4c914 + 6117cca commit c52b9e1
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 38 deletions.
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,23 @@ Please follow those steps to setup your development environment.
2. Install [CMake](https://cmake.org/download/)

3. Install [Qt + QtCreator](https://www.qt.io/)
1. Install the latest Desktop distribution fitting your compiling environment (will not be needed in the future)


1. Install the latest Desktop distribution fitting your compiling environment (will not be needed in the future)

4. Install [MiniConda3](https://conda.io/miniconda.html)
1. Install Python 3.6 version for current user (in user directory)
1. Install Python 3.6 version for current user (in user directory)

5. Install [PyCharm Community Edition](https://www.jetbrains.com/pycharm/)

### Step 1 : Open the root CMakeLists.txt in QtCreator
1. Opening the root CMakeLists.txt will allow to create and build the project
1. Build the project, it will automatically generate the Python environment in env/python-3.6, PyQt UI and RCC files.
2. All python dependencies will be automatically downloaded
3. Once the project is built, you will not need QtCreator until you change or add a resource file or a QtDesigner ui file.
4. If you change or add ui or resources files, you need to rebuild the project from QtCreator.
1. Build the project, it will automatically generate the Python environment in env/python-3.6, PyQt UI and RCC files.
2. All python dependencies will be automatically downloaded
3. Once the project is built, you will not need QtCreator until you change or add a resource file or a QtDesigner ui file.
4. If you change or add ui or resources files, you need to rebuild the project from QtCreator.

### Step 2 : Create a PyCharm project
1. Using PyCharm, opening the directory "{PROJECT_ROOT}/python"
1. Select the existing Python 3.6 environment in "{PROJECT_ROOT}/python/env/python-3.6" in the app menu: PyCharm->Preferences->Project:python->Project Interpreter
1. Select the existing Python 3.6 environment in "{PROJECT_ROOT}/python/env/python-3.6" in the app menu: PyCharm->Preferences->Project:python->Project Interpreter

### Step 3 : Run the application
1. Run the OpenIMUApp.py application from PyCharm
Expand Down
2 changes: 1 addition & 1 deletion python/OpenIMUApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def except_hook(cls, exception, traceback):
if __name__ == '__main__':
sys.excepthook = except_hook
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import Qt, QDir
from PyQt5.QtCore import QDir
from libopenimu.qt.MainWindow import MainWindow
import PyQt5

Expand Down
10 changes: 5 additions & 5 deletions python/libopenimu/algorithms/old/Algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ def resample_data(data, rate):
return np.array((t, xint, yint, zint)).transpose()


"""
Calculating magnitude
array contains t, acc_x, acc_y, acc_z
will return t, sqrt(acc_x^2,acc_y^2,acc_z^2)
"""
#
# Calculating magnitude
# array contains t, acc_x, acc_y, acc_z
# will return t, sqrt(acc_x^2,acc_y^2,acc_z^2)
#


def svm(data):
Expand Down
30 changes: 15 additions & 15 deletions python/libopenimu/algorithms/tests/test_freedson_adult_1998.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ def thread_finished_callback(self):
pass

def test_cutpoints(self):
self.assertEqual(freedson1998.CutPoints.classify(0), freedson1998.CutPoints.SEDENTARY)
self.assertEqual(freedson1998.CutPoints.classify(10), freedson1998.CutPoints.SEDENTARY)
self.assertEqual(freedson1998.CutPoints.classify(99), freedson1998.CutPoints.SEDENTARY)
self.assertEqual(freedson1998.CutPoints.classify(value=0), freedson1998.CutPoints.SEDENTARY)
self.assertEqual(freedson1998.CutPoints.classify(value=10), freedson1998.CutPoints.SEDENTARY)
self.assertEqual(freedson1998.CutPoints.classify(value=99), freedson1998.CutPoints.SEDENTARY)

self.assertEqual(freedson1998.CutPoints.classify(100), freedson1998.CutPoints.LIGHT)
self.assertEqual(freedson1998.CutPoints.classify(500), freedson1998.CutPoints.LIGHT)
self.assertEqual(freedson1998.CutPoints.classify(1951), freedson1998.CutPoints.LIGHT)
self.assertEqual(freedson1998.CutPoints.classify(value=100), freedson1998.CutPoints.LIGHT)
self.assertEqual(freedson1998.CutPoints.classify(value=500), freedson1998.CutPoints.LIGHT)
self.assertEqual(freedson1998.CutPoints.classify(value=1951), freedson1998.CutPoints.LIGHT)

self.assertEqual(freedson1998.CutPoints.classify(1952), freedson1998.CutPoints.MODERATE)
self.assertEqual(freedson1998.CutPoints.classify(3000), freedson1998.CutPoints.MODERATE)
self.assertEqual(freedson1998.CutPoints.classify(5724), freedson1998.CutPoints.MODERATE)
self.assertEqual(freedson1998.CutPoints.classify(value=1952), freedson1998.CutPoints.MODERATE)
self.assertEqual(freedson1998.CutPoints.classify(value=3000), freedson1998.CutPoints.MODERATE)
self.assertEqual(freedson1998.CutPoints.classify(value=5724), freedson1998.CutPoints.MODERATE)

self.assertEqual(freedson1998.CutPoints.classify(5726), freedson1998.CutPoints.VIGOROUS)
self.assertEqual(freedson1998.CutPoints.classify(8000), freedson1998.CutPoints.VIGOROUS)
self.assertEqual(freedson1998.CutPoints.classify(9498), freedson1998.CutPoints.VIGOROUS)
self.assertEqual(freedson1998.CutPoints.classify(value=5726), freedson1998.CutPoints.VIGOROUS)
self.assertEqual(freedson1998.CutPoints.classify(value=8000), freedson1998.CutPoints.VIGOROUS)
self.assertEqual(freedson1998.CutPoints.classify(value=9498), freedson1998.CutPoints.VIGOROUS)

self.assertEqual(freedson1998.CutPoints.classify(9499), freedson1998.CutPoints.VERY_VIGOROUS)
self.assertEqual(freedson1998.CutPoints.classify(100000), freedson1998.CutPoints.VERY_VIGOROUS)
self.assertEqual(freedson1998.CutPoints.classify(100000000000), freedson1998.CutPoints.VERY_VIGOROUS)
self.assertEqual(freedson1998.CutPoints.classify(value=9499), freedson1998.CutPoints.VERY_VIGOROUS)
self.assertEqual(freedson1998.CutPoints.classify(value=100000), freedson1998.CutPoints.VERY_VIGOROUS)
self.assertEqual(freedson1998.CutPoints.classify(value=100000000000), freedson1998.CutPoints.VERY_VIGOROUS)
2 changes: 1 addition & 1 deletion python/libopenimu/importers/BaseImporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def get_recordset(self, timestamp):
return None

# Validate timestamp
if my_time > datetime.datetime.now() or my_time < datetime.datetime(2018, 1, 1):
if my_time > datetime.datetime.now() or my_time < datetime.datetime(1969, 1, 1):
print("Invalid timestamp: " + str(timestamp))
return None

Expand Down
4 changes: 2 additions & 2 deletions python/libopenimu/qt/Charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,8 @@ def get_pos_from_time(self, timestamp):
def resizeEvent(self, e: QResizeEvent):
super().resizeEvent(e)

oldSize = e.oldSize()
newSize = e.size()
# oldSize = e.oldSize()
# newSize = e.size()

# Update cursor from time
if self.cursor_time:
Expand Down
2 changes: 0 additions & 2 deletions python/libopenimu/qt/ImportBrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
from libopenimu.models.DataSource import DataSource
from libopenimu.models.LogTypes import LogTypes

import gc


class ImportBrowser(QDialog):
dbMan = None
Expand Down
2 changes: 1 addition & 1 deletion python/libopenimu/qt/MainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def show_start_window(self):

# If we need to import data, show the import dialog
if start_window.importing:
self.importRequested()
self.import_requested()
gc.collect()

def setup_signals(self):
Expand Down
4 changes: 2 additions & 2 deletions python/libopenimu/qt/ResultWindow.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from PyQt5.QtWidgets import QWidget, QListWidgetItem, QTableWidgetItem, QTableWidget, QHeaderView
from PyQt5.QtWidgets import QWidget, QListWidgetItem, QTableWidgetItem, QHeaderView
from PyQt5.QtGui import QIcon, QColor, QGuiApplication
from PyQt5.QtCore import Qt, QItemSelectionModel
from PyQt5.QtCore import Qt

from resources.ui.python.ResultWidget_ui import Ui_frmResult

Expand Down

0 comments on commit c52b9e1

Please sign in to comment.