Skip to content

Commit 90b9676

Browse files
authored
Merge pull request #30 from Remi-Gau/dev
[INFRA] add octave tests
2 parents 5df3f61 + 7ebe05d commit 90b9676

File tree

11 files changed

+73
-33
lines changed

11 files changed

+73
-33
lines changed

.github/workflows/run_tests_matlab.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
release: R2020a
2626

2727
- name: Clone spm_2_bids
28-
uses: actions/checkout@v2
28+
uses: actions/checkout@v3
2929
with:
3030
submodules: true
3131
fetch-depth: 2
@@ -36,8 +36,7 @@ jobs:
3636
git clone https://github.com/MOcov/MOcov.git --depth 1
3737
3838
- name: get bids-matlab and JSONio
39-
run: |
40-
make install_dev
39+
run: make install_dev
4140

4241
- name: Run commands
4342
uses: matlab-actions/[email protected]
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: tests_octave
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- dev
8+
pull_request:
9+
branches: ['*']
10+
11+
jobs:
12+
test:
13+
14+
runs-on: ubuntu-20.04
15+
16+
steps:
17+
18+
- name: Install dependencies
19+
run: |
20+
sudo apt-get -y -qq update
21+
sudo apt-get -y install octave liboctave-dev
22+
23+
- name: Clone spm_2_bids
24+
uses: actions/checkout@v3
25+
with:
26+
submodules: true
27+
fetch-depth: 2
28+
29+
- name: get bids-matlab and JSONio
30+
run: make install_dev_octave
31+
32+
- name: MOxUnit Action
33+
uses: joergbrech/[email protected]
34+
with:
35+
tests: tests
36+
src: src src/defaults src/utils
37+
ext: lib/JSONio lib/bids-matlab tests/utils
38+
with_coverage: false

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cff-version: 1.2.0
22

33
title: "spm_2_bids"
44

5-
version: 0.2.0
5+
version: 0.2.0dev
66

77
abstract: Toolbox to convert SPM output files to valid BIDS derivatives.
88

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[![code quality](https://github.com/cpp-lln-lab/spm_2_bids/actions/workflows/miss_hit_code_quality.yml/badge.svg)](https://github.com/cpp-lln-lab/spm_2_bids/actions/workflows/miss_hit_code_quality.yml)
22
[![code style](https://github.com/cpp-lln-lab/spm_2_bids/actions/workflows/miss_hit_code_style.yml/badge.svg)](https://github.com/cpp-lln-lab/spm_2_bids/actions/workflows/miss_hit_code_style.yml)
3-
[![tests](https://github.com/cpp-lln-lab/spm_2_bids/actions/workflows/run_tests.yml/badge.svg)](https://github.com/cpp-lln-lab/spm_2_bids/actions/workflows/run_tests.yml)
3+
[![tests and coverage with matlab](https://github.com/cpp-lln-lab/spm_2_bids/actions/workflows/run_tests_matlab.yml/badge.svg)](https://github.com/cpp-lln-lab/spm_2_bids/actions/workflows/run_tests_matlab.yml)
44
[![codecov](https://codecov.io/gh/cpp-lln-lab/spm_2_bids/branch/master/graph/badge.svg?token=yaL40GJK9y)](https://codecov.io/gh/cpp-lln-lab/spm_2_bids)
5+
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.6564109.svg)](https://doi.org/10.5281/zenodo.6564109)
56

67
# spm_2_bids
78

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
author = "Rémi Gau"
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = "v0.2.0"
25+
release = "v0.2.0dev"
2626

2727

2828
# -- General configuration ---------------------------------------------------

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
miss_hit==0.9.27
1+
miss_hit==0.9.33
22
pre-commit
33
jupyterlab
44
octave_kernel

src/Mapping.m

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -367,20 +367,3 @@ function print_mapping(obj, filename)
367367

368368
end
369369
end
370-
371-
function bf = prepare_for_printing(spec)
372-
373-
if isfield(spec, 'suffix') && isempty(spec.suffix) || ...
374-
~isfield(spec, 'suffix')
375-
spec.suffix = '*';
376-
end
377-
378-
if isfield(spec, 'ext') && ~isempty(spec.ext)
379-
spec.extension = '.*';
380-
end
381-
if ~isfield(spec, 'extension') || isempty(spec.extension)
382-
spec.ext = '.*';
383-
end
384-
385-
bf = bids.File(spec);
386-
end

src/utils/identify_rawsources.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
verbose = true;
3434
end
3535

36-
if endsWith(derivatives, '_seg8.mat')
36+
if bids.internal.ends_with(derivatives, '_seg8.mat')
3737
derivatives = strrep(derivatives, '_seg8.mat', '.nii');
38-
elseif endsWith(derivatives, '_uw.mat')
38+
elseif bids.internal.ends_with(derivatives, '_uw.mat')
3939
derivatives = strrep(derivatives, '_uw.mat', '.nii');
4040
end
4141

src/utils/identify_sources.m

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@
7171
return
7272
end
7373

74-
if endsWith(derivatives, '_seg8.mat')
74+
if bids.internal.ends_with(derivatives, '_seg8.mat')
7575

7676
prefix_based = false;
7777

7878
derivatives = strrep(derivatives, '_seg8.mat', '.nii');
7979

80-
elseif endsWith(derivatives, '_uw.mat')
80+
elseif bids.internal.ends_with(derivatives, '_uw.mat')
8181

8282
prefix_based = false;
8383

@@ -102,17 +102,18 @@
102102
else
103103
% remove the prefix of the last step
104104

105-
if startsWith(bf.prefix, 's') || startsWith(bf.prefix, 'u')
105+
if bids.internal.starts_with(bf.prefix, 's') || ...
106+
bids.internal.starts_with(bf.prefix, 'u')
106107
bf.prefix = bf.prefix(2:end);
107108

108-
elseif startsWith(bf.prefix, 'w')
109+
elseif bids.internal.starts_with(bf.prefix, 'w')
109110
bf.prefix = bf.prefix(2:end);
110111
add_deformation_field = true;
111112

112-
elseif startsWith(bf.prefix, 'rp_a')
113+
elseif bids.internal.starts_with(bf.prefix, 'rp_a')
113114
bf.prefix = bf.prefix(4:end);
114115

115-
elseif startsWith(bf.prefix, 'mean')
116+
elseif bids.internal.starts_with(bf.prefix, 'mean')
116117
% TODO mean may involve several files from the source (across runs
117118
% and sessions
118119
% prefixes = {

src/utils/prepare_for_printing.m

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
function bf = prepare_for_printing(spec)
2+
%
3+
% (C) Copyright 2022 spm_2_bids developers
4+
5+
if isfield(spec, 'suffix') && isempty(spec.suffix) || ...
6+
~isfield(spec, 'suffix')
7+
spec.suffix = '*';
8+
end
9+
10+
if isfield(spec, 'ext') && ~isempty(spec.ext)
11+
spec.extension = '.*';
12+
end
13+
if ~isfield(spec, 'extension') || isempty(spec.extension)
14+
spec.ext = '.*';
15+
end
16+
17+
bf = bids.File(spec);
18+
end

0 commit comments

Comments
 (0)