id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type 1215946244,PR_kwDOAMm_X842zRtP,6515,Add allow_failures flag to Dataset.curve_fit,11289391,closed,0,,,4,2022-04-26T13:17:18Z,2023-06-16T03:15:09Z,2023-06-16T03:15:09Z,CONTRIBUTOR,,0,pydata/xarray/pulls/6515,"- [x] Closes #6317 - [ ] Tests added - [x] User visible changes (including notable bug fixes) are documented in `whats-new.rst` For some reason, my grepping doesn't seem to show any existing tests for `curve_fit`...?","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/6515/reactions"", ""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 1}",,,13221727,pull 1157140667,I_kwDOAMm_X85E-JC7,6317,Handle scipy fitting errors in `xarray.curve_fit`,11289391,closed,0,,,2,2022-03-02T12:38:04Z,2023-06-16T03:15:08Z,2023-06-16T03:15:08Z,CONTRIBUTOR,,,,"### Is your feature request related to a problem? I'm trying to fit a bunch of exponential decays to a dataset of dimensions `(Time, experimental_index)`, along the `Time` dimension. This works nicely... except in some cases, `scipy.optimize` raises an error such as `RuntimeError: Optimal parameters not found: The maximum number of function evaluations is exceeded.`. That's, of course, reasonable, except in my use case I'm fine with a bunch of `experimental_index` failing to fit, and I'd still like to access the fits that made it through. ### Describe the solution you'd like I'm proposing adding a flag for `xarray.curvefit`, for example `allow_failures: bool = False`, that would take this part: https://github.com/pydata/xarray/blob/f9037c41e36254bfe7efa9feaedd3eae5512bd11/xarray/core/dataset.py#L7738-L7752 and, if active, wrap `popt, pcov = curve_fit(func, x, y, **kwargs)` in a `try/except` block that would output `nan` just as the `not len(y)` conditional clause does if `scipy.optimize.curve_fit` fails with a `RuntimeError`. ### Describe alternatives you've considered At the moment, I sidestep the issue like this: ```python fits = [] for experimental_index in timetraces.experimental_index: trace = traces.sel(experimental_index=experimental_index) try: fit = trace.curvefit( ""Time"", fitfunc, p0=(...), bounds={...}, ) except (RuntimeError, TypeError) as e: logger.debug(...) continue fits.append(fit) fits = xarray.concat(fits, dim=""experimental_index"", coords=""all"") ``` but that seems like a pretty ugly hack... ### Additional context I would of course be happy to implement this!","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/6317/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 1092546388,PR_kwDOAMm_X84weBgE,6132,"Check for just `...`, rather than `[...]` in `da.stack`",11289391,closed,0,,,3,2022-01-03T14:13:28Z,2022-01-04T04:57:12Z,2022-01-03T23:05:23Z,CONTRIBUTOR,,0,pydata/xarray/pulls/6132,"- [x] Closes #6051 - [x] Tests added - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - not quite just yet, as I'm not 100% sure in what category you'd put it! `_stack_once` seemed like a reasonable place to put this check, just going from the trace of where the test failed. I also saw mypy failures during the local pre-commit step, but chose to ignore them for now given #6024. They seemed to pop up in unrelated areas, anyway.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/6132/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull