GithubHelp home page GithubHelp logo

polarization's People

Contributors

dccote avatar jlbegin avatar shadimasoumi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

polarization's Issues

Document existing polarization APIs

List all publications and public code on polarization APIs. Document features of each to help us narrow down what we want to include in our package.

Find good visualisation ideas

(No coding involved, we will implement it later)
Sometimes it can be hard to display such information, particularly when you have multiple states to analyse. We need to find nice ways to visualise the polarization state(s) of a single photon, multiple photons, a large beam, a depolarized beam, etc.

Something like this could be nice to visualize propagation of a single vector.
image

I would also like a poincaré sphere showing the polarization state and how it evolved. Similar to this
image

We could also add interactivity and have a slider to view the polarization state at different point in the 'optical path'.

Add an optical path API

To allow for the design and visualisation of a path with multiple PS elements (polarized light source, waveplates, birefringent material, tissues, etc.).

Choose a polarization convention

And be clear about it. We can keep the convention currently used in the code as long as it is coherent everywhere, but we need to document it so the users know.

Here are the different valid conventions:

image

image

Write basic usage examples

We need examples for basic polarization calculations.

There are some in the README (maybe deprecated), but we need them to be in seperate python files, inside an 'examples' directory.
The current file name examples.py is deprecated.

These usage examples will help to spot missing features.

Later we will also write more involved examples targetting OCT, dMRI, and other stuff.

Add interactive material

Paired with good polarization visualisation to play with tissue properties (birefringence, thickness, scattering, optic axis) and light source.

PS signal discontinuity

There seems to be a discontinuity in the fringes at interfaces. With the traditional processing we should see an undershoot in birefringence at interfaces. With the new simulated data we instead see an increase in intensity (overshoot) which probably indicates a discontinuity in the fringes.

We clearly see this discontinuity in the stokes vector at depth 220 and 300

Reconstructed birefringence

image

Stokes vector components for SV1 and SV2 (Without noise)

New simulation

image

Old Simulation

image

isLinear property doesn't work

When a circularly polarized jones vector passes through a linear polarizer, isLinear returns False while it should be True...

Speed optimization

The code as it stands provide the right answers (similar to MATLAB code), but is abysmally slow. It does not matter, this can be optimized.

There are several things that can be implemented to improve the performance considerably. As it stands, there are 3 lines of optimizations to follow:

  1. The most important penalty is the redundancy of several calculations: because we made the choice to encapsulate the k-dependence in the JonesMatrix (i.e. the numerical values of certain matrices are not available until the JonesVector is known), then we often end up re-calculating a matrix for a given k over and over. The obvious optimization here is to cache the forward and backward matrices for a given k and simply return the computed values if it is for the same k. This all boils down to implementing a caching mechanism in computeMatrix for JonesMatrix, but also for MatrixProduct.
  2. The object penalty. Going through objects for various calculations adds a performance penalty. For instance, @properties are slower than variables, __init__ takes time, etc... In some cases, this penalty is unacceptable. The best example is the internal calculation of the backscatterMatrix for a TissueLayer from all scatterers. It is better to explicitly compute a single matrix rather than take all the individual matrices from each scatterers.
  3. Finally, there appear to be various performance enhancements possible with numpy versus other means of calculations but this looks less promizing.

This could be approached two ways:

  1. Local caching mechanisms in objects
  2. Global pre-flight optimization, pre computing everything.

Since the real problem is the redundancy of the calculations, I don't think the global strategy will blow the local strategy out of the water: the real gain is to compute everything just once, and the local/global strategies are two means to an end. I would much prefer a local optimization, but we may experiment with both.

Let's implement these changes individually in a unique branche for each optimization.
Let's always confirm the unittests are still passing, because the current branch gives results that are similar to the original MATLAB code.

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.