-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from SilverLabUCL/initial-import
Initial import of code from old repository
- Loading branch information
Showing
53 changed files
with
14,774 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017-2018 University College London | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Matlab API for NWB use in the Silver Lab | ||
|
||
Quick usage example: | ||
|
||
``` matlab | ||
nwb = NwbFile('Data/161215_15_34_21.nwb'); | ||
gui = DisplayVideos(nwb); | ||
``` | ||
|
||
For examples of using the API from Matlab analysis scripts, see | ||
https://github.com/SilverLabUCL/Data-Analysis-Hana/blob/hdf5-experiment/RunUsingNwb.m | ||
|
||
|
||
## Automated Matlab testing | ||
|
||
Tests are stored in the [tests](./tests) folder. | ||
New tests are written as classes named like `TestSomething` within this folder. | ||
It's probably easiest to start by copying the structure of an existing test. | ||
|
||
Tests may be run locally, | ||
and are also run automatically when pushing to the `master` branch or creating/updating pull requests. | ||
|
||
### Local test running | ||
|
||
Within Matlab, change to the `MATLAB/tests` folder (or add it to your path) then run | ||
``` | ||
TestRunner() | ||
``` | ||
|
||
### Automated tests | ||
|
||
Results are displayed at http://jenkins.rc.ucl.ac.uk/ - ask Jonathan Cooper to give your GitHub account permissions to see this. | ||
Tests of the master branch are at http://jenkins.rc.ucl.ac.uk/job/SilverLab-main/ and for pull requests under http://jenkins.rc.ucl.ac.uk/job/SilverLab-pull-request/. | ||
|
||
You can also see results of specific builds linked from the pull requests / [commits](https://github.com/SilverLabUCL/SilverLab_NWBv1/commits/master) themselves. | ||
Click on 'Console output' to see the actual test output (scrolling past a lot of test environment setup output!). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# A little Python script to set the Matlab paths correctly for using NWB | ||
|
||
import argparse | ||
import os | ||
import re | ||
import sys | ||
|
||
|
||
def munge_path(path): | ||
"""Convert `path` to a native system path so Matlab understands it.""" | ||
if sys.platform.startswith('win32'): | ||
if re.match(r'/\s/.*', path): | ||
path = os.path.realpath('{}:{}'.format(path[1], path[2:])) | ||
elif sys.platform.startswith('cygwin'): | ||
if re.match(r'/cygdrive/\s/.*', path): | ||
path = os.path.realpath('{}:{}'.format(path[10], path[11:])) | ||
return path | ||
|
||
|
||
def setup_matlab(silverlab_path, nwb_api_path): | ||
silverlab_path = munge_path(silverlab_path) | ||
nwb_api_path = munge_path(os.path.join(nwb_api_path, 'matlab_bridge', 'matlab_bridge_api')) | ||
print('Setting up Matlab with paths:') | ||
print(' NWB API folder: {}'.format(nwb_api_path)) | ||
print(' Our Matlab folder: {}'.format(silverlab_path)) | ||
matlab_commands = [ | ||
"pyversion '{}';".format(sys.executable), | ||
"addpath('{}');".format(nwb_api_path), | ||
"addpath(genpath('{}'));".format(silverlab_path), | ||
"success = savepath();", | ||
"if success == 1; error('Failed to save Matlab path - set manually'); else quit; end;" | ||
] | ||
os.system('matlab -nosplash -nodesktop -r "{}"'.format(' '.join(matlab_commands))) | ||
|
||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser(description='Setup Matlab for NWB use.') | ||
parser.add_argument('nwb_api_path', | ||
help='path to the NWB API sources') | ||
args = parser.parse_args() | ||
our_matlab_path = os.path.join(os.path.dirname(__file__), 'source') | ||
setup_matlab(our_matlab_path, args.nwb_api_path) |
Oops, something went wrong.