This repository contains a small Flask application for converting angular sizes in arcseconds to projected physical distances in parsecs using a cosmological distance model from Astropy.
The calculator exposes two endpoints:
/– returns a welcome message./calculate– accepts a JSON payload witharcsecandredshiftvalues and returns the corresponding distance in parsecs.
This project began as part of my Master's thesis on dual Active Galactic Nuclei (AGN) and supermassive black holes (SMBHs). The main research focus involved analysing observational X‑ray data from the following telescopes:
- Chandra
- XMM-Newton
- Swift/XRT
- NuSTAR
- Install the required dependencies:
pip install -r requirements.txt
- Start the application using Flask's built-in server:
Or run with Gunicorn (recommended for production):
python theapp.py
gunicorn theapp:app
- Send a POST request to
/calculatewith a JSON body. Example:curl -X POST http://localhost:5000/calculate \ -H 'Content-Type: application/json' \ -d '{"arcsec": 1.0, "redshift": 0.1}'
The response will contain the calculated distance in parsecs.
A basic Procfile and app.yaml are included for deploying the API to cloud platforms that support Gunicorn. Modify them as needed for your environment.
This repository is released under the MIT License. See the LICENSE file for details.