-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPy16Notes.txt
More file actions
78 lines (65 loc) · 3.84 KB
/
Py16Notes.txt
File metadata and controls
78 lines (65 loc) · 3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Py16 programs for data viewing and analysis of I16 data
By Dan Porter, 2016, Version 3.7
These programs workin work in any python environment, as long as you have numpy, scipy, pil, and matplotlib installed and matplotlib initialised in the tkinter backend. The software has been extensivley tested in Python 2.7+ but will not currently work in python 3+ environments.
#### INSTALLATION ####
1. On an I16 Workstation as I16user:
The Software is already installed and ready for use, there is a shortcut on the desktop "I16 Data Viewer"
2. On a Diamond workstation or via the NX server
The Software is already available, see below.
3. Remotley run the Software using Cygwin (or linux):
- Install Cygwin: https://cygwin.com/install.html
- https://x.cygwin.com/docs/ug/using-remote-apps.html
- In the Cygwin terminal, first prepare the display for X11 forwarding. Type: export DISPLAY=:0.0
- Start an ssh session. Type: ssh -X FED_ID@nx-user.diamond.ac.uk (replace FED_ID with your FedID, if Diamond Staff, use nx-staff.diamond.ac.uk)
- Say "Yes" to any messages that may come up, then enter your FED_ID password
- You are now connected to a machine local to diamond, use the commands described below
4. To run these programs elsewhere:
- You need a distribution of Python that includes numpy, matplotlib, scipy and tkinter, such as Anaconda: www.anaconda.com/download/
- You must ensure you have tkinter set as the matplotlib backend (this is usually default)
- Run the Py16GUI.py script using the command: ipython -i --matplotlib tk Py16GUI.py
#### RUNNING THE SOFTWARE ####
The software can be run in three ways:
1. Using a GUI interface through an interactive terminal
2. Using a command line interface through an interactive terminal
3. Using a python script
1. Using a GUI interface through an interactive terminal
On an I16 workstation (as I16user)
- Double click the shortcut on the desktop "I16_Data_Viewer"
- Select "Run in Console"
On another Diamond workstation, the Diamond NX server or when remotely connecting:
- Open a terminal
- Type:
>> cd /dls_sw/i16/software/python/Py16/
>> module load python/ana
>> ipython -i --matplotlib tk Py16GUI.py
On another system
- Open a terminal/ console/ command prompt
Type:
>> cd /direcotry of Py16GUI.py
>> ipython -i --matplotlib tk Py16GUI.py
- NOTE: There are included bash scripts for linux and windows that can be simply run to start the software.
2. Using a command line interface through an interactive terminal
a. Start iPython from the Py16 directory
- in Windows: Navigate to the directory containing Py16progs.py, SHIFT+Right Click and select "Open Command Window Here"
- in Linux: Open a console, cd to the location of Py16progs.py
- in Mac: Open a console, cd to the location of Py16progs.py
- type >> ipython -i --matplotlib tk
b. in the iPython console, type:
>> import Py16progs as p16
c. Define the experiment and analysis folders
>> p16.filedir = '/experiment_directory'
>> p16.savedir = '/analysis_directory'
d. Load data/ plot data as requried
>> d = p16.readscan(534299) # Loads the data from this scan number into a python dictionary d
>> x,y,dy,varx,vary,ttl,d = p16.getdata(534299) # Automatically loads x,y normalised data from scan
>> p16.plotscan(534299) # Automatically plots the data
>> help(p16) # List of functions
3. Using a python script
a. Make a copy of the included "Example_Script.py"
b. In the new script, before doing anything else, change the following lines:
- The location of Py16progs.py
- The location of the data (dp.filedir = '')
- The location of the analysis folder (dp.savedir = '')
- Make any changes to the experiment parameters requried
c. Write your analysis script
d. Run the script in your prefered way. E.G,: In a console, type >> ipython My_Script.py