{"id":48320906,"url":"https://github.com/cphyc/halo-viewer","last_synced_at":"2026-04-05T00:39:50.202Z","repository":{"id":324237723,"uuid":"1096510176","full_name":"cphyc/halo-viewer","owner":"cphyc","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-12T18:04:01.000Z","size":287,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-12T23:01:02.136Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cphyc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-14T14:30:23.000Z","updated_at":"2026-02-12T18:05:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/cphyc/halo-viewer","commit_stats":null,"previous_names":["cphyc/halo-viewer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cphyc/halo-viewer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cphyc%2Fhalo-viewer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cphyc%2Fhalo-viewer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cphyc%2Fhalo-viewer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cphyc%2Fhalo-viewer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cphyc","download_url":"https://codeload.github.com/cphyc/halo-viewer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cphyc%2Fhalo-viewer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31420530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T00:25:07.052Z","status":"ssl_error","status_checked_at":"2026-04-05T00:25:05.923Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-05T00:39:49.623Z","updated_at":"2026-04-05T00:39:50.190Z","avatar_url":"https://github.com/cphyc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Megatron Data Viewer\n\nThis repository contains a web-based viewer for visualizing Megatron simulation data.\n\nIt is built using React, and allows to interact with the data through a web interface without the need to install any software\non the webserver (apart from a static file server).\n\n## Features\n- 3D visualization of halo catalogues using [three.js](https://threejs.org/),\n- Display of content of halo catalogues,\n- Display of precomputed data (e.g., images and spectra),\n- Interactive Python environment running in the browser using [Pyodide](https://pyodide.org/en/stable/) and [yt](https://yt-project.org/).\n\n## Installation\n\nIn order to use the viewer, you need to have a working distribution of Python 3 and npm installed on your system.\nWe assume you have `uv` installed. If not, follow the instructions at https://docs.astral.sh/uv/getting-started/installation/#installation-methods.\n\n## Cloning the repository\n```bash\n# Clone the repository\ngit clone https://github.com/cphyc/halo-viewer.git\ncd halo-viewer\n\n# Initialize submodules\ngit submodule update --init --recursive\n```\n\n## Setting up Pyodide\n\nThe viewer uses Pyodide to run Python in the browser. Download and extract version 0.29.3:\n\n```bash\n# Download and extract Pyodide\n(\n  cd public\n  wget https://github.com/pyodide/pyodide/releases/download/0.29.3/pyodide-0.29.3.tar.bz2\n  tar -xjf pyodide-0.29.3.tar.bz2\n  mv pyodide pyodide-0.29.3\n  rm pyodide-0.29.3.tar.bz2\n)\n```\n\n### Updating Pyodide to a newer version\n\n1. Download from [Pyodide releases](https://github.com/pyodide/pyodide/releases)\n2. Extract to `public/pyodide-X.Y.Z/`\n3. Update `indexURL` in `src/pyodide/pyWorker.ts`\n4. Update `pyodide` version in `package.json`\n5. Run `npm install`\n\n## Building 'wheels'\n\nThe viewer includes a Python environment running in the browser. This allows\ninteracting with the cutouts (raw data products) using Python code.\nIt, however, requires two packages to be shipped as pre-compiled wheels:\n`yt_derived_fields` and `yt_experiments`.\n\n```bash\n# Create wheels for yt_derived_fields\n(\n  cd external/yt_derived_fields\n  uv build --wheel -o ../../../public/wheels/\n)\n\n# Create pyodide wheels for yt_experiments\n(\n  cd external/yt_experiments\n  uvx cibuildwheel --platform pyodide\n  cp wheelhouse/*.whl ../../../public/wheels/\n)\n```\n\n## Building the web application\n\nFirst, you'll need to create a local environment file, `.env.local`,\nin the root of the repository. This file should contain the base URL\nwhere your data is hosted.\n\n```bash\n# // File .env.local\n\n# This is the base URL where the data is hosted. For example,\n# if your data is hosted at https://example.com/data/,\n# set BASE_URL to https://example.com/data/\nBASE_URL=\n\n# Don't change the line below unless you know what you're doing\nVITE_DATA_BASE_URL=${BASE_URL}\n```\n\nOnce this is done, you can build the application using npm:\n```bash\n# Install dependencies\nnpm install\n# Build the application\nnpm run build\n```\n\nAnd voilà! Your application is ready to be deployed.\n\n### Testing locally\n\nYou can test the application locally using\n```bash\nnpm run dev\n```\n\nAlternatively, after you've built the application (see previous section), you can serve the local folder, e.g. with\n```bash\npython -m http.server\n```\n\nDon't forget to modify the `.env.local` file to use the same port as the one used by the Python server (default is 8000).\n\n## Configuring Data Resources\n\nThe viewer supports dynamic configuration of data resources through a `resources.json` file in the `public/` folder. This allows you to define what data types (1D, 2D, 3D) are available for each halo without modifying the code.\n\n### Resource Configuration\n\nCreate or edit `public/resources.json` to define available resources. The schema is defined in `public/resources.schema.json`.\n\nExample configuration (also available as `public/resources.example.json`):\n\n```json\n{\n  \"$schema\": \"./resources.schema.json\",\n  \"resources\": [\n    {\n      \"id\": \"spectrum\",\n      \"name\": \"Spectrum\",\n      \"type\": \"1D\",\n      \"bundled\": true,\n      \"pathTemplate\": \"demo-halos/spectra/output_00100/halos_{bucketId}.json.gz\",\n      \"dataKey\": \"total\",\n      \"xAxis\": {\n        \"label\": \"λ\",\n        \"unit\": \"Å\",\n        \"key\": \"wavelength\"\n      },\n      \"yAxis\": {\n        \"label\": \"fλ\",\n        \"unit\": \"arbitrary units\",\n        \"key\": \"data\"\n      },\n      \"downloadable\": true\n    }\n  ]\n}\n```\n\n### Resource Types\n\n- **1D data**: Line plots (e.g., spectra, time series)\n- **2D data**: Images (e.g., projections, slices) - *coming soon*\n- **3D data**: Data cubes (e.g., position-position-velocity) - *coming soon*\n\n### Bundled vs Non-bundled Resources\n\n- **Bundled** (`bundled: true`): Multiple halos stored in a single file. Use `{bucketId}` in `pathTemplate` for bucket-based organization (e.g., `haloId / 1000`).\n- **Non-bundled** (`bundled: false`): One file per halo. Use `{haloId}` in `pathTemplate`.\n\n### Data Download\n\nEach resource card includes a download button that exports the data as JSON. For bundled resources, the data is automatically unbundled to provide only the selected halo's data.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcphyc%2Fhalo-viewer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcphyc%2Fhalo-viewer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcphyc%2Fhalo-viewer/lists"}