Installation

SPECULA requires Python 3.8 or higher and we strongly recommend using conda for package management.

Prerequisites

System Requirements:
  • Python 3.8 or higher

  • Git (for repository cloning)

  • CUDA-compatible GPU (optional, for acceleration)

Recommended Setup:
  • Anaconda or Miniconda

  • 16GB+ RAM

  • 12GB+ GPU memory (if using GPU acceleration)

Step 1: Create Conda Environment

Create a dedicated conda environment for SPECULA (here with python 3.11):

# Create environment with Python 3.11
conda create --name specula python=3.11

# Activate the environment
conda activate specula

Step 3: Install SPECULA

You can install SPECULA in two ways:

A) Install from PyPI (recommended for most users):

# Install SPECULA from PyPI
pip install specula

B) Install from source (for development or latest features):

Clone the SPECULA repository from GitHub:

# Clone the repository
git clone https://github.com/ArcetriAdaptiveOptics/SPECULA.git

# Navigate to the directory
cd SPECULA

Then install in development mode:

pip install -e .

This installs SPECULA in “editable” mode, allowing you to modify the code and see changes immediately.

Required Dependencies: All required dependencies will be installed automatically, including:

  • numpy: Numerical computing foundation

  • scipy: Scientific computing algorithms

  • astropy: Astronomical data handling and FITS I/O

  • matplotlib: Plotting and visualization

  • flask: Web framework for display server

  • flask-socketio: Real-time web communication

  • python-socketio: WebSocket client support

  • scikit-image: Image processing algorithms

  • astro-seeing: Sympy Expressions Evaluation Implemented oN the GPU

  • symao: A collection of Sympy expressions used in Adaptive Optics

  • synim: Synthetic image generation

Optional Libraries

Block Diagram Generation

  • pycairo: Graphics library for rendering diagrams

  • orthogram: Automatic block diagram creation from SPECULA configurations

To install these libraries, first install pkg-config and cairo with conda:

# Install dependencies for optional diagram tools
conda install -c conda-forge pkg-config cairo

To ensure that the correct version of pycairo is installed, use conda:

# Install pycairo version 1.21.0
conda install -c conda-forge pycairo=1.21.0

and then install orthogram with pip.

# Install optional diagram tools
pip install orthogram

Transfer function system management

  • control: Library for control system analysis and design

# Install control library
pip install control

Environment Management

Useful conda commands:

# List environments
conda env list

# Activate SPECULA environment
conda activate specula

# Deactivate environment
conda deactivate

# Update all packages
conda update --all

# Remove environment (if needed)
conda env remove --name specula

Updating SPECULA:

# Navigate to SPECULA directory
cd SPECULA

# Pull latest changes
git pull origin main