Skip to content
Snippets Groups Projects
Commit e2d45b54 authored by Luis Dekant's avatar Luis Dekant
Browse files

Resolve "Refactor UI files"

parent 7566fea0
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
[run] [run]
branch = True branch = True
source = adwin_control source = adwin_control
omit = servoController.py omit = run.py
[paths] [paths]
source = source =
......
...@@ -15,9 +15,9 @@ adwin\_control.Servo ...@@ -15,9 +15,9 @@ adwin\_control.Servo
:members: :members:
:no-undoc-members: :no-undoc-members:
adwin\_control.servoController adwin\_control.controller
------------------------------ ---------------------------
.. automodule:: adwin_control.servoController .. automodule:: adwin_control.controller
:members: :members:
:no-undoc-members: :no-undoc-members:
...@@ -47,7 +47,7 @@ services: ...@@ -47,7 +47,7 @@ services:
context: . context: .
cache_from: cache_from:
- lasnq/adwin_control - lasnq/adwin_control
command: bash -c "rsync -ur /mnt/* /code/ && ipython3 `pwd`/src/adwin_control/servoController.py" command: bash -c "rsync -ur /mnt/* /code/ && ipython3 `pwd`/src/adwin_control/run.py"
environment: environment:
PYTHONPATH: "/code/src" PYTHONPATH: "/code/src"
volumes: volumes:
......
...@@ -31,3 +31,4 @@ pytest-cov ...@@ -31,3 +31,4 @@ pytest-cov
jsonpickle jsonpickle
websocket-client websocket-client
websockets websockets
gunicorn
...@@ -14,7 +14,7 @@ from setuptools import setup ...@@ -14,7 +14,7 @@ from setuptools import setup
# Add here console scripts and other entry points in ini-style format # Add here console scripts and other entry points in ini-style format
entry_points = """ entry_points = """
[console_scripts] [console_scripts]
adwin_control = adwin_control.servoController:main adwin_control = adwin_control.run:main
# For example: # For example:
# fibonacci = adwin_control.skeleton:run # fibonacci = adwin_control.skeleton:run
""" """
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
"""gunicorn config file"""
workers = 1
bind = '0.0.0.0:8000'
timeout = 30
worker_class = 'sync'
debug = True
spew = False
loglevel = 'info'
import subprocess
def main():
subprocess.run(['gunicorn', '-c', 'guniconfig.py.ini', 'run:server'])
subprocess.run(['pwd'])
if __name__ == '__main__':
main()
import dash
from adwin_control import settings
from adwin_control.adwinUI import UI
def getLayout(ui):
return ui.layout
app = dash.Dash(__name__)
ui = UI(app)
app.layout = getLayout(ui)
ui.setCallbacks()
server = app.server
def main():
app.run_server(host='0.0.0.0', debug=settings.DEBUG, threaded=False, processes=1)
if __name__ == '__main__':
main()
...@@ -35,11 +35,13 @@ def _rearange_filter_coeffs(filter): ...@@ -35,11 +35,13 @@ def _rearange_filter_coeffs(filter):
a = filter[3:6] a = filter[3:6]
return [b[0], a[1], a[2], b[1] / b[0], b[2] / b[0]] return [b[0], a[1], a[2], b[1] / b[0], b[2] / b[0]]
def _convertStepsize2Frequency(stepsize): def _convertStepsize2Frequency(stepsize):
if stepsize is None: if stepsize is None:
return None return None
return stepsize * settings.SAMPLING_RATE / settings.RAMP_DATA_POINTS return stepsize * settings.SAMPLING_RATE / settings.RAMP_DATA_POINTS
def _convertFrequency2Stepsize(frequency): def _convertFrequency2Stepsize(frequency):
# period_time = RAMP_DATA_POINTS/stepsize / SAMPLING_RATE # period_time = RAMP_DATA_POINTS/stepsize / SAMPLING_RATE
# f = stepsize * SAMPLING_RATE / RAMP_DATA_POINTS # f = stepsize * SAMPLING_RATE / RAMP_DATA_POINTS
...@@ -168,9 +170,9 @@ class Servo: ...@@ -168,9 +170,9 @@ class Servo:
'inputSw': False, 'inputSw': False,
}) })
self._ramp = mp.Manager().dict({ self._ramp = mp.Manager().dict({
'amplitude': None, 'amplitude': .1,
'minimum': 0, 'minimum': 0,
'stepsize': None, 'stepsize': 20,
}) })
self._fifo = mp.Manager().dict({ self._fifo = mp.Manager().dict({
'stepsize': self.DEFAULT_FIFO_STEPSIZE, 'stepsize': self.DEFAULT_FIFO_STEPSIZE,
......
This diff is collapsed.
...@@ -34,13 +34,14 @@ BACKUP_SUBSTRING = user_config.get('BACKUP_SUBSTRING', "%Y-%m-%d_%H-%M-%S") ...@@ -34,13 +34,14 @@ BACKUP_SUBSTRING = user_config.get('BACKUP_SUBSTRING', "%Y-%m-%d_%H-%M-%S")
LOG_LEVEL = user_config.get('LOG_LEVEL', 'WARNING') LOG_LEVEL = user_config.get('LOG_LEVEL', 'WARNING')
LOG_FORMAT = user_config.get('LOG_FORMAT', '%(levelname)s: %(module)s: %(message)s') LOG_FORMAT = user_config.get('LOG_FORMAT', '%(levelname)s: %(module)s: %(message)s')
DEBUG = user_config.get('DEBUG', False)
SERVO_NAMES = user_config.get('SERVO_NAMES', {}) # currently only for one device
# Temperature feedback # Temperature feedback
DEFAULT_TEMP_HOST = user_config.get('DEFAULT_TEMP_HOST', '127.0.0.1') DEFAULT_TEMP_HOST = user_config.get('DEFAULT_TEMP_HOST', '127.0.0.1')
DEFAULT_TEMP_PORT = user_config.get('DEFAULT_TEMP_PORT', 5917) DEFAULT_TEMP_PORT = user_config.get('DEFAULT_TEMP_PORT', 5917)
SERVO_NAMES = user_config.get('SERVO_NAMES', dict({}))
# ADwin variables # ADwin variables
SAMPLING_RATE = 200e3 SAMPLING_RATE = 200e3
RAMP_DATA_POINTS = 0x20000 RAMP_DATA_POINTS = 0x20000
......
...@@ -14,4 +14,5 @@ ...@@ -14,4 +14,5 @@
# 1: 'Cavity', # 1: 'Cavity',
# 3: 'Mode Cleaner', # 3: 'Mode Cleaner',
# } # }
# LOG_LEVEL = 'WARNING' # Possible alternatives: DEBUG, INFO, WARNING, ERROR, CRITICAL
# DEBUG = True
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment