Skip to content

Commit

Permalink
Merge pull request #52 from t20100/last-stuff
Browse files Browse the repository at this point in the history
Change gif to png to avoid pdf export issue
  • Loading branch information
t20100 authored Nov 29, 2019
2 parents b5d0f06 + c522d20 commit f0a7002
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 67 deletions.
Binary file removed python/io/images/h5py.gif
Binary file not shown.
Binary file added python/io/images/h5py.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 15 additions & 67 deletions python/io/io_hdf5.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"source": [
"# h5py\n",
"\n",
"![h5py book](images/h5py.gif \"h5py book\")\n",
"![h5py book](images/h5py.png \"h5py book\")\n",
"\n",
"[h5py](https://www.h5py.org/) is the python binding for accessing hdf5. Originally from [Andrew Collette](http://shop.oreilly.com/product/0636920030249.do)"
]
Expand Down Expand Up @@ -182,21 +182,13 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"metadata": {
"slideshow": {
"slide_type": "-"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"First children: <KeysViewHDF5 ['diff_map_0000', 'diff_map_0001', 'diff_map_0002', 'diff_map_0003', 'diff_map_0004']>\n"
]
}
],
"outputs": [],
"source": [
"import h5py\n",
"\n",
Expand All @@ -208,24 +200,13 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": null,
"metadata": {
"slideshow": {
"slide_type": "-"
}
},
"outputs": [
{
"data": {
"text/plain": [
"<HDF5 dataset \"map\": shape (29, 78, 100), type \"<f4\">"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# Get a dataset from a sub group\n",
"dataset = h5file['/diff_map_0004/data/map']\n",
Expand Down Expand Up @@ -281,7 +262,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -292,40 +273,23 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dataset: (29, 78, 100) 226200 float32\n"
]
}
],
"outputs": [],
"source": [
"# Here we only read metadata from the dataset\n",
"print(\"Dataset:\", dataset.shape, dataset.size, dataset.dtype)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {
"slideshow": {
"slide_type": "-"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[104.14766 103.352615 103.01642 103.24001 103.27751 ]\n",
"[205.95827 206.2795 206.5441 206.48112 206.46625]\n"
]
}
],
"outputs": [],
"source": [
"# Read and apply an operation\n",
"print(dataset[5, 5, 0:5])\n",
Expand All @@ -334,22 +298,13 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {
"slideshow": {
"slide_type": "-"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[103.45841 103.19393 103.12445 103.15601 103.203285]\n",
"[0. 0. 0. 0. 0.]\n"
]
}
],
"outputs": [],
"source": [
"# copy the data and store it as a numpy-array\n",
"# if no copy is done, once the file is close the data will not be accessible anymore\n",
Expand All @@ -361,7 +316,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -385,7 +340,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -454,7 +409,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -723,13 +678,6 @@
" an example on how to store tomography raw data\n",
" an example to store tomoraphy application (3D reconstruction)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit f0a7002

Please sign in to comment.