# AGB Star Deprojection
A package for visualising radially expanding circumstellar envelopes of AGB stars.
---
## Quick Start
### Installation
```bash
python3 -m pip install agb_star_deprojection_methods
```
### Import
```python
from agb_star_deprojection_methods.classes import CondensedData, StarData
```
### Initialise a StarData object
```python
fits_file = "example_fits_file.fits" # relative path to fits file
distance_to_star = 8.04e8 # distance to star in AU
rest_frequency = 2.3e11 # rest frequency in Hz
star = StarData(fits_file, distance_to_star, rest_frequency)
```
### Plot channel maps (opens in matplotlib window)
```python
star.plot_channel_maps() # many optional arguments
```
### Plot 3D deprojection using plotly
```python
star.plot_3D() # many optional arguments
```
### Export to a CondensedData object
```python
data = star.export()
```
### Tweak parameters and create a new StarData object
```python
data.v_exp = 20
new_star = StarData(data)
```
### Expand envelope over time
```python
years = 1000
info = new_star(years) # CondensedData object representing the envelope in 1000 years
expanded_star = StarData(info)
```
### Save animation frame-by-frame to a folder
```python
path_to_folder = "animation/frames"
star.plot_3D(folder = path_to_folder, num_angles = 100)
```
---
## Creating a Mask
To create a mask manually, use the following script:
```python
from agb_star_deprojection_methods.classes import StarData
fits_file = "example_fits_file.fits"
distance_to_star = 8.04e8
rest_frequency = 2.3e11
star = StarData(fits_file, distance_to_star, rest_frequency)
stds = 3 # number of standard deviations to initially filter by
savefile = "trial_mask.npy" # .npy file to save mask to
# open mask selector
star.create_mask(filter_stds=stds, savefile=savefile)
```
Running this will open a matplotlib window with a subplot for each velocity channel.
- **Double click** inside a subplot, then **drag to lasso points**.
- When you finish dragging, press:
- **A** to keep only these points in the mask,
- **R** to remove these points from the mask,
- **Enter** to do neither.
- Once you have completed the mask, close the matplotlib application.
- The mask will be saved to the location specified by `savefile`.
To load the star data with the mask:
```python
from agb_star_deprojection_methods.classes import StarData
fits_file = "example_fits_file.fits"
distance_to_star = 8.04e8
rest_frequency = 2.3e11
maskfile = "trial_mask.npy" # .npy file to load mask from
star = StarData(fits_file, distance_to_star, rest_frequency, maskfile)
# any other operations you want done
# ...
```
---
## Further Reading
See our report and more detailed documentation at https://psychedelickoala.github.io/agb-star-deprojection-docs/AGB-Star-Deprojection.html.
Raw data
{
"_id": null,
"home_page": null,
"name": "agb-star-deprojection-methods",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "AGB, AGB stars, astronomy, astrophysics, circumstellar envelope, deprojection, stars, visualisation",
"author": null,
"author_email": "Annalisa Calvi <annalisacalvi@icloud.com>, Jacob Zhang <jzhang27182@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/c8/56/d2a64bf9168b3791b501ab6d4ebdc39d91e5b1b68d2dd3b5ee0247f760a5/agb_star_deprojection_methods-0.0.3.tar.gz",
"platform": null,
"description": "# AGB Star Deprojection\n\nA package for visualising radially expanding circumstellar envelopes of AGB stars.\n\n---\n\n## Quick Start\n\n### Installation\n\n```bash\npython3 -m pip install agb_star_deprojection_methods\n```\n\n### Import\n\n```python\nfrom agb_star_deprojection_methods.classes import CondensedData, StarData\n```\n\n### Initialise a StarData object\n\n```python\nfits_file = \"example_fits_file.fits\" # relative path to fits file\ndistance_to_star = 8.04e8 # distance to star in AU\nrest_frequency = 2.3e11 # rest frequency in Hz\n\nstar = StarData(fits_file, distance_to_star, rest_frequency)\n```\n\n### Plot channel maps (opens in matplotlib window)\n\n```python\nstar.plot_channel_maps() # many optional arguments\n```\n\n### Plot 3D deprojection using plotly\n\n```python\nstar.plot_3D() # many optional arguments\n```\n\n### Export to a CondensedData object\n\n```python\ndata = star.export()\n```\n\n### Tweak parameters and create a new StarData object\n\n```python\ndata.v_exp = 20\nnew_star = StarData(data)\n```\n\n### Expand envelope over time\n\n```python\nyears = 1000\ninfo = new_star(years) # CondensedData object representing the envelope in 1000 years\nexpanded_star = StarData(info)\n```\n\n### Save animation frame-by-frame to a folder\n\n```python\npath_to_folder = \"animation/frames\"\nstar.plot_3D(folder = path_to_folder, num_angles = 100)\n```\n\n---\n\n## Creating a Mask\n\nTo create a mask manually, use the following script:\n\n```python\nfrom agb_star_deprojection_methods.classes import StarData\n\nfits_file = \"example_fits_file.fits\"\ndistance_to_star = 8.04e8\nrest_frequency = 2.3e11\n\nstar = StarData(fits_file, distance_to_star, rest_frequency)\n\nstds = 3 # number of standard deviations to initially filter by\nsavefile = \"trial_mask.npy\" # .npy file to save mask to\n\n# open mask selector\nstar.create_mask(filter_stds=stds, savefile=savefile)\n```\n\nRunning this will open a matplotlib window with a subplot for each velocity channel. \n- **Double click** inside a subplot, then **drag to lasso points**. \n- When you finish dragging, press:\n - **A** to keep only these points in the mask,\n - **R** to remove these points from the mask,\n - **Enter** to do neither.\n- Once you have completed the mask, close the matplotlib application. \n- The mask will be saved to the location specified by `savefile`.\n\nTo load the star data with the mask:\n\n```python\nfrom agb_star_deprojection_methods.classes import StarData\n\nfits_file = \"example_fits_file.fits\"\ndistance_to_star = 8.04e8\nrest_frequency = 2.3e11\n\nmaskfile = \"trial_mask.npy\" # .npy file to load mask from\n\nstar = StarData(fits_file, distance_to_star, rest_frequency, maskfile)\n\n# any other operations you want done\n# ...\n```\n\n---\n\n## Further Reading\n\nSee our report and more detailed documentation at https://psychedelickoala.github.io/agb-star-deprojection-docs/AGB-Star-Deprojection.html.",
"bugtrack_url": null,
"license": null,
"summary": "Package for visualising radially expanding circumstellar envelopes of AGB stars.",
"version": "0.0.3",
"project_urls": {
"Documentation": "https://psychedelickoala.github.io/agb-star-deprojection-docs/AGB-Star-Deprojection.html"
},
"split_keywords": [
"agb",
" agb stars",
" astronomy",
" astrophysics",
" circumstellar envelope",
" deprojection",
" stars",
" visualisation"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "5eec96e2a3f71300f461869ed87bb7dd9db28ef46ff44aa1cac3b9ff07483a51",
"md5": "ac0398d2d4300e85ec683a66f264d57b",
"sha256": "a8f5cd6cf5eb70c7fdd21b0f766e52f380d06ddd29f731f3f59e8fe6f3ea1f2f"
},
"downloads": -1,
"filename": "agb_star_deprojection_methods-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ac0398d2d4300e85ec683a66f264d57b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 21142,
"upload_time": "2025-07-27T12:08:54",
"upload_time_iso_8601": "2025-07-27T12:08:54.992527Z",
"url": "https://files.pythonhosted.org/packages/5e/ec/96e2a3f71300f461869ed87bb7dd9db28ef46ff44aa1cac3b9ff07483a51/agb_star_deprojection_methods-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c856d2a64bf9168b3791b501ab6d4ebdc39d91e5b1b68d2dd3b5ee0247f760a5",
"md5": "7d508cbda596a43987af8a40740dd351",
"sha256": "2c1f278f9a7525de42e7911feb1525650a6a588d8e84b0e5f631337a932c76d5"
},
"downloads": -1,
"filename": "agb_star_deprojection_methods-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "7d508cbda596a43987af8a40740dd351",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 20007,
"upload_time": "2025-07-27T12:08:55",
"upload_time_iso_8601": "2025-07-27T12:08:55.992175Z",
"url": "https://files.pythonhosted.org/packages/c8/56/d2a64bf9168b3791b501ab6d4ebdc39d91e5b1b68d2dd3b5ee0247f760a5/agb_star_deprojection_methods-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-27 12:08:55",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "agb-star-deprojection-methods"
}