Name | ztfparsnip JSON |
Version |
0.3.0
JSON |
| download |
home_page | |
Summary | Generate noisified lightcurves based on the BTS sample and retrain Parsnip with these. |
upload_time | 2023-08-16 07:29:09 |
maintainer | |
docs_url | None |
author | Simeon Reusch |
requires_python | >=3.10,<3.12 |
license | |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# ztfparsnip
[![PyPI version](https://badge.fury.io/py/ztfparsnip.svg)](https://badge.fury.io/py/ztfparsnip)
[![CI](https://github.com/simeonreusch/ztfparsnip/actions/workflows/ci.yaml/badge.svg)](https://github.com/simeonreusch/ztfparsnip/actions/workflows/ci.yaml)
[![Coverage Status](https://coveralls.io/repos/github/simeonreusch/ztfparsnip/badge.svg?branch=main)](https://coveralls.io/github/simeonreusch/ztfparsnip?branch=main)
Retrain [Parsnip](https://github.com/LSSTDESC/parsnip) for [ZTF](https://www.ztf.caltech.edu/). This is achieved by using [fpbot](https://github.com/simeonreusch/fpbot) forced photometry lightcurves of the [Bright Transient Survey](https://sites.astro.caltech.edu/ztf/bts/bts.php). These are augmented (redshifted, noisified and - when possible - K-corrected).
The package is maintained by [A. Townsend](https://github.com/aotownsend) (HU Berlin) and [S. Reusch](https://github.com/simeonreusch) (DESY).
The following augmentation steps are taken for each parent lightcurve to generate a desired number of children (calculated via `weights`):
- draw a new redshift from a cubic distribution with maximum redshift increase `delta_z`
- only accept the lightcurve if at least `n_det_threshold` datapoints are above the signal-to-noise threshold `SN_threshold`
- if the lightcurve has an existing SNCosmo template, apply a [K-correction](https://en.wikipedia.org/wiki/K_correction) at that magnitude (if `k_corr=True`)
- randomly drop datapoints until `subsampling_rate` is reached
- add some scatter to the observed dates (`jd_scatter_sigma` in days)
- if `phase_lim=True`, only keep datapoints during a typical duration (depends on the type of source)
:warning:
Note that a high `delta_z` without loosening the `SN_threshold` and `n_det_threshold` will result in a large dropout rate, which will ultimately lead to far less lightcurves being generated than initially desired.
## Usage
### Create an augmented training sample
```python
from pathlib import Path
from ztfparsnip.create import CreateLightcurves
weights = {"sn_ia": 9400, "tde": 9400, "sn_other": 9400, "agn": 9400, "star": 9400}
if __name__ == "__main__":
sample = CreateLightcurves(
output_format="parsnip",
classkey="simpleclasses",
weights=weights,
train_dir=Path("train"),
plot_dir=Path("plot"),
seed=None,
phase_lim=True,
k_corr=True,
)
sample.select()
sample.create(plot_debug=False)
```
### Train Parsnip with the augmented sample
```python
from ztfparsnip.train import Train
if __name__ == "__main__":
train = Train(classkey="simpleclasses", seed=None)
train.run()
```
### Evaluate the Parsnip model
```python
from ztfparsnip.train import Train
if __name__ == "__main__":
train = Train(classkey="simpleclasses", seed=None)
train.classify()
```
Raw data
{
"_id": null,
"home_page": "",
"name": "ztfparsnip",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<3.12",
"maintainer_email": "",
"keywords": "",
"author": "Simeon Reusch",
"author_email": "simeon.reusch@desy.de",
"download_url": "https://files.pythonhosted.org/packages/3d/e8/b4caa6671b13b23be052dd5e01db536abb560f6a676cb4426ec3d5175cb9/ztfparsnip-0.3.0.tar.gz",
"platform": null,
"description": "# ztfparsnip\n[![PyPI version](https://badge.fury.io/py/ztfparsnip.svg)](https://badge.fury.io/py/ztfparsnip)\n[![CI](https://github.com/simeonreusch/ztfparsnip/actions/workflows/ci.yaml/badge.svg)](https://github.com/simeonreusch/ztfparsnip/actions/workflows/ci.yaml)\n[![Coverage Status](https://coveralls.io/repos/github/simeonreusch/ztfparsnip/badge.svg?branch=main)](https://coveralls.io/github/simeonreusch/ztfparsnip?branch=main)\n\nRetrain [Parsnip](https://github.com/LSSTDESC/parsnip) for [ZTF](https://www.ztf.caltech.edu/). This is achieved by using [fpbot](https://github.com/simeonreusch/fpbot) forced photometry lightcurves of the [Bright Transient Survey](https://sites.astro.caltech.edu/ztf/bts/bts.php). These are augmented (redshifted, noisified and - when possible - K-corrected).\n\nThe package is maintained by [A. Townsend](https://github.com/aotownsend) (HU Berlin) and [S. Reusch](https://github.com/simeonreusch) (DESY).\n\nThe following augmentation steps are taken for each parent lightcurve to generate a desired number of children (calculated via `weights`):\n\n- draw a new redshift from a cubic distribution with maximum redshift increase `delta_z`\n- only accept the lightcurve if at least `n_det_threshold` datapoints are above the signal-to-noise threshold `SN_threshold`\n- if the lightcurve has an existing SNCosmo template, apply a [K-correction](https://en.wikipedia.org/wiki/K_correction) at that magnitude (if `k_corr=True`)\n- randomly drop datapoints until `subsampling_rate` is reached\n- add some scatter to the observed dates (`jd_scatter_sigma` in days)\n- if `phase_lim=True`, only keep datapoints during a typical duration (depends on the type of source)\n\n:warning:\nNote that a high `delta_z` without loosening the `SN_threshold` and `n_det_threshold` will result in a large dropout rate, which will ultimately lead to far less lightcurves being generated than initially desired.\n\n## Usage\n### Create an augmented training sample\n```python\nfrom pathlib import Path\nfrom ztfparsnip.create import CreateLightcurves\n\nweights = {\"sn_ia\": 9400, \"tde\": 9400, \"sn_other\": 9400, \"agn\": 9400, \"star\": 9400}\n\nif __name__ == \"__main__\":\n sample = CreateLightcurves(\n output_format=\"parsnip\",\n classkey=\"simpleclasses\",\n weights=weights,\n train_dir=Path(\"train\"),\n plot_dir=Path(\"plot\"),\n seed=None,\n phase_lim=True,\n k_corr=True,\n )\n sample.select()\n sample.create(plot_debug=False)\n```\n\n### Train Parsnip with the augmented sample\n```python\nfrom ztfparsnip.train import Train\n\nif __name__ == \"__main__\":\n train = Train(classkey=\"simpleclasses\", seed=None)\n train.run()\n```\n\n### Evaluate the Parsnip model\n```python\nfrom ztfparsnip.train import Train\n\nif __name__ == \"__main__\":\n train = Train(classkey=\"simpleclasses\", seed=None)\n train.classify()\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Generate noisified lightcurves based on the BTS sample and retrain Parsnip with these.",
"version": "0.3.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "92ec73034df264cf13a22614b3b3f342701dcf4b7eb29efe26ee159fad80e88f",
"md5": "3f9fe276f16366ded10d5ff90702a670",
"sha256": "30a85b070a48119e1be06d61364865ec2fae76876e3fe2bcd3e61f3efb382589"
},
"downloads": -1,
"filename": "ztfparsnip-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3f9fe276f16366ded10d5ff90702a670",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<3.12",
"size": 3161429,
"upload_time": "2023-08-16T07:29:06",
"upload_time_iso_8601": "2023-08-16T07:29:06.788462Z",
"url": "https://files.pythonhosted.org/packages/92/ec/73034df264cf13a22614b3b3f342701dcf4b7eb29efe26ee159fad80e88f/ztfparsnip-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3de8b4caa6671b13b23be052dd5e01db536abb560f6a676cb4426ec3d5175cb9",
"md5": "a5e91a4b993c8a53ebfa314bd6ce9ba8",
"sha256": "d4a214daf24b0b8bbc80ab5211724ef70211dd7bd3497f71aae432dd604af210"
},
"downloads": -1,
"filename": "ztfparsnip-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "a5e91a4b993c8a53ebfa314bd6ce9ba8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<3.12",
"size": 3134724,
"upload_time": "2023-08-16T07:29:09",
"upload_time_iso_8601": "2023-08-16T07:29:09.075848Z",
"url": "https://files.pythonhosted.org/packages/3d/e8/b4caa6671b13b23be052dd5e01db536abb560f6a676cb4426ec3d5175cb9/ztfparsnip-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-16 07:29:09",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "ztfparsnip"
}