From 54c17f1901672656c0160d2d4ba1a91d24b436d3 Mon Sep 17 00:00:00 2001 From: Juncheng E Date: Thu, 24 Sep 2020 20:21:34 +0200 Subject: [PATCH] update SDF --- CMakeLists.txt | 2 +- .../CrystFELPhotonDiffractor/CMakeLists.txt | 5 ++- Modules/Others/sdf/CMakeLists.txt | 5 ++- README.md | 4 +- .../SimEx/Analysis/DiffractionAnalysis.py | 8 ++-- .../TNSAIonMatterInteractorTest.py | 2 +- environment.yml | 3 +- install.sh | 38 +++++++++++++++---- requirements.txt | 1 + 9 files changed, 50 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 844b6909..6d885583 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,7 @@ FIND_PACKAGE(Python set (LIBDIR lib) set (INCLUDEDIR include) set (BINDIR bin) -set (PYPATH ${LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}) +set (PYPATH ${LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages) message( "PYPATH=${PYPATH}" ) set (DOCDIR share/doc) diff --git a/Modules/Diffractors/CrystFELPhotonDiffractor/CMakeLists.txt b/Modules/Diffractors/CrystFELPhotonDiffractor/CMakeLists.txt index 79c5e311..54776b8d 100644 --- a/Modules/Diffractors/CrystFELPhotonDiffractor/CMakeLists.txt +++ b/Modules/Diffractors/CrystFELPhotonDiffractor/CMakeLists.txt @@ -18,7 +18,9 @@ MESSAGE("HDF5_VERSION= ${HDF5_VERSION}") MESSAGE("HDF5_LIBRARY_DIRS= ${HDF5_LIBRARY_DIRS}") FIND_PACKAGE (GSL REQUIRED) - +find_package(ZLIB) +include_directories(${ZLIB_INCLUDE_DIRS}) +# TARGET_LINK_LIBRARIES( ${ZLIB_LIBRARIES}) # This macro invokes the HDF5 compiler wrapper, it parses the output and # extracts the path where library are stored. # Usage: @@ -103,6 +105,7 @@ ExternalProject_Add( crystfel ) # Install needed crystfel binaries, scripts and doc material. +ExternalProject_Get_Property(crystfel BINARY_DIR) ExternalProject_Get_Property(crystfel SOURCE_DIR) ExternalProject_Get_Property(crystfel BINARY_DIR) # diff --git a/Modules/Others/sdf/CMakeLists.txt b/Modules/Others/sdf/CMakeLists.txt index ef514f1a..ea23a9a6 100644 --- a/Modules/Others/sdf/CMakeLists.txt +++ b/Modules/Others/sdf/CMakeLists.txt @@ -2,7 +2,8 @@ INCLUDE(ExternalProject) ExternalProject_Add( sdf -GIT_REPOSITORY https://github.com/PaNOSC-ViNYL/SDF.git +GIT_REPOSITORY https://cfsa-pmw.warwick.ac.uk/SDF/SDF.git +GIT_TAG 642be14ccae3bc7db53995f3fa8ea831bbbd3c6a GIT_SUBMODULES C utilities -CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} +CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PYPATH} ) \ No newline at end of file diff --git a/README.md b/README.md index 39b7f05d..23ed91e8 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ SimEx Software platform for **Sim**ulation of advanced photon **Ex**periments. -[![Build Status](https://travis-ci.org/PaNOSC-ViNYL/SimEx.svg?branch=master)](https://travis-ci.org/PaNOSC-ViNYL/SimEx) -[![Build Status](https://travis-ci.org/PaNOSC-ViNYL/SimEx.svg?branch=develop)](https://travis-ci.org/PaNOSC-ViNYL/SimEx) +[![Build Status master](https://travis-ci.org/PaNOSC-ViNYL/SimEx.svg?branch=master)](https://travis-ci.org/github/panosc-vinyl/simex/branches) +[![Build Status develop](https://travis-ci.org/PaNOSC-ViNYL/SimEx.svg?branch=develop)](https://travis-ci.org/github/panosc-vinyl/simex/branches) ## Purpose of SimEx diff --git a/Sources/python/SimEx/Analysis/DiffractionAnalysis.py b/Sources/python/SimEx/Analysis/DiffractionAnalysis.py index 9c7a2d7c..34688960 100644 --- a/Sources/python/SimEx/Analysis/DiffractionAnalysis.py +++ b/Sources/python/SimEx/Analysis/DiffractionAnalysis.py @@ -719,11 +719,13 @@ def photonStatistics(stack): print("*************************") + print ("Photon number statistics per pattern" print("avg = %6.5e" % (avg_photons)) print("std = %6.5e" % (rms_photons)) - print("avg_mean = %6.5e" % (avg_mean)) - print("avg_max = %6.5e" % (avg_max)) - print("avg_min = %6.5e" % (avg_min)) + print ("Photon number statistics per pixel" + print("avg_mean_pixel = %6.5e" % (avg_mean)) + print("avg_max_pixel = %6.5e" % (avg_max)) + print("avg_min_pixel = %6.5e" % (avg_min)) print("*************************") diff --git a/Tests/python/unittest/SimExTest/Calculators/TNSAIonMatterInteractorTest.py b/Tests/python/unittest/SimExTest/Calculators/TNSAIonMatterInteractorTest.py index 12ba9dd5..820469ea 100644 --- a/Tests/python/unittest/SimExTest/Calculators/TNSAIonMatterInteractorTest.py +++ b/Tests/python/unittest/SimExTest/Calculators/TNSAIonMatterInteractorTest.py @@ -48,7 +48,7 @@ def testConstructor(self): self.assertIsInstance(interact, AbstractIonInteractor) def testRun(self): - input_file = TestUtilities.generateTestFilePath('00101.sdf') + input_file = TestUtilities.generateTestFilePath('0010.sdf') mysource = TNSAIonMatterInteractor(parameters=self.params, input_path=input_file, output_path='Data/NeutronData.h5') diff --git a/environment.yml b/environment.yml index 8a9dbeb0..9062f039 100644 --- a/environment.yml +++ b/environment.yml @@ -21,8 +21,8 @@ name: simex channels: - - defaults - conda-forge + - ondateam dependencies: - Cython - cmake>=3.12.1 @@ -46,6 +46,7 @@ dependencies: - openpmd-api - python>=3.5 - nomkl + - cfelpyutils - pip - pip: - xraydb diff --git a/install.sh b/install.sh index beae111f..896a55b0 100755 --- a/install.sh +++ b/install.sh @@ -8,6 +8,7 @@ usage: $0 MODE MODE includes: conda-env: create conda simex virtual environment conda: install SimEx in current conda environment + conda-develop: install SimEx in current conda environment with DEVELOPER_MODE=ON maxwell develop EOF @@ -55,13 +56,31 @@ then PYLIB=${PYVERSION%.*} DEVELOPER_MODE=ON XCSIT=OFF + export ZLIB_ROOT=$CONDA_PREFIX export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH - #export PYTHONPATH=$CONDA_PREFIX/lib/$PYLIB:$CONDA_PREFIX/lib/$PYLIB/site-packages:$PYTHONPATH - #echo "PYTHONPATH="$PYTHONPATH + # THIRD_PARTY_ROOT=/gpfs/exfel/data/group/spb-sfx/spb_simulation/simex + # export PYTHONPATH=$CONDA_PREFIX/lib/$PYLIB:$CONDA_PREFIX/lib/$PYLIB/site-packages:$PYTHONPATH + # echo "PYTHONPATH="$PYTHONPATH +fi + +elif [ $MODE = "conda-develop" ] +then + echo $MODE + CONDA_BIN=`which conda` + CONDA_BIN=${CONDA_BIN%/*} + source ${CONDA_BIN%/*}/etc/profile.d/conda.sh + INSTALL_PREFIX=$CONDA_PREFIX + PYVERSION=`python -V | tr '[:upper:]' '[:lower:]' | tr -d ' '` + PYLIB=${PYVERSION%.*} + DEVELOPER_MODE=ON + XCSIT=OFF + export ZLIB_ROOT=$CONDA_PREFIX + export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH + # THIRD_PARTY_ROOT=/gpfs/exfel/data/group/spb-sfx/spb_simulation/simex + # export PYTHONPATH=$CONDA_PREFIX/lib/$PYLIB:$CONDA_PREFIX/lib/$PYLIB/site-packages:$PYTHONPATH + # echo "PYTHONPATH="$PYTHONPATH fi -XCSIT=ON -THIRD_PARTY_ROOT=/gpfs/exfel/data/group/spb-sfx/spb_simulation/simex # Check for existing build directory, remove if found if [ -d build ] @@ -109,15 +128,20 @@ cmake -DSRW_OPTIMIZED=ON \ -DBOOST_ROOT=$BOOST_ROOT \ .. # Build the project. -make -j32 +make -j32 # Install the project. make install +# Back to root dir. cd .. -# Revert -git checkout -- CMakeLists.txt +# make and make install should be exec'ed not in this script (crystfel fails to compile). +if [ $MODE = "conda" ] || [ $MODE = "conda-env " ] +then + echo "In case of error in compiling crystfel, rerun make in the build dir." +fi + if [ $MODE = "develop" ]; then echo "Please run 'source build/simex_vars.sh' before developing" fi diff --git a/requirements.txt b/requirements.txt index dbe9e4bb..fe9c11cd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,6 +11,7 @@ openpmd-api periodictable>=1.4.1 pint py3nvml +cfelpyutils pyFAI<=0.16 pyfftw scipy==1.3.1