Skip to content

Commit

Permalink
Resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
nietootein committed Jun 13, 2024
2 parents 3c75618 + 75d64c4 commit b6eceef
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 74 deletions.
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

48 changes: 16 additions & 32 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ DL1 Data Handler
:alt: DOI


.. image:: https://travis-ci.org/cta-observatory/dl1-data-handler.svg?branch=master
:target: https://travis-ci.org/cta-observatory/dl1-data-handler.svg?branch=master
:alt: build status


.. image:: https://anaconda.org/ctlearn-project/dl1_data_handler/badges/installer/conda.svg
.. image:: https://anaconda.org/ctlearn-project/dl1_data_handler/badges/version.svg
:target: https://anaconda.org/ctlearn-project/dl1_data_handler/
:alt: Anaconda-Server Badge

Expand All @@ -22,23 +17,16 @@ DL1 Data Handler
:alt: Latest Release


.. image:: https://coveralls.io/repos/github/cta-observatory/dl1-data-handler/badge.svg?branch=master
:target: https://coveralls.io/github/cta-observatory/dl1-data-handler?branch=master
:alt: Coverage Status
.. image:: https://github.com/cta-observatory/dl1-data-handler/actions/workflows/python-package-conda.yml/badge.svg
:target: https://github.com/cta-observatory/dl1-data-handler/actions/workflows/python-package-conda.yml
:alt: Continuos Integration


A package of utilities for writing (deprecated), reading, and applying image processing to `Cherenkov Telescope Array (CTA) <https://www.cta-observatory.org/>`_ DL1 data (calibrated images) in a standardized format. Created primarily for testing machine learning image analysis techniques on IACT data.
A package of utilities for reading, writing (deprecated), and applying image processing to `Cherenkov Telescope Array (CTA) <https://www.cta-observatory.org/>`_ DL1 data (calibrated images) in a standardized format. Created primarily for testing machine learning image analysis techniques on IACT data.

Currently supports data in the CTA pyhessio sim_telarray format, with the possibility of supporting other IACT data formats in the future. Built using ctapipe and PyTables.

Previously named image-extractor (v0.1.0 - v0.6.0). Currently under development, intended for internal use only.

Data Format
-----------

[Deprecated] DL1DataWriter implements a standardized format for storing simulated CTA DL1 event data into Pytables files. CTAMLDataDumper is the class which implements the conversion from ctapipe containers to the CTA ML data format. See the wiki page `here <https://github.com/cta-observatory/dl1-data-handler/wiki/CTA-ML-Data-Format>`_ for a full description of this data format and an FAQ.

ctapipe process tool should be used instead.

Installation
------------
Expand All @@ -55,20 +43,20 @@ necessary package channels, and install dl1-data-handler specified version and i

.. code-block:: bash
DL1DH_VER=0.10.11
DL1DH_VER=0.11.0
wget https://raw.githubusercontent.com/cta-observatory/dl1-data-handler/v$DL1DH_VER/environment.yml
conda env create -n [ENVIRONMENT_NAME] -f environment.yml
conda activate [ENVIRONMENT_NAME]
conda install -c ctlearn-project dl1_data_handler=$DL1DH_VER
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).

If you want to import any functionality from dl1-data-handler into your own Python scripts, then you are all set. However, if you wish to make use of any of the scripts in dl1-data-handler/scripts (like write_data.py), you should also clone the repository locally and checkout the corresponding tag (i.e. for version v0.10.11):
If you want to import any functionality from dl1-data-handler into your own Python scripts, then you are all set. However, if you wish to make use of any of the scripts in dl1-data-handler/scripts (like write_data.py), you should also clone the repository locally and checkout the corresponding tag (i.e. for version v0.11.0):

.. code-block:: bash
git clone https://github.com/cta-observatory/dl1-data-handler.git
git checkout v0.10.11
git checkout v0.11.0
dl1-data-handler should already have been installed in your environment by Conda, so no further installation steps (i.e. with setuptools or pip) are necessary and you should be able to run scripts/write_data.py directly.

Expand All @@ -78,15 +66,20 @@ Dependencies
The main dependencies are:


* PyTables >= 3.7
* NumPy >= 1.16.0
* ctapipe == 0.19
* PyTables >= 3.8
* NumPy >= 1.20.0
* ctapipe == 0.20.0

Also see setup.py.

Usage
-----

ImageMapper
^^^^^^^^^^^

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>`_

[Deprecated] DL1DataWriter
^^^^^^^^^^^^^^^^^^^^^^^^^^
The DL1DataWriter is not supported by the default installation. Please follow the custom installation instructions:
Expand Down Expand Up @@ -177,15 +170,6 @@ It can be called as:

It will automatically sort the simtel files in the file_dir directory into groups with matching particle_type, zenith, azimuth, and production parameters. Within each of these groups, it will group together input files in sequential order into runs of size NUM_INPUTS_PER_RUN. The output filename for each run will be automatically generated as ``[particle_type]_[ze]deg_[az]deg_runs[run_number_range]___[production info].h5``. The output YAML file will be written to output_file.

ImageMapper
^^^^^^^^^^^

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>`_

Other scripts
^^^^^^^^^^^^^

All other scripts located in the scripts/deprecated directory are not currently updated to be compatible with dl1-data-handler >= 0.7.0 and should not be used.

Examples/Tips
-------------
Expand Down
20 changes: 10 additions & 10 deletions dl1_data_handler/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,17 +437,17 @@ def _get_image(self, child, tel_type, image_index, parameter_table=-1):
with lock:
record = child[image_index]
for i, channel in enumerate(self.image_channels):
cleaning_mask = "image_mask"
if parameter_table >= 0:
cleaning_mask += str(parameter_table)
mask = record[cleaning_mask]
if "image" in channel:
vector[:, i] = record["image"]
if "time" in channel:
cleaned_peak_times = record["peak_time"] * mask
vector[:, i] = record["peak_time"] - cleaned_peak_times[np.nonzero(cleaned_peak_times)].mean()
if "clean" in channel or "mask" in channel:
cleaning_mask = "image_mask"
if parameter_table >= 0:
cleaning_mask += str(parameter_table)
if "image" in channel:
vector[:, i] = record["image"] * record[cleaning_mask]
if "time" in channel:
vector[:, i] = record["peak_time"] * record[cleaning_mask]
else:
vector[:, i] = record[channel]

vector[:, i] *= mask
# Apply the transform to recover orginal floating point values if the file were compressed
if "image" in channel and self.image_scale:
vector[:, i] /= self.image_scale
Expand Down
2 changes: 1 addition & 1 deletion dl1_data_handler/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def find_git_on_windows():


def get_git_describe_version():
"""return the string output of git desribe"""
"""return the string output of git describe"""
try:
repo_url = "https://github.com/cta-observatory/dl1-data-handler/"
output_lines = subprocess.check_output(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def getVersionFromFile():
"jupyter",
"pandas",
"pytest-cov",
"tables>=3.7",
"tables>=3.8",
],
entry_points={
"console_scripts": [
Expand Down

0 comments on commit b6eceef

Please sign in to comment.