### Verify installation Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/building_extension.md Run tests to ensure the installation was successful. ```default python setup.py test ``` -------------------------------- ### Build and install from source Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/building_extension.md Commands to build and install the package within a virtual environment. ```default python setup.py build python setup.py install ``` -------------------------------- ### Install from PyPi Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/building_extension.md Install the latest stable release using pip. ```default pip install pyedflib ``` -------------------------------- ### Verify installation on Windows Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/building_extension.md Run the test suite specifically for Windows installations. ```default python runtests.py ``` -------------------------------- ### Install Cython Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/installing_build_dependencies.md Installs the required version of Cython using pip. ```bash pip install Cython>=0.16 ``` -------------------------------- ### Install numpy Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/installing_build_dependencies.md Installs the numpy library using pip. ```bash pip install numpy ``` -------------------------------- ### Install Sphinx and numpydoc Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/installing_build_dependencies.md Installs documentation generation tools required for building the project documentation. ```bash pip install Sphinx ``` ```bash pip install numpydoc ``` -------------------------------- ### Install development version Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/building_extension.md Install the latest development version directly from the repository or via pip. ```default pip install -e git+https://github.com/holgern/pyedflib.git#egg=pyedflib ``` ```default pip install pyedflib==dev ``` -------------------------------- ### Install Basic Build Tools on Debian/Ubuntu Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/preparing_linux_build_environment.md Installs essential build tools like gcc, python-dev, and git. This command is specific to Debian/Ubuntu systems using aptitude. Adapt the package manager and package names for other Linux distributions. ```default aptitude install build-essential gcc python-dev git-core ``` -------------------------------- ### Build and install on Windows Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/building_extension.md Specific build commands for Windows environments requiring Visual C++ compiler. ```default util\setenv_win.bat python setup.py build_ext --inplace python setup.py install --user ``` -------------------------------- ### Compile EDFlib with GCC Source: https://github.com/holgern/pyedflib/blob/master/README-edflib.md Example compilation command for EDFlib using GCC on Linux. Ensure to include the necessary large file source definitions. ```bash gcc -Wall -Wextra -Wshadow -Wformat-nonliteral -Wformat-security -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE test_edflib.c edflib.c -lm -o test_edflib ``` -------------------------------- ### Run pyedflib tests with nose Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/testing.md Execute the test suite for pyedflib using the nose test runner. Ensure pyedflib is installed in your environment. ```bash nosetests pyedflib ``` -------------------------------- ### Modify EDF File Channels Source: https://github.com/holgern/pyedflib/blob/master/README.rst Provides examples for modifying EDF files by dropping specific channels, changing channel polarity, or renaming channels. ```Python # drop a channel from the file or anonymize edf highlevel.drop_channels('edf_file.edf', to_drop=['ch2', 'ch4']) # change polarity of certain channels highlevel.change_polarity('file.edf', channels=[1,3]) # rename channels within a file highlevel.rename_channels('file.edf', mapping={'C3-M1':'C3'}) ``` -------------------------------- ### Build documentation Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/building_extension.md Navigate to the doc directory and generate HTML documentation. ```default cd doc make html ``` -------------------------------- ### Set up a Python virtual environment Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/installing_build_dependencies.md Creates and activates a new virtual environment for project isolation. ```bash curl -O https://raw.github.com/pypa/virtualenv/master/virtualenv.py python virtualenv.py . /bin/activate ``` -------------------------------- ### Create source distribution Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/how_to_release.md Generates source distribution files in tar.gz and zip formats. ```bash python setup.py sdist --formats=gztar,zip ``` -------------------------------- ### Write and Read EDF File Source: https://github.com/holgern/pyedflib/blob/master/README.rst Demonstrates how to write a new EDF file with random signals and then read it back, specifying which channels to retrieve. ```Python from pyedflib import highlevel import numpy as np # write an edf file signals = np.random.rand(5, 256*300)*200 # 5 minutes of random signal channel_names = ['ch1', 'ch2', 'ch3', 'ch4', 'ch5'] signal_headers = highlevel.make_signal_headers(channel_names, sample_frequency=256) header = highlevel.make_header(patientname='patient_x', gender='Female') highlevel.write_edf('edf_file.edf', signals, signal_headers, header) # read an edf file signals, signal_headers, header = highlevel.read_edf('edf_file.edf', ch_names=['ch1', 'ch2']) print(signal_headers[0]['sample_frequency']) # prints 256 ``` -------------------------------- ### Upload release to PyPI Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/how_to_release.md Registers and uploads wheel files to the Python Package Index using twine. ```bash twine register dist\filename_which_should_uploaded.whl ``` ```bash twine upload dist\filename_which_should_uploaded.whl ``` -------------------------------- ### Read EDF file signals with PyEDFlib Source: https://github.com/holgern/pyedflib/blob/master/doc/source/index.md Demonstrates how to open an EDF file and read its signal data into a NumPy array. ```python import pyedflib import numpy as np file_name = pyedflib.data.get_generator_filename() f = pyedflib.EdfReader(file_name) n = f.signals_in_file signal_labels = f.getSignalLabels() sigbufs = np.zeros((n, f.getNSamples()[0])) for i in np.arange(n): sigbufs[i, :] = f.readSignal(i) ``` -------------------------------- ### Configure Windows build environment variables Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/preparing_windows_build_environment.md Execute this batch script in the command prompt to configure the environment variables necessary for the build process. ```bat rem Configure the environment for builds. rem Convince setup.py to use the SDK tools. set MSSdk=1 set DISTUTILS_USE_SDK=1 ``` -------------------------------- ### Clone the repository Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/building_extension.md Use git to clone the PyEDFlib source code from GitHub. ```default git clone https://github.com/holgern/pyedflib.git pyedflib ``` -------------------------------- ### Tag the release Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/how_to_release.md Signs and pushes a release tag to the master branch. ```bash git tag -s vX.X.X ``` -------------------------------- ### Run pyedflib tests with pyedflib.test() Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/testing.md Run the integrated test suite for pyedflib directly using its test function. This method may require additional dependencies like Matplotlib for doctests. ```python >>> pyedflib.test() ``` -------------------------------- ### Analyze EDF/BDF file with test_edflib Source: https://github.com/holgern/pyedflib/blob/master/README-edflib.md Command to analyze an EDF/BDF file using the test_edflib utility. Specify the filename and the signal number to inspect. ```bash test_edflib test_generator.edf 6 ``` -------------------------------- ### Anonymize and Compare EDF Files Source: https://github.com/holgern/pyedflib/blob/master/README.rst Shows how to anonymize an EDF file by removing or replacing sensitive patient information and then compare it with the original file. ```Python highlevel.anonymize_edf('edf_file.edf', new_file='anonymized.edf', to_remove=['patientname', 'birthdate'], new_values=['anonymized', '']) # check if the two files have the same content highlevel.compare_edf('edf_file.edf', 'anonymized.edf') ``` -------------------------------- ### Clean source files Source: https://github.com/holgern/pyedflib/blob/master/doc/source/dev/how_to_release.md Removes untraced files from the repository. ```bash git clean -xfdn ``` ```bash git clean -xfd ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.