{"id":20305205,"url":"https://github.com/nelsonwenner/shape-similarity","last_synced_at":"2025-10-13T04:30:44.097Z","repository":{"id":48521182,"uuid":"385780884","full_name":"nelsonwenner/shape-similarity","owner":"nelsonwenner","description":":chart_with_upwards_trend: The package allows you to check the similarity between two shapes/curves, using Frechet distance together with Procrustes analysis.","archived":false,"fork":false,"pushed_at":"2024-07-29T14:53:02.000Z","size":45,"stargazers_count":46,"open_issues_count":5,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-29T14:23:38.239Z","etag":null,"topics":["curve","distance","frechet-distance","procrustes-analysis","python3","similarity"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nelsonwenner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-07-14T01:37:37.000Z","updated_at":"2025-09-12T02:33:20.000Z","dependencies_parsed_at":"2025-01-15T07:10:32.791Z","dependency_job_id":"545870cc-c783-4f1a-b3b6-30d8f43a9783","html_url":"https://github.com/nelsonwenner/shape-similarity","commit_stats":{"total_commits":67,"total_committers":1,"mean_commits":67.0,"dds":0.0,"last_synced_commit":"cc4ab524ebd333291d6a2b3c23c96ecffa459d6d"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nelsonwenner/shape-similarity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nelsonwenner%2Fshape-similarity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nelsonwenner%2Fshape-similarity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nelsonwenner%2Fshape-similarity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nelsonwenner%2Fshape-similarity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nelsonwenner","download_url":"https://codeload.github.com/nelsonwenner/shape-similarity/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nelsonwenner%2Fshape-similarity/sbom","scorecard":{"id":679239,"data":{"date":"2025-08-11","repo":{"name":"github.com/nelsonwenner/shape-similarity","commit":"dd56242e56e2335531eb4bd463fd7df6181becc3"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.1,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 1/11 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/nelsonwenner/shape-similarity/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/nelsonwenner/shape-similarity/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/nelsonwenner/shape-similarity/ci.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:22","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:25","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 26 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T22:33:57.889Z","repository_id":48521182,"created_at":"2025-08-21T22:33:57.890Z","updated_at":"2025-08-21T22:33:57.890Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279013688,"owners_count":26085390,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["curve","distance","frechet-distance","procrustes-analysis","python3","similarity"],"created_at":"2024-11-14T17:07:40.534Z","updated_at":"2025-10-13T04:30:43.773Z","avatar_url":"https://github.com/nelsonwenner.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch2 align=\"center\"\u003e\n  SHAPE SIMILARITY\n\u003c/h2\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Workflow\" src=\"https://github.com/nelsonwenner/shape-similarity/workflows/shapesimilarity%20ci/badge.svg\"\u003e\n  \u003cimg alt=\"Codecov\" src=\"https://codecov.io/gh/nelsonwenner/shape-similarity/branch/master/graph/badge.svg?token=AZW2BNGG4G\"\u003e\n\u003c/p\u003e\n\n## :bulb: About\nThe package allows you to check the similarity between two shapes/curves, using Frechet distance together with Procrustes analysis.\nInternally, `shape_similarity` works by first normalizing the curves using Procrustes analysis and then calculating Fréchet distance between the curves.\n\n## :page_facing_up: Content\n* Frechet Distance\n  * In mathematics, the Fréchet distance is a measure of similarity between curves that takes into account the location and ordering of the points along the curves. Imagine a person traversing a finite curved path while walking their dog on a leash, with the dog traversing a separate finite curved path. Each can vary their speed to keep slack in the leash, but neither can move backwards. The Fréchet distance between the two curves is the length of the shortest leash sufficient for both to traverse their separate paths from start to finish. Note that the definition is symmetric with respect to the two curves—the Fréchet distance would be the same if the dog were walking its owner.\n  \n* Procrustes Analysis\n  * In statistics, Procrustes analysis is a form of statistical shape analysis used to analyse the distribution of a set of shapes. To compare the shapes of two or more objects, the objects must be first optimally \"superimposed\". Procrustes superimposition (PS) is performed by optimally translating, rotating and uniformly scaling the objects. In other words, both the placement in space and the size of the objects are freely adjusted. The aim is to obtain a similar placement and size, by minimizing a measure of shape difference called the Procrustes distance between the objects.  \n\n## :rocket: Technologies\n* [Python3](https://www.python.org/)\n\n## :package: Installation\n1. Install with pip\n```shell\n$ python -m pip install shapesimilarity\n```\n2. Install from source code\n```shell\n$ git clone https://github.com/nelsonwenner/shape-similarity.git\n\n$ python -m pip install .\n```\n3. Run the tests\n```shell\n$ python -m pip install pytest\n\n$ python -m pytest\n```\n\n## :information_source: Example useage\n```python\nfrom shapesimilarity import shape_similarity\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nx = np.linspace(1, -1, num=200)\n\ny1 = 2*x**2 + 1\ny2 = 2*x**2 + 2\n\nshape1 = np.column_stack((x, y1))\nshape2 = np.column_stack((x, y2))\n\nsimilarity = shape_similarity(shape1, shape2)\n\nplt.plot(shape1[:,0], shape1[:,1], linewidth=2.0)\nplt.plot(shape2[:,0], shape2[:,1], linewidth=2.0)\n\nplt.title(f'Shape similarity is: {similarity}', fontsize=14, fontweight='bold')\nplt.show()\n```\n* You can further customize the precision of the shape_similarity function by changing the rotation (default 10). Increasing it will increase accuracy. You can also disable rotation correction completely (default True).\n  ```python\n  # disable rotation correction entirely\n  shape_similarity(shape1, shape2, checkRotation=False)\n\n  # higher accuracy, but slower\n  shape_similarity(shape1, shape2, rotation=30)\n  ```\n\n## :chart_with_downwards_trend: Results\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"plot1\" src=\"https://user-images.githubusercontent.com/40550247/126214358-6aa995aa-15b1-4c60-9f0e-34bbef91a99b.png\"\u003e\n  \u003cimg alt=\"plot2\" src=\"https://user-images.githubusercontent.com/40550247/126214579-302d9220-98ed-4823-992b-d4439145bc5a.png\"\u003e\n\u003c/p\u003e\n\n## :pushpin: Referencies\n* [Frechet distance](https://en.wikipedia.org/wiki/Fr%C3%A9chet_distance)\n* [Procrustes analysis](https://en.wikipedia.org/wiki/Procrustes_analysis)\n* [Curve Matcher](https://github.com/chanind/curve-matcher)\n\n---\nMade with :hearts: by Nelson Wenner :wave: [Get in touch!](https://www.linkedin.com/in/nelsonwenner/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnelsonwenner%2Fshape-similarity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnelsonwenner%2Fshape-similarity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnelsonwenner%2Fshape-similarity/lists"}