File size: 3,580 Bytes
12d9ea6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1edced1
 
12d9ea6
1edced1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
122
123
124
125
---
license: cc-by-4.0
task_categories:
- other
language:
- en
tags:
- astronomy
- spectroscopy
- galaxies
- desi
- cosmology
size_categories:
- n<1K
---

# DESI DR1 ELG Galaxy Spectra Dataset

This dataset contains 999 Emission Line Galaxy (ELG) spectra from the Dark Energy Spectroscopic Instrument (DESI) Data Release 1, along with associated metadata. This is a curated sample of high-quality galaxy spectra suitable for research and educational purposes in astronomy and cosmology.

## Dataset Contents

- `metadata.csv` - Galaxy properties and catalog information (999 galaxies + header)
- `spectrum_GALAXY_*.json` - Individual spectrum files (999 files)
- `*.py` - Analysis and visualization scripts

## Metadata Columns (`metadata.csv`)

| Column | Description |
|--------|-------------|
| `targetid` | DESI target identifier |
| `galaxy_type` | Galaxy type classification (ELG) |
| `spectype` | Spectroscopic type (GALAXY) |
| `ra`, `dec` | Right ascension and declination (degrees) |
| `redshift` | Spectroscopic redshift |
| `z_bin` | Redshift bin (0.6-0.8, 0.8-1.0) |
| `survey` | DESI survey (main) |
| `program` | Observing program (dark) |
| `healpix` | HEALPix pixel ID |
| `desi_target`, `bgs_target`, `mws_target`, `scnd_target` | DESI targeting bitmasks |

## Spectrum File Format

Each `spectrum_GALAXY_*.json` file contains:

```json
{
  "metadata": {
    "sparcl_id": "UUID",
    "object_type": "GALAXY",
    "redshift": 0.6004,
    "redshift_err": 7.4e-05,
    "ra": 126.957,
    "dec": 3.269,
    "survey": "main",
    "data_release": "DESI-DR1",
    "targetid": 39636661465776861
  },
  "data": {
    "wavelength": [3600.0, 3600.8, ...],  // 7781 points, 3600-9824 Å
    "flux": [...],                        // Observed flux (10⁻¹⁷ erg/s/cm²/Å)
    "model": [...],                       // Best-fit model
    "inverse_variance": [...]             // 1/σ² for flux uncertainties
  }
}
```

## Quick Start

### Load metadata
```python
import pandas as pd
metadata = pd.read_csv('metadata.csv')
print(f"Dataset contains {len(metadata)} ELG galaxies")
print(f"Redshift range: {metadata['redshift'].min():.3f} - {metadata['redshift'].max():.3f}")
```

### Load a spectrum
```python
import json
import numpy as np

# Load spectrum file
with open('spectrum_GALAXY_0.6004_7006c68c_20250811_152534.json', 'r') as f:
    spectrum = json.load(f)

# Extract data
wavelength = np.array(spectrum['data']['wavelength'])
flux = np.array(spectrum['data']['flux'])
model = np.array(spectrum['data']['model'])
redshift = spectrum['metadata']['redshift']

print(f"Galaxy at z={redshift:.4f}")
print(f"Spectrum covers {wavelength[0]:.0f}-{wavelength[-1]:.0f} Å")
```

### Plot a spectrum
```python
import matplotlib.pyplot as plt

plt.figure(figsize=(12, 6))
plt.plot(wavelength, flux, 'k-', alpha=0.7, label='Observed')
plt.plot(wavelength, model, 'r-', label='Model')
plt.xlabel('Wavelength (Å)')
plt.ylabel('Flux (10⁻¹⁷ erg/s/cm²/Å)')
plt.title(f'DESI ELG Spectrum (z={redshift:.4f})')
plt.legend()
plt.grid(True, alpha=0.3)
plt.show()
```

## Analysis Scripts

- `plot_desi_spectra.py` - Create multi-panel spectrum plots and redshift distributions
- `sample_elg_galaxies.py` - Original sampling script for ELG selection
- `spectrum_downloader.py` - Script used to download spectra from DESI archives

## Dataset Statistics

- **Total galaxies**: 999
- **Redshift range**: 0.600 - 0.948
- **Spectral coverage**: 3600 - 9824 Å (7781 wavelength points)
- **Galaxy type**: Emission Line Galaxies (ELGs)
- **Survey**: DESI Main Survey (dark time program)