Skip to content

Commit e43e32b

Browse files
authored
Merge pull request #143 from cta-observatory/move_get_image
Define API for reader and image_mapper
2 parents 906c5b8 + d9e725b commit e43e32b

File tree

15 files changed

+3414
-5108
lines changed

15 files changed

+3414
-5108
lines changed

.github/workflows/python-package-conda.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
run: |
3030
# $CONDA is an environment variable pointing to the root of the miniconda directory
3131
echo $CONDA/bin >> $GITHUB_PATH
32+
- name: Add MKL_THREADING_LAYER variable
33+
run: echo "MKL_THREADING_LAYER=GNU" >> $GITHUB_ENV
3234
- name: Install dependencies
3335
run: |
3436
conda env update --file environment.yml --name base --solver=classic

.zenodo.json

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
22
"license": "MIT",
33
"contributors": [
4-
{
5-
"affiliation": "Laboratoire d'Annecy de Physique des Particules, CNRS, and LISTIC,Universit\u00e9 Savoie Mont-Blanc, Annecy, France",
6-
"type": "Researcher",
7-
"name": "Mika\u00ebl Jacquemont"
8-
},
94
{
105
"orcid": "0000-0002-5686-2078",
116
"affiliation": "Laboratoire d'Annecy de Physique des Particules, CNRS, Universit\u00e9 Savoie Mont-Blanc, Annecy, France",
@@ -17,6 +12,12 @@
1712
"affiliation": "Instituto de F\u00edsica de Part\u00edculas y del Cosmos and Departamento de EMFTEL, Universidad Complutense de Madrid, Madrid, Spain",
1813
"type": "Researcher",
1914
"name": "Jos\u00e9 Luis Contreras"
15+
},
16+
{
17+
"orcid": "0009-0007-1566-9507",
18+
"affiliation": "Instituto de F\u00edsica de Part\u00edculas y del Cosmos and Departamento de EMFTEL, Universidad Complutense de Madrid, Madrid, Spain",
19+
"type": "Researcher",
20+
"name": "Alexander Cervi\u00f1o"
2021
}
2122
],
2223
"language": "eng",
@@ -30,27 +31,28 @@
3031
],
3132
"creators": [
3233
{
33-
"affiliation": "University of California Los Angeles, Division of Astronomy and Astrophysics, Los Angeles, CA, USA",
34-
"name": "Bryan Kim"
35-
},
36-
{
37-
"affiliation": "Columbia University, Department of Physics, New York, NY, USA",
38-
"name": "Ari Brill"
39-
},
40-
{
41-
"affiliation": "Instituto de F\u00edsica de Part\u00edculas y del Cosmos and Departamento de EMFTEL, Universidad Complutense de Madrid, Madrid, Spain",
34+
"orcid": "0000-0003-1821-7964"
35+
"affiliation": "Universit\u00e9 de Gen\u00e8ve, D\u00e9partement de physique nucl\u00e9aire et corpusculaire, Gen\u00e8ve, Suisse",
4236
"name": "Tjark Miener"
4337
},
4438
{
4539
"orcid": "0000-0003-3343-0755",
4640
"affiliation": "Instituto de F\u00edsica de Part\u00edculas y del Cosmos and Departamento de EMFTEL, Universidad Complutense de Madrid, Madrid, Spain",
4741
"name": "Daniel Nieto"
4842
},
43+
{
44+
"affiliation": "University of California Los Angeles, Division of Astronomy and Astrophysics, Los Angeles, CA, USA",
45+
"name": "Bryan Kim"
46+
},
47+
{
48+
"affiliation": "Columbia University, Department of Physics, New York, NY, USA",
49+
"name": "Ari Brill"
50+
},
4951
{
5052
"affiliation": "Columbia University, Department of Physics, New York, NY, USA",
5153
"name": "Qi Feng"
5254
}
5355
],
5456
"access_right": "open",
5557
"description": "<p>A package of utilities for writing, reading, and applying image processing to&nbsp;calibrated data from imaging atmospheric Cherenkov telescopes in a standardized format.</p>"
56-
}
58+
}

README.rst

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ necessary package channels, and install dl1-data-handler specified version and i
4343

4444
.. code-block:: bash
4545
46-
DL1DH_VER=0.12.0
46+
DL1DH_VER=0.13.0
4747
wget https://raw.githubusercontent.com/cta-observatory/dl1-data-handler/v$DL1DH_VER/environment.yml
4848
conda env create -n [ENVIRONMENT_NAME] -f environment.yml
4949
conda activate [ENVIRONMENT_NAME]
@@ -52,27 +52,6 @@ necessary package channels, and install dl1-data-handler specified version and i
5252
This should automatically install all dependencies (NOTE: this may take some time, as by default MKL is included as a dependency of NumPy and it is very large).
5353

5454

55-
Dependencies
56-
------------
57-
58-
The main dependencies are:
59-
60-
61-
* PyTables >= 3.8
62-
* NumPy >= 1.20.0
63-
* ctapipe == 0.21.2
64-
65-
Also see setup.py.
66-
67-
Usage
68-
-----
69-
70-
ImageMapper
71-
^^^^^^^^^^^
72-
73-
The ImageMapper class transforms the hexagonal input pixels into a 2D Cartesian output image. The basic usage is demonstrated in the `ImageMapper tutorial <https://github.com/cta-observatory/dl1-data-handler/blob/master/notebooks/test_image_mapper.ipynb>`_. It requires `ctapipe-extra <https://github.com/cta-observatory/ctapipe-extra>`_ outside of the dl1-data-handler. See this publication for a detailed description: `arXiv:1912.09898 <https://arxiv.org/abs/1912.09898>`_
74-
75-
7655
Links
7756
-----
7857

dl1_data_handler/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
from .image_mapper import *
2-
from .processor import *
32
from .reader import *
4-
from .transforms import *
53
from ._version import __version__

dl1_data_handler/conftest.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
"""
2+
common pytest fixtures for tests in dl1-data-handler.
3+
Credits to ctapipe for the original code.
4+
"""
5+
6+
import pytest
7+
8+
from ctapipe.core import run_tool
9+
from ctapipe.utils import get_dataset_path
10+
11+
@pytest.fixture(scope="session")
12+
def prod5_gamma_simtel_path():
13+
return get_dataset_path("gamma_prod5.simtel.zst")
14+
15+
@pytest.fixture(scope="session")
16+
def dl1_tmp_path(tmp_path_factory):
17+
"""Temporary directory for global dl1 test data"""
18+
return tmp_path_factory.mktemp("dl1_")
19+
20+
@pytest.fixture(scope="session")
21+
def r1_tmp_path(tmp_path_factory):
22+
"""Temporary directory for global r1 test data"""
23+
return tmp_path_factory.mktemp("r1_")
24+
25+
@pytest.fixture(scope="session")
26+
def dl1_gamma_file(dl1_tmp_path, prod5_gamma_simtel_path):
27+
"""
28+
DL1 file containing both images and parameters from a gamma simulation set.
29+
"""
30+
from ctapipe.tools.process import ProcessorTool
31+
32+
output = dl1_tmp_path / "gamma.dl1.h5"
33+
34+
argv = [
35+
f"--input={prod5_gamma_simtel_path}",
36+
f"--output={output}",
37+
"--write-images",
38+
"--DataWriter.Contact.name=αℓℓ the äüöß",
39+
]
40+
assert run_tool(ProcessorTool(), argv=argv, cwd=dl1_tmp_path) == 0
41+
return output
42+
43+
@pytest.fixture(scope="session")
44+
def r1_gamma_file(r1_tmp_path, prod5_gamma_simtel_path):
45+
"""
46+
R1 file containing both waveforms and parameters from a gamma simulation set.
47+
"""
48+
from ctapipe.tools.process import ProcessorTool
49+
50+
output = r1_tmp_path / "gamma.r1.h5"
51+
52+
argv = [
53+
f"--input={prod5_gamma_simtel_path}",
54+
f"--output={output}",
55+
f"--DataWriter.write_r1_waveforms=True",
56+
"--DataWriter.Contact.name=αℓℓ the äüöß",
57+
]
58+
assert run_tool(ProcessorTool(), argv=argv, cwd=r1_tmp_path) == 0
59+
return output

0 commit comments

Comments
 (0)