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).
- GPU-accelerated dedispersion using PyTorch
- Boxcar filtering
- Candidate detection based on SNR thresholds
- Support for handling bad channels
- Configurable through JSON files
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.
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
-
Clone the repository:
git clone https://github.com/nkosogor/PyTorchDedispersion.git cd PyTorchDedispersion
-
Install the package and dependencies:
pip install .
This library supports Sigproc Filterbank format.
{
"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.
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.
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.
For detailed instructions on running tests, refer to the tests README.
This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.
For questions, please contact [email protected].