From 68e0d46be59c514768237b5ae6efcafa6de8b748 Mon Sep 17 00:00:00 2001 From: Bas des Tombe Date: Mon, 16 Oct 2023 15:33:09 +0200 Subject: [PATCH] Undo certain merge changes --- src/dtscalibration/calibrate_utils.py | 20 +++++++++++--------- tests/test_examples.py | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/dtscalibration/calibrate_utils.py b/src/dtscalibration/calibrate_utils.py index ddf68f38..e0590d7c 100644 --- a/src/dtscalibration/calibrate_utils.py +++ b/src/dtscalibration/calibrate_utils.py @@ -242,7 +242,7 @@ def calibration_single_ended_solver( # noqa: MC0001 """ # get ix_sec argsort so the sections are in order of increasing x - ix_sec = ds.ufunc_per_section(x_indices=True, calc_per="all") + ix_sec = ds.dts.ufunc_per_section(sections=sections, x_indices=True, calc_per="all") ds_sec = ds.isel(x=ix_sec) x_sec = ds_sec["x"].values @@ -261,8 +261,8 @@ def calibration_single_ended_solver( # noqa: MC0001 p0_est_alpha = np.asarray([485.0] + no * [0.0] + nt * [1.4] + nta * nt * [0.0]) # X \gamma # Eq.34 - cal_ref = ds.ufunc_per_section( - label="st", ref_temp_broadcasted=True, calc_per="all" + cal_ref = ds.dts.ufunc_per_section( + sections=sections, label="st", ref_temp_broadcasted=True, calc_per="all" ) # cal_ref = cal_ref # sort by increasing x data_gamma = 1 / (cal_ref.T.ravel() + 273.15) # gamma @@ -1195,7 +1195,7 @@ def calibration_double_ended_solver( # noqa: MC0001 ------- """ - ix_sec = ds.ufunc_per_section(x_indices=True, calc_per="all") + ix_sec = ds.dts.ufunc_per_section(sections=sections, x_indices=True, calc_per="all") ds_sec = ds.isel(x=ix_sec) ix_alpha_is_zero = ix_sec[0] # per definition of E @@ -1224,7 +1224,7 @@ def calibration_double_ended_solver( # noqa: MC0001 Zero_d, Z_TA_fw, Z_TA_bw, - ) = construct_submatrices(nt, nx_sec, ds, ds.trans_att.values, x_sec) + ) = construct_submatrices(sections, nt, nx_sec, ds, trans_att, x_sec) # y # Eq.41--45 y_F = np.log(ds_sec.st / ds_sec.ast).values.ravel() @@ -1859,7 +1859,9 @@ def construct_submatrices(sections, nt, nx, ds, trans_att, x_sec): # Z \gamma # Eq.47 cal_ref = np.array( - ds.ufunc_per_section(label="st", ref_temp_broadcasted=True, calc_per="all") + ds.dts.ufunc_per_section( + sections=sections, label="st", ref_temp_broadcasted=True, calc_per="all" + ) ) data_gamma = 1 / (cal_ref.ravel() + 273.15) # gamma coord_gamma_row = np.arange(nt * nx, dtype=int) @@ -2240,10 +2242,10 @@ def calc_df_db_double_est(ds, sections, ix_alpha_is_zero, gamma_est): Ibwx0 = np.log( ds.rst.isel(x=ix_alpha_is_zero) / ds.rast.isel(x=ix_alpha_is_zero) ).values - ref_temps_refs = ds.ufunc_per_section( - label="st", ref_temp_broadcasted=True, calc_per="all" + ref_temps_refs = ds.dts.ufunc_per_section( + sections=sections, label="st", ref_temp_broadcasted=True, calc_per="all" ) - ix_sec = ds.ufunc_per_section(x_indices=True, calc_per="all") + ix_sec = ds.dts.ufunc_per_section(sections=sections, x_indices=True, calc_per="all") ref_temps_x0 = ( ref_temps_refs[ix_sec == ix_alpha_is_zero].flatten().compute() + 273.15 ) diff --git a/tests/test_examples.py b/tests/test_examples.py index 0695492e..e2a8793c 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -64,7 +64,7 @@ def _notebook_run(path): def test_ipynb(): file_ext = "*.ipynb" wd = os.path.dirname(os.path.abspath(__file__)) - nb_dir = os.path.join(wd, "..", "examples", "notebooks", file_ext) + nb_dir = os.path.join(wd, "..", "docs", "notebooks", file_ext) filepathlist = glob.glob(nb_dir) for fp in filepathlist: