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

[wip] Deprecate various parameter related functions from dataset #3960

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions qcodes/dataset/data_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ def captured_counter(self) -> int:
return captured_counter

@property
@deprecate(alternative="dataset.rundescriber.parameters")
def _parameters(self) -> Optional[str]:
if self.pristine:
psnames = [ps.name for ps in self.description.interdeps.paramspecs]
Expand All @@ -431,10 +432,12 @@ def _parameters(self) -> Optional[str]:
return parameters

@property
@deprecate(alternative="dataset.rundescriber.parameters")
def parameters(self) -> Optional[str]:
return self._parameters

@property
@deprecate(alternative="dataset.rundescriber.parameters")
def paramspecs(self) -> Dict[str, ParamSpec]:
return {ps.name: ps
for ps in self.get_parameters()}
Expand Down
4 changes: 4 additions & 0 deletions qcodes/dataset/data_set_in_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
update_parent_datasets,
update_run_description,
)
from qcodes.utils.deprecate import deprecate
from qcodes.utils.helpers import NumpyJSONEncoder

from .data_set_cache import DataSetCacheInMem
Expand Down Expand Up @@ -592,6 +593,7 @@ def metadata(self) -> Dict[str, Any]:
return self._metadata

@property
@deprecate(alternative="dataset.rundescriber.parameters")
def paramspecs(self) -> Dict[str, ParamSpec]:
return {ps.name: ps for ps in self._get_paramspecs()}

Expand Down Expand Up @@ -721,6 +723,7 @@ def _set_interdependencies(
raise RuntimeError(mssg)
self._rundescriber = RunDescriber(interdeps, shapes=shapes)

@deprecate(alternative="dataset.rundescriber.parameters")
def _get_paramspecs(self) -> SPECS:
old_interdeps = new_to_old(self.description.interdeps)
return list(old_interdeps.paramspecs)
Expand Down Expand Up @@ -799,6 +802,7 @@ def __repr__(self) -> str:
return "\n".join(out)

@property
@deprecate(alternative="dataset.rundescriber.parameters")
def _parameters(self) -> Optional[str]:
psnames = [ps.name for ps in self.description.interdeps.paramspecs]
if len(psnames) > 0:
Expand Down
3 changes: 3 additions & 0 deletions qcodes/dataset/data_set_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
get_data_export_type,
)
from qcodes.dataset.linked_datasets.links import Link
from qcodes.utils.deprecate import deprecate

from .descriptions.versioning.converters import new_to_old
from .exporters.export_info import ExportInfo
Expand Down Expand Up @@ -326,6 +327,7 @@ def the_same_dataset_as(self, other: DataSetProtocol) -> bool:

return True

@deprecate(alternative="dataset.rundescriber.parameters")
def get_parameters(self) -> SPECS:
old_interdeps = new_to_old(self.description.interdeps)
return list(old_interdeps.paramspecs)
Expand Down Expand Up @@ -524,6 +526,7 @@ def completed_timestamp(self, fmt: str = "%Y-%m-%d %H:%M:%S") -> Optional[str]:
return raw_time_to_str_time(self.completed_timestamp_raw, fmt)

@property
@deprecate(alternative="dataset.rundescriber.parameters")
def dependent_parameters(self) -> Tuple[ParamSpecBase, ...]:
"""
Return all the parameters that explicitly depend on other parameters
Expand Down
6 changes: 3 additions & 3 deletions qcodes/utils/deprecate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import warnings
import types
import warnings
from contextlib import contextmanager
from typing import Optional, Callable, Any, cast, Iterator, List
from typing import Any, Callable, Iterator, List, Optional, cast

import wrapt

Expand All @@ -28,7 +28,7 @@ def issue_deprecation_warning(
what: str,
reason: Optional[str] = None,
alternative: Optional[str] = None,
stacklevel: int = 2
stacklevel: int = 3,
) -> None:
warnings.warn(
deprecation_message(what, reason, alternative),
Expand Down