neurostuff / PyMARE

PyMARE: Python Meta-Analysis & Regression Engine
https://pymare.readthedocs.io
MIT License
50 stars 11 forks source link

Use 1D array in `scipy.optimize.minimize` #111

Closed JulioAPeraza closed 2 years ago

JulioAPeraza commented 2 years ago

Closes #109.

In the latest scipy release, the use of minimize with x0.ndim != 1 is being deprecated.

Currently, the output of ub_start = 2 * DerSimonianLaird().fit(y, v, X).params_["tau2"] is already a 1D array so the use of minimize with [ub_start] gives x0.ndim = 2, which then gets converted to an array of dimension 0 by np.squeeze(x0), resulting in an error here: https://github.com/scipy/scipy/blob/903bc39809af20a1447ed702e84592397c3de509/scipy/optimize/_minimize.py#L947

Changes proposed in this pull request:

codecov-commenter commented 2 years ago

Codecov Report

Merging #111 (d2a999b) into master (19af399) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #111   +/-   ##
=======================================
  Coverage   87.88%   87.88%           
=======================================
  Files          13       13           
  Lines         883      883           
=======================================
  Hits          776      776           
  Misses        107      107           
Impacted Files Coverage Δ
pymare/stats.py 67.21% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

tsalo commented 2 years ago

It's working! Thanks!