{"id":313,"date":"2021-08-08T14:17:33","date_gmt":"2021-08-08T05:17:33","guid":{"rendered":"https:\/\/rfsec.ddns.net\/db\/?p=313"},"modified":"2021-08-08T16:57:53","modified_gmt":"2021-08-08T07:57:53","slug":"streamlit%e3%82%92%e8%a9%a6%e3%81%99","status":"publish","type":"post","link":"https:\/\/rfsec.ddns.net\/db\/?p=313","title":{"rendered":"streamlit\u3092\u8a66\u3059"},"content":{"rendered":"\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/streamlit.io\/\" target=\"_blank\">streamlit<\/a>\u306fpython\u30b3\u30fc\u30c9\u3060\u3051\u3067\u3001Web\u30d6\u30e9\u30a6\u30b6\u30fc\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u30a2\u30d7\u30ea\u3092\u516c\u958b\u3067\u304d\u308b\u512a\u308c\u3082\u306e\u3067\u3059\u3002\u78c1\u6c17\u30bb\u30f3\u30b5\u30fc\u306e\u30aa\u30d5\u30bb\u30c3\u30c8\u53ef\u8996\u5316\u3067\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002jupyter\u306e\u30b3\u30fc\u30c9\u3078\u591a\u5c11\u624b\u3092\u52a0\u3048\u308b\u3060\u3051\u3067OK\u3002\u30c7\u30d0\u30c3\u30b0\u306fjupyter\u3067\u52d5\u4f5c\u78ba\u8a8d\u3092\u884c\u3044\u3001\u5b8c\u6210\u3057\u305f\u3089\u5fc5\u8981\u306b\u5fdc\u3058\u3066streamlit\u5316\u3059\u308b\u306e\u304c\u826f\u3055\u305d\u3046\u3002streamlit\u306f\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u304b\u3089\u6b21\u306e\u3088\u3046\u306b\u5b9f\u884c\u3057\u3001\u8868\u793a\u3055\u308c\u305furl\u3092\u30d6\u30e9\u30a6\u30b6\u30fc\u3067\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>$ treamlit run mag-offset.py\n\n  You can now view your Streamlit app in your browser.\n\n  Network URL: http:\/\/192.168.68.122:8501\n  External URL: http:\/\/203.165.226.42:8501<\/code><\/pre><\/div>\n\n\n\n<p>\u30d6\u30e9\u30a6\u30b6\u30fc\u3067\u30a2\u30af\u30bb\u30b9\u3057\u305f\u69d8\u5b50<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"757\" height=\"666\" src=\"https:\/\/rfsec.ddns.net\/db\/wp-content\/uploads\/2021\/08\/streamlit.png\" alt=\"\" class=\"wp-image-314\" srcset=\"https:\/\/rfsec.ddns.net\/db\/wp-content\/uploads\/2021\/08\/streamlit.png 757w, https:\/\/rfsec.ddns.net\/db\/wp-content\/uploads\/2021\/08\/streamlit-300x264.png 300w, https:\/\/rfsec.ddns.net\/db\/wp-content\/uploads\/2021\/08\/streamlit-624x549.png 624w\" sizes=\"auto, (max-width: 757px) 100vw, 757px\" \/><\/figure>\n\n\n\n<p><strong>mag-offset.py<\/strong><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>import matplotlib\n\nimport os\nimport pandas as pd\nfrom mpl_toolkits.mplot3d import Axes3D\nimport matplotlib.pyplot as plt\nimport math\nimport numpy as np\n\nimport streamlit as st\nst.title(&#39;Magnetic compass offset plot&#39;)\n### \u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f\ndf = pd.read_csv(&#39;BMX055\/data4.csv&#39;)\n#print(df)\na_x=np.average(df[&#39;Mag_x&#39;])\na_y=np.average(df[&#39;Mag_y&#39;])\na_z=np.average(df[&#39;Mag_z&#39;])\n#print(round(a_x,2),round(a_y,2),round(a_z,2))\n# \u3053\u3053\u304b\u3089\u30b0\u30e9\u30d5\u63cf\u753b\n\n# \u30b0\u30e9\u30d5\u306e\u5165\u308c\u7269\u3092\u7528\u610f\u3059\u308b\u3002\nfig = plt.figure()\n#ax = Axes3D(fig)     &lt;--- warning\u3068\u306a\u308b\u306e\u3067\u3001\u6b21\u306e\u884c\u306b\u66f8\u304d\u63db\u3048\nax = fig.add_subplot(111, projection=&#39;3d&#39;)\n# \u8ef8\u306e\u30e9\u30d9\u30eb\u3092\u8a2d\u5b9a\u3059\u308b\u3002\nax.set_xlabel(&#39;x&#39;)\nax.set_ylabel(&#39;y&#39;)\nax.set_zlabel(&#39;z&#39;)\nst.table(pd.DataFrame({\n    &#39;Center X&#39;: [a_x],\n    &#39;Center Y&#39;: [a_y],\n    &#39;Center Z&#39;: [a_z]\n}))\n# \u30b0\u30e9\u30d5\u3092\u8868\u793a\u3059\u308b\u3002\nax.scatter3D(df[&#39;Mag_x&#39;],df[&#39;Mag_y&#39;],df[&#39;Mag_z&#39;],color=&quot;blue&quot;)\nax.scatter3D(a_x,a_y,a_z,color=&quot;red&quot;)\n#plt.show()       &lt;--- plt.show()\u3092 st.write(fig)\u3078\u7f6e\u304d\u63db\u3048\u308b\u3002\nst.write(fig)<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>streamlit\u306fpython\u30b3\u30fc\u30c9\u3060\u3051\u3067\u3001Web\u30d6\u30e9\u30a6\u30b6\u30fc\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u30a2\u30d7\u30ea\u3092\u516c\u958b\u3067\u304d\u308b\u512a\u308c\u3082\u306e\u3067\u3059\u3002\u78c1\u6c17\u30bb\u30f3\u30b5\u30fc\u306e\u30aa\u30d5\u30bb\u30c3\u30c8\u53ef\u8996\u5316\u3067\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002jupyter\u306e\u30b3\u30fc\u30c9\u3078\u591a\u5c11\u624b\u3092\u52a0\u3048\u308b\u3060\u3051\u3067OK\u3002\u30c7\u30d0\u30c3\u30b0\u306f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[6],"tags":[],"class_list":["post-313","post","type-post","status-publish","format-standard","hentry","category-make"],"featured_image_src":null,"author_info":{"display_name":"mars","author_link":"https:\/\/rfsec.ddns.net\/db\/?author=1"},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rfsec.ddns.net\/db\/index.php?rest_route=\/wp\/v2\/posts\/313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rfsec.ddns.net\/db\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rfsec.ddns.net\/db\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rfsec.ddns.net\/db\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rfsec.ddns.net\/db\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=313"}],"version-history":[{"count":2,"href":"https:\/\/rfsec.ddns.net\/db\/index.php?rest_route=\/wp\/v2\/posts\/313\/revisions"}],"predecessor-version":[{"id":317,"href":"https:\/\/rfsec.ddns.net\/db\/index.php?rest_route=\/wp\/v2\/posts\/313\/revisions\/317"}],"wp:attachment":[{"href":"https:\/\/rfsec.ddns.net\/db\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rfsec.ddns.net\/db\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rfsec.ddns.net\/db\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}