{"id":17358290,"url":"https://github.com/yymao/abundancematching","last_synced_at":"2025-04-15T00:28:53.027Z","repository":{"id":55413194,"uuid":"326017655","full_name":"yymao/abundancematching","owner":"yymao","description":"A Python package for subhalo abundance matching (SHAM) with scatter.","archived":false,"fork":false,"pushed_at":"2025-01-28T23:28:37.000Z","size":40,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T16:36:02.474Z","etag":null,"topics":["abundance-matching","astrophysics","deconvolution","python","subhalo-abundance-matching"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yymao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-01-01T16:47:57.000Z","updated_at":"2025-02-01T08:01:26.000Z","dependencies_parsed_at":"2025-04-12T16:47:45.116Z","dependency_job_id":null,"html_url":"https://github.com/yymao/abundancematching","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yymao%2Fabundancematching","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yymao%2Fabundancematching/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yymao%2Fabundancematching/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yymao%2Fabundancematching/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yymao","download_url":"https://codeload.github.com/yymao/abundancematching/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248983273,"owners_count":21193546,"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":["abundance-matching","astrophysics","deconvolution","python","subhalo-abundance-matching"],"created_at":"2024-10-15T19:05:00.479Z","updated_at":"2025-04-15T00:28:53.019Z","avatar_url":"https://github.com/yymao.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AbundanceMatching\n\n[![PyPI:AbundanceMatching](https://img.shields.io/pypi/v/AbundanceMatching.svg)](https://pypi.python.org/pypi/AbundanceMatching)\n[![ascl:1604.006](https://img.shields.io/badge/ascl-1604.006-blue.svg?colorB=262255)](https://ascl.net/1604.006)\n\nA python module that implements subhalo abundance matching. \nThis module can interpolate and extrapolate abundance functions (e.g., stellar mass function, halo mass function) \nand provides Peter Behroozi's fiducial deconvolution implementation ([Behroozi et al. 2010](https://ui.adsabs.harvard.edu/abs/2010ApJ...717..379B/abstract)).\n\n## Installation\n\n```bash\npip install abundancematching\n```\n\n## Example\n\nHere's an example to do abundance matching with this code.\n\n```python\n\"\"\"\nAssume you have a numpy structured array `halos`,\nwhich contains a list of halos, with labels of the quantity names.\nAssume you also have a luminosity function table `lf`,\nwhose first column is the quantity to match (e.g. magnitude),\nand the second column is the abundance (per Mpc^3 per Mag).\n\"\"\"\n\nimport matplotlib.pyplot as plt\nfrom AbundanceMatching import AbundanceFunction, LF_SCATTER_MULT, calc_number_densities, add_scatter, rematch\n\naf = AbundanceFunction(lf[:,0], lf[:,1], (-27, -5))\n\n# check the abundance function\nplt.semilogy(lf[:,0], lf[:,1])\nx = np.linspace(-27, -5, 101)\nplt.semilogy(x, af(x))\n\n# deconvolution and check results (it's a good idea to always check this)\nscatter = 0.2\nremainder = af.deconvolute(scatter*LF_SCATTER_MULT, 20)\nx, nd = af.get_number_density_table()\nplt.plot(x, remainder/nd);\n\n# get number densities of the halo catalog\nbox_size = 100 \nnd_halos = calc_number_densities(halos['vpeak'], box_size)\n\n# do abundance matching with no scatter\ncatalog = af.match(nd_halos)\n\n#do abundance matching with some scatter\ncatalog_sc = af.match(nd_halos, scatter*LF_SCATTER_MULT)\n\n#if you want to do multiple (100) realizations:\ncatalog_deconv = af.match(nd_halos, scatter*LF_SCATTER_MULT, False)\nfor __ in range(100):\n    catalog_this = add_scatter(catalog_deconv, scatter*LF_SCATTER_MULT)\n    catalog_this = rematch(catalog_this, catalog, af._x_flipped)\n    # do something with catalog_this\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyymao%2Fabundancematching","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyymao%2Fabundancematching","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyymao%2Fabundancematching/lists"}