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.16.0.tar.gz (16.3 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: palpao-0.16.0.tar.gz
  • Upload date:
  • Size: 16.3 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.16.0.tar.gz
Algorithm Hash digest
SHA256 1371149a0f90c1b889e589aa7199b8f34e8abd316b6525361c112a318f496744
MD5 efefc64fd089881099b478b11bf95154
BLAKE2b-256 5becbed7418e6f0fe57c801518aeda4540b24dba6e7ca3061a8eb917b2a9009e

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