Skip to content

Commit

Permalink
Merge pull request #24 from smoia/fix/dmat
Browse files Browse the repository at this point in the history
Fix denoise_matrix input from CLI that was causing it to be a list of lists
  • Loading branch information
Stefano Moia authored Oct 30, 2021
2 parents 1bcbebd + 830e597 commit e1d502f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions phys2cvr/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,9 @@ def _get_parser():
default=0)
opt_regr.add_argument('-dmat', '--denoise-matrix',
dest='denoise_matrix',
action='append',
nargs='*',
type=str,
help=('Complete path (absolute or relative) and name '
help=('Complete path (absolute or relative) and filename '
'of denoising matrices to add to the regression model. '
'This option can be specified multiple times to '
'add multiple denoising matrices, but multiple '
Expand Down
3 changes: 2 additions & 1 deletion phys2cvr/phys2cvr.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def phys2cvr(fname_func, fname_co2=None, fname_pidx=None, fname_mask=None,
phys2cvr will add all polynomials up to the specified order
(e.g. if user specifies 3, orders 0, 1, 2, and 3 will be added).
Default is 0, which will model only the mean of the timeseries.
denoise_matrix : list of np.array(s), optional
denoise_matrix : list of str(s) or path(s), optional
Add one or multiple denoising matrices to the regression model.
Ignored if not performing the regression step.
scale_factor : str, int, or float, optional
Expand Down Expand Up @@ -359,6 +359,7 @@ def phys2cvr(fname_func, fname_co2=None, fname_pidx=None, fname_mask=None,

# Read in eventual denoising factors
if denoise_matrix:
denoise_matrix = io.if_declared_force_type(denoise_matrix, 'list', 'denoise_matrix')
for matrix in denoise_matrix:
LGR.info(f'Read confounding factor from {matrix}')
conf = np.genfromtxt(matrix)
Expand Down

0 comments on commit e1d502f

Please sign in to comment.