Skip to content

Commit

Permalink
updated README and docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
marcsgil committed Nov 5, 2024
1 parent 5e2dde4 commit 6cca057
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
32 changes: 15 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ This project provides a Julia package for controlling a spatial light modulator

## Installation

To install the package, clone the repository and use Julia's package manager to add it to your environment:
The package is in the General Registry, so you can install it by hitting `]` in a Julia REPL to enter the PKG mode and then typing

```sh
git clone https://github.com/yourusername/SpatialLightModulator.git
cd SpatialLightModulator
julia -e 'using Pkg; Pkg.add(PackageSpec(path=pwd()))'
```
add SpatialLightModulator
```

## Usage
Expand All @@ -20,13 +18,13 @@ Here's a basic example of how to use the `SpatialLightModulator` package:
using SpatialLightModulator

# Create an SLM instance for the last monitor
slm = SLM()
slm = SLMDisplay()

# Generate random hologram data
holo = rand(UInt8, slm.width, slm.height)

# Update the hologram displayed on the SLM
update_hologram(slm, holo)
updateArray(slm, holo)

# Close the SLM window
close(slm)
Expand All @@ -36,27 +34,27 @@ For the calculation of holograms used to produce structured light modes, conside

## Documentation

### `SLM`
SLM(monitor_id::Int=lastindex(GetMonitors()))
### `SLMDisplay`
SLMDisplay(monitor::Int=lastindex(GetMonitors()))

Create a new Spatial Light Modulator (SLM) window.
`monitor_id` is the index of the monitor to use. By default, the last monitor is used.

`monitor` is the index of the monitor to use. By default, the last monitor is used.
To get the list of available monitors, use `GetMonitors()`, which is re-exported from GLFW.jl.


### `update_hologram`
### `updateArray`
updateArray(slm::SLMDisplay, data::AbstractMatrix{UInt8}; sleep=0.15)

update_hologram(slm::SLM, data::AbstractMatrix{UInt8}; sleep_time=0.15)

Update the array displayed on the SLM.

Update the hologram displayed on the SLM.
`data` is a 2D matrix of `UInt8` values representing the hologram.
`data` is a 2D matrix of UInt8 values representing the hologram.
The size of `data` must match the size of the SLM window.
Sleep for `sleep_time` seconds after updating the hologram. This is useful to give the SLM time to update the hologram.
Sleep for `sleep` seconds after updating the hologram. This is useful to give the SLM time to update the hologram.

### `close`

close(slm::SLM)
close(slm::SLMDisplay)

Close the SLM window.

Expand Down
4 changes: 2 additions & 2 deletions src/SpatialLightModulator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function SLMDisplay(monitor::Int=lastindex(GLFW.GetMonitors()))
end

"""
updateArray(slm::SLM, data::AbstractMatrix{UInt8}; sleep=0.15)
updateArray(slm::SLMDisplay, data::AbstractMatrix{UInt8}; sleep=0.15)
Update the array displayed on the SLM.
Expand All @@ -132,7 +132,7 @@ function updateArray(slm::SLMDisplay, data::AbstractMatrix{UInt8}; sleep=0.15)
end

"""
close(slm::SLM)
close(slm::SLMDisplay)
Close the SLM window.
"""
Expand Down

2 comments on commit 6cca057

@marcsgil
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/118749

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.0 -m "<description of version>" 6cca057048c1dfb3d1db1e3f24e0cce032952475
git push origin v0.3.0

Please sign in to comment.