Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ jobs:

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get update
sudo apt-get install ffmpeg -y
pip install numpy matplotlib ruff

pip install ruff

- name: Test WCONViewer
run: |
./test_all.sh

./test_all.sh # also does pip install . and ruff check


- name: Print info on files
run: |
pip list
ls -alt
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/__pycache__
/.DS_Store
/examples/*.mp4
/old
/build
/*.egg-info
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
# WCONViewer
Python based viewer for WCON files in 2D

## Installation

```
pip install .
```

Saving animations with `-nogui` requires the `ffmpeg` binary to be installed on your system.

## Usage

```
wconviewer -f examples/simdata.wcon
```

Run `wconviewer -h` for all options (e.g. `-nogui` to save an `.mp4` instead of showing a window).
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import streamlit as st

from WormView import WormView
from wconviewer.WormView import WormView

DEFAULT_WCON = "examples/simdata.wcon"
FRAME_DELAY = 0.1 # seconds between frames while playing
Expand Down
28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[build-system]
requires = ["setuptools>=61"]
build-backend = "setuptools.build_meta"

[project]
name = "WCONViewer"
version = "0.1.0"
description = "Viewer for WCON (Worm tracker Commons Object Notation) files in 2D"
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.10"
dependencies = ["numpy", "matplotlib"]

[project.optional-dependencies]
dev = ["ruff"]

[project.scripts]
wconviewer = "wconviewer.WormView:main"

[tool.setuptools]
packages = ["wconviewer"]

[tool.ruff]
target-version = "py310"
line-length = 88

[tool.ruff.lint]
select = ["E4", "E7", "E9", "F"]
14 changes: 8 additions & 6 deletions test_all.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/bash
set -ex

ruff format *.py
ruff check *.py
ruff format wconviewer app.py
ruff check wconviewer app.py

python WormView.py -f examples/simdata.wcon -nogui -z # Test reloading WCON in Player
python WormView.py -f examples/worm_motion_log.wcon -nogui -g
python WormView.py -f examples/output_W2D.wcon -nogui -g -z
pip install .

#python WormView.py -f examples/N2\ on\ food\ L_2009_09_15__11_01_01___8___1.wcon.zip -nogui
wconviewer -f examples/simdata.wcon -nogui -z # Test reloading WCON in Player
wconviewer -f examples/worm_motion_log.wcon -nogui -g
wconviewer -f examples/output_W2D.wcon -nogui -g -z

#wconviewer -f examples/N2\ on\ food\ L_2009_09_15__11_01_01___8___1.wcon.zip -nogui
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions WormView.py → wconviewer/WormView.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import os
import argparse
import sys
from Player import Player
from SimpleWCON import SimpleWCON
from .Player import Player
from .SimpleWCON import SimpleWCON


class HalfIntegerLocator(MultipleLocator):
Expand Down Expand Up @@ -277,7 +277,7 @@ def parse_args():
"--wcon_file",
type=validate_file,
help="WCON file path",
default="examples/simdata.wcon",
required=True,
)
parser.add_argument(
"-nogui", action="store_true", help="Just load file, don't show GUI"
Expand Down
Empty file added wconviewer/__init__.py
Empty file.
5 changes: 5 additions & 0 deletions wconviewer/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import sys

from .WormView import main

sys.exit(main())
Loading