Commit 16b420b1 authored by eric pellegrini's avatar eric pellegrini
Browse files

updated CHANGELOG

added informations to the README
cleaned up the output cells of the demo notebook
parent fc8d8415
version 0.2.0
--------------
* FIXED typos due to files and classes renamings
* CHANGED reorganized the files
* CHANGED reorganized renamed some classes
* CHANGED added informations in the README
version 0.1.0 version 0.1.0
-------------- --------------
* ADDED initial contents * ADDED initial contents
......
Overview
========
**hdfviewer** is a python3 package for inspecting HDF files in the context of **Jupyter Lab** notebook.
It represents each group found in the HDF file as an accordion made of the following subitems:
- **attributes**: contains the HDF attributes of this group
- **groups**: contains the HDF subgroups of this group
- **datasets**: contains the HDF datasets of this group
If one of these subitems is empty (e.g. no attributes defined for a given group) the corresponding subitem is omitted.
When one reaches a HDF dataset, informations about the dataset are collected (dimensionality, numeric type, attributes ...) and displayed in a Jupyter output widget. In case of 1D, 2D or 3D dataset, a view of the dataset is also displayed. Depending on the dimensionality of the dataset the display will consist in:
- **1D**: simple MatPlotLib 1D plot
- **2D**: matrix view of the dataset
- **3D**: matrix view of the dataset
In case of **2D** and **3D** datasets, the matrix view is made of a 2D image of the selected frame of the dataset (always `0` for 2D datasets) with a 1D column-projection view of the dataset on its top and a 1D row-projection view of the dataset on its right. The matrix view is interactive with the following interactions:
- **2D**:
- toggle between cross and integration 1D potting mode. In cross plot mode, the 1D projection views represents resp. the row and column of the matrix image point left-clicked by the user. In integration plot mode, the 1D projection views represents the sum over resp. the row and column of the image. To switch between those two modes, press the **i** key.
- **3D**:
- toggle between cross and integration 1D potting mode. See above.
- go to the last frame by pressing the **pgdn** key.
- go to the first frame by pressing the **pgup** key.
- go to the next frame by pressing the **down** or the **right** keys or wheeling **down** the mouse wheel
- go to the previous frame by pressing the **up** or the **left** keys or wheeling **up** the mouse down
- go the +n (n can be > 9) frame by pressing *n* number followed by the **down** or the **right** keys
- go the -n (n can be > 9) frame by pressing *n* number followed by the **up** or the **left** keys
Installation
=============
- `cd` to the directory where lies the `setup.py` file
- `python3 setup build`
- `python3 setup install`
Usage in a notebook
===================
`%matplotlib ipympl`
`import h5py`
`from hdfviewer.widgets.HDFViewer import HDFViewer`
`from hdfviewer.widgets.PathSelector import PathSelector`
`path = PathSelector(extensions=[".hdf",".h5",".nxs"])`
`path.widget`
`if path.file:`
  `hdf5 = h5py.File(path.file,"r")`
  ` display(HDFViewer(hdf5))`
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib ipympl"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"ename": "ImportError",
"evalue": "No module named 'hdfviewer.HDFViewer'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-2-4e5ea23e6fd6>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mh5py\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mhdfviewer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mHDFViewer\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mHDFViewer\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mhdfviewer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPathSelector\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mPathSelector\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mImportError\u001b[0m: No module named 'hdfviewer.HDFViewer'"
]
}
],
"source": [
"import h5py\n",
"\n",
"from hdfviewer.widgets.HDFViewer import HDFViewer\n",
"from hdfviewer.widgets.PathSelector import PathSelector"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'PathSelector' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-3-21cbad8e706b>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mpath\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mPathSelector\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mextensions\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\".hdf\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\".h5\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\".nxs\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwidget\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mNameError\u001b[0m: name 'PathSelector' is not defined"
]
}
],
"source": [
"path = PathSelector(extensions=[\".hdf\",\".h5\",\".nxs\"])\n",
"path.widget"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
...@@ -11,54 +11,19 @@ ...@@ -11,54 +11,19 @@
from hdfviewer.widgets.HDFViewer import HDFViewer from hdfviewer.widgets.HDFViewer import HDFViewer
from hdfviewer.widgets.PathSelector import PathSelector from hdfviewer.widgets.PathSelector import PathSelector
``` ```
%%%% Output: error
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-4e5ea23e6fd6> in <module>()
1 import h5py
2
----> 3 from hdfviewer.HDFViewer import HDFViewer
4 from hdfviewer.PathSelector import PathSelector
ImportError: No module named 'hdfviewer.HDFViewer'
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
path = PathSelector(extensions=[".hdf",".h5",".nxs"]) path = PathSelector(extensions=[".hdf",".h5",".nxs"])
path.widget path.widget
``` ```
%%%% Output: error
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-3-21cbad8e706b> in <module>()
----> 1 path = PathSelector(extensions=[".hdf",".h5",".nxs"])
2 path.widget
NameError: name 'PathSelector' is not defined
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
if path.file: if path.file:
hdf5 = h5py.File(path.file,"r") hdf5 = h5py.File(path.file,"r")
display(HDFViewer(hdf5)) display(HDFViewer(hdf5))
``` ```
%%%% Output: display_data
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
```
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment