Skip to content

Commit

Permalink
Merge pull request #2 from VERITAS-Observatory/migration
Browse files Browse the repository at this point in the history
Migration
  • Loading branch information
steob92 authored Jan 30, 2024
2 parents fdddf20 + 8f65749 commit 645443e
Show file tree
Hide file tree
Showing 38 changed files with 131,598 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .cz.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
name = "cz_conventional_commits"
tag_format = "$version"
version_scheme = "semver"
version = "0.0.1"
version = "0.1.1"
update_changelog_on_bump = true
major_version_zero = true
45 changes: 28 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
repos:
- hooks:
- id: commitizen
- id: commitizen-branch
stages:
- push
repo: https://github.com/commitizen-tools/commitizen
rev: v3.13.0

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.14
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
- hooks:
- id: commitizen
- id: commitizen-branch
stages:
- push
repo: https://github.com/commitizen-tools/commitizen
rev: v3.13.0

- repo: https://github.com/ambv/black
rev: 24.1.1
hooks:
- id: black
language_version: python3.10

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.15
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# # Run the formatter.
# - id: ruff-format
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
args: ["--max-line-length=100", "--extend-ignore=E203,E712"]
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# gammapy-tools
A repo for tools related to gammapy background generation.
This is the public version of [gammapy-background-analysis](https://github.com/VERITAS-Observatory/gammapy-background-analysis.git).


# Installation

This package requires [V2DL3](https://github.com/VERITAS-Observatory/V2DL3) and [Gammapy](https://gammapy.org/) to be installed.

Gammapy (v1.1) can be installed via:
```
pip install gammapy==1.1
```
Also install gammapy-data using
```
gammapy download datasets
```
And set the enviromental variable GAMMAPY_DATA, to that download location (for example):
```
export GAMMAPY_DATA=/path/to/gammapy/data
```

A modified version of `Hipparcos_MAG8_1997.dat` is used for finding stars. Copy this into the `$GAMMAPY_DATA/catalogs/` directory:
```
cp background_from_bkg/Hipparcos_MAG8_1997.dat $GAMMAPY_DATA/catalogs/
```

As there maybe issues installing root-numpy, V2DL3 can be installed in one's enviroment as follows (replace `mamba` with `conda` for a conda install):
```
git clone https://github.com/VERITAS-Observatory/V2DL3.git
cd V2DL3
# Because its an env install of requirements
# Note the python version in the latest test throws issues with pytest
grep -A 100 "dependencies:" environment-eventdisplay.yml | grep "-" | grep -v "python" | awk '{print $2}' | xargs mamba install --yes
# root_numpy throws issues too. Only VEGAS uses it
mv setup.py _setup.py && grep -v "root_numpy" _setup.py > setup.py && pip install .
# clean up
cd ../ ; rm -r V2DL3
```

`background_from_bkg` can then be installed via:
```
pip install -r requirements.txt
pip install .
```

# Containerization
For details on working with containers see [containers.md](docs/containers.md)


# Usage

A number of worked examples can be found in [examples](examples).

To simplify analysis, a "driver" config file is used. An example of such a config file is shown in [config_crab.yaml](config_crab.yaml), which contains 4 crab runs.

* See [config.md](docs/config.md) for details on config files.
* See [mimicing_data.md](docs/mimicing_data.md) for details on mimicing and scrambling data.
Loading

0 comments on commit 645443e

Please sign in to comment.