{"id":21280628,"url":"https://github.com/borgwardtlab/topf","last_synced_at":"2025-04-14T12:53:26.992Z","repository":{"id":69144800,"uuid":"153589085","full_name":"BorgwardtLab/Topf","owner":"BorgwardtLab","description":"Topological peak filtering","archived":false,"fork":false,"pushed_at":"2020-07-29T12:04:29.000Z","size":92,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-28T02:03:34.295Z","etag":null,"topics":["peak-detection","persistent-homology","topological-data-analysis"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BorgwardtLab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2018-10-18T08:22:31.000Z","updated_at":"2024-11-18T14:52:26.000Z","dependencies_parsed_at":"2023-03-11T05:19:37.553Z","dependency_job_id":null,"html_url":"https://github.com/BorgwardtLab/Topf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorgwardtLab%2FTopf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorgwardtLab%2FTopf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorgwardtLab%2FTopf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BorgwardtLab%2FTopf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BorgwardtLab","download_url":"https://codeload.github.com/BorgwardtLab/Topf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248885455,"owners_count":21177625,"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":["peak-detection","persistent-homology","topological-data-analysis"],"created_at":"2024-11-21T10:37:45.355Z","updated_at":"2025-04-14T12:53:26.962Z","avatar_url":"https://github.com/BorgwardtLab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":" \u003cimg src=\"topf.svg\" height=\"128\" /\u003e\n\n# Topf \u0026mdash; Topological peak filtering\n\n`topf` is a small library for Python 3 that permits the detection and\nsubsequent filtering of peaks in one-dimensional functions. The method\nis based on a topological notion of *prominence* or *persistence* of a\npeak with respect to all other peaks.\n\n# Dependencies\n\n- Python 3.7\n- `numpy`\n\n# Installation\n\n- Clone the repository\n- `poetry install` (for local development)\n- `pip3 install .` (for global usage)\n\n# Usage\n\nInstall the library using `pip3 install topf`. You can then access the\nmain class, `PersistenceTransformer` by issuing `import topf`. As\na simple example, we load the file `example.txt`, depict its peaks,\nand filter the smallest ones:\n\n```python\nimport topf\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport seaborn as sns\n\n\ndata = np.genfromtxt('example.txt')          # load data\ntransformer = topf.PersistenceTransformer()  # prepare transformer\npeaks = transformer.fit_transform(data)      # transform data into peaks\n\n# First, let's plot the original data. We can see that there is\n# quite a number of relatively small peaks.\nplt.subplot(3, 1, 1)\nsns.lineplot(x=data[:, 0], y=data[:, 1])\n\n# Second, let's show the transformed data. Here, every non-zero\n# point depicts the *prominence* of a peak.\nplt.subplot(3, 1, 2)\nsns.lineplot(x=peaks[:, 0], y=peaks[:, 1])\n\n# Third, let's show an example of filtering. At present, there is\n# no automated way of doing so.\nfiltered_data = data[peaks[:, 1] \u003e 4]  # only keep high peaks\n\nplt.subplot(3, 1, 3)\nsns.lineplot(x=data[:, 0], y=data[:, 1], alpha=0.5)\nsns.scatterplot(\n    x=filtered_data[:, 0],\n    y=filtered_data[:, 1],\n)\n\nplt.tight_layout()\nplt.show()\n```\n\nThis file is also available as [`example.py`](examples/example.py) in this\nrepository\u0026nbsp;(with some minor modifications to simplify usage).\nIt will result in the following output:\n\n![Example data with peak filtering](examples/example.png)\n\n# Licence notice\n\nThe icon of this project was created by \u003ca href=\"http://www.freepik.com\"\ntitle=\"Freepik\"\u003eFreepik\u003c/a\u003e from \u003ca href=\"https://www.flaticon.com/\"\ntitle=\"Flaticon\"\u003ewww.flaticon.com\u003c/a\u003e and is licensed by \u003ca\nhref=\"http://creativecommons.org/licenses/by/3.0/\" title=\"Creative\nCommons BY 3.0\" target=\"_blank\"\u003eCC 3.0 BY\u003c/a\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborgwardtlab%2Ftopf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborgwardtlab%2Ftopf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborgwardtlab%2Ftopf/lists"}