Spaces:
Sleeping

File size: 3,641 Bytes
81e12ec
 
 
 
 
 
 
 
 
 
dc6bacd
 
 
 
0c3044a
dc6bacd
81e12ec
 
33df543
 
35de79c
33df543
 
dc6bacd
 
 
7494a58
dc6bacd
 
 
 
 
7494a58
dc6bacd
 
71192b4
dc6bacd
 
 
71192b4
dc6bacd
 
 
 
 
8a62125
 
 
 
 
07ed642
 
8a62125
 
 
 
6590d03
8a62125
 
 
 
 
07ed642
8a62125
dc6bacd
 
 
 
 
 
 
 
7494a58
 
33815f1
dc6bacd
 
07ed642
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dc6bacd
 
7494a58
 
 
71192b4
7494a58
 
 
 
 
 
dc6bacd
 
71192b4
dc6bacd
 
 
71192b4
0c3044a
35de79c
dc6bacd
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
---
title: Jellyscope
emoji: πŸ”­
colorFrom: indigo
colorTo: pink
sdk: docker
app_port: 5000
pinned: false
---

# Jellyscope

Interactive web application for visualizing JWST jellyfish galaxy datacubes.

Jellyscope lets you explore multi-filter NIRCam datacubes, select regions of galaxies (clumps, tails, disk), and inspect their physical properties.

**Live demo:** <https://huggingface.co/spaces/EAT-Prototypes/jellyscope>

## Requirements

- Python 3.13+
- [uv](https://docs.astral.sh/uv/) package manager

## Installation

```bash
uv sync --extra dev
```

## Usage

```bash
uv run jellyscope --data-dir data
```

Then open <http://127.0.0.1:5000> in your browser.

### Options

```plaintext
--host HOST       Server host (default: 127.0.0.1)
--port PORT       Server port (default: 5000)
--data-dir DIR    Path to data directory (default: data)
```

## Run with Docker

Alternatively, run Jellyscope as a containerized service via Docker Compose. No local Python or `uv` required β€” only Docker.

```bash
just docker build       # docker compose build
just docker up          # docker compose up -d
```

Then open <http://localhost:5000>.

The local `./data/` directory is bind-mounted read-only at `/data` inside the container. Override CLI flags ad-hoc:

```bash
docker compose run --rm jellyscope --help
```

Tear down with `just docker down`.

## Data Format

Place your data in the `data/` directory:

- **FITS datacubes** β€” 3D arrays with shape `(n_filters, ny, nx)` and `FILTER1..FILTERn` header keys
- **clumps_properties.csv** β€” Columns: `clump_id, area_pix, area_arcsec2, r_eff_arcsec, x0, y0, area_kpc2, r_eff_kpc, inside, component`
- **clumps_pixels.csv** β€” Columns: `clump_id, x, y`

## Development

This project uses modern Python tooling managed via [uv](https://docs.astral.sh/uv/) and a [`justfile`](https://just.systems/) (install with `brew install just` on macOS).

```bash
just                   # List available recipes
just install           # Install deps + set up pre-commit hooks
just check lint        # Run ruff linter
just check lint-fix    # Auto-fix lint issues
just check format      # Format code with ruff
just check typecheck   # Run mypy type checking
just check test        # Run tests with coverage
just check test-fast   # Quick test run (no coverage, stop on first failure)
just check all         # Run ALL checks (lint + format + typecheck + tests)
just check spellcheck  # Check for typos in code/docs
just serve             # Start the dev server
just docker build      # Build the Docker image
just docker up         # Start the containerized service
just docker down       # Stop the containerized service
just docker logs       # Tail container logs
just clean             # Remove build artifacts
```

### Tooling

| Tool | Purpose |
| ------ | --------- |
| [uv](https://docs.astral.sh/uv/) | Package management, venv, lockfile |
| [ruff](https://docs.astral.sh/ruff/) | Linting + formatting |
| [mypy](https://mypy.readthedocs.io/) | Static type checking |
| [pre-commit](https://pre-commit.com/) | Git hooks (lint, format, typecheck before each commit) |
| [codespell](https://github.com/codespell-project/codespell) | Typo detection |

## Project Structure

```plaintext
src/jellyscope/
β”œβ”€β”€ config.py           # Configuration
β”œβ”€β”€ data/               # FITS I/O, clump catalog, data store
β”œβ”€β”€ model/              # Pydantic request/response schemas
β”œβ”€β”€ visualization/      # Plotly figure builders (image, RGB)
β”œβ”€β”€ web/                # FastAPI app, REST API, frontend
└── cli.py              # Command-line entry point
```

## License

MIT