8000 Inputting bounds for model fitting raises guess variable dimensionality error in <curve_fit>/<least_squares> · Issue #216 · fooof-tools/fooof · GitHub
[go: up one dir, main page]

Skip to content

Inputting bounds for model fitting raises guess variable dimensionality error in <curve_fit>/<least_squares> #216

Closed

Description

@tresupan

Hi!

I was having difficulty inputting bounds for the aperiodic fitting. When I would initialize self._ap_bounds with values other than np.inf I would get an error when the spec param _simple_ap_fit function called curve_fit. Inside curve_fit and subsequently least_squares this seems to cause some change in the guess parameters which leads to a ValueError resulting from the guess variable having the wrong dimensions. I think this dimension check only happens when you input restricted bounds. I can get rid of the error by indexing the guess variable that gets passed into curve_fit:

In _simple_ap_fit I add “[0]”:
guess = np.array([off_guess + kne_guess + exp_guess])[0]

Activity

  1. ryanhammonds commented on Oct 15, 2021

    @ryanhammonds
    Contributor

    @tresupan I was getting a similar error as the tau freq approached 0hz. Installing from main rather than pypi fixed this issue. It looks #206 was the fix.

  2. TomDonoghue commented on Apr 19, 2022

    @TomDonoghue
    Member

    Yeh, this issue should be fixed in the main branch! If there are any follow ups / continuing issues, feel free to re-open, but otherwise I am going to close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0