From 8166782b151440c3f3f4bb3edd9e3c8ac84f49a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20N=C3=B6the?= Date: Thu, 5 Dec 2019 14:00:59 +0100 Subject: [PATCH 1/3] Update readme --- README.rst | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/README.rst b/README.rst index b1e04b8..a9c8173 100644 --- a/README.rst +++ b/README.rst @@ -35,6 +35,22 @@ e.g. : Submodules ---------- +io +~~ + +To store pandas dataframes in column-oriented storage into hdf5 files, +we created some helpfull wrappers around ``pandas`` and ``h5py``: + +.. code:: python + from fact.io import read_h5py, to_h5py + import pandas as pd + + df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}) + to_h5py(df, 'test.hdf5', key='events') + + print(read_h5py('test.hdf5', key='events')) + + plotting ~~~~~~~~ @@ -43,28 +59,15 @@ Utils for plotting data into a FACT camera view. Based on matplotlib. .. code:: python import matplotlib.pyplot as plt - import fact.plotting as factplot + import fact.plotting import camera from numpy.random import normal # create some pseudo data with shape (10, 1440): data = normal(30, 5, (10, 1440)) - factplot.camera(data[0]) + camera(data[0]) plt.show() -Or you can start an interactive Viewer which lets you click through the -events and save the images: - -.. code:: python - - from fact.plotting import Viewer - from numpy.random import poisson - - # pseudo data: - data = poisson(30, (10, 1440)) - - # call the Viewer with data and a label for the colorbar: - Viewer(data, "label") There are also functions to get the camera\_geometry from the delivered source file: @@ -111,7 +114,7 @@ To download the database and read it to Pandas dataframe without using peewee: from fact import credentials import pandas as pd - + factDB = credentials.create_factdb_engine() runInfo = pd.read_sql_table(table_name="RunInfo", con=factDB) From d8cde272bb3a647b51d61a51de683ba09e08ac64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20N=C3=B6the?= Date: Thu, 5 Dec 2019 14:17:32 +0100 Subject: [PATCH 2/3] Fix example --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index a9c8173..90cb562 100644 --- a/README.rst +++ b/README.rst @@ -59,7 +59,7 @@ Utils for plotting data into a FACT camera view. Based on matplotlib. .. code:: python import matplotlib.pyplot as plt - import fact.plotting import camera + from fact.plotting import camera from numpy.random import normal # create some pseudo data with shape (10, 1440): From 71a0b2f637644d81819f53f74a84ce29a52d1030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20N=C3=B6the?= Date: Thu, 5 Dec 2019 14:21:05 +0100 Subject: [PATCH 3/3] Add missing newline --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index 90cb562..545b3ac 100644 --- a/README.rst +++ b/README.rst @@ -42,6 +42,7 @@ To store pandas dataframes in column-oriented storage into hdf5 files, we created some helpfull wrappers around ``pandas`` and ``h5py``: .. code:: python + from fact.io import read_h5py, to_h5py import pandas as pd