polyanskiy / refractiveindex.info-database

Database of optical constants
Creative Commons Zero v1.0 Universal
159 stars 55 forks source link

Material search based on glass codes #46

Open CodeFHD opened 3 weeks ago

CodeFHD commented 3 weeks ago

Hi, first, big thanks for your work with this catalogue, quite the dedicated work over many years!

I'm currently trying to include this database in one of my own projects, an optics addon for Blender, where I am considering a good strategy for a material lookup. The related part is a simple sequential ray-tracer, written in python, together with a simple .zmx-import to include publicly available designs, e.g. from https://www.lens-designs.com/. So far, I have used a few catalogs from glass manufacturers directly. There are a number of materials missing, and I next wanted to extend using your database.

What I am considering is the lookup given a material code to the correct file. The catalog-nk.yml file seems to be a possible place to use as a basis, but e.g. the code "N-BK7" could be found in the "name" attribute as "N-BK7 (Schott)", "Schott N-BK7(R)", or even via the BK7 page. These all link to the same file, so it would not matter. Another, different example is the glass F2, which exists from different manufacturers with slightly different data. In programming, that still needs a lookup to the associated BOOK, etc.. It might work, but given the extent of the database, I am wondering if I would end up with a correct implementation without having to manually verify everything.

What I have in mind is a catalog file that starts from a (common) material identifier, for example of the structure {Identifier, [Manufacturer_1, file_path_1, ...], [Manufacturer_2, file_path_2, ...], ...}

I did look in PyTMM and the related https://github.com/toftul/refractiveindex for something equivalent, but did not find anything.

So finally, to put this into specific questions: Do you have alternative suggestion how to approach this, using your current information/datasets? Do you know of any further existing (python) implementations that address this?

polyanskiy commented 3 weeks ago

Hi,

Thank you for your message and for your kind words! I appreciate your interest in using the refractiveindex.info database for your optics project. The topic you’ve raised about material lookup is indeed important for optical design software.

To address your question, if by material code you are referring to a glass name, such as "N-BK7," the best approach would be to look for the corresponding page with the identifier "N-BK7" (e.g., - PAGE: N-BK7). However, please note that page IDs are not always unique, and certain manufacturers may use the same names for similar glasses, such as "F2." This means that the shelf ID, book ID, and page ID are all crucial elements of the material's identifier and should be considered in the lookup process.

Your idea of constructing a dedicated catalog file is very relevant. I've always thought this could be a good way to adapt the refractiveindex.info database for specific applications. I would be interested in adding to the database a catalog file that includes materials relevant to optical design—not just glasses, but also some relevant metals, crystals, etc.. However, I think it would be beneficial to maintain the existing shelf/book/page structure for consistency and ease of maintenance.

A practical starting point could be to modify the catalog-nk.yml file by removing any unnecessary data for your specific use case. From there, you could reorganize the material entries to suit your project’s logic, such as creating separate shelves for metals, optical crystals, and so on.

Please let me know your thoughts on this approach.

CodeFHD commented 3 weeks ago

Thanks for the quick feedback. I will try to put your ideas and preferences into my next implementation steps and see if I can come up with something compatible.

To clarify, yes by "material code" i was referring to the glass name. Or, as you indicated yourself, it could also be a metal name, like Germanium, or DLC (diamond like carbon) used for infrared. For optics design and implementation purposes, I of course always have the separation of "bulk material" and coatings in mind. Though this distinction is probably not relevant for the layout of a database.