{ "nbformat": 4, "nbformat_minor": 5, "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.11.0" } }, "cells": [ { "cell_type": "markdown", "id": "intro", "metadata": {}, "source": [ "# Meteorites vs UFOs: Detection Bias Study\n", "\n", "1,279 records across 3 datasets exploring observation bias in sky-watching phenomena:\n", "- `temporal_comparison`: Year-by-year meteorite falls vs UFO reports (1900\u20132023)\n", "- `state_comparison`: 58 US states, UFO-per-meteorite ratio\n", "- `meteorite_detail`: 1,097 individual witnessed falls\n", "\n", "**Dataset**: [github.com/lukeslp/meteorites-ufos-detection-bias](https://github.com/lukeslp/meteorites-ufos-detection-bias)" ] }, { "cell_type": "code", "execution_count": null, "id": "imports", "metadata": {}, "outputs": [], "source": [ "import json\n", "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "import matplotlib.ticker as mticker\n", "import numpy as np\n", "\n", "plt.style.use('seaborn-v0_8-whitegrid')\n", "plt.rcParams['figure.figsize'] = (14, 5)\n", "plt.rcParams['font.size'] = 11\n", "print('Libraries loaded')" ] }, { "cell_type": "markdown", "id": "load-h", "metadata": {}, "source": [ "## 1. Load Data" ] }, { "cell_type": "code", "execution_count": null, "id": "load", "metadata": {}, "outputs": [], "source": [ "with open('meteorites_ufos_detection_bias.json') as f:\n", " data = json.load(f)\n", "\n", "temporal = pd.DataFrame(data['temporal_comparison'])\n", "states = pd.DataFrame(data['state_comparison'])\n", "meteorites = pd.DataFrame(data['meteorite_detail'])\n", "\n", "print(f'Temporal records: {len(temporal)} (years {temporal.year.min()}-{temporal.year.max()})')\n", "print(f'State records: {len(states)}')\n", "print(f'Meteorite detail records: {len(meteorites)}')\n", "temporal.head(3)" ] }, { "cell_type": "markdown", "id": "temporal-h", "metadata": {}, "source": [ "## 2. Temporal Trends: UFO Reports vs Meteorite Falls (1900\u20132023)" ] }, { "cell_type": "code", "execution_count": null, "id": "temporal", "metadata": {}, "outputs": [], "source": [ "fig, ax1 = plt.subplots(figsize=(14, 6))\n", "\n", "ax2 = ax1.twinx()\n", "ax1.fill_between(temporal['year'], temporal['ufo_sightings'], alpha=0.25, color='#FF6B35', label='UFO sightings')\n", "ax1.plot(temporal['year'], temporal['ufo_sightings'], color='#FF6B35', linewidth=1.5, label='UFO sightings')\n", "ax2.bar(temporal['year'], temporal['meteorite_falls'], alpha=0.6, color='#2196F3', width=0.8, label='Meteorite falls')\n", "\n", "ax1.set_xlabel('Year')\n", "ax1.set_ylabel('UFO Sightings (NUFORC)', color='#FF6B35')\n", "ax2.set_ylabel('Witnessed Meteorite Falls (NASA)', color='#2196F3')\n", "ax1.set_title('UFO Reports vs Meteorite Falls (1900\u20132023)', fontsize=14, fontweight='bold', pad=12)\n", "ax1.yaxis.set_major_formatter(mticker.FuncFormatter(lambda x, _: f'{x:,.0f}'))\n", "\n", "# Mark key events\n", "ax1.axvline(1947, color='purple', linestyle='--', alpha=0.5, label='Roswell (1947)')\n", "ax1.axvline(1993, color='green', linestyle='--', alpha=0.5, label='X-Files debut (1993)')\n", "\n", "lines1, labels1 = ax1.get_legend_handles_labels()\n", "lines2, labels2 = ax2.get_legend_handles_labels()\n", "ax1.legend(lines1 + lines2, labels1 + labels2, loc='upper left', fontsize=9)\n", "\n", "plt.tight_layout()\n", "plt.show()" ] }, { "cell_type": "markdown", "id": "state-h", "metadata": {}, "source": [ "## 3. State-Level UFO-per-Meteorite Ratio (Top 20 States)" ] }, { "cell_type": "code", "execution_count": null, "id": "state-chart", "metadata": {}, "outputs": [], "source": [ "# Filter states with valid ratios and sort\n", "states_valid = states.dropna(subset=['ufo_per_meteorite']).sort_values('ufo_per_meteorite', ascending=False)\n", "top20 = states_valid.head(20)\n", "\n", "fig, ax = plt.subplots(figsize=(14, 8))\n", "colors = ['#FF4444' if v > 1000 else '#FF9800' if v > 100 else '#4CAF50' for v in top20['ufo_per_meteorite']]\n", "bars = ax.barh(top20['state'][::-1], top20['ufo_per_meteorite'][::-1], color=colors[::-1])\n", "\n", "ax.set_xlabel('UFO Reports per Witnessed Meteorite Fall')\n", "ax.set_title('Detection Bias: UFO Reports per Meteorite Fall by State', fontsize=14, fontweight='bold', pad=12)\n", "ax.xaxis.set_major_formatter(mticker.FuncFormatter(lambda x, _: f'{x:,.0f}'))\n", "\n", "for bar, (_, row) in zip(bars[::-1], top20.iterrows()):\n", " ax.text(bar.get_width() + 10, bar.get_y() + bar.get_height()/2,\n", " f'{row[\"ufo_per_meteorite\"]:,.0f}x', va='center', fontsize=9)\n", "\n", "plt.tight_layout()\n", "plt.show()\n", "\n", "print('Top 5 most biased states:')\n", "print(top20[['state','meteorite_falls','ufo_sightings','ufo_per_meteorite']].head(5).to_string(index=False))" ] }, { "cell_type": "markdown", "id": "meteor-h", "metadata": {}, "source": [ "## 4. Meteorite Fall Locations & Mass Distribution" ] }, { "cell_type": "code", "execution_count": null, "id": "meteor-scatter", "metadata": {}, "outputs": [], "source": [ "# Filter to valid coordinates\n", "m_valid = meteorites.dropna(subset=['latitude', 'longitude', 'mass_g'])\n", "m_valid = m_valid[(m_valid['latitude'].between(-90, 90)) & (m_valid['longitude'].between(-180, 180))]\n", "\n", "fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(16, 6))\n", "\n", "# Scatter map\n", "sizes = np.sqrt(m_valid['mass_g'].clip(100, 1e8)) / 10\n", "ax1.scatter(m_valid['longitude'], m_valid['latitude'], s=sizes, alpha=0.5, color='#FF6B35', edgecolor='none')\n", "ax1.set_xlim(-180, 180)\n", "ax1.set_ylim(-90, 90)\n", "ax1.axhline(0, color='gray', linewidth=0.5)\n", "ax1.axvline(0, color='gray', linewidth=0.5)\n", "ax1.set_title(f'Witnessed Meteorite Falls (n={len(m_valid):,})', fontsize=13, fontweight='bold')\n", "ax1.set_xlabel('Longitude')\n", "ax1.set_ylabel('Latitude')\n", "\n", "# Mass histogram (log scale)\n", "ax2.hist(np.log10(m_valid['mass_g'].clip(lower=1)), bins=40, color='#2196F3', edgecolor='white', linewidth=0.5)\n", "ax2.set_title('Meteorite Mass Distribution (log scale)', fontsize=13, fontweight='bold')\n", "ax2.set_xlabel('log10(mass in grams)')\n", "ax2.set_ylabel('Count')\n", "ax2.set_xticks(range(0, 9))\n", "ax2.set_xticklabels(['1g', '10g', '100g', '1kg', '10kg', '100kg', '1t', '10t', '100t'])\n", "\n", "plt.tight_layout()\n", "plt.show()" ] }, { "cell_type": "markdown", "id": "bias-h", "metadata": {}, "source": [ "## 5. Detection Bias Summary Table" ] }, { "cell_type": "code", "execution_count": null, "id": "bias-table", "metadata": {}, "outputs": [], "source": [ "# Top 10 most 'biased' states\n", "ranked = states.dropna(subset=['ufo_per_meteorite']).sort_values('ufo_per_meteorite', ascending=False)\n", "\n", "print('=== Top 10 Most \"Biased\" States (UFO reports per meteorite fall) ===')\n", "top10 = ranked.head(10)[['state', 'meteorite_falls', 'ufo_sightings', 'ufo_per_meteorite']].copy()\n", "top10.columns = ['State', 'Meteorite Falls', 'UFO Reports', 'UFO per Meteorite']\n", "top10['UFO per Meteorite'] = top10['UFO per Meteorite'].apply(lambda x: f'{x:,.0f}x')\n", "print(top10.to_string(index=False))\n", "\n", "print('\\n=== Key Observations ===')\n", "total_ufo = states['ufo_sightings'].sum()\n", "total_met = states['meteorite_falls'].sum()\n", "print(f'Total US UFO reports: {total_ufo:,}')\n", "print(f'Total US witnessed meteorite falls: {total_met}')\n", "print(f'Overall US ratio: {total_ufo/total_met:.0f} UFO reports per meteorite fall')\n", "print(f'\\nPost-1990s UFO surge: {temporal[temporal.year >= 1990][\"ufo_sightings\"].sum():,} reports vs {temporal[temporal.year < 1990][\"ufo_sightings\"].sum():,} before 1990')" ] } ] }