Skip to content

Commit

Permalink
variance_stokes_linear() does not default through zero anymore.
Browse files Browse the repository at this point in the history
  • Loading branch information
bdestombe committed Aug 4, 2023
1 parent dd6d21c commit ab12189
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Changed
* Standardized parameter names. Reduced the freedom in choosing parameter names and dimension names in favor of simplifying the code.
* Requiring netcdf4 >= 1.6.4
* Optional dependencies of xarray that improve performance are now required by default.
* variance_stokes_linear() does not default through zero anymore.
* Flox included in requirements to speed up resampling via xarray ([Xarray #5734](https://github.com/pydata/xarray/pull/5734)).

Removed
Expand Down
7 changes: 5 additions & 2 deletions src/dtscalibration/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,7 @@ def variance_stokes_exponential(
return var_I, resid_da

def variance_stokes_linear(
self, st_label, sections=None, nbin=50, through_zero=True, plot_fit=False
self, st_label, sections=None, nbin=50, through_zero=False, plot_fit=False
):
"""
Approximate the variance of the noise in Stokes intensity measurements
Expand Down Expand Up @@ -1457,6 +1457,7 @@ def variance_stokes_linear(
# VAR(Stokes) = slope * Stokes
offset = 0.0
slope = np.linalg.lstsq(st_sort_mean[:, None], st_sort_var, rcond=None)[0]

else:
# VAR(Stokes) = slope * Stokes + offset
slope, offset = np.linalg.lstsq(
Expand All @@ -1472,7 +1473,9 @@ def variance_stokes_linear(
f"not possible. Most likely, your {st_label} do "
f"not vary enough to fit a linear curve. Either "
f"use `through_zero` option or use "
f"`ds.variance_stokes_constant()`"
f"`ds.variance_stokes_constant()`. Another reason "
f"could be that your sections are defined to be "
f"wider than they actually are."
)

def var_fun(stokes):
Expand Down

0 comments on commit ab12189

Please sign in to comment.