Skip to content

Release v0.7.0: Plotting Styles and RatInABox API Parity

Latest

Choose a tag to compare

@Routhleck Routhleck released this 19 Jan 09:18
· 1 commit to master since this release

What's New

🎨 Enhanced Plotting System with Style Presets

  • Flexible plotting style system with three predefined styles: simulation, scientific, and publication
  • Full RatInABox API compatibility for agent parameters and environment plotting
  • New example scripts demonstrating plotting capabilities and API parity

📖 Comprehensive Contribution Guidelines

  • Detailed CONTRIBUTING.md with development setup, code style, and testing procedures
  • Clear pull request process and community guidelines

Major Features / Key Changes

🎨 Plotting Style System

  • Style presets: Three predefined plotting styles (simulation, scientific, publication) for spatial plots with customizable colors, markers, and visual properties
  • Environment plotting: New env.plot_environment() method for visualizing spatial environments
  • Style selection: All plotting functions now support style parameter for consistent visualization across your project
from canns_lib.spatial import Environment, Agent

# Create environment and agent
env = Environment()
agent = Agent(env)

# Plot with different styles
env.plot_environment(style='scientific')  # Clean, publication-ready plots
env.plot_environment(style='simulation')  # Colorful, detailed visualization
env.plot_environment(style='publication') # High-contrast, print-optimized

🗺️ RatInABox API Parity

  • Agent parameter access: Full compatibility with RatInABox API for accessing agent parameters (e.g., agent.dt, agent.speed_mean, agent.speed_std, agent.rotational_velocity_std)
  • Property getters: Direct access to agent configuration without breaking encapsulation
  • API compatibility: Seamless migration path for RatInABox users
from canns_lib.spatial import Agent, Environment

env = Environment()
agent = Agent(env, dt=0.01, speed_mean=0.1)

# Access parameters using RatInABox-compatible API
print(f"Time step: {agent.dt}")
print(f"Speed mean: {agent.speed_mean}")
print(f"Speed std: {agent.speed_std}")

📖 Documentation Improvements

  • CONTRIBUTING.md: Comprehensive 433-line guide covering development environment setup, code style guidelines for Python and Rust, testing requirements, and PR process
  • Community guidelines: Best practices for contributing to the project
  • Updated README: Maintenance badge updated for 2026

New Components Added

  • python/canns_lib/spatial/plotting_styles.py - Plotting style definitions and configuration
  • example/ratinabox_comparison.py - Demonstrates RatInABox API compatibility (271 lines)
  • example/style_comparison.py - Shows all three plotting styles side-by-side (110 lines)
  • tests/test_spatial_api_parity.py - Tests for RatInABox API compatibility (77 lines)
  • CONTRIBUTING.md - Contribution guidelines (433 lines)

Technical Improvements

  • Rust backend enhancements: Added 56 lines to src/spatial/agent.rs for property getter support
  • Python API expansion: Enhanced python/canns_lib/spatial/__init__.py with 205 new lines for plotting and API parity
  • Test coverage: New tests verify API compatibility with RatInABox

Breaking Changes

None - all additions are backward compatible.

Technical Notes

  • The plotting style system is designed to be extensible - custom styles can be defined following the same pattern
  • RatInABox API parity focuses on read-only parameter access; full behavioral compatibility may require additional work
  • All new features include example scripts and tests for verification

Files Added/Modified

  • Added: CONTRIBUTING.md, example/ratinabox_comparison.py, example/style_comparison.py, python/canns_lib/spatial/plotting_styles.py, tests/test_spatial_api_parity.py
  • Modified: README.md, python/canns_lib/spatial/__init__.py, src/spatial/agent.rs
  • Total changes: 8 files changed, 1,301 insertions(+), 12 deletions(-)

Use Cases

  • Researchers: Use publication-ready plotting styles for papers and presentations
  • RatInABox users: Migrate existing code with minimal changes using compatible API
  • Contributors: Follow clear guidelines for contributing to the project
  • Developers: Customize plotting styles for specific visualization needs

Full Changelog: v0.6.5...v0.7.0