Giter Club home page Giter Club logo

thorlabspm100's Introduction

Overview

This package can be used to drive a PM100A/D power meter from Thorlabs. It provides an object oriented interface to the SCPI commands using Python properties.

Installation

To install the ThorlabsPM100 driver, download the package and run the command:

python setup.py install

You can also directly move the ThorlabsPM100 to a location that Python can import from (directory in which scripts using ThorlabsPM100 are run, etc.)

Usage

The best way to connect your instrument is with the pyvisa package https://pyvisa.readthedocs.io/en/stable/. On linux, the instrument is automatically detected as a USBTMC device. A simple interface is described in the file usbtmc.py

First you need to create your instrument. Using visa:

import visa
from ThorlabsPM100 import ThorlabsPM100
rm = visa.ResourceManager()
inst = rm.open_resource('USB0::0x0000::0x0000::xxxxxxxxx::INSTR', term_chars='\\n', timeout=1)
power_meter = ThorlabsPM100(inst=inst)

Or using usbtmc (you nedd to have read and write access to the โ€˜/dev/usbtmc0โ€™):

from ThorlabsPM100 import ThorlabsPM100, USBTMC
inst = USBTMC(device="/dev/usbtmc0")
power_meter = ThorlabsPM100(inst=inst)

Commands that set or query a value are Python properties of ThorlabsPM100 class. Other command are methods of ThorlabsPM100 class :

print power_meter.read # Read-only property
print power_meter.sense.average.count # read property
power_meter.sense.average.count = 10 # write property
power_meter.system.beeper.immediate() # method

Version history

  • 1.1 : support of Python 3 with 2to3
  • 1.0 : initial release

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.