Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
Rename 'Protocol' to 'MessageAPI' in order to avoid confusion with bpod protocols
Try to expand tree on rtd theme
  • Loading branch information
Carlos Mão de Ferro committed Jan 20, 2017
1 parent 0ddcd1e commit c1f2d92
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 32 deletions.
Binary file modified docs/source/_images/main_classes.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/source/api_reference/pybpodapi/com/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
.. toctree::
:titlesonly:

protocol
message_api
message_headers
arcom
hw_info_container
Expand Down
23 changes: 23 additions & 0 deletions docs/source/api_reference/pybpodapi/com/message_api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
==================================================
:mod:`message_api` --- Requesting Commands to Bpod
==================================================

.. module:: com.message_api
:synopsis: communication with Bpod device

.. contents:: Contents
:local:

--------
Overview
--------

This module defines messages that are available to interact with the Bpod device.

--------------
Implementation
--------------

.. automodule:: pybpodapi.com.message_api
:members:
:private-members:
23 changes: 0 additions & 23 deletions docs/source/api_reference/pybpodapi/com/protocol.rst

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Overview
This container is used to store serial message information.

.. seealso::
:meth:`pybpodapi.com.protocol.Protocol.load_serial_message`
:meth:`pybpodapi.com.message_api.MessageAPI.load_serial_message`

--------------
Implementation
Expand Down
6 changes: 6 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@
# documentation.
#
# html_theme_options = {}
# toc tree depth on sidebar
html_theme_options = {
'collapse_navigation': False,
'display_version': True,
'navigation_depth': 3
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down
2 changes: 1 addition & 1 deletion pybpodapi/com/protocol.py → pybpodapi/com/message_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
logger = logging.getLogger(__name__)


class Protocol(object):
class MessageAPI(object):
"""
Define command actions that can be requested to Bpod device.
Expand Down
8 changes: 4 additions & 4 deletions pybpodapi/model/bpod.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
import math

from pybpodapi.com.protocol import Protocol
from pybpodapi.com.message_api import MessageAPI
from pybpodapi.com.hardware_info_container import HardwareInfoContainer
from pybpodapi.com.serial_message_container import SerialMessageContainer
from pybpodapi.hardware.hardware import Hardware
Expand Down Expand Up @@ -45,11 +45,11 @@ def hardware(self, value):

@property
def bpod_protocol(self):
return self._bpod_protocol # type: Protocol
return self._bpod_protocol # type: MessageAPI

@bpod_protocol.setter
def bpod_protocol(self, value):
self._bpod_protocol = value # type: Protocol
self._bpod_protocol = value # type: MessageAPI

#########################################
############ PUBLIC METHODS #############
Expand All @@ -72,7 +72,7 @@ def start(self, serial_port, baudrate=115200, sync_channel=255, sync_mode=1):

self.hardware = Hardware() # type: Hardware
self.session = Session() # type: Session
self.bpod_protocol = Protocol() # type: Protocol
self.bpod_protocol = MessageAPI() # type: MessageAPI

self.bpod_protocol.connect(serial_port, baudrate)

Expand Down
4 changes: 2 additions & 2 deletions pybpodapi/model/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ def add_trial(self, sma):

self.trials.append(new_trial)

logger.info("New trial added: %s", str(new_trial))

def add_trial_events(self):

current_trial = self.current_trial() # type: Trial
Expand Down Expand Up @@ -83,5 +81,7 @@ def add_trial_events(self):
thisEventTimestamps.append(sma_data.event_timestamps[i])
current_trial.events_timestamps[thisEventName] = thisEventTimestamps

logger.info("Trial info: %s", str(current_trial))

def current_trial(self):
return self.trials[-1]

0 comments on commit c1f2d92

Please sign in to comment.