Skip to main content

ALPAO, Boston MEMS, Physik Instrument Deformable mirrors interface

Project description

# PALPAO: deformable mirror controller

[![Build Status][travis]][travislink] [![Coverage Status][coveralls]][coverallslink] [![PyPI version][pypiversion]][pypiversionlink]

This is part a component of the Plico framework to control DMs (Alpao, MEMS)


[plico]: https://github.com/lbusoni/plico
[pysilico]: https://github.com/lbusoni/pysilico
[allied]: https://www.alliedvision.com
[travis]: https://travis-ci.com/lbusoni/palpao.svg?branch=master "go to travis"
[travislink]: https://travis-ci.com/lbusoni/palpao
[coveralls]: https://coveralls.io/repos/github/lbusoni/palpao/badge.svg?branch=master "go to coveralls"
[coverallslink]: https://coveralls.io/github/lbusoni/palpao
[pypiversion]: https://badge.fury.io/py/palpao.svg
[pypiversionlink]: https://badge.fury.io/py/palpao

## Installation

### Installing

From the wheel

```
pip install palpao-XXX.whl
```

In palpao source dir

```
pip install .
```

During development you want to update use

```
pip install -e .
```
that install a python egg with symlinks to the source directory in such
a way that chages in the python code are immediately available without
the need for re-installing (beware of conf/calib files!)

### Uninstall

```
pip uninstall palpao
```

### Config files

The application uses `appdirs` to locate configurations, calibrations
and log folders: the path varies as it is OS specific.
The configuration files are copied when the application is first used
from their original location in the python package to the final
destination, where they are supposed to be modified by the user.
The application never touches an installed file (no delete, no overwriting)

To query the system for config file location, in a python shell:

```
import palpao
palpao.defaultConfigFilePath
```


The user can specify customized conf/calib/log file path for both
servers and client (how? ask!)


## Usage

### Starting Server

```
palpao_start
```
Starts the 2 servers that control one device each.


### Using client

In a Python / IPython shell:

```
In [1]: import palpao

In [2]: dm1=palpao.DeformableMirror('AlpaoDM277')

In [3]: dm2=palpao.DeformableMirror('MemsMultiDM')

In [4]: dm1.getSnapshot('boo')
Out[4]: {'boo.COMMAND_COUNTER': 0, 'boo.SERIAL_NUMBER': '1', 'boo.STEP_COUNTER': 45956}

In [5]: dm1.applyZonalCommand(np.ones(277))

In [6]: dm1.getZonalCommand()
Out[6]:
array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1.])

In [7]: dm1.getSnapshot('boo')
Out[7]: {'boo.COMMAND_COUNTER': 1, 'boo.SERIAL_NUMBER': '1', 'boo.STEP_COUNTER': 83589}

In [8]: dm2.getSnapshot('tux')
Out[8]:
{'tux.COMMAND_COUNTER': 0,
'tux.SERIAL_NUMBER': '234',
'tux.STEP_COUNTER': 95980}
```


### Terminal

An ipython terminal with palpao embedded

```
palpao_terminal
```

### Stopping Palpao

To kill the servers

```
palpao_stop
```

More hard:

```
palpao_kill_all
```




## Administration Tool

For developers.


### Testing
Never commit before tests are OK!
To run the unittest and integration test suite execute in palpao source dir

```
python setup.py test
```


### Creating a Conda environment
Use the Anaconda GUI or in terminal

```
conda create --name palpao
```

To create an environment with a specific python version

```
conda create --name palpao26 python=2.6
```


It is better to install available packages from conda instead of pip.

```
conda install --name palpao matplotlib scipy ipython numpy
```

### Packaging and distributing

See https://packaging.python.org/tutorials/distributing-packages/#

To make a source distribution

```
python setup.py sdist
```

and the tar.gz is created in palpao/dist


If it is pure Python and works on 2 and 3 you can make a universal wheel

```
python setup.py bdist_wheel --universal
```

Otherwise do a pure wheel

```
python setup.py bdist_wheel
```

The wheels are created in palpao/dist. I suppose one can trash palpao/build now and distribute the files in palpao/dist


To upload on pip (but do you really want to make it public?)

```
twine upload dist/*
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

palpao-0.14.0.tar.gz (15.1 kB view details)

Uploaded Source

File details

Details for the file palpao-0.14.0.tar.gz.

File metadata

  • Download URL: palpao-0.14.0.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/38.4.0 requests-toolbelt/0.8.0 tqdm/4.23.2 CPython/3.6.4

File hashes

Hashes for palpao-0.14.0.tar.gz
Algorithm Hash digest
SHA256 3615de62c7bdcd5938245d0e29b5bf26d046842f58cf44ecb8e2ad81346c5386
MD5 6243e873f8665c96b68a68ec7017102e
BLAKE2b-256 8ea183cd0444231ade2c940c112b40c57f7327bb48502cb3d205914834db10ad

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page