Skip to content

Commit

Permalink
Merge pull request #482 from Remi-Gau/remi-job_mat_to_mfile
Browse files Browse the repository at this point in the history
[ENH] save jobs as m file
  • Loading branch information
Remi-Gau authored Jan 21, 2022
2 parents 9d0275f + d5fcb7e commit be9ba3f
Show file tree
Hide file tree
Showing 73 changed files with 458 additions and 267 deletions.
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cff-version: 1.2.0
title: "CPP SPM"

version: 1.1.4dev

abstract: CPP_SPM is a set pipelines and tools for Octave/MATLAB to process and analyze BIDS data sets using SPM.

message: "If you use this software, please cite it as below."
Expand Down
65 changes: 65 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
## Contributing guidelines

Feel free to open issues to report a bug and ask for improvements.

If you want to contribute, have a look at our
[contributing guidelines](https://github.com/cpp-lln-lab/.github/blob/main/CONTRIBUTING.md)
that are meant to guide you and help you get started. If something is not clear
or you get stuck: it is more likely we did not do good enough a job at
explaining things. So do not hesitate to open an issue, just to ask for
clarification.

### Style guidelines

We use `camelCase` to name functions and variables for the vast majority of the
code in this repository.

Scripts names in general and as well functions related to the demos use a
`snake_case`.

Constant are written in `UPPERCASE`.

#### Input arguments ordering

From more general to more specific

`BIDS` > `opt` > `subject` > `session` > `run`

- `BIDS` (output from `getData` or `bids.layout`) restrict the set of possible
analysis one can run to this BIDS data set
- `opt` restricts this set even further
- `subject` / `session` / `run` even more

```matlab
% OK
varargout = getInfo(BIDS, opt, subLabel, info, varargin)
% not OK
varargout = getInfo(subLabel, BIDS, opt, info, varargin)
```

#### Output arguments ordering

Try to return them in order of importance first and in order of appearance
otherwise.

#### Exceptions

If function creates or modifies a batch then `matlabbatch` is the first `argin`
and first `argout`.

If a function performs an "action" to be chosen from a one of several strings
(with a switch statement), this string comes as first `argin` or second if
`matlabbatch` is first.

```matlab
% OK
varargout = getInfo('filename', BIDS, opt, subID, varargin)
[matlabbatch, voxDim] = setBatchRealign(matlabbatch, [action = 'realign',] BIDS, opt, subID)
% not OK
% 'filename' is the name of the "action" or the info to get in this case
% batch and action should go first
varargout = getInfo(BIDS, opt, subID, 'filename', varargin)
[matlabbatch, voxDim] = setBatchRealign(BIDS, opt, subID, matlabbatch, [action = 'realign'])
```
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ validate_cff: CITATION.cff

manual:
cd docs && sh create_manual.sh

70 changes: 0 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,76 +71,6 @@ Please see our
[documentation](https://cpp_spm.readthedocs.io/en/latest/index.html) for more
info.

## Contributing

Feel free to open issues to report a bug and ask for improvements.

If you want to contribute, have a look at our
[contributing guidelines](https://github.com/cpp-lln-lab/.github/blob/main/CONTRIBUTING.md)
that are meant to guide you and help you get started. If something is not clear
or you get stuck: it is more likely we did not do good enough a job at
explaining things. So do not hesitate to open an issue, just to ask for
clarification.

### Style guidelines

These are some of the guidelines we try to follow. Several of them are described
in our our
[contributing guidelines](https://github.com/cpp-lln-lab/.github/blob/main/CONTRIBUTING.md).

We use `camelCase` to name functions and variables for the vast majority of the
code in this repository.

Scripts names in general and as well functions related to the demos use a
`snake_case`.

Constant are written in `UPPERCASE`.

#### Input arguments ordering

From more general to more specific

`BIDS` > `opt` > `subject` > `session` > `run`

- `BIDS` (output from `getData` or `bids.layout`) restrict the set of possible
analysis one can run to this BIDS data set
- `opt` restricts this set even further
- `subject` / `session` / `run` even more

```matlab
% OK
varargout = getInfo(BIDS, opt, subLabel, info, varargin)
% not OK
varargout = getInfo(subLabel, BIDS, opt, info, varargin)
```

#### Output arguments ordering

Try to return them in order of importance first and in order of appearance
otherwise.

#### Exceptions

If function creates or modifies a batch then `matlabbatch` is the first `argin`
and first `argout`.

If a function performs an "action" to be chosen from a one of several strings
(with a switch statement), this string comes as first `argin` or second if
`matlabbatch` is first.

```matlab
% OK
varargout = getInfo('filename', BIDS, opt, subID, varargin)
[matlabbatch, voxDim] = setBatchRealign(matlabbatch, [action = 'realign',] BIDS, opt, subID)
% not OK
% 'filename' is the name of the "action" or the info to get in this case
% batch and action should go first
varargout = getInfo(BIDS, opt, subID, 'filename', varargin)
[matlabbatch, voxDim] = setBatchRealign(BIDS, opt, subID, matlabbatch, [action = 'realign'])
```

## Citation

```bibtex
Expand Down
64 changes: 45 additions & 19 deletions docs/source/architecture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,40 +74,66 @@ Batches
Low level functions description
===============================

Utility functions
-----------------
BIDS related functions
----------------------

.. automodule:: src.utils
.. automodule:: src.bids

.. autofunction:: cleanCrash
.. autofunction:: initBids

.. autofunction:: saveOptions
.. autofunction:: loadAndCheckOptions
.. autofunction:: addStcToQuery
.. autofunction:: removeEmptyQueryFields

.. autofunction:: getROIs

.. autofunction:: getInfo
.. autofunction:: getData

.. autofunction:: setDirectories
.. autofunction:: createDataDictionary
.. autofunction:: createDerivativeDir
.. autofunction:: createGlmDirName
.. autofunction:: getInfo
.. autofunction:: getSubjectList
.. autofunction:: getAndCheckRepetitionTime
.. autofunction:: getAndCheckSliceOrder

.. autofunction:: getAnatFilename
.. autofunction:: getBoldFilename
.. autofunction:: getMeanFuncFilename
.. autofunction:: getTpmFilename
.. autofunction:: getMeanFuncFilename
.. autofunction:: getBoldFilename
.. autofunction:: getAnatFilename

.. autofunction:: getFuncVoxelDims
.. autofunction:: getAndCheckSliceOrder
.. autofunction:: getSubjectList
Input / Output
--------------

.. automodule:: src.IO

.. autofunction:: saveOptions
.. autofunction:: loadAndCheckOptions

.. autofunction:: overwriteDir
.. autofunction:: createDerivativeDir

.. autofunction:: saveSpmScript

.. autofunction:: unzipAndReturnsFullpathName

.. autofunction:: onsetsMatToTsv
.. autofunction:: regressorsMatToTsv

.. autofunction:: renameSegmentParameter
.. autofunction:: renameUnwarpParameter
.. autofunction:: renameSegmentParameter

.. autofunction:: cleanCrash

Utility functions
-----------------

.. automodule:: src.utils

.. autofunction:: createDataDictionary
.. autofunction:: createGlmDirName

.. autofunction:: getFuncVoxelDims

.. autofunction:: rmTrialTypeStr
.. autofunction:: setFields

.. autofunction:: unzipAndReturnsFullpathName
.. autofunction:: validationInputFile


Expand Down
1 change: 1 addition & 0 deletions docs/source/defaults.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ checkOptions
============

.. autofunction:: checkOptions
.. autofunction:: setDirectories

spm_my_defaults
===============
Expand Down
84 changes: 0 additions & 84 deletions docs/source/function_description.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/set_up.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Selecting groups and subjects
The way to select certain subjects is summarised in the documentation of the
:func:`src/utils/getSubjectList` function.

.. automodule:: src.utils
.. automodule:: src.bids

.. autofunction:: getSubjectList
:noindex:
Expand Down
1 change: 0 additions & 1 deletion lib/miss_hit.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
enable: false

1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ pre-commit
jupyterlab
octave_kernel
rstcheck

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 1 addition & 3 deletions src/utils/saveOptions.m → src/IO/saveOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ function saveOptions(opt)
taskString = ['_task-', strjoin(opt.taskName, '')];
end

filename = fullfile(optionDir, [timeStamp(), '_options', ...
taskString, ...
'.json']);
filename = fullfile(optionDir, ['options', taskString, '_', timeStamp(), '.json']);

jsonFormat.indent = ' ';
spm_jsonwrite(filename, opt, jsonFormat);
Expand Down
Loading

0 comments on commit be9ba3f

Please sign in to comment.