From 3c618b431e2695b5967ff067b502a7226073241e Mon Sep 17 00:00:00 2001 From: gac-x07mb Date: Tue, 17 Dec 2024 16:13:36 +0100 Subject: [PATCH] minor changes add functions to phoenix.py --- .../startup/post_startup.py | 5 ++- phoenix_bec/devices/phoenix_trigger.py | 10 +++-- .../Code_to_test_devices/test_phoenix.py | 5 ++- .../local_scripts/Documentation/.bashrc | 45 +++++++++++++++++++ .../local_scripts/TEST_scanning/Linescan_1.py | 7 ++- .../local_scripts/TEST_scanning/monitor.sh | 2 + phoenix_bec/scripts/phoenix.py | 19 ++++++++ pyproject.toml | 3 +- 8 files changed, 87 insertions(+), 9 deletions(-) create mode 100644 phoenix_bec/local_scripts/Documentation/.bashrc create mode 100644 phoenix_bec/local_scripts/TEST_scanning/monitor.sh diff --git a/phoenix_bec/bec_ipython_client/startup/post_startup.py b/phoenix_bec/bec_ipython_client/startup/post_startup.py index 240a5ea..ae8ac4a 100644 --- a/phoenix_bec/bec_ipython_client/startup/post_startup.py +++ b/phoenix_bec/bec_ipython_client/startup/post_startup.py @@ -196,8 +196,11 @@ print("...... %ph_restart_bec_server restarts bec-server in new terminal ") def ph_restart_bec_server(line): os.system("bec-server restart") os.system( - 'gnome-terminal --geometry 170X50 -- bash -c "source /data/test/x07mb-test-bec/production/bec_venv/bin/activate ; bec-server attach; exec bash"' + 'gnome-terminal --geometry 100X30 -- bash -c "source /data/test/x07mb-test-bec/production/bec_venv/bin/activate ; bec-server attach ; exec bash"' ) + # os.system( + # "gnome-terminal --geometry 170X50 -- bash -c "source / tmux attach -t bec ; exec bash"" + # ) # #import phoenix_bec.bec_ipython_client.startup.post_startup diff --git a/phoenix_bec/devices/phoenix_trigger.py b/phoenix_bec/devices/phoenix_trigger.py index bebe7f7..18326c1 100644 --- a/phoenix_bec/devices/phoenix_trigger.py +++ b/phoenix_bec/devices/phoenix_trigger.py @@ -215,9 +215,13 @@ class PhoenixTrigger(PSIDetectorBase): start_csmpl = Cpt( EpicsSignal, "START-CSMPL", kind=Kind.config, put_complete=True ) # cont on / off - intr_count = Cpt( - EpicsSignal, "INTR-COUNT", kind=Kind.config, put_complete=True - ) # conter run up + + # intr_count = Cpt( + # EpicsSignal, "INTR-COUNT", kind=Kind.config, put_complete=True + # ) # conter run up + + intr_count = Cpt(EpicsSignal, "INTR-COUNT") # counter run up NEEDS TO BE READ OUT !!!! + total_cycles = Cpt( EpicsSignal, "TOTAL-CYCLES", kind=Kind.config, put_complete=True ) # cycles set diff --git a/phoenix_bec/local_scripts/Code_to_test_devices/test_phoenix.py b/phoenix_bec/local_scripts/Code_to_test_devices/test_phoenix.py index ce4ec7f..e84d542 100644 --- a/phoenix_bec/local_scripts/Code_to_test_devices/test_phoenix.py +++ b/phoenix_bec/local_scripts/Code_to_test_devices/test_phoenix.py @@ -9,6 +9,9 @@ ph = PhoenixBL() # # how do we get this to iphython command line ? # print('........... falkon.mca1 ' +## -ph.list_signals_falcon() +# ph.list_signals_falcon() # ph.list_signals_xmap() +ph.run_shell("ls") +ph.run_shell(["ls -altr ", "pwd"]) diff --git a/phoenix_bec/local_scripts/Documentation/.bashrc b/phoenix_bec/local_scripts/Documentation/.bashrc new file mode 100644 index 0000000..776a22d --- /dev/null +++ b/phoenix_bec/local_scripts/Documentation/.bashrc @@ -0,0 +1,45 @@ +# .bashrc + +# Source global definitions +if [ -f /etc/bashrc ]; then + . /etc/bashrc +fi + +# User specific environment +if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]] +then + PATH="$HOME/.local/bin:$HOME/bin:$PATH" +fi +export PATH + +# Uncomment the following line if you don't like systemctl's auto-paging feature: +# export SYSTEMD_PAGER= + + + + + + +# User specific aliases and functions + + + + +BEC_PATH='/data/test/x07mb-test-bec/production' +alias cd_bec='cd '$BEC_PATH +alias bec_env='source 'BEC_PATH'/bec_venv/bin/activate' +alias cd_bec_ph='cd '$BEC_PATH'/phoenix_bec/phoenix_bec' +alias cd_bec_local_scripts='cd '$BEC_PATH'/phoenix_bec/phoenix_bec/local_scripts' + +alias cd_bec_devices='cd '$BEC_PATH'/phoenix_bec/phoenix_bec/devices' +alias cd_bec_devices='cd '$BEC_PATH'/phoenix_bec/phoenix_bec/device_configs' + +alias cd_bec_device_configs='cd /data/test/x07mb-test-bec/production/phoenix_bec/phoenix_bec/device_configs' +alias cd_bec_scripts='cd /data/test/x07mb-test-bec/production/phoenix_bec/phoenix_bec/scripts' +alias cd_bec_venv_bin='cd /data/test/x07mb-test-bec/production/bec_venv/bin' + + +#alias activate_bec_venv='source /data/test/x07mb-test-bec/bec_deployment/bec_venv/bin/activate' +#alias activate_bec_venv='source /data/test/x07mb-test-bec/production/bec_venv/bin/activate' +alias bec_env='source /data/test/x07mb-test-bec/production/bec_venv/bin/activate' + diff --git a/phoenix_bec/local_scripts/TEST_scanning/Linescan_1.py b/phoenix_bec/local_scripts/TEST_scanning/Linescan_1.py index b8d6c58..bd034f0 100644 --- a/phoenix_bec/local_scripts/TEST_scanning/Linescan_1.py +++ b/phoenix_bec/local_scripts/TEST_scanning/Linescan_1.py @@ -37,7 +37,10 @@ print("---------------------------------") print(" SCAN DO NOT READ DIODE ") dev.SAI_01_MEAN.readout_priority = "baseline" # do not read detector ti = tt.time_ns() -s1 = scans.line_scan(dev.MA1_ScanX, 0, 0.002, steps=4, exp_time=0.01, relative=False, delay=2) + + +phoenix.run_shell("sh monitor.sh > monitor.out & ") +s1 = scans.line_scan(dev.MA1_ScanX, 0, 0.002, steps=4, exp_time=1, relative=False, delay=2) tf = tt.time_ns() print("elapsed time", (tf - ti) / 1e9) @@ -46,7 +49,7 @@ print(" SCAN READ DIODE ") tt.sleep(2) dev.SAI_01_MEAN.readout_priority = "monitored" # read detector -s2 = scans.line_scan(dev.MA1_ScanX, 0, 0.002, steps=11, exp_time=0.3, relative=False, delay=2) +s2 = scans.line_scan(dev.MA1_ScanX, 0, 0.002, steps=11, exp_time=0.01, relative=False, delay=2) dev.MA1_ScanX.enabled = False diff --git a/phoenix_bec/local_scripts/TEST_scanning/monitor.sh b/phoenix_bec/local_scripts/TEST_scanning/monitor.sh new file mode 100644 index 0000000..bb3c486 --- /dev/null +++ b/phoenix_bec/local_scripts/TEST_scanning/monitor.sh @@ -0,0 +1,2 @@ +camonitor X07MB-ES-MA1:ScanX.VAL X07MB-ES-MA1:ScanX.RBV X07MB-OP2:START-CSMPL X07MB-OP2:SMPL X07MB-OP2:INTR-COUNT X07MB-XMAP:StartAll X07MB-XMAP:EraseStart X07MB-XMAP:StopAll +W \ No newline at end of file diff --git a/phoenix_bec/scripts/phoenix.py b/phoenix_bec/scripts/phoenix.py index 888779e..d6def14 100644 --- a/phoenix_bec/scripts/phoenix.py +++ b/phoenix_bec/scripts/phoenix.py @@ -205,6 +205,25 @@ class PhoenixBL(Utilities, PhoenixHelp): # print(self.path_phoenix_bec) # os.system("cat " + self.path_phoenix_bec + "phoenix_bec/scripts/Current_setup.txt") + def run_shell(self, commands): + + cmd = 'gnome-terminal --geometry 100X30 -- bash -c "' + print(cmd) + if type(commands) == list: + for i in commands: + cmd = cmd + i + " ; " + # endfor + else: + cmd = cmd + commands + " ; " + # endelse + cmd = cmd + ' exec bash " ' + print(cmd) + + os.system(cmd) + # os.system( + # 'gnome-terminal --geometry 100X30 -- bash -c "source /data/test/x07mb-test-bec/production/bec_venv/bin/activate ; bec-server attach ; exec bash"' + # ) + @classmethod def my_log(cls, x): """ diff --git a/pyproject.toml b/pyproject.toml index 32fe503..234d2ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ classifiers = [ "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering", ] -dependencies = [] +dependencies = ["pandas"] [project.optional-dependencies] dev = [ @@ -24,7 +24,6 @@ dev = [ "pytest-random-order", "ophyd_devices", "bec_server", - "pandas", ] [project.entry-points."bec"]