Code Monkey home page Code Monkey logo

python-slm's Introduction

python-SLM

Set of routines in Python used to control a Spatial Light Modulator. It is assumed that the SLM is connected to a secondary monitor.

Important!!! The code requires the following modules installed:

Note by C.A.: currently wxPython and slmpy are disabled for simulation only.

Files

File Description
generate_Laguerre_Gauss_SLM.py File that generates a phase mask for a LG beam and displays it on a SLM
generate_Laguerre_Gauss_split_SLM.py Program that splits the SLM into two equal regions. In each region is generated an independent phase mask of a LG beam

Files description

generate_Laguerre_Gauss_SLM.py

The file generates a phase mask for a LG beam with a charge specified by the user. The mask can be saved as a bmp file, displayed on the main monitor, or can be sent to the SLM.

How to use it

To use the function, just write python generate_Laguerre_Gauss_SLM.py [options], where the options are the following:

  • -c CHARGE sets the CHARGE of the LG beam.
  • -w RADIUS use this option to put a circular mask centered in the screen center with radius RADIUS.
  • -g PERIOD add a grating to the LG phase. The period in pixels is specified with the variable PERIOD.
  • -s when added the image generated is sent to the SLM (by default the phase mask is not sent to the SLM).
  • -m when added, the SLM correction mask provided by the manufacturer is applied to the phase mask.
  • -b when added, the image of the phase mask is stored in the bmp file "LG_ch_CHARGE.bmp", where CHARGE is specified with the option -c.

The correction mask file has to be stored in the same folder as the python file. To change the mask file name, just change the line after the comment change 'correctionMaskFile' according to your correction mask file.

To exit, press 'q' after clicking on the 'phase mask' window.

Usage examples

  • Use python generate_Laguerre_Gauss_SLM.py -c 10, to generate a phase mask (LG beam charge +10) that is shown only in the main screen.
  • To save the image in a bmp file, use python generate_Laguerre_Gauss_SLM.py -c 10 -b. The file will be saved as LG_ch_10.bmp.
  • To generate and send to the SLM a phase mask for a LG beam with charge -5, use python generate_Laguerre_Gauss_SLM.py -c -5 -m -s. Notice that the option -m specifies to use the correction mask provided by the manufacturer.

generate_Laguerre_Gauss_split_SLM.py

Program that splits the SLM into two equal regions and in each region generates a phase mask of an independent Laguerre Gauss beam with a CHARGE provided by the user.

The whole image is sent to the second monitor output where the SLM is connected. The mask generated is also shown in the main monitor in a small window.

How to use it

To use the function, just write python generate_Laguerre_Gauss_split_SLM.py [options], where the options are the following:

  • -c CHARGE sets the CHARGE of the LG beam. Two indices are required.
  • -w RADIUS use this option to put a circular mask centered in the screen center with radius RADIUS.
  • -g PERIOD add a grating to the LG phase. The period in pixels is specified with the variable PERIOD. Two indices are required.
  • -s when added the image generated is sent to the SLM (by default the phase mask is not sent to the SLM).
  • -m when added, the SLM correction mask provided by the manufacturer is applied to the phase mask.
  • -b when added, the image of the phase mask is stored in the bmp file "LG_ch_CHARGE.bmp", where CHARGE is specified with the option -c.

The correction mask file has to be stored in the same folder as the python file. To change the mask file name, just change the line after the comment change 'correctionMaskFile' according to your correction mask file.

To exit, press 'q' after clicking on the 'phase mask' window.

Usage examples:

  • Use python generate_Laguerre_Gauss_split_SLM.py -c 10 -5, to split the screen into two regions | LG +10 | LG -5 |. In the left (right) region, a LG beam with charge +10 (-5) is displayed.
  • To send to the image generated in the previous example to the SLM, just add -s at the end. That is python generate_Laguerre_Gauss_split_SLM.py -c 10 -5 -s
  • To save a mask generated, use the command -m. The command python generate_Laguerre_Gauss_split_SLM.py -c 10 -5 -b. Saves the image in the bmp file LG_ch_chargeLeft_chargeRight.bmp; in this case LG_ch_10_-5.bmp.

python-slm's People

Contributors

totesalaz avatar acechenx avatar

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.