Skip to content

Commit 59eff15

Browse files
committed
update readme
1 parent 5ecae0a commit 59eff15

File tree

1 file changed

+47
-6
lines changed

1 file changed

+47
-6
lines changed

README.md

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,62 @@ Easy TI PLM data formatting and phase processing in Python.
44

55
This library provides utilities designed to make it easy to work with TI PLM technology. It addresses challenges associated with:
66

7-
* PLM device parameters (resolution, phase displacements, bit layout, etc.)
7+
* PLM device parameters (resolution, phase displacements, bit layout, etc.) - See [PLM database](./src/ti_plm/db/)
88
* Formatting phase data correctly for different TI PLM devices (quantization, bit packing, data flip, etc.)
99
* Displaying CGHs on PLM EVMs over external video (HDMI, DP)
1010

1111
## Installation
1212

13-
It is recommended to use a clean Python environment for working with this library using `conda`, `venv`, etc. This avoid potential dependency clashes with other installed libraries.
13+
Recommended: use `conda`, `venv`, `uv`, etc. to set up a dedicated Python environment to avoid dependency conflicts.
1414

15-
You can install `ti-plm` from this repo by cloning/downloading it and running `pip install .` from the project directory. This will also install all dependencies.
16-
17-
By default only core dependencies are installed. If you want to use the `display` module to render images/holograms on external monitors, there are a few additional dependencies that need to be installed, including `pygame`, `screeninfo`, and `pillow`. This can be done automatically by specifying the `display` pip install option: `pip install ".[display]"`
15+
* `pip install ti-plm`
16+
* Core functionality only
17+
* `pip install ti-plm[display]`
18+
* Installs optional dependencies needed by `display` module (pygame, screeninfo, pillow, etc.)
1819

1920
## Usage
2021

21-
See [examples](./examples/) and [tests](./tests/) for usage examples.
22+
This library provides a `PLM` class that keeps track of PLM device parameters and provides functions to process data in a way specific to that device. PLM functions support n-dimensional arrays by default, as long as the last 2 dimensions are rows, columns. This means you can easily and efficiently process phase data for RGB images (color channel being the outermost dimension), or time-series data (time being the outermost dimension).
23+
24+
```python
25+
from ti_plm import PLM
26+
27+
# Typically PLM parameters will be loaded from the database
28+
print(PLM.get_device_list()) # print a list of all available devices in the database
29+
plm = PLM.from_db('p67') # load p67 data from database into a new `plm` object
30+
31+
# Alternatively, PLM parameters can be specified manually
32+
# See PLM class documentation for required parameters,
33+
# or look at example json files in src/ti_plm/db
34+
plm = PLM(
35+
name=...,
36+
shape=...,
37+
pitch=...,
38+
displacement_ratios=...,
39+
memory_lut=...,
40+
electrode_layout=...,
41+
data_flip=...
42+
)
43+
44+
# Once the plm object is instantiated, you can use its class methods to process phase data
45+
# This will take care of quantizing to appropriate displacement levels and mapping data to
46+
# the electrode layout specific to this device. In this case phase_map would contain floating
47+
# point phase data between 0 and 2pi
48+
bmp = plm.process_phase_map(phase_map)
49+
50+
# This process can also be broken down into individual steps:
51+
# 1. Quantize continuous phase data into buckets corresponding to avaialble mirror levels
52+
state_index = plm.quantize(phase_map)
53+
# 2. Map state_index values to electrodes
54+
bmp = plm.electrode_map(state_index)
55+
# 3. Replicate bits across the full 8 bits of the bmp
56+
bmp *= 255
57+
58+
# If phase_map data has additional dimensions for color channel or time-series, make sure the last
59+
# 2 dimensions are rows, columns. See examples/p67.py for a demo of this.
60+
```
61+
62+
See [examples](./examples/) and [tests](./tests/) for more usage examples.
2263

2364
## CLI
2465

0 commit comments

Comments
 (0)