diff --git a/doc/BOZ analysis part I.a Correction determination.ipynb b/doc/BOZ analysis part I.a Correction determination.ipynb index ae50811741325895f8d86564f63a559e8c1d4273..56c558cbd51a269ecd98a9d04d001caa5439470c 100644 --- a/doc/BOZ analysis part I.a Correction determination.ipynb +++ b/doc/BOZ analysis part I.a Correction determination.ipynb @@ -39,6 +39,16 @@ "import os" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import sys\n", + "print(sys.executable)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -65,21 +75,6 @@ "rois_th = 4" ] }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], - "source": [ - "proposal = int(proposal)\n", - "darkrun = int(darkrun)\n", - "run = int(run)\n", - "module = int(module)\n", - "gain = int(gain)\n", - "sat_level = int(sat_level)\n", - "rois_th = int(rois_th)" - ] - }, { "cell_type": "code", "execution_count": 3, @@ -1536,7 +1531,7 @@ "metadata": { "celltoolbar": "Tags", "kernelspec": { - "display_name": "xfel", + "display_name": "xfel (Python 3.7)", "language": "python", "name": "xfel" }, diff --git a/doc/Dask DSSC module binning.ipynb b/doc/Dask DSSC module binning.ipynb index 4a75edb22b2bcfe6942a109bbd07f8a96eb707f9..c7f20a0457ec8c58e4006fbb0d92c1cff4ec5649 100644 --- a/doc/Dask DSSC module binning.ipynb +++ b/doc/Dask DSSC module binning.ipynb @@ -26,6 +26,16 @@ "import xarray as xr" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import sys\n", + "print(sys.executable)" + ] + }, { "cell_type": "code", "execution_count": 2, @@ -116,12 +126,6 @@ "metadata": {}, "outputs": [], "source": [ - "proposalNB = int(proposalNB)\n", - "dark_runNB = int(dark_runNB)\n", - "runNB = int(runNB)\n", - "module_group = int(module_group)\n", - "bin_width = float(bin_width)\n", - "\n", "moduleNB = list(range(module_group*4, (module_group+1)*4))" ] }, @@ -229,7 +233,7 @@ "metadata": { "celltoolbar": "Tags", "kernelspec": { - "display_name": "xfel", + "display_name": "xfel (Python 3.7)", "language": "python", "name": "xfel" }, diff --git a/doc/changelog.rst b/doc/changelog.rst index f47a502d6371714072a0f05542ac06340a63b235..ee15b95d23f0bfd464d2a3fc6f40c3af3757251b 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -9,12 +9,14 @@ unreleased - fix :issue:`45` SLURM scripts embedded in and download link available from documentation :mr:`171` - fix :issue:`8` regarding azimuthal integration with pyFAI and hexagonal DSSC pixel splitting by providing an example notebook :mr:`174` - fix :issue:`46` with a change in dask groupby mean behavior :mr:`174` + - fix :issue:`47` SLURM script not using the correct kernel :mr:`176` - **Improvements** - update version of BAM mnemonics :mr:`175` - update version GATT-related mnemonics, add `transmission_col2` :mr:`172` - reorganize the Howto section :mr:`169` + - improve SLURM scripts with named arguments :mr:`176` - **New Features** diff --git a/doc/howtos.rst b/doc/howtos.rst index e157a9d0205e2f61b5c9d325bd538abd3f58ab0e..5ce280acfa51e2fa0e230cf5f3a9aa0006a61753 100644 --- a/doc/howtos.rst +++ b/doc/howtos.rst @@ -52,13 +52,14 @@ It is launched with the following: .. code:: bash - sbatch ./bin_dssc_module_job.sh 180 179 0 - sbatch ./bin_dssc_module_job.sh 180 179 1 - sbatch ./bin_dssc_module_job.sh 180 179 2 - sbatch ./bin_dssc_module_job.sh 180 179 3 + sbatch ./bin_dssc_module_job.sh -p 2719 -d 180 -r 179 -m 0 -x delay -b 0.1 + sbatch ./bin_dssc_module_job.sh -p 2719 -d 180 -r 179 -m 1 -x delay -b 0.1 + sbatch ./bin_dssc_module_job.sh -p 2719 -d 180 -r 179 -m 2 -x delay -b 0.1 + sbatch ./bin_dssc_module_job.sh -p 2719 -d 180 -r 179 -m 3 -x delay -b 0.1 -where 180 is the dark run number, 179 is the run nummber and 0, 1, 2 and 3 are -the 4 module group, each job processing a set of 4 DSSC module. +where 2719 is the proposal number, 180 is the dark run number, 179 is the run +nummber and 0, 1, 2 and 3 are the 4 module group, each job processing a set of +4 DSSC module, delay is the bin axis and 0.1 is the bin width. The result will be 16 \*.h5 files, one per module, saved in the folder specified in the script, a copy of which can be found in the *scripts* folder in the @@ -121,9 +122,10 @@ reads as: It uses the first notebook and is launched via slurm: -``sbatch ./boz_parameters_job.sh 615 614 3`` +``sbatch ./boz_parameters_job.sh -p 2937 -d 615 -r 614 -g 3`` -where 615 is the dark run number, 614 is the run on 3 broken membranes and 3 is +where 2937 is the proposal run number, where 615 is the dark run number, +614 is the run on 3 broken membranes and 3 is the DSSC gain in photon per bin. The proposal run number is defined inside the script file. diff --git a/doc/scripts/bin_dssc_module_job.sh b/doc/scripts/bin_dssc_module_job.sh index 247cfe67d304cae6a02eb4f0f7f74eff5c4e566f..c5d321a9c3d52409d1716adb5d6c94d174645e63 100644 --- a/doc/scripts/bin_dssc_module_job.sh +++ b/doc/scripts/bin_dssc_module_job.sh @@ -5,21 +5,49 @@ #SBATCH --mail-type=END,FAIL #SBATCH --output=logs/%j-%x.out -PROPOSAL=2719 -DARK=$1 -RUN=$2 -MODULE_GROUP=$3 +while getopts ":p:d:r:k:m:x:b:" option +do + case $option in + p) PROPOSAL="$OPTARG";; + d) DARK="$OPTARG";; + r) RUN="$OPTARG";; + k) KERNEL="$OPTARG";; + m) MODULE_GROUP="$OPTARG";; + x) XAXIS="$OPTARG";; + b) BINWIDTH="$OPTARG";; + \?) echo "Unknown option" + exit 1;; + :) echo "Missing option for input flag" + exit 1;; + esac +done +# Load xfel environment source /etc/profile.d/modules.sh module load exfel module load exfel_anaconda3/1.1 echo processing run $RUN -OUTPATH=/gpfs/exfel/exp/SCS/202002/p002719/scratch/tests -mkdir $OUTPATH/r$RUN +PDIR=$(find-proposal $PROPOSAL) +PPROPOSAL="p$(printf '%06d' $PROPOSAL)" +RDIR="$PDIR/usr/processed_runs/r$(printf '%04d' $RUN)" +mkdir $RDIR -# Run papermill -python3 -c "import papermill as pm; pm.execute_notebook('Dask DSSC module binning.ipynb', \ -'$OUTPATH/r$RUN/output$MODULE_GROUP.ipynb', \ -parameters=dict(proposalNB='$PROPOSAL', dark_runNB='$DARK', runNB='$RUN', module_group='$MODULE_GROUP', \ -path='$OUTPATH/r$RUN/', kernel='xfel'))" +NB='Dask DSSC module binning.ipynb' + +# kernel list can be seen from 'jupyter kernelspec list' +if [ -z "${KERNEL}" ]; then + KERNEL="toolbox_$PPROPOSAL" +fi + +python -c "import papermill as pm; pm.execute_notebook(\ + '$NB', \ + '$RDIR/output$MODULE_GROUP.ipynb', \ + kernel_name='$KERNEL', \ + parameters=dict(proposalNB=int('$PROPOSAL'), \ + dark_runNB=int('$DARK'), \ + runNB=int('$RUN'), \ + module_group=int('$MODULE_GROUP'), \ + path='$RDIR', \ + xaxis='$XAXIS', \ + bin_width=float('$BINWIDTH')))" diff --git a/doc/scripts/boz_parameters_job.sh b/doc/scripts/boz_parameters_job.sh index f8c199a10f4883798c5e415c8195a5110123b64f..ef7fd34a26e4efc87037523a089f30fe3294919c 100644 --- a/doc/scripts/boz_parameters_job.sh +++ b/doc/scripts/boz_parameters_job.sh @@ -5,14 +5,29 @@ #SBATCH --mail-type=END,FAIL #SBATCH --output=logs/%j-%x.out -PROPOSAL=2784 -DARK=$1 -RUN=$2 -GAIN=$3 -ROISTH=${4:-1} -SATLEVEL=${5:-500} -MODULE=15 +ROISTH='1' +SATLEVEL='500' +MODULE='15' +while getopts ":p:d:r:k:g:t:s:m:" option +do + case $option in + p) PROPOSAL="$OPTARG";; + d) DARK="$OPTARG";; + r) RUN="$OPTARG";; + k) KERNEL="$OPTARG";; + g) GAIN="$OPTARG";; + t) ROISTH="$OPTARG";; + s) SATLEVEL="$OPTARG";; + m) MODULE="$OPTARG";; + \?) echo "Unknown option" + exit 1;; + :) echo "Missing option for input flag" + exit 1;; + esac +done + +# Load xfel environment source /etc/profile.d/modules.sh module load exfel module load exfel_anaconda3/1.1 @@ -24,20 +39,20 @@ RDIR="$PDIR/usr/processed_runs/r$(printf '%04d' $RUN)" mkdir $RDIR NB='BOZ analysis part I.a Correction determination.ipynb' -KERNEL="SCS Toolbox ($PPROPOSAL)" -#activate the proposal environment -ACTIVATE="$PDIR/usr/Software/envs/toolbox_$PPROPOSAL/bin/activate" -source $ACITVATE +# kernel list can be seen from 'jupyter kernelspec list' +if [ -z "${KERNEL}" ]; then + KERNEL="toolbox_$PPROPOSAL" +fi python -c "import papermill as pm; pm.execute_notebook(\ '$NB', \ - '$RDIR/output.ipynb', \ - parameters=dict(proposal='$PROPOSAL', \ - darkrun='$DARK', \ - run='$RUN', \ - module='$MODULE', \ - gain='$GAIN', \ - rois_th='$ROISTH', \ - sat_level='$SATLEVEL', \ - kernel='$KERNEL'))" + '$RDIR/output.ipynb', \ + kernel_name='$KERNEL', \ + parameters=dict(proposal=int('$PROPOSAL'), \ + darkrun=int('$DARK'), \ + run=int('$RUN'), \ + module=int('$MODULE'), \ + gain=float('$GAIN'), \ + rois_th=float('$ROISTH'), \ + sat_level=int('$SATLEVEL')))"