{"id":40751564,"url":"https://github.com/fancompute/fdfdpy","last_synced_at":"2026-01-21T16:04:51.543Z","repository":{"id":57428874,"uuid":"123981196","full_name":"fancompute/fdfdpy","owner":"fancompute","description":"Pure Python implementation of the finite difference frequency domain (FDFD) method for electromagnetics","archived":false,"fork":false,"pushed_at":"2018-11-05T22:12:15.000Z","size":1465,"stargazers_count":53,"open_issues_count":3,"forks_count":17,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-11T11:26:02.544Z","etag":null,"topics":["eigenvalues","eigenvectors","electromagnetics","fdfd","finite-difference","frequency-domain","modal-calculations","optics","python-fdfd"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-05T21:29:09.000Z","updated_at":"2024-07-26T11:49:29.000Z","dependencies_parsed_at":"2022-09-09T02:11:45.225Z","dependency_job_id":null,"html_url":"https://github.com/fancompute/fdfdpy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fancompute/fdfdpy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancompute%2Ffdfdpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancompute%2Ffdfdpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancompute%2Ffdfdpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancompute%2Ffdfdpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fancompute","download_url":"https://codeload.github.com/fancompute/fdfdpy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fancompute%2Ffdfdpy/sbom","scorecard":{"id":392009,"data":{"date":"2025-08-11","repo":{"name":"github.com/fancompute/fdfdpy","commit":"49d3682a9cface0e2ce32932f4dbfc36adff9fef"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"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":"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/17 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":"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":"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":"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.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"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 14 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-18T18:04:25.338Z","repository_id":57428874,"created_at":"2025-08-18T18:04:25.338Z","updated_at":"2025-08-18T18:04:25.338Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28635926,"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":["eigenvalues","eigenvectors","electromagnetics","fdfd","finite-difference","frequency-domain","modal-calculations","optics","python-fdfd"],"created_at":"2026-01-21T16:04:50.906Z","updated_at":"2026-01-21T16:04:51.529Z","avatar_url":"https://github.com/fancompute.png","language":"Jupyter Notebook","readme":"![](img/dipole_dielectric_field.png)\n\n# fdfdpy\n\nThis is a pure Python implementation of the finite difference frequency domain (FDFD) method. It makes use of scipy, numpy, matplotlib, and the MKL Pardiso solver. fdfdpy currently supports 2D geometries\n\n## Installation\n\n    python setup.py install\n\n## Examples\n\nSee the ipython notebooks in `notebooks`.\n\n## Unit Tests\n\nSome basic tests are included in `tests/`\n\nTo run an example test, `tests/test_nonlinear_solvers.py`, either call\n\n\tpython -m unittest tests/test_nonlinear_solvers.py\n\nor\n\n\tpython tests/test_nonlinear_solvers.py\n\n## Structure\n\n### Initialization\n\nThe `Simulation` class is initialized as\n\n\tfrom fdfdpy import Simulation\n\tsimulation = Simulation(omega, eps_r, dl, NPML, pol, L0)\n\n- `omega` : the angular frequency in units of` 2 pi / seconds`\n- `eps_r` : a numpy array specifying the relative permittivity distribution\n- `dl` : the spatial grid size in units of `L0`\n- `NPML` : defines number of PML grids `[# on x borders, # on y borders]`\n- `pol` : polarization, one of `{'Hz','Ez'}` where `z` is the transverse field.\n- `L0` : (optional) simulation length scale, default is 1e-6 meters (one micron)\n\nCreating a new Fdfd object solves for:\n\n- `xrange` : defines spatial domain in x [left-most position, right-most position] in units of `L0`\n- `yrange` : defines spatial domain in y [bottom-most position, top-most position] in units of `L0`\n- `A` : the Maxwell operator, which is used later to solve for the E\u0026M fields.\n- `derivs` : dictionary storing the derivative operators.\n\nIt also creates a relative permeability, `mu_r`, as `numpy.ones(eps_r.shape)` and a source `src` as `numpy.zeros(eps_r.shape)`.\n\n### Adding sources is exciting!\n\nSources can be added to the simulation either by manually editing the 2D src array inside of the simulation object,\n\n\tsimulation.src[10,20:30] = 1\n\nor by adding modal sources, which are defined as planes within the 2D domain which launch a mode in their normal direction. Modal source definitions can be added to the simulation by\n\n\tsimulation.add_mode(neff, direction, center, width)\n\tsimulation.setup_modes()\n\n- `neff` : defines the effective index of the mode; this will be used as the eigenvalue guess\n- `direction` : defines the normal direction of the plane, should be either 'x' or 'y'\n- `center` : defines the center coordinates for the plane in cell coordinates [xc, yc]\n- `width` : defines the width of the plane in number of cells\n\nNote that `simulation.setup_modes()` must always be called after adding mode(s) in order to populate `simulation.src`.\n\n### Solving for the electromagnetic fields\n\nNow, we have everything we need to solve the system for the electromagnetic fields, by running\n\n\tfields = simulation.solve_fields(timing=False)\n\n`simulation.src` is proportional to either the `Jz` or `Mz` source term, depending on whether `pol` is set to `'Ez'` or `'Hz'`, respectively.\n\n`fields` is a tuple containing `(Ex, Ey, Hz)` or `(Hx, Hy, Ez)` depending on the polarization.\n\n### Setting a new permittivity\n\nIf you want to change the permittivity distribution, reassigning `eps_r`\n\n\tsimulation.eps_r = eps_new\n\nwill automatically solve for a new system matrix with the new permittivity distribution.  Note that `simulation.setup_modes()` should also be called if the permittivity changed within the plane of any of the modal sources. \u003c- I'll make this happen automatically later -T\n\n### Plotting\n\nPrimary fields (Hz/Ez) can be visualized using the included helper functions:\n\n\tsimulation.plt_re(outline=True, cbar=True)\n\tsimulation.plt_abs(outline=True, cbar=True, vmax=None)\n\nThese optionally outline the permittivity with contours and can be supplied with a matplotlib axis handle to plot into.\n\n### To Do\n\n#### Whenever\n- [ ] xrange, yrange labels on plots.\n- [ ] set modal source amplitude (and normalization)\n- [ ] Add ability to run local jupyter notebooks running FDFD on parallel from server.\n- [ ] Save the factorization of `A` in the `Fdfd` object to be reused later if one has the same `A` but a different `b`.\n- [ ] Allow the source term to have `(Jx, Jy, Jz, Mx, My, Mz)`, which would be useful for adjoint stuff where the source is not necessarily along the `z` direction.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffancompute%2Ffdfdpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffancompute%2Ffdfdpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffancompute%2Ffdfdpy/lists"}