Files
SwissMX/Readme.md

216 lines
7.6 KiB
Markdown

SwissMX
=======
SwissMX is a python application to operate the SwissMX system at cristallina:<br/>
![alt text](SwissMX.jpg "Title")
Repositories and dependencies (update:23.09.24)
-----------------------------------------------
|repo |`https://git.psi.ch/`|`~/Documents/prj/SwissFEL/`|description|
|:- |:- |:- |:- |
|SwissMX |[grp-sf_cristallina/SwissMX.git](https://git.psi.ch/grp-sf_cristallina/SwissMX) |apps/SwissMX |Main python user interface fro SwissMX|
|PBSwissMX|[grp-sf_cristallina/PBSwissMX.git](https://git.psi.ch/grp-sf_cristallina/PBSwissMX) |apps/PBSwissMX |PowerBrick documents and tool to generate trajectories and motion programs for SwissMX|
|PBTools |[epics_support_apps/PBTools.git](https://git.psi.ch/epics_support_apps/PBTools) |PBTools |packages needed by PBSwissMX for low level communication to PowerBrick|
|ppmac |[epics_support_apps/ppmac.git](https://git.psi.ch/epics_support_apps/ppmac) |PBTools/ppmac |packages needed by PBTools for lowest level communication to PowerBrick|
|SW_MX |[epics_ioc_modules/SW_MX.git](https://git.psi.ch/epics_ioc_modules/SW_MX) |epics_ioc_modules/SW_MX |IOC modules and `generate.py` for all SwissMX motors|
```mermaid
flowchart BT
PBSwissMX --> SwissMX
PBTools --> PBSwissMX
ppmac --> PBTools
SW_MX-->PBSwissMX
```
<!--
```mermaid
%% info
%%``` -->
#### installation location
|repo | installed at
|:- |:-
|SwissMX | /sf/cristallina/applications/SwissMX/
|PBSwissMX| /sf/cristallina/applications/SwissMX/PBSwissMX/
|PBTools | /sf/cristallina/applications/SwissMX/PBTools/
|ppmac | /sf/cristallina/applications/SwissMX/PBTools/ppmac/
|SW_MX | /ioc/modules/SW_MX/ and ioc directories
#### related documentation
- additional module `slic` is needed, which is provided by Sven and covers the JungFrau acquisition framefork
- For **motion/frame synchronization** read: [grp-sf_cristallina/PBSwissMX.git:Readme.md](https://git.psi.ch/grp-sf_cristallina/PBSwissMX/-/blob/master/Readme.md)
- For old but still usefull information read the [Log.md](Log.md) file
- [SFELPHOTON-1337](https://jira.psi.ch/browse/SFELPHOTON-1337): ticket about restructuing repositories
---
deployment and tests (update: 31.10.24)
---------------------------------------
#### push local stuff to git
```
zamofing_t@ganymede:
cd ~/Documents/prj/SwissFEL/apps/SwissMX &&\
git commit-amend &&\
git push psigithub -f
cd ~/Documents/prj/SwissFEL/apps/PBSwissMX &&\
git commit-amend &&\
git push psigithub -f
```
#### switch to latest test environment
```
ssh saresc-cons-03
cd /sf/cristallina/applications/SwissMX &&\
git checkout master &&\
git stash push &&\
git fetch psigithub master &&\
git reset psigithub/master --hard &&\
git stash pop
#git pull psigithub --ff-only master
cd /sf/cristallina/applications/SwissMX/PBSwissMX &&\
git checkout master &&\
git stash push &&\
git fetch psigithub master &&\
git reset psigithub/master --hard &&\
git stash pop
#git pull psigithub --ff-only master
chmod -R g+w /sf/cristallina/applications/SwissMX
```
#### run application
```
*** with official python ***
additionally needed packages:
RH7:
[saresc-vcons-01 ~]$ /opt/gfa/python-3.8/latest/bin/pip install --user qtawesome
RH8:
[saresc-cons-03 ~]$ pip install --user qtawesome
swissmx
*** with conda environment ***
ssh gac-cristall@saresc-cons-03 (pw:ValToira_2021)
cd /sf/cristallina/applications/SwissMX/
# conda env list
conda activate crmx38
python swissmx.py --sim 0xc0
```
Document to start SwissMX in cristallina environment (maintained by John):
https://docs.google.com/document/d/1yEmV_DbRBKQKVCoovjXriNgSjNEBaz50WA0l3yA5jtg/edit#heading=h.z9io692b8tow
## code generation parameters
```
copied from: PBSwissMX/python/shapepath.py: ShapePath.setup_motion
generates program <prgId> and saves to fnPrg
the type of generated program is defined by <mode>$
-> the list af all points that will be moved at, is in 'mot_pts'
(m)= mandatory
(o)= optional
common kwargs:
scale : (o) scaling velocity (default=1. value=0 would stop at each point
cnt : (o) move path multiple times (default=1)
dwell : (o) dwell time at end (default=100ms)
mode:0 unused
mode:1 pvt motion point list
common kwargs plus:
points : (m) point list
trf : (o) transformation that will be done on 'points', mot_pts=trf*points
mode:2 unused
mode:3 pvt motion point list using inverse fft velocity
common kwargs plus:
points : (m) point list
trf : (o) transformation that will be done on 'points', mot_pts=trf*points
numPad : (o) number of padding points to reduce aliasing (default=16)
mode:4 pvt motion short code using grid parameters
common kwargs plus:
trf : (o) transformation that will be done on 'grid points'
grid: (m) grid parameters: {orig:(0,0),pitch(10,10),cnt:(10,10),mode:0}
mode:5 pvt motion 'stop and go' short code using grid parameters.
Instead of continous motion it moves and waits as given in the parameters
common kwargs plus:
trf : (o) transformation that will be done on 'grid points'
grid: (m) grid parameters: {orig:(0,0),pitch(10,10),cnt:(10,10),mode:0}
tmove: (m) time to move in ms (move start on FEL-trigger
twait: (m) time to wait in ms
(tmove+twait will be rounded to a multiple of fel_per)
mode:6 pvt motion 'hit and return using grid parameters. continous motion on 2n ells to pump then same 2n wells to probe, then go 2 rows down
common kwargs plus:
trf : (o) transformation that will be done on 'grid points'
grid : (m) grid parameters: {orig:(0,0),pitch(10,10),cnt:(10,10),mode:0}
ssz : (m) section size (in wells)
smv : (o) time(in num of shots) to move to next section (horiz/vert)
default is (ssz[0]-1,ssz[1])
sdelay: (o) shots count of delay. Default is ssz[0]*ssz[1]
Examples:
mode:1
mode:3
mode:4
mode:5,tmove:20,twait:30
mode:6,ssz:(4,3)
```
## graphical object parameters
```
FixTarget:
90*40+480*2=4560
60*30+360*2=2520
2520-240=2280
4560-240=4320
size in mm, dscr.size in user units (um)
"size:(6,3.5),
dscr: {
size:(4560,2520),
fiducial:{type:0,pos:((240,240),(4320,240),(240,2280),(4320,2280))},
grid:{pos:(480,360),pitch:(90,60),count:(40,30)}
}"
grid:
size, fiducialSize in mm:
(60-1)*.120 -> 7.08mm
(45-1)*.120 -> 5.28mm
fiducialSize -> 0.1mm
"size:(7.08,5.28),cnt:(60,45),fiducialSize:.01"
SwissMX():
"ofs:[.2,.2],width:10,fidScl:.02,fiducial:[[.1,.1],[.1,2.7],[10.3,.1],[10.3, 2.7]]"
SwissFEL():
"ofs:[.2,.2],width:10,fidScl:.02,fiducial:[[.1,.1],[.1,2.2],[10.3,.1],[10.3,2.2]]"
```
## fully parameter examples:
```
"mode:4,size:(7.08,5.28), cnt:(60,45), fiducialSize:.01" -> add a grid
"mode:6,ssz:(4,3), size:(7.08,5.28), cnt:(60,45), fiducialSize:.01" -> add a grid
"mode:6,ssz:(4,3), size:(3,1.5), cnt:(30,15), fiducialSize:.01" -> add a grid
"mode:6,ssz:(6,8),
dscr: {
size:(4560,2520),
fiducial:{type:0,pos:((240,240),(4320,240),(240,2280),(4320,2280))},
grid:{pos:(480,360),pitch:(90,60),count:(40,30)}
}" -> add a FixTarget
```
## testing hit and return:
```
-> add a FixTarget
"mode:6,ssz:(6,8),
dscr: {
size:(4560,2520),
fiducial:{type:0,pos:((240,240),(4320,240),(240,2280),(4320,2280))},
grid:{pos:(480,360),pitch:(90,60),count:(40,30)}
}" -> add a FixTarget
```