cnhoper/NEA-CloseApproach: Asteroid Close-Approach Astrometry Analysis Software

Read full text
Authors: Zhenjun Zhang, Jiancheng Wang, Yigong Zhang, X. Y. Cheng, Jie Su
Cited by: 1

Abstract

This repository contains scripts, notebooks, and data examples for processing CloseApproach data (especially NEAs), including pixel positioning, parallax/chromatic aberration correction, DCR calculation, MCMC fitting, and other processes. ## 📋 Project Overview This code repository provides a complete data processing pipeline for CloseApproach observations, used to extract timing and positional information of asteroid occultation events from raw astronomical image data. The code is directly related to the results in the paper "High-Precision Astrometric Positioning of Near-Earth Asteroids - Via the Close Approach Method", achieving high-precision CloseApproach event detection and parameter fitting through automated processing workflows. All scripts and notebooks are developed in Python, supporting batch processing and interactive analysis. ### Relation to Paper Results The code and data in this repository directly support the main findings in the paper:- **Data Processing Pipeline**: Complete processing chain from raw FITS images to final occultation parameters (minimum distance, minimum time).- **Chromatic Aberration Correction (DCR)**: Implements multi-band chromatic aberration models to correct atmospheric dispersion effects on occultation positioning.- **Pixel Scale Calculation**: Calculates pixel-to-celestial coordinate transformation through reference star matching.- **Result Validation**: Ensures method robustness by comparing fitting results from different methods. ## 📂 File Types, Formats, and Structure ### File Types and Formats- **Python Scripts (.py)**: Executable Python code for batch data processing tasks. Uses UTF-8 encoding, compatible with Python 3.7+.- **Jupyter Notebooks (.ipynb)**: Interactive documents containing code, visualizations, and explanatory text. Used for exploratory analysis and result presentation.- **Configuration Files (.yaml)**: YAML-formatted parameter files for specifying data paths, target information, etc.- **Data Files**: - **FITS (.fits)**: Astronomical image data in standard FITS format. - **CSV (.csv)**: Tabular data such as star catalogs and fitting results. - **Other**: XML, TAB, and other catalog format files. ### Repository Structure```approximate_occultation/├── README.md # Project documentation├── LICENSE # MIT License├── config.yaml # Global configuration file├── *.py # Python scripts (data processing core)├── *.ipynb # Jupyter notebooks (analysis and visualization)├── dcr/ # Chromatic aberration correction data│ ├── reflectance.csv # Reflectance data│ ├── GaiaDR3_Average_Solar_Analogue_Spectrum.csv # Solar analogue spectrum│ └── ... # Other spectral and catalog data``` ## 🔧 Dependencies and Required Software ### System Requirements- **Operating System**: Windows 10+, Linux, macOS- **Python Version**: 3.7 or higher- **Memory**: At least 8GB RAM (when processing large FITS files)- **Storage**: At least 10GB available space (including data and temporary files) ### Core DependenciesInstall all dependencies:```bashpip install numpy pandas scipy astropy pyyaml matplotlib seaborn emcee corner pyfits astroquery``` Detailed dependency list:- **numpy** (>=1.19.0): Numerical computing- **pandas** (>=1.3.0): Data processing and analysis- **scipy** (>=1.7.0): Scientific computing (optimization, statistics)- **astropy** (>=5.0): Astronomical data processing (FITS, coordinate transformation, ephemerides)- **pyyaml** (>=5.4): YAML configuration file parsing- **matplotlib** (>=3.4.0): Basic plotting- **seaborn** (>=0.11.0): Statistical visualization- **emcee** (>=3.1.0): MCMC sampling (Bayesian fitting)- **corner** (>=2.2.0): Posterior distribution visualization- **pyfits** (astropy.io.fits): FITS file processing- **astroquery** (>=0.4.0): Astronomical data queries (Gaia, SDSS, etc.) ### Optional Dependencies- **jupyter** (>=1.0.0): Running notebooks- **notebook** (>=6.4.0): Jupyter notebook server ### Installation Steps1. Create a virtual environment: ```bash python -m venv .venv # Windows .\.venv\Scripts\activate # Linux/macOS source .venv/bin/activate ``` 2. Install dependencies: ```bash pip install -r requirements.txt # If requirements.txt exists # Or manually install the packages above ``` ## 📄 Detailed Description of Scripts and Notebooks ### Python Scripts #### CaculateTargetEphemerisPosition.py**Purpose**: Calculate the apparent position and ephemeris information of the target asteroid at observation times.**Usage**: Compute asteroid RA/DEC positions from JPL ephemerides or local BSP files, generate ephemeris data for matching.**Input**: Target information and observation time range from config.yaml.**Output**: cen_time_ApparentPosition.csv (containing time, position, distance, etc.).**Relation to Paper**: Provides time reference for occultation events, used to calculate minimum distance time. #### calibrate_bias_flat_cr.py**Purpose**: Preprocess raw FITS images, including bias subtraction, flat field correction, and cosmic ray removal.**Usage**: Batch process observation image sequences to generate calibrated science images.**Input**: Raw FITS files, bias and flat frames.**Output**: calibrated_*.fits (calibrated images).**Relation to Paper**: Ensures image quality, reduces noise impact on star detection. #### downloadCatalog.py**Purpose**: Download reference star data from Gaia or other catalogs for the target region.**Usage**: Download catalogs based on observation field RA/DEC and radius for subsequent matching.**Input**: Download parameters from config.yaml.**Output**: gaia_stars.csv or other catalog files.**Relation to Paper**: Provides reference stars for pixel-to-celestial coordinate transformation. #### flatBiasCalibrated.py**Purpose**: Auxiliary script for flat and bias calibration, handling specific types of calibration frames.**Usage**: Used in conjunction with calibrate_bias_flat_cr.py.**Input**: Bias and flat FITS files.**Output**: master_bias.fits, master_flat.fits.**Relation to Paper**: Supports image preprocessing, improves data quality. #### match.py / match1.py**Purpose**: Match detected star points with downloaded catalogs to establish pixel-to-celestial coordinate transformation.**Usage**: Use astropy matching algorithms to calculate transformation matrices.**Input**: Detected star point lists, catalog data.**Output**: Matching results and transformation parameters.**Relation to Paper**: Achieves precise pixel positioning, foundation for occultation timing calculation. #### 平场bias制作.py (Flat Bias Creation)**Purpose**: Generate master bias and master flat frames.**Usage**: Median combine multiple bias/flat frames.**Input**: Multiple bias or flat FITS files.**Output**: master_bias.fits, master_flat.fits.**Relation to Paper**: Fundamental step for image calibration. #### 记录曝光时刻中值.py (Record Exposure Time Median)**Purpose**: Calculate median exposure times for observation sequences, used for time reference.**Usage**: Process time information from FITS headers.**Input**: FITS file sequences.**Output**: exposure_times.csv.**Relation to Paper**: Provides precise timestamps for ephemeris calculation. ### Jupyter Notebooks #### main.ipynb**Purpose**: Main analysis notebook integrating the entire data processing workflow.**Usage**: From data loading to final result visualization.**Content**: Contains code and charts for all steps.**Relation to Paper**: Demonstrates complete analysis workflow, generates main charts in the paper. #### 主程序.ipynb (Main Program)**Purpose**: Chinese version of the main program notebook, similar to main.ipynb but with Chinese comments.**Usage**: Complete processing workflow demonstration.**Relation to Paper**: Provides localized version of the analysis workflow. #### 解算像素尺寸.ipynb (Calculate Pixel Size)**Purpose**: Calculate image pixel scale through reference star matching.**Usage**: Use star pairs with known distances to calculate pixel/arcsecond ratio.**Input**: Matched star point coordinates.**Output**: pixel_scale.arcsec_per_pixel.**Relation to Paper**: Provides spatial resolution information for position accuracy assessment. ## 🚀 Quick Start (Python Environment)1. **Create a virtual environment (recommended)** ```bash python -m venv .venv .\.venv\Scripts\activate ``` 2. **Install dependencies** (example dependencies, supplement as needed) ```bash pip install numpy pandas scipy astropy pyyaml matplotlib seaborn emcee corner astroquery ``` 3. **Configure data paths** Edit paths and target information in `config.yaml`, ensure relevant files exist. 4. **Run core scripts** - Calculate celestial ephemeris/position (generate `cen_time_ApparentPosition.csv`) ```bash python CaculateTargetEphemerisPosition.py ``` - Image preprocessing (bias, flat, cosmic rays) ```bash python calibrate_bias_flat_cr.py ``` ## 🧭 Key File Description- `config.yaml`: Global configuration entry, containing: - `Preprocessing.Path`: Raw FITS data folder - `CatalogDownload`: Catalog download range (RA/DEC/radius/magnitude) - `ephemeris`: JPL/HORIZONS, IMCCE data paths - `target` / `reference_star`: Target asteroid and reference star information - `fitting`: Fitting-related configurations (order, output units, time reference) - `match.py`, `match1.py`: Used to match detected star points with Gaia catalogs/reference stars, obtaining pixel-to-celestial coordinate correspondences. ## 📌 Usage Suggestions- **Configure data paths in `config.yaml` first**, then run scripts, otherwise errors may occur due to missing files.- For processing new observation data, it is recommended to first use `downloadCatalog.py` to obtain the target region catalog, then run matching and fitting workflows.- Notebook files are suitable for interactive debugging and res

Publication details

Journal / source
Zenodo (CERN European Organization for Nuclear Research)
Publication date
13 March 2026