Skip to content

Commit 5307bd4

Browse files
committed
Merge branch 'main' of github.com:ljfp/NASASpaceAppsChallenge2025
2 parents 3093b4f + d57eb4a commit 5307bd4

6 files changed

Lines changed: 49 additions & 820 deletions

File tree

README.md

Lines changed: 23 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,35 @@
1-
# NASA Sky Data Prototype
1+
# NASA Sky Explorer Prototype
22

3-
Prototype utilities for building an ESASky-like explorer backed exclusively by public NASA archives. The initial focus is on downloading survey cutouts and generating quick-look imagery from NASA's **SkyView** service, which federates data from multiple missions (DSS, GALEX, WISE, 2MASS, Fermi, ROSAT, etc.).
3+
A barebones FastAPI project that serves the landing page for the NASA Sky Explorer Prototype
44

5-
## 🚀 Goals
5+
## Quickstart
66

7-
- Help you discover NASA-managed astronomical data that can power a visual explorer.
8-
- Provide a reproducible script that fetches science-ready survey tiles and converts them into PNG previews.
9-
- Document next steps for evolving the prototype into a richer web or desktop application.
7+
1. Create a virtual environment and install the dependencies:
108

11-
## 📡 Key NASA Data Sources
9+
```bash
10+
python -m venv .venv
11+
source .venv/bin/activate
12+
pip install -r requirements.txt
13+
```
1214

13-
| Archive | What you get | Programmatic access |
14-
| --- | --- | --- |
15-
| [NASA SkyView](https://skyview.gsfc.nasa.gov/current/cgi/titlepage.pl) | On-the-fly projection of surveys (optical, IR, UV, X-ray, gamma) | HTTP service + [`astroquery.skyview`](https://astroquery.readthedocs.io/en/latest/skyview/skyview.html) |
16-
| [Mikulski Archive for Space Telescopes (MAST)](https://archive.stsci.edu/) | HST, JWST, Kepler/K2, TESS, GALEX, etc. | [`astroquery.mast`](https://astroquery.readthedocs.io/en/latest/mast/mast.html) APIs |
17-
| [High Energy Astrophysics Science Archive Research Center (HEASARC)](https://heasarc.gsfc.nasa.gov/docs/archive.html) | Chandra, XMM-Newton, Swift, Fermi, ROSAT, etc. | [`astroquery.heasarc`](https://astroquery.readthedocs.io/en/latest/heasarc/heasarc.html), TAP |
18-
| [Planetary Data System (PDS)](https://pds.nasa.gov/) | Planetary mission data (images, spectra, telemetry) | [PDS Imaging Node APIs](https://pds-imaging.jpl.nasa.gov/help/), [PDS Search](https://pds.nasa.gov/services/search/) |
19-
| [NASA/IPAC Infrared Science Archive (IRSA)](https://irsa.ipac.caltech.edu/frontpage/) | WISE/NEOWISE, Spitzer, 2MASS, Planck, etc. | [`astroquery.irsa`](https://astroquery.readthedocs.io/en/latest/irsa/irsa.html), VO TAP |
20-
| [NASA Open Data Portal](https://data.nasa.gov/) | Curated datasets across NASA centers | REST API + CSV/JSON exports |
15+
2. Launch the development server:
2116

22-
> Some APIs (e.g. MAST, NASA Open APIs) require a free API key or authentication token. The SkyView service used in this prototype is fully open and anonymous.
17+
```bash
18+
uvicorn src.server:app --reload
19+
```
2320

24-
## 🧭 Prototype walkthrough
21+
3. Open <http://127.0.0.1:8000/> in your browser to view the page titled **“Minimal FastAPI App.”**
2522

26-
### 1. Create an isolated environment
23+
## Project structure
2724

28-
```bash
29-
python -m venv .venv
30-
source .venv/bin/activate
31-
pip install -r requirements.txt
3225
```
33-
34-
### 2. Fetch a survey cutout and generate a PNG
35-
36-
The CLI accepts either a resolvable object name or explicit coordinates. A DSS2 Red cutout of the Whirlpool Galaxy at 0.4° scale can be generated with:
37-
38-
```bash
39-
python -m src.skyview_downloader --target "M51" --survey "DSS2 Red" --width 0.4 --pixels 800
40-
```
41-
42-
To target custom celestial coordinates in decimal degrees:
43-
44-
```bash
45-
python -m src.skyview_downloader --ra 201.3651 --dec -43.0191 --survey "WISE 3.4" --width 1.0 --pixels 1024
26+
NASASpaceAppsChallenge2025/
27+
├── requirements.txt # FastAPI and Uvicorn dependencies
28+
├── src/
29+
│ ├── __init__.py
30+
│ └── server.py # FastAPI application serving the HTML page
31+
└── web/
32+
└── index.html # Static HTML served at the root route
4633
```
4734

48-
Outputs are written to `outputs/`:
49-
50-
- `<target>-<survey>.fits` — the raw FITS cutout.
51-
- `<target>-<survey>.png` — contrast-stretched preview (Astropy WCS axes, grayscale colormap).
52-
53-
### 3. Spin up the interactive globe prototype
54-
55-
Launch the FastAPI service, which proxies NASA's SkyView service and serves the front-end assets:
56-
57-
```bash
58-
uvicorn src.server:app --reload
59-
```
60-
61-
Then open <http://127.0.0.1:8000/app> in your browser. Rotate the sphere with your mouse or trackpad, use the zoom buttons to adjust the field of view, and switch between surveys (DSS, WISE, GALEX, Fermi). Every interaction requests a fresh cutout from NASA SkyView, so you're always looking at live archival imagery.
62-
63-
> The backend stores PNG tiles in `outputs/` to avoid re-downloading frequently requested fields.
64-
65-
### 4. Inspect available surveys
66-
67-
NASA maintains the full survey catalogue at <https://skyview.gsfc.nasa.gov/current/cgi/survey.pl>. Any entry in the "Survey" column is compatible with the `--survey` option.
35+
Feel free to build on this foundation for richer APIs or interfaces.

requirements.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
astroquery==0.4.7
2-
astropy==6.0.1
31
fastapi==0.112.1
4-
matplotlib==3.8.4
52
uvicorn[standard]==0.30.1

src/server.py

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,20 @@
1-
"""FastAPI service that proxies NASA SkyView tiles and serves the prototype UI."""
2-
from __future__ import annotations
1+
"""Minimal FastAPI application that serves a static HTML homepage for the NASA Sky Explorer Prototype."""
32

4-
import asyncio
5-
import logging
63
from pathlib import Path
7-
from typing import Optional
84

9-
from fastapi import FastAPI, HTTPException, Query
10-
from fastapi.middleware.cors import CORSMiddleware
11-
from fastapi.responses import FileResponse, JSONResponse, Response
12-
from fastapi.staticfiles import StaticFiles
13-
14-
from .skyview_downloader import fetch_survey_image
5+
from fastapi import FastAPI, HTTPException
6+
from fastapi.responses import HTMLResponse
157

168
BASE_DIR = Path(__file__).resolve().parent.parent
179
WEB_DIR = BASE_DIR / "web"
18-
OUTPUT_DIR = BASE_DIR / "outputs"
19-
FAVICON_PATH = WEB_DIR / "favicon.ico"
20-
21-
logging.basicConfig(
22-
level=logging.INFO,
23-
format="%(asctime)s %(levelname)s [%(name)s] %(message)s",
24-
)
25-
26-
logger = logging.getLogger(__name__)
27-
logger.setLevel(logging.INFO)
10+
INDEX_PATH = WEB_DIR / "index.html"
2811

29-
app = FastAPI(title="NASA SkyView Prototype", version="0.1.0")
30-
app.add_middleware(
31-
CORSMiddleware,
32-
allow_origins=["*"],
33-
allow_credentials=True,
34-
allow_methods=["*"],
35-
allow_headers=["*"],
36-
)
12+
app = FastAPI(title="NASA Sky Explorer Prototype")
3713

38-
if WEB_DIR.exists():
39-
app.mount("/app", StaticFiles(directory=WEB_DIR, html=True), name="app")
4014

41-
42-
@app.get("/favicon.ico", include_in_schema=False)
43-
async def favicon() -> Response:
44-
if FAVICON_PATH.exists():
45-
return FileResponse(FAVICON_PATH)
46-
return Response(status_code=204)
15+
@app.get("/", response_class=HTMLResponse)
16+
def read_index() -> str:
17+
"""Return the contents of the bundled ``index.html`` file."""
4718

4819

4920
@app.get("/aladin")
@@ -117,11 +88,6 @@ async def get_tile(
11788
if __name__ == "__main__":
11889
import uvicorn
11990

120-
logging.basicConfig(
121-
level=logging.INFO,
122-
format="%(asctime)s %(levelname)s [%(name)s] %(message)s",
123-
)
124-
12591
uvicorn.run(
12692
"src.server:app",
12793
host="0.0.0.0",

0 commit comments

Comments
 (0)