updated readme

This commit is contained in:
Erik Frojdh 2023-06-05 10:28:22 +02:00
parent d742e169d4
commit 7fbd308c7d
2 changed files with 25 additions and 11 deletions

View File

@ -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: ## Getting started
* [Using NumPy C-API](https://numpy.org/doc/stable/user/c-info.html)
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** **Simplified build using make**
```bash ```bash
$ make #build c extension inplace $ make #build c extension inplace
``` ```
Check what is available
``` ```
$ make help $ make help
clean Remove the build folder and the shared library clean Remove the build folder and the shared library
@ -65,3 +74,7 @@ $ export CREADER_TEST_DATA=/mnt/sls_det_storage/moench_data/cluster_reader_test/
$ make test $ make test
``` ```
## 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)

View File

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "cc37377b", "id": "8e4c3dd9",
"metadata": {}, "metadata": {},
"source": [ "source": [
"# Using ClusterFile" "# Using ClusterFile"
@ -11,7 +11,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 1,
"id": "5dcb9f4e", "id": "38941595",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -28,7 +28,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "a1f27bec", "id": "bc0ae735",
"metadata": {}, "metadata": {},
"source": [ "source": [
"## Read clusters from file and plot a histogram\n", "## Read clusters from file and plot a histogram\n",
@ -41,7 +41,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 6,
"id": "45482025", "id": "e69f82da",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -74,6 +74,7 @@
"xmax = 1e4\n", "xmax = 1e4\n",
"hist1 = bh.Histogram(bh.axis.Regular(n_bins, xmin, xmax))\n", "hist1 = bh.Histogram(bh.axis.Regular(n_bins, xmin, xmax))\n",
"\n", "\n",
"# Read clusters and fill the histogram with pixel values\n",
"with ClusterFile(path/fname, chunk = 10000) as f:\n", "with ClusterFile(path/fname, chunk = 10000) as f:\n",
" for clusters in f:\n", " for clusters in f:\n",
" hist1.fill(clusters['data'].flat)\n", " hist1.fill(clusters['data'].flat)\n",
@ -91,7 +92,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "a2973368", "id": "f7fd30b5",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []