Skip to content

Commit 00c51e3

Browse files
authored
Merge pull request #49 from VERITAS-Observatory/spectral-5sigma
Add functionality to plot spectra for significant bins in light curve
2 parents 5b8b28e + 90c37c3 commit 00c51e3

25 files changed

+836
-226
lines changed

.github/workflows/flake8.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/linter.yml

Lines changed: 55 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
---
2-
## Super Linter GitHub Actions ##
3-
name: Lint Code Base
2+
name: CI-linting
43

5-
# Start the job on all push #
64
on:
5+
workflow_dispatch:
76
pull_request:
87
branches: [main]
98
types: [opened, synchronize]
@@ -12,35 +11,80 @@ on:
1211
- main
1312

1413
jobs:
15-
build:
16-
name: Lint Code Base
14+
15+
linting:
1716
runs-on: ubuntu-latest
17+
defaults:
18+
run:
19+
shell: bash -leo pipefail {0}
1820

1921
permissions:
2022
contents: read
2123
packages: read
2224
statuses: write
2325

2426
steps:
25-
- name: Checkout Code
27+
- name: checkout
2628
uses: actions/checkout@v4
2729
with:
2830
fetch-depth: 0
2931

32+
- name: Set up Python
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: "3.13"
36+
37+
38+
- name: Check for non-ASCII characters
39+
run: |
40+
output=$(find . -type f \
41+
\( -name "*.py" -o -name "*.rst" -o -name "*.yml" -o -name "*.toml" \) \
42+
-exec perl -ne 'print if /[^[:ascii:]]/ && !/latin/i' {} \;)
43+
if [ -n "$output" ]; then
44+
echo "Non-ASCII characters found in documentation."
45+
exit 1
46+
fi
47+
48+
- name: install packages not included in super-linter
49+
run: |
50+
pip install validate-pyproject
51+
52+
- name: pyproject.toml
53+
run: |
54+
validate-pyproject pyproject.toml
55+
56+
- name: Check whether the citation metadata from CITATION.cff is valid
57+
uses: citation-file-format/cffconvert-github-action@2.0.0
58+
with:
59+
args: "--validate"
60+
61+
# Dependencies required to avoid errors
62+
# reported by linters
63+
- name: Install mamba dependencies
64+
uses: mamba-org/setup-micromamba@v2
65+
with:
66+
environment-file: environment.yml
67+
init-shell: bash
68+
69+
- name: Python dependencies
70+
run: |
71+
pip install -e '.[tests,dev,doc]'
72+
73+
- name: Pre-commit
74+
run: |
75+
pre-commit run --all-files
76+
3077
- name: Lint Code Base
3178
uses: super-linter/super-linter@v7
3279
env:
3380
VALIDATE_ALL_CODEBASE: false
3481
VALIDATE_GITHUB_ACTIONS: true
3582
VALIDATE_YAML: true
36-
VALIDATE_PYTHON_ISORT: true
37-
VALIDATE_PYTHON_FLAKE8: true
38-
VALIDATE_PYTHON_BLACK: true
3983
VALIDATE_MARKDOWN: true
84+
VALIDATE_NATURAL_LANGUAGE: true
4085
VALIDATE_DOCKERFILE_HADOLINT: true
86+
VALIDATE_BASH: true
4187
LINTER_RULES_PATH: ./
42-
PYTHON_BLACK_CONFIG_FILE: pyproject.toml
43-
PYTHON_ISORT_CONFIG_FILE: pyproject.toml
4488

4589
DEFAULT_BRANCH: main
4690
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ __pycache__/
88
v2dl5.egg-info
99

1010
v2dl5/_version.py
11+
12+
.vscode

.pre-commit-config.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1+
---
12
repos:
23
# https://pycqa.github.io/isort/docs/configuration/black_compatibility.html#integration-with-pre-commit
34
- repo: https://github.com/pycqa/isort
45
rev: 6.0.1
56
hooks:
67
- id: isort
78
args: ["--profile", "black", "--filter-files"]
8-
- repo: https://github.com/psf/black
9-
rev: 25.1.0
10-
hooks:
11-
- id: black
12-
args: ["--line-length=100"]
139
- repo: https://github.com/astral-sh/ruff-pre-commit
1410
# Ruff
1511
rev: v0.11.4

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Allows to run analysis scripts for a given list of runs or for a cone search aro
1212

1313
- source detection analysis including integral flux (or flux upper limits), reflection region model
1414
- spectral analysis, reflected region model
15+
- run-list generation
16+
- light-curve analysis and plotting
1517

1618
## Installation
1719

@@ -28,17 +30,17 @@ conda activate v2dl5
2830
pip install -e .
2931
```
3032

31-
## V2DL5 Analysis
33+
## Analysis
3234

3335
### Run list generator
3436

35-
The tool `runlist.py` allows to generate a list of runs for a given observation time and zenith angle.
37+
The tool `generate_run_list.py` allows to generate a list of runs for a given observation time and zenith angle.
3638
It generates a lot of printout which should be used to fine tune the run selection.
3739

3840
Example:
3941

4042
```console
41-
python v2dl5/scripts/generate_runlist.py \
43+
python v2dl5/scripts/generate_run_list.py \
4244
--obs_table ../../../VTS/DL3/v490/dl3_pointlike_moderate2tel/obs-index.fits.gz \
4345
--config examples/run_selection.yml \
4446
--output_dir my_output_dir
@@ -68,7 +70,7 @@ python v2dl5/scripts/plot_binary_light_curves.py \
6870

6971
### Auxiliary data
7072

71-
Auxiliary data is stored in v2dl5/data and available at run time. This includes:
73+
Auxiliary data is stored in v2dl5/data and available at runtime. This includes:
7274

7375
#### Star catalogues
7476

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ dependencies:
2121
- pytest-xdist
2222
- python
2323
- scipy
24+
- uproot

eventdisplay_anasum/light_curve_analysis.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ fi
1111

1212
light_curves()
1313
{
14-
ANASUM_FILE="/data/$(basename $1)"
15-
TIME_FILE="/time_data/$(basename $2)"
14+
ANASUM_FILE="/data/$(basename "$1")"
15+
TIME_FILE="/time_data/$(basename "$2")"
1616
podman run --platform linux/amd64 --rm -it -v "$(pwd)/:/workdir" \
17-
-v "$(dirname $1):/data" \
18-
-v "$(dirname $2):/time_data" \
17+
-v "$(dirname "$1"):/data" \
18+
-v "$(dirname "$2"):/time_data" \
1919
ghcr.io/veritas-observatory/eventdisplay_v4:main \
2020
/bin/bash -c \
2121
"cd /workdir/; root -l -q -b 'light_curve_analysis.C(\"$ANASUM_FILE\", \"$TIME_FILE\", $3, $4, $5)';"

eventdisplay_anasum/nightly_time_bins.C

Lines changed: 0 additions & 50 deletions
This file was deleted.

eventdisplay_anasum/nightly_time_bins.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

eventdisplay_anasum/runlist_from_time_bins.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ fi
1111

1212
runlist_from_time_bins()
1313
{
14-
ANASUM_FILE="/data/$(basename $1)"
15-
TIME_FILE="/time_data/$(basename $2)"
14+
ANASUM_FILE="/data/$(basename "$1")"
15+
TIME_FILE="/time_data/$(basename "$2")"
1616
podman run --platform linux/amd64 --rm -it -v "$(pwd)/:/workdir" \
17-
-v "$(dirname $1):/data" \
18-
-v "$(dirname $2):/time_data" \
17+
-v "$(dirname "$1"):/data" \
18+
-v "$(dirname "$2"):/time_data" \
1919
ghcr.io/veritas-observatory/eventdisplay_v4:main \
2020
/bin/bash -c \
2121
"cd /workdir/; root -l -q -b 'runlist_from_time_bins.C(\"$ANASUM_FILE\", \"$TIME_FILE\", $3)';"

0 commit comments

Comments
 (0)