This repository has been archived on 2025-04-15. You can view files and clone it, but cannot push or open issues or pull requests.
2023-06-05 17:40:58 +02:00

82 lines
1.6 KiB
Markdown

# creader
Small python package to read cluster and raw files
## Getting started
Run
```bash
export PYTHONPATH=$PWD:$PYTHONPATH
make
```
And then have a look at the examples:
- [Reading cluster files](examples/ClusterFile.ipynb)
- [Reading Moench03/04 raw files](examples/RawFile.ipynb)
## 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
debug Build extension with debug prints and assertions
ext [DEFAULT] build c extension in place
test Run unit tests using pytest
```
**Manual build**
```bash
#build in place and use from the same folder
#sometimes necessary to remove build folder and .so
#by hand
$ python setup.py build_ext --inplace
```
To use make sure that the .so and potentially python files are in PYTHONPATH (or installed in developer mode)
```bash
#conda
$ conda develop install .
#or with pip
$ pip install --editable .
```
## Cluster file specifications
```
[int32 frame_number][int32 n_clusters][clusters....]
// Cluster data type
typedef struct {
int16_t x;
int16_t y;
int32_t data[9];
} Cluster ;
```
## Running tests
```bash
#Tell the program where the test data is located.
# Can change depending on how you mounted sls_det_storage
$ export CREADER_TEST_DATA=/mnt/sls_det_storage/moench_data/cluster_reader_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)