Python-based MaRCoS CLI, associated tests and APIs.
Table of Contents
TODO: The Python package is not yet released.
pip install marcos
See the MaRCoS wiki for info; specifically the Using MaRCoS and the Marcos internals pages.
If you want to write your own scripts the recommended procedure is as follows (i.e. using a Python virtual environment managed by hatch
)
- Install
hatch
for dependency management (either as user or site wide):python -m ensurepip
python -m pip install -U pip
python -m pip install -U hatch
- Create a new project, e.g. in your home folder:
cd ~
hatch new my_experiments
- Add
marcos
as a dependency:cd my_experiments
nano pyproject.toml
- Find the line that says
dependencies=[]
and change it todependencies = ["marcos @ git+https://github.com/M4a1x/marcos_client.git"]
. Save with<Ctrl-O>
. Exit with<Ctrl-X>
.
- Create your first script here:
~/my_experiments/my_experiment/first_experiment.py
With your favourite text editor with content:import matplotlib.pyplot as plt import numpy as np from marcos import Experiment def my_first_experiment(): exp = Experiment(lo_freq=5, rx_t=3.125) exp.add_flodict({"tx0": (np.array([50, 130]), np.array([0.5, 0]))}) exp.add_flodict({"rx0_en": (np.array([200, 400]), np.array([1, 0]))}) exp.plot_sequence() plt.show() # Execute the sequence rxd, msgs = exp.run() exp.close_server(only_if_sim=True) if __name__ == "__main__": my_first_experiment()
- Start the
marga
simulator. See wiki/README.md for details - Run your first script:
cd ~/my_experiments
hatch run my_experiments/first_experiment.py
- API for configuration (
local_config.py
/local_config.toml
) - Create
local_config.toml
through CLI - Include
test_server.py
into CLI (Should return no errors) - Include
test_noise.py
into CLI (Generates simple pulses to view on an oscilloscope)
csvs/
: CSV files used by test_flocra_model.pyexperiment.py
: basic API for controlling the MaRCoS serverexamples.py
: examples of how to use experiment.py and other libraries [WIP]local_config.py.example
: template file for local configuration; create a copy and name it local_config.py to configure your local setupserver_comms.py
: low-level communication library for the MaRCoS server; use if you wish to write your own APItest_flocra.py
: hand-written (low-level) examples/tests of the Flocra systemtest_flocra_model.py
: unit tests of the MaRCoS server + Verilator model of the Flocra HDLtest_ocra_pulseq.py
: tests of the ocra-pulseq interface [WIP]test_server.py
: unit tests of the standalone MaRCoS server operationvlsualiser.py
: [WIP] plot expected ocra assembly file outputs (for very basic files)
marcos
is distributed under the terms of the GPL-3.0-or-later license.