Add optional cli argument for spind path
This commit is contained in:
parent
e99edbaf72
commit
90387174e5
@ -38,10 +38,11 @@ def main():
|
|||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--anatric-path",
|
"--anatric-path", type=str, default=None, help="path to anatric executable",
|
||||||
type=str,
|
)
|
||||||
default=None,
|
|
||||||
help="path to anatric executable",
|
parser.add_argument(
|
||||||
|
"--spind-path", type=str, default=None, help="path to spind scripts folder",
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -55,7 +56,7 @@ def main():
|
|||||||
|
|
||||||
logger.info(app_path)
|
logger.info(app_path)
|
||||||
|
|
||||||
pyzebra_handler = PyzebraHandler(args.anatric_path)
|
pyzebra_handler = PyzebraHandler(args.anatric_path, args.spind_path)
|
||||||
handler = ScriptHandler(filename=app_path, argv=args.args)
|
handler = ScriptHandler(filename=app_path, argv=args.args)
|
||||||
server = Server(
|
server = Server(
|
||||||
{"/": Application(pyzebra_handler, handler)},
|
{"/": Application(pyzebra_handler, handler)},
|
||||||
|
@ -5,7 +5,7 @@ class PyzebraHandler(Handler):
|
|||||||
"""Provides a mechanism for generic bokeh applications to build up new streamvis documents.
|
"""Provides a mechanism for generic bokeh applications to build up new streamvis documents.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, anatric_path):
|
def __init__(self, anatric_path, spind_path):
|
||||||
"""Initialize a pyzebra handler for bokeh applications.
|
"""Initialize a pyzebra handler for bokeh applications.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -14,6 +14,7 @@ class PyzebraHandler(Handler):
|
|||||||
super().__init__() # no-op
|
super().__init__() # no-op
|
||||||
|
|
||||||
self.anatric_path = anatric_path
|
self.anatric_path = anatric_path
|
||||||
|
self.spind_path = spind_path
|
||||||
|
|
||||||
def modify_document(self, doc):
|
def modify_document(self, doc):
|
||||||
"""Modify an application document with pyzebra specific features.
|
"""Modify an application document with pyzebra specific features.
|
||||||
@ -26,5 +27,6 @@ class PyzebraHandler(Handler):
|
|||||||
"""
|
"""
|
||||||
doc.title = "pyzebra"
|
doc.title = "pyzebra"
|
||||||
doc.anatric_path = self.anatric_path
|
doc.anatric_path = self.anatric_path
|
||||||
|
doc.spind_path = self.spind_path
|
||||||
|
|
||||||
return doc
|
return doc
|
||||||
|
@ -5,6 +5,7 @@ import subprocess
|
|||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from bokeh.io import curdoc
|
||||||
from bokeh.layouts import column, row
|
from bokeh.layouts import column, row
|
||||||
from bokeh.models import (
|
from bokeh.models import (
|
||||||
Button,
|
Button,
|
||||||
@ -22,6 +23,8 @@ import pyzebra
|
|||||||
|
|
||||||
|
|
||||||
def create():
|
def create():
|
||||||
|
doc = curdoc()
|
||||||
|
|
||||||
path_prefix_textinput = TextInput(title="Path prefix:", value="")
|
path_prefix_textinput = TextInput(title="Path prefix:", value="")
|
||||||
selection_list = TextAreaInput(title="ROIs:", rows=7)
|
selection_list = TextAreaInput(title="ROIs:", rows=7)
|
||||||
lattice_const_textinput = TextInput(
|
lattice_const_textinput = TextInput(
|
||||||
@ -54,7 +57,7 @@ def create():
|
|||||||
"-n",
|
"-n",
|
||||||
"2",
|
"2",
|
||||||
"python",
|
"python",
|
||||||
os.path.expanduser("~/spind/gen_hkl_table.py"),
|
os.path.join(doc.spind_path, "gen_hkl_table.py"),
|
||||||
lattice_const_textinput.value,
|
lattice_const_textinput.value,
|
||||||
"--max-res",
|
"--max-res",
|
||||||
str(max_res_spinner.value),
|
str(max_res_spinner.value),
|
||||||
@ -81,7 +84,7 @@ def create():
|
|||||||
"-n",
|
"-n",
|
||||||
"2",
|
"2",
|
||||||
"python",
|
"python",
|
||||||
os.path.expanduser("~/spind/SPIND.py"),
|
os.path.join(doc.spind_path, "SPIND.py"),
|
||||||
temp_peak_list_dir,
|
temp_peak_list_dir,
|
||||||
temp_hkl_file,
|
temp_hkl_file,
|
||||||
"-o",
|
"-o",
|
||||||
@ -136,6 +139,9 @@ def create():
|
|||||||
process_button = Button(label="Process", button_type="primary")
|
process_button = Button(label="Process", button_type="primary")
|
||||||
process_button.on_click(process_button_callback)
|
process_button.on_click(process_button_callback)
|
||||||
|
|
||||||
|
if doc.spind_path is None:
|
||||||
|
process_button.disabled = True
|
||||||
|
|
||||||
ub_matrix_textareainput = TextAreaInput(title="UB matrix:", rows=7, width=400)
|
ub_matrix_textareainput = TextAreaInput(title="UB matrix:", rows=7, width=400)
|
||||||
hkl_textareainput = TextAreaInput(title="hkl values:", rows=7, width=400)
|
hkl_textareainput = TextAreaInput(title="hkl values:", rows=7, width=400)
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
source /home/pyzebra/miniconda3/etc/profile.d/conda.sh
|
source /home/pyzebra/miniconda3/etc/profile.d/conda.sh
|
||||||
|
|
||||||
conda activate prod
|
conda activate prod
|
||||||
pyzebra --port=80 --allow-websocket-origin=pyzebra.psi.ch:80
|
pyzebra --port=80 --allow-websocket-origin=pyzebra.psi.ch:80 --spind-path=/home/pyzebra/spind
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
source /home/pyzebra/miniconda3/etc/profile.d/conda.sh
|
source /home/pyzebra/miniconda3/etc/profile.d/conda.sh
|
||||||
|
|
||||||
conda activate test
|
conda activate test
|
||||||
python ~/pyzebra/pyzebra/app/cli.py --allow-websocket-origin=pyzebra.psi.ch:5006
|
python ~/pyzebra/pyzebra/app/cli.py --allow-websocket-origin=pyzebra.psi.ch:5006 --spind-path=/home/pyzebra/spind
|
||||||
|
Loading…
x
Reference in New Issue
Block a user