# Spectroscopic Binary System
[![PyPI version](https://badge.fury.io/py/spectroscopicbinarysystem.svg?1.3.4)](https://badge.fury.io/py/spectroscopicbinarysystem)
**Spectroscopic Binary System** is a package intended to contain functionality and some common tools needed for performing astrophysics on spectroscopic binary stars with Python. It allows, among other things, to automatically measure the radial velocity of SB1 type systems and to find their orbital solution with **BinaryStarSolver** (https://github.com/NickMilsonPhysics/BinaryStarSolver)
## Installation
To install **spectroscopicbinarysystem** with pip, run:
```bash
# mac / unix
pip install spectroscopicbinarysystem
# windows
py -m pip install spectroscopicbinarysystem
```
If you want to make sure none of your existing dependencies get upgraded, you can also do:
```bash
# mac / unix
pip install spectroscopicbinarysystem --no-deps
# windows
py -m pip install spectroscopicbinarysystem --no-deps
```
## Prerequisites
Your spectra must be in fit(s) format with (at minimum) the following fields in the header.
The geographical coordinates of the observer will allow to automatically correct the heliocentric/baricentric velocity.
```
01 | SIMPLE = T / File does conform to FITS standard
02 | BITPIX = -32 / Number of bits per data pixel
03 | NAXIS = 1 / Number of data axes
04 | NAXIS1 = 1212 / Length of data axis 1
05 | CRVAL1 = 3780.17883300781 / Coordinate at reference pixel
06 | CDELT1 = 3.267211914 / Coordinate increment
09 | DATE-OBS= '2021-03-24T19:45:00' / Date of observation start
12 | BSS_INST= 'SW72ED + StarEx 2400 + ASI183MM' / Instrument
16 | OBSERVER= 'gbertrand' / Observer name or alias
17 | CUNIT1 = 'Angstrom' / Wavelength unit
18 | CTYPE1 = 'Wavelength' / Axis type
20 | CRPIX1 = 1 / Reference pixel
21 | BSS_VHEL= 0 / [km/s] Heliocentric speed
26 | JD-OBS = 0 / JD start observation
29 | GEO_LONG= 0 / Obs. geographic longitude
30 | GEO_LAT = 0 / Obs. geographic latitude
31 | GEO_ELEV= 0 / Obs. geographic elevation
```
## Usage/Examples
Download sample data (see **/examples/alphadra** directory) or from the **STAROS** database (https://alphadra.staros-projects.org/)
And run this code :
```python
from spectroscopicbinarysystem import SpectroscopicBinarySystem
sbs = SpectroscopicBinarySystem(
object_name='hd123299',
spectra_path='./examples/alphadra/',
t0=2451441.804,
period_guess=51,
conf={
"LAMBDA_REF": 6562.82,
"LINE_FIT_MODEL": "gaussian",
"LINE_FIT_FWHM": 1.0,
"RV_CORR_TYPE": "barycentric",
"SB_TYPE": 1
},
verbose=False,
debug=False)
# plot result with matplotlib and save the results
sbs.plotRadialVelocityCurve(
title="α Dra - HD123299 - Phased radial velocities",
subtitle=f"{sbs.getObservationCount()} observations collected from april 2022 to may 2023\nhttps://alphadra.staros-projects.org/\n",
savefig=True)
# plot 2d dynamic spectrum
sbs.plotSpec2DFlux(
title="α Dra - HD123299 - Hα line 2d dynamic spectrum",
subtitle=f"{sbs.getObservationCount()} observations collected from april 2022 to may 2023\nhttps://alphadra.staros-projects.org/\n",
savefig=True
)
# display result with plotly
sbs.plotlyRadialVelocityCurve(
title="α Dra - HD123299 - Phased radial velocities",
group_by_instrument=False)
```
![results](https://github.com/guillbertrand/spectrobinarystarsystem/blob/master/examples/alphadra/hd123299_phased_result.png)
![results](https://github.com/guillbertrand/spectrobinarystarsystem/blob/master/examples/alphadra/hd123299_2d_spectrum_result.png)
![results](https://github.com/guillbertrand/spectrobinarystarsystem/blob/master/examples/alphadra/hd123299_debug_result_page_4.png)
Raw data
{
"_id": null,
"home_page": "",
"name": "SpectroscopicBinarySystem",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "astronomy,astrophysics,science,fits,models,fitting,spectroscopy,spectrum",
"author": "Guillaume Bertrand",
"author_email": "gbe.io@pm.me",
"download_url": "https://files.pythonhosted.org/packages/73/0d/5871e99eeb8a6fa102eec6e4998eef1b31a7b9b5d16df02e929cd651f3d4/SpectroscopicBinarySystem-1.5.0.tar.gz",
"platform": null,
"description": "\r\n# Spectroscopic Binary System\r\n\r\n[![PyPI version](https://badge.fury.io/py/spectroscopicbinarysystem.svg?1.3.4)](https://badge.fury.io/py/spectroscopicbinarysystem)\r\n\r\n**Spectroscopic Binary System** is a package intended to contain functionality and some common tools needed for performing astrophysics on spectroscopic binary stars with Python. It allows, among other things, to automatically measure the radial velocity of SB1 type systems and to find their orbital solution with **BinaryStarSolver** (https://github.com/NickMilsonPhysics/BinaryStarSolver)\r\n\r\n\r\n## Installation\r\n\r\nTo install **spectroscopicbinarysystem** with pip, run:\r\n```bash\r\n # mac / unix\r\n pip install spectroscopicbinarysystem\r\n\r\n # windows\r\n py -m pip install spectroscopicbinarysystem\r\n```\r\n\r\nIf you want to make sure none of your existing dependencies get upgraded, you can also do:\r\n```bash\r\n # mac / unix\r\n pip install spectroscopicbinarysystem --no-deps \r\n\r\n # windows\r\n py -m pip install spectroscopicbinarysystem --no-deps\r\n```\r\n\r\n## Prerequisites\r\n\r\nYour spectra must be in fit(s) format with (at minimum) the following fields in the header.\r\nThe geographical coordinates of the observer will allow to automatically correct the heliocentric/baricentric velocity.\r\n```\r\n01 | SIMPLE = T / File does conform to FITS standard\r\n02 | BITPIX = -32 / Number of bits per data pixel\r\n03 | NAXIS = 1 / Number of data axes\r\n04 | NAXIS1 = 1212 / Length of data axis 1\r\n05 | CRVAL1 = 3780.17883300781 / Coordinate at reference pixel\r\n06 | CDELT1 = 3.267211914 / Coordinate increment\r\n09 | DATE-OBS= '2021-03-24T19:45:00' / Date of observation start\r\n12 | BSS_INST= 'SW72ED + StarEx 2400 + ASI183MM' / Instrument\r\n16 | OBSERVER= 'gbertrand' / Observer name or alias\r\n17 | CUNIT1 = 'Angstrom' / Wavelength unit\r\n18 | CTYPE1 = 'Wavelength' / Axis type\r\n20 | CRPIX1 = 1 / Reference pixel\r\n21 | BSS_VHEL= 0 / [km/s] Heliocentric speed\r\n26 | JD-OBS = 0 / JD start observation\r\n29 | GEO_LONG= 0 / Obs. geographic longitude\r\n30 | GEO_LAT = 0 / Obs. geographic latitude\r\n31 | GEO_ELEV= 0 / Obs. geographic elevation\r\n```\r\n\r\n\r\n## Usage/Examples\r\n\r\nDownload sample data (see **/examples/alphadra** directory) or from the **STAROS** database (https://alphadra.staros-projects.org/)\r\n\r\nAnd run this code :\r\n\r\n```python\r\nfrom spectroscopicbinarysystem import SpectroscopicBinarySystem\r\n\r\nsbs = SpectroscopicBinarySystem(\r\n object_name='hd123299',\r\n spectra_path='./examples/alphadra/',\r\n t0=2451441.804,\r\n period_guess=51,\r\n conf={\r\n \"LAMBDA_REF\": 6562.82,\r\n \"LINE_FIT_MODEL\": \"gaussian\",\r\n \"LINE_FIT_FWHM\": 1.0,\r\n \"RV_CORR_TYPE\": \"barycentric\",\r\n \"SB_TYPE\": 1\r\n },\r\n verbose=False,\r\n debug=False)\r\n\r\n# plot result with matplotlib and save the results\r\nsbs.plotRadialVelocityCurve(\r\n title=\"\u03b1 Dra - HD123299 - Phased radial velocities\",\r\n subtitle=f\"{sbs.getObservationCount()} observations collected from april 2022 to may 2023\\nhttps://alphadra.staros-projects.org/\\n\",\r\n savefig=True)\r\n\r\n# plot 2d dynamic spectrum\r\nsbs.plotSpec2DFlux(\r\n title=\"\u03b1 Dra - HD123299 - H\u03b1 line 2d dynamic spectrum\",\r\n subtitle=f\"{sbs.getObservationCount()} observations collected from april 2022 to may 2023\\nhttps://alphadra.staros-projects.org/\\n\",\r\n savefig=True\r\n)\r\n\r\n# display result with plotly\r\nsbs.plotlyRadialVelocityCurve(\r\n title=\"\u03b1 Dra - HD123299 - Phased radial velocities\",\r\n group_by_instrument=False)\r\n\r\n```\r\n\r\n![results](https://github.com/guillbertrand/spectrobinarystarsystem/blob/master/examples/alphadra/hd123299_phased_result.png)\r\n\r\n![results](https://github.com/guillbertrand/spectrobinarystarsystem/blob/master/examples/alphadra/hd123299_2d_spectrum_result.png)\r\n\r\n![results](https://github.com/guillbertrand/spectrobinarystarsystem/blob/master/examples/alphadra/hd123299_debug_result_page_4.png)\r\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "Python astronomy tools for spectroscopic binary system",
"version": "1.5.0",
"project_urls": null,
"split_keywords": [
"astronomy",
"astrophysics",
"science",
"fits",
"models",
"fitting",
"spectroscopy",
"spectrum"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "df698658720416ab97bef0744bc6240d7bc8db77fa8a89f65d96ada57d0db5e4",
"md5": "ec8633252194aadd9667ba03b8bcc834",
"sha256": "d5946e42147d9f1352cc3ffc128912e8e39c5c541eefe89076f26ec58cd11e48"
},
"downloads": -1,
"filename": "SpectroscopicBinarySystem-1.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ec8633252194aadd9667ba03b8bcc834",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 12509,
"upload_time": "2023-06-25T12:41:01",
"upload_time_iso_8601": "2023-06-25T12:41:01.956341Z",
"url": "https://files.pythonhosted.org/packages/df/69/8658720416ab97bef0744bc6240d7bc8db77fa8a89f65d96ada57d0db5e4/SpectroscopicBinarySystem-1.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "730d5871e99eeb8a6fa102eec6e4998eef1b31a7b9b5d16df02e929cd651f3d4",
"md5": "2053f0cd5e81d79088c81b3719135008",
"sha256": "c33946b583f7bca2ba41de28beed62a19a9efdbcb5f3ecb52aaf8c0c70729070"
},
"downloads": -1,
"filename": "SpectroscopicBinarySystem-1.5.0.tar.gz",
"has_sig": false,
"md5_digest": "2053f0cd5e81d79088c81b3719135008",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 11968,
"upload_time": "2023-06-25T12:41:03",
"upload_time_iso_8601": "2023-06-25T12:41:03.660734Z",
"url": "https://files.pythonhosted.org/packages/73/0d/5871e99eeb8a6fa102eec6e4998eef1b31a7b9b5d16df02e929cd651f3d4/SpectroscopicBinarySystem-1.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-25 12:41:03",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "spectroscopicbinarysystem"
}