Skip to content

HardikMedhi/cme-ips-intersection

Repository files navigation

CME-IPS Intersection Analysis

This package analyzes geometric and temporal intersections between Coronal Mass Ejections (CMEs) and Interplanetary Scintillation (IPS) lines of sight. It identifies when CME structures intersect with IPS observation paths and validates these intersections using CME propagation models.

Overview

The analysis consists of two main components:

  1. Intersection Detection (cme_ips_intersection.py): Finds geometric intersections between CME cones and IPS lines of sight, then validates them using a drag-based CME propagation model.

  2. Data Extraction (extract_intersection_data.py): Extracts detailed CME and IPS information for all detected intersections and generates comprehensive output files.

Features

  • 3D Geometric Intersection: Detects cone-line intersections in 3D space using robust computational geometry algorithms
  • CME Propagation Modeling: Validates intersections using a drag-based model with configurable solar wind parameters
  • Directional Filtering: Processes East and West solar elongations separately
  • Temporal Validation: Ensures intersection timing is physically consistent with CME propagation
  • Flexible Configuration: All parameters controlled through a centralized config file

Installation

Prerequisites

  • Python 3.7 or higher
  • pip package manager

Setup

  1. Clone or download this repository

  2. Install required packages:

    pip install -r requirements.txt
  3. Ensure your data files are in the correct locations (see Configuration section)

Configuration

All analysis parameters are defined in config.py. Edit this file to customize the analysis for your data:

Key Configuration Parameters

# Input files
IPS_CATALOG_FILE = "source_catalog.fits"  # IPS source catalog
CME_CATALOG_PATH = "../data/CME/seeds/cmecat_{month:02d}.txt"  # CME catalog pattern

# Output
OUTPUT_DIR = "cme_ips_intersect_results_5hrs"  # Results directory

# CME Propagation Model
DRAG_COEFFICIENT = 0.2e-7  # km^-1
SOLAR_WIND_SPEED = 400     # km/s
MAX_PROPAGATION_TIME = 100 # hours

# Intersection Parameters
CONE_HEIGHT_MIN = 0.0  # AU
CONE_HEIGHT_MAX = 2.0  # AU
TIME_WINDOW = 5        # hours (intersection validation tolerance)

# Timezone
TIMEZONE_OFFSET = 5.5  # hours (IST = UTC + 5.5)

Configuration Details

  • IPS_CATALOG_FILE: Path to FITS file containing IPS source catalog with columns: source_name, mjd, elongation, ra, dec
  • CME_CATALOG_PATH: Path template for monthly CME catalogs (use {month:02d} as placeholder)
  • OUTPUT_DIR: Directory where intersection results will be saved
  • DRAG_COEFFICIENT: Gamma parameter in CME drag equation (units: km^-1)
  • SOLAR_WIND_SPEED: Background solar wind speed (units: km/s)
  • TIME_WINDOW: Maximum time difference allowed between predicted and observed intersection times (hours)
  • CONE_HEIGHT_MIN/MAX: CME cone extent along axis direction (units: AU)

Usage

1. Finding Intersections

Run the main intersection analysis:

python cme_ips_intersection.py

This script will:

  • Load CME and IPS catalogs for all available months
  • Filter by East/West elongation directions
  • Detect geometric intersections between CME cones and IPS lines of sight
  • Validate intersections using CME propagation model
  • Save results to text files in the output directory

Output: Files named cme_ips_intersections_month{MM}_{direction}.txt containing:

CME_Index IPS_Index Duration_Hours Time_Diff_Hours

2. Extracting Detailed Data

After finding intersections, extract detailed information:

python extract_intersection_data.py

This script will:

  • Read intersection result files
  • Extract CME properties (position angle, angular width, velocity, acceleration)
  • Extract IPS properties (source name, position, elongation)
  • Generate detailed combined tables

Output: Multiple files per month/direction:

  • month{MM}_{direction}_cme_data.txt: CME event details
  • month{MM}_{direction}_ips_data.txt: IPS observation details
  • month{MM}_{direction}_detailed_intersections.txt: Combined intersection data
  • month{MM}_{direction}_detailed_intersections.csv: CSV format for analysis

Data Requirements

IPS Catalog (FITS format)

Required columns:

  • source_name: Source identifier (string)
  • mjd: Modified Julian Date of observation (float)
  • elongation: Solar elongation in degrees (float, positive=East, negative=West)
  • ra: Right ascension in degrees (float)
  • dec: Declination in degrees (float)

CME Catalog (Text format)

Space-separated columns:

  • date: Date in YYYY/MM/DD or YYYY-MM-DD format
  • time: Time in HH:MM:SS format
  • nframe: Number of frames (integer)
  • pa: Position angle in degrees (float, 0-360)
  • da: Half angular width in degrees (float)
  • vel: Velocity in km/s (float)
  • acc: Acceleration in m/s^2 (float)

Algorithm Overview

1. Geometric Intersection

The code implements a robust cone-line intersection algorithm:

  • CME represented as a finite cone with vertex at Sun's position
  • IPS line of sight from Earth through the P-point (closest approach to Sun)
  • 3D intersection computed using quadratic equation solving
  • Handles all edge cases (point, segment, ray intersections)

2. CME Propagation Model

Uses a drag-based differential equation:

dR/dt = s
ds/dt = -γ(s - ω)|s - ω|

Where:

  • R: distance from Sun (km)
  • s: CME velocity (km/s)
  • γ: drag coefficient
  • ω: solar wind speed

3. Temporal Validation

An intersection is valid if:

  1. Geometric intersection exists
  2. CME arrives at intersection distance within TIME_WINDOW of IPS observation
  3. Timing consistent with CME propagation model

Output Format

Intersection Files

# CME-IPS Intersection Results
# Month: MM, Elongation: EAST/WEST
# Columns: CME_Index IPS_Index Duration_Hours Time_Diff_Hours
0 5 12.3456 14.2345
1 7 15.6789 16.7890
...

Detailed Intersection Files

Combined data with CME and IPS properties:

  • CME: datetime, position angle, angular width, velocity, acceleration
  • IPS: datetime, source name, elongation, RA, Dec
  • Intersection: duration, time difference

Coordinate Systems

  • ICRS: International Celestial Reference System (barycentric)
  • GCRS: Geocentric Celestial Reference System (geocentric)
  • All coordinates transformed consistently through astropy

Performance Notes

  • Processing time depends on number of CME and IPS events
  • Typical runtime: ~1-5 minutes per month (varies with data density)
  • Progress bars display real-time status
  • Results cached in output directory

Troubleshooting

Common Issues

  1. FileNotFoundError: Check paths in config.py match your data structure
  2. Import errors: Ensure all packages installed: pip install -r requirements.txt
  3. Empty results: Verify TIME_WINDOW and other parameters are appropriate for your data
  4. SIMBAD timeouts: Internet connection required for source coordinate queries

Debug Mode

To enable verbose SIMBAD queries, set in config.py:

SIMBAD_VERBOSE = True

Citation

If you use this code in your research, please cite:

[Your citation information here]

License

[Your license information]

Contact

For questions or issues, please contact: [Your contact information]

Acknowledgments

This analysis uses:

  • Astropy for astronomical calculations
  • SIMBAD for source coordinates
  • SciPy for numerical integration

About

This code finds geometric intersections between CME cone models and IPS lines-of-sight by mapping CME position angles to 3D vectors, constructing finite cones, and analytically solving cone–line intersections. A drag-based model time-validates intersections against IPS observations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages