Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/packages-dl3-irfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,28 @@ 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 }}
password: ${{ secrets.GITHUB_TOKEN }}

- 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
type=semver,pattern={{major}}.{{minor}}.{{patch}},suffix=-dl3-irfs
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' }}
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
28 changes: 7 additions & 21 deletions DL2/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"
16 changes: 7 additions & 9 deletions DL2/generate_DL2_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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()
Expand Down
26 changes: 14 additions & 12 deletions DL3-IRFs/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand Down
4 changes: 2 additions & 2 deletions DL3-IRFs/src/test_cta_file.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Test program for OGADF scheme using ogadf_schema
"""
usage: python src/test_cta_file.py <file.fits.gz>
(only 3D implemented at this point)
usage: python src/test_cta_file.py <file.fits.gz>
(only 3D implemented at this point)
"""
import logging
import sys
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading