Giter Club home page Giter Club logo

bonsai-common's Introduction

** NOTICE **

This library is deprecated. Please use the Bonsai Platform API instead.


Bonsai Common

Python Tests A python library for integrating data sources with Bonsai brain.

Installation

To install from source (assuming you are in this directory)

$ pip install ./

To install the current release from the git repo:

$ pip install git+https://github.com/microsoft/bonsai-common

Usage

Clients will subclass bonsai_common.SimulatorSession and implement the required methods.

Example:

import sys
from bonsai_common import SimulatorSession, Schema
from microsoft_bonsai_api.simulator.client import BonsaiClientConfig
from microsoft_bonsai_api.simulator.generated.models import SimulatorInterface

class SimModel(SimulatorSession):
def get_state(self) -> Schema:
"""Called to retreive the current state of the simulator. """
    pass

def get_interface(self) -> SimulatorInterface:
"""Called to retreive the simulator interface during registration. """
    pass

def halted(self) -> bool
"""
Should return weather the episode is halted, and
no further action will result in a state.
"""
    pass

def episode_start(self, config: Schema):
""" Called at the start of each episode """
    pass

def episode_step(self, action: Schema):
""" Called for each step of the episode """
    pass

Then, the simulator is configured and assigned a BRAIN and run.

    def example():
        config = BonsaiClientConfig(argv=sys.argv)
        sim = SimModel(config)
        while sim.run():
            continue

Example of how to run simulator.

$ python mysim.py --workspace <WORKSPACE_ID> --accesskey <KEY>

Running tests using Dockerfile

To build dockerfile: docker build -t testbonsai3 .

To run tests: docker run testbonsai3

Microsoft Open Source Code of Conduct

This repository is subject to the Microsoft Open Source Code of Conduct.

bonsai-common's People

Contributors

journeyman-msft avatar microsoftopensource avatar mzat-msft avatar nmann4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.