Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
fc6bf56
Add Bayesian Blocks submodules
falric05 Mar 7, 2025
8128805
Update submodule BBrta and add wrapper for AGILE Bayesian Blocks and …
falric05 Mar 31, 2025
8951a18
implement class as derived from AGBaseAnalysis
Jun 17, 2025
0ad8287
rename
Jun 17, 2025
c20700d
update submodule to most recent commit
Jun 17, 2025
b936064
Add and Test the Configuration Class for Bayesian Blocks
Jun 18, 2025
a06012f
fixture
Jun 18, 2025
27e9def
Complete AGBayesianBlocks class implementation
Jun 19, 2025
e21a57d
Plotting function for Bayesian Blocks plots
Jun 19, 2025
12c734f
test Bayesian Blocks from AP file
Jun 19, 2025
b30401b
add and test getconfiguration
Jun 19, 2025
4e47661
install submodules in CI and container
Jun 19, 2025
003fdc5
bug fix test invocation
Jun 19, 2025
eb99769
setup docs for BB
Jun 19, 2025
ce69033
prepare tests for BB on MLE and TTE
Jun 19, 2025
477e5ac
add BB files for download and test
Jun 21, 2025
3e99b09
simplify configuration parameters
Jun 21, 2025
89490dd
fix plotting bug
Jun 21, 2025
95379b2
separate plotting for binned and unbinned
Jun 22, 2025
19fd0dd
test AGILE_AP with fitness measures and test AGILE_PH with simulated …
Jun 22, 2025
c847630
add download script
Jun 22, 2025
fa5daff
use one plotting function for BB
Jun 22, 2025
c9bc94c
codacy fixes
Jun 22, 2025
8220eba
Complete tutorial Notebook
Jun 22, 2025
4639a17
Complete docs on BB
Jun 22, 2025
fb2ffcb
codacy fixes
Jun 22, 2025
22fbb71
ensure test_data.ph is installed
Jun 22, 2025
a5fde96
update commit after BBRTA PR
Jun 22, 2025
d85e03a
Merge pull request #43 from AGILESCIENCE/42-add-bayesian-blocks
AndreaBulgarelli Aug 20, 2025
19ad3b6
Bugfix docs: myst-nb
Aug 20, 2025
7aeb3f7
Not skipping ratemeters test
May 1, 2023
183b6e3
Add legacy script
Aug 7, 2025
e39fbac
Add generic conversion function
Aug 7, 2025
4fe3563
update AGRatemetersConfig
Aug 7, 2025
bef0663
develop and test AGRatemeters init and read_ratemeters
Aug 7, 2025
7b14a78
Add RM test file
Aug 7, 2025
8b7642d
test base configuration
Aug 7, 2025
ebab55b
fix legacy script
Aug 9, 2025
57594d7
Improve Configuration Ratemeters
Aug 9, 2025
6f5d4d0
Add and test Plotter Function
Aug 10, 2025
15a521d
Add functiona nd test for AP analysis of the results
Aug 10, 2025
20ccfee
Fix and test getConfiguration
Aug 10, 2025
5e849b1
Add duration estimation and test
Aug 11, 2025
b0b4852
Add test on a long GRB
Aug 11, 2025
5aafdd6
sorting bugfix
Aug 11, 2025
cf4dc9a
Add Notebooks and Test Data
Aug 11, 2025
af8de4c
Add docs on ratemters
Aug 11, 2025
b420cb7
Bug fix install file RM
Aug 20, 2025
2d906f3
Merge pull request #55 from AGILESCIENCE/14-read_ratemeters
gabriele-panebianco-inaf Sep 2, 2025
e5e21df
rm unused unittest import
Sep 13, 2025
d573934
change unittest into pytest
Sep 13, 2025
d5ea154
fix docs index
Sep 13, 2025
1b563fc
improve download script
Sep 13, 2025
f97a636
rm logfilenameprefix (unused)
Sep 13, 2025
1c36d5f
fix HTML notebooks
Sep 13, 2025
73d9616
Merge pull request #61 from AGILESCIENCE/47-unittest-with-pytest
gabriele-panebianco-inaf Sep 13, 2025
7a277cf
introduce AGVisibilityConfig instead of AGEngAgileOffaxisVisibilityCo…
Sep 24, 2025
0a56f26
Change name AGEngAgileOffaxisVisibility in AGVisibility
Sep 24, 2025
2e68909
rm empty AGEngAgileFermiOffAxisVisibilityComparisonConfig which is empty
Sep 24, 2025
7f0b5eb
fix
Sep 24, 2025
9417194
remove unused zmax
Sep 25, 2025
f1816cb
Refactor functions to compute and provide the AGILE direction, and ou…
Sep 25, 2025
80c68c3
mv unused and API into lecay folders
Sep 26, 2025
5f5ad69
mv deprecated (and previously skipped tests into legacy directories)
Sep 26, 2025
ff93a26
rename file
Sep 26, 2025
a523ecd
update imports
Oct 5, 2025
b7b53d4
add fermi visibility
Oct 5, 2025
f8f6566
Fix docs BB tutorial
Oct 5, 2025
7cc6578
rename visibility notebook, delete unused one
Oct 5, 2025
488688e
Complete plotting functions
Oct 5, 2025
7e8449b
Add visibility Notebook and data
Oct 5, 2025
c00fa94
test AGVisibilityConfig
Oct 5, 2025
842f4fb
Docs addition
Oct 5, 2025
1281299
change default
Oct 5, 2025
3e49747
Add visibility notebook and docs
Oct 5, 2025
508ddb2
add visibility test
Oct 6, 2025
76f67a0
Add download test dataset to installation procedure
Oct 6, 2025
0d62eec
Merge pull request #63 from AGILESCIENCE/62-notebook-source-visibility
AndreaBulgarelli Oct 6, 2025
461803a
add attribute lightCurveTable
Oct 13, 2025
7362204
Add AP Tutorial
Oct 13, 2025
92fa77d
Merge pull request #66 from AGILESCIENCE/59-lc-output
gabriele-panebianco-inaf Oct 13, 2025
bfeac26
docs update
Oct 16, 2025
40608df
Version Update and CHANGELOG: 1.7.0
Oct 16, 2025
e252d6a
fix docs
Oct 16, 2025
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
20 changes: 19 additions & 1 deletion .github/workflows/continuous-integration-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

# Cache dependencies to speed up future pipelines. Each job has its own cache
- name: Cache pip dependencies
Expand All @@ -52,6 +53,10 @@ jobs:
python3 -m pip install -r requirements.lock
python3 -m pip install .

- name: Download test dataset
shell: bash -l {0}
run: download_test_dataset.sh

- name: Running unit tests and code coverage
shell: bash -l {0}
run: start_coverage.sh
Expand All @@ -74,6 +79,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

# Cache dependencies to speed up future pipelines. Each job has its own cache
- name: Cache pip dependencies
Expand All @@ -96,6 +102,10 @@ jobs:
python3 -m pip install -r requirements.lock
python3 -m pip install .

- name: Download test dataset
shell: bash -l {0}
run: download_test_dataset.sh

- name: Running REST API tests with SSDC data download
shell: bash -l {0}
run: start_test_rest_api.sh
Expand All @@ -116,7 +126,8 @@ jobs:
- name: Checking out code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 0
submodules: recursive

- name: Debug
shell: bash -l {0}
Expand All @@ -130,6 +141,10 @@ jobs:
python3 -m pip install -r requirements.lock
python3 -m pip install .

- name: Download test dataset
shell: bash -l {0}
run: download_test_dataset.sh

- name: Running unit tests and code coverage
shell: bash -l {0}
run: start_coverage.sh
Expand Down Expand Up @@ -158,6 +173,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursives

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "agilepy/external_packages/BBrta"]
path = agilepy/external_packages/BBrta
url = https://github.com/ASTRO-EDU/BBrta.git
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# Changelog

## Release 1.6.5 (May 20, 2025)
## Release 1.7.0 (October 2025)
* [PR!43](https://github.com/AGILESCIENCE/Agilepy/pull/43) solving [#42](https://github.com/AGILESCIENCE/Agilepy/issues/42). New feature: Bayesian Blocks Analysis. Added Classes `AGBayesianBlocks` and `AGBayesianBlocksConfig`, Unit Tests, Test Dataset, Tutorial Notebook and Documentation pages for the Bayesian Blocks Analysis.
* [PR!55](https://github.com/AGILESCIENCE/Agilepy/pull/55) solving [#14](https://github.com/AGILESCIENCE/Agilepy/issues/14). New feature: Ratemeters Analysis.: Added Classes`AGRatemeters` and `AGRatemetersConfig`, Unit Tests, Test Dataset, Tutorial Notebook and Documentation pages for the AGILE Scientific Ratemeters Analysis.
* [PR!47](https://github.com/AGILESCIENCE/Agilepy/pull/47) solving:
* [#35](https://github.com/AGILESCIENCE/Agilepy/issues/35). Minor Bugfix: remove the deprecated and unused parameter `logfilenameprefix` from the the configuration.
* [#61](https://github.com/AGILESCIENCE/Agilepy/issues/61). Minor Testing issue: Replace tests performed with `unittest` with equivalent `pytest` tests.
* [PR!63](https://github.com/AGILESCIENCE/Agilepy/pull/63) solving [#12](https://github.com/AGILESCIENCE/Agilepy/issues/12), [#26](https://github.com/AGILESCIENCE/Agilepy/issues/26), [#63](https://github.com/AGILESCIENCE/Agilepy/issues/63). Major Class Review: Replace the classes and functions composing the "Engineering API" (`AGEngAgileOffaxisVisibility`,`AGEngAgileOffaxisVisibilityConfig`, `AGEngAgileFermiOffAxisVisibilityComparisonConfig`, `AGEngAgileFermiOffAxisVisibilityComparison`, `AGEngDisplayComparison`) with one class `AGVisibility`, with the goal of computing the pointing direction of the AGILE Spacecraft (and, optionally, Fermi) and the off-axis angle of asource. Add Classes `AGVisibility` and `AGVisibilityConfig`, Unit Tests, Test Dataset, Tutorial Notebook and documentation.
* [PR!66](https://github.com/AGILESCIENCE/Agilepy/pull/66) solving [#59](https://github.com/AGILESCIENCE/Agilepy/issues/59). Improvements:
* Add `AGAnalysis.lightCurveTable` attribute to easily retrieve MLE and AP Light Curves.
* Add dedicated Tutorial on Aperture Photometry Light Curve Estimation.
* Documentation updates and improvements.


## Release 1.6.5 (May 20, 2025, d923ff5)
* [#41](https://github.com/AGILESCIENCE/Agilepy/issues/41): Documentation update on installation procedures.
* [#48](https://github.com/AGILESCIENCE/Agilepy/issues/48): Fix a bug in the `entrypoint.sh` script for `agilepy` container that caused it to crash.
* [#46](https://github.com/AGILESCIENCE/Agilepy/issues/46): Implement `agilepy/scripts/start_test_rest_api.sh` to test the REST API with data download from SSDC, and use it in CI pipelines.
Expand Down
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
include README.md
include agilepy/testing/unittesting/api/data/testcase.maplist4
include agilepy/testing/unittesting/api/data/test_data.ph
include agilepy/testing/unittesting/api/data/PKP080686_1_3913_000.lv1.cor.gz
include agilepy/testing/unittesting/api/data/PKP086465_1_3913_000.lv1.cor.gz
include agilepy/testing/unittesting/core/test_data/sourceconf.wrongext
include agilepy/testing/unittesting/core/test_data/AGILE_test_datacoverage
include agilepy/testing/unittesting/core/test_out/.gitkeep
Expand All @@ -11,6 +14,7 @@ recursive-include * *.xml
recursive-include * *.source
recursive-include * *.sh
recursive-include * *.txt
recursive-include * *.csv
recursive-include * *.ipynb
recursive-include * *.cts.gz
recursive-include * *.coveragerc
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@

Agilepy is an open-source Python package developed at INAF/OAS Bologna to analyse AGILE/GRID data built on top of the command-line version of the AGILE/GRID Science Tools.

Agilepy is a user-friendly Python interface designed to simplify AGILE/GRID data analysis by streamlining task configuration and data accessibility. With Agilepy, you can easily generate and display sky maps and light curves, access gamma-ray source catalogues, perform spectral model and position fitting (including background evaluation), analyze aperture photometry, and use wavelet analysis. Additionally, Agilepy offers an engineering interface that enables the analysis of AGILE's off-axis viewing angle time evolution for a specific sky region, comparing it with Fermi/LAT off-axis evolution.
Agilepy is a user-friendly Python interface designed to simplify AGILE/GRID data analysis by streamlining task configuration and data accessibility.
With Agilepy, you can easily generate and display sky maps and light curves, access gamma-ray source catalogues, perform spectral model and position fitting (including background evaluation), analyze aperture photometry, use wavelet and bayesian blocks analysis.
Additionally, Agilepy offers a visibility interface that enables the analysis of AGILE's off-axis viewing angle time evolution for a specific sky region, comparing it with Fermi/LAT off-axis evolution.
The analysis of the AGILE Scientific Ratemeters is also possible.


* Documentation: [https://agilepy.readthedocs.io](https://agilepy.readthedocs.io)
Expand Down
35 changes: 26 additions & 9 deletions agilepy/api/AGAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
import os
import re
import numpy as np
# from tqdm import tqdm, trange

from astropy.table import Table
from tqdm.notebook import trange, tqdm
from time import time
from pathlib import Path
Expand Down Expand Up @@ -101,6 +102,10 @@ def __init__(self, configurationFilePath, sourcesFilePath = None):
"mle" : None,
"ap" : None
}
self.lightCurveTable = {
"mle" : None,
"ap" : None
}

self.multiTool = Multi("AG_multi", self.logger)

Expand Down Expand Up @@ -159,7 +164,6 @@ def getConfiguration(confFilePath, userName, sourceName, tmin, tmax, timetype, g
output:
outdir: {outputDir}
filenameprefix: analysis_product
logfilenameprefix: analysis_log
sourcename: {sourceName}
username: {userName}
verboselvl: {verboselvl}
Expand Down Expand Up @@ -955,7 +959,6 @@ def lightCurveMLE(self, sourceName, tmin = None, tmax = None, timetype = None, b
(_, last) = Utils._getFirstAndLastLineInFile(configBKP.getConf("input", "evtfile"))
idxTmax = float(Utils._extractTimes(last)[1])

# logFilenamePrefix = configBKP.getConf("output","logfilenameprefix")
# verboseLvl = configBKP.getConf("output","verboselvl")

self.logger.info( f"[LC] Number of processes: {processes}, Number of bins per process {len(binsForProcesses[0])}")
Expand Down Expand Up @@ -994,9 +997,8 @@ def lightCurveMLE(self, sourceName, tmin = None, tmax = None, timetype = None, b
"""
processes = []
for pID, pInputs in enumerate(binsForProcesses):
logFilenamePrefix += f"_thread_{pID}"
self.logger.info("generating process...(%d). Chunk size for process: %d"%(pID, len(pInputs)))
p = Process(target=self._computeLcBin, args=(pID, pInputs, configBKP, lcAnalysisDataDir, logsOutDir, logFilenamePrefix, verboseLvl))
p = Process(target=self._computeLcBin, args=(pID, pInputs, configBKP, lcAnalysisDataDir, logsOutDir, verboseLvl))
processes.append((pID,p,len(pInputs)))

for pID, p, binsNumber in processes:
Expand All @@ -1019,6 +1021,10 @@ def lightCurveMLE(self, sourceName, tmin = None, tmax = None, timetype = None, b
self.logger.info( "Took %f seconds.", time()-timeStart)

self.lightCurveData["mle"] = str(lcOutputFilePath)

# Data Table
lc_table = Table.read(lcOutputFilePath, format='ascii')
self.lightCurveTable["mle"] = lc_table

return str(lcOutputFilePath)

Expand All @@ -1043,9 +1049,20 @@ def aperturePhotometry(self):
products = apTool.call()
self.logger.info( f"Science tool AP produced:\n {products}")

self.lightCurveData["ap"] = products[0]
try:
self.lightCurveData["ap"] = products[0]
file_name = products[0]
file_optional = products[1]
except KeyError:
# This happens if the file already exists
file_name = self.lightCurveData["ap"]
file_optional = None

# Read table
lc_table = Table.read(file_name, format='ascii', names=["tmin_TT","tmax_TT","exposure","counts"])
self.lightCurveTable["ap"] = lc_table

return products[0], products[1]
return file_name, file_optional


############################################################################
Expand Down Expand Up @@ -1381,11 +1398,11 @@ def _updateFovMinMaxValues(fovbinnumber, fovradmin, fovradmax, stepi):

"""
The light curve data generation could be parallalezed..
def _computeLcBin(self, threadID, bins, configBKP, lcAnalysisDataDir, logsOutDir, logFilenamePrefix, verboseLvl):
def _computeLcBin(self, threadID, bins, configBKP, lcAnalysisDataDir, logsOutDir, verboseLvl):

logger = AgilepyLogger()

logger.initialize(logsOutDir, logFilenamePrefix, verboseLvl)
logger.initialize(logsOutDir, verboseLvl)

# outputs = []

Expand Down
1 change: 0 additions & 1 deletion agilepy/api/AGAnalysisWavelet.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def getConfiguration(confFilePath, userName, outputDir, verboselvl, ctsmap, scal
output:
outdir: %s
filenameprefix: wavelet_product
logfilenameprefix: eng_log
username: %s
sourcename: wavelet
verboselvl: %d
Expand Down
Loading