From 7fbd308c7d9fd82f763211610facfb3a6eca3023 Mon Sep 17 00:00:00 2001 From: Erik Frojdh Date: Mon, 5 Jun 2023 10:28:22 +0200 Subject: [PATCH] updated readme --- README.md | 25 +++++++++++++++++++------ examples/ClusterFile.ipynb | 11 ++++++----- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 69f661a..51ad862 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,27 @@ -# python_cpp_example +# creader -Minimal example building a C++ python extension. +Small python package to read cluster and raw files -Useful links: - * [Using NumPy C-API](https://numpy.org/doc/stable/user/c-info.html) +## Getting started + +Run +```bash +export PYTHONPATH=$PWD:$PYTHONPATH +make +``` +And then have a look at the examples: + +- [Reading cluster files](examples/ClusterFile.ipynb) -### Build instructions +## Build instructions **Simplified build using make** ```bash $ make #build c extension inplace ``` +Check what is available ``` $ make help clean Remove the build folder and the shared library @@ -64,4 +73,8 @@ $ export CREADER_TEST_DATA=/mnt/sls_det_storage/moench_data/cluster_reader_test/ $ make test -``` \ No newline at end of file +``` + +## Useful links: + * [Using NumPy C-API](https://numpy.org/doc/stable/user/c-info.html) + * [Extending Python with C](https://docs.python.org/3/extending/extending.html) diff --git a/examples/ClusterFile.ipynb b/examples/ClusterFile.ipynb index 1b05184..121edae 100644 --- a/examples/ClusterFile.ipynb +++ b/examples/ClusterFile.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "cc37377b", + "id": "8e4c3dd9", "metadata": {}, "source": [ "# Using ClusterFile" @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": 1, - "id": "5dcb9f4e", + "id": "38941595", "metadata": {}, "outputs": [], "source": [ @@ -28,7 +28,7 @@ }, { "cell_type": "markdown", - "id": "a1f27bec", + "id": "bc0ae735", "metadata": {}, "source": [ "## Read clusters from file and plot a histogram\n", @@ -41,7 +41,7 @@ { "cell_type": "code", "execution_count": 6, - "id": "45482025", + "id": "e69f82da", "metadata": {}, "outputs": [ { @@ -74,6 +74,7 @@ "xmax = 1e4\n", "hist1 = bh.Histogram(bh.axis.Regular(n_bins, xmin, xmax))\n", "\n", + "# Read clusters and fill the histogram with pixel values\n", "with ClusterFile(path/fname, chunk = 10000) as f:\n", " for clusters in f:\n", " hist1.fill(clusters['data'].flat)\n", @@ -91,7 +92,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a2973368", + "id": "f7fd30b5", "metadata": {}, "outputs": [], "source": []