From c404e26466bfc852a1de19d7f8ec376a5c401655 Mon Sep 17 00:00:00 2001 From: markvrma Date: Wed, 16 Feb 2022 18:17:07 +0400 Subject: [PATCH 1/3] deleted tracetab.py and the test --- pymc/tests/test_tracetab.py | 44 ------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 pymc/tests/test_tracetab.py diff --git a/pymc/tests/test_tracetab.py b/pymc/tests/test_tracetab.py deleted file mode 100644 index 41a13f8473..0000000000 --- a/pymc/tests/test_tracetab.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2020 The PyMC Developers -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from pymc.backends import tracetab as ttab - - -def test_create_flat_names_0d(): - shape = () - result = ttab.create_flat_names("x", shape) - expected = ["x"] - assert result == expected - assert ttab._create_shape(result) == shape - - -def test_create_flat_names_1d(): - shape = (2,) - result = ttab.create_flat_names("x", shape) - expected = ["x__0", "x__1"] - assert result == expected - assert ttab._create_shape(result) == shape - - -def test_create_flat_names_2d(): - shape = 2, 3 - result = ttab.create_flat_names("x", shape) - expected = ["x__0_0", "x__0_1", "x__0_2", "x__1_0", "x__1_1", "x__1_2"] - assert result == expected - assert ttab._create_shape(result) == shape - - -def test_create_flat_names_3d(): - shape = 2, 3, 4 - assert ttab._create_shape(ttab.create_flat_names("x", shape)) == shape From 293d721dd2f8e78e05d8f38204cf9766db266be9 Mon Sep 17 00:00:00 2001 From: markvrma Date: Wed, 16 Feb 2022 18:22:53 +0400 Subject: [PATCH 2/3] deleted tracetab.py and the test --- pymc/backends/tracetab.py | 46 --------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 pymc/backends/tracetab.py diff --git a/pymc/backends/tracetab.py b/pymc/backends/tracetab.py deleted file mode 100644 index 80436c3de9..0000000000 --- a/pymc/backends/tracetab.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2020 The PyMC Developers -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Functions for converting traces into a table-like format -""" - - -import numpy as np - - -def create_flat_names(varname, shape): - """Return flat variable names for `varname` of `shape`. - - Examples - -------- - >>> create_flat_names('x', (5,)) - ['x__0', 'x__1', 'x__2', 'x__3', 'x__4'] - - >>> create_flat_names('x', (2, 2)) - ['x__0_0', 'x__0_1', 'x__1_0', 'x__1_1'] - """ - if not shape: - return [varname] - labels = (np.ravel(xs).tolist() for xs in np.indices(shape)) - labels = (map(str, xs) for xs in labels) - return ["{}__{}".format(varname, "_".join(idxs)) for idxs in zip(*labels)] - - -def _create_shape(flat_names): - """Determine shape from `create_flat_names` output.""" - try: - _, shape_str = flat_names[-1].rsplit("__", 1) - except ValueError: - return () - return tuple(int(i) + 1 for i in shape_str.split("_")) From 924fcb564dade74b0c6ca64feb16ebb08d063229 Mon Sep 17 00:00:00 2001 From: markvrma Date: Wed, 16 Feb 2022 23:44:56 +0400 Subject: [PATCH 3/3] removed pymc.backends.tracetabs from _init_.py --- pymc/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pymc/__init__.py b/pymc/__init__.py index 624e12d31f..1cb3c6797f 100644 --- a/pymc/__init__.py +++ b/pymc/__init__.py @@ -52,7 +52,6 @@ def __set_compiler_flags(): from pymc import gp, ode, sampling from pymc.aesaraf import * from pymc.backends import * -from pymc.backends.tracetab import * from pymc.bart import * from pymc.blocking import * from pymc.data import *