This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Pyafm

Pyafm is a set of tools for controlling atomic force microscopes. It provides control of AFM postition using both short-range (piezo) and long range (stepper) vertical positioning. There are separate modules for controlling the piezo (pypiezo) and stepper (stepper), this module mostly contains methods that require the capabilities of both.

This module can optionally include temperature sensing via a pypid backend.

Packages

Gentoo

I’ve packaged pyafm for Gentoo. You need layman and my wtk overlay. Install with:

# emerge -av app-portage/layman
# layman --add wtk
# emerge -av sci-physics/pyafm

Although it is not strictly required (thanks to duck typing) you’ll probably also want my stepper package or an equivalent stepper implementation.

Dependencies

Pyafm requires the following Python modules:

  • Pycomedi (required directly, and via pypiezo)
  • Pypiezo
  • Stepper (or equivalent stepper implementation)
  • Pypid (optional temperature monitoring and control)
  • H5config (required directly, and via pypiezo)
  • SciPy

Getting the source

Pyafm is available as a Git repository:

$ git clone git://tremily.us/pyafm.git

There are also periodic bundled releases. For example, get version 0.3 as a gzipped tarball with:

$ wget 'http://git.tremily.us/?p=pyafm.git;a=snapshot;h=v0.3;sf=tgz'
$ tar -xzvf pyafm-0.1.tar.gz

Installation

After downloading, change to the source directory and run:

$ python setup.py install

to install pyafm. Run:

$ python setup.py install --help

to see a list of installation options you may want to configure.

Usage

The docstrings include some pretty detailed tests to get you started. dir() and help() are your friends ;). One neat feature that I’ve added recently (2012-03-16) is the ability to store and load complete AFM configurations via h5config. For example, when you first use pyafm, it may take you a bit to dig up all the necessary calibration constants, etc. and plug them into your config:

>>> import pycomedi.constant
>>> import pypiezo.config
>>> import pyafm.config
>>> config = pyafm.config.AFMConfig()
>>> config['name'] = '1B3D9'
>>> config['main-axis'] = 'z'
>>> config['piezo'] = pypiezo.config.PiezoConfig()
>>> config['piezo']['name'] = '2253E'
>>> config['piezo']['axes'] = [
...     pypiezo.config.AxisConfig(), pypiezo.config.AxisConfig()]
>>> config['piezo']['axes'][0]['gain'] = 20
>>> config['piezo']['axes'][0]['sensitivity'] = 8.8e-9
>>> config['piezo']['axes'][0]['channel'] = pypiezo.config.OutputChannelConfig()
>>> config['piezo']['axes'][0]['channel']['analog-reference] = pycomedi.constant.AREF.ground
>>> config['piezo']['axes'][0]['channel']['analog-reference] = pycomedi.constant.AREF.ground

and on, and on ;). Don’t worry though, once you finish telling Python about your particular AFM configuration, you can get a working AFM instance quite easily:

>>> devices = []
>>> afm = AFM(config=config, devices=devices)

That takes care of opening all the channels and initializing all the pieces you configured above. devices will end up full of any pycomedi.device.Device instances that you need. Once you’re happy with your setup, make sure the config object is up-to-date with:

>>> afm.setup_config()

Which copies any new object state into the .config attribute (e.g. bit-to-volt conversion polynomials). Then save your configuration with:

>>> import pyafm.storage
>>> pyafm.storage.save_afm(afm=afm, filename='whatever', group='/optional')

Which will create a HDF5 file at the specified path, and store the AFM configutaion under the specified group. Both filename and group are optional. If you leave them out, they will default to ~/.config/pyafm-default.h5 and / respectively.

The next time you need to do something with the AFM, just load your old config file. If you used the default location, that’s as easy as:

>>> import pyafm.storage
>>> devices = []
>>> afm = pyafm.storage.load_afm(devices=devices)
>>> afm.load_from_config()

When you’re done using them, it’s good practice to close any devices in devices:

>>> for device in devices:
...     device.close()

Using load_afm with the default path is a good way to keep your AFM configuration synchronized across several applications. That way, there’s only one place you need to update if you recalibrate your piezo or rebuild an amplifier.

Release History

Release History

0.5

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pyafm-0.5.tar.gz (23.5 kB) Copy SHA256 Checksum SHA256 Source May 24, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting