{"id":13717463,"url":"https://github.com/fancompute/wavetorch","last_synced_at":"2026-01-21T16:07:00.155Z","repository":{"id":57496795,"uuid":"170393593","full_name":"fancompute/wavetorch","owner":"fancompute","description":" 🌊 Numerically solving and backpropagating through the wave equation","archived":false,"fork":false,"pushed_at":"2020-02-08T05:12:15.000Z","size":17780,"stargazers_count":530,"open_issues_count":3,"forks_count":84,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-05-07T07:39:48.885Z","etag":null,"topics":["differential-equations","pytorch","recurrent-neural-network","rnn","time-series","vowel-recognition","wave-equation"],"latest_commit_sha":null,"homepage":"https://advances.sciencemag.org/content/5/12/eaay6946","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/fancompute.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}},"created_at":"2019-02-12T21:23:46.000Z","updated_at":"2025-03-24T05:41:24.000Z","dependencies_parsed_at":"2022-09-03T02:10:22.277Z","dependency_job_id":null,"html_url":"https://github.com/fancompute/wavetorch","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/fancompute/wavetorch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancompute%2Fwavetorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancompute%2Fwavetorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancompute%2Fwavetorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancompute%2Fwavetorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fancompute","download_url":"https://codeload.github.com/fancompute/wavetorch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancompute%2Fwavetorch/sbom","scorecard":{"id":392013,"data":{"date":"2025-08-11","repo":{"name":"github.com/fancompute/wavetorch","commit":"927ad02dc9db83f72b8df1d91418a6681e60fd56"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"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 0/30 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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":-1,"reason":"No tokens found","details":null,"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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"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":"Vulnerabilities","score":0,"reason":"10 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2021-856 / GHSA-5545-2q6w-2gh6","Warn: Project is vulnerable to: GHSA-6p56-wp2h-9hxr","Warn: Project is vulnerable to: PYSEC-2019-108 / GHSA-9fq2-x9r6-wfmf","Warn: Project is vulnerable to: PYSEC-2021-857 / GHSA-f7c7-j99h-c22f","Warn: Project is vulnerable to: GHSA-fpfv-jqm9-f5jm","Warn: Project is vulnerable to: PYSEC-2020-73","Warn: Project is vulnerable to: GHSA-53q9-r3pm-6pq6","Warn: Project is vulnerable to: PYSEC-2020-107 / GHSA-jjw5-xxj6-pcv5","Warn: Project is vulnerable to: PYSEC-2024-110 / GHSA-jw8x-6495-233v","Warn: Project is vulnerable to: PYSEC-2020-108"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T18:04:27.111Z","repository_id":57496795,"created_at":"2025-08-18T18:04:27.111Z","updated_at":"2025-08-18T18:04:27.111Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28635927,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T15:01:31.228Z","status":"ssl_error","status_checked_at":"2026-01-21T14:42:58.942Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["differential-equations","pytorch","recurrent-neural-network","rnn","time-series","vowel-recognition","wave-equation"],"created_at":"2024-08-03T00:01:22.627Z","updated_at":"2026-01-21T16:07:00.150Z","avatar_url":"https://github.com/fancompute.png","language":"Python","readme":"# wavetorch\n\n![](../master/img/optimization.png)\n\n## Overview\n\nThis python package provides recurrent neural network (RNN) modules for pytorch that compute time-domain solutions to the [scalar wave equation](https://en.wikipedia.org/wiki/Wave_equation). The code in this package is the basis for the results presented in our [recent paper](https://arxiv.org/abs/1904.12831), where we demonstrate that [recordings](https://homepages.wmich.edu/~hillenbr/voweldata.html) of spoken vowels can be classified as their waveforms propagate through a trained inhomogeneous material distribution. \n\nThis package not only provides a numerical framework for solving the wave equation, but it also allows the gradient of the solutions to be computed *automatically* via pytorch's automatic differentiation framework. This gradient computation is equivalent to the adjoint variable method (AVM) that has recently gained popularity for performing inverse design and optimization of photonic devices.\n\nFor additional information and discussion see our paper:\n\n* T. W. Hughes*, I. A. D. Williamson*, M. Minkov, and S. Fan, [Wave physics as an analog recurrent neural network](https://advances.sciencemag.org/content/5/12/eaay6946), Science Advances, vol. 5, no. 12, p. eaay6946, Dec. 2019\n\n## Components\n\nThe machine learning examples in this package are designed around the task of vowel recognition, using the dataset of raw audio recordings available from Prof James Hillenbrand's [website](https://homepages.wmich.edu/~hillenbr/voweldata.html). However, the core modules provided by this package, which are described below, may be applied to other learning or inverse design tasks involving time-series data. \n\nThe `wavetorch` package provides several individual modules, each subclassing `torch.nn.Module`. These modules can be combined to model the wave equation or (potentially) used as components to build other networks.\n\n* `WaveRNN` - A wrapper which contains *one* or more `WaveSource` modules, *zero* or more `WaveProbe` modules, and a single `WaveCell` module. The `WaveRNN` module is a convenient wrapper around the individual components and handles time-stepping the wave equation. If no probes are present, the output of `WaveRNN` is the scalar field distribution as a function of time. If probes are present, the output will be (by default) the probe values, but this output can be overridded to instead output the field distribution.\n    * `WaveCell` - Implements a single time step of the [scalar wave equation](https://en.wikipedia.org/wiki/Wave_equation).\n        * `WaveGeometry` - The children of this module implement the parameterization of the physical domain used by the `WaveCell` module. Although the geometry module subclasses `torch.nn.Module`, it has no `forward()` method and serves only to provide a parameterization of the material density to the `WaveCell` module. Subclassing `torch.nn.Module` was necessary in order to properly expose the trainable parameters to pytorch.\n    * `WaveSource` - Implements a source for injecting waves into the [scalar wave equation](https://en.wikipedia.org/wiki/Wave_equation).\n    * `WaveProbe` - Implements a probe for measuring wave amplitudes (or intensities) at points in the domain defined by a `WaveGeometry`.\n\n## Usage\n\n### Propagating waves\n\nSee [study/propagate.py](study/propagate.py)\n\n![](../master/img/propagate.png)\n\n### Optimization and inverse design of a lens\n\nSee [study/optimize_lens.py](study/optimize_lens.py) \n\n![](../master/img/inverse_design_lens.png)\n\n### Vowel recognition\n\nTo train the model using the configuration specified by the file [study/example.yml](study/example.yml), issue the following command from the top-level directory of the repository:\n```\npython ./study/vowel_train.py ./study/example.yml\n```\nThe configuration file, [study/example.yml](study/example.yml), is commented to provide information on how the vowel data is processed, how the physics of the problem is specified, and how the training process is configured.\n\nDuring training, the progress of the optimization will be printed to the screen. At the end of each epoch, the current state of the model, along with a history of the model state and performance at all previous epochs and cross validation folds, is saved to a file.\n\n**WARNING:** depending on the batch size, the window length, and the sample rate for the vowel data (all of which are specified in the YAML configuration file) the gradient computation may require a significant amount of memory. It is recommended to start small with the batch size and work your way up gradually, depending on what your machine can handle.\n\n#### Summary of vowel recognition results\n\nA summary of a trained model which was previously saved to disk can be generated like so:\n```\npython ./study/vowel_summary.py \u003cPATH_TO_MODEL\u003e\n```\n\n![](../master/img/summary.png)\n\n#### Display field snapshots during vowel recognition\n\nSnapshots of the scalar field distribution for randomly selected vowels samples can be generated like so:\n```\npython ./study/vowel_analyze.py fields \u003cPATH_TO_MODEL\u003e --times 1500 2500 3500 ...\n```\n\n![](../master/img/fields.png)\n\n#### Display short-time Fourier transform (STFT) of vowel waveforms\n\nA matrix of short time Fourier transforms of the received signal, where the row corresponds to an input vowel and the column corresponds to a particular probe (matching the confusion matrix distribution) can be generated like so:\n```\npython ./study/vowel_analyze.py stft \u003cPATH_TO_MODEL\u003e\n```\n\n![](../master/img/stft.png)\n\n## Dependencies\n\n* `pytorch`\n* `scikit-learn`\n* `scikit-image`\n* `librosa`\n* `seaborn`\n* `matplotlib`\n* `numpy`\n* `yaml`\n* `pandas`\n","funding_links":[],"categories":["Pytorch \u0026 related libraries｜Pytorch \u0026 相关库","simulation","Pytorch \u0026 related libraries"],"sub_categories":["Other libraries｜其他库:","Other libraries:"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffancompute%2Fwavetorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffancompute%2Fwavetorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffancompute%2Fwavetorch/lists"}