Skip to content

PyTorchDedispersion: GPU-accelerated Python package for dedispersed signal searches in radio telescope data

License

Notifications You must be signed in to change notification settings

nkosogor/PyTorchDedispersion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyTorchDedispersion

Table of Contents

  1. Description
  2. Features
  3. Installation
  4. Usage Instructions
  5. Running Tests
  6. License
  7. Contact Information

Description

PyTorchDedispersion is a Python package designed for processing and analyzing radio telescope data using GPU acceleration. It provides tools for dedispersion, boxcar filtering, and candidate detection, making it suitable for searching for fast radio bursts (FRBs).

Features

  • GPU-accelerated dedispersion using PyTorch
  • Boxcar filtering
  • Candidate detection based on SNR thresholds
  • Support for handling bad channels
  • Configurable through JSON files

Installation

Prerequisites

Ensure that CUDA and cuDNN are installed on your system. For detailed installation instructions, refer to the NVIDIA CUDA Toolkit Installation Guide and the NVIDIA cuDNN Installation Guide.

Install PyTorch

Find a suitable version of PyTorch at the PyTorch website.

Example command for installing PyTorch with CUDA 12.1 support:

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

Verify the installation:

import torch

print("Is CUDA available:", torch.cuda.is_available())
print("CUDA version:", torch.version.cuda)
print("cuDNN version:", torch.backends.cudnn.version())

Expected output:

Is CUDA available: True
CUDA version: 12.1
cuDNN version: 8902

Install PyTorchDedispersion

  1. Clone the repository:

    git clone https://github.com/nkosogor/PyTorchDedispersion.git
    cd PyTorchDedispersion
  2. Install the package and dependencies:

    pip install .

Usage Instructions

Supported File Formats

This library supports Sigproc Filterbank format.

Configuration File Parameters

{
    "SOURCE": ["/path/to/local/file.fil"],
    "SNR_THRESHOLD": 7,
    "BOXCAR_WIDTHS": [1, 2, 4, 8, 16],
    "DM_RANGES": [
        {"start": 100, "stop": 200, "step": 0.5},
        {"start": 200, "stop": 500, "step": 1}
    ],
    "BAD_CHANNEL_FILE": "/path/to/bad_channel_file.txt"
}
  • SOURCE: Input data file path.
  • SNR_THRESHOLD: Minimum SNR for candidate detection.
  • BOXCAR_WIDTHS: List of widths (in samples) for boxcar filtering.
  • DM_RANGES: Ranges of dispersion measures (in pc/cm³) to search.
  • BAD_CHANNEL_FILE (Optional): Path to a file with bad channel indices.

Running the Dedispersion Script

Use the dedisperse_candidates.py script to process your data based on the configuration file. Run the script as follows:

python pytorch_dedispersion/dedisperse_candidates.py --config /path/to/config.json --verbose --gpu 0

Additional command-line options:

  • --remove-trend: Remove trend from the data.
  • --window-size: Specify window size for trend removal.

Output

The script generates a CSV file containing candidate information, saved in the format candidates_YYYYMMDD-HHMMSS.csv. The output CSV file will have lines formatted as follows:

SNR,Sample Number,Time (sec),Boxcar Width,DM Value
11.5,1601,2.03,1,476
  • SNR: The signal-to-noise ratio of the detected candidate.
  • Sample Number: The sample number where the candidate was detected.
  • Time (sec): The corresponding time in seconds for the detected sample.
  • Boxcar Width: The width of the boxcar (in samples) filter used to detect the candidate.
  • DM Value: The dispersion measure value in pc/cm³ for the detected candidate.

Running Tests

For detailed instructions on running tests, refer to the tests README.

License

This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.

Contact Information

For questions, please contact [email protected].

About

PyTorchDedispersion: GPU-accelerated Python package for dedispersed signal searches in radio telescope data

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages