Skip to content

Commit

Permalink
Merge pull request #1 from Yambottle/main
Browse files Browse the repository at this point in the history
Initial OOP design
  • Loading branch information
dimitri-yatsenko authored Sep 20, 2021
2 parents c78d0c7 + 97bb5ea commit bb93b4c
Show file tree
Hide file tree
Showing 17 changed files with 770 additions and 0 deletions.
22 changes: 22 additions & 0 deletions +src/+jobs/CatGT.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
classdef CatGT < src.jobs.JobBase
%CatGT Summary of this class goes here
% Detailed explanation goes here

properties
job_info
input
output
end

methods
function obj = CatGT(job_info, input)
obj.job_info = job_info;
obj.input = input;
end

function obj = execute(obj)
disp(obj.job_info);
end
end
end

15 changes: 15 additions & 0 deletions +src/+jobs/JobBase.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
classdef (Abstract) JobBase < handle
%JOBBASE Summary of this class goes here
% Detailed explanation goes here

properties (Abstract)
job_info
input
output
end

methods (Abstract)
execute(obj)
end
end

22 changes: 22 additions & 0 deletions +src/+jobs/KiloSort.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
classdef KiloSort < src.jobs.JobBase
%KiloSort Summary of this class goes here
% Detailed explanation goes here

properties
job_info
input
output
end

methods
function obj = KiloSort(job_info, input)
obj.job_info = job_info;
obj.input = input;
end

function obj = execute(obj)
disp(obj.job_info);
end
end
end

18 changes: 18 additions & 0 deletions +src/+pipeline/Config.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
classdef Config < handle
%RunSpec Summary of this class goes here
% Detailed explanation goes here

properties
run_name
gate_index
concat_trigger
probes
brain_regions
end

methods
function obj=Config()
end
end
end

27 changes: 27 additions & 0 deletions +src/+pipeline/Pipeline.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
classdef Pipeline < handle
%Pipeline Summary of this class goes here
% Detailed explanation goes here

properties
current_stage
stages
end

methods
function obj = Pipeline()
obj.current_stage = -1;
obj.stages = {};
end

function execute(obj)
% stages have to run in sequence, because of result dependency
for stage = obj.stages
curr = stage{:};
obj.current_stage = curr;
disp(obj.current_stage.stage_info);
curr.execute();
end
end
end
end

25 changes: 25 additions & 0 deletions +src/+stage/Stage.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
classdef Stage < handle
%Stage Summary of this class goes here
% Detailed explanation goes here

properties
stage_info
current_job
job_queue
end

methods
function obj = Stage(stage_info)
obj.stage_info = stage_info;
obj.job_queue = {};
end
function obj = execute(obj)
% TODO - jobs can run in parallel
for job = obj.job_queue
curr = job{:};
curr.execute();
end
end
end
end

16 changes: 16 additions & 0 deletions +src/Utils.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
classdef Utils
%Utils Summary of this class goes here
% Detailed explanation goes here

methods(Static)
function config = load_json(fpath)
fid = fopen(fpath);
raw = fread(fid,inf);
config = char(raw');
fclose(fid);
disp(config) % debug
config = jsondecode(config);
end
end
end

87 changes: 87 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Python
# Sphinx gallery temp dir
docs/auto_examples/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
test_data/
cached_data/
.pytest_cache/
test-reports/
.venv/

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# pyenv python configuration file
.python-version

# ide specific
.idea/
.history/
.vscode/

# matlab
*.mat
*.asv

# virtual environment
.venv/

# macOS
.DS_Store

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# neuropixels-toolkit
(Under construction) Neuropixel Toolkit is a set of unified Matlab tools for manipulating Neuropixel and Kilosort datasets

## Usecase Diagram
![Here should be a usecase diagram](docs/usecase_diagram.drawio.png)

## Class Diagram
![Here should be a class diagram](docs/class_diagram.drawio.png)
13 changes: 13 additions & 0 deletions configs/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "v0.0.1",
"type": "text/json",
"CatGT": {
"v1": 1,
"v2": 2
},
"KiloSort": {
"v1": 123,
"v2": 345,
"v3": 109
}
}
Loading

0 comments on commit bb93b4c

Please sign in to comment.