GithubHelp home page GithubHelp logo

machine_learning_ray_tracing's Introduction

Machine Learning Polarimetry

Overview

A general problem in the experimental Polarimetry is to obtain via this experimental data the properties of the material, this problem is tipycally approached by using Mueller matrix descomposition, but this method is convoluted since it depends of all the basics types of Mueller matrix that are known. So another approached to this problem is to have an algorithm thats go from the material properties to the polarimetry and then invert this problem using any tool that can typically invert physics problem, in this case we used Machine learning more specifically Neural Networks (NN). To do so we used the McClain algorithm[] and Feed-Forward Neural Networks.

Polarimetry

This repository contains codes that computes the Mueller matrix of an birrefrigent material using as inputs the geometrics parameters of the problem and the Parameters of the material via an ray tracing code (McClain ray tracing).

Inputs

Geometric Parameters

  • Angle between the incident ray and the incident plane, the incident angle (a_i).
  • Normal vector of the incident plane (vnorm).
  • The large of the crystal (thick).

Parameters of the Crystal

  • Ordinary Refractive Index (no).
  • Extraordinary Refractive Index (ne).
  • Angle of the Optic Axis (a_c).
  • Ordinary Gyrotropic Index (ge).
  • Extraordinary Gyrotropic Index (go).

External Parameters

  • refractive index of the outside media (for example: air no=ne=1).
  • wavelength of the incident ray (lamda).

Output

  • Mueller matrix of the material (M).
  • the diference of the Optical path lenght inside the crystal or Optical Path Difference (OPD).
  • The Brewster angle of the material (brews).

Machine Learning

Our goal is to invert the Ray tracing algorithm using as input the Mueller matrix of a material and other parameters obtainable by experimental measurements, and as outputs the parameters of the material, in this case the refractive index (,), to do so we gonna use Feed-Forward Neural Networks.

Neural Network Arquitecture and Training

We used 0.1 as the learning rate with a decay of 0.01 over 30 epochs and a batch size of 10, elu as the activation function, Adam as the optimization method and for the loss function we used the Logcosh function from Keras[].

The Arquitecture used for this algorithm is the following:

Arquitecture

Data

For this problem we used the data from the McClain ray tracing algorithm, that was mention previously. As input we used the ouputs of the ray tracing algorithm and as outputs the refractive index of the material(,)and fixing the other parameteres that are used as input of the ray tracing algorithm. This leads to a input of 17 as the shape, 16 for the Mueller matrix (4x4 matrix) and 1 from the OPD (This data has been adjusted by a parameter of in the code) or the Brewster angle.

Example

As an example we gonna used the BBO crystal, and the following parameters:

  • ni = 1
  • a_c = 29.2
  • a_i = 0
  • no = 1.6589 []
  • ne = 1.5446 []
  • go = ge =0
  • thick = 3E-3
  • lamda = 853*10**-9
  • vnorm = np.zeros((3,1)) and vnorm[2] = 1

Then use the algorithm as:

  • M,OPD = all_polarization(no,ne,go,ge,thick,a_c,a_i,ni,lamda)

Where M is the Mueller matrix of the material for that especific set of inputs and OPD is the Optical path difference between the ordinary and the extraordinary ray incide the crystal.

If the Brewster angle is required use the following line of command:

  • brews = Brewster(no,ne,a_c,go,ge,vnorm,ni,Ei)

Where brews is the Brewster angle calculated in this case for this setup between 50 and 90 from the reflection index, this can be changed in the line 529 in the code.

For this function to work is needed an input polarization, in this case we use the s polarization as an input but the algorithm transform this polarization in p as the real polarization used in the algorithm.

This Algorithm is in the repository by the name of ray_tracing_algorithm.py.

In the repository there is a folder that contain the data used to train the NN using 10.000 data as training data and 3.000 data for validation, there is a folder for tha Brewster angle option and the OPD option, both contain random data for and from 1.4 to 1.7, using the random.uniform function, this . This folders are Training data Brewster and Training data OPD.

Also in the repository there is a folder that contain the weight used for this problem, from 10.000 to 100 data for the option of Brewster angle and for OPD from 1.000.000 to 100 data. this due to the OPD data is more easy to obtain than the Brewster angle data.

Results

Using the weight of the 10.000 data for OPD and Brewster angle we have the following NN predictions :

For OPD:

  • no = 1,6153855
  • ne = 1,48315930

Giving us an percentage relative error of 2,62% for the and a 3,98% for the . For Brewster we have:

  • no = 1,65347790
  • ne = 1,53919400

Giving us an percentage relative error of 0,33% for the and a 0,35% for the .

Requeriments

Reference

[1]Stephen C. McClain, Lloyd W. Hillman, and Russell A. Chipman, "Polarization ray tracing in anisotropic optically active media. I. Algorithms," J. Opt. Soc. Am. A 10, 2371-2382 (1993)

[2]Stephen C. McClain, Lloyd W. Hillman, and Russell A. Chipman, "Polarization ray tracing in anisotropic optically active media. II. Theory and physics," J. Opt. Soc. Am. A 10, 2383-2393 (1993)

[3] https://keras.io/api/

[4] G. Tamošauskas, G. Beresnevičius, D. Gadonas, A. Dubietis. Transmittance and phase matching of BBO crystal in the 3−5 μm range and its application for the characterization of mid-infrared laser pulses, Opt. Mater. Express 8, 1410-1418 (2018)

machine_learning_ray_tracing's People

Contributors

spaiva2222 avatar

Watchers

Felipe Herrera avatar

Forkers

rickyparada6

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.