{"id":14989255,"url":"https://github.com/marcos-moura97/opticalpyber","last_synced_at":"2026-01-30T21:37:20.278Z","repository":{"id":57690731,"uuid":"481918035","full_name":"marcos-moura97/opticalpyber","owner":"marcos-moura97","description":"Package with tools to waveguides and optical fibers","archived":false,"fork":false,"pushed_at":"2022-04-21T12:06:40.000Z","size":98,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-20T19:29:08.994Z","etag":null,"topics":["electromagnetic-simulation","electromagnetism","physics","python","scipy"],"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/marcos-moura97.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-15T10:11:11.000Z","updated_at":"2022-04-22T09:40:30.000Z","dependencies_parsed_at":"2022-09-26T20:52:35.728Z","dependency_job_id":null,"html_url":"https://github.com/marcos-moura97/opticalpyber","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marcos-moura97/opticalpyber","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcos-moura97%2Fopticalpyber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcos-moura97%2Fopticalpyber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcos-moura97%2Fopticalpyber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcos-moura97%2Fopticalpyber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcos-moura97","download_url":"https://codeload.github.com/marcos-moura97/opticalpyber/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcos-moura97%2Fopticalpyber/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28919735,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T20:25:28.696Z","status":"ssl_error","status_checked_at":"2026-01-30T20:25:13.426Z","response_time":66,"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":["electromagnetic-simulation","electromagnetism","physics","python","scipy"],"created_at":"2024-09-24T14:17:56.931Z","updated_at":"2026-01-30T21:37:20.260Z","avatar_url":"https://github.com/marcos-moura97.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\r\n    \u003cimg alt=\"OpticalPyber\" ttle=\"OpticalPyber\" src=\"https://github.com/marcos-moura97/opticalpyber/blob/main/docs/logo.png\" width=\"30%\" height=\"auto\"/\u003e\r\n\u003c/h1\u003e\r\n\r\n\u003cp align=\"center\"\u003e\r\n  \u003ca href=\"#about-the-project\"\u003eAbout the Project\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;|\u0026nbsp;\u0026nbsp;\u0026nbsp;\r\n  \u003ca href=\"#requirements\"\u003eRequirements\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;|\u0026nbsp;\u0026nbsp;\u0026nbsp;\r\n  \u003ca href=\"#examples\"\u003eExamples\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;|\u0026nbsp;\u0026nbsp;\u0026nbsp;\r\n  \u003ca href=\"#next-steps\"\u003eNext Steps\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;|\u0026nbsp;\u0026nbsp;\u0026nbsp;\r\n  \u003ca href=\"#references\"\u003eReferences\u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\n\u003cbr /\u003e\r\n\r\n## About the Project\r\n\r\nPackage with tools to analize waveguides and optical fibers. This package uses numerical methods to find the eigenvalues related to the propagation modes and other characteristics of the waveguide. Currently, this package supports three types of waveguide: Planar, Retangular and Optical Fibers.\r\n\r\nThis package is made based on python codes used during my graduation, this codes can be found in [this repository](https://github.com/marcos-moura97/eletromagnetism_python.git).\r\n\r\n## Requirements\r\n- numpy\r\n- scipy\r\n- matplotlib (if you want to plot something)\r\n\r\n## Examples\r\n\r\n### Planar Waveguide\r\n\r\n- Find the effective index and plot the profile dispersion curve for modes TM0, TM1 and TM2 in an symetric guide [1-2].\r\n```\r\nfrom opticalpyber import PlanarWaveguide\r\nimport matplotlib.pyplot as plt\r\n\r\n# materials\r\nn1 = 3.38       #core\r\nn2 = 3          #cladding\r\nn3 = n2         #substrate\r\n\r\nd = 2.5E-6      #core length\r\nlbd = 1E-6      # wavelength\r\n\r\nguide = PlanarWaveguide(n1, n2, n3, d)\r\n\r\nfor mode in range(3):\r\n    Ey = guide.calculateDispersionField(lbd, mode=\"TM\", mode_number=mode)\r\n\r\n    # make the x arrays\r\n    x = np.arange(-2*guide.lbd,2*guide.lbd,guide.dx)\r\n\r\n    # ploting\r\n    plt.figure(mode)\r\n    plt.plot(x,Ey[:-1],'b')\r\n    # plot the bars that divide the materials\r\n    plt.plot([-guide.a,-guide.a],[-guide.amplitude,guide.amplitude],'k--') # substracte / core\r\n    plt.plot([guide.a,guide.a],[-guide.amplitude,guide.amplitude],'k--')   # core / cladding\r\n    # some info\r\n    plt.title(f'Dispersion of Ey for mode TM{mode}')\r\n    plt.xlabel('y')\r\n    plt.ylabel('Ey')\r\n    plt.xticks([-guide.a,guide.a], ['-a','a'])\r\n    plt.show()\r\n\r\n```\r\n\r\n### Retangular Waveguide\r\n\r\n- Find the effective index and plot the profile dispersion curve for modes TM0 in an symetric rib waveguide[1].\r\n\r\n```\r\nfrom opticalpyber import RetangularWaveguide\r\nimport matplotlib.pyplot as plt\r\n\r\n## materials\r\n\r\nn1 = 3.50125  # core\r\nn2 = 3.5  # substrate/rib\r\nn3 = 3  # cladding\r\n\r\nd = 2 * 8e-6  # core length\r\n\r\nh = 3e-6  # rib bigger height\r\nt = 1e-6  # rib smaller height, if =0, than is a ridge waveguide\r\nhc = 6.5e-6  # core height\r\n\r\nlbd = 1.32e-6  # wavelength\r\n\r\nguide = RetangularWaveguide(n1, n2, n3, d, h, t, hc)\r\nall_modes = guide.calculateNeff(lbd)\r\nprint(guide.neff)\r\n\r\n(XX, YY, Zx) = guide.calculateDispersionFieldX()\r\n\r\n# Ploting\r\nplt.figure()\r\n# plot\r\nplt.contourf(XX, YY, Zx)\r\n# structure plot\r\nplt.plot([-(3*guide.a), -guide.a, -guide.a, guide.a, guide.a, 3*guide.a],\r\n         [guide.hc+guide.t, guide.hc+guide.t, guide.hc+guide.h, guide.hc+guide.h, guide.hc+guide.t, guide.hc+guide.t], 'k')\r\nplt.plot([-(3*guide.a), 3*guide.a], [guide.hc, guide.hc], 'k')\r\nplt.plot([-(3*guide.a), 3*guide.a], [0, 0], 'k')\r\n# labels\r\nplt.xticks([-guide.a,guide.a], ['-a','a'])\r\nplt.yticks([0,guide.hc,guide.hc+guide.t, guide.hc+guide.h], ['0','hc','hc+t','hc+h'])\r\n# limits\r\nplt.xlim([-(3*guide.a), 3*guide.a])\r\nplt.ylim([-guide.t, guide.hc+guide.h+guide.t])\r\n\r\nplt.show()\r\n\r\n```\r\n\r\n### Optical Fiber\r\n\r\n- Find and plot the modes LP01, LP11 and LP21 of an Step-index fiber[4].\r\n\r\n```\r\nfrom opticalpyber import OpticalFiber\r\nimport matplotlib.pyplot as plt\r\n\r\n# materials\r\nn1 = 1.45 # core\r\nn2 = 1.4  # cladding\r\n\r\n# diameter of the core\r\nd = 16E-6 # um\r\n\r\n# wavelength of analysis\r\nlbd = 8.11E-6 # um\r\n\r\nfiber = OpticalFiber(n1, n2, d)\r\n\r\nfor mode in range(3):\r\n    modes = fiber.findMModes(lbd, mode)\r\n    print(f'For mode M = {mode} we found {len(modes)} values.')\r\n    print(modes)\r\n\r\n    # plot the modes\r\n    (x, y, z) = fiber.calculateDispersionField(modes[-1], dx=1e-8)\r\n\r\n    plt.figure(mode)\r\n    plt.contourf(x, y, z)\r\n    plt.colorbar()\r\n    plt.show()\r\n```\r\n\r\n## Next Steps\r\n\r\n- Unit Tests\r\n- Add Slot Waveguides\r\n- More Robust Optical Fiber Model\r\n\r\n## References\r\n\r\n[1] Okamoto, K. (2021). Fundamentals of optical waveguides. Elsevier.\r\n\r\n[2] GHATAK, A. A., Ghatak, A., Thyagarajan, K., \u0026 Thyagarajan, K. (1998). An introduction to fiber optics. Cambridge university press.\r\n\r\n[3] Orfanidis, S. J. (2002). Electromagnetic waves and antennas.\r\n\r\n[4] Paschotta, D., 2022. LP Modes. [online] Rp-photonics.com. Available at: \u003chttps://www.rp-photonics.com/lp_modes.html\u003e [Accessed 15 April 2022].\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcos-moura97%2Fopticalpyber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcos-moura97%2Fopticalpyber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcos-moura97%2Fopticalpyber/lists"}