{"id":13736672,"url":"https://github.com/DCC-Lab/RayTracing","last_synced_at":"2025-05-08T12:33:28.490Z","repository":{"id":34138805,"uuid":"166473288","full_name":"DCC-Lab/RayTracing","owner":"DCC-Lab","description":"Simple ray tracing library in Python for optical design that considers simple optical elements (with ABCD ray matrices) but also finite diameters of elements to calculate aperture and field stops, field of view, etc... Useful to validate the design of an optical system (lenses positions, power and diameters). Also permits the propagation of gaussian laser beams through the same elements.","archived":false,"fork":false,"pushed_at":"2024-09-02T03:27:02.000Z","size":17642,"stargazers_count":257,"open_issues_count":1,"forks_count":47,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-11-14T21:35:15.272Z","etag":null,"topics":[],"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/DCC-Lab.png","metadata":{"files":{"readme":"README-Adding-new-materials.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}},"created_at":"2019-01-18T21:13:35.000Z","updated_at":"2024-11-14T11:41:16.000Z","dependencies_parsed_at":"2023-02-16T11:15:36.073Z","dependency_job_id":"6f29e013-df5e-413e-8320-6e86f159b415","html_url":"https://github.com/DCC-Lab/RayTracing","commit_stats":{"total_commits":1926,"total_committers":21,"mean_commits":91.71428571428571,"dds":0.7118380062305296,"last_synced_commit":"31594e532a24ed9f80638e32bf05a722eafd1267"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCC-Lab%2FRayTracing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCC-Lab%2FRayTracing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCC-Lab%2FRayTracing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCC-Lab%2FRayTracing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DCC-Lab","download_url":"https://codeload.github.com/DCC-Lab/RayTracing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224732129,"owners_count":17360416,"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","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":[],"created_at":"2024-08-03T03:01:26.273Z","updated_at":"2024-11-15T04:32:16.795Z","avatar_url":"https://github.com/DCC-Lab.png","language":"Python","funding_links":[],"categories":["simulation","Equipement and Tools"],"sub_categories":["Software for Optical Design"],"readme":"## Adding a new material to the Raytracing module\n\nIf you attempt to read a Zemax file with ZMXReader, you may encounter an error if the material is not recognized:\n\n```shell\nValueError: The requested material 'SomeWeirdMaterial' is not recognized in the list of materials of raytracing: ['Air', 'N_BK7', 'N_SF2', 'N_SF8', 'SF2', 'SF5', 'N_SF5', 'N_SF6', 'N_SF6HT', 'N_SF10', 'N_SF11', 'N_SF57', 'N_BAF10', 'E_BAF11', 'N_BAK1', 'N_BAK4', 'FK51A', 'LAFN7', 'N_LASF9', 'N_LAK22', 'N_SSK5', 'E_FD10', 'FusedSilica'].  You need to implement it as asubclass of Material, see materials.py for examples.\n```\n\n\n\nThe reason is that there are tons of materials available and it is ridiculous to enter them all ifthey are not used in optical components.  With the excellent http://refractiveindex.info, we are always just one click away from an answer. \n\n## How do you add a new material?\n\nIt is in fact quite simple:\n\n1. Take a look at `materials.py` for many examples.\n\n2. Derive a class from material, give it the name of your material (e.g., `N_LAK21`)\n\n3. Then you need to define  `n()` and the Abbe number:\n\n   ```python\n   @classmethod\n   def n(cls, wavelength): # Wavelengths are always in microns (like Zemax, refractiveindex.info, etc).\n   \t\treturn calculate the value\n   \t\t\n   @classmethod\n   def abbeNumber(cls):\n       return aValue\t\t\n   ```\n\n4. All you need to define is in this example for N_BK7:\n\n   ```python\n   class N_BK7(Material):\n       \"\"\" All data from https://refractiveindex.info/tmp/data/glass/schott/N-BK7.html \"\"\"\n       @classmethod\n       def n(cls, wavelength):\n           if wavelength \u003e 10 or wavelength \u003c 0.01:\n               raise ValueError(\"Wavelength must be in microns\")\n           x = wavelength\n   \n           n=(1+1.03961212/(1-0.00600069867/x**2)+0.231792344/(1-0.0200179144/x**2)+1.01046945/(1-103.560653/x**2))**.5\n           return n\n       \n       @classmethod\n       def abbeNumber(cls):\n           return 64.17\n   ```\n\n## Will Raytracing know about my new material?\n\nYes it will, through the magic of Python, it is possible to know when subclasses are created.\n\nThere are functions to find materials (such as `Material.findByName()` or `Material.findByIndex()`.  You actually don't need to include your code into the main raytracing code: if you derive a class from Material (as above) it will be included in the search without having to do anything.\n\nYou can then send it to us, we'll include it if it is relevant. Send to  dccote@cervo.ulaval.ca, or create an [Issue on GitHub](https://github.com/DCC-Lab/RayTracing/issues) and paste your code.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDCC-Lab%2FRayTracing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDCC-Lab%2FRayTracing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDCC-Lab%2FRayTracing/lists"}