Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor datastore #202

Merged
merged 22 commits into from
Oct 16, 2023
Merged
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions src/dtscalibration/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ def sections(self):
def sections(self):
self.attrs["_sections"] = yaml.dump(None)

@sections.setter
def sections(self, value):
msg = "Not possible anymore. Instead, pass the sections as an argument to \n" \
"ds.dts.calibrate_single_ended() or ds.dts.calibrate_double_ended()."
bdestombe marked this conversation as resolved.
Show resolved Hide resolved
raise NotImplementedError(msg)
bdestombe marked this conversation as resolved.
Show resolved Hide resolved

def check_reference_section_values(self):
"""
Checks if the values of the used sections are of the right datatype
Expand Down Expand Up @@ -870,9 +876,6 @@ def variance_stokes_constant(self, st_label, sections=None, reshape_residuals=Tr
dtscalibration/python-dts-calibration/blob/main/examples/notebooks/\
04Calculate_variance_Stokes.ipynb>`_
"""

# var_I, resid = variance_stokes_constant_util(st_label, sections=None, reshape_residuals=True)
# def variance_stokes_constant_util(st_label, sections=None, reshape_residuals=True):
def func_fit(p, xs):
return p[:xs, None] * p[None, xs:]

Expand Down Expand Up @@ -1014,7 +1017,12 @@ def variance_stokes_exponential(

Parameters
----------
reshape_residuals
suppress_info : bool, optional
Suppress print statements.
use_statsmodels : bool, optional
Use statsmodels to fit the exponential. If `False`, use scipy.
reshape_residuals : bool, optional
Reshape the residuals to the shape of the Stokes intensity
st_label : str
label of the Stokes, anti-Stokes measurement.
E.g., st, ast, rst, rast
Expand Down Expand Up @@ -1700,6 +1708,9 @@ def calibration_single_ended(
variance of the estimate of dalpha.
Covariances between alpha and other parameters are not accounted
for.
fix_alpha : Tuple[array-like, array-like], optional
A tuple containing two array-likes. The first array-like is the integrated
differential attenuation of length x, and the second item is its variance.

Returns
-------
Expand Down Expand Up @@ -3029,7 +3040,7 @@ def create_da_ta2(no, i_splice, direction="fw", chunks=None):
arr = da.concatenate(
(
da.zeros(
(1, i_splice, 1), chunks=((1, i_splice, 1)), dtype=bool
(1, i_splice, 1), chunks=(1, i_splice, 1), dtype=bool
),
da.ones(
(1, no - i_splice, 1),
Expand All @@ -3045,7 +3056,7 @@ def create_da_ta2(no, i_splice, direction="fw", chunks=None):
da.ones((1, i_splice, 1), chunks=(1, i_splice, 1), dtype=bool),
da.zeros(
(1, no - i_splice, 1),
chunks=((1, no - i_splice, 1)),
chunks=(1, no - i_splice, 1),
dtype=bool,
),
),
Expand Down Expand Up @@ -3826,7 +3837,7 @@ def create_da_ta2(no, i_splice, direction="fw", chunks=None):
arr = da.concatenate(
(
da.zeros(
(1, i_splice, 1), chunks=((1, i_splice, 1)), dtype=bool
(1, i_splice, 1), chunks=(1, i_splice, 1), dtype=bool
),
da.ones(
(1, no - i_splice, 1),
Expand All @@ -3842,7 +3853,7 @@ def create_da_ta2(no, i_splice, direction="fw", chunks=None):
da.ones((1, i_splice, 1), chunks=(1, i_splice, 1), dtype=bool),
da.zeros(
(1, no - i_splice, 1),
chunks=((1, no - i_splice, 1)),
chunks=(1, no - i_splice, 1),
dtype=bool,
),
),
Expand Down
Loading