Skip to content

Commit

Permalink
Merge pull request #135 from fact-project/fix_readme
Browse files Browse the repository at this point in the history
Update readme
  • Loading branch information
maxnoe authored Dec 5, 2019
2 parents 5c6d7aa + 71a0b2f commit 65201e6
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,23 @@ 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
~~~~~~~~

Expand All @@ -43,28 +60,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
from 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:
Expand Down Expand Up @@ -111,7 +115,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)
Expand Down

0 comments on commit 65201e6

Please sign in to comment.