How matteobachetti/toaextractor works
Project type and purpose
• Type: Open-source Python library/tool built on the Astropy ecosystem.
• Purpose: Ingest pulsar event data, compute Times Of Arrival (TOAs) and timing residuals, then produce summary tables and plots.
File structure
• Top-level:
• setup.py, pyproject.toml, setup.cfg → packaging / installation
• tox.ini, .github/workflows → CI/CD
• README.rst, docs/ → user documentation
• Core package: toa_extractor/
• pipeline.py – orchestrates the main TOA-extraction workflow
• plotting.py – plotting routines for residuals and profiles
• summary.py – collates results into tables/reports
• data_setup.py, data/ – built-in templates and example ECVS catalogs
• utils/ – helper modules (config management, data slicing, FFT fitting, folding, profile fitting)
• Tests: toa_extractor/tests/ and toa_extractor/utils/tests/ for unit and integration tests.
Extract insights from the README
• Emphasis on Astropy as a foundational dependency.
• Core functionality: reading event files, template profiles, folding, FFT-based fitting, TOA/residual calculation.
a. User Interface / Entry Points
– CLI or Python API calls (e.g. toa_extractor.pipeline.run(...))
b. Data Inputs
– Raw event files (FITS, .evt, .evt.gz)
– Template definitions (ECSV, YAML)
c. Processing Engine
– pipeline.py: high-level workflow
– data_setup.py: loads templates & data catalogs
– Utils sub-modules:
· data_manipulation.py (slice/filter events)
· fold.py (phase-folding routines)
· fftfit.py, fit_crab_profiles.py (profile fitting)
· config.py (runtime configuration)
d. Results / Output
– TOA tables (ECSV, ASCII) via summary.py
– Residual plots via plotting.py
e. External Dependencies
– Astropy (I/O, table structures, FITS handling)
– NumPy, SciPy (numerical routines)
– Matplotlib (plotting)
f. Quality & Packaging
– Test suite (pytest)
– CI workflows (.github/workflows)
– Documentation build (Sphinx under docs/)
Relationships and data flows
• CI & Docs can be shown as side modules that consume source code but do not affect runtime flow.
Architectural patterns and design principles
• Modular design: clear separation between orchestration (pipeline.py), utilities, and I/O
• Plug-in style for templates & data via data/ and config files → extensibility
• Test isolation: each utils module has its own test folder