diff --git a/.github/workflows/packages-dl3-irfs.yml b/.github/workflows/packages-dl3-irfs.yml index ac32622..39c5dc3 100644 --- a/.github/workflows/packages-dl3-irfs.yml +++ b/.github/workflows/packages-dl3-irfs.yml @@ -21,12 +21,12 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v5 with: path: 'Converters' - name: Log in to the Container registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -34,7 +34,7 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: tags: | type=ref,event=pr,suffix=-dl3-irfs @@ -42,7 +42,7 @@ jobs: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Build and push Docker image - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v6 with: context: . push: ${{ github.event_name != 'pull_request' }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8770937..49d47e9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,24 +1,24 @@ repos: # https://pycqa.github.io/isort/docs/configuration/black_compatibility.html#integration-with-pre-commit - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 7.0.0 hooks: - id: isort args: ["--profile", "black", "--filter-files"] - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 25.11.0 hooks: - id: black args: ["--line-length=100"] # https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html?highlight=other%20tools#flake8 - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.3.0 hooks: - id: flake8 args: ["--max-line-length=100", "--extend-ignore=E203,E712"] # https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v6.0.0 hooks: - id: check-yaml - id: trailing-whitespace diff --git a/DL2/Dockerfile b/DL2/Dockerfile index 55fcaeb..2dacae3 100644 --- a/DL2/Dockerfile +++ b/DL2/Dockerfile @@ -1,31 +1,17 @@ # Dockerfile to build DL2 Converter for Eventdisplay -FROM python:3.10-slim +FROM mambaorg/micromamba:latest ENV LC_ALL=C LABEL maintainer.name="Eventdisplay Team" LABEL maintainer.email="gernot.maier@desy.de" ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y --no-install-recommends wget && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -ENV PATH /conda/bin:$PATH -ENV PYTHONPATH=$PYTHONPATH:"/" - -COPY Converters/DL2/environment.yml environment.yml - -RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \ - /bin/bash ~/miniconda.sh -b -p /conda && \ - rm ~/miniconda.sh -RUN conda env update -n base --file environment.yml && \ - conda clean --all - WORKDIR /workdir/ -SHELL ["/bin/bash", "-c"] +COPY Converters/DL2/environment.yml /tmp/environment.yml + +# Create environment using micromamba +RUN micromamba install -y -n base -f /tmp/environment.yml && \ + micromamba clean -a -y -RUN source /root/.bashrc && \ - conda init bash +ENV PATH="/opt/conda/bin:$PATH" diff --git a/DL2/generate_DL2_file.py b/DL2/generate_DL2_file.py index 743d444..475fe6d 100644 --- a/DL2/generate_DL2_file.py +++ b/DL2/generate_DL2_file.py @@ -111,9 +111,7 @@ def cli(filenames, cut_level, debug, output, layout, event_type): if event_type > 0: logging.info(f"Number of events within event_type file: {len(event_types)}") ratio = np.sum(event_types == -1) / len(event_types) - logging.info( - f"Ratio of training to simulated events: {ratio}" - ) + logging.info(f"Ratio of training to simulated events: {ratio}") logging.info(f"len(data_mask): {len(data_mask)}") data_mask[data_mask] = event_types == event_type if np.sum(data_mask) == 0: @@ -165,12 +163,12 @@ def cli(filenames, cut_level, debug, output, layout, event_type): # Create primary HDU: primary_hdu = fits.PrimaryHDU() primary_hdu.header["TELESCOP"] = layout, "Telescope and array codename" - primary_hdu.header[ - "COMMENT" - ] = "FITS (Flexible Image Transport System) format is defined in 'Astronomy" - primary_hdu.header[ - "COMMENT" - ] = "and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H" + primary_hdu.header["COMMENT"] = ( + "FITS (Flexible Image Transport System) format is defined in 'Astronomy" + ) + primary_hdu.header["COMMENT"] = ( + "and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H" + ) # Create HDU header = fits.Header() diff --git a/DL3-IRFs/Dockerfile b/DL3-IRFs/Dockerfile index a82b73c..eb4723a 100644 --- a/DL3-IRFs/Dockerfile +++ b/DL3-IRFs/Dockerfile @@ -1,31 +1,33 @@ # Dockerfile to build DL3-IRFs Converter for Eventdisplay -From rootproject/root:6.30.02-ubuntu22.04 +FROM rootproject/root:6.30.02-ubuntu22.04 ENV LC_ALL=C LABEL maintainer.name="Eventdisplay Team" LABEL maintainer.email="gernot.maier@desy.de" -# force ubunto to use bash for /bin/sh +# force ubuntu to use bash for /bin/sh RUN yes no | dpkg-reconfigure dash ## Basic packages -RUN apt-get update && apt-get install -y \ - git -RUN apt-get clean +RUN apt-get update && \ + apt-get install --no-install-recommends -y git && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + WORKDIR /data/ -ENV DATA /data/ +ENV DATA=/data/ -# Install and compile cfitsio -RUN wget --quiet http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-4.3.1.tar.gz && \ - tar -xzf cfitsio-4.3.1.tar.gz && \ - cd cfitsio-4.3.1 && \ +## Install and compile cfitsio from GitHub at tag cfitsio-4.6.3 +RUN git clone https://github.com/HEASARC/cfitsio.git && \ + cd cfitsio && \ + git checkout cfitsio-4.6.3 && \ ./configure --prefix=${DATA}/ && \ make && \ make install && \ make clean && \ - cd .. && rm -f cfitsio-4.3.1.tar.gz + cd .. && rm -rf cfitsio -ENV LD_LIBRARY_PATH "${DATA}/lib:${LD_LIBRARY_PATH}" +ENV LD_LIBRARY_PATH="${DATA}/lib:${LD_LIBRARY_PATH}" # Install and compile DL3 converter RUN git clone https://github.com/Eventdisplay/Converters.git && \ diff --git a/DL3-IRFs/src/test_cta_file.py b/DL3-IRFs/src/test_cta_file.py index eccd75d..f756d53 100644 --- a/DL3-IRFs/src/test_cta_file.py +++ b/DL3-IRFs/src/test_cta_file.py @@ -1,7 +1,7 @@ # Test program for OGADF scheme using ogadf_schema """ - usage: python src/test_cta_file.py - (only 3D implemented at this point) +usage: python src/test_cta_file.py + (only 3D implemented at this point) """ import logging import sys diff --git a/LICENSE b/LICENSE index 5d05046..5510947 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2020, Eventdisplay +Copyright (c) 2020-2025, Eventdisplay Developers All rights reserved. Redistribution and use in source and binary forms, with or without