diff --git a/.github/workflows/pypi_publish.yml b/.github/workflows/pypi_publish.yml new file mode 100644 index 00000000..458dc902 --- /dev/null +++ b/.github/workflows/pypi_publish.yml @@ -0,0 +1,160 @@ +name: PyPI Publish + +on: + release: + types: [published] + push: + pull_request: + workflow_dispatch: + +jobs: + build-n-publish: + # pull requests are a duplicate of a branch push if within the same repo. + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository + + name: ${{ matrix.host-os }} / Python ${{ matrix.python-version }} / OpenMP ${{ matrix.openmp }} + runs-on: ${{ matrix.host-os }} + strategy: + matrix: + host-os: ["ubuntu-latest", "macos-latest", "windows-latest"] + python-version: ["3.8", "3.9", "3.10", "3.11"] + openmp: ["off"] + fail-fast: false + + defaults: + run: + shell: bash -l {0} + + steps: + - uses: actions/checkout@v3 + + - name: Set OpenMP mode + if: matrix.openmp == 'on' + run: | + export MODE="omp" + echo "MODE=${MODE}" >> $GITHUB_ENV + + - name: Set MacOS Deployment Target + if: runner.os == 'macOS' + run: | + export MACOSX_DEPLOYMENT_TARGET="10.15" + echo "MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}" >> $GITHUB_ENV + + - uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: testenv + allow-softlinks: true + auto-activate-base: false + auto-update-conda: true + channel-priority: flexible + channels: conda-forge + miniconda-version: "latest" + python-version: ${{ matrix.python-version }} + show-channel-urls: true + use-only-tar-bz2: false + + - name: Set up Visual Studio shell + if: runner.os == 'Windows' + uses: egor-tensin/vs-shell@v2 + with: + arch: x64 + + - name: Install build requirements with conda + if: runner.os != 'Linux' + run: | + set -vxeuo pipefail + conda install -y cmake + + - name: Install OpenMP for macOS with conda + if: runner.os == 'macOS' && matrix.openmp == 'on' + run: | + set -vxeuo pipefail + conda install -y -c conda-forge llvm-openmp + + # NOTE: This step is not needed for fast tests. + # - name: Install mpi4py for Unix with conda + # if: runner.os != 'Windows' + # run: | + # set -vxeuo pipefail + # conda install -y -c conda-forge mpi4py openmpi + + - name: Install cibuildwheel on Linux + if: runner.os == 'Linux' + run: | + set -vxeuo pipefail + python -m pip install --upgrade pip + python -m pip install cibuildwheel + echo "CIBW_BEFORE_ALL=pip install cmake" >> $GITHUB_ENV + PYTH_VER=${{ matrix.python-version }} + PYTH_VER=${PYTH_VER//.} + echo "CIBW_BUILD="cp$PYTH_VER-manylinux*"" >> $GITHUB_ENV + + - name: Build wheel on Linux + if: runner.os == 'Linux' + run: | + set -vxeuo pipefail + python -VV + python -m cibuildwheel --output-dir dist env/python + ls -la dist/* + + - name: Build wheel on Windows/Mac + if: runner.os != 'Linux' + run: | + set -vxeuo pipefail + cd env/python + python -VV + python setup.py bdist_wheel + ls -la dist/* + mkdir -p ../../dist + cp dist/*.whl ../../dist/ + + - name: Publish wheels to GitHub artifacts + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist/* + + - name: Install the package and test requirements + run: | + set -vxeuo pipefail + pip install -v dist/*64.whl + + # Smoke import test: + python -c "import srwpy; import srwpy.srwlpy" + + # Check CLI tools: + srw-viewer --help + + python -m pip install -r env/python/requirements-dev.txt + python -m pip list + + - name: Run fast tests + run: | + set -vxeuo pipefail + cd env/python + pytest -k fast + + publish-to-pypi: + # Hints from: + # - https://github.com/pypa/gh-action-pypi-publish/discussions/28 + # - https://github.com/Lightning-AI/lightning/blob/master/.github/workflows/release-pypi.yml + if: github.event_name == 'release' + name: Publish to PyPI + needs: build-n-publish + runs-on: ubuntu-latest + permissions: + id-token: write + + steps: + - uses: actions/checkout@v3 + + - name: Download wheels from GitHub artifacts + uses: actions/download-artifact@v3 + with: + name: wheels + path: dist/ + + - name: Publish wheels to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: ./dist/ diff --git a/.gitignore b/.gitignore index 2200b57b..94c5afd0 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,8 @@ docs/build/ # Compiled libraries *.a *.so +*.pyd +.vscode/ __srwl_logs__/ uti_plot*.png diff --git a/cpp/cmake/CMakeLists.txt b/cpp/cmake/CMakeLists.txt index 05bcbda1..0e2b8d0a 100644 --- a/cpp/cmake/CMakeLists.txt +++ b/cpp/cmake/CMakeLists.txt @@ -215,7 +215,7 @@ set(srw_clients_c_source_files ../src/clients/c/srwlclient.cpp ) -add_executable(srwlclient ${srw_clients_c_source_files}) +add_library(srwlclient STATIC ${srw_clients_c_source_files}) target_link_libraries(srwlclient srw) @@ -227,10 +227,8 @@ install(TARGETS srwlclient RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) # python # for testing we will need the python interpreter -find_package(PythonInterp REQUIRED) - # we require python development headers -find_package(PythonLibs ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} EXACT REQUIRED) +find_package(Python COMPONENTS Interpreter Development.Module REQUIRED) set(srw_clients_python_source_files @@ -239,7 +237,7 @@ set(srw_clients_python_source_files add_library(srwlpy SHARED ${srw_clients_python_source_files}) -target_include_directories(srwlpy PUBLIC ${PYTHON_INCLUDE_DIRS}) +target_include_directories(srwlpy PUBLIC ${Python_INCLUDE_DIRS}) target_include_directories(srwlpy PUBLIC $) @@ -263,7 +261,7 @@ if(APPLE) endif() if(WIN32) - target_link_libraries(srwlpy srw ${PYTHON_LIBRARIES}) + target_link_libraries(srwlpy srw ${Python_LIBRARIES}) set_target_properties(srwlpy PROPERTIES SUFFIX ".pyd") endif() diff --git a/cpp/src/ext/genmath/fftw.h.old b/cpp/src/ext/genmath/fftw.h.old deleted file mode 100644 index 22ed9555..00000000 --- a/cpp/src/ext/genmath/fftw.h.old +++ /dev/null @@ -1,421 +0,0 @@ -/* -*- C -*- */ -/* - * Copyright (c) 1997-1999, 2003 Massachusetts Institute of Technology - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -/* fftw.h -- system-wide definitions */ -/* $Id: fftw.h.in,v 1.57 2003/03/16 23:43:46 stevenj Exp $ */ - -#ifndef FFTW_H -#define FFTW_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* Define for using single precision */ -/* - * If you can, use configure --enable-float instead of changing this - * flag directly - */ -/* #undef FFTW_ENABLE_FLOAT */ - -/* our real numbers */ -#ifdef FFTW_ENABLE_FLOAT -typedef float fftw_real; -#else -typedef double fftw_real; -#endif - -/********************************************* - * Complex numbers and operations - *********************************************/ -typedef struct { - fftw_real re, im; -} fftw_complex; -#define c_re(c) ((c).re) -#define c_im(c) ((c).im) - -typedef enum { - FFTW_FORWARD = -1, FFTW_BACKWARD = 1 -} fftw_direction; - -/* backward compatibility with FFTW-1.3 */ -typedef fftw_complex FFTW_COMPLEX; -typedef fftw_real FFTW_REAL; - -#ifndef FFTW_1_0_COMPATIBILITY -#define FFTW_1_0_COMPATIBILITY 0 -#endif - -#if FFTW_1_0_COMPATIBILITY -/* backward compatibility with FFTW-1.0 */ -#define REAL fftw_real -#define COMPLEX fftw_complex -#endif - -/********************************************* - * Success or failure status - *********************************************/ - -typedef enum { - FFTW_SUCCESS = 0, FFTW_FAILURE = -1 -} fftw_status; - -/********************************************* - * Codelets - *********************************************/ -typedef void (fftw_notw_codelet) - (const fftw_complex *, fftw_complex *, int, int); -typedef void (fftw_twiddle_codelet) - (fftw_complex *, const fftw_complex *, int, - int, int); -typedef void (fftw_generic_codelet) - (fftw_complex *, const fftw_complex *, int, - int, int, int); -typedef void (fftw_real2hc_codelet) - (const fftw_real *, fftw_real *, fftw_real *, - int, int, int); -typedef void (fftw_hc2real_codelet) - (const fftw_real *, const fftw_real *, - fftw_real *, int, int, int); -typedef void (fftw_hc2hc_codelet) - (fftw_real *, const fftw_complex *, - int, int, int); -typedef void (fftw_rgeneric_codelet) - (fftw_real *, const fftw_complex *, int, - int, int, int); - -/********************************************* - * Configurations - *********************************************/ -/* - * A configuration is a database of all known codelets - */ - -enum fftw_node_type { - FFTW_NOTW, FFTW_TWIDDLE, FFTW_GENERIC, FFTW_RADER, - FFTW_REAL2HC, FFTW_HC2REAL, FFTW_HC2HC, FFTW_RGENERIC -}; - -/* description of a codelet */ -typedef struct { - const char *name; /* name of the codelet */ - void (*codelet) (); /* pointer to the codelet itself */ - int size; /* size of the codelet */ - fftw_direction dir; /* direction */ - enum fftw_node_type type; /* TWIDDLE or NO_TWIDDLE */ - int signature; /* unique id */ - int ntwiddle; /* number of twiddle factors */ - const int *twiddle_order; /* - * array that determines the order - * in which the codelet expects - * the twiddle factors - */ -} fftw_codelet_desc; - -/* On Win32, you need to do funny things to access global variables - in shared libraries. Thanks to Andrew Sterian for this hack. */ -#ifdef HAVE_WIN32 -# if defined(BUILD_FFTW_DLL) -# define DL_IMPORT(type) __declspec(dllexport) type -# elif defined(USE_FFTW_DLL) -# define DL_IMPORT(type) __declspec(dllimport) type -# else -# define DL_IMPORT(type) type -# endif -#else -# define DL_IMPORT(type) type -#endif - -extern DL_IMPORT(const char *) fftw_version; - -/***************************** - * Plans - *****************************/ -/* - * A plan is a sequence of reductions to compute a FFT of - * a given size. At each step, the FFT algorithm can: - * - * 1) apply a notw codelet, or - * 2) recurse and apply a twiddle codelet, or - * 3) apply the generic codelet. - */ - -/* structure that contains twiddle factors */ -typedef struct fftw_twiddle_struct { - int n; - const fftw_codelet_desc *cdesc; - fftw_complex *twarray; - struct fftw_twiddle_struct *next; - int refcnt; -} fftw_twiddle; - -typedef struct fftw_rader_data_struct { - struct fftw_plan_struct *plan; - fftw_complex *omega; - int g, ginv; - int p, flags, refcount; - struct fftw_rader_data_struct *next; - fftw_codelet_desc *cdesc; -} fftw_rader_data; - -typedef void (fftw_rader_codelet) - (fftw_complex *, const fftw_complex *, int, - int, int, fftw_rader_data *); - -/* structure that holds all the data needed for a given step */ -typedef struct fftw_plan_node_struct { - enum fftw_node_type type; - - union { - /* nodes of type FFTW_NOTW */ - struct { - int size; - fftw_notw_codelet *codelet; - const fftw_codelet_desc *codelet_desc; - } notw; - - /* nodes of type FFTW_TWIDDLE */ - struct { - int size; - fftw_twiddle_codelet *codelet; - fftw_twiddle *tw; - struct fftw_plan_node_struct *recurse; - const fftw_codelet_desc *codelet_desc; - } twiddle; - - /* nodes of type FFTW_GENERIC */ - struct { - int size; - fftw_generic_codelet *codelet; - fftw_twiddle *tw; - struct fftw_plan_node_struct *recurse; - } generic; - - /* nodes of type FFTW_RADER */ - struct { - int size; - fftw_rader_codelet *codelet; - fftw_rader_data *rader_data; - fftw_twiddle *tw; - struct fftw_plan_node_struct *recurse; - } rader; - - /* nodes of type FFTW_REAL2HC */ - struct { - int size; - fftw_real2hc_codelet *codelet; - const fftw_codelet_desc *codelet_desc; - } real2hc; - - /* nodes of type FFTW_HC2REAL */ - struct { - int size; - fftw_hc2real_codelet *codelet; - const fftw_codelet_desc *codelet_desc; - } hc2real; - - /* nodes of type FFTW_HC2HC */ - struct { - int size; - fftw_direction dir; - fftw_hc2hc_codelet *codelet; - fftw_twiddle *tw; - struct fftw_plan_node_struct *recurse; - const fftw_codelet_desc *codelet_desc; - } hc2hc; - - /* nodes of type FFTW_RGENERIC */ - struct { - int size; - fftw_direction dir; - fftw_rgeneric_codelet *codelet; - fftw_twiddle *tw; - struct fftw_plan_node_struct *recurse; - } rgeneric; - } nodeu; - - int refcnt; -} fftw_plan_node; - -typedef enum { - FFTW_NORMAL_RECURSE = 0, - FFTW_VECTOR_RECURSE = 1 -} fftw_recurse_kind; - -struct fftw_plan_struct { - int n; - int refcnt; - fftw_direction dir; - int flags; - int wisdom_signature; - enum fftw_node_type wisdom_type; - struct fftw_plan_struct *next; - fftw_plan_node *root; - double cost; - fftw_recurse_kind recurse_kind; - int vector_size; -}; - -typedef struct fftw_plan_struct *fftw_plan; - -/* flags for the planner */ -#define FFTW_ESTIMATE (0) -#define FFTW_MEASURE (1) - -#define FFTW_OUT_OF_PLACE (0) -#define FFTW_IN_PLACE (8) -#define FFTW_USE_WISDOM (16) - -#define FFTW_THREADSAFE (128) /* guarantee plan is read-only so that the - same plan can be used in parallel by - multiple threads */ - -#define FFTWND_FORCE_BUFFERED (256) /* internal flag, forces buffering - in fftwnd transforms */ - -#define FFTW_NO_VECTOR_RECURSE (512) /* internal flag, prevents use - of vector recursion */ - -extern fftw_plan fftw_create_plan_specific(int n, fftw_direction dir, - int flags, - fftw_complex *in, int istride, - fftw_complex *out, int ostride); -#define FFTW_HAS_PLAN_SPECIFIC -extern fftw_plan fftw_create_plan(int n, fftw_direction dir, int flags); -extern void fftw_print_plan(fftw_plan plan); -extern void fftw_destroy_plan(fftw_plan plan); -extern void fftw(fftw_plan plan, int howmany, fftw_complex *in, int istride, - int idist, fftw_complex *out, int ostride, int odist); -extern void fftw_one(fftw_plan plan, fftw_complex *in, fftw_complex *out); -extern void fftw_die(const char *s); -extern void *fftw_malloc(size_t n); -extern void fftw_free(void *p); -extern void fftw_check_memory_leaks(void); -extern void fftw_print_max_memory_usage(void); - -typedef void *(*fftw_malloc_type_function) (size_t n); -typedef void (*fftw_free_type_function) (void *p); -typedef void (*fftw_die_type_function) (const char *errString); -extern DL_IMPORT(fftw_malloc_type_function) fftw_malloc_hook; -extern DL_IMPORT(fftw_free_type_function) fftw_free_hook; -extern DL_IMPORT(fftw_die_type_function) fftw_die_hook; - -extern size_t fftw_sizeof_fftw_real(void); - -/* Wisdom: */ -/* - * define this symbol so that users know we are using a version of FFTW - * with wisdom - */ -#define FFTW_HAS_WISDOM -extern void fftw_forget_wisdom(void); -extern void fftw_export_wisdom(void (*emitter) (char c, void *), void *data); -extern fftw_status fftw_import_wisdom(int (*g) (void *), void *data); -extern void fftw_export_wisdom_to_file(FILE *output_file); -extern fftw_status fftw_import_wisdom_from_file(FILE *input_file); -extern char *fftw_export_wisdom_to_string(void); -extern fftw_status fftw_import_wisdom_from_string(const char *input_string); - -/* - * define symbol so we know this function is available (it is not in - * older FFTWs) - */ -#define FFTW_HAS_FPRINT_PLAN -extern void fftw_fprint_plan(FILE *f, fftw_plan plan); - -/***************************** - * N-dimensional code - *****************************/ -typedef struct { - int is_in_place; /* 1 if for in-place FFTs, 0 otherwise */ - - int rank; /* - * the rank (number of dimensions) of the - * array to be FFTed - */ - int *n; /* - * the dimensions of the array to the - * FFTed - */ - fftw_direction dir; - - int *n_before; /* - * n_before[i] = product of n[j] for j < i - */ - int *n_after; /* n_after[i] = product of n[j] for j > i */ - - fftw_plan *plans; /* 1d fftw plans for each dimension */ - - int nbuffers, nwork; - fftw_complex *work; /* - * work array big enough to hold - * nbuffers+1 of the largest dimension - * (has nwork elements) - */ -} fftwnd_data; - -typedef fftwnd_data *fftwnd_plan; - -/* Initializing the FFTWND plan: */ -extern fftwnd_plan fftw2d_create_plan(int nx, int ny, fftw_direction dir, - int flags); -extern fftwnd_plan fftw3d_create_plan(int nx, int ny, int nz, - fftw_direction dir, int flags); -extern fftwnd_plan fftwnd_create_plan(int rank, const int *n, - fftw_direction dir, - int flags); - -extern fftwnd_plan fftw2d_create_plan_specific(int nx, int ny, - fftw_direction dir, - int flags, - fftw_complex *in, int istride, - fftw_complex *out, int ostride); -extern fftwnd_plan fftw3d_create_plan_specific(int nx, int ny, int nz, - fftw_direction dir, int flags, - fftw_complex *in, int istride, - fftw_complex *out, int ostride); -extern fftwnd_plan fftwnd_create_plan_specific(int rank, const int *n, - fftw_direction dir, - int flags, - fftw_complex *in, int istride, - fftw_complex *out, int ostride); - -/* Freeing the FFTWND plan: */ -extern void fftwnd_destroy_plan(fftwnd_plan plan); - -/* Printing the plan: */ -extern void fftwnd_fprint_plan(FILE *f, fftwnd_plan p); -extern void fftwnd_print_plan(fftwnd_plan p); -#define FFTWND_HAS_PRINT_PLAN - -/* Computing the N-Dimensional FFT */ -extern void fftwnd(fftwnd_plan plan, int howmany, - fftw_complex *in, int istride, int idist, - fftw_complex *out, int ostride, int odist); -extern void fftwnd_one(fftwnd_plan p, fftw_complex *in, fftw_complex *out); - -#ifdef __cplusplus -} /* extern "C" */ - -#endif /* __cplusplus */ -#endif /* FFTW_H */ diff --git a/env/python/MANIFEST.in b/env/python/MANIFEST.in index 4416d10f..555a2e86 100644 --- a/env/python/MANIFEST.in +++ b/env/python/MANIFEST.in @@ -8,3 +8,8 @@ include srwpy/*.so # If including data files in the package, add them like: # include path/to/data_file + +graft srwpy/examples/data_example_* + +include README.md +include requirements.txt \ No newline at end of file diff --git a/env/python/requirements-optional.txt b/env/python/requirements-optional.txt new file mode 100644 index 00000000..3e01382d --- /dev/null +++ b/env/python/requirements-optional.txt @@ -0,0 +1,6 @@ +mpi4py +oasys_srw +primme +pykern +mpld3 +scikit-image \ No newline at end of file diff --git a/env/python/setup.py b/env/python/setup.py index 65cc96b3..ec409805 100644 --- a/env/python/setup.py +++ b/env/python/setup.py @@ -50,7 +50,7 @@ def build_extension(self, ext): '-DBUILD_CLIENT_PYTHON=ON', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir, '-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=' + extdir, - '-DPYTHON_EXECUTABLE=' + sys.executable] + '-DPython_EXECUTABLE=' + sys.executable] env = os.environ.copy() if 'MODE' in env: if env['MODE'] == 'omp': @@ -77,23 +77,29 @@ def build_extension(self, ext): base_dir = os.path.dirname(os.path.realpath(__file__)) original_src_dir = os.path.join(base_dir, '../..') +# Read README.md for long_description +long_description = open(os.path.join(original_src_dir, 'README.md')).read() + with open(os.path.join(base_dir, 'requirements.txt')) as requirements_file: # Parse requirements.txt, ignoring any commented-out lines. requirements = [line for line in requirements_file.read().splitlines() if not line.startswith('#')] setup(name='srwpy', - version='1.0', + version='4.0.0b1', description='This is SRW for Python', author='O. Chubar et al.', author_email='chubar@bnl.gov', url='http://github.com/ochubar/SRW', - long_description=''' -This is SRW for Python. -''', + long_description=long_description, + long_description_content_type='text/markdown', packages=find_packages(exclude=['docs', 'tests']), + package_data={'srwpy': ['examples/data_example_**/*']}, install_requires=requirements, zip_safe=False, ext_modules=[CMakeExtension('srwlpy', original_src_dir, 'srwpy')], cmdclass=dict(build_ext=CMakeBuild), + entry_points={ + 'console_scripts': ['srw-viewer=srwpy.SRWLIB_ExampleViewDataFile:main'], + }, ) diff --git a/env/python/srwpy/__init__.py b/env/python/srwpy/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/env/python/srwpy/examples/__init__.py b/env/python/srwpy/examples/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/env/python/tests/test_example04.py b/env/python/tests/test_example04.py index 30f14446..1d6ecc98 100644 --- a/env/python/tests/test_example04.py +++ b/env/python/tests/test_example04.py @@ -13,8 +13,8 @@ def test_example04(example_code): exec(example_code, globals(), globals()) # end of example, start testing - assert len(arI1x) == 700 - assert len(arI1y) == 750 + assert len(arI1x) == 120 + assert len(arI1y) == 112 assert hasattr(wfr, "mesh") assert hasattr(wfr, "partBeam") for param in ["zStart", diff --git a/env/python/tests/test_example12.py b/env/python/tests/test_example12.py index ec7fe550..283a144c 100644 --- a/env/python/tests/test_example12.py +++ b/env/python/tests/test_example12.py @@ -4,7 +4,7 @@ import sys -@pytest.mark.fast +@pytest.mark.slow @pytest.mark.interactive @pytest.mark.skipif(sys.platform != "linux", reason="runs only on Linux") # @pytest.mark.skipif(sys.platform not in ["linux", "darwin"], reason="runs only on Unix") diff --git a/env/python/tests/test_example13.py b/env/python/tests/test_example13.py index 18b8703f..03404cfd 100644 --- a/env/python/tests/test_example13.py +++ b/env/python/tests/test_example13.py @@ -14,8 +14,8 @@ def test_example13(example_code): # end of example, start testing assert len(arI0) == 102900 - assert len(arI1s) == 2240000 - assert len(arI1m) == 2240000 + assert len(arI1s) == 6720 + assert len(arI1m) == 6720 assert hasattr(wfr, "mesh") for param in ["zStart", "eStart", "eFin", "ne", diff --git a/env/python/tests/test_example15.py b/env/python/tests/test_example15.py index 44305ceb..45b7ac76 100644 --- a/env/python/tests/test_example15.py +++ b/env/python/tests/test_example15.py @@ -1,8 +1,8 @@ # Imports from the example: from __future__ import print_function -import srwpy.uti_plot as uti_plot from srwpy.srwlib import * from srwpy.uti_math import matr_prod, fwhm +from srwpy.uti_plot import * # Imports for tests: import pytest @@ -16,8 +16,8 @@ def test_example15(example_code): assert type(intensitiesToPlot) == dict assert len(intensitiesToPlot["intensity"]) == 3 assert len(intensitiesToPlot["intensity"][0]) == 235872 - assert len(intensitiesToPlot["intensity"][1]) == 73728 - assert len(intensitiesToPlot["intensity"][2]) == 81120 + assert len(intensitiesToPlot["intensity"][1]) == 4212 + assert len(intensitiesToPlot["intensity"][2]) == 3024 assert len(intensitiesToPlot["mesh_x"]) == 3 assert len(intensitiesToPlot["mesh_x"][0]) == 3 diff --git a/env/python/tests/test_example16.py b/env/python/tests/test_example16.py index 4fa04b82..4a730d3c 100644 --- a/env/python/tests/test_example16.py +++ b/env/python/tests/test_example16.py @@ -1,8 +1,8 @@ # Imports from the example: from __future__ import print_function # Python 2.7 compatibility -import srwpy.uti_plot as uti_plot from srwpy.srwlib import * from srwpy.uti_math import fwhm +from srwpy.uti_plot import * from scipy.special import jv # Imports for tests: