Skip to content

Commit

Permalink
[compression] improve/fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gipert committed Nov 9, 2023
1 parent 6180c77 commit f849e71
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
24 changes: 24 additions & 0 deletions docs/source/notebooks/DataCompression.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,30 @@
"decode(obj.values)"
]
},
{
"cell_type": "markdown",
"id": "89deabde",
"metadata": {},
"source": [
"Waveform compression settings can also be specified at the LGDO level by attaching a `compression` attribute to the `values` attribute of a `WaveformTable` object:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "24e8f49f",
"metadata": {},
"outputs": [],
"source": [
"from lgdo.compression import ULEB128ZigZagDiff\n",
"\n",
"wfs.values.attrs[\"compression\"] = ULEB128ZigZagDiff()\n",
"store.write_object(wfs, \"waveforms\", \"data.lh5\", wo_mode=\"of\")\n",
"\n",
"obj, _ = store.read_object(\"waveforms\", \"data.lh5\", decompress=False)\n",
"obj.values.attrs[\"codec\"]"
]
},
{
"cell_type": "markdown",
"id": "3999f30d",
Expand Down
7 changes: 4 additions & 3 deletions src/lgdo/lh5_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,9 +796,10 @@ def write_object(
passed directly to :meth:`h5py.Group.create_dataset`.
:class:`.WaveformCodec` object
If `obj` is a :class:`.WaveformTable`, compress its `values` using
this algorithm. More documentation about the supported waveform
compression algorithms at :mod:`.lgdo.compression`.
If `obj` is a :class:`.WaveformTable` and ``obj.values`` holds the
attribute, compress ``values`` using this algorithm. More
documentation about the supported waveform compression algorithms at
:mod:`.lgdo.compression`.
If the `obj` :class:`.LGDO` has a `hdf5_settings` attribute holding a
dictionary, it is interpreted as a list of keyword arguments to be
Expand Down

0 comments on commit f849e71

Please sign in to comment.