GithubHelp home page GithubHelp logo

ilent2 / ott Goto Github PK

View Code? Open in Web Editor NEW
48.0 10.0 29.0 7.05 MB

Optical Tweezers Toolbox (Version 1)

License: Other

MATLAB 100.00%
optical-tweezers-toolbox scattering force-torque-calculation matlab t-matrix

ott's Issues

BscPlane translations as phase shifts

It would be nice (and useful) to have an option to translate plane waves by applying a phase shift to the beam.

Important: need to make sure that the same translation rule isn't applied to beams once they have been scattered by another particle (or check that they are still compatible).

About "Warning: Ignoring fz<0 entries at start of vector " may be a bug

"Ignoring fz<0 entries at start of vector" is warned when I run modified example_sphere.m file, but when I open the find_equilibrium.m file to find the corresponding 39 lines, run find(fz<0,1) is not equal to 1, but to 3, so the program should not run warning('Ignoring fz<0 entries at start of vector'), but the result is to continue executing the program below "if zeroindex ==1". The results are shown in the following charts.
I changed 4 things, 1 is n_medium=1.53 and n_particle=1.33; 2 is NA=0.8; 3 is radius=10e-6; 4 is linspace(-4,4,80)->linspace(-30,30,300).
image
image
image
image
Thank you Dr. Lenton for your patient answer earlier. I am currently writing a simulation paper on vortex optical tweezers, and I need to use your optical tweezers kit for simulation, but I still don't know enough about some parts of the program. Thank you for your help, and I can include you as the author when the paper is published. What do you think?

1.3.1 versus 1.4

I'm thinking that 1.3.1 shouldn't have the GUI as it appears to be a big deal. Suggest putting it in 1.4.

TmatrixPm with 4-th order rotational symmetry

I'm unsure what to do with the file ott/+ott/tmatrix_pm_cube.m in version 1.4

In version 1.4 I've added a TmatrixPm class with a static method for constructing simple T-matrices using the point matching method.

Should I create a subclass of TmatrixPm -> TmatrixPmCube or should I modify the simple() static method to use tmatrix_pm_cube instead? What is the purpose of tmatrix_pm_cube? Are there additional optimisations? What are Nmax_particle and Nmax_medium for?

Move utility functions to +utils sub package

It would be nice to move the utility functions to a +utils sub package. We could then also drop the backwards compatibility requirement on the utility functions (say they are for internal use and users should use them at their own risk).

Functions I think should be included in the +utils directory, there may be others...

  • angulargrid.m
  • spharm.m
  • vsh.m
  • iseven.m
  • rtp2xyz.m
  • vswf.m
  • isodd.m
  • rtpv2xyzv.m
  • wigner_rotation_matrix.m
  • sbesselh1.m
  • xyz2rtp.m
  • laguerre.m
  • sbesselh2.m
  • xyzv2rtpv.m
  • legendrerow.m
  • sbesselh.m
  • z_rotation_matrix.m
  • sbesselj.m

transform from center-of-mass frame to lab frame

Hi Dr. Issac Lenton,

I'm trying to do some scattering calculations with OTT in MATLAB. I'm able to follow the beam_visualization.m example and calculate the scattered fields when the trap beam (a gaussian beam) is offset from the particle. As I understand it, everything is in the particle's center-of-mass frame. I want to transform the far-field solutions back into the lab frame after the scattering calculation. Could you advise how I should proceed? Currently, translation in Y (using .translateXyz) seems to also cause some tilt in the far-field solutions without applying any scattering matrix. I attached a plot to show how the beam profile in blue in the translated Y dimension looks skewed in the particle's COM frame in the far field regime. I want to be in a rest frame of this incoming trap beam, where I think the beam profiles in any XY planes would look translated and not skewed. Any suggestions are appreciated.

backscatteredCOM

Thanks,
Yuqi

GUI commands

It would be useful to add (maybe optionally) a printout to the command line of the code used in GUI. E.g. when I press Generate button in any gui window, I want to see which command was executed, so I can use it later in m-files. Also, it might be useful for those trying the toolbox for the first time.

emFieldXyz: E-field units

Dear Dr. Lenton,

I have a small question regarding the units for E-field plotted via emFieldXyz method. I couldn't find the info about the units for electric field, so, I wonder whether emFieldXyz returns fields in SI (i.e., V/m for E-field), or they somehow inherit the normalization from beam.power = 1 (as was suggested in the documentation). So, should I convert the obtained fields by hands? I found how to convert forces from normalized units to SI, but the same trick with E-field is not so clear for me.

Thank you in advance.

Best regards,
Gleb Fedorovich

Check documentation on all files

  • Make usage consistent across all files
  • Function names should be in bold
  • Class names should match class declaration
  • Classes should have list of methods and properties
  • PACKAGE_INFO should be replaced by the following text

% This file is part of the optical tweezers toolbox. % See LICENSE.md for information about using/distributing this file.

Add Upgrading section to readme

Version 1.4 will be installed differently and have depreciated functionality. We should add a updating section to the readme for version 1.4.

At this stage, upgrading will consist of:

  1. Download the latest release of v1.3 (probably 1.3.1), run your scripts and look for depreciation warnings. Follow the instructions in the depreciation warnings to use the new functions.

  2. Download the new toolbox and include the package path. Remove the old toolbox from the path.

  3. Add import ott.* to all scripts using toolbox functions or prefix all toolbox functions with ott..

Absorption calculations?

I think this is a feature request but I may be overlooking a way to do what I want with the existing code so... please bear with me. I am interested in computing not only the scattering of fields from particles but also their absorption. Now, the SMARTIES code base constructs T-matrices using a formulation that looks like: T = -P*inv(Q) but the OTT just calculates T directly without that factorization. This works like: E_incident~(a;b), E_scattered~(p;q), and E_internal~(c;d) where my lowercase letters represent the coefficients of the basis functions, etc. Then (p;q) = T(a;b) tells the scattered from the incident using the T-matrix. But also we can do (p;q) = -P(c;d) and (a;b) = Q(c;d) or (c;d) = inv(Q)(a;b). It is this last bit that I think I need since only if I have the coefficients for the internal field components can I figure out the dissipated power?

As a note, the SMARTIES function that does this is called: "sphCalculatePQ" which says, "Calculates P,Q matrices for a spheroid using the algorithm of [JQSRT 123, 153 (2013)]" [here is the article: https://www.sciencedirect.com/science/article/pii/S0022407313000423 ]

Smarties method does not work

Attempting to use either the GUI for "Geometric Shape T-matrix" or the command line "ott.Tmatrix.simple" fails when the user attempts to use the documented optional parameter 'method' with the value 'smarties'. The error is thrown by the ott.TmatrixSmarties function on line 123 indicating that method is not a recognized parameter. This seems like the parameter is getting passed down from the ott.Tmatrix.simple function to the subsidiary ott.TmatrixSmarties function when it shouldn't be but I am unfamiliar with the object oriented programming approach in Matlab so I may be wrong here. It is also possible this errror is somehow due to smarties not being installed but, if so, the error does not seem to alert the user to that effect. (I did, in fact, install smarties and used the initpath function to add it to my path prior to running ott.) This error was seen using Matlab R2019b on Mac OS Catalina.

Consistent T-matrix and beam set type methods

Replace toScattered, toTotal, and similar functions with a single set type function. For the matrix, use a set.type for default behaviour and a expand function for additional behaviour.

Add unit tests for this

Check other functions that could be simplified or replaced with a get.set interface

Extinction coefficient

Dear Dr. Lenton
When I read the program and the corresponding documents, I didn't find the effect of the extinction coefficient of the captured particles on the radiation pressure, whether I didn't notice this. If we calculate the radiation pressure of graphite and metal particles, how should we define the absorption coefficient or extinction coefficient

Setting the T-matrix of particle with other shape in GUI

Hi Issac, how can I set the T-matrix of particle with cylinder shape in GUI? I set the radius and height with 1e-7 and 3e-6 respectively. But system went worry and told me haven't defined the 'mtimes' function. My MATLAB version is 21b and using toolbox version 1(available in github).

Unsure what to do with functions

Unsure what to do with:

  • axial_equilibrium.m
  • trapping_landscape.m
  • forcetorque.m
  • force_z.m

Perhaps other files in +utils package.

Issue with bsc_pointmatch_farfield normalisation

rw = (k * w0)^2 * tan(theta).^2 / 2;

Hi Alex,
There seems to be an issue with the power normalisation for bsc_pointmatch_farfield. Around line 175, rw is calculated from tan(theta).^2, where theta is in the range ((1:ntheta)-0.5)/ntheta*pi which will sometimes be approximately pi/2. Even when it is not exactly pi/2, nearby values still cause a problem since rw is later used in exp(rw/2 + ...) which quickly becomes too large.
Could you take a look at this.
Cheers,
Isaac

The refractive index of a medium varies with the laser of different wavelength

Does the program take into account the effect of different laser wavelengths on the refractive index of the medium (such as water)? Since the refractive index of most media is corresponding to the refractive index of D-light (589.3nm), while optical tweezers are commonly used for 1064nm laser, the corresponding refractive index of media will decrease somewhat at 1064nm band, resulting in slightly different results.
Thank you, Dr. Lenton

Make the toolbox a package

It would be good to make the toolbox into a package, this will reduce namespace pollution. The functions can be used individually, such as

ott.force_z(...)

or all the functions can be imported

import ott.*

This will require adding the above import to all toolbox functions that use other toolbox functions and changing the directory ott-toolbox to +ott, however this change breaks backwards comparability.

Optimise examples

The examples are running really slowly. We should be able to optimise them to run at a speed comparable to the previous release.

BscPmParaxial.m

RE: Our previous conversation, can you add the ability to override he fit points. This will be helpful for people calculating simple SLM beams which may not need many fit points.

Octave and warnings

Octave is not happy about the ott_warning.m function:

error: invalid assignment to cs-list outside multiple assignment

error: invalid empty index list

error: invalid dimension inquiry of a non-existent value

A few options there of what to do, but I'll leave it to you to decide. One way is to make it detect matlab, another way is to leave it out for now? another way is to be very strict with lists and parameters so that it doesn't output "this is not defined" type error.

EDIT: Another option is to release an octave version without warnings.

Optimisations for beam.translate

  • Add A,B matrices as output to all translate functions
  • Add option for output Nmax
  • Modify translate_z to output non-square matrices
  • Updates examples and maybe forcetorque to use optimisation

Warnings

The Warning messages are obtrusive in 1.3.1. It is possible to change a particular warning state (using the tag) to only display a warning once.

Filling factor

Is there a predefined filling factor (ratio between beam waist and aperture radius)? I couldn't find a method to change either the aperture size or the beam waist so I assume there must be one. However, in one of the additional papers to this toolbox (Multipole expansion of strongly focussed laser beams) I've read that one can define the truncation of the beam by the aperture. Could someone explain to me what I am missing?

Unit tests for all components

Write a unit test file for each class/component. Check that it at least constructs/runs. We can add more tests latter.

Multiple beams in BSC class

Add append method
Plane wave beam with multiple angles
Translate to multiple beams
Scatter for multiple beams

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.