Skip to content

SalmaTech-03/AstroWave-Intelligence

Repository files navigation

AstroWave Intelligence

Deep Learning for Gravitational Wave Detection

Python TensorFlow Flask LIGO License

AstroWave Intelligence is a cutting-edge deep learning application capable of distinguishing between cosmic gravitational wave signals and background detector noise. By leveraging real data from the Laser Interferometer Gravitational-Wave Observatory (LIGO), this system processes raw strain data into Time-Frequency Q-Transforms and analyzes them using a Convolutional Neural Network (CNN).


Key Features

  • Authentic Scientific Data: Connects directly to the Gravitational-Wave Open Science Center (GWOSC) to fetch real-time observatory data.
  • Advanced Signal Processing: Implements whitening, bandpassing, and Constant-Q Transforms to convert raw time-series data into visual spectrograms.
  • Deep Learning Architecture: Utilizes a custom-tuned CNN (Convolutional Neural Network) optimized for binary classification of time-frequency images.
  • Interactive Web Interface: A sci-fi inspired Flask web dashboard that allows users to scan specific GPS times for cosmic events.
  • Battle-Tested Pipeline: robust data generation, automated preprocessing, and model evaluation modules.

The Science

Gravitational waves are ripples in the fabric of spacetime caused by some of the most violent and energetic processes in the Universe. This project automates the detection of these signals:

  1. Input: A GPS timestamp (Time of potential event).
  2. Preprocessing: The raw strain data ($10^{-19}$ meters) is incredibly noisy. We whiten the data to flatten the noise spectrum and apply a bandpass filter (30-400Hz).
  3. Visualization: We generate a Q-Transform, a specialized spectrogram that balances time and frequency resolution, ideal for "chirp" signals.
  4. Inference: The CNN analyzes the spectrogram image to detect the characteristic "chirp" shape of a binary black hole or neutron star merger.

Project Architecture

AstroWave-Intelligence/
├── data/
│   └── processed/          # Generated spectrograms for training
├── models/
│   └── astrowave_cnn.h5    # The trained Neural Network
├── reports/
│   └── figures/            # Confusion matrices and training history
├── src/
│   ├── build_dataset.py    # Fetches LIGO data and creates training set
│   ├── data_loader.py      # TF Data pipeline for batching and loading
│   ├── evaluate.py         # Generates classification reports
│   ├── model.py            # CNN Architecture definition
│   ├── preprocess.py       # Signal processing (Whitening/Q-Transform)
│   └── train.py            # Main training loop
├── static/
│   └── images/             # Dynamic images generated by the web app
├── templates/
│   ├── index.html          # Main search interface
│   └── result.html         # Prediction results dashboard
├── app.py                  # Flask Application Entry Point
└── requirements.txt        # Python dependencies

Installation & Setup

Prerequisites

  • Python 3.8+
  • pip (Python Package Manager)

1. Clone the Repository

git clone https://github.com/yourusername/astrowave-intelligence.git
cd astrowave-intelligence

2. Create a Virtual Environment

It is highly recommended to use a virtual environment to manage dependencies.

# Windows
python -m venv venv
.\venv\Scripts\activate

# Mac/Linux
python3 -m venv venv
source venv/bin/activate

3. Install Dependencies

pip install numpy matplotlib tensorflow gwpy gwosc tqdm flask scikit-learn seaborn

(Note: gwpy requires TimeSeries libraries that may take a moment to install.)


Training the Model

To train the AI from scratch using fresh LIGO data, follow this pipeline:

  1. Generate the Dataset: Downloads real event data and generates noise samples.

    python src/build_dataset.py
  2. Train the CNN: Loads the dataset, trains the model, and saves astrowave_cnn_final.h5 to the models/ directory (or Desktop).

    python src/train.py
  3. Evaluate Performance: Generates a confusion matrix and classification report.

    python src/evaluate.py

Launching the Web Interface

Once the model is trained (or if you are using the pre-trained model provided), launch the web dashboard:

  1. Ensure the model file is in the right place: Make sure astrowave_cnn_final.h5 is located in the models/ folder.

  2. Run the Flask App:

    python app.py
  3. Access the Dashboard: Open your browser and navigate to: http://127.0.0.1:5000/


Test Data (GPS Times)

Use these GPS times to test the detection capabilities in the web app:

Event Name GPS Time Type Expected Result
GW150914 1126259462.422 Binary Black Hole Merger SIGNAL
GW170817 1187008882.4 Binary Neutron Star Merger SIGNAL
GW151226 1135136350.6 Binary Black Hole Merger SIGNAL
Random Noise 1186741861.0 Background Noise NOISE
Random Noise 1126259400.0 Background Noise NOISE

Performance

The model utilizes a robust CNN architecture featuring:

  • 2 Convolutional Blocks with MaxPooling and BatchNormalization.
  • Dropout regularization to prevent overfitting.
  • Binary Crossentropy loss optimization.

Current Accuracy on Validation Set: ~98%


Acknowledgements

  • LIGO Scientific Collaboration: For providing the open data via GWOSC.
  • GWpy: For the excellent Python package for gravitational-wave astrophysics.
  • TensorFlow: For the deep learning framework.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors