This repository contains the SPARC (Spitzer Photometry and Accurate Rotation Curves) database converted into JSON format for easy usage in Jupyter Notebooks and other analysis tools.
sparc_data/: Contains the original.datfiles from the SPARC database.sparc_full.json: Contains the aggregated data for all galaxies in a single file.convert_to_json.py: Python script used to perform the conversion.
Each JSON file represents a galaxy and follows this structure:
{
"meta": {
"galaxy_name": "GalaxyName",
"distance": 12.3,
"distance_unit": "Mpc"
},
"columns": ["Rad", "Vobs", "errV", "Vgas", "Vdisk", "Vbul", "SBdisk", "SBbul"],
"units": ["kpc", "km/s", "km/s", "km/s", "km/s", "km/s", "L/pc^2", "L/pc^2"],
"data": [
[0.1, 10.5, 2.1, ...],
[0.2, 20.3, 1.5, ...]
]
}- Rad: Radius (kpc)
- Vobs: Observed rotation velocity (km/s)
- errV: Uncertainty in observed velocity (km/s)
- Vgas: Velocity contribution from gas (km/s)
- Vdisk: Velocity contribution from the stellar disk (km/s)
- Vbul: Velocity contribution from the bulge (km/s)
- SBdisk: Surface brightness of the disk (L/pc^2)
- SBbul: Surface brightness of the bulge (L/pc^2)
You can load the entire database easily in Python:
import json
import pandas as pd
# Load all data
with open('sparc_full.json', 'r') as f:
all_data = json.load(f)
# Access a specific galaxy
galaxy_name = 'CamB'
data = all_data[galaxy_name]
# Access metadata
print(f"Galaxy: {data['meta']['galaxy_name']}, Distance: {data['meta']['distance']} Mpc")
# Convert to Pandas DataFrame
df = pd.DataFrame(data['data'], columns=data['columns'])
print(df.head())To regenerate the JSON files from the source data:
python3 convert_to_json.py