diff --git a/ImageD11/nbGui/S3DXRD/run_astra_recon.py b/ImageD11/nbGui/S3DXRD/run_astra_recon.py index ec97bcaf..45437fdf 100755 --- a/ImageD11/nbGui/S3DXRD/run_astra_recon.py +++ b/ImageD11/nbGui/S3DXRD/run_astra_recon.py @@ -18,15 +18,11 @@ def main(h5name, dsfile): # horrible workaround to include id11 code path import sys - id11_code_path = sys.argv[1] - - sys.path.insert(0, id11_code_path) - from ImageD11.sinograms.sinogram import read_h5, write_h5 import ImageD11.sinograms.dataset import numpy as np - h5name = sys.argv[2] - dsfile = sys.argv[3] + h5name = sys.argv[1] + dsfile = sys.argv[2] main(h5name, dsfile) diff --git a/ImageD11/nbGui/S3DXRD/run_mlem_recon.py b/ImageD11/nbGui/S3DXRD/run_mlem_recon.py index eaa33b82..0bf96355 100755 --- a/ImageD11/nbGui/S3DXRD/run_mlem_recon.py +++ b/ImageD11/nbGui/S3DXRD/run_mlem_recon.py @@ -28,11 +28,7 @@ def main(h5name, ginc, dsfile, dest, nthreads): if __name__ == "__main__": # horrible workaround to include id11 code path - import sys - - id11_code_path = sys.argv[1] - - sys.path.insert(0, id11_code_path) + import sys import numpy as np import h5py @@ -41,10 +37,10 @@ def main(h5name, ginc, dsfile, dest, nthreads): from ImageD11.sinograms.sinogram import GrainSinogram import ImageD11.grain - h5name = sys.argv[2] - ginc = int(sys.argv[3]) - dsfile = sys.argv[4] - dest = sys.argv[5] - nthreads = int(sys.argv[6]) + h5name = sys.argv[1] + ginc = int(sys.argv[2]) + dsfile = sys.argv[3] + dest = sys.argv[4] + nthreads = int(sys.argv[5]) main(h5name, ginc, dsfile, dest, nthreads) diff --git a/ImageD11/nbGui/S3DXRD/run_pbp_recon.py b/ImageD11/nbGui/S3DXRD/run_pbp_recon.py index c1e308d7..db38bc21 100755 --- a/ImageD11/nbGui/S3DXRD/run_pbp_recon.py +++ b/ImageD11/nbGui/S3DXRD/run_pbp_recon.py @@ -1,29 +1,24 @@ if __name__ == "__main__": - # horrible workaround to include id11 code path - import sys - - id11_code_path = sys.argv[1] - - sys.path.insert(0, id11_code_path) + import sys import ImageD11.sinograms.point_by_point import ImageD11.sinograms.dataset from ImageD11 import cImageD11 import ast - dsfile = sys.argv[2] - hkltol = float(sys.argv[3]) - fpks = float(sys.argv[4]) - dstol = float(sys.argv[5]) - etacut = float(sys.argv[6]) - ifrac = float(sys.argv[7]) - costol = float(sys.argv[8]) - y0 = float(sys.argv[9]) - symmetry = sys.argv[10] - foridx = [int(x) for x in ast.literal_eval(sys.argv[11])] - forgen = [int(x) for x in ast.literal_eval(sys.argv[12])] - uniqcut = float(sys.argv[13]) - minpkint = int(sys.argv[14]) + dsfile = sys.argv[1] + hkltol = float(sys.argv[2]) + fpks = float(sys.argv[3]) + dstol = float(sys.argv[4]) + etacut = float(sys.argv[5]) + ifrac = float(sys.argv[6]) + costol = float(sys.argv[7]) + y0 = float(sys.argv[8]) + symmetry = sys.argv[9] + foridx = [int(x) for x in ast.literal_eval(sys.argv[10])] + forgen = [int(x) for x in ast.literal_eval(sys.argv[11])] + uniqcut = float(sys.argv[12]) + minpkint = int(sys.argv[13]) print('Loading dset') ds = ImageD11.sinograms.dataset.load(dsfile) @@ -52,4 +47,4 @@ pbp_object.setpeaks(cf_2d) print('Go for pbp') - pbp_object.point_by_point(ds.pbpfile, loglevel=3) \ No newline at end of file + pbp_object.point_by_point(ds.pbpfile, loglevel=3) diff --git a/ImageD11/nbGui/nb_utils.py b/ImageD11/nbGui/nb_utils.py index 29af372c..b75cc21d 100644 --- a/ImageD11/nbGui/nb_utils.py +++ b/ImageD11/nbGui/nb_utils.py @@ -151,8 +151,8 @@ def prepare_mlem_bash(ds, grains, id11_code_path, n_simultaneous_jobs=50, cores_ #SBATCH --cpus-per-task={cores_per_task} # date -echo python3 {python_script_path} {id11_code_path} {grainsfile} $SLURM_ARRAY_TASK_ID {dsfile} {reconfile} {cores_per_task} > {log_path} 2>&1 -python3 {python_script_path} {id11_code_path} {grainsfile} $SLURM_ARRAY_TASK_ID {dsfile} {reconfile} {cores_per_task} > {log_path} 2>&1 +echo PYTHONPATH={id11_code_path} python3 {python_script_path} {grainsfile} $SLURM_ARRAY_TASK_ID {dsfile} {reconfile} {cores_per_task} > {log_path} 2>&1 +PYTHONPATH={id11_code_path} python3 {python_script_path} {grainsfile} $SLURM_ARRAY_TASK_ID {dsfile} {reconfile} {cores_per_task} > {log_path} 2>&1 date """.format(outfile_path=outfile_path, errfile_path=errfile_path, @@ -198,8 +198,8 @@ def prepare_astra_bash(ds, grainsfile, id11_code_path): # date module load cuda -echo python3 {python_script_path} {id11_code_path} {grainsfile} {dsfile} > {log_path} 2>&1 -python3 {python_script_path} {id11_code_path} {grainsfile} {dsfile} > {log_path} 2>&1 +echo PYTHONPATH={id11_code_path} python3 {python_script_path} {grainsfile} {dsfile} > {log_path} 2>&1 +PYTHONPATH={id11_code_path} python3 {python_script_path} {grainsfile} {dsfile} > {log_path} 2>&1 date """.format(outfile_path=outfile_path, errfile_path=errfile_path, @@ -243,8 +243,8 @@ def prepare_pbp_bash(pbp_object, id11_code_path, minpkint): # date source /cvmfs/hpc.esrf.fr/software/packages/linux/x86_64/jupyter-slurm/latest/envs/jupyter-slurm/bin/activate -echo python3 {python_script_path} {id11_code_path} {dsfile} {hkltol} {fpks} {dstol} {etacut} {ifrac} {costol} {y0} {symmetry} {foridx} {forgen} {uniqcut} {minpkint} > {log_path} 2>&1 -OMP_NUM_THREADS=1 python3 {python_script_path} {id11_code_path} {dsfile} {hkltol} {fpks} {dstol} {etacut} {ifrac} {costol} {y0} {symmetry} {foridx} {forgen} {uniqcut} {minpkint} > {log_path} 2>&1 +echo OMP_NUM_THREADS=1 PYTHONPATH={id11_code_path} python3 {python_script_path} {dsfile} {hkltol} {fpks} {dstol} {etacut} {ifrac} {costol} {y0} {symmetry} {foridx} {forgen} {uniqcut} {minpkint} > {log_path} 2>&1 +OMP_NUM_THREADS=1 PYTHONPATH={id11_code_path} python3 {python_script_path} {dsfile} {hkltol} {fpks} {dstol} {etacut} {ifrac} {costol} {y0} {symmetry} {foridx} {forgen} {uniqcut} {minpkint} > {log_path} 2>&1 date """.format(outfile_path=outfile_path, errfile_path=errfile_path,