# Type III Radio Burst Automatic Recognition Algorithm
The automatic recognition of the Type III radio burst using Hough Transform.
## Installation
### Python
install from pypi
```bash
pip install type3detect
```
install from git
```bash
git clone https://github.com/peijin94/type3detect.git
cd src/python
python pip install .
```
### Matlab:
```bash
git clone https://github.com/peijin94/type3detect.git
cd src/matlab
```
## Example
Read fits file and detect type III radio bursts in dynamic spectrum.
```python
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import numpy as np
from type3detect import detectRadioburst as drb
from type3detect import radioTools as rt
fname = './LOFAR_20220701_070000_LBA_OUTER_S0.fits'
# preprocess
(dyspec,t_fits,f_fits,hdu) = drb.read_fits(fname) # read LOFAR dynspec fits
(dyspec,f_fits) = drb.cut_low(dyspec,f_fits,f_low_cut_val=30) # remove below freq (RFI)
(data_fits_new,data_fits_new_smooth) = drb.preproc(dyspec,gauss_sigma=1.5)
# binarization
bmap = drb.binarization(data_fits_new,N_order=6,peak_r=1.002)
# detect verticle features
lines = drb.hough_detect(bmap,dyspec,threshold=40,line_gap=10,line_length=30,
theta=np.linspace(np.pi/2-np.pi/8,np.pi/2-1/180*np.pi,300))
line_sets = drb.line_grouping(lines)
# get electron beam information from radio bursts
(v_beam, f_range_burst, t_range_burst, model_curve_set,
t_set_arr_set,f_set_arr_set,t_model_arr,f_model_arr
)= drb.get_info_from_linegroup(line_sets,t_fits,f_fits)
# detailed demo in ./type3detect_demo.ipynb
```
Example: Implementation with for LOFAR dynamic spectrum.
Demo Notebook: [type3detect_demo.ipynb](https://github.com/peijin94/type3detect/blob/master/type3detect_demo.ipynb)
![img](https://github.com/peijin94/type3detect/raw/master/img/LOFAR_20220413_135000_LBA_OUTER.fits.jpg)
### Binarization
Use several ways to transform the flux intensity data into binary. ([LocalMax(matlab)](src/matlab/get_local_max_map.m)) ([binarization(Python)](src/python/src/detectRadioBurst.py))
### Active-Contour method for Backbone
The Active Contour Method for the backbone of the radio burst (**ACBone**)
Take the result of the Hough transform as a initail position and iteratively move the line to find the backbone position. The demo code : ([ACBone-Matlab](src/matlab/active_contour.m), [ACBone-Python](src/python/type3detect/ACBone.py))
![img](https://github.com/peijin94/type3detect/raw/master/img/activecontour.GIF)
Eventually, we can obtain the centerline of a Type III radio burst.
## Citation
Make sure to cite the paper if you use the idea or code in this repo: [A type III radio burst automatic analysis system and statistic results for a half solar cycle with Nançay Decameter Array data](https://www.aanda.org/component/article?access=doi&doi=10.1051/0004-6361/201833260#R16) Peijin Zhang. A&A 2018.10
bibtex:
```
@article{zhang2018type,
title={A type III radio burst automatic analysis system and statistic results for a half solar cycle with Nan{\c{c}}ay Decameter Array data},
author={Zhang, PJ and Wang, Chuan Bing and Ye, Lin},
journal={Astronomy \& Astrophysics},
volume={618},
pages={A165},
year={2018},
publisher={EDP Sciences}
}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/peijin94/type3detect",
"name": "type3detect",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "LOFAR,Solar,radio",
"author": "Peijin",
"author_email": "pjer1316@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9b/55/1e7ef84441ec8b7693933e5a5e05abb7ad13ac87096d453008f3d36f259b/type3detect-0.0.3.tar.gz",
"platform": null,
"description": "# Type III Radio Burst Automatic Recognition Algorithm\n\nThe automatic recognition of the Type III radio burst using Hough Transform.\n\n## Installation\n\n### Python\n\ninstall from pypi\n```bash\npip install type3detect\n```\n\ninstall from git\n```bash\ngit clone https://github.com/peijin94/type3detect.git\ncd src/python\npython pip install .\n```\n\n### Matlab:\n```bash\ngit clone https://github.com/peijin94/type3detect.git\ncd src/matlab\n```\n\n## Example \n\nRead fits file and detect type III radio bursts in dynamic spectrum.\n\n```python\nimport matplotlib.dates as mdates\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom type3detect import detectRadioburst as drb\nfrom type3detect import radioTools as rt\n\nfname = './LOFAR_20220701_070000_LBA_OUTER_S0.fits'\n\n# preprocess\n(dyspec,t_fits,f_fits,hdu) = drb.read_fits(fname) # read LOFAR dynspec fits\n(dyspec,f_fits) = drb.cut_low(dyspec,f_fits,f_low_cut_val=30) # remove below freq (RFI)\n(data_fits_new,data_fits_new_smooth) = drb.preproc(dyspec,gauss_sigma=1.5)\n\n# binarization\nbmap = drb.binarization(data_fits_new,N_order=6,peak_r=1.002)\n\n# detect verticle features\nlines = drb.hough_detect(bmap,dyspec,threshold=40,line_gap=10,line_length=30,\n theta=np.linspace(np.pi/2-np.pi/8,np.pi/2-1/180*np.pi,300))\nline_sets = drb.line_grouping(lines)\n\n# get electron beam information from radio bursts\n(v_beam, f_range_burst, t_range_burst, model_curve_set,\n t_set_arr_set,f_set_arr_set,t_model_arr,f_model_arr\n )= drb.get_info_from_linegroup(line_sets,t_fits,f_fits)\n\n# detailed demo in ./type3detect_demo.ipynb\n```\n\nExample: Implementation with for LOFAR dynamic spectrum.\n\nDemo Notebook: [type3detect_demo.ipynb](https://github.com/peijin94/type3detect/blob/master/type3detect_demo.ipynb)\n\n![img](https://github.com/peijin94/type3detect/raw/master/img/LOFAR_20220413_135000_LBA_OUTER.fits.jpg)\n\n\n### Binarization\n\nUse several ways to transform the flux intensity data into binary. ([LocalMax(matlab)](src/matlab/get_local_max_map.m)) ([binarization(Python)](src/python/src/detectRadioBurst.py))\n\n\n### Active-Contour method for Backbone\n\nThe Active Contour Method for the backbone of the radio burst (**ACBone**)\n\nTake the result of the Hough transform as a initail position and iteratively move the line to find the backbone position. The demo code : ([ACBone-Matlab](src/matlab/active_contour.m), [ACBone-Python](src/python/type3detect/ACBone.py))\n\n![img](https://github.com/peijin94/type3detect/raw/master/img/activecontour.GIF)\n\nEventually, we can obtain the centerline of a Type III radio burst.\n\n\n## Citation\n\nMake sure to cite the paper if you use the idea or code in this repo: [A type III radio burst automatic analysis system and statistic results for a half solar cycle with Nan\u00e7ay Decameter Array data](https://www.aanda.org/component/article?access=doi&doi=10.1051/0004-6361/201833260#R16) Peijin Zhang. A&A 2018.10\n\nbibtex:\n```\n@article{zhang2018type,\n title={A type III radio burst automatic analysis system and statistic results for a half solar cycle with Nan{\\c{c}}ay Decameter Array data},\n author={Zhang, PJ and Wang, Chuan Bing and Ye, Lin},\n journal={Astronomy \\& Astrophysics},\n volume={618},\n pages={A165},\n year={2018},\n publisher={EDP Sciences}\n}\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "tools to process the lofar solar data",
"version": "0.0.3",
"project_urls": {
"Download": "https://github.com/peijin94/type3detect/archive/refs/heads/master.zip",
"Homepage": "https://github.com/peijin94/type3detect"
},
"split_keywords": [
"lofar",
"solar",
"radio"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9b551e7ef84441ec8b7693933e5a5e05abb7ad13ac87096d453008f3d36f259b",
"md5": "564664823547663788b51be735ea8bc7",
"sha256": "62c2eed2fa2855837ab80ddf225864b57b29299ff0f28bdf58ce00bd4322dbe4"
},
"downloads": -1,
"filename": "type3detect-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "564664823547663788b51be735ea8bc7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7180,
"upload_time": "2023-05-29T13:30:50",
"upload_time_iso_8601": "2023-05-29T13:30:50.070322Z",
"url": "https://files.pythonhosted.org/packages/9b/55/1e7ef84441ec8b7693933e5a5e05abb7ad13ac87096d453008f3d36f259b/type3detect-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-29 13:30:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "peijin94",
"github_project": "type3detect",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "type3detect"
}