{"id":25039453,"url":"https://github.com/ishanoshada/light-speed","last_synced_at":"2026-02-16T00:33:10.702Z","repository":{"id":273568620,"uuid":"920170930","full_name":"Ishanoshada/Light-Speed","owner":"Ishanoshada","description":"light_speed is a comprehensive Python package for calculations and simulations related to the speed of light, relativistic physics, and real-world optical phenomena. It is designed for scientists, researchers, and physics enthusiasts who want to explore the fascinating world of light and its interactions.","archived":false,"fork":false,"pushed_at":"2025-01-22T12:30:49.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-27T18:34:15.587Z","etag":null,"topics":["lightspeed","math","package","physics","pypi"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/light-speed/","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/Ishanoshada.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-21T17:26:51.000Z","updated_at":"2025-01-22T12:30:14.000Z","dependencies_parsed_at":"2025-07-05T05:15:41.573Z","dependency_job_id":null,"html_url":"https://github.com/Ishanoshada/Light-Speed","commit_stats":null,"previous_names":["ishanoshada/light-speed"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Ishanoshada/Light-Speed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ishanoshada%2FLight-Speed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ishanoshada%2FLight-Speed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ishanoshada%2FLight-Speed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ishanoshada%2FLight-Speed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ishanoshada","download_url":"https://codeload.github.com/Ishanoshada/Light-Speed/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ishanoshada%2FLight-Speed/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29495012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T00:16:34.147Z","status":"ssl_error","status_checked_at":"2026-02-16T00:15:26.759Z","response_time":118,"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":["lightspeed","math","package","physics","pypi"],"created_at":"2025-02-06T02:51:53.694Z","updated_at":"2026-02-16T00:33:10.689Z","avatar_url":"https://github.com/Ishanoshada.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Light Speed Physics\n\n`light_speed` is a comprehensive Python package for calculations and simulations related to the speed of light, relativistic physics, and real-world optical phenomena. It is designed for scientists, researchers, and physics enthusiasts who want to explore the fascinating world of light and its interactions.\n\n---\n\n## Features\n\n- **Relativity Calculations**:\n  - Lorentz factor, time dilation, length contraction, relativistic mass, and momentum.\n- **Optics**:\n  - Snell's law, critical angle, and chromatic dispersion in fiber optics.\n- **Photon Energy**:\n  - Energy-wavelength conversions.\n- **Waveguides**:\n  - Supported modes in planar waveguides.\n- **Medium Properties**:\n  - Speed of light in various mediums, refractive index calculators, and Fresnel reflection coefficients.\n\n---\n\n## Installation\n\nInstall the package using pip:\n\n```bash\npip install light_speed\n```\n\n---\n\n## Usage\n\n### Import the Package\n```python\nfrom light_speed import LightSpeedPhysics\n```\n\n### Examples\n\n### **1. Speed of Light in a Medium**\nCalculate the speed of light in a specific medium using its refractive index:\n```python\nfrom light_speed import LightSpeedPhysics\n\nphysics = LightSpeedPhysics()\nn_water = physics.refractive_index_calculator('water')\nspeed_water = physics.speed_in_medium(n_water)\nprint(f\"Speed of light in water: {speed_water:.2f} m/s\")\n```\n\n---\n\n### **2. Relativistic Time Dilation**\nCompute the time dilation for an object moving at a significant fraction of the speed of light:\n```python\nfrom light_speed import LightSpeedPhysics\n\nphysics = LightSpeedPhysics()\nproper_time = 1.0  # seconds\nvelocity = 1e7  # m/s\ndilated_time = physics.time_dilation(proper_time, velocity)\nprint(f\"Dilated Time: {dilated_time:.2f} seconds\")\n```\n\n---\n\n### **3. Lorentz Factor**\nCalculate the Lorentz factor for a given velocity:\n```python\nfrom light_speed import LightSpeedPhysics\n\nphysics = LightSpeedPhysics()\nvelocity = 1e7  # m/s\nlorentz_factor = physics.lorentz_factor(velocity)\nprint(f\"Lorentz Factor: {lorentz_factor:.2f}\")\n```\n\n---\n\n### **4. Length Contraction**\nFind the contracted length of a moving object:\n```python\nfrom light_speed import LightSpeedPhysics\n\nphysics = LightSpeedPhysics()\nproper_length = 10.0  # meters\nvelocity = 2e8  # m/s\ncontracted_length = physics.length_contraction(proper_length, velocity)\nprint(f\"Contracted Length: {contracted_length:.2f} meters\")\n```\n\n---\n\n### **5. Relativistic Mass**\nCalculate the relativistic mass of an object:\n```python\nfrom light_speed import LightSpeedPhysics\n\nphysics = LightSpeedPhysics()\nrest_mass = 70.0  # kg\nvelocity = 2.5e8  # m/s\nrel_mass = physics.relativistic_mass(rest_mass, velocity)\nprint(f\"Relativistic Mass: {rel_mass:.2f} kg\")\n```\n\n---\n\n### **6. Relativistic Momentum**\nDetermine the relativistic momentum of a moving object:\n```python\nfrom light_speed import LightSpeedPhysics\n\nphysics = LightSpeedPhysics()\nmass = 70.0  # kg\nvelocity = 2.5e8  # m/s\nmomentum = physics.relativistic_momentum(mass, velocity)\nprint(f\"Relativistic Momentum: {momentum:.2e} kg⋅m/s\")\n```\n\n---\n\n### **7. Relativistic Kinetic Energy**\nCalculate the kinetic energy of an object moving at relativistic speeds:\n```python\nfrom light_speed import LightSpeedPhysics\n\nphysics = LightSpeedPhysics()\nmass = 70.0  # kg\nvelocity = 2e8  # m/s\nkinetic_energy = physics.relativistic_kinetic_energy(mass, velocity)\nprint(f\"Relativistic Kinetic Energy: {kinetic_energy:.2e} Joules\")\n```\n\n---\n\n### **8. Energy to Wavelength Conversion**\nConvert photon energy (in electron volts) to wavelength:\n```python\nfrom light_speed import LightSpeedPhysics\n\nphysics = LightSpeedPhysics()\nenergy_ev = 2.0  # eV\nwavelength = physics.energy_wavelength_conversion(energy_ev)\nprint(f\"Wavelength: {wavelength:.2e} meters\")\n```\n\n---\n\n### **9. Snell's Law**\nCalculate the angle of refraction when light moves between two mediums:\n```python\nfrom light_speed import LightSpeedPhysics\n\nphysics = LightSpeedPhysics()\ntheta1 = 30  # degrees\nn1 = physics.refractive_index_calculator('air')\nn2 = physics.refractive_index_calculator('glass')\ntheta2 = physics.snells_law(n1, n2, theta1)\nprint(f\"Refraction Angle: {theta2:.2f} degrees\")\n```\n\n---\n\n### **10. Critical Angle**\nDetermine the critical angle for total internal reflection:\n```python\nfrom light_speed import LightSpeedPhysics\n\nphysics = LightSpeedPhysics()\ncritical_angle = physics.critical_angle(1.52, 1.000293)\nprint(f\"Critical Angle: {critical_angle:.2f} degrees\")\n```\n\n---\n\n### **11. Fiber Optic Travel Time**\nCalculate the travel time of light through a fiber optic cable:\n```python\nfrom light_speed import LightSpeedPhysics\n\nphysics = LightSpeedPhysics()\ndistance = 100000  # meters\ncore_index = 1.462\ntravel_time = physics.fiber_optic_travel_time(distance, core_index)\nprint(f\"Travel Time: {travel_time * 1000:.2f} milliseconds\")\n```\n\n---\n\n### **12. Chromatic Dispersion**\nCalculate the time delay caused by chromatic dispersion in optical fibers:\n```python\nfrom light_speed import LightSpeedPhysics\n\nphysics = LightSpeedPhysics()\nwavelength1 = 1.55e-6  # meters\nwavelength2 = 1.50e-6  # meters\nfiber_length = 50000  # meters\ntime_delay = physics.chromatic_dispersion(wavelength1, wavelength2, fiber_length)\nprint(f\"Chromatic Dispersion Time Delay: {time_delay:.2e} seconds\")\n```\n\n---\n\n### **13. Group Velocity**\nCompute the group velocity of a light pulse in a medium:\n```python\nfrom light_speed import LightSpeedPhysics\n\nphysics = LightSpeedPhysics()\nwavelength = 1.55e-6  # meters\ndn_dlambda = -0.02  # change in refractive index per wavelength\ngroup_velocity = physics.group_velocity(wavelength, dn_dlambda)\nprint(f\"Group Velocity: {group_velocity:.2f} m/s\")\n```\n\n---\n\n### **14. Fresnel Reflection Coefficient**\nCalculate the Fresnel reflection coefficients:\n```python\nfrom light_speed import LightSpeedPhysics\n\nphysics = LightSpeedPhysics()\nn1 = 1.000293  # air\nn2 = 1.52  # glass\ntheta_i = 45  # degrees\nr_parallel, r_perpendicular = physics.reflection_coefficient(n1, n2, theta_i)\nprint(f\"Reflection Coefficient (Parallel): {r_parallel:.2f}\")\nprint(f\"Reflection Coefficient (Perpendicular): {r_perpendicular:.2f}\")\n```\n\n---\n\n### **15. Waveguide Modes**\nCalculate the number of modes supported by a planar waveguide:\n```python\nfrom light_speed import LightSpeedPhysics\n\nphysics = LightSpeedPhysics()\nwidth = 5e-6  # meters\nwavelength = 1.55e-6  # meters\nn_core = 1.5\nn_cladding = 1.4\nmodes = physics.waveguide_modes(width, wavelength, n_core, n_cladding)\nprint(f\"Number of Modes: {modes}\")\n```\n\n---\n\n### **16. Doppler Shift**\nCalculate the relativistic Doppler shift for an approaching or receding source:\n```python\nfrom light_speed import LightSpeedPhysics\n\nphysics = LightSpeedPhysics()\nfrequency = 500e12  # Hz\nvelocity = 2e7  # m/s\napproaching = True  # True if approaching, False if receding\nshifted_frequency = physics.doppler_shift(frequency, velocity, approaching)\nprint(f\"Shifted Frequency: {shifted_frequency:.2f} Hz\")\n```\n\n\n---\n## Requirements\n\n- Python \n- NumPy (automatically installed)\n\n---\n\n## Contributing\n\nContributions are welcome! Follow these steps to contribute:\n\n1. Fork the repository.\n2. Create a feature branch (`git checkout -b feature-name`).\n3. Commit your changes (`git commit -m 'Add some feature'`).\n4. Push to the branch (`git push origin feature-name`).\n5. Open a pull request.\n\n---\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n\n\n**Repository Views** ![Views](https://profile-counter.glitch.me/lights/count.svg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fishanoshada%2Flight-speed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fishanoshada%2Flight-speed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fishanoshada%2Flight-speed/lists"}