# Ekos AI Guider Offline Trainer


## 1. Prerequisites


```bash
# Create a virtual environment
python3 -m venv venv
source venv/bin/activate

# Install the required dependencies
pip install numpy scipy torch
```

## 2. Collecting Training Data

Before you can train a model, you must use the **Guide AI Assistant** inside KStars to collect system identification data.


## 3. Running the Trainer


```bash
python train.py --sysid-data ./sysid_data.json --output ./weights.json
```

### Options:

*   `--sysid-data <path>`: (Required) Path to the JSON data collected by KStars.
*   `--output <path>`: (Required) Path to save the resulting trained weights JSON file.
*   `--mount-type <type>`: Force a specific mount type (`WORM_GEAR`, `HARMONIC_DRIVE`, `DIRECT_DRIVE`). Usually not needed as it auto-detects from the sysid file.
*   `--verbose`: Print detailed logs of the physics fitting and the MLP training epochs.
*   `--gpu`: Use CUDA/MPS to accelerate training if available (not necessary for these small models).

## 4. Loading the Model into KStars

1. Take the `weights.json` file generated by the trainer and copy it back to your observatory computer.
2. In KStars, open your Equipment Profile.
3. Under the **AI Guiding** section, set the **Weights File** path to point to your `weights.json`.
4. Start guiding. The AI will automatically engage!
