{"id":22441465,"url":"https://github.com/decargroup/closed_loop_koopman","last_synced_at":"2025-10-16T04:31:20.836Z","repository":{"id":213755153,"uuid":"697823122","full_name":"decargroup/closed_loop_koopman","owner":"decargroup","description":"Companion code for Closed-Loop Koopman Operator Approximation","archived":false,"fork":false,"pushed_at":"2024-03-24T19:39:48.000Z","size":32192,"stargazers_count":15,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-06T02:14:31.713Z","etag":null,"topics":["control","dynamical-systems","koopman","machine-learning","system-identification"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2303.15318","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/decargroup.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-09-28T14:47:29.000Z","updated_at":"2024-10-08T07:26:41.000Z","dependencies_parsed_at":"2024-03-24T20:32:09.662Z","dependency_job_id":"c3c2204f-39b4-4c2d-b434-35c3f28ecb09","html_url":"https://github.com/decargroup/closed_loop_koopman","commit_stats":{"total_commits":137,"total_committers":1,"mean_commits":137.0,"dds":0.0,"last_synced_commit":"4056d43f6b6994a64b2744ecc841be134443f7dd"},"previous_names":["decargroup/closed_loop_koopman"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decargroup%2Fclosed_loop_koopman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decargroup%2Fclosed_loop_koopman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decargroup%2Fclosed_loop_koopman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decargroup%2Fclosed_loop_koopman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/decargroup","download_url":"https://codeload.github.com/decargroup/closed_loop_koopman/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236677550,"owners_count":19187473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["control","dynamical-systems","koopman","machine-learning","system-identification"],"created_at":"2024-12-06T02:14:38.468Z","updated_at":"2025-10-16T04:31:11.490Z","avatar_url":"https://github.com/decargroup.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Closed-Loop Koopman Operator Approximation\n\nThis repository contains the companion code for [Closed-Loop Koopman Operator\nApproximation](https://arxiv.org/abs/2303.15318). All the code required to\ngenerate the paper's plots from raw data is included here.\n\nThe regression methods detailed in the paper are implemented in\n`cl_koopman_pipeline.py`, which extends\n[`pykoop`](https://github.com/decarsg/pykoop), the authors' Koopman operator\nidentification library.\n\nThis software relies on [`doit`](https://pydoit.org/) to automate experiment\nexecution and plot generation.\n\n## Requirements\n\nThis software is compatible with Linux, macOS, and Windows. It was developed on\nArch Linux with Python 3.11.6, while the experiments used in the corresponding\npaper were run on Windows 10 with Python 3.10.9. The `pykoop` library supports\nany version of Python above 3.7.12. You can install Python from your package\nmanager or from the [official website](https://www.python.org/downloads/).\n\n## Installation\n\nTo clone the repository, run\n```sh\n$ git clone git@github.com:decargroup/closed_loop_koopman.git\n```\n\nThe recommended way to use Python is through a [virtual\nenvironment](https://docs.python.org/3/library/venv.html). Create a virtual\nenvironment (in this example, named `venv`) using\n```sh\n$ virtualenv venv\n```\nActivate the virtual environment with[^1]\n```sh\n$ source ./venv/bin/activate\n```\nTo use a specific version of Python in the virtual environment, instead use\n```sh\n$ source ./venv/bin/activate --python \u003cPATH_TO_PYTHON_BINARY\u003e\n```\nIf the virtual environment is active, its name will appear at the beginning of\nyour terminal prompt in parentheses:\n```sh\n(venv) $\n```\n\nTo install the required dependencies in the virtual environment, including\n`pykoop`, run\n```sh\n(venv) $ pip install -r ./requirements.txt\n```\n\nThe LMI solver used, MOSEK, requires a license to use. You can request personal\nacademic license [here](https://www.mosek.com/products/academic-licenses/). You\nwill be emailed a license file which must be placed in `~/mosek/mosek.lic`[^2].\n\n[^1]: On Windows, use `\u003e \\venv\\Scripts\\activate`.\n[^2]: On Windows, place the license in `C:\\Users\\\u003cUSER\u003e\\mosek\\mosek.lic`.\n\n## Usage\n\nTo automatically generate all the plots used in the paper, run\n```sh\n(venv) $ doit\n```\nin the repository root. This command will preprocess the raw data located in\n`dataset/`, run all the required experiments, and generate figures, placing\nall the results in a directory called `build/`.\n\n\nTo execute just one task and its dependencies, run\n```sh\n(venv) $ doit \u003cTASK_NAME\u003e\n```\nTo see a list of all available task names, run\n```sh\n(venv) $ doit list --all\n```\nFor example, to generate only the closed-loop prediction error plot, run\n```sh\n(venv) $ doit plot_paper_figures:errors_cl\n```\n\nIf you have a pre-built copy of `build/` or other build products, `doit` will\nthink they are out-of-date and try to rebuild them. To prevent this, run\n```sh\n(venv) $ doit reset-dep\n```\nafter placing the folders in the right locations. This will force `doit` to\nrecognize the build products as up-to-date and prevent it from trying to\nre-generate them. This is useful when moving the `build/` directory between\nmachines.\n\n## Dataset\n\nThe dataset contained in `dataset/` was collected using the [Quanser\n_QUBE-Servo_](https://www.quanser.com/products/qube-servo-2/). Details\nconcerning the experimental procedure can be found in the paper. The C source\ncode used to run the _QUBE-Servo_ system can be found\n[here](https://github.com/decargroup/quanser_qube).\n\nEach CSV file in `dataset/` contains one experimental episode. The columns are:\n\n| Column | Description |\n| --- | --- |\n| `t` | Timestamp (s) |\n| `target_theta` | Target motor angle (rad) |\n| `target_alpha` | Target pendulum angle (rad) |\n| `theta` | Measured motor angle (rad) |\n| `alpha` | Measured pendulum angle (rad) |\n| `control_output` | Control signal calculated by the controller (V) |\n| `feedforward` | Feedforward signal to be added to `control_output` (V) |\n| `plant_input` | `control_output` summed with `feedforward` (V), saturated between -10V and 10V |\n| `saturation` | Signal indicating if saturation is active (_i.e._, -1 if saturating in the negative direction, +1 if saturating in the positive direction) |\n\n## Repository Layout\n\nThe files and folders of the repository are described here:\n\n| Path | Description |\n| --- | --- |\n| `build/` | Contains all `doit` outputs, including plots. |\n| `dataset/` | Contains the raw experimental data from the Quanser _QUBE-Servo_ system. |\n| `cl_koopman_pipeline.py` | Contains implementations of algorithms presented in the paper. |\n| `dodo.py` | Describes all of `doit`'s behaviour, like a `Makefile`. Also contains plotting code. |\n| `LICENSE` | Repository license. |\n| `requirements.txt` | Contains required Python packages with versions. |\n| `README.md` | This file! |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecargroup%2Fclosed_loop_koopman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdecargroup%2Fclosed_loop_koopman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecargroup%2Fclosed_loop_koopman/lists"}