diff --git a/CheatSheets_Examples/RSXS_data_description.md b/CheatSheets_Examples/RSXS_data_description.md new file mode 100644 index 0000000000000000000000000000000000000000..28760e8fae4af496711be08edfce5d6f543aa359 --- /dev/null +++ b/CheatSheets_Examples/RSXS_data_description.md @@ -0,0 +1,69 @@ +# Description ascii files: + + +## Extra PVs:
+ +Snapshop of the beamline at the end of the scan: +- Extra PV 1-18: scan and beamline info (mono energy, ID value, polarization ect) +- Extra PV 19-97: ignore +- Extra PV 98 : mirror position (centroid) +- Extra PV 103-126: detector gain +- Extra PV 127: dwell time +- Extra PV 130: detector selected +- Extra PV 131: slit size +- Extra PV 133-142: sample position +- Extra PV 144-145: temperature +- Extra PV 146: light (on or off) +- Extra PV 146-153: UB info (only if using hkl) + +
+
+ +## Column Descriptions:
+Each column corresponds to a positioner or detector as described in the column description.
+WARNING: column number can shift from one scan to the next if using more than 1 positioner (eg th2th scan, hkl scan or scanXAS_BL) + + + + 1 [ Index ] + 2 [1-D Positioner 1] 29idKappa:m9.VAL, tth, LINEAR, degrees, 29idKappa:m9.RBV, tth, degrees + 3 [1-D Detector 1] S:SRcurrentAI.VAL, SR Current, mA. => storage ring current + 4 [1-D Detector 2] EPS:29:ID:SS1:POSITION, SS1 Position Text, => shutter + 5 [1-D Detector 3] 29idmono:ENERGY_MON, Calculated Photon Energy, eV => mono energy readback + 6 [1-D Detector 4] ID29:EnergySet.VAL, Set ID energy, keV => ID set point (in keV) + 7 [1-D Detector 5] ID29:Energy.VAL, ID energy readback, keV => ID readback (in keV) + 8 [1-D Detector 6] 29idb:ca1:read, , => ignore + 9 [1-D Detector 7] 29idb:ca2:read, , => ignore + 10 [1-D Detector 8] 29idb:ca3:read, , => ignore + 11 [1-D Detector 9] 29idb:ca4:read, , => ignore + 12 [1-D Detector 10] 29idb:ca5:read, , => ignore + 13 [1-D Detector 11] 29idb:ca10:read, , => ignore + 14 [1-D Detector 12] 29idb:ca12:read, , => ignore + 15 [1-D Detector 13] 29idb:ca13:read, , => ignore + 16 [1-D Detector 23] 29idd:LS331:TC1:SampleA, Convt str fror SplA query, => T sample (K) + 17 [1-D Detector 24] 29idd:LS331:TC1:SampleB, Convrt str from SplB query, => T cold finger (K) + 18 [1-D Detector 25] 29id_ps6:Stats1:CentroidX_RBV, , => centroid position (mirror) + 19 [1-D Detector 26] 29id_ps6:Stats1:SigmaX_RBV, ,=> ignore + 20 [1-D Detector 27] 29id_ps6:Stats1:CentroidTotal_RBV, ,=> ignore + 21 [1-D Detector 30] 29iddMPA:det1:TotalRate_RBV, ,=> ignore + 22 [1-D Detector 31] 29idMZ0:scaler1.S14, ,=> mesh (incident intensity I0) + 23 [1-D Detector 32] 29idMZ0:scaler1.S2, ,=> TEY + 24 [1-D Detector 33] 29idMZ0:scaler1.S3, ,=> D3 + 25 [1-D Detector 34] 29idMZ0:scaler1.S4, ,=> D4 + 26 [1-D Detector 35] 29idMZ0:scaler1.S5, ,=> MCP + 27 [1-D Detector 36] 29idMZ0:scaler1_calc1.B, ,=> TEY/I0 + 28 [1-D Detector 37] 29idMZ0:scaler1_calc1.C, ,=> D3/I0 + 29 [1-D Detector 38] 29idMZ0:scaler1_calc1.D, ,=> D4/I0 + 30 [1-D Detector 39] 29idMZ0:scaler1_calc1.E, ,=> MCP/I0 + 31 [1-D Detector 41] 29iddMPA:Stats1:Total_RBV, ,=> MCP ROI1 + 32 [1-D Detector 42] 29iddMPA:Stats2:Total_RBV, ,=> MCP ROI2 + 33 [1-D Detector 43] 29iddMPA:Stats3:Total_RBV, ,=> MCP ROI3 + 34 [1-D Detector 44] 29iddMPA:Stats4:Total_RBV, ,=> MCP ROI4 + 35 [1-D Detector 45] 29iddMPA:Stats5:Total_RBV, ,=> ignore + 36 [1-D Detector 51] 29idKappa:m8.RBV, kth, degrees => kth motor readback + 37 [1-D Detector 52] 29idKappa:m7.RBV, kap, degrees => kap motor readback + 38 [1-D Detector 53] 29idKappa:m1.RBV, kphi, degrees => kphi motor readback + 39 [1-D Detector 54] 29idKappa:m9.RBV, tth, degrees => tth motor readback + 40 [1-D Detector 55] 29idKappa:Euler_ThetaRBV, th, => th motor readback + 41 [1-D Detector 56] 29idKappa:Euler_ChiRBV, chi, => chi motor readback + 42 [1-D Detector 57] 29idKappa:Euler_PhiRBV, phi, => phi motor readback \ No newline at end of file diff --git a/README b/README deleted file mode 100644 index 483efc6bab8cbe27ba65fd5a5eb9f76f24869e2e..0000000000000000000000000000000000000000 --- a/README +++ /dev/null @@ -1,357 +0,0 @@ -#!/bin/I-AM-A-README_DO_NOT_EXECUTE - -# test - -# CONTENT: -#========= -# -# - slackbot -# - convert tabs/space -# - file/dir permissions -# - snapshot -# - git -# - add/remove extra PVs in scanrecord -# - retreive IOC auto-save -# - modify the IPython startup -# - M4R hexapods -# - setup SRS baseline -# - screen sessions -# -# -# -# -# -# Slackbot: -#========= - -# to start in a screen session: -# $ screen -dmS SLACKBOT slack29id.sh -# $ screen -list # to check if running -# $ screen -r # to attach -# $ screen -d # to dettach -# delete: attach then exit or ctrl C - -# to start slackbot by hand (not in screen session): -# -# $ source /APSshare/miniconda/x86_64/etc/profile.d/conda.sh -# $ conda activate slackenv -# $ ~/.conda/envs/slackenv/bin/slack2bm -# or use slack29id alias -# -# -# To convert tabs to space or space to tabs: -# ========================================= -# -# IMPORTANT: does need a new destination file.py > file_new.py NOT file.py > file.py (deletes all the content!!!) -# -# cp ScanFunctions_IEX.py ScanFunctions_IEXbackup.py -# sed -e 's/ /\t/g' ScanFunctions_IEXbackup.py > ScanFunctions_IEX.py # spaces to tabs (s/ /\t => insert 4 spaces between //) -# sed $'s/\t/ /g' ScanFunctions_IEXbackup.py ScanFunctions_IEX.py # tabs to space (t/ /g => insert 4 spaces between //) -# -# -# -# -# -# -# Tp change file/dir permissions: -#================================ -# -# Other useful commands: -# -# -----a----- = all -# -u- -g- -o- = user/grp/other -# rwx rwx rwx -# 421 421 421 = (2^2)(2^1)(2^0) -# -# chmod 664 = -rw-rw-r-- = (4+2+0)(4+2+0)(4+0+0) -# chmod 775 = -rwxrwxr-x = (4+2+0)(4+2+0)(4+0+1) => for directories -# chmod 777 = -rwxrwxrwx = (4+2+1)(4+2+1)(4+0+1) -# -# chmod a-x myfilename # to remove executable to all -# chmod g+w myfilename # to add write permission to group -# chmod g+s mydirectoryname # all subdirectories have the same permissions as the parent (drwxrwsr-x) -# -# chgrp # to change current user group (by default it is the primary group) -# -# -# pushd mypath -# pushd -# popd -# dirs -# -# kdiff3 file1 file2 -# -# -# -# Snapshot: -#========== -# -#- navigate to th folder where the file is -#- cd .snapshot -#- ls -l -#- pick your folder -#- cp thefile ../../thefile_backup -# -# -# -# -# To use the version control (git): => see detailed help below -#================================ -# -## to ignore a file: -#--------------------- -# add it to .gitignore file (in gedit or whatever text editor) -# -# -## to commit all files: -#--------------------- -# -# export VISUAL=nano -# -# git commit -a -# -# type all my comments -# ctrl+O to save -# press Enter -# ctrl+X to quit - -## to commit ONE file: -#--------------------- -# export VISUAL=nano -# -# git add myfiletocommit.py -# git commit myfiletocommit.py -# -# type all my comments -# ctrl+O to save -# press Enter -# ctrl+X to quit - -## to see the difference: -#----------------------- -#git diff ScanFunctions_plot.py -#git difftool -t tkdiff ScanFunctions_plot.py - -## to push on GitLab: -#--------------------- -# git push -# -# -## to see the files under version control: -#---------------------------------------- -# git ls-files - -## to bring back changes from home computer (Fanny's iMac) to sleepy: -#------------------------------------------------------------------- -# -# On iMac: -# commit all changes (git commit -a) -# git fetch => make sure local computer is up to date with branch master history -# git push -# -# On sleepy: -# git stash => store local changes aside (changes that have not been committed yet) -# git fetch => sync local computer with branch master history -# git status => Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded: GOOD, no conflict -# git rebase origin/master => update files to sync with the branch master -# git status => you're now up to date with branch master -# git stash apply => restore local changes -# -# -# Add/remove extra PVs in scanrecord: -#=================================== -# -#[junebug ~] su 29id -#[junebug ~] ioc 29idKappa -#[junebug /net/s29dserv/xorApps/epics/synApps_5_8/ioc/29idKappa] cd iocBoot/ioc29idKappa -#[junebug /net/s29dserv/xorApps/epics/synApps_5_8/ioc/29idKappa/iocBoot/ioc29idKappa] gedit saveData.req -# -# To make sure it is the right version of SynApps, for to IOC status webpage: -# -#Environment Variables -# -# ARCH = linux-x86_64 -# TOP = /net/s29dserv/xorApps/epics/synApps_5_8/ioc/29idKappa -# EPICS_BASE = /APSshare/epics/base-3.14.12.5 -# SUPPORT = /APSshare/epics/synApps_5_8/support -# ENGINEER = Arms -# LOCATION = 29ID-D -# GROUP = XSD-MM -# -# -# Retreive IOC auto-save: -#======================== -# -#Same as above, find IOC location form the IOC webpage, then ls -lt: -# -#-rwxrwxrwx 1 dohnarms s29admin 230517 Jun 18 13:53 auto_settings.savB -#-rwxrwxrwx 1 dohnarms s29admin 230517 Jun 18 13:53 auto_settings.sav -#[...] -#-rw-rw-r-- 1 29id s29admin 230588 Jun 10 09:33 auto_settings.sav_210610-093348 -#-rw-rw-r-- 1 29id s29admin 284 Jun 10 09:33 auto_positions.sav_210610-093348 -#-rw-rw-r-- 1 29id s29admin 230600 Jun 10 09:26 auto_settings.sav_210610-092619 -#-rw-rw-r-- 1 29id s29admin 284 Jun 10 09:26 auto_positions.sav_210610-092619 -#-rw-rw-r-- 1 29id s29admin 230587 Jun 10 09:10 auto_settings.sav_210610-091028 -# -# you can look at old setting in gedit or copy it and rename it as auto_settings.sav with the IOC off; settings will be replaced by the autsaved values at reboot -#[junebug /net/s29dserv/xorApps/epics/synApps_5_8/ioc/29idKappa/iocBoot/ioc29idKappa/autosave] gedit auto_settings_210610-093348.sav -# -# -# To modify the IPython startup: -#============================== -# -# ipython locale profile => -# -# (29id) cd /home/beams22/29ID/.ipython/profile_default/startup/ -# (29iduser) cd /home/beams22/29IDUSER/.ipython/profile_default/startup/ -# -# or: -# ipython locale profile slackbot -# -# (29iduser) cd /home/beams22/29IDUSER/.ipython/profile_slackbot/startup/ -# -# .py and .ipy files in this directory will be run *prior* to any code or files specified -# via the exec_lines or exec_files configurables whenever you load this profile. -# -# Files will be run in lexicographical order, so you can control the execution order of files -# with a prefix, e.g.: -# -# 00-first.py -# 50-middle.py -# 99-last.ipy -# -# -# 99-StartDir => indicates the path for the macros Folder for each user id -# -# Create soft link to common ScanFunctions scripts: -# -# ln -s /home/beams/29IDUSER/Documents/User_Macros/Macros_29id/ScanFunctions_IEX.py 91-ScanFunctions_IEX.py -# -# -# -# -# To use M4R hexapods: (most commands are aliased) - 2/12/2021 -#===================== -# -# IMPORTANT: backup/restore => s29hxp1 BUT gui = hxp2 (for scattering) -# -# You must be on Sleepy: -# -#[sleepy~] su 29id -#[sleepy~] 29idHXP status -#[sleepy~] 29idHXP start -# -#[sleepy~] hxpPositionRestore -# => gives basic instructions -# -#[sleepy~] cd /net/s29dserv/xorApps/epics/synApps_5_7/ioc/29idHXP/iocBoot/ioc29idHXP/hxp_backups -#[sleepy~] ls -lt -#-rw-rw-r-- 1 29id s29admin 655 Nov 11 17:34 s29hxp1_20201111-173407.xml -#-rw-rw-r-- 1 29id s29admin 666 Sep 25 13:15 s29hxp3_20200925-131531.xml -#-rw-rw-r-- 1 29id s29admin 658 Dec 12 2019 s29hxp1_20191212-201925.xml -#-rw-rw-r-- 1 29iduser s29admin 659 Nov 15 2019 s29hxp1_20191115-181411.xml -#... -#[sleepy~] hxpPositionRestore -# -# Move hexapod: v = Pitch , u = Roll , z = lateral -# -#[sleepy~] hxpPositionBackup s29hxp1 -# -# DONE -# -# HXP website: http://s29hxp1.xray.aps.anl.gov/ -# administrator / administrator -# -# -# -# -# To setup SRS baseline: (to be added to github) -#====================== -# -# With shutter close or slit at 0 (faster), 'INPUT OFFSET' set 'ON' and 'UNCAL' -#- make sure the counts go down (not up) when closing the shutter! If the count goes up without beam, change the INVERT ON/OFF - as of 2021_2 all of our SRSs are INVERT ON (D3/D4/TEY/mesh) -#- Set gain relatively high for the offset (same as sensitivity or more) -#- play with the tweak button one way or the other to get a stable number (ie does not slowly goes down to zero); you might need to play with the +/- for that -#- try decreasing the offset gain: if it drops to zero, then go back to previous gain and increase the number; try again. -#- The goal is to slowly bring the gain down while keeping a non zero signal; -#- adjust until the final INPUT OFFSET gain should be at least 1 order of magnitude lower than the SENSITIVITY with a few hundreds counts -# -# -# -# -# Screen session: -#=============== -# -# Starting Linux Screen: screen # rename with Ctrl+a A -# Starting Named Session: screen -S session_name -# -# Below are some most common commands for managing Linux Screen Windows: -# -# Ctrl+a c Create a new window (with shell). -# Ctrl+a " List all windows. -# Ctrl+a 0 Switch to window 0 (by number). -# Ctrl+a A Rename the current window. -# Ctrl+a S Split current region horizontally into two regions. -# Ctrl+a | Split current region vertically into two regions. -# Ctrl+a tab Switch the input focus to the next region. -# Ctrl+a Ctrl+a Toggle between the current and previous windows -# Ctrl+a Q Close all regions but the current one. -# Ctrl+a X Close the current region. -# -# Detach from Linux Screen Session: Ctrl+a d -# -# Reattach to a Linux Screen: screen -r -# In case you have multiple screen sessions running on your machine, you will need to append the screen session ID after the r switch. -# -# -# - - -# -# -# python environment: -#==================== -# -#[dragonfly /home/beams22/29IDUSER]: -# source /APSshare/miniconda/x86_64/bin/activate # => (base) -[dragonfly /home/beams22/29IDUSER] -# date; conda env create --force -n 29id -f /home/beams22/29IDUSER/Documents/User_Macros/Macros_29id/environment_29id.yml; date -# conda activate 29id # # => (29id) [dragonfly /home/beams22/29IDUSER] -# jupyter-lab --no-browser -# -# (29id) [dragonfly /home/beams22/29IDUSER] which jupyter => /home/beams/29IDUSER/.conda/envs/29id/bin/jupyter -# -# (29id) [dragonfly /home/beams22/29IDUSER] conda env list => conda environments: -# -# base /APSshare/miniconda/x86_64 -# 29id * /home/beams/29IDUSER/.conda/envs/29id -# apres /home/beams/29IDUSER/.conda/envs/apres -# bluesky_2020_1 /home/beams/29IDUSER/.conda/envs/bluesky_2020_1 -# bluesky_2021_2 /home/beams/29IDUSER/.conda/envs/bluesky_2021_2 -# hkl /home/beams/29IDUSER/.conda/envs/hkl -# slackenv /home/beams/29IDUSER/.conda/envs/slackenv -# test /home/beams/29IDUSER/.conda/envs/test -# -# -# (29id) [dragonfly /home/beams22/29IDUSER] conda list -# packages in environment at /home/beams/29IDUSER/.conda/envs/29id: -# -# Name Version Build Channel -# _libgcc_mutex 0.1 conda_forge conda-forge -# _openmp_mutex 4.5 1_gnu conda-forge -# aioredis 1.3.1 pypi_0 pypi -# alabaster 0.7.12 pyhd3eb1b0_0 -# ansi2html 1.5.2 py38h06a4308_0 -# anyio 2.2.0 py38h06a4308_1 -# appdirs 1.4.4 py_0 -# aps-dm-api 3.2.2 py38_1 aps-anl-tag -# apstools 1.5.0 py_0 aps-anl-tag -# .... -# -# Install new package in a given environment: -# (29id) [dragonfly /home/beams22/29IDUSER] conda install netcdf4 # can be found on https://anaconda.org/conda-forge -# -# -# -# % matplotlib inline => in jupyter, not interactive -# % matplotlib => in separate window, interactive diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5b4c3a977d0b7e7a05279ffba5648e950d9f2588 --- /dev/null +++ b/README.md @@ -0,0 +1,459 @@ +#!/bin/I-AM-A-README_DO_NOT_EXECUTE + + +# Table of content: + +- screen sessions +- slackbot +- convert tabs/space +- file/dir permissions +- snapshot +- add/remove extra PVs in scanrecord +- retreive IOC auto-save +- M4R hexapods +- setup SRS baseline +- modify the IPython startup +- version control (git) +
+
+ + + +# Screen sessions: + +Screen session commands: + + $ screen -dmS + # start a named screen session as daemon ie in detached mode. + $ screen -S # to start a named screen session + $ screen -list # to check current sessions + $ screen -r # to attach + $ screen -d or ctrl+a, d # to detach + $ screen -XS kill # to kill a remote session + $ screen -XS quit # to kill a remote session + $ attach then exit or ctrl C # to kill a remote session + + Below are some most common commands for managing Linux Screen Windows: + + Ctrl+a c Create a new window (with shell). + Ctrl+a " List all windows. + Ctrl+a 0 Switch to window 0 (by number). + Ctrl+a A Rename the current window. + Ctrl+a S Split current region horizontally into two regions. + Ctrl+a | Split current region vertically into two regions. + Ctrl+a tab Switch the input focus to the next region. + Ctrl+a Q Close all regions but the current one. + Ctrl+a X Close the current region. + Ctrl+a Ctrl+a Toggle between the current and previous windows +
+
+ +# Slackbot: + +To start in a screen session: + + $ screen -dmS SLACKBOT slack29id.sh + +To start slackbot by hand (not in screen session): + + $ source /APSshare/miniconda/x86_64/etc/profile.d/conda.sh + $ conda activate slackenv + $ ~/.conda/envs/slackenv/bin/slack2bm + +or use slack29id alias + + + + +
+
+ +# Convert tabs to space or space to tabs + +IMPORTANT: does need a new destination file.py > file_new.py NOT file.py > file.py (deletes all the content!!!) + + $ cp ScanFunctions_IEX.py ScanFunctions_IEXbackup.py + $ sed -e 's/ /\t/g' ScanFunctions_IEXbackup.py > ScanFunctions_IEX.py + # spaces to tabs (s/ /\t => insert 4 spaces between //) + $ sed $'s/\t/ /g' ScanFunctions_IEXbackup.py ScanFunctions_IEX.py + # tabs to space (t/ /g => insert 4 spaces between //) + + +
+
+ +# Change file/dir permissions: +Other useful commands: + + -----a----- = all + -u- -g- -o- = user/grp/other + rwx rwx rwx + 421 421 421 = (2^2)(2^1)(2^0) + + chmod 664 = -rw-rw-r-- = (4+2+0)(4+2+0)(4+0+0) => for files + chmod 775 = -rwxrwxr-x = (4+2+0)(4+2+0)(4+0+1) => for directories + chmod 777 = -rwxrwxrwx = (4+2+1)(4+2+1)(4+0+1) + + chmod a-x myfilename # to remove executable to all + chmod g+w myfilename # to add write permission to group + chmod g+s mydirectoryname # all subdir have same permissions as + # parent (drwxrwsr-x) + + chgrp # change current user group (by default primary group) + +Other useful commands: + + + $ pushd mypath + $ pushd + $ popd + $ dirs + $ kdiff3 file1 file2 + +
+
+ +# Snapshot backup: + +Navigate to the folder where the file is: + + $ cd .snapshot + $ ls -l + # pick your folder + $ cp thefile ../../thefile_backup + + +
+
+ + + +# Add/remove extra PVs in scanrecord: + $ [junebug ~] su 29id + $ [junebug ~] ioc 29idKappa + $ [junebug /net/.../synApps_5_8/ioc/29idKappa] cd iocBoot/ioc29idKappa + $ [junebug /net/.../iocBoot/ioc29idKappa] gedit saveData.req + +To make sure it is the right version of SynApps, for to [IOC live webpage](https://bcda.xray.aps.anl.gov/cgi-bin/ioc_alive.cgi?net=118) +


+ +# Environment Variables + + $ ARCH = linux-x86_64 + $ TOP = /net/s29dserv/xorApps/epics/synApps_5_8/ioc/29idKappa + $ EPICS_BASE = /APSshare/epics/base-3.14.12.5 + $ SUPPORT = /APSshare/epics/synApps_5_8/support + $ ENGINEER = Arms + $ LOCATION = 29ID-D + $ GROUP = XSD-MM +

+ +# Retrieve IOC auto-save: + +Same as above, find IOC location form the IOC webpage, then ls -lt: + + $ -rwxrwxrwx 1 dohnarms s29admin 230517 Jun 18 13:53 auto_settings.savB + $ -rwxrwxrwx 1 dohnarms s29admin 230517 Jun 18 13:53 auto_settings.sav + $ [...] + $ -rw-rw-r-- 1 29id s29admin 230588 Jun 10 09:33 auto_settings.sav_210610-093348 + $ -rw-rw-r-- 1 29id s29admin 284 Jun 10 09:33 auto_positions.sav_210610-093348 + $ -rw-rw-r-- 1 29id s29admin 230600 Jun 10 09:26 auto_settings.sav_210610-092619 + $ -rw-rw-r-- 1 29id s29admin 284 Jun 10 09:26 auto_positions.sav_210610-092619 + $ -rw-rw-r-- 1 29id s29admin 230587 Jun 10 09:10 auto_settings.sav_210610-091028 + + you can look at old setting in gedit or copy it and rename it as auto_settings.sav with the IOC off; settings will be replaced by the autsaved values at reboot + + $ [junebug /net/s29dserv/xorApps/.../ioc29idKappa/autosave] gedit auto_settings_210610-093348.sav + +
+
+ +# Modify iPython startup: + +The startup is tied to a specific ipython local profile; for general use of 29id macros: + + (29id) cd /home/beams22/29ID/.ipython/profile_default/startup/ + (29iduser) cd /home/beams22/29IDUSER/.ipython/profile_default/startup/ + +ipython local profile for slackbot: + + (29iduser) cd /home/beams22/29IDUSER/.ipython/profile_slackbot/startup/ + +The .py and .ipy files in this directory will be run *prior* to any code or files specified via the exec_lines or exec_files configurables whenever you load this profile. + +Files will be run in lexicographical order, so you can control the execution order of files with a prefix, e.g.: + + 00-first.py + 50-middle.py + 98-last.ipy + 99-StartDir # indicates the path for the macros Folder for each user id + + Create soft link to common ScanFunctions scripts: + + ln -s /home/beams/29IDUSER/Documents/User_Macros/Macros_29id/ScanFunctions_IEX.py 91-ScanFunctions_IEX.py +
+
+ + +# To use M4R hexapods: + + +IMPORTANT: using hxp1 controler to move hxp2 (hxp2 controler is fried, and hxp1 is clamped): +- backup/restore => s29hxp1 +- gui = hxp2 (for scattering)
+ +[HXP website](http://s29hxp1.xray.aps.anl.gov/): administrator / administrator + +Most commands are aliased. You must be on Sleepy(?): + + + $ [sleepy~] su 29id + $ [sleepy~] 29idHXP status + $ [sleepy~] 29idHXP start + $ [sleepy~] hxpPositionRestore # gives basic instructions + $[sleepy~] cd /net/s29dserv/xorApps/epics/synApps_5_7/ioc/29idHXP/iocBoot/ioc29idHXP/hxp_backups + $ [sleepy~] ls -lt + $ -rw-rw-r-- 1 29id s29admin 655 Nov 11 17:34 s29hxp1_20201111-173407.xml + $ -rw-rw-r-- 1 29id s29admin 666 Sep 25 13:15 s29hxp3_20200925-131531.xml + $ -rw-rw-r-- 1 29id s29admin 658 Dec 12 2019 s29hxp1_20191212-201925.xml + $ -rw-rw-r-- 1 29iduser s29admin 659 Nov 15 2019 s29hxp1_20191115-181411.xml + #... + $ [sleepy~] hxpPositionRestore + +Move hexapods; +- v = Pitch +- u = Roll +- z = lateral + +When done aligning, backup: + + $ [sleepy~] hxpPositionBackup s29hxp1 +
+
+ + +# To setup SRS baseline: + +With shutter close or slit at 0 (faster), 'INPUT OFFSET' set 'ON' and 'UNCAL' +- make sure the counts go down (not up) when closing the shutter! If the count goes up without beam, change the INVERT ON/OFF - as of 2021_2 all of our SRSs are INVERT ON (D3/D4/TEY/mesh) +- Set gain relatively high for the offset (same as sensitivity or more) +- play with the tweak button one way or the other to get a stable number (ie does not slowly goes down to zero); you might need to play with the +/- for that +- try decreasing the offset gain: if it drops to zero, then go back to previous gain and increase the number; try again. +- The goal is to slowly bring the gain down while keeping a non zero signal; +- adjust until the final INPUT OFFSET gain should be at least 1 order of magnitude lower than the SENSITIVITY with a few hundreds counts +
+
+ + +# python environment: + + + $ source /APSshare/miniconda/x86_64/bin/activate # activate (base) + $ (base) date; conda env create --force -n 29id -f /home/beams22/29IDUSER/Documents/User_Macros/Macros_29id/environment_29id.yml; date + # install 29id environment + $ (base) conda activate 29id # activate (29id) + $ (29id) jupyter-lab --no-browser + $ (29id) which jupyter + /home/beams/29IDUSER/.conda/envs/29id/bin/jupyter + + $ conda env list # conda environments: + + base /APSshare/miniconda/x86_64 + 29id * /home/beams/29IDUSER/.conda/envs/29id + apres /home/beams/29IDUSER/.conda/envs/apres + bluesky_2020_1 /home/beams/29IDUSER/.conda/envs/bluesky_2020_1 + bluesky_2021_2 /home/beams/29IDUSER/.conda/envs/bluesky_2021_2 + hkl /home/beams/29IDUSER/.conda/envs/hkl + slackenv /home/beams/29IDUSER/.conda/envs/slackenv + test /home/beams/29IDUSER/.conda/envs/test + + (29id) conda list + packages in environment at /home/beams/29IDUSER/.conda/envs/29id: + Name Version Build Channel + _libgcc_mutex 0.1 conda_forge conda-forge + _openmp_mutex 4.5 1_gnu conda-forge + aioredis 1.3.1 pypi_0 pypi + alabaster 0.7.12 pyhd3eb1b0_0 + ansi2html 1.5.2 py38h06a4308_0 + anyio 2.2.0 py38h06a4308_1 + appdirs 1.4.4 py_0 + aps-dm-api 3.2.2 py38_1 aps-anl-tag + apstools 1.5.0 py_0 aps-anl-tag + .... + + + Install new package in a given environment (can be found on [conda forge](https://anaconda.org/conda-forge)) + + (29id) conda install netcdf4 + +Interactive plot: + + % matplotlib inline => in jupyter, not interactive + % matplotlib => in separate window, interactive + + + +# Version control: + +To ignore a file: + + add it to .gitignore file (in gedit or whatever text editor) + + +To commit ALL tracked files (option -a) + + $ git commit -am 'commit message goes here' # single line message + $ git commit -am 'Message # multi lines message + $ + $ goes + $ here' + +To commit ONE file: + + $ git add myfiletocommit.py # stage file for commit + $ git commit myfiletocommit.py # commit file + +To see the difference: + + $ git diff ScanFunctions_plot.py + $ difftool -t tkdiff ScanFunctions_plot.py + +To push to remote repository (GitLab): + + $ git push + +To see the tracked files (files under version control): + + $ git ls-files +
+ +# Git workflow (branching): + +1. Update your local repository to be in sync with the remote 'origin/master': + +
+ + $ git checkout master + $ git fetch   # make sure local computer is up to date with master + $ git status   + # Your branch is behind 'origin/master' by X commit, and can be + # fast-forward => GOOD, no conflict    + $ git rebase origin/master # update files to sync with branch master +Rebase is the same as "git pull", but cleaner commmit tree: no merge message - since no new feature has been added yet (just synchronizing repository) +
+
+ +2. Create a new branch: + +
+ + $ git checkout -b newbranch # create a new branch, switch to it + # makes changes, commit regularly ("atomic" commits) + $ git push # push branch to remote repository +The changes are still in a separate branch; you will need to create pull request on GitLab to merge new features (newbranch) into master. +
 
                 + +3. Going back to working (user) repository (29iduser@nerdy):
+ +Once the pull request has been accepted and the new feature merged into master, you need to update the user repository: + + + + $ git stash # store local changes aside + # (changes that have not been committed yet) + $ git fetch # sync local computer with origin/master + $ git status + # Your branch is behind 'origin/master' by X commit, and can be + # fast-forward => GOOD, no conflict    + $ git pull # update files to sync with branch master + # with merge commit message + $ git status # you're now up to date with branch master + $ git stash apply # re-apply stashed changes + +
  +4. Undoing changes:
  + +- delete branch: + + $ git branch -d garbagebranch + +- git amend + + # git commit --amend # let you modify the last commit and commit message + +- git revert: + + $ git revert 01768ee --no-edit # undo a commit with message in history + + * 02a7ec9 - (HEAD -> master) Revert "debug circular import" (6 seconds ago) + * 01768ee - (origin/master) debug circular import (2 hours ago) + * 8a34366 - update README.md (3 days ago) + +- git reset: + + $ git reset --soft 01768ee # undo a commit, erase message in history + # leave changes + $ git reset --hard 01768ee # undo a commit, erase message in history + # remove changes !!!! + +WARNING: +- git revert is the best tool for undoing shared public changes +- git reset is best used for undoing local private changes + +Make sure you know what you are doing; in case of doubt, create backup branch + + +
  +5. What if I forgot to fetch/rebase before commiting new changes in user repository (29iduser@nerdy)? +
  +
+ + $ git commit -am 'some changes' + $ git push + # ! [rejected] master -> master (non-fast-forward) + # error: failed to push + $ git status + # Your branch and 'origin/master' have diverged ... + $ git lg + * 0b1d902 - (HEAD -> master) add feature X + * dd2b5fc - weekly commit 03/21/2022 + $ git checkout -b backup-tmp # create backup just in case + $ git lg + * 0b1d902 - (HEAD -> backup-tmp master) add feature X + * dd2b5fc - weekly commit 03/21/202 + $ git checkout master # switch back to master + * Switched to branch 'master' + * Your branch and 'origin/master' have diverged ... + $ git reset --soft HEAD~1 # undo last commit and leave changes from it uncommited + # back to commit [-1] + # HEAD~5 back 5 commits + $ git lg + * dd2b5fc - (HEAD -> master) weekly commit 03/21/2022 + $ git status + # On branch master + # Your branch is behind 'origin/master' by X commit, and can be fast forward + # Changes to be commited: + # modified: some files + # modified: some files + $ git stash + # saved working directory... + $ git status + # On branch master + # Your branch is behind 'origin/master' by X commit, and can be fast forward + # Nothing to commit, working tree clean + $ git rebase origin/master + # On branch master + # your branch is up to date with 'origin/master' + $ git stash apply + # Auto-merging somefile + # On branch master + # your branch is up to date with 'origin/master' + # Changes not staged for commit: + # modified: some files + # modified: some files + + If git complains about conflicts, call Kevin. + If not, you are now ready to (re)commit the changes. + +
+
\ No newline at end of file diff --git a/ScanFunctions_IEX.py b/ScanFunctions_IEX.py index 4a55876282b0ad882ef0c7140ae924d6dc24017a..c500704e90c7c17cac64d9c4a8b75cae3374dae9 100755 --- a/ScanFunctions_IEX.py +++ b/ScanFunctions_IEX.py @@ -4767,6 +4767,10 @@ def StartOfTheWeek(GRT,branch,wait=False,**kwargs): print(scan+" is not a valid scan scanType=['slit1','wire','flux','monoVslit']") return + def beamsteering(x,y): + D={} + return + ### checking diode settings: if branch == 'c':