https://github.com/apt1002/ocularity
Colour perception experiment
https://github.com/apt1002/ocularity
Last synced: 8 months ago
JSON representation
Colour perception experiment
- Host: GitHub
- URL: https://github.com/apt1002/ocularity
- Owner: apt1002
- License: bsd-2-clause
- Created: 2023-09-16T13:47:07.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-06-03T18:30:37.000Z (about 1 year ago)
- Last Synced: 2025-06-04T02:13:16.948Z (about 1 year ago)
- Language: Rust
- Size: 68.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ocularity
This is an experiment. It measures how humans see colour. More specifically it measures what colours humans can distinguish.
The software crowd-sources data from visitors to a web site. After an introduction and a questionnaire, the server repeatedly shows two randomly-generated images and asks the user to choose one.
## Deficiencies
Because the data is crowd-sourced from people on the internet, the experiment is not very well controlled. Aspects out of my control include:
- The display equipment and configuration
- The lighting
- The time of day
- The background (outside the browser window)
- The user's mental state (e.g. are they drunk?)
- distractions, surroundings
## Building
The web server is written in Rust, and can be built using `cargo`:
```sh
cargo build --release
```
## Running
For testing, you can run the server using `cargo`:
```sh
cargo run
```
By default the server listens on `localhost:8081` and appends experimental data to `/tmp/ocularity.log`. These values can be configured as described below.
For production, you can run the server using `systemd` as described below, so that it continues running when you log out, and restarts itself automatically if there is an error.
## Configuration
The server can be configured using three environment variables:
- OCULARITY_RESULTS - the filename of the results file (default: `/tmp/ocularity.log`)
- OCULARITY_ADDRESS - the host and port to listen on (default: `localhost:8081`
- OCULARITY_BASE_URL - the globally visible URL of the web server (default: `http://SERVER_ADDRESS`)
One way that the `BASE_URL` can differ from the `ADDRESS` is if the server is exposed to the internet via a proxy.
## Systemd configuration
The file `ocularity.service` belongs in `$HOME/.config/systemd/user/`. Edit it as needed.
Run the following commands:
```sh
loginctl enable-linger
systemctl --user enable ocularity.service
systemctl --user start ocularity.service
```
Replace `start` with `stop`, `restart` or `status` as appropriate. Systemd will log `stdout` and `stderr` by default, which makes for a usable server log. View it with
```sh
journalctl --user-unit ocularity
```