# Goldshtein bat explorer export

This static export is derived from the real tracking tables and saved **R/brms v2** posterior fits. It is not simulated data, a browser refit, or an export of the Python/PyMC fit.

## Pinned inputs

- `jgraving/unwrap`: `a88980215555a0169483aad7fbf6ac826b7121db`
- `jgraving/unwrap-data`: `211be00604093b2c6c8f441efd5fb27f4a6b361a`
- Data: `goldshtein_bats/dataAll_trackDest.xls`, `all_bats_info.xls`, and `agamon_hula_lake_outline.geojson`.
- Fits: `fit_cache/bats_fit_vm_v2.rds`, `fit_cache/bats_fit_mix_v2.rds`.
- Model specification and saved PSIS-LOO table: `notebooks_r/goldshtein_bats.ipynb` (comparison output in cell index 48).

Full source file SHA-256 digests are included under `provenance.sha256` in the JSON. The site exporter is `scripts/export_goldshtein_bats.py`.

## Reproduce

Use local checkouts at the pinned commits, with Python dependencies `numpy`, `pandas`, `scipy`, `rdata==1.1.0`, `xlrd`, `geopandas`, `pyproj`, `shapely`, and `tqdm`. Pandas 2.2/2.3 and xlrd 2.0.1 are sufficient.

```sh
python scripts/export_goldshtein_bats.py --unwrap /path/to/unwrap --data /path/to/unwrap-data
node --test tests/goldshtein-bats.test.cjs
```

The exporter uses the upstream 60 m resampling and harmonic lake-reference preprocessing. It checks the retained tag order, treatment, and circular response against **both** cached fitting tables. All 4,942 headings match; the maximum pre-rounding angular difference is about 2.83e-10 radians. No sampling settings, priors, or fits are changed. R environments are never executed. The narrow `rdata` sentinel compatibility adapter is explained in the script.

## Schema

Coordinates are UTM EPSG:32636, in meters. Angles are radians with 0 north and positive clockwise unless noted otherwise. `angles` is a 145-point relative-bearing density grid on [-pi, pi], including the repeated endpoint.

Each track contains `id`, one-based `treatment`, `destination` (`roost`/`lake`), number of usable headings `n`, `points`, and `fits.vm`/`fits.mix`.

Point columns, in order:

1. x / easting (m)
2. y / northing (m)
3. goal-relative observed bearing (radians)
4. local destination reference (radians)
5. absolute movement bearing (radians)
6. posterior mean conditional responsibility of the concentrated mixture component
7. single-von-Mises log posterior predictive density
8. mixture log posterior predictive density
9. gap-before flag (0/1)
10. usable-in-fit flag (0/1)

Missing quantities are JSON `null`. Every resampled position is retained for mapping; only usable headings enter histograms and the heading selector. Gaps are dashed. The original fitted table includes some gap-crossing bearings; those are retained and identified, not silently dropped.

`mu`, `kappa`, and `weight` contain [5th percentile, median, 95th percentile]. `mu` is in **degrees**, unwrapped about its circular posterior mean before taking quantiles. `density` contains [5th-percentile curve, posterior-mean curve, 95th-percentile curve]. `goal` is the mean **weighted** concentrated density, and `background` is the mean uniform density. Both components sum to the mean total density. All summaries use all 8,000 retained posterior draws, four chains of 2,000 draws with zero saved warmup. Densities are per radian.

`population` uses treatment effects with individual effects set to zero. It does not integrate over a new-animal distribution. Individual summaries include that animal's fitted effects. `loo` copies the saved notebook's PSIS-LOO table; it is not a new LOO calculation.

## Interpretation

- A 90% pointwise posterior density band is uncertainty about the fitted density, not an interval containing 90% of headings.
- Membership is the average conditional responsibility over posterior draws, not a ratio of posterior-mean densities and not an observed internal behavioral state.
- Log predictive density is log(mean posterior density), not mean(log density) or a held-out likelihood. It can be positive.
- The sample represents retained usable tracks, not all released bats or their return-success rate.
- Population weights concern sampled headings and approximately traveled distance, not flight time.
- Serial dependence is not explicitly modeled. The two model specifications also differ in angular hierarchy and concentration prior.
- The notebook reports absent divergence information and a convergence helper that flattened chains. This export does not claim verified sampling convergence.

Original study: Goldshtein et al. (2024), *Acoustic cognitive map-based navigation in echolocating bats*, Science 386(6721), 561–567. https://doi.org/10.1126/science.adn6269
