Skip to content

Commit

Permalink
bug fixed and ross logo
Browse files Browse the repository at this point in the history
  • Loading branch information
ramintoosi committed Apr 18, 2023
1 parent fedb740 commit 72f4c12
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 14 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -404,4 +404,6 @@ compile_commands.json

# End of https://www.toptal.com/developers/gitignore/api/python,pycharm+all,flask,qt

data
data
/ross_backend/data.db
/ross_ui/ross_data/
8 changes: 4 additions & 4 deletions ross_backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,18 @@ def revoked_token_callback():
api.add_resource(UserLogout, '/logout')
api.add_resource(User, '/user/<int:user_id>')

api.add_resource(RawData, '/raw/<string:name>')
# api.add_resource(RawData, '/raw/<string:name>')
api.add_resource(RawDataDefault, '/raw')
api.add_resource(DetectDefault, '/detect')
api.add_resource(Detect, '/detect/<string:name>')
# api.add_resource(Detect, '/detect/<string:name>')
api.add_resource(SortDefault, '/sort')
api.add_resource(Sort, '/sort/<string:name>')
# api.add_resource(Sort, '/sort/<string:name>')

api.add_resource(DetectionResultDefault, '/detection_result')
api.add_resource(SortingResultDefault, '/sorting_result')

api.add_resource(Projects, '/projects')
api.add_resource(Project, '/project/<string:name>')
# api.add_resource(Project, '/project/<string:name>')

if __name__ == '__main__':
db.init_app(app)
Expand Down
7 changes: 5 additions & 2 deletions ross_backend/resources/detect.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import pickle
import traceback
from uuid import uuid4
from pathlib import Path

from flask_jwt_extended import jwt_required, get_jwt_identity
from flask_restful import Resource, reqparse, request
from models.config import ConfigDetectionModel
from models.data import DetectResultModel
from models.project import ProjectModel
from models.data import RawModel
from resources.funcs.detection import startDetection


Expand Down Expand Up @@ -106,7 +108,7 @@ def put(self, name):

class DetectDefault(Resource):
parser = reqparse.RequestParser(bundle_errors=True)
parser.add_argument('filter_type', type=str, required=True, choices=('butterworth'))
parser.add_argument('filter_type', type=str, required=True, choices='butterworth')
parser.add_argument('filter_order', type=int, required=True)
parser.add_argument('pass_freq', type=int, required=True)
parser.add_argument('stop_freq', type=int, required=True)
Expand Down Expand Up @@ -200,7 +202,8 @@ def put(self):
# -------------------------------------------------------
print("inserting detection result to database")

detection_result_path = '../ross_data/Detection_Result/' + str(uuid4()) + '.pkl'
detection_result_path = str(Path(RawModel.find_by_project_id(project_id).data).parent / \
(str(uuid4()) + '.pkl'))

with open(detection_result_path, 'wb') as f:
pickle.dump(data_file, f)
Expand Down
13 changes: 8 additions & 5 deletions ross_backend/resources/sort.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import pickle
import traceback
from uuid import uuid4
from pathlib import Path

from flask_jwt_extended import jwt_required, get_jwt_identity
from flask_restful import Resource, reqparse, request
from models.config import ConfigSortModel
from models.data import SortResultModel
from models.data import SortResultModel, RawModel
from models.project import ProjectModel
from models.user import UserModel
from resources.funcs.sorting import startSorting, startReSorting
Expand Down Expand Up @@ -254,16 +255,18 @@ def put(self):

data = {"clusters": clusters_index}

detection_result_path = '../ross_data/Sort_Result/' + str(uuid4()) + '.pkl'
with open(detection_result_path, 'wb') as f:
sort_result_path = str(Path(RawModel.find_by_project_id(project_id).data).parent /
(str(uuid4()) + '.pkl'))

with open(sort_result_path, 'wb') as f:
pickle.dump(data, f)

sortResult = SortResultModel.find_by_project_id(project_id)

if sortResult:
sortResult.data = detection_result_path
sortResult.data = sort_result_path
else:
sortResult = SortResultModel(user_id, detection_result_path, project_id)
sortResult = SortResultModel(user_id, sort_result_path, project_id)

try:
sortResult.save_to_db()
Expand Down
7 changes: 5 additions & 2 deletions ross_ui/controller/mainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class softwareMode(enum.Enum):
class MainApp(MainWindow):
def __init__(self):
super(MainApp, self).__init__()

self.setWindowIcon(QtGui.QIcon('view/icons/ross.png'))

# initial values for software options
self.plotHistFlag = False
self.pca_manual = None
Expand All @@ -65,8 +68,8 @@ def __init__(self):
self.spike_mat = None
self.spike_time = None

self.Raw_data_path = os.path.join(pathlib.Path(__file__).parent, './ross_data/Raw_Data')
self.pca_path = os.path.join(pathlib.Path(__file__).parent, './ross_data/pca_images')
self.Raw_data_path = os.path.join(pathlib.Path(__file__).parent, '../ross_data/Raw_Data')
self.pca_path = os.path.join(pathlib.Path(__file__).parent, '../ross_data/pca_images')

pathlib.Path(self.Raw_data_path).mkdir(parents=True, exist_ok=True)
pathlib.Path(self.pca_path).mkdir(parents=True, exist_ok=True)
Expand Down
Binary file added ross_ui/view/icons/ross.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 72f4c12

Please sign in to comment.