Skip to content

Commit

Permalink
Eliminated all references to key_dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Oct 5, 2017
1 parent 1026074 commit 75a0bac
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 28 deletions.
4 changes: 2 additions & 2 deletions doc/Tutorials/Columnar_Data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@
"outputs": [],
"source": [
"obs_hmap = hv.HoloMap({i: hv.Image(np.random.randn(10, 10), bounds=(0,0,3,3))\n",
" for i in range(3)}, key_dimensions=['Observation'])\n",
" for i in range(3)}, kdims=['Observation'])\n",
"obs_hmap"
]
},
Expand Down Expand Up @@ -415,7 +415,7 @@
"extents = (0,0,3,3)\n",
"error_hmap = hv.HoloMap({(i, j): hv.Image(j*np.random.randn(3, 3), bounds=extents)\n",
" for i, j in product(range(3), np.linspace(0, 1, 3))},\n",
" key_dimensions=['Observation', 'noise'])\n",
" kdims=['Observation', 'noise'])\n",
"noise_layout = error_hmap.layout('noise')\n",
"noise_layout"
]
Expand Down
4 changes: 2 additions & 2 deletions doc/Tutorials/Sampling_Data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@
"outputs": [],
"source": [
"obs_hmap = hv.HoloMap({i: hv.Image(np.random.randn(10, 10), bounds=extents)\n",
" for i in range(3)}, key_dimensions=['Observation'])"
" for i in range(3)}, kdims=['Observation'])"
]
},
{
Expand Down Expand Up @@ -384,7 +384,7 @@
"extents = (0, 0, 2, 10)\n",
"curve = hv.HoloMap({(i) : hv.Curve(zip(xs, np.sin(xs)*i))\n",
" for i in np.linspace(0.5, 1.5, 3)},\n",
" key_dimensions=['Observation'])\n",
" kdims=['Observation'])\n",
"all_samples = curve.table().to.points()\n",
"sampled = curve.sample([0, 2, 4, 6, 8])\n",
"sampling = all_samples * sampled.to.points(extents=extents).opts(style=dict(color='r'))\n",
Expand Down
12 changes: 6 additions & 6 deletions examples/topics/simulation/sri_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@
" raise Exception(\"Enable visualize option to get compute network visulizations.\")\n",
"\n",
" # Declare HoloMap for network animation and counts array\n",
" network_hmap = hv.HoloMap(key_dimensions=['Time'])\n",
" network_hmap = hv.HoloMap(kdims=['Time'])\n",
" sird = np.zeros((steps, 5))\n",
" \n",
" # Declare dimensions and labels\n",
Expand All @@ -247,10 +247,10 @@
" \n",
" path_data = [list(el[()]) for el in paths]\n",
" # Create network path and node Elements\n",
" network_paths = hv.Path(path_data, key_dimensions=spatial_dims)\n",
" network_paths = hv.Path(path_data, kdims=spatial_dims)\n",
" network_nodes = hv.Points(np.hstack([points, state_array]),\n",
" key_dimensions=spatial_dims,\n",
" value_dimensions=['State'])\n",
" kdims=spatial_dims,\n",
" vdims=['State'])\n",
" \n",
" # Create overlay and accumulate in network HoloMap\n",
" network_hmap[i] = (network_paths * network_nodes * nlabel).relabel(group='Network', label='SRI')\n",
Expand All @@ -265,7 +265,7 @@
" \n",
" # Animate VLine on top of Curves\n",
" distribution = hv.HoloMap({i: (curves * hv.VLine(i)).relabel(group='Counts', label='SRI')\n",
" for i in range(steps)}, key_dimensions=['Time'])\n",
" for i in range(steps)}, kdims=['Time'])\n",
" \n",
" return network_hmap + distribution"
]
Expand Down Expand Up @@ -536,7 +536,7 @@
"outputs": [],
"source": [
"exp2_dims = ['Connections', 'pVaccinated']\n",
"hmap = hv.HoloMap(key_dimensions=exp2_dims)\n",
"hmap = hv.HoloMap(kdims=exp2_dims)\n",
"vacc_rates = np.linspace(0, 1, 21)\n",
"mean_conns = [2**i for i in range(7)]\n",
"for v, c in itertools.product(vacc_rates, mean_conns):\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/user_guide/07-Tabular_Datasets.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@
"outputs": [],
"source": [
"obs_hmap = hv.HoloMap({i: hv.Image(np.random.randn(10, 10), bounds=(0,0,3,3))\n",
" for i in range(3)}, key_dimensions=['Observation'])\n",
" for i in range(3)}, kdims=['Observation'])\n",
"obs_hmap"
]
},
Expand Down Expand Up @@ -424,7 +424,7 @@
"extents = (0,0,3,3)\n",
"error_hmap = hv.HoloMap({(i, j): hv.Image(j*np.random.randn(3, 3), bounds=extents)\n",
" for i, j in product(range(3), np.linspace(0, 1, 3))},\n",
" key_dimensions=['Observation', 'noise'])\n",
" kdims=['Observation', 'noise'])\n",
"noise_layout = error_hmap.layout('noise')\n",
"noise_layout"
]
Expand Down
4 changes: 2 additions & 2 deletions examples/user_guide/09-Indexing_and_Selecting_Data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@
"outputs": [],
"source": [
"obs_hmap = hv.HoloMap({i: hv.Image(np.random.randn(10, 10), bounds=extents)\n",
" for i in range(3)}, key_dimensions=['Observation'])"
" for i in range(3)}, kdims=['Observation'])"
]
},
{
Expand Down Expand Up @@ -490,7 +490,7 @@
"extents = (0, 0, 2, 10)\n",
"curve = hv.HoloMap({(i) : hv.Curve(zip(xs, np.sin(xs)*i))\n",
" for i in np.linspace(0.5, 1.5, 3)},\n",
" key_dimensions=['Observation'])\n",
" kdims=['Observation'])\n",
"all_samples = curve.table().to.points()\n",
"sampled = curve.sample([0, 2, 4, 6, 8])\n",
"sampling = all_samples * sampled.to.points(extents=extents).opts(style=dict(color='r'))\n",
Expand Down
14 changes: 0 additions & 14 deletions holoviews/core/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,20 +381,6 @@ def __init__(self, items=None, identifier=None, parent=None, **kwargs):
Dimensioned.__init__(self, self.data, **params)


@classmethod
def collate(cls, data, kdims=None, key_dimensions=None):
kdims = key_dimensions if (kdims is None) else kdims
if kdims is None:
raise Exception("Please specify the key dimensions.")

collate_deprecation.warning("Layout.collate will be deprecated after version 1.3.0."
"\nUse HoloMap.collate instead (see HoloViews homepage for example usage)")
from .element import Collator
layouts = {k:(v if isinstance(v, Layout) else Layout.from_values([v]))
for k,v in data.items()}
return Collator(layouts, kdims=kdims)()


@classmethod
def from_values(cls, vals):
"""
Expand Down

0 comments on commit 75a0bac

Please sign in to comment.