spinsight 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
spinsight/__init__.py ADDED
File without changes
spinsight/constants.py ADDED
@@ -0,0 +1,2 @@
1
+ # 1H gyromagnetic ratio [MHz/T]
2
+ GYRO = 42.577
spinsight/deploy.py ADDED
@@ -0,0 +1,37 @@
1
+ # Deploy app on network
2
+
3
+ import socket
4
+ import panel as pn
5
+ import optparse
6
+ from pathlib import Path
7
+ import sys
8
+ sys.path.append(str(Path(__file__).parent.parent))
9
+ from spinsight import main
10
+
11
+
12
+ def CLI():
13
+ # parse command line
14
+ p = optparse.OptionParser()
15
+ p.add_option('--port', '-p', default=80, type="int",
16
+ help="Port to deploy SpinSight")
17
+ p.add_option('--network', '-n', action='store_true',
18
+ help="Deploy on local network")
19
+ p.add_option('--url', '-u', default='', type="string",
20
+ help="URL identifying server")
21
+ options, arguments = p.parse_args()
22
+
23
+ hosts = []
24
+ if options.network: # get IP number
25
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
26
+ s.connect(('8.8.8.8', 80))
27
+ hosts = [s.getsockname()[0]] # IP number
28
+ if options.url:
29
+ hosts.append(options.url)
30
+
31
+ if len(hosts)>0:
32
+ print('Deploying SpinSight at:')
33
+ for host in hosts:
34
+ print('* http://{}:{}'.format(host, options.port))
35
+
36
+ # serve application
37
+ pn.serve(main.getApp, show=False, title='SpinSight', port=options.port, websocket_origin=['{}:{}'.format(host, options.port) for host in hosts])
@@ -0,0 +1,6 @@
1
+ if (cb_data.index.indices.length > 0) {
2
+ hoverIndex.data = {"index": [cb_data.index.indices[0]], "board": [board]};
3
+ }
4
+ else {
5
+ hoverIndex.data = {"index": [], "board": []};
6
+ }