Note
Go to the end to download the full example code
Check install and run tests#
The emd.support
submodule contains a few functions relating to the
installation and testing of EMD on your system. Most users will not need to
use these functions most of the time but they can be helpful for checking
that EMD is properly installed.
Firstly, we can use emd.support.get_installed_version
to confirm which
version of EMD we have installed.
# sphinx_gallery_thumbnail_path = '_static/emd_pytest_thumb.png'
import emd
print(emd.support.get_installed_version())
0.6.2
Secondly, we can identify where the EMD files are installed on the computer
by calling emd.support.get_install_dir
. This can be useful if you have a
couple of EMD versions and want to be sure which is currently in use.
print(emd.support.get_install_dir())
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd
Finally, if you have installed EMD from source (rather than via conda or pypi) you can run the test suit directly from the support module. (Note that this will not create any output on the website.)
print(emd.support.run_tests())
============================= test session starts ==============================
platform linux -- Python 3.11.6, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable
configfile: setup.cfg
plugins: cov-4.1.0
collected 49 items
../../../../emd/tests/test_cycles.py ......... [ 18%]
../../../../emd/tests/test_imftools.py . [ 20%]
../../../../emd/tests/test_logger.py .... [ 28%]
../../../../emd/tests/test_sift.py ......................... [ 79%]
../../../../emd/tests/test_spectra.py ........ [ 95%]
../../../../emd/tests/test_utils.py .. [100%]/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/stable/lib/python3.11/site-packages/coverage/inorout.py:519: CoverageWarning: Module emd was previously imported, but not measured (module-not-measured)
self.warn(msg, slug="module-not-measured")
=============================== warnings summary ===============================
emd/tests/test_cycles.py::TestCyclesObject::test_cycle_object_iteration
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/cycles.py:530: DeprecationWarning: `alltrue` is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use `all` instead.
ensure_equal_dims((ip, x), ('ip', 'x'), 'phase_align')
emd/tests/test_cycles.py::TestCyclesObject::test_cycle_object_iteration
/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/stable/lib/python3.11/site-packages/scipy/interpolate/_interpolate.py:710: RuntimeWarning: divide by zero encountered in divide
slope = (y_hi - y_lo) / (x_hi - x_lo)[:, None]
emd/tests/test_imftools.py::TestAssessHarmonicCriteria::test_input_length
emd/tests/test_imftools.py::TestAssessHarmonicCriteria::test_input_length
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/imftools.py:407: DeprecationWarning: `alltrue` is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use `all` instead.
ensure_equal_dims((IP, IF, IA), ('IP', 'IF', 'IA'), 'assess_harmonic_criteria')
emd/tests/test_imftools.py::TestAssessHarmonicCriteria::test_input_length
emd/tests/test_imftools.py::TestAssessHarmonicCriteria::test_input_length
emd/tests/test_imftools.py::TestAssessHarmonicCriteria::test_input_length
emd/tests/test_imftools.py::TestAssessHarmonicCriteria::test_input_length
/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/stable/lib/python3.11/site-packages/dcor/_hypothesis.py:34: DeprecationWarning: HypothesisTest will cease to be iterable.
warnings.warn(
emd/tests/test_sift.py::TestSiftDefaults::test_ensemble_sift_default
emd/tests/test_sift.py::TestSiftDefaults::test_ensemble_sift_default
emd/tests/test_sift.py::TestSiftDefaults::test_ensemble_sift_default
emd/tests/test_sift.py::TestSiftDefaults::test_ensemble_sift_default
emd/tests/test_sift.py::TestSiftDefaults::test_ensemble_sift_default
emd/tests/test_sift.py::TestSiftDefaults::test_ensemble_sift_default
emd/tests/test_sift.py::TestSiftDefaults::test_ensemble_sift_default
emd/tests/test_sift.py::TestSiftDefaults::test_ensemble_sift_default
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/sift.py:671: DeprecationWarning: `alltrue` is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use `all` instead.
ensure_equal_dims([X, noise], ['X', 'noise'], '_sift_with_noise', dim=0)
emd/tests/test_sift.py::TestIsIMF::test_is_imf_on_abreu
emd/tests/test_sift.py::TestIsIMF::test_is_imf_on_abreu
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/tests/test_sift.py:430: DeprecationWarning: `alltrue` is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use `all` instead.
out = is_imf(imf)
emd/tests/test_sift.py::TestIsIMF::test_is_imf_on_sinusoid
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/tests/test_sift.py:422: DeprecationWarning: `alltrue` is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use `all` instead.
out = is_imf(self.y)
emd/tests/test_spectra.py::TestSpectra::test_hilberthuang
emd/tests/test_spectra.py::TestSpectra::test_hilberthunang_1d
emd/tests/test_spectra.py::TestSpectra::test_hilberthunang_1d
emd/tests/test_spectra.py::TestSpectra::test_hilberthunang_1d
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/spectra.py:596: DeprecationWarning: `alltrue` is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use `all` instead.
ensure_equal_dims((IF, IA), ('IF', 'IA'), 'hilberthuang')
emd/tests/test_spectra.py::TestHolospectrum::test_holo
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/spectra.py:747: DeprecationWarning: `alltrue` is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use `all` instead.
ensure_equal_dims((IF, IF2, IA2), ('IF', 'IF2', 'IA2'), 'holospectrum', dim=0)
emd/tests/test_spectra.py::TestHolospectrum::test_holo
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/spectra.py:748: DeprecationWarning: `alltrue` is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use `all` instead.
ensure_equal_dims((IF, IF2, IA2), ('IF', 'IF2', 'IA2'), 'holospectrum', dim=1)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
---------- coverage: platform linux, python 3.11.6-final-0 -----------
Name Stmts Miss Cover Missing
--------------------------------------------------------------------------------------------------------------------------------
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/__init__.py 13 13 0% 7-39
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/_cycles_support.py 149 83 44% 5-57, 70-75, 85, 93, 96-100, 105, 113-114, 120-144, 155, 164, 173-183, 192, 198-206, 211, 215-227, 232, 237, 244, 250-256, 260, 264, 269, 273, 278, 283-296, 303-308
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/_sift_core.py 230 63 73% 5-23, 68-69, 95, 110, 134, 170, 176, 181, 185, 196-200, 207, 324, 332, 334, 337-350, 361-362, 364-365, 370, 404-406, 409-411, 416-458, 487, 498, 518, 523, 532-533, 544-545, 550
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/_version.py 1 1 0% 4
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/cycles.py 609 297 51% 5-72, 133-134, 141, 146-147, 157, 174-175, 197, 223, 252-299, 349-350, 368-378, 396, 431, 437-440, 448-483, 533, 539, 545-546, 554, 558, 573-754, 773, 779, 782, 791, 799, 812-813, 818, 823-855, 953, 976, 981, 986, 990, 995-1004, 1009, 1014-1025, 1029, 1033-1034, 1038, 1042, 1055, 1063-1072, 1085, 1091, 1093-1096, 1100-1107, 1111-1120, 1126-1181, 1201-1202, 1212-1234, 1237, 1248-1266, 1272, 1283, 1286, 1294, 1298, 1301-1302, 1311, 1313, 1318, 1322, 1333, 1342, 1347, 1352, 1358, 1361, 1374, 1389, 1400, 1414, 1420, 1422, 1424, 1426, 1428, 1432
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/imftools.py 199 82 59% 5-25, 63, 98, 112-114, 123, 147, 150, 158-159, 167, 247-351, 417, 490-550, 572, 577-579, 597-668
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/logger.py 123 69 44% 5-89, 93-140, 157, 171, 175, 177, 189, 199, 207, 213-215, 223-237, 243, 252-260, 265-269, 289-298, 301-303, 306, 308, 314, 317
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/plotting.py 221 221 0% 5-540
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/sift.py 579 201 65% 5-58, 126, 128-129, 157-172, 181, 186, 215-256, 292-374, 378-383, 390-392, 523, 582-583, 598-605, 611-619, 691-693, 758, 769, 801-803, 879, 935, 979, 1061, 1110-1112, 1240-1241, 1257, 1280, 1290-1292, 1420-1424, 1426-1427, 1433-1439, 1472-1474, 1481, 1485-1492, 1509, 1512-1514, 1522-1524, 1540, 1549-1598, 1633, 1635, 1653-1656, 1662, 1673, 1679-1680, 1684-1699, 1713-1735, 1742, 1746, 1752-1756, 1762-1763, 1769-1770, 1778-1792, 1866-1873, 1887, 1906, 1915, 1919
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/simulate.py 50 44 12% 5-96, 159-209
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/spectra.py 304 155 49% 5-44, 120-179, 200-284, 328-333, 336, 341, 373, 398-484, 620, 776-889, 939-940, 942-943, 947-948, 959-964, 969-970, 975, 1037, 1113, 1147, 1181-1183, 1187, 1195, 1226, 1234, 1257, 1260, 1266, 1271, 1274, 1278-1279
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/support.py 97 49 49% 5-34, 40-78, 83-84, 94, 125-134, 169-172, 174-177, 185, 233-236, 272-285
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/tests/__init__.py 0 0 100%
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/tests/test_cycles.py 131 0 100%
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/tests/test_imftools.py 21 0 100%
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/tests/test_logger.py 31 2 94% 52-53
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/tests/test_sift.py 300 5 98% 134, 217-219, 223
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/tests/test_spectra.py 86 0 100%
/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/tests/test_utils.py 30 0 100%
--------------------------------------------------------------------------------------------------------------------------------
TOTAL 3174 1285 60%
======================= 49 passed, 25 warnings in 2.23s ========================
--- Logging error ---
Traceback (most recent call last):
File "/home/docs/.asdf/installs/python/3.11.6/lib/python3.11/logging/__init__.py", line 1113, in emit
stream.write(msg + self.terminator)
ValueError: I/O operation on closed file.
Call stack:
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/stable/lib/python3.11/site-packages/sphinx/__main__.py", line 7, in <module>
raise SystemExit(main(sys.argv[1:]))
File "/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/stable/lib/python3.11/site-packages/sphinx/cmd/build.py", line 341, in main
return build_main(argv)
File "/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/stable/lib/python3.11/site-packages/sphinx/cmd/build.py", line 293, in build_main
app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
File "/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/stable/lib/python3.11/site-packages/sphinx/application.py", line 272, in __init__
self._init_builder()
File "/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/stable/lib/python3.11/site-packages/sphinx/application.py", line 343, in _init_builder
self.events.emit('builder-inited')
File "/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/stable/lib/python3.11/site-packages/sphinx/events.py", line 97, in emit
results.append(listener.handler(self.app, *args))
File "/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/stable/lib/python3.11/site-packages/sphinx_gallery/gen_gallery.py", line 632, in generate_gallery_rst
) = generate_dir_rst(src_dir, target_dir, gallery_conf, seen_backrefs)
File "/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/stable/lib/python3.11/site-packages/sphinx_gallery/gen_rst.py", line 531, in generate_dir_rst
intro, title, (t, mem) = generate_file_rst(
File "/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/stable/lib/python3.11/site-packages/sphinx_gallery/gen_rst.py", line 1203, in generate_file_rst
output_blocks, time_elapsed = execute_script(
File "/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/stable/lib/python3.11/site-packages/sphinx_gallery/gen_rst.py", line 1108, in execute_script
execute_code_block(
File "/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/stable/lib/python3.11/site-packages/sphinx_gallery/gen_rst.py", line 970, in execute_code_block
is_last_expr, mem_max = _exec_and_get_memory(
File "/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/stable/lib/python3.11/site-packages/sphinx_gallery/gen_rst.py", line 811, in _exec_and_get_memory
mem_last, _ = gallery_conf["call_memory"](
File "/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/stable/lib/python3.11/site-packages/sphinx_gallery/gen_gallery.py", line 244, in call_memory
return 0.0, func()
File "/home/docs/checkouts/readthedocs.org/user_builds/emd/envs/stable/lib/python3.11/site-packages/sphinx_gallery/gen_rst.py", line 722, in __call__
exec(self.code, self.fake_main.__dict__)
File "/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/doc/source/tutorials/04_utilities/emd_tutorial_04_utils_01_support.py", line 33, in <module>
print(emd.support.run_tests())
File "/home/docs/checkouts/readthedocs.org/user_builds/emd/checkouts/stable/emd/support.py", line 73, in run_tests
logger.info('EMD package tests passed')
Message: 'EMD package tests passed'
Arguments: ()
None
Total running time of the script: (0 minutes 2.659 seconds)