Skip to content

Commit

Permalink
Move to absolute imports
Browse files Browse the repository at this point in the history
  • Loading branch information
BSchilperoort committed Jul 29, 2023
1 parent 38b42c0 commit b4fbf52
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 42 deletions.
36 changes: 18 additions & 18 deletions src/dtscalibration/__init__.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# coding=utf-8
from .datastore import DataStore
from .datastore import open_datastore
from .datastore import open_mf_datastore
from .datastore import read_apsensing_files
from .datastore import read_sensornet_files
from .datastore import read_sensortran_files
from .datastore import read_silixa_files
from .datastore_utils import check_dims
from .datastore_utils import check_timestep_allclose
from .datastore_utils import get_netcdf_encoding
from .datastore_utils import merge_double_ended
from .datastore_utils import shift_double_ended
from .datastore_utils import suggest_cable_shift_double_ended
from .plot import plot_accuracy
from .plot import plot_location_residuals_double_ended
from .plot import plot_residuals_reference_sections
from .plot import plot_residuals_reference_sections_single
from .plot import plot_sigma_report
from dtscalibration.datastore import DataStore
from dtscalibration.datastore import open_datastore
from dtscalibration.datastore import open_mf_datastore
from dtscalibration.datastore import read_apsensing_files
from dtscalibration.datastore import read_sensornet_files
from dtscalibration.datastore import read_sensortran_files
from dtscalibration.datastore import read_silixa_files
from dtscalibration.datastore_utils import check_dims
from dtscalibration.datastore_utils import check_timestep_allclose
from dtscalibration.datastore_utils import get_netcdf_encoding
from dtscalibration.datastore_utils import merge_double_ended
from dtscalibration.datastore_utils import shift_double_ended
from dtscalibration.datastore_utils import suggest_cable_shift_double_ended
from dtscalibration.plot import plot_accuracy
from dtscalibration.plot import plot_location_residuals_double_ended
from dtscalibration.plot import plot_residuals_reference_sections
from dtscalibration.plot import plot_residuals_reference_sections_single
from dtscalibration.plot import plot_sigma_report

__version__ = '2.0.0'
__all__ = [
Expand Down
45 changes: 22 additions & 23 deletions src/dtscalibration/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@
from scipy.optimize import minimize
from scipy.sparse import linalg as ln

from .calibrate_utils import calc_alpha_double
from .calibrate_utils import calibration_double_ended_solver
from .calibrate_utils import calibration_single_ended_solver
from .calibrate_utils import match_sections
from .calibrate_utils import parse_st_var
from .calibrate_utils import wls_sparse
from .calibrate_utils import wls_stats
from .datastore_utils import check_timestep_allclose
from .io import _dim_attrs
from .io import apsensing_xml_version_check
from .io import read_apsensing_files_routine
from .io import read_sensornet_files_routine_v3
from .io import read_sensortran_files_routine
from .io import read_silixa_files_routine_v4
from .io import read_silixa_files_routine_v6
from .io import sensornet_ddf_version_check
from .io import sensortran_binary_version_check
from .io import silixa_xml_version_check
from .io import ziphandle_to_filepathlist
from dtscalibration.calibrate_utils import calc_alpha_double
from dtscalibration.calibrate_utils import calibration_double_ended_solver
from dtscalibration.calibrate_utils import calibration_single_ended_solver
from dtscalibration.calibrate_utils import match_sections
from dtscalibration.calibrate_utils import parse_st_var
from dtscalibration.calibrate_utils import wls_sparse
from dtscalibration.calibrate_utils import wls_stats
from dtscalibration.datastore_utils import check_timestep_allclose
from dtscalibration.io import _dim_attrs
from dtscalibration.io import apsensing_xml_version_check
from dtscalibration.io import read_apsensing_files_routine
from dtscalibration.io import read_sensornet_files_routine_v3
from dtscalibration.io import read_sensortran_files_routine
from dtscalibration.io import read_silixa_files_routine_v4
from dtscalibration.io import read_silixa_files_routine_v6
from dtscalibration.io import sensornet_ddf_version_check
from dtscalibration.io import sensortran_binary_version_check
from dtscalibration.io import silixa_xml_version_check
from dtscalibration.io import ziphandle_to_filepathlist

dtsattr_namelist = ['double_ended_flag']
dim_attrs = {k: v for kl, v in _dim_attrs.items() for k in kl}
Expand All @@ -43,7 +43,6 @@
message='xarray subclass DataStore should explicitly define __slots__')


# pylint: disable=W605
class DataStore(xr.Dataset):
"""The data class that stores the measurements, contains calibration
methods to relate Stokes and anti-Stokes to temperature. The user should
Expand Down Expand Up @@ -289,7 +288,7 @@ def sections(self):
pass

@property
def is_double_ended(self):
def is_double_ended(self) -> float:
"""
Whether or not the data is loaded from a double-ended setup.
Expand All @@ -303,15 +302,15 @@ def is_double_ended(self):
# backward compatible to when only silixa files were supported
return bool(int(self.attrs['customData:isDoubleEnded']))
else:
assert 0
raise ValueError("Could not determine if the data was from a double-ended setup.")

@is_double_ended.setter
def is_double_ended(self, flag: bool):
self.attrs['isDoubleEnded'] = flag
pass

@property
def chfw(self):
def chfw(self) -> float:
"""
Zero based channel index of the forward measurements
Expand Down
2 changes: 1 addition & 1 deletion src/dtscalibration/datastore_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def shift_double_ended(ds, i_shift, verbose=True):
With a shifted x-axis
"""
# pylint: disable=import-outside-toplevel
from . import DataStore
from dtscalibration import DataStore

assert isinstance(i_shift, (int, np.integer))

Expand Down

0 comments on commit b4fbf52

Please sign in to comment.