{ "cells": [ { "cell_type": "code", "execution_count": 128, "id": "waiting-chance", "metadata": {}, "outputs": [], "source": [ "import time\n", "import numpy" ] }, { "cell_type": "code", "execution_count": 146, "id": "moving-alexandria", "metadata": {}, "outputs": [], "source": [ "d=DeviceProxy(\"LTS/ini_device/1\")" ] }, { "cell_type": "code", "execution_count": 198, "id": "ranking-aluminum", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Device is now in on state\n" ] } ], "source": [ "state = str(d.state())\n", "\n", "if state == \"OFF\":\n", " d.initialise()\n", " time.sleep(1)\n", "state = str(d.state())\n", "if state == \"STANDBY\":\n", " d.on()\n", "state = str(d.state())\n", "if state == \"ON\":\n", " print(\"Device is now in on state\")\n" ] }, { "cell_type": "code", "execution_count": 199, "id": "beneficial-evidence", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "double_scalar_RW [0.]\n", "double_scalar_R [1.2]\n", "bool_scalar_RW [False]\n", "bool_scalar_R [ True]\n", "int_scalar_RW [0]\n", "int_scalar_R [5]\n", "str_scalar_RW ('',)\n", "str_scalar_R ('this is',)\n", "double_spectrum_RW [0. 0. 0. 0.]\n", "double_spectrum_R [1.2 2.3 3.4 4.5]\n", "bool_spectrum_RW [False False False False]\n", "bool_spectrum_R [ True True False False]\n", "int_spectrum_RW [0 0 0 0]\n", "int_spectrum_R [1 2 3 4]\n", "str_spectrum_RW ('', '', '', '')\n", "str_spectrum_R ('\"a\"', ' \"b\"', ' \"c\"', ' \"d\"')\n", "double_image_RW [[0. 0. 0.]\n", " [0. 0. 0.]]\n", "double_image_R [[1.2 2.3 3.4]\n", " [4.5 5.6 6.7]]\n", "bool_image_RW [[False False False]\n", " [False False False]]\n", "bool_image_R [[ True True False]\n", " [False True False]]\n", "int_image_RW [[0 0 0]\n", " [0 0 0]]\n", "int_image_R [[1 2 3]\n", " [4 5 6]]\n", "str_image_RW (('', '', ''), ('', '', ''))\n", "str_image_R (('\"a\"', ' \"b\"', ' \"c\"'), (' \"d\"', ' \"e\"', ' \"f\"'))\n", "State <function __get_command_func.<locals>.f at 0x7f3efee95c80>\n", "Status <function __get_command_func.<locals>.f at 0x7f3efee95c80>\n" ] } ], "source": [ "attr_names = d.get_attribute_list()\n", "\n", "for i in attr_names:\n", " try:\n", " exec(\"print(i, d.{})\".format(i))\n", " except:\n", " pass\n" ] }, { "cell_type": "code", "execution_count": 93, "id": "sharing-mechanics", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([0])" ] }, "execution_count": 93, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d.int_scalar_RW" ] }, { "cell_type": "code", "execution_count": 203, "id": "2f03759a", "metadata": {}, "outputs": [], "source": [ "d.str_image_RW = [[\"1\", \"2\", \"3\"],[\"4\", \"5\", \"6\"]]" ] }, { "cell_type": "code", "execution_count": 204, "id": "3187f3bb", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(('1', '2', '3'), ('4', '5', '6'))" ] }, "execution_count": 204, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d.str_image_RW" ] }, { "cell_type": "code", "execution_count": 192, "id": "eb406dce", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\"['a', 'b', 'c', 'd', 'e', 'f']\"" ] }, "execution_count": 192, "metadata": {}, "output_type": "execute_result" } ], "source": [ "numpy.str_([\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"])" ] }, { "cell_type": "code", "execution_count": 197, "id": "7b270085", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "6" ] }, "execution_count": 197, "metadata": {}, "output_type": "execute_result" } ], "source": [ "array = []\n", "string = '\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"'\n", "\n", "for i in string.split(\",\"):\n", " value = numpy.str_(i)\n", " array.append(value)\n", "\n", "len(array)" ] }, { "cell_type": "code", "execution_count": null, "id": "69ecc437", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "StationControl", "language": "python", "name": "stationcontrol" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.3" } }, "nbformat": 4, "nbformat_minor": 5 }