{"id":22669856,"url":"https://github.com/astrobarker/asymptote","last_synced_at":"2025-03-29T11:15:34.306Z","repository":{"id":206562593,"uuid":"716801560","full_name":"AstroBarker/asymptote","owner":"AstroBarker","description":"Bayesian inference for core-collapse supernova simulation explosion energy","archived":false,"fork":false,"pushed_at":"2024-08-24T04:12:37.000Z","size":95,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-04T10:56:38.588Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AstroBarker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-09T22:47:22.000Z","updated_at":"2024-08-24T04:12:41.000Z","dependencies_parsed_at":"2024-12-09T15:41:51.019Z","dependency_job_id":"cdf1eced-832a-455a-b28d-98bd1076b38c","html_url":"https://github.com/AstroBarker/asymptote","commit_stats":null,"previous_names":["astrobarker/asymptote"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstroBarker%2Fasymptote","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstroBarker%2Fasymptote/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstroBarker%2Fasymptote/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstroBarker%2Fasymptote/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AstroBarker","download_url":"https://codeload.github.com/AstroBarker/asymptote/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246174609,"owners_count":20735417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-09T15:41:41.761Z","updated_at":"2025-03-29T11:15:34.268Z","avatar_url":"https://github.com/AstroBarker.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ASYMPTOTic explosion Energy\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\nCode to estimate asymtptotic core-collapse supernova explosion energy following the methods of  [Murphy et al. 2019](https://ui.adsabs.harvard.edu/abs/2019MNRAS.489..641M/abstract).\nFit a physically motivated functional form for the time dependence of the explosion energy using MCMC methods using [emcee](https://emcee.readthedocs.io/en/stable/index.html).\n\n## Functional Form\nWe fit a function of the following form\n\n$$E_{\\mathrm{expl}} = E_{\\infty} - A / t$$\n\nwhere $E_{\\infty}$ is the asymptotic explosion energy and $A$ is a fit parameter encapsulating physics such as opacitiy and heating rate.\nWe fit this equation to simulation output using Markov Chain Monte Carlo (MCMC) Bayesian inference methods.\nThe posterior distribution for $E_{\\infty}$ and $A$ is\n\n$$ P(E_{\\infty}, A, \\sigma | {E_{\\mathrm{sim},i}}) \\propto \\mathcal{L}({E_{\\mathrm{sim},i}} | E_{\\infty}, A, \\sigma)P(E_{\\infty})P(A)P(\\sigma) $$\n\nwhere $P(E_{\\infty})$, $P(A)$, and $P(\\sigma)$ are uniform priors.\nVariance $\\sigma^2$ on simulation explosion energies is unknown and treated as a free parameter to be marginalized over.\nIn practice, it is very small (unless the fit is very bad).\n\nOur likelihoods are given by\n\n$$\\mathcal{L}({E_{\\mathrm{sim},i}} | E_{\\infty}, A, \\sigma)P(E_{\\infty})P(A)P(\\sigma) = \\prod_{i} \\frac{1}{\\sqrt{2\\pi\\sigma}} e^{-[E_{\\mathrm{sim},i} - E_{\\mathrm{expl}}(E_{\\infty}, a, t)]^2/[2\\sigma^2]}$$\n\nIn practice, you should fit the latter half or third of your data (post shock revival). \nThis is controlled with the `--frac` command line arg or `self.fit_frac` member attribute. \nDefault value is 0.5, to only fit the second half of data, but this may need tweaking on a case-by-case basis.\n\nThis produces mean and uncertainties on $log_{10}(E)$. \nTo propagate this to uncertainty on $E$, a convenience function `propagate_error` is available.\nIt uses Monte Carlo error propagation to capture the potentially asymmetric uncertainties on $E$.\n\n## Dependencies\n- numpy\n- matplotlib\n- emcee\n- corner\n- optional: tqdm (for progress bar)\n\n## Usage\nThis code assumes that it is loading FLASH `.dat` output. \nTo use with your data, add a function as needed to load time and energy data.\n\nWith `asymptote.py` contents in your working directory, or in your `$PYTHONPATH`, you may simply\n```python\nimport asymptote\nmymodel = asymptote.Model(path_to_data, fit_frac)\nmymodel.fit_energy(nwalkers=32, nsamples=16384, nburn=512)\nE_asym = mymodel.E_asym\n```\n\nor simply as a script\n```shell\npython asymptote.py --nwalkers 32 --nsamples 16384 --nburn 512 --frac 0.5\n```\n\nSee `help(asymptote.Model)`, or the source code docstrings, for documentation.\n\n# Code Style\nCode linting and formatting is done with [ruff](https://docs.astral.sh/ruff/).\nRules are listed in [ruff.toml](ruff.toml).\nTo check all python in the current directory, you may `ruff .`.\nTo format a given file according to `ruff.toml`, run `ruff format file.py`.\nChecks for formatting are performed on each push / PR.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastrobarker%2Fasymptote","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastrobarker%2Fasymptote","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastrobarker%2Fasymptote/lists"}