Skip to content

Commit 281efff

Browse files
Merged in PhyNerd/lyse/labconfig-port (pull request labscript-suite#27)
removed hardcoded port Approved-by: Philip Starkey <philip.starkey@monash.edu> Approved-by: Chris Billington <chrisjbillington@gmail.com>
2 parents 4def0b8 + bda9bc4 commit 281efff

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

__init__.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import sys
2323

2424
import labscript_utils.h5_lock, h5py
25+
from labscript_utils.labconfig import LabConfig
2526
import pandas
2627
from numpy import array, ndarray
2728
import types
@@ -46,6 +47,13 @@
4647
# data to be sent back to the lyse GUI if running within lyse
4748
_updated_data = {}
4849

50+
# get port that lyse is using for communication
51+
try:
52+
_labconfig = LabConfig(required_params={"ports": ["lyse"]})
53+
_lyse_port = int(_labconfig.get('ports', 'lyse'))
54+
except Exception:
55+
_lyse_port = 42519
56+
4957
if len(sys.argv) > 1:
5058
path = sys.argv[1]
5159
else:
@@ -65,11 +73,10 @@ class _RoutineStorage(object):
6573
routine_storage = _RoutineStorage()
6674

6775

68-
def data(filepath=None, host='localhost', timeout=5):
76+
def data(filepath=None, host='localhost', port=_lyse_port, timeout=5):
6977
if filepath is not None:
7078
return _get_singleshot(filepath)
7179
else:
72-
port = 42519
7380
df = zmq_get(port, host, 'get dataframe', timeout)
7481
try:
7582
padding = ('',)*(df.columns.nlevels - 1)

0 commit comments

Comments
 (0)