neurostuff / compose-runner

package for running neurosynth-compose generated bundles
0 stars 0 forks source link

Allow setting n_cores at run time #12

Closed adelavega closed 9 months ago

adelavega commented 9 months ago

It would be more useful to set things such as n_cores at runtime, allowing spec to be over-written

Also, kwargs are interpreted as string, so setting n_cores fails if set in spec (through website) right now

/usr/local/lib/python3.10/dist-packages/nimare/utils.py in _check_ncores(n_cores)
     28         Moved from Estimator._check_ncores into its own function.
     29     """
---> 30     if n_cores <= 0:
     31         n_cores = mp.cpu_count()
     32     elif n_cores > mp.cpu_count():

TypeError: '<=' not supported between instances of 'str' and 'int'
adelavega commented 9 months ago

Same issue for n_iters

    return self._transform(results)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nimare/workflows/base.py", line 147, in _transform
    corr_result = self.corrector.transform(result)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nimare/correct.py", line 185, in transform
    corr_maps, corr_tables, description = getattr(est, correction_method)(
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nimare/meta/cbma/mkda.py", line 835, in correct_fwe_montecarlo
    rand_idx1 = np.random.choice(null_xyz.shape[0], size=(iter_df1.shape[0], n_iters))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "numpy/random/mtrand.pyx", line 998, in numpy.random.mtrand.RandomState.choice
  File "numpy/random/mtrand.pyx", line 782, in numpy.random.mtrand.RandomState.randint
  File "numpy/random/_bounded_integers.pyx", line 1315, in numpy.random._bounded_integers._rand_int64
  File "/usr/local/lib/python3.11/site-packages/numpy/core/fromnumeric.py", line 3100, in prod
    return _wrapreduction(a, np.multiply, 'prod', axis, dtype, out,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/numpy/core/fromnumeric.py", line 88, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
numpy.core._exceptions._UFuncNoLoopError: ufunc 'multiply' did not contain a loop with signature matching types (dtype('<U21'), dtype('<U21')) -> None