diff --git a/.github/workflows/create-tag.yml b/.github/workflows/create-tag.yml new file mode 100644 index 0000000..2d95eed --- /dev/null +++ b/.github/workflows/create-tag.yml @@ -0,0 +1,34 @@ +name: Create tag from new version + +on: + workflow_dispatch: + workflow_call: + push: + branches: + - main + paths: + - fieldtrip/_version.py + +permissions: + contents: write + +jobs: + setup-tag: + runs-on: "ubuntu-latest" + steps: + - name: Check out FieldTrip Python + uses: actions/checkout@v4 + + - name: Get package version + run: | + VERSION=$(sed -n 's/^__version__ = "\(.*\)"/\1/p' fieldtrip/_version.py) + echo "pyproject.toml version: $VERSION" + git config user.name github-actions + git config user.email github-actions@github.com + MSG=$(git log $(git describe --tags --abbrev=0)..HEAD --oneline) + echo "Creating tag $VERSION with message:" + echo "$MSG" + git tag -a "$VERSION" -m "$MSG" + + - name: Publish tags + run: git push --tags diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 0000000..98897d3 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,153 @@ +name: Upload and Publish Python Package +on: + workflow_run: + workflows: ["run_unit_tests"] + types: + - completed + workflow_dispatch: + +env: + PYTHON_VERSION: "3.13" + +jobs: + check-tag: + name: Check if commit is a tag + if: > + github.event_name == 'workflow_dispatch' || + github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + outputs: + is_tagged: ${{ steps.check-tag.outputs.is_tagged }} + tag_name: ${{ steps.check-tag.outputs.tag_name }} + is_prerelease: ${{ steps.check-tag.outputs.is_prerelease }} + steps: + - name: Checkout full history + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Determine tagged commit and pre-release + id: check-tag + run: | + TAG=$(git tag --points-at HEAD | head -n 1) + echo "Found tag: $TAG" + if [[ "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then + echo "is_tagged=true" >> $GITHUB_OUTPUT + echo "tag_name=$TAG" >> $GITHUB_OUTPUT + + if [[ "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+[a-zA-Z].*$ ]]; then + echo "is_prerelease=true" >> $GITHUB_OUTPUT + else + echo "is_prerelease=false" >> $GITHUB_OUTPUT + fi + else + echo "is_tagged=false" >> $GITHUB_OUTPUT + fi + + build: + name: Build Package + needs: check-tag + if: needs.check-tag.outputs.is_tagged == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + + - name: Build sdist and wheel + run: python -m build + + - name: Upload built packages + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + + publish-to-testpypi: + name: Publish to TestPyPI + needs: build + runs-on: ubuntu-latest + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Publish to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + + test-install: + name: Test Install from TestPyPI + needs: publish-to-testpypi + runs-on: ubuntu-latest + steps: + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Test install from TestPyPI + run: | + python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple fieldtrip-python + python -c "import fieldtrip" + + publish-to-pypi: + name: Publish to PyPI + needs: test-install + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/project/fieldtrip-python/ + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + sign-and-release: + name: Sign and Create GitHub Release + needs: [check-tag, publish-to-pypi] + if: needs.check-tag.outputs.is_tagged == 'true' + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Sign with Sigstore + uses: sigstore/gh-action-sigstore-python@v3.0.0 + with: + inputs: >- + dist/*.tar.gz + dist/*.whl + + - name: Create GitHub Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create "${{ needs.check-tag.outputs.tag_name }}" \ + --repo "$GITHUB_REPOSITORY" \ + --generate-notes \ + $([[ "${{ needs.check-tag.outputs.is_prerelease }}" == "true" ]] && echo "--prerelease") \ + dist/* diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml new file mode 100644 index 0000000..19d1fc8 --- /dev/null +++ b/.github/workflows/run_unit_tests.yml @@ -0,0 +1,128 @@ +name: Unit tests +on: + workflow_dispatch: + workflow_call: + push: + paths: + - tests/** + - fieldtrip/** + - setup.py + - pyproject.toml + pull_request: + +env: + MLM_LICENSE_TOKEN: ${{ secrets.MATLAB_BATCH_TOKEN }} + +jobs: + run-unit-tests: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: False + matrix: + matlab: ["R2025b"] + os: [ubuntu-latest, macos-13, macos-latest, windows-latest] + python-version: ["3.10", "3.11", "3.12", "3.13"] + include: + - os: ubuntu-latest + os_name: Linux + platform: Linux + - os: macos-13 + os_name: macOS_Intel + platform: Mac + - os: macos-latest + os_name: macOS_Apple_Silicon + platform: Mac + - os: windows-latest + os_name: Windows + platform: Windows + + steps: + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install FieldTrip Python from latest Release (to get CTF file) + run: | + python -m pip install https://github.com/johmedr/fieldtrip-python/releases/latest/download/fieldtrip_python-20241219b1-py3-none-any.whl + + - name: Check out FieldTrip Python + uses: actions/checkout@v4 + + # Setup MATLAB and Runtime + - name: Set up MATLAB + uses: matlab-actions/setup-matlab@v2 + with: + release: ${{matrix.matlab}} + cache: True + products: | + MATLAB_Compiler + MATLAB_Compiler_SDK + + - name: Extract MATLAB path to file + uses: matlab-actions/run-command@v2 + with: + command: | + fileID = fopen('matlab_path.txt', 'w'); + matlabpath = matlabroot; + matlabpath = strrep(matlabpath, filesep, '/'); + matlabpath = strrep(matlabpath, '\', '\\'); + matlabpath = strrep(matlabpath, 'C:', '/c/'); + matlabpath = strrep(matlabpath, 'D:', '/d/'); + fprintf(fileID, matlabpath); + fclose(fileID); + # sometimes this step hangs when closing matlab, automatically terminating after 2 minutes solves the issue + timeout-minutes: 2 + continue-on-error: true + + - name: Set environment variable with MATLAB path + shell: bash # Works on Windows as well because of shell: bash + run: | + matlab_path=$(cat matlab_path.txt) + echo "MATLAB_PATH=$matlab_path" >> $GITHUB_ENV + + - name: Run tests (Mac Apple Silicon) + if: matrix.os_name == 'macOS_Apple_Silicon' + run: | + export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH:+${DYLD_LIBRARY_PATH}:}\ + ${{ env.MATLAB_PATH }}/runtime/maca64:\ + ${{ env.MATLAB_PATH }}/bin/maca64:\ + ${{ env.MATLAB_PATH }}/sys/os/maca64:\ + ${{ env.MATLAB_PATH }}/extern/bin/maca64" + export PYTHONHOME=${{ env.pythonLocation }} + mwpython -m unittest discover tests -v + + - name: Run tests (Mac Intel) + if: matrix.os_name == 'macOS_Intel' + run: | + export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH:+${DYLD_LIBRARY_PATH}:}\ + ${{ env.MATLAB_PATH }}/runtime/maci64:\ + ${{ env.MATLAB_PATH }}/bin/maci64:\ + ${{ env.MATLAB_PATH }}/sys/os/maci64:\ + ${{ env.MATLAB_PATH }}/extern/bin/maci64" + export PYTHONHOME=${{ env.pythonLocation }} + mwpython -m unittest discover tests -v + + - name: Run tests (Windows) + if: matrix.os_name == 'Windows' + shell: bash + run: | + export PATH="${{ env.MATLAB_PATH }}/runtime/win64:\ + ${{ env.MATLAB_PATH }}/bin/win64:\ + ${{ env.MATLAB_PATH }}/sys/os/win64:\ + ${{ env.MATLAB_PATH }}/extern/bin/win64\ + ${{ env.MATLAB_PATH }}/runtime/win32:\ + ${{ env.MATLAB_PATH }}/bin/win32:\ + ${{ env.MATLAB_PATH }}/sys/os/win32:\ + ${{ env.MATLAB_PATH }}/extern/bin/win32:${PATH}" + python -m unittest discover tests -v + + - name: Run tests (Linux) + if: runner.os == 'Linux' + run: | + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}\ + ${{ env.MATLAB_PATH }}/runtime/glnxa64:\ + ${{ env.MATLAB_PATH }}/bin/glnxa64:\ + ${{ env.MATLAB_PATH }}/sys/os/glnxa64:\ + ${{ env.MATLAB_PATH }}/extern/bin/glnxa64" + python -m unittest discover tests -v diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fd53429 --- /dev/null +++ b/.gitignore @@ -0,0 +1,40 @@ +# Python cache files +**/__pycache__/ + +# Virtual environment +**/venv/ +**/.env/ +**/env/ +**/.venv/ + +# Distribution files +**/dist/ +**/build/ +**/*.egg-info/ + +# Jupyter Notebook checkpoints +**/.ipynb_checkpoints/ + +# IDE and editor files +**/.vscode/ +**/.idea/ +**/*.swp + +# Pytest cache +.cache/ + +# OS-specific files +**/.DS_Store +**/Thumbs.db + +*.nii + +# MPython Hashmaps +**/.mpython_hashmap.csv +.mpython/build +.mpython/external +**/*.asv +examples/data/ + +# CTF file +**/*.ctf \ No newline at end of file diff --git a/.mpython/templates/class_header.py b/.mpython/templates/class_header.py new file mode 100644 index 0000000..f3f0556 --- /dev/null +++ b/.mpython/templates/class_header.py @@ -0,0 +1,8 @@ +from mpython import MatlabClass +from fieldtrip._runtime import Runtime, RuntimeMixin + + +class (RuntimeMixin, MatlabClass): + def __init__(self, *args, **kwargs): + + super().__init__() diff --git a/.mpython/templates/docstring.py b/.mpython/templates/docstring.py new file mode 100644 index 0000000..e88acc3 --- /dev/null +++ b/.mpython/templates/docstring.py @@ -0,0 +1,28 @@ +""" + + +This file was automatically converted from Matlab to Python using +[MPython](https://github.com/MPython-Package-Factory/mpython), please +refer to the original matlab file for the most accurate documentation. + +[Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ ) + +Copyright (C) 2011-2021, Robert Oostenveld +Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + +This file is part of FieldTrip, see http://www.fieldtriptoolbox.org +for the documentation and details. + +FieldTrip 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 3 of the License, or +(at your option) any later version. + +FieldTrip 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 FieldTrip. If not, see . +""" diff --git a/.mpython/templates/function_header.py b/.mpython/templates/function_header.py new file mode 100644 index 0000000..e69de29 diff --git a/.mpython/wrap_project.m b/.mpython/wrap_project.m new file mode 100644 index 0000000..d9fcec8 --- /dev/null +++ b/.mpython/wrap_project.m @@ -0,0 +1,84 @@ +function wrap_project + + +python_package_name = 'fieldtrip'; +matlab_project_url = 'https://github.com/fieldtrip/fieldtrip.git'; +[~, matlab_project_name] = fileparts(matlab_project_url); +mpython_url = 'https://github.com/MPython-Package-Factory/mpython.git'; + +[cpath, ~, ~] = fileparts(mfilename('fullpath')); +python_package_path = fullfile(cpath, '..'); + +restoredefaultpath; + +cd(cpath); + +mkdir('external'); +cd('external'); + +if ~exist(matlab_project_name, 'dir') + system(sprintf('git clone --depth=1 %s', matlab_project_url)); +else + system(sprintf('git -C %s pull', matlab_project_name)); +end + +if ~exist('mpython', 'dir') + system(sprintf('git clone --depth=1 %s', mpython_url)); +else + system('git -C mpython pull'); +end + +cd('..'); + +addpath(fullfile(cpath, 'external', 'mpython')); +addpath(fullfile(cpath, 'external', matlab_project_name)); + +mkdir('build'); +srcpath = fullfile('external', matlab_project_name); +buildpath = fullfile('build', matlab_project_name); +copyfile(srcpath, buildpath); + +ignored = { + '.git' + '.github' + 'test' + 'external' + 'compat' +}; +for i = 1:length(ignored) + try + rmdir(fullfile(buildpath, ignored{i}), 's'); + fprintf('Removed %s\n', fullfile(buildpath, ignored{i})); + catch e + warning(e.message); + fprintf('Could not remove %s\n', fullfile(buildpath, ignored{i})); + end + try + delete(fullfile(buildpath, ignored{i})); + fprintf('Deleted %s\n', fullfile(buildpath, ignored{i})); + catch e + warning(e.message); + fprintf('Could not remove %s\n', fullfile(buildpath, ignored{i})); + end +end + + +toolboxes = { + 'signal' + 'stats' + 'newunits' + 'syms' + 'images' + 'parfor' +}; +mpython_compile(buildpath, python_package_path, python_package_name, toolboxes) + + +mpython_wrap( ... + buildpath, ... + python_package_path, ... + python_package_name, ... + true, ... + fullfile(cpath, 'templates')) + +end diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..fa1736a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,11 @@ +repos: +- repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.11.2 + hooks: + # Run the linter. + - id: ruff + args: [ --fix, --ignore=F811] + # Run the formatter. + - id: ruff-format + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/README.md b/README.md index 8675d81..8a82b37 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ / \ ------------------------------------ / \ - ------------------------------------------------- - / /\/\/\/\/\ - --------------------------------------------------- + ------------------------------------------------- + / /\/\/\/\/\ + --------------------------------------------------- | F i e l d T r i p | ------------------------------------------ \ / @@ -14,6 +14,80 @@ ---------- ``` -# The Python interface to [FieldTrip](https://www.fieldtriptoolbox.org) +# The Python interface to _[FieldTrip](https://www.fieldtriptoolbox.org)_ + + +> [!WARNING] +> This project is **young** and might contain bugs. +> **If you experience any issues, please [let us know](https://github.com/fieldtrip/fieldtrip-python/issues)!** + +## Installation instructions + +### Important - Windows + +Python installation made from Microsoft Store on Windows will not work +(raises DeclarativeService.dll not found), install it from Python website. + +### Important - Python/MATLAB compatibility + +Specific versions of MATLAB are compatible with +[specific versions of Python](https://uk.mathworks.com/support/requirements/python-compatibility.html). + +By default, `fieldtrip-python` uses R2025b, which is compatible with Python 3.10-3.13. + +### Option 1 - Install the MATLAB runtime on first use + +1. Install FieldTrip-Python + ```shell + pip install https://github.com/johmedr/fieldtrip-python/releases/latest/download/fieldtrip_python-20241219b1-py3-none-any.whl + ``` +2. Start Python + ```shell + python + ``` +3. Calling a FieldTrip function will try to locate or install MATLAB Runtime. + ```python + import fieldtrip + ft_info('Hello, world') + ``` +4. Follow the instructions to install the runtime + +- **Advantages** + - Installs the runtime that is required for your python version + - Does not resintall anything if a compatible runtime already exists +- **Drawbacks** + - May need to be run in proviledged mode (e.g., `sudo`) + - May be fiddly on Windows + +### Option 2 - Install the MATLAB runtime manually + +1. Install the appropriate [MATLAB Runtime](https://uk.mathworks.com/products/compiler/matlab-runtime.html) +2. Install FieldTrip: + ```python + pip install https://github.com/johmedr/fieldtrip-python/releases/latest/download/fieldtrip_python-20241219b1-py3-none-any.whl + ``` + +- **Advantages** + - Graphical interface for installing the runtime +- **Drawbacks** + - The correct runtime must be selected for your python version + +### Option 3 - Install the MATLAB runtime using an installation script + +1. Install FieldTrip-Python + ```shell + pip install https://github.com/johmedr/fieldtrip-python/releases/latest/download/fieldtrip_python-20241219b1-py3-none-any.whl + ``` +2. Run the installer + ```shell + install_matlab_runtime --version R2025b --yes + ``` + +- **Advantages** + - Exposes installation options (`install_matlab_runtime --help`) +- **Drawbacks** + - For advanced users -More to follow ... diff --git a/fieldtrip/__connectivity/__init__.py b/fieldtrip/__connectivity/__init__.py new file mode 100644 index 0000000..31cc236 --- /dev/null +++ b/fieldtrip/__connectivity/__init__.py @@ -0,0 +1,30 @@ +from .ft_connectivity_cancorr import ft_connectivity_cancorr +from .ft_connectivity_corr import ft_connectivity_corr +from .ft_connectivity_csd2transfer import ft_connectivity_csd2transfer +from .ft_connectivity_dtf import ft_connectivity_dtf +from .ft_connectivity_granger import ft_connectivity_granger +from .ft_connectivity_mim import ft_connectivity_mim +from .ft_connectivity_mutualinformation import ft_connectivity_mutualinformation +from .ft_connectivity_pdc import ft_connectivity_pdc +from .ft_connectivity_plm import ft_connectivity_plm +from .ft_connectivity_powcorr_ortho import ft_connectivity_powcorr_ortho +from .ft_connectivity_ppc import ft_connectivity_ppc +from .ft_connectivity_psi import ft_connectivity_psi +from .ft_connectivity_wpli import ft_connectivity_wpli + + +__all__ = [ + "ft_connectivity_cancorr", + "ft_connectivity_corr", + "ft_connectivity_csd2transfer", + "ft_connectivity_dtf", + "ft_connectivity_granger", + "ft_connectivity_mim", + "ft_connectivity_mutualinformation", + "ft_connectivity_pdc", + "ft_connectivity_plm", + "ft_connectivity_powcorr_ortho", + "ft_connectivity_ppc", + "ft_connectivity_psi", + "ft_connectivity_wpli", +] diff --git a/fieldtrip/__connectivity/_blockwise_conditionalgranger.py b/fieldtrip/__connectivity/_blockwise_conditionalgranger.py new file mode 100644 index 0000000..0043850 --- /dev/null +++ b/fieldtrip/__connectivity/_blockwise_conditionalgranger.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _blockwise_conditionalgranger(*args, **kwargs): + """ + BLOCKWISE_CONDITIONALGRANGER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/blockwise_conditionalgranger.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("blockwise_conditionalgranger", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_coeffs2iis.py b/fieldtrip/__connectivity/_coeffs2iis.py new file mode 100644 index 0000000..88685d3 --- /dev/null +++ b/fieldtrip/__connectivity/_coeffs2iis.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _coeffs2iis(*args, **kwargs): + """ + COEFFS2IIS computes the instantaneous interaction strength based on the + MVAR-coefficients and a noise covariance matrix. The underlying + assumption is that the MVAR-models have been fitted in a bivariate + fashion. It uses the definition according to Vinck et al. Neuroimage 2015 + (108). + + Input data: + A = 2x2xncmbxorder, matrix with MVAR-coefficients + C = 2x2xncmb , covariance matrices of the noise + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/coeffs2iis.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("coeffs2iis", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_ctranspose2x2.py b/fieldtrip/__connectivity/_ctranspose2x2.py new file mode 100644 index 0000000..52ddfb6 --- /dev/null +++ b/fieldtrip/__connectivity/_ctranspose2x2.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _ctranspose2x2(*args, **kwargs): + """ + compute ctranspose of multiple 2x2 matrices, input is 2x2xN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/ctranspose2x2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ctranspose2x2", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_ctranspose3x3.py b/fieldtrip/__connectivity/_ctranspose3x3.py new file mode 100644 index 0000000..28c188e --- /dev/null +++ b/fieldtrip/__connectivity/_ctranspose3x3.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _ctranspose3x3(*args, **kwargs): + """ + compute ctranspose of multiple 3x3 matrices, input is 3x3xN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/ctranspose3x3.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ctranspose3x3", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_defaultId.py b/fieldtrip/__connectivity/_defaultId.py new file mode 100644 index 0000000..e4f6099 --- /dev/null +++ b/fieldtrip/__connectivity/_defaultId.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _defaultId(*args, **kwargs): + """ + DEFAULTID returns a string that can serve as warning or error identifier, + for example 'FieldTip:ft_read_header:line345'. + + See also WARNING, ERROR, FT_NOTICE, FT_INFO, FT_DEBUG + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/defaultId.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("defaultId", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_det2x2.py b/fieldtrip/__connectivity/_det2x2.py new file mode 100644 index 0000000..176f09a --- /dev/null +++ b/fieldtrip/__connectivity/_det2x2.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _det2x2(*args, **kwargs): + """ + DET2X2 computes determinant of matrix x, using explicit analytic definition + if size(x,1) < 4, otherwise use MATLAB det-function + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/det2x2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("det2x2", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_det3x3.py b/fieldtrip/__connectivity/_det3x3.py new file mode 100644 index 0000000..78516ef --- /dev/null +++ b/fieldtrip/__connectivity/_det3x3.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _det3x3(*args, **kwargs): + """ + DET3X3 computes determinant of matrix x, using explicit analytic definition + if size(x) = [3 3 K M] + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/det3x3.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("det3x3", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_fixname.py b/fieldtrip/__connectivity/_fixname.py new file mode 100644 index 0000000..feaa6ec --- /dev/null +++ b/fieldtrip/__connectivity/_fixname.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _fixname(*args, **kwargs): + """ + FIXNAME changes all inappropriate characters in a string into '_' + so that it can be used as a filename or as a field name in a structure. + If the string begins with a digit, an 'x' is prepended. + + Use as + str = fixname(str) + + MATLAB 2014a introduces the matlab.lang.makeValidName and + matlab.lang.makeUniqueStrings functions for constructing unique + identifiers, but this particular implementation also works with + older MATLAB versions. + + See also DEBLANK, STRIP, PAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/fixname.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixname", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_ft_debug.py b/fieldtrip/__connectivity/_ft_debug.py new file mode 100644 index 0000000..194f66e --- /dev/null +++ b/fieldtrip/__connectivity/_ft_debug.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_debug(*args, **kwargs): + """ + FT_DEBUG prints a debug message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_debug(...) + with arguments similar to fprintf, or + ft_debug(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_debug off + or for specific ones using + ft_debug off msgId + + To switch them back on, you would use + ft_debug on + or for specific ones using + ft_debug on msgId + + Messages are only printed once per timeout period using + ft_debug timeout 60 + ft_debug once + or for specific ones using + ft_debug once msgId + + You can see the most recent messages and identifier using + ft_debug last + + You can query the current on/off/once state for all messages using + ft_debug query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/ft_debug.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_debug", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_ft_error.py b/fieldtrip/__connectivity/_ft_error.py new file mode 100644 index 0000000..fae5885 --- /dev/null +++ b/fieldtrip/__connectivity/_ft_error.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _ft_error(*args, **kwargs): + """ + FT_ERROR prints an error message on screen, just like the standard ERROR function. + + Use as + ft_error(...) + with arguments similar to fprintf, or + ft_error(msgId, ...) + with arguments similar to error. + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/ft_error.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_error", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_ft_getopt.py b/fieldtrip/__connectivity/_ft_getopt.py new file mode 100644 index 0000000..3fb6f42 --- /dev/null +++ b/fieldtrip/__connectivity/_ft_getopt.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def _ft_getopt(*args, **kwargs): + """ + FT_GETOPT gets the value of a specified option from a configuration structure + or from a cell-array with key-value pairs. + + Use as + val = ft_getopt(s, key, default, emptymeaningful) + where the input values are + s = structure or cell-array + key = string + default = any valid MATLAB data type (optional, default = []) + emptymeaningful = boolean value (optional, default = false) + + If the key is present as field in the structure, or as key-value pair in the + cell-array, the corresponding value will be returned. + + If the key is not present, ft_getopt will return the default, or an empty array + when no default was specified. + + If the key is present but has an empty value, then the emptymeaningful flag + specifies whether the empty value or the default value should be returned. + If emptymeaningful==true, then the empty array will be returned. + If emptymeaningful==false, then the specified default will be returned. + + See also FT_SETOPT, FT_CHECKOPT, INPUTPARSER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/ft_getopt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_getopt", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_ft_info.py b/fieldtrip/__connectivity/_ft_info.py new file mode 100644 index 0000000..ffb5e3b --- /dev/null +++ b/fieldtrip/__connectivity/_ft_info.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_info(*args, **kwargs): + """ + FT_INFO prints an info message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_info(...) + with arguments similar to fprintf, or + ft_info(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_info off + or for specific ones using + ft_info off msgId + + To switch them back on, you would use + ft_info on + or for specific ones using + ft_info on msgId + + Messages are only printed once per timeout period using + ft_info timeout 60 + ft_info once + or for specific ones using + ft_info once msgId + + You can see the most recent messages and identifier using + ft_info last + + You can query the current on/off/once state for all messages using + ft_info query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/ft_info.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_info", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_ft_notice.py b/fieldtrip/__connectivity/_ft_notice.py new file mode 100644 index 0000000..711e6d6 --- /dev/null +++ b/fieldtrip/__connectivity/_ft_notice.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_notice(*args, **kwargs): + """ + FT_NOTICE prints a notice message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_notice(...) + with arguments similar to fprintf, or + ft_notice(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_notice off + or for specific ones using + ft_notice off msgId + + To switch them back on, you would use + ft_notice on + or for specific ones using + ft_notice on msgId + + Messages are only printed once per timeout period using + ft_notice timeout 60 + ft_notice once + or for specific ones using + ft_notice once msgId + + You can see the most recent messages and identifier using + ft_notice last + + You can query the current on/off/once state for all messages using + ft_notice query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/ft_notice.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_notice", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_ft_notification.py b/fieldtrip/__connectivity/_ft_notification.py new file mode 100644 index 0000000..be5c5cd --- /dev/null +++ b/fieldtrip/__connectivity/_ft_notification.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _ft_notification(*args, **kwargs): + """ + FT_NOTIFICATION works mostly like the WARNING and ERROR commands in MATLAB and + is called by FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO and FT_DEBUG. Please note + that you should not call this function directly. + + Some examples: + ft_info on + ft_info on msgId + ft_info off + ft_info off msgId + ft_info once + ft_info once msgId + ft_info on backtrace + ft_info off backtrace + ft_info on verbose + ft_info off verbose + + ft_info query % shows the status of all notifications + ft_info last % shows the last notification + ft_info clear % clears the status of all notifications + ft_info timeout 10 % sets the timeout (for 'once') to 10 seconds + + See also DEFAULTID, FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/ft_notification.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_notification", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_ft_platform_supports.py b/fieldtrip/__connectivity/_ft_platform_supports.py new file mode 100644 index 0000000..ac998b8 --- /dev/null +++ b/fieldtrip/__connectivity/_ft_platform_supports.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def _ft_platform_supports(*args, **kwargs): + """ + FT_PLATFORM_SUPPORTS returns a boolean indicating whether the current platform + supports a specific capability + + Use as + status = ft_platform_supports(what) + or + status = ft_platform_supports('matlabversion', min_version, max_version) + + The following values are allowed for the 'what' parameter, which means means that + the specific feature explained on the right is supported: + + 'which-all' which(...,'all') + 'exists-in-private-directory' exists(...) will look in the /private subdirectory to see if a file exists + 'onCleanup' onCleanup(...) + 'alim' alim(...) + 'int32_logical_operations' bitand(a,b) with a, b of type int32 + 'graphics_objects' graphics system is object-oriented + 'libmx_c_interface' libmx is supported through mex in the C-language (recent MATLAB versions only support C++) + 'images' all image processing functions in FieldTrip's external/images directory + 'signal' all signal processing functions in FieldTrip's external/signal directory + 'stats' all statistical functions in FieldTrip's external/stats directory + 'program_invocation_name' program_invocation_name() (GNU Octave) + 'singleCompThread' start MATLAB with -singleCompThread + 'nosplash' start MATLAB with -nosplash + 'nodisplay' start MATLAB with -nodisplay + 'nojvm' start MATLAB with -nojvm + 'no-gui' start GNU Octave with --no-gui + 'RandStream.setGlobalStream' RandStream.setGlobalStream(...) + 'RandStream.setDefaultStream' RandStream.setDefaultStream(...) + 'rng' rng(...) + 'rand-state' rand('state') + 'urlread-timeout' urlread(..., 'Timeout', t) + 'griddata-vector-input' griddata(...,...,...,a,b) with a and b vectors + 'griddata-v4' griddata(...,...,...,...,...,'v4') with v4 interpolation support + 'uimenu' uimenu(...) + 'weboptions' weboptions(...) + 'parula' parula(...) + 'datetime' datetime structure + 'html' html rendering in desktop + + See also FT_VERSION, VERSION, VER, VERLESSTHAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/ft_platform_supports.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_platform_supports", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_ft_progress.py b/fieldtrip/__connectivity/_ft_progress.py new file mode 100644 index 0000000..57be1e8 --- /dev/null +++ b/fieldtrip/__connectivity/_ft_progress.py @@ -0,0 +1,63 @@ +from fieldtrip._runtime import Runtime + + +def _ft_progress(*args, **kwargs): + """ + FT_PROGRESS shows a graphical or non-graphical progress indication similar to the + standard WAITBAR function, but with the extra option of printing it in the command + window as a plain text string or as a rotating dial. Alternatively, you can also + specify it not to give feedback on the progress. + + Prior to the for-loop, you should call either + ft_progress('init', 'none', 'Please wait...') + ft_progress('init', 'text', 'Please wait...') + ft_progress('init', 'textbar', 'Please wait...') % ascii progress bar + ft_progress('init', 'dial', 'Please wait...') % rotating dial + ft_progress('init', 'etf', 'Please wait...') % estimated time to finish + ft_progress('init', 'gui', 'Please wait...') + + In each iteration of the for-loop, you should call either + ft_progress(x) % only show percentage + ft_progress(x, 'Processing event %d from %d', i, N) % show string, x=i/N + + After finishing the for-loop, you should call + ft_progress('close') + + Here is an example for the use of a progress indicator + ft_progress('init', 'etf', 'Please wait...'); + for i=1:100 + ft_progress(i/100, 'Processing event %d from %d', i, 100); + pause(0.03); + end + ft_progress('close') + + See also WAITBAR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/ft_progress.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_progress", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__connectivity/_ft_version.py b/fieldtrip/__connectivity/_ft_version.py new file mode 100644 index 0000000..1f3fbb4 --- /dev/null +++ b/fieldtrip/__connectivity/_ft_version.py @@ -0,0 +1,69 @@ +from fieldtrip._runtime import Runtime + + +def _ft_version(*args, **kwargs): + """ + FT_VERSION returns the version of FieldTrip and the path where it is installed + + FieldTrip is not released with version numbers as "2.0", "2.1", etc. Instead, we + share our development version on http://github.com/fieldtrip/fieldtrip. You can use + git to make a local clone of the development version. Furthermore, we make + more-or-less daily releases of the code available on + https://github.com/fieldtrip/fieldtrip/releases and as zip file on our FTP server. + + If you use git with the development version, the version is labeled with the hash + of the latest commit like "128c693". You can access the specific version "XXXXXX" + at https://github.com/fieldtrip/fieldtrip/commit/XXXXXX. + + If you download the daily released version from our FTP server, the version is part + of the file name "fieldtrip-YYYYMMDD.zip", where YYY, MM and DD correspond to year, + month and day. + + Use as + ft_version + to display the latest revision number on screen, or + [ftver, ftpath] = ft_version + to get the version and the installation root directory. + + When using git with the development version, you can also get additional information with + ft_version revision + ft_version branch + ft_version clean + + On macOS you might have installed git along with Xcode instead of with homebrew, + which then requires that you agree to the Apple license. In that case it can + happen that this function stops, as in the background (invisible to you) it is + asking whether you agree. You can check this by typing "/usr/bin/git", which will + show the normal help message, or which will mention the license agreement. To + resolve this please open a terminal and type "sudo xcodebuild -license" + + See also FT_PLATFORM_SUPPORTS, VERSION, VER, VERLESSTHAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/ft_version.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_version", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_ft_warning.py b/fieldtrip/__connectivity/_ft_warning.py new file mode 100644 index 0000000..315fd60 --- /dev/null +++ b/fieldtrip/__connectivity/_ft_warning.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def _ft_warning(*args, **kwargs): + """ + FT_WARNING prints a warning message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. This function works + similar to the standard WARNING function, but also features the "once" mode. + + Use as + ft_warning(...) + with arguments similar to fprintf, or + ft_warning(msgId, ...) + with arguments similar to warning. + + You can switch of all warning messages using + ft_warning off + or for specific ones using + ft_warning off msgId + + To switch them back on, you would use + ft_warning on + or for specific ones using + ft_warning on msgId + + Warning messages are only printed once per timeout period using + ft_warning timeout 60 + ft_warning once + or for specific ones using + ft_warning once msgId + + You can see the most recent messages and identifier using + ft_warning last + + You can query the current on/off/once state for all messages using + ft_warning query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/ft_warning.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_warning", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_getsubfield.py b/fieldtrip/__connectivity/_getsubfield.py new file mode 100644 index 0000000..498a9ce --- /dev/null +++ b/fieldtrip/__connectivity/_getsubfield.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _getsubfield(*args, **kwargs): + """ + GETSUBFIELD returns a field from a structure just like the standard + GETFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = getsubfield(s, 'fieldname') + or as + f = getsubfield(s, 'fieldname.subfieldname') + + See also GETFIELD, ISSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/getsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getsubfield", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_inv2x2.py b/fieldtrip/__connectivity/_inv2x2.py new file mode 100644 index 0000000..3db8433 --- /dev/null +++ b/fieldtrip/__connectivity/_inv2x2.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _inv2x2(*args, **kwargs): + """ + INV2X2 computes inverse of matrix x, using explicit analytic definition + if size(x,1) < 4, otherwise use MATLAB inv-function + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/inv2x2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("inv2x2", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_inv3x3.py b/fieldtrip/__connectivity/_inv3x3.py new file mode 100644 index 0000000..8cae596 --- /dev/null +++ b/fieldtrip/__connectivity/_inv3x3.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _inv3x3(*args, **kwargs): + """ + INV3X3 computes inverse of matrix x, using explicit analytic definition + if size(x) = [3 3 K M] + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/inv3x3.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("inv3x3", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_issubfield.py b/fieldtrip/__connectivity/_issubfield.py new file mode 100644 index 0000000..a58c9cf --- /dev/null +++ b/fieldtrip/__connectivity/_issubfield.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _issubfield(*args, **kwargs): + """ + ISSUBFIELD tests for the presence of a field in a structure just like the standard + Matlab ISFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = issubfield(s, 'fieldname') + or as + f = issubfield(s, 'fieldname.subfieldname') + + This function returns true if the field is present and false if the field + is not present. + + See also ISFIELD, GETSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/issubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("issubfield", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_istrue.py b/fieldtrip/__connectivity/_istrue.py new file mode 100644 index 0000000..178c48f --- /dev/null +++ b/fieldtrip/__connectivity/_istrue.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _istrue(*args, **kwargs): + """ + ISTRUE converts an input argument like "yes/no", "true/false" or "on/off" into a + boolean. If the input is boolean, then it will remain like that. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/istrue.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("istrue", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_keyval.py b/fieldtrip/__connectivity/_keyval.py new file mode 100644 index 0000000..231d532 --- /dev/null +++ b/fieldtrip/__connectivity/_keyval.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _keyval(*args, **kwargs): + """ + KEYVAL returns the value that corresponds to the requested key in a + key-value pair list of variable input arguments + + Use as + [val] = keyval(key, varargin) + + See also VARARGIN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/keyval.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("keyval", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_mtimes2x2.py b/fieldtrip/__connectivity/_mtimes2x2.py new file mode 100644 index 0000000..6563707 --- /dev/null +++ b/fieldtrip/__connectivity/_mtimes2x2.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _mtimes2x2(*args, **kwargs): + """ + MTIMES2X2 compute x*y where the dimensionatity is 2x2xN or 2x2xNxM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/mtimes2x2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mtimes2x2", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_mtimes3x3.py b/fieldtrip/__connectivity/_mtimes3x3.py new file mode 100644 index 0000000..f11ae0f --- /dev/null +++ b/fieldtrip/__connectivity/_mtimes3x3.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _mtimes3x3(*args, **kwargs): + """ + MTIMES3X3 compute x*y where the dimensionatity is 3x3xN or 3x3xNxM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/mtimes3x3.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mtimes3x3", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_multivariate_decomp.py b/fieldtrip/__connectivity/_multivariate_decomp.py new file mode 100644 index 0000000..1962191 --- /dev/null +++ b/fieldtrip/__connectivity/_multivariate_decomp.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def _multivariate_decomp(*args, **kwargs): + """ + MULTIVARIATE_DECOMP does a linear decomposition of multivariate time series, + based on the covariance matrix. + + Use as: + [E, D] = multivariate_decomp(C,x,y,method) + + Input arguments: + C = covariance matrix (or csd) between input time series + x = list of indices corresponding to group 1 + y = list of indices corresponding to group 2 + method = 'cca', or 'pls', 'mlr', decomposition method + (canonical correlation partial least squares, or multivariate + linear regression). In the case of mlr-like decompositions, + the indices for x reflect the independent variable) + realflag = true (default) or false. Do the operation on the real part + of the matrix if the input matrix is complex-valued + fastflag = true (default) or false. Compute the solution without an + eigenvalue decomposition (only when numel(x)==1) + + The implementation is based on Borga 2001, Canonical correlation, a + tutorial (can be found online). + + Output arguments: + E = projection matrix (not necessarily normalized). to get the orientation, + do orix = E(x,1)./norm(E(x,1)), and oriy = E(y,1)./norm(E(y,1)); + D = diagonal matrix with eigenvalues + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/multivariate_decomp.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("multivariate_decomp", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_rmsubfield.py b/fieldtrip/__connectivity/_rmsubfield.py new file mode 100644 index 0000000..db5db63 --- /dev/null +++ b/fieldtrip/__connectivity/_rmsubfield.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _rmsubfield(*args, **kwargs): + """ + RMSUBFIELD removes the contents of the specified field from a structure + just like the standard Matlab RMFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = rmsubfield(s, 'fieldname') + or as + s = rmsubfield(s, 'fieldname.subfieldname') + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/rmsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rmsubfield", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_sandwich2x2.py b/fieldtrip/__connectivity/_sandwich2x2.py new file mode 100644 index 0000000..d3a527b --- /dev/null +++ b/fieldtrip/__connectivity/_sandwich2x2.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _sandwich2x2(*args, **kwargs): + """ + SANDWICH2X2 compute x*y*x' provided y is Hermitian and dimensionality is 2x2xN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/sandwich2x2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sandwich2x2", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_sandwich3x3.py b/fieldtrip/__connectivity/_sandwich3x3.py new file mode 100644 index 0000000..8de72df --- /dev/null +++ b/fieldtrip/__connectivity/_sandwich3x3.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _sandwich3x3(*args, **kwargs): + """ + SANDWICH3X3 compute x*y*x' provided y is Hermitian and dimensionality is 3x3xN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/sandwich3x3.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sandwich3x3", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_setsubfield.py b/fieldtrip/__connectivity/_setsubfield.py new file mode 100644 index 0000000..9802aa4 --- /dev/null +++ b/fieldtrip/__connectivity/_setsubfield.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _setsubfield(*args, **kwargs): + """ + SETSUBFIELD sets the contents of the specified field to a specified value + just like the standard Matlab SETFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = setsubfield(s, 'fieldname', value) + or as + s = setsubfield(s, 'fieldname.subfieldname', value) + + where nested is a logical, false denoting that setsubfield will create + s.subfieldname instead of s.fieldname.subfieldname + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/setsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("setsubfield", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_sfactorization_wilson.py b/fieldtrip/__connectivity/_sfactorization_wilson.py new file mode 100644 index 0000000..91f5ecd --- /dev/null +++ b/fieldtrip/__connectivity/_sfactorization_wilson.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def _sfactorization_wilson(*args, **kwargs): + """ + SFACTORIZATION_WILSON performs multivariate non-parametric spectral factorization on + cross-spectra, based on Wilson's algorithm. + + Usage : [H, Z, S, psi] = sfactorization_wilson(S,freq); + + Inputs : S (1-sided, 3D-spectral matrix in the form of Channel x Channel x frequency) + : freq (a vector of frequencies) at which S is given. + + Outputs: H (transfer function) + : Z (noise covariance) + : psi (left spectral factor) + + This function is an implemention of Wilson's algorithm (Eq. 3.1) + for spectral matrix factorization + + Ref: G.T. Wilson,"The Factorization of Matricial Spectral Densities," + SIAM J. Appl. Math.23,420-426(1972). + Written by M. Dhamala & G. Rangarajan, UF, Aug 3-4, 2006. + Email addresses: mdhamala@bme.ufl.edu, rangaraj@math.iisc.ernet.in + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/sfactorization_wilson.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sfactorization_wilson", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_sfactorization_wilson2x2.py b/fieldtrip/__connectivity/_sfactorization_wilson2x2.py new file mode 100644 index 0000000..529095a --- /dev/null +++ b/fieldtrip/__connectivity/_sfactorization_wilson2x2.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def _sfactorization_wilson2x2(*args, **kwargs): + """ + SFACTORIZATION_WILSON2X2 performs pairwise non-parametric spectral factorization on + cross-spectra, based on Wilson's algorithm. + + Usage : [H, Z, psi] = sfactorization_wilson(S,freq); + + Inputs : S (1-sided, 3D-spectral matrix in the form of Channel x Channel x frequency) + : freq (a vector of frequencies) at which S is given. + + Outputs: H (transfer function) + : Z (noise covariance) + : S (cross-spectral density 1-sided) + : psi (left spectral factor) + + This function is an implemention of Wilson's algorithm (Eq. 3.1) + for spectral matrix factorization. + + Ref: G.T. Wilson,"The Factorization of Matricial Spectral Densities," + SIAM J. Appl. Math.23,420-426(1972). + Written by M. Dhamala & G. Rangarajan, UF, Aug 3-4, 2006. + Email addresses: mdhamala@bme.ufl.edu, rangaraj@math.iisc.ernet.in + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/sfactorization_wilson2x2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sfactorization_wilson2x2", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_sfactorization_wilson3x3.py b/fieldtrip/__connectivity/_sfactorization_wilson3x3.py new file mode 100644 index 0000000..5d64175 --- /dev/null +++ b/fieldtrip/__connectivity/_sfactorization_wilson3x3.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def _sfactorization_wilson3x3(*args, **kwargs): + """ + SFACTORIZATION_WILSON3X3 performs triplet-wise non-parametric spectral factorization on + cross-spectra, based on Wilson's algorithm. + + Usage : [H, Z, psi] = sfactorization_wilson(S,freq); + + Inputs : S (1-sided, 3D-spectral matrix in the form of Channel x Channel x frequency) + : freq (a vector of frequencies) at which S is given. + + Outputs: H (transfer function) + : Z (noise covariance) + : S (cross-spectral density 1-sided) + : psi (left spectral factor) + + This function is an implemention of Wilson's algorithm (Eq. 3.1) + for spectral matrix factorization. + + Ref: G.T. Wilson,"The Factorization of Matricial Spectral Densities," + SIAM J. Appl. Math.23,420-426(1972). + Written by M. Dhamala & G. Rangarajan, UF, Aug 3-4, 2006. + Email addresses: mdhamala@bme.ufl.edu, rangaraj@math.iisc.ernet.in + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/sfactorization_wilson3x3.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sfactorization_wilson3x3", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_standardise.py b/fieldtrip/__connectivity/_standardise.py new file mode 100644 index 0000000..e3b6504 --- /dev/null +++ b/fieldtrip/__connectivity/_standardise.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _standardise(*args, **kwargs): + """ + STANDARDISE computes the zscore of a matrix along dimension dim + has similar functionality as the stats-toolbox's zscore function + + Use as + x = standardise(x, dim) + + See also ZSCORE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/standardise.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("standardise", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_transfer2coeffs.py b/fieldtrip/__connectivity/_transfer2coeffs.py new file mode 100644 index 0000000..e51cf76 --- /dev/null +++ b/fieldtrip/__connectivity/_transfer2coeffs.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _transfer2coeffs(*args, **kwargs): + """ + TRANSFER2COEFFS converts a spectral transfer matrix into the time domain + equivalent multivariate autoregressive coefficients up to a specified + lag, starting from lag 1. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/transfer2coeffs.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("transfer2coeffs", *args, **kwargs) diff --git a/fieldtrip/__connectivity/_triplet_conditionalgranger.py b/fieldtrip/__connectivity/_triplet_conditionalgranger.py new file mode 100644 index 0000000..73bdb84 --- /dev/null +++ b/fieldtrip/__connectivity/_triplet_conditionalgranger.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _triplet_conditionalgranger(*args, **kwargs): + """ + TRIPLET_CONDITIONALGRANGER + + Inputs: + H3,Z3: transfer matrix, noise covariance for + triplets, 3x3(xtriplet)xnfreq + H2,Z2: transfer matrix, noise covariance for + duplets, 2x2(xnduplet)xnfreq + cmbindx: Nx3 indices determining the output, abc = b->a/c + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/private/triplet_conditionalgranger.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("triplet_conditionalgranger", *args, **kwargs) diff --git a/fieldtrip/__connectivity/ft_connectivity_cancorr.py b/fieldtrip/__connectivity/ft_connectivity_cancorr.py new file mode 100644 index 0000000..9e568f4 --- /dev/null +++ b/fieldtrip/__connectivity/ft_connectivity_cancorr.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def ft_connectivity_cancorr(*args, **kwargs): + """ + FT_CONNECTIVITY_CANCORR computes the canonical correlation or canonical coherence + between multiple variables. Canonical correlation analysis (CCA) is a way of + measuring the linear relationship between two multidimensional variables. It finds + two bases, one for each variable, that are optimal with respect to correlations + and, at the same time, it finds the corresponding correlations. + + Use as + [R] = ft_connectivity_cancorr(inputdata, ...) + + The input data should be a covariance or cross-spectral density array organized as + Channel x Channel + or + Channel x Channel (x Frequency) + + The output R represents the max(indices)*max(indices) canonical correlation matrix + or canonical coherence matrix. + + Additional optional input arguments come as key-value pairs: + 'indices' = 1xNchan vector with indices of the groups to which the channels belong, + e.g. [1 1 2 2] for a 2-by-2 connectivity between 2 planar MEG channels + 'realflag' = boolean flag whether to use the real-valued part only for the determination + of the rotation (default = false) + + See also CONNECTIVITY, FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/ft_connectivity_cancorr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_connectivity_cancorr", *args, **kwargs) diff --git a/fieldtrip/__connectivity/ft_connectivity_corr.py b/fieldtrip/__connectivity/ft_connectivity_corr.py new file mode 100644 index 0000000..3268daa --- /dev/null +++ b/fieldtrip/__connectivity/ft_connectivity_corr.py @@ -0,0 +1,90 @@ +from fieldtrip._runtime import Runtime + + +def ft_connectivity_corr(*args, **kwargs): + """ + FT_CONNECTIVITY_CORR computes correlation, coherence or a related quantity from a + data-matrix containing a covariance or cross-spectral density. This implements the + methods as described in the following papers: + + Coherence: Rosenberg et al, The Fourier approach to the identification of + functional coupling between neuronal spike trains. Prog Biophys Molec + Biol 1989; 53; 1-31 + + Partial coherence: Rosenberg et al, Identification of patterns of + neuronal connectivity - partial spectra, partial coherence, and neuronal + interactions. J. Neurosci. Methods, 1998; 83; 57-72 + + Phase locking value: Lachaux et al, Measuring phase sychrony in brain + signals. Human Brain Mapping, 1999; 8; 194-208. + + Imaginary part of coherency: Nolte et al, Identifying true brain + interaction from EEG data using the imaginary part of coherence. Clinical + Neurophysiology, 2004; 115; 2292-2307 + + Use as + [c, v, n] = ft_connectivity_corr(inputdata, ...) + + The input data should be a covariance or cross-spectral density array organized as + Repetitions x Channel x Channel (x Frequency) (x Time) + or + Repetitions x Channelcombination (x Frequency) (x Time) + + If the input already contains an average, the first dimension must be singleton. + Furthermore, the input data can be complex-valued cross spectral densities, or + real-valued covariance estimates. If the former is the case, the output will be + coherence (or a derived metric), if the latter is the case, the output will be the + correlation coefficient. + + The output represents + c = the correlation/coherence + v = variance estimate, this can only be computed if the data contains leave-one-out samples + n = the number of repetitions in the input data + + Additional optional input arguments come as key-value pairs: + 'dimord' = string, specifying how the input matrix should be interpreted + 'hasjack' = boolean flag that specifies whether the repetitions represent leave-one-out samples + 'complex' = 'abs', 'angle', 'real', 'imag', 'complex', 'logabs' for post-processing of coherency + 'powindx' = required if the input data contain linearly indexed channel pairs. This + should be an Nx2 matrix indexing on each row for the respective channel + pair the indices of the corresponding auto-spectra. + 'pownorm' = boolean flag that specifies whether normalisation with the product + of the power should be performed (thus should be true when + correlation/coherence is requested, and false when covariance + or cross-spectral density is requested). + 'feedback' = 'none', 'text', 'textbar', 'dial', 'etf', 'gui' type of feedback showing progress of computation, see FT_PROGRESS + + Partialisation can be performed when the input data is (chan x chan). The following + option needs to be specified: + 'pchanindx' = index-vector to the channels that need to be partialised + + See also CONNECTIVITY, FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/ft_connectivity_corr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_connectivity_corr", *args, **kwargs) diff --git a/fieldtrip/__connectivity/ft_connectivity_csd2transfer.py b/fieldtrip/__connectivity/ft_connectivity_csd2transfer.py new file mode 100644 index 0000000..2fcf011 --- /dev/null +++ b/fieldtrip/__connectivity/ft_connectivity_csd2transfer.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def ft_connectivity_csd2transfer(*args, **kwargs): + """ + FT_CONNECTIVITY_CSD2TRANSFER computes the transfer-function from frequency domain + data using the Wilson-Burg algorithm. The transfer function can be used for the + computation of directional measures of connectivity, such as Granger causality, + partial directed coherence, or directed transfer functions. + + Use as + [output] = ft_connectivity_csd2transfer(freq, ...) + + The input variable freq should be a FieldTrip data structure containing frequency + domain data containing the cross-spectral density computed between all pairs of + channels, thus containing a 'dimord' of 'chan_chan_freq(_time)'. + + Additional optional input arguments come as key-value pairs: + numiteration = scalar value (default: 100) the number of iterations + channelcmb = Nx2 cell-array listing the channel pairs for the spectral + factorization. If not defined or empty (default), a + full multivariate factorization is performed, otherwise + a multiple pairwise factorization is done. + tol = scalar value (default: 1e-18) tolerance limit truncating + the iterations + sfmethod = 'multivariate', or 'bivariate' + stabilityfix = false, or true. zigzag-reduction by means of tapering of the + intermediate time domain representation when computing the + plusoperator + + The code for the Wilson-Burg algorithm has been very generously provided by Dr. + Mukesh Dhamala, and Prof. Mingzhou Ding and his group, and has been adjusted for + efficiency. If you use this code for studying directed interactions, please cite + the following references: + - M.Dhamala, R.Rangarajan, M.Ding, Physical Review Letters 100, 018701 (2008). + - M.Dhamala, R.Rangarajan, M.Ding, Neuroimage 41, 354 (2008). + + See also FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/ft_connectivity_csd2transfer.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_connectivity_csd2transfer", *args, **kwargs) diff --git a/fieldtrip/__connectivity/ft_connectivity_dtf.py b/fieldtrip/__connectivity/ft_connectivity_dtf.py new file mode 100644 index 0000000..765a7cf --- /dev/null +++ b/fieldtrip/__connectivity/ft_connectivity_dtf.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def ft_connectivity_dtf(*args, **kwargs): + """ + FT_CONNECTIVITY_DTF computes the directed transfer function. + + Use as + [d, v, n] = ft_connectivity_dtf(inputdata, ...) + + The input should be a spectral transfer matrix organized as + Nrpt x Nchan x Nchan x Nfreq (x Ntime) + where Nrpt can be 1. + + The output represents + d = partial directed coherence matrix Nchan x Nchan x Nfreq (x Ntime). + If multiple observations in the input, the average is returned. + v = variance of d across observations. + n = number of observations. + + Typically, nrpt should be 1 where the spectral transfer matrix is computed across + observations. When nrpt>1 and hasjack=true, the input is assumed to contain the + leave-one-out estimates of the spectral transfer matrix, thus a more reliable + estimate of the relevant quantities. + + Additional optional input arguments come as key-value pairs: + 'hasjack' = boolean, specifying whether the input contains leave-one-outs, + required for correct variance estimate (default = false) + 'crsspctrm' = matrix containing the cross-spectral density. If this + matrix is defined, the function returns the ddtf, which + requires an estimation of partial coherence from this matrix. + 'invfun' = 'inv' (default) or 'pinv', the function used to invert the + crsspctrm matrix to obtain the partial coherence. Pinv is + useful if the data are poorly-conditioned. + 'feedback' = 'none', 'text', 'textbar', 'dial', 'etf', 'gui' type of feedback showing progress of computation, see FT_PROGRESS + + See also CONNECTIVITY, FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/ft_connectivity_dtf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_connectivity_dtf", *args, **kwargs) diff --git a/fieldtrip/__connectivity/ft_connectivity_granger.py b/fieldtrip/__connectivity/ft_connectivity_granger.py new file mode 100644 index 0000000..635cb07 --- /dev/null +++ b/fieldtrip/__connectivity/ft_connectivity_granger.py @@ -0,0 +1,74 @@ +from fieldtrip._runtime import Runtime + + +def ft_connectivity_granger(*args, **kwargs): + """ + FT_CONNECTIVITY_GRANGER computes spectrally resolved granger causality. This + implementation is loosely based on the code used in Brovelli, et. al., PNAS 101, + 9849-9854 (2004). + + Use as + [granger, v, n] = ft_connectivity_granger(H, Z, S, ...) + + The input data should be + H = spectral transfer matrix, Nrpt x Nchan x Nchan x Nfreq (x Ntime), + or Nrpt x Nchancmb x Nfreq (x Ntime). Nrpt can be 1. + Z = the covariance matrix of the noise, Nrpt x Nchan x Nchan (x Ntime), + or Nrpt x Nchancmb (x Ntime). + S = the cross-spectral density matrix with the same dimensionality as H. + + Additional optional input arguments come as key-value pairs: + 'dimord' = required string specifying how to interpret the input data + supported values are 'rpt_chan_chan_freq(_time) and + 'rpt_chan_freq(_time), 'rpt_pos_pos_freq(_time)' and + 'rpt_pos_freq(_time)' + 'method' = 'granger' (default), or 'instantaneous', or 'total' + 'hasjack' = boolean, specifying whether the input contains leave-one-outs, + required for correct variance estimate (default = false) + 'powindx' = is a variable determining the exact computation, see below + + If the inputdata is such that the channel-pairs are linearly indexed, granger + causality is computed per quadruplet of consecutive entries, where the convention + is as follows: + + H(:, (k-1)*4 + 1, :, :, :) -> 'chan1-chan1' + H(:, (k-1)*4 + 2, :, :, :) -> 'chan1->chan2' + H(:, (k-1)*4 + 3, :, :, :) -> 'chan2->chan1' + H(:, (k-1)*4 + 4, :, :, :) -> 'chan2->chan2' + + The same holds for the Z and S matrices. + + Pairwise block-granger causality can be computed when the inputdata has + dimensionality Nchan x Nchan. In that case 'powindx' should be specified, as a 1x2 + cell-array indexing the individual channels that go into each 'block'. + + See also CONNECTIVITY, FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/ft_connectivity_granger.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_connectivity_granger", *args, **kwargs) diff --git a/fieldtrip/__connectivity/ft_connectivity_mim.py b/fieldtrip/__connectivity/ft_connectivity_mim.py new file mode 100644 index 0000000..d722bdb --- /dev/null +++ b/fieldtrip/__connectivity/ft_connectivity_mim.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def ft_connectivity_mim(*args, **kwargs): + """ + FT_CONNECTIVITY_MIM computes the multivariate interaction measure from a + data-matrix containing the cross-spectral density. This implements the method + described in Ewald et al., Estimating true brain connectivity from EEG/MEG data + invariant to linear and static trasformations in sensor space. Neuroimage, 2012; + 476:488. + + Use as + [m] = hcp_connectivity_mim(inputdata, ...) + + The input data should be an array organized as + Channel x Channel x Frequency + + The output m contains the newChannel x newChannel x Frequency connectivity measure, + with newChannel equal to max(indices). + + Additional optional input arguments come as key-value pairs: + 'indices' = 1xN vector with indices of the groups to which the channels belong, + e.g. [1 1 2 2] for a 2-by-2 connectivity between 2 planar MEG channels. + + + See also CONNECTIVITY, FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/ft_connectivity_mim.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_connectivity_mim", *args, **kwargs) diff --git a/fieldtrip/__connectivity/ft_connectivity_mutualinformation.py b/fieldtrip/__connectivity/ft_connectivity_mutualinformation.py new file mode 100644 index 0000000..bf6b84f --- /dev/null +++ b/fieldtrip/__connectivity/ft_connectivity_mutualinformation.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def ft_connectivity_mutualinformation(*args, **kwargs): + """ + FT_CONNECTIVITY_MUTUALINFORMATION computes mutual information using either the + information breakdown toolbox (ibtb), as described in Magri et al., BMC + Neuroscience 2009, 1471-2202, or Robin Ince's Gaussian copula based parametric + approach (gcmi). + + Use as + mi = ft_connectivity_mutualinformation(inputdata, ...) + + The input data should be a Nchan x Nobservations matrix. + + The output mi contains the estimated mutual information between all channels and + the reference channels. + + Additional input arguments come as key-value pairs: + method = string, 'ibtb' or 'gcmi' (default = 'gcmi') + + The default method has changed from 'ibtb' to 'gcmi' in December 2022. The former method + is based on an external toolbox that is not actively supported anymore. Moreover, the + Gaussian-Copula based Mutual Information does not depend on a binning strategy, and may + provide reasonable results also in the presence of low amounts of data. The change in + default reflects the default defined in ft_connectivityanalysis. + + Additional input arguments for the 'ibtb' method: + 'histmethod' = The way that histograms are generated from the data. Possible values + are 'eqpop' (default), 'eqspace', 'ceqspace', 'gseqspace'. + See the help of the 'binr' function in the ibtb toolbox for more information. + 'numbin' = scalar value. The number of bins used to create the histograms needed for + the entropy computations + 'opts' = structure that is passed on to the 'information' function in the ibtb + toolbox. See the help of that function for more information. + 'refindx' = scalar value or 'all'. The channel that is used as 'reference channel'. + + See also CONNECTIVITY, FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/ft_connectivity_mutualinformation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_connectivity_mutualinformation", *args, **kwargs) diff --git a/fieldtrip/__connectivity/ft_connectivity_pdc.py b/fieldtrip/__connectivity/ft_connectivity_pdc.py new file mode 100644 index 0000000..c62caec --- /dev/null +++ b/fieldtrip/__connectivity/ft_connectivity_pdc.py @@ -0,0 +1,74 @@ +from fieldtrip._runtime import Runtime + + +def ft_connectivity_pdc(*args, **kwargs): + """ + FT_CONNECTIVITY_PDC computes partial directed coherence. This function implements + the metrices described in Baccala et al., Biological Cybernetics 2001, 84(6), + 463-74. and in Baccala et al., 15th Int.Conf.on DSP 2007, 163-66. + + The implemented algorithm has been tested against the implementation in the + SIFT-toolbox. It yields numerically identical results to what is known there as + 'nPDC' (for PDC) and 'GPDC' for generalized pdc. + + Use as + [p, v, n] = ft_connectivity_pdc(inputdata, ...) + + The input data should be a spectral transfer matrix organized as + Nrpt x Nchan x Nchan x Nfreq (x Ntime), + where Nrpt can be 1. + + Additional optional input arguments come as key-value pairs: + 'hasjack' = 0 (default) is a boolean specifying whether the input + contains leave-one-outs, required for correct variance + estimate + 'invfun' = 'inv' (default) or 'pinv', the function used to invert the + transfer matrix to obtain the fourier transform of the + MVAR coefficients. Use 'pinv' if the data are + poorly-conditioned. + 'noisecov' = matrix containing the covariance of the residuals of the + MVAR model. If this matrix is defined, the function + returns the generalized partial directed coherence. + 'feedback' = 'none', 'text', 'textbar', 'dial', 'etf', 'gui' type of feedback showing progress of computation, see FT_PROGRESS + + Output arguments: + p = partial directed coherence matrix Nchan x Nchan x Nfreq (x Ntime). + If multiple observations in the input, the average is returned. + v = variance of p across observations. + n = number of observations. + + Typically, nrpt should be 1 (where the spectral transfer matrix is + computed across observations. When nrpt>1 and hasjack is true the input + is assumed to contain the leave-one-out estimates of H, thus a more + reliable estimate of the relevant quantities. + + See also CONNECTIVITY, FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/ft_connectivity_pdc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_connectivity_pdc", *args, **kwargs) diff --git a/fieldtrip/__connectivity/ft_connectivity_plm.py b/fieldtrip/__connectivity/ft_connectivity_plm.py new file mode 100644 index 0000000..c4cdb1d --- /dev/null +++ b/fieldtrip/__connectivity/ft_connectivity_plm.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def ft_connectivity_plm(*args, **kwargs): + """ + FT_CONNECTIVITY_PLM computes the phase linearity measurement from a cell array of + time-domain data, where each cell is an epoch. This implements the metric described + in Baselice et al. "Phase Linearity Measurement: a novel index for brain functional + connectivity", IEEE Transactions on Medical Imaging, 2018. + + Use as + [p] = ft_connectivity_plm(inputdata, ...) + + The input data input should be organized as a cell-array, one element for each + epoch/repetition. Each cell should be a matrix of of nchan x nsamples values. + + Additional optional input arguments come as key-value pairs: + 'bandwidth' = scalar, half-bandwidth parameter: the frequency range across which to integrate + 'fsample' = sampling frequency, needed to convert bandwidth to number of bins + + The output p contains the phase linearity measurement in the [0, 1] interval. It is + organized as a 3D matrix of Nrpt x Nchan x Nchan dimensions. + + See also CONNECTIVITY, FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/ft_connectivity_plm.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_connectivity_plm", *args, **kwargs) diff --git a/fieldtrip/__connectivity/ft_connectivity_powcorr_ortho.py b/fieldtrip/__connectivity/ft_connectivity_powcorr_ortho.py new file mode 100644 index 0000000..9cb78cd --- /dev/null +++ b/fieldtrip/__connectivity/ft_connectivity_powcorr_ortho.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def ft_connectivity_powcorr_ortho(*args, **kwargs): + """ + FT_CONNECTIVITY_POWCORR_ORTHO computes power correlation after removing + the zero-lag contribution on a trial-by-trial basis, according to Hipp's + Nature Neuroscience paper. + + Use as + [c] = ft_connectivity_powcorr(inputdata, ...) + + Where the input is a Nchan*Nrpt matrix containing the complex-valued amplitude + and phase information at a given frequency. + + The output c is a Nchan*Nref matrix that contain the power correlation for all + channels orthogonalised relative to the reference channel in the first Nref + columns, and the power correlation for the reference channels orthogonalised + relative to the channels in the second Nref columns. + + Additional optional input arguments come as key-value pairs: + 'refindx' = index/indices of the channels that serve as a reference channel (default is all) + 'tapvec' = vector with the number of tapers per trial + + See also CONNECTIVITY, FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/ft_connectivity_powcorr_ortho.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_connectivity_powcorr_ortho", *args, **kwargs) diff --git a/fieldtrip/__connectivity/ft_connectivity_ppc.py b/fieldtrip/__connectivity/ft_connectivity_ppc.py new file mode 100644 index 0000000..5637888 --- /dev/null +++ b/fieldtrip/__connectivity/ft_connectivity_ppc.py @@ -0,0 +1,61 @@ +from fieldtrip._runtime import Runtime + + +def ft_connectivity_ppc(*args, **kwargs): + """ + FT_CONNECTIVITY_PPC computes pairwise phase consistency or weighted pairwise phase + consistency from a data-matrix containing a cross-spectral density. This implements + the method described in Vinck M, van Wingerden M, Womelsdorf T, Fries P, Pennartz + CM. The pairwise phase consistency: a bias-free measure of rhythmic neuronal + synchronization. Neuroimage. 2010 May 15;51(1):112-22. + + Use as + [c, v, n] = ft_connectivity_ppc(inputdata, ...) + + Where the input data input should be organized as: + Repetitions x Channel x Channel (x Frequency) (x Time) + or + Repetitions x Channelcombination (x Frequency) (x Time) + + The first dimension should contain repetitions and should not contain an average + already. Also, it should not consist of leave-one-out averages. + + The output c contains the ppc, v is a leave-one-out variance estimate which is only + computed if dojack = 1,and n is the number of repetitions in the input data. + + Additional optional input arguments come as key-value pairs: + 'dojack' = boolean specifying whether the repetitions represent leave-one-out samples + 'weighted' = boolean, whether to compute unweighted ppc or weighted ppc, the weighting + is according to the magnitude of the cross-spectrum + 'feedback' = 'none', 'text', 'textbar', 'dial', 'etf', 'gui' type of feedback showing progress of computation, see FT_PROGRESS + + See also CONNECTIVITY, FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/ft_connectivity_ppc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_connectivity_ppc", *args, **kwargs) diff --git a/fieldtrip/__connectivity/ft_connectivity_psi.py b/fieldtrip/__connectivity/ft_connectivity_psi.py new file mode 100644 index 0000000..25194f2 --- /dev/null +++ b/fieldtrip/__connectivity/ft_connectivity_psi.py @@ -0,0 +1,65 @@ +from fieldtrip._runtime import Runtime + + +def ft_connectivity_psi(*args, **kwargs): + """ + FT_CONNECTIVITY_PSI computes the phase slope index from a data-matrix containing + the cross-spectral density. This implements the method described in Nolte et al., + Robustly estimating the flow direction of information in complex physical systems. + Physical Review Letters, 2008; 100; 234101. + + Use as + [c, v, n] = ft_connectivity_psi(inputdata, ...) + + Where the input data input should be organized as + Repetitions x Channel x Channel (x Frequency) (x Time) + or + Repetitions x Channelcombination (x Frequency) (x Time) + + The first dimension should be singleton if the input already contains an + average. + + The output p contains the phase slope index, v is a variance estimate which only + can be computed if the data contains leave-one-out samples, and n is the number of + repetitions in the input data. If the phase slope index is positive, then the first + chan (1st dim) becomes more leading (or less lagged) with higher frequency, + indicating that it is causally driving the second channel (2nd dim). + + Additional optional input arguments come as key-value pairs: + 'nbin' = scalar, half-bandwidth parameter: the number of frequency bins across which to integrate + 'hasjack' = boolean, specifying whether the repetitions represent leave-one-out samples (allowing for a variance estimate) + 'feedback' = 'none', 'text', 'textbar', 'dial', 'etf', 'gui' type of feedback showing progress of computation, see FT_PROGRESS + 'dimord' = string, specifying how the input matrix should be interpreted + 'powindx' = ? + 'normalize' = ? + + See also CONNECTIVITY, FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/ft_connectivity_psi.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_connectivity_psi", *args, **kwargs) diff --git a/fieldtrip/__connectivity/ft_connectivity_wpli.py b/fieldtrip/__connectivity/ft_connectivity_wpli.py new file mode 100644 index 0000000..43ba9b1 --- /dev/null +++ b/fieldtrip/__connectivity/ft_connectivity_wpli.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def ft_connectivity_wpli(*args, **kwargs): + """ + FT_CONNECTIVITY_WPLI computes the weighted phase lag index from a data matrix + containing the cross-spectral density. This implements the method described in + Vinck M, Oostenveld R, van Wingerden M, Battaglia F, Pennartz CM. An improved index + of phase-synchronization for electrophysiological data in the presence of + volume-conduction, noise and sample-size bias. Neuroimage. 2011 Apr + 15;55(4):1548-65. + + Use as + [wpi, v, n] = ft_connectivity_wpli(inputdata, ...) + + The input data input should contain cross-spectral densities organized as: + Repetitions x Channel x Channel (x Frequency) (x Time) + or + Repetitions x Channelcombination (x Frequency) (x Time) + + Alternatively, the input data can contain fourier coefficients organized + as: + Repetitions_tapers x Channel (x Frequency) (x Time) + + The first dimension of the input data matrix should contain repetitions and should not + contain an average already. Also, the input should not consist of leave-one-out averages. + + The output wpli contains the wpli, v is a leave-one-out variance estimate + which is only computed if dojack=true, and n is the number of repetitions + in the input data. + + Additional optional input arguments come as key-value pairs: + 'dojack' = boolean, compute a variance estimate based on + leave-one-out, only supported when input data is a + bivariate cross-spectral density + 'debias' = boolean, compute debiased wpli or not + 'feedback' = 'none', 'text', 'textbar', 'dial', 'etf', 'gui' type of feedback + showing progress of computation, see FT_PROGRESS + 'isunivariate' = boolean, compute CSD on fly (saves memory with many trials) + 'cumtapcnt' = vector that contains the cumulative taper counter, defining how + tapers should be combined to define repetitions. If not + defined (or empty), it will be ones(size(input,1),1), + i.e. each slice of the matrix is considered a repetition. + This option is only function in case isunivariate = true + + See also FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/connectivity/ft_connectivity_wpli.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_connectivity_wpli", *args, **kwargs) diff --git a/fieldtrip/__contrib/__init__.py b/fieldtrip/__contrib/__init__.py new file mode 100644 index 0000000..8f04325 --- /dev/null +++ b/fieldtrip/__contrib/__init__.py @@ -0,0 +1,110 @@ +from .__misc import ft_icabrowser, ft_laggedcoherence, ft_nonlinearassociation +from .__nutmegtrip import ( + nmt_addtopo, + nmt_animate, + nmt_close, + nmt_image, + nmt_mni2mri, + nmt_mri2mni, + nmt_peaksearch, + nmt_peaksearch_helper, + nmt_polaritytweak, + nmt_reducerank, + nmt_repos, + nmt_sourceoriplot, + nmt_sourceplot, + nmt_spm_plot, + nmt_spm_write_deformationinv, + nmt_spmfig_setup, + nmt_svdtrunc, + nmt_svdtruncinv, + nmt_tbxdti_quiver3, + nmt_timeselect, + nmt_transform_coord, + spm_ov_quivernmt, +) +from .__spike import ( + ft_spike_isi, + ft_spike_jpsth, + ft_spike_maketrials, + ft_spike_plot_isi, + ft_spike_plot_isireturn, + ft_spike_plot_jpsth, + ft_spike_plot_psth, + ft_spike_plot_raster, + ft_spike_psth, + ft_spike_rate, + ft_spike_rate_orituning, + ft_spike_select, + ft_spike_waveform, + ft_spike_xcorr, + ft_spikedensity, + ft_spikedetection, + ft_spikedownsample, + ft_spikefixdmafile, + ft_spikesimulation, + ft_spikesorting, + ft_spikesplitting, + ft_spiketriggeredaverage, + ft_spiketriggeredinterpolation, + ft_spiketriggeredspectrum, + ft_spiketriggeredspectrum_convol, + ft_spiketriggeredspectrum_fft, + ft_spiketriggeredspectrum_stat, +) + + +__all__ = [ + "ft_icabrowser", + "ft_laggedcoherence", + "ft_nonlinearassociation", + "nmt_addtopo", + "nmt_animate", + "nmt_close", + "nmt_image", + "nmt_mni2mri", + "nmt_mri2mni", + "nmt_peaksearch", + "nmt_peaksearch_helper", + "nmt_polaritytweak", + "nmt_reducerank", + "nmt_repos", + "nmt_sourceoriplot", + "nmt_sourceplot", + "nmt_spm_plot", + "nmt_spm_write_deformationinv", + "nmt_spmfig_setup", + "nmt_svdtrunc", + "nmt_svdtruncinv", + "nmt_tbxdti_quiver3", + "nmt_timeselect", + "nmt_transform_coord", + "spm_ov_quivernmt", + "ft_spike_isi", + "ft_spike_jpsth", + "ft_spike_maketrials", + "ft_spike_plot_isi", + "ft_spike_plot_isireturn", + "ft_spike_plot_jpsth", + "ft_spike_plot_psth", + "ft_spike_plot_raster", + "ft_spike_psth", + "ft_spike_rate", + "ft_spike_rate_orituning", + "ft_spike_select", + "ft_spike_waveform", + "ft_spike_xcorr", + "ft_spikedensity", + "ft_spikedetection", + "ft_spikedownsample", + "ft_spikefixdmafile", + "ft_spikesimulation", + "ft_spikesorting", + "ft_spikesplitting", + "ft_spiketriggeredaverage", + "ft_spiketriggeredinterpolation", + "ft_spiketriggeredspectrum", + "ft_spiketriggeredspectrum_convol", + "ft_spiketriggeredspectrum_fft", + "ft_spiketriggeredspectrum_stat", +] diff --git a/fieldtrip/__contrib/__misc/__init__.py b/fieldtrip/__contrib/__misc/__init__.py new file mode 100644 index 0000000..c43da18 --- /dev/null +++ b/fieldtrip/__contrib/__misc/__init__.py @@ -0,0 +1,6 @@ +from .ft_icabrowser import ft_icabrowser +from .ft_laggedcoherence import ft_laggedcoherence +from .ft_nonlinearassociation import ft_nonlinearassociation + + +__all__ = ["ft_icabrowser", "ft_laggedcoherence", "ft_nonlinearassociation"] diff --git a/fieldtrip/__contrib/__misc/_ignorefields.py b/fieldtrip/__contrib/__misc/_ignorefields.py new file mode 100644 index 0000000..ba44908 --- /dev/null +++ b/fieldtrip/__contrib/__misc/_ignorefields.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _ignorefields(*args, **kwargs): + """ + IGNOREFIELDS returns a list of fields that can be present in the cfg structure that + should be ignored at various places in the code, e.g. for provenance, history, + size-checking, etc. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/misc/private/ignorefields.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ignorefields", *args, **kwargs) diff --git a/fieldtrip/__contrib/__misc/_rollback_provenance.py b/fieldtrip/__contrib/__misc/_rollback_provenance.py new file mode 100644 index 0000000..8e2467d --- /dev/null +++ b/fieldtrip/__contrib/__misc/_rollback_provenance.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _rollback_provenance(*args, **kwargs): + """ + ROLLBACK_PROVENANCE rolls the provenance one step back and should + be used whenever a FT function calls another FT function without + the user being (or having to be) aware of this. + + Some examples for use + + tmpcfg = []; + tmpcfg.downsample = cfg.downsample; % simply copy this option + tmpcfg.smooth = 'no'; % override the default for this option + mri = ft_volumedownsample(tmpcfg, mri); + [cfg, mri] = rollback_provenance(cfg, mri); + + tmpcfg = []; + tmpcfg.parameter = cfg.parameter; + [varargin{:}] = ft_selectdata(tmpcfg, varargin{:}); + [cfg, varargin{:}] = rollback_provenance(cfg, varargin{:}); + + See also FT_PREAMBLE, FT_POSTAMBLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/misc/private/rollback_provenance.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rollback_provenance", *args, **kwargs) diff --git a/fieldtrip/__contrib/__misc/ft_icabrowser.py b/fieldtrip/__contrib/__misc/ft_icabrowser.py new file mode 100644 index 0000000..e0cdfaa --- /dev/null +++ b/fieldtrip/__contrib/__misc/ft_icabrowser.py @@ -0,0 +1,80 @@ +from fieldtrip._runtime import Runtime + + +def ft_icabrowser(*args, **kwargs): + """ + FT_ICABROWSER takes as an input comp structure from FieldTrip ft_componentanalysis + and presents a GUI interface showing the power spectrum, variance over + time and the topography of the components, as well as the possibility to + save a PDF, inspect the timecourse and toggle components to be rejected vs + kept. Also, it allows for the specification of artifactual segments, + through the functionality of ft_databrowser. This may be handy in order + to identify data segments that cause infrequent data features loading on + a limited set of channels (e.g. isolated SQUID jumps in MEG). This type + of artitfact defendibly would require the extreme segments to be rejected + from the data a priori, i.e. before application of the independent + component analysis. + + Use as + [rej_comp, artifact] = ft_icabrowser(cfg, comp) + + where the input comp structure should be obtained from FT_COMPONENTANALYSIS. + + The configuration must contain: + cfg.layout = filename of the layout, see FT_PREPARE_LAYOUT + + further optional configuration parameters are + cfg.rejcomp = list of components which shall be initially marked for rejection, e.g. [1 4 7] + cfg.blocksize = blocksize of time course length for visualization (default = []) + cfg.powscale = scaling of y axis in power plot, 'lin' or 'log10', (default = 'log10') + cfg.freqscale = scaling of x axis in power plot, 'lin' or 'log', (default = 'lin') + cfg.foilim + cfg.zlim = plotting limits for color dimension of topoplot, 'maxmin', 'maxabs', 'zeromax', 'minzero', or [zmin zmax] (default = 'maxmin') + cfg.outputfolder = where pdfs will be saved (default = pwd) + cfg.prefix = prefix of the pdf files (default = 'ICA') + cfg.colormap = any sized colormap, see FT_COLORMAP + cfg.outputfile = MAT file which contains indices of all components to reject + cfg.showcallinfo = show call info, 'yes' or 'no' (default: 'no') + cfg.chunklength + + original written by Thomas Pfeffer + adapted by Jonathan Daume and Anne Urai + University Medical Center Hamburg-Eppendorf, 2015 + + modified by Daniel Matthes + Max Planck Institute for Human Cognitive and Brain Sciences, 2019 + + Jan-Mathijs did a big overhaul of the functionality, allowing for more + interaction. Future versions may lose some functionality, e.g. w.r.t + saving pdfs. + + See also FT_COMPONENTANALYSIS, FT_TOPOPLOTIC, FT_PREPARE_LAYOUT, FT_DATABROWSER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/misc/ft_icabrowser.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_icabrowser", *args, **kwargs) diff --git a/fieldtrip/__contrib/__misc/ft_laggedcoherence.py b/fieldtrip/__contrib/__misc/ft_laggedcoherence.py new file mode 100644 index 0000000..16b4aab --- /dev/null +++ b/fieldtrip/__contrib/__misc/ft_laggedcoherence.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def ft_laggedcoherence(*args, **kwargs): + """ + FT_LAGGEDCOHERENCE calculates the lagged coherence for a set of + channels pairs, a number of frequencies, and a number of lags. The channel + pairs are the complete set of pairs that can be formed from the channels + in datain, including the auto-pairs (one channel for which the lagged + coherence is calculated at different lags). + + Use as + outdata = ft_laggedcoherence(cfg, indata) + where cfg is a configuration structure (see below) and indata is the + output of FT_PREPROCESSING. + + The configuration structure should contain + cfg.foi = vector 1 x numfoi, frequencies of interest + cfg.loi = vector 1 x numloi, lags of interest, this must be a vector of + integers with starting value 0 or higher + cfg.numcycles = integer, number of cycles of the Fourier basis functions that + are used to calculate the Fourier coefficients that are the + basis for calculating lagged coherence + + + When using the results of this function in a publication, please cite: + Fransen, A. M., van Ede, F., & Maris, E. (2015). Identifying neuronal + oscillations using rhythmicity. Neuroimage, 118, 256-267. + + See also FT_PREPROCESSING, FT_FREQANALYSIS, FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/misc/ft_laggedcoherence.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_laggedcoherence", *args, **kwargs) diff --git a/fieldtrip/__contrib/__misc/ft_nonlinearassociation.py b/fieldtrip/__contrib/__misc/ft_nonlinearassociation.py new file mode 100644 index 0000000..496b8aa --- /dev/null +++ b/fieldtrip/__contrib/__misc/ft_nonlinearassociation.py @@ -0,0 +1,99 @@ +from fieldtrip._runtime import Runtime + + +def ft_nonlinearassociation(*args, **kwargs): + """ + NONLINEARASSOCIATION calculate the association coefficient as a + function of delay. + + In order to estimate the amount of association between all possible + pairs of MEG sensors the nonlinear association analysis is used. + It was first developed for EEG data analysis by Pijn and co-workers + (Lopes da Silva, et al. 1989; Pijn, et al. 1990). The basic principle + is similar to that of coherence and (cross) correlation, with the + exception that this nonlinear association method can be applied + independent of the type of relationship (linear or nonlinear) in + the data. + + The method is based on the idea that if two signals x and y are + correlated, a nonlinear regression curve can be calculated that + represents their relationship. In practice, that regression curve + is estimated by creating a scatterplot of y versus x, dividing the + data in segments and describing each segment with a linear regression + curve. The estimated correlation ratio h2, which gives the reduction + in variance of y as a result of predicting its values according to + the regression curve, can be calculated as follows: + + h^2 = (sum(Yi - mean(Y))^2 - sum(Yi - f(Xi))^2) / sum(Yi - mean(Y))^2 + + With the sum going over N samples and f(Xi) the estimated value of + Yi according to the regression line. The h2 coefficient has values + between 0 (y is completely independent of x) and 1 (y is completely + determined by x). In the case of a linear relationship between x + and y, h2 is equal to the well known Pearson correlation coefficient + (r2). As is the case with cross-correlation, it is possible to + estimate h2 as a function of time shift () between the signals. The + h2 is then iteratively calculated for different values of , by + shifting the signals in comparison to each other, and the value for + which the maximal h2 is reached can be used as an estimate of the + time lag between both signals. In deciding what epoch length to use + in the association analysis, a trade-off has to be made between + successfully determining the correct delay and h2-value (for which + large epoch lengths are necessary) and a small enough time-resolution + (for which small epoch lengths are necessary). + + Use as + [association] = ft_nonlinearassociation(cfg, data) + + The input data should be organised in a structure as obtained from + the PREPROCESSING function. + + The configuration should contain + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see CHANNELSELECTION for details + cfg.keeptrials = 'yes' or 'no', process the individual trials or the concatenated data (default = 'no') + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.fsample = 1200 + cfg.maxdelay = 32/cfg.fsample + cfg.delaystep = 2/cfg.fsample + cfg.nr_bins = 7 + cfg.offset = 0 + cfg.order = 'Hxy' + cfg.timwin = 0.2 + cfg.toi = [] + + References + - Lopes da Silva F, Pijn JP, Boeijinga P. (1989): Interdependence of + EEG signals: linear vs. nonlinear associations and the significance + of time delays and phase shifts. Brain Topogr 2(1-2):9-18. + - Pijn JP, Vijn PC, Lopes da Silva FH, Van Ende Boas W, Blanes W. + (1990): Localization of epileptogenic foci using a new signal + analytical approach. Neurophysiol Clin 20(1):1-11. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/misc/ft_nonlinearassociation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_nonlinearassociation", *args, **kwargs) diff --git a/fieldtrip/__contrib/__nutmegtrip/__init__.py b/fieldtrip/__contrib/__nutmegtrip/__init__.py new file mode 100644 index 0000000..eb1b1bd --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/__init__.py @@ -0,0 +1,48 @@ +from .nmt_addtopo import nmt_addtopo +from .nmt_animate import nmt_animate +from .nmt_close import nmt_close +from .nmt_image import nmt_image +from .nmt_mni2mri import nmt_mni2mri +from .nmt_mri2mni import nmt_mri2mni +from .nmt_peaksearch import nmt_peaksearch +from .nmt_peaksearch_helper import nmt_peaksearch_helper +from .nmt_polaritytweak import nmt_polaritytweak +from .nmt_reducerank import nmt_reducerank +from .nmt_repos import nmt_repos +from .nmt_sourceoriplot import nmt_sourceoriplot +from .nmt_sourceplot import nmt_sourceplot +from .nmt_spm_plot import nmt_spm_plot +from .nmt_spm_write_deformationinv import nmt_spm_write_deformationinv +from .nmt_spmfig_setup import nmt_spmfig_setup +from .nmt_svdtrunc import nmt_svdtrunc +from .nmt_svdtruncinv import nmt_svdtruncinv +from .nmt_tbxdti_quiver3 import nmt_tbxdti_quiver3 +from .nmt_timeselect import nmt_timeselect +from .nmt_transform_coord import nmt_transform_coord +from .spm_ov_quivernmt import spm_ov_quivernmt + + +__all__ = [ + "nmt_addtopo", + "nmt_animate", + "nmt_close", + "nmt_image", + "nmt_mni2mri", + "nmt_mri2mni", + "nmt_peaksearch", + "nmt_peaksearch_helper", + "nmt_polaritytweak", + "nmt_reducerank", + "nmt_repos", + "nmt_sourceoriplot", + "nmt_sourceplot", + "nmt_spm_plot", + "nmt_spm_write_deformationinv", + "nmt_spmfig_setup", + "nmt_svdtrunc", + "nmt_svdtruncinv", + "nmt_tbxdti_quiver3", + "nmt_timeselect", + "nmt_transform_coord", + "spm_ov_quivernmt", +] diff --git a/fieldtrip/__contrib/__nutmegtrip/_atlas_lookup.py b/fieldtrip/__contrib/__nutmegtrip/_atlas_lookup.py new file mode 100644 index 0000000..8cb6763 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/_atlas_lookup.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _atlas_lookup(*args, **kwargs): + """ + ATLAS_LOOKUP determines the anatomical label of a location in the given atlas. + + Use as + label = atlas_lookup(atlas, pos, ...); + + Optional input arguments should come in key-value pairs and can include + 'method' = 'sphere' (default) searches surrounding voxels in a sphere + 'cube' searches surrounding voxels in a cube + 'queryrange' = number, should be 1, 3, 5, 7, 9 or 11 (default = 3) + 'coordsys' = 'mni' or 'tal' (default = []) + + Dependent on the coordinates if the input points and the coordinates of the atlas, + the input positions are transformed between MNI and Talairach-Tournoux coordinates. + See http://www.mrc-cbu.cam.ac.uk/Imaging/Common/mnispace.shtml for more details. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/private/atlas_lookup.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("atlas_lookup", *args, **kwargs) diff --git a/fieldtrip/__contrib/__nutmegtrip/_freezeColors.py b/fieldtrip/__contrib/__nutmegtrip/_freezeColors.py new file mode 100644 index 0000000..44179c9 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/_freezeColors.py @@ -0,0 +1,80 @@ +from fieldtrip._runtime import Runtime + + +def _freezeColors(*args, **kwargs): + """ + freezeColors Lock colors of plot, enabling multiple colormaps per figure. (v2.3) + + Problem: There is only one colormap per figure. This function provides + an easy solution when plots using different colomaps are desired + in the same figure. + + freezeColors freezes the colors of graphics objects in the current axis so + that subsequent changes to the colormap (or caxis) will not change the + colors of these objects. freezeColors works on any graphics object + with CData in indexed-color mode: surfaces, images, scattergroups, + bargroups, patches, etc. It works by converting CData to true-color rgb + based on the colormap active at the time freezeColors is called. + + The original indexed color data is saved, and can be restored using + unfreezeColors, making the plot once again subject to the colormap and + caxis. + + + Usage: + freezeColors applies to all objects in current axis (gca), + freezeColors(axh) same, but works on axis axh. + + Example: + subplot(2,1,1); imagesc(X); colormap hot; freezeColors + subplot(2,1,2); imagesc(Y); colormap hsv; freezeColors etc... + + Note: colorbars must also be frozen. Due to Matlab 'improvements' this can + no longer be done with freezeColors. Instead, please + use the function CBFREEZE by Carlos Adrian Vargas Aguilera + that can be downloaded from the MATLAB File Exchange + (http://www.mathworks.com/matlabcentral/fileexchange/24371) + + h=colorbar; cbfreeze(h), or simply cbfreeze(colorbar) + + For additional examples, see test/test_main.m + + Side effect on render mode: freezeColors does not work with the painters + renderer, because Matlab doesn't support rgb color data in + painters mode. If the current renderer is painters, freezeColors + changes it to zbuffer. This may have unexpected effects on other aspects + of your plots. + + See also unfreezeColors, freezeColors_pub.html, cbfreeze. + + + John Iversen (iversen@nsi.edu) 3/23/05 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/private/freezeColors.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("freezeColors", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__contrib/__nutmegtrip/_getdimsiz.py b/fieldtrip/__contrib/__nutmegtrip/_getdimsiz.py new file mode 100644 index 0000000..1ed0a37 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/_getdimsiz.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _getdimsiz(*args, **kwargs): + """ + GETDIMSIZ + + Use as + dimsiz = getdimsiz(data, field) + or + dimsiz = getdimsiz(data, field, numdim) + + MATLAB will not return the size of a field in the data structure that has trailing + singleton dimensions, since those are automatically squeezed out. With the optional + numdim parameter you can specify how many dimensions the data element has. This + will result in the trailing singleton dimensions being added to the output vector. + + Example use + dimord = getdimord(datastructure, fieldname); + dimtok = tokenize(dimord, '_'); + dimsiz = getdimsiz(datastructure, fieldname, numel(dimtok)); + + See also GETDIMORD, GETDATFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/private/getdimsiz.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getdimsiz", *args, **kwargs) diff --git a/fieldtrip/__contrib/__nutmegtrip/_nmt_coord_diff.py b/fieldtrip/__contrib/__nutmegtrip/_nmt_coord_diff.py new file mode 100644 index 0000000..fda7123 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/_nmt_coord_diff.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _nmt_coord_diff(*args, **kwargs): + """ + C = NMT_COORD_DIFF(A,B) + + subtract single 1 x 3 coordinate B from list of coordinates A (N x 3) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/private/nmt_coord_diff.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_coord_diff", *args, **kwargs) diff --git a/fieldtrip/__contrib/__nutmegtrip/_nmt_rownorm.py b/fieldtrip/__contrib/__nutmegtrip/_nmt_rownorm.py new file mode 100644 index 0000000..4c64889 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/_nmt_rownorm.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _nmt_rownorm(*args, **kwargs): + """ + NORM = NMT_ROWNORM(A) + Treat each row of A as vector and take norm. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/private/nmt_rownorm.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_rownorm", *args, **kwargs) diff --git a/fieldtrip/__contrib/__nutmegtrip/_nmt_tfplot.py b/fieldtrip/__contrib/__nutmegtrip/_nmt_tfplot.py new file mode 100644 index 0000000..7776584 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/_nmt_tfplot.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _nmt_tfplot(*args, **kwargs): + """ + nutmegtrip uses this helper function to plot time-frequency data + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/private/nmt_tfplot.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_tfplot", *args, **kwargs) diff --git a/fieldtrip/__contrib/__nutmegtrip/_nmt_ts_intervalpower.py b/fieldtrip/__contrib/__nutmegtrip/_nmt_ts_intervalpower.py new file mode 100644 index 0000000..3c118ca --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/_nmt_ts_intervalpower.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _nmt_ts_intervalpower(*args, **kwargs): + """ + when time interval is selected, calculate desired representation of interval power + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/private/nmt_ts_intervalpower.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_ts_intervalpower", *args, **kwargs) diff --git a/fieldtrip/__contrib/__nutmegtrip/_nmt_update_panel.py b/fieldtrip/__contrib/__nutmegtrip/_nmt_update_panel.py new file mode 100644 index 0000000..eb17434 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/_nmt_update_panel.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _nmt_update_panel(*args, **kwargs): + """ + nmt_update_panel is a function. + nmt_update_panel(axsel) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/private/nmt_update_panel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_update_panel", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__contrib/__nutmegtrip/_parameterselection.py b/fieldtrip/__contrib/__nutmegtrip/_parameterselection.py new file mode 100644 index 0000000..69018a6 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/_parameterselection.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _parameterselection(*args, **kwargs): + """ + PARAMETERSELECTION selects the parameters that are present as a volume in the data + add that have a dimension that is compatible with the specified dimensions of the + volume, i.e. either as a vector or as a 3D volume. + + Use as + [select] = parameterselection(param, data) + where + param cell-array, or single string, can be 'all' + data structure with anatomical or functional data + select returns the selected parameters as a cell-array + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/private/parameterselection.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("parameterselection", *args, **kwargs) diff --git a/fieldtrip/__contrib/__nutmegtrip/_unfreezeColors.py b/fieldtrip/__contrib/__nutmegtrip/_unfreezeColors.py new file mode 100644 index 0000000..a0d7008 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/_unfreezeColors.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def _unfreezeColors(*args, **kwargs): + """ + unfreezeColors Restore colors of a plot to original indexed color. (v2.3) + + Useful if you want to apply a new colormap to plots whose + colors were previously frozen with freezeColors. + + Usage: + unfreezeColors unfreezes all objects in current axis, + unfreezeColors(axh) same, but works on axis axh. axh can be vector. + unfreezeColors(figh) same, but for all objects in figure figh. + + Has no effect on objects on which freezeColors was not already called. + (Note: if colorbars were frozen using cbfreeze, use cbfreeze('off') to + unfreeze them. See freezeColors for information on cbfreeze.) + + + See also freezeColors, freezeColors_pub.html, cbfreeze. + + + John Iversen (iversen@nsi.edu) 3/23/05 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/private/unfreezeColors.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("unfreezeColors", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_addtopo.py b/fieldtrip/__contrib/__nutmegtrip/nmt_addtopo.py new file mode 100644 index 0000000..48a5dff --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_addtopo.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def nmt_addtopo(*args, **kwargs): + """ + configures and display topoplot on nutmegtrip viewer + (not intended for use outside of nutmegtrip plot functions) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_addtopo.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_addtopo", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_animate.py b/fieldtrip/__contrib/__nutmegtrip/nmt_animate.py new file mode 100644 index 0000000..f7beb2b --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_animate.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def nmt_animate(*args, **kwargs): + """ + designed to animate activations over time in nutmegtrip viewer + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_animate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_animate", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_close.py b/fieldtrip/__contrib/__nutmegtrip/nmt_close.py new file mode 100644 index 0000000..7bdd3c6 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_close.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def nmt_close(*args, **kwargs): + """ + --- Executes during object deletion, before destroying properties. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_close.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_close", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_image.py b/fieldtrip/__contrib/__nutmegtrip/nmt_image.py new file mode 100644 index 0000000..d46548d --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_image.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def nmt_image(*args, **kwargs): + """ + analogous to spm's spm_image -- used to update coords when clicking + around MRI viewer + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_image.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_image", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_mni2mri.py b/fieldtrip/__contrib/__nutmegtrip/nmt_mni2mri.py new file mode 100644 index 0000000..7234581 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_mni2mri.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def nmt_mni2mri(*args, **kwargs): + """ + [xyz_o_mm,xyz_o_vx]=nmt_mri2mni(xyz_i,mrifullpath,[doaffine]) + Takes MNI coordinates (mm) and converts to original MRI coordinates (mm + and/or voxel) using normalization info from SPM8 (or SPM12 'OldNorm') + + XYZ_I: Nx3 list of coords in individual's MRI coordinates (mm) + mrifullpath: path to normalized MRI volume (nifti) + + [wrapper for spm_get_orig_coord from SPM8/SPM12] + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_mni2mri.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_mni2mri", *args, **kwargs) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_mri2mni.py b/fieldtrip/__contrib/__nutmegtrip/nmt_mri2mni.py new file mode 100644 index 0000000..1760db2 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_mri2mni.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def nmt_mri2mni(*args, **kwargs): + """ + [xyz_o]=nmt_mri2mni(xyz_i,mrifullpath,[doaffine]) + Takes MRI coords (mm) and converts them to MNI coordinates (mm) + using normalization info from SPM8 (or SPM12 'OldNorm') + + XYZ_I: Nx3 list of coords in individual's MRI coordinates (mm) + + mrifullpath: path to normalized MRI volume (nifti) + + doaffine: (optional) applies affine transform for area outside of + bounding box specified by SPM warping. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_mri2mni.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_mri2mni", *args, **kwargs) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_peaksearch.py b/fieldtrip/__contrib/__nutmegtrip/nmt_peaksearch.py new file mode 100644 index 0000000..a6adda1 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_peaksearch.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def nmt_peaksearch(*args, **kwargs): + """ + [vox_idx, t_idx] = nmt_peaksearch(cfg) + cfg.time = single time point, or time range, or 'current'; if unspecified, search over time at specified voxel + cfg.vox = find peak time at specified voxel, or 'current'; if unspecified, search over voxels at specified time + cfg.peaktype = 'mag' (max magnitude, default) or 'max' or 'min' + cfg.searchradius = minimum and maximum distance to search for peak + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_peaksearch.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_peaksearch", *args, **kwargs) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_peaksearch_helper.py b/fieldtrip/__contrib/__nutmegtrip/nmt_peaksearch_helper.py new file mode 100644 index 0000000..0688d80 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_peaksearch_helper.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def nmt_peaksearch_helper(*args, **kwargs): + """ + simplifies Callback for peak search functionality in GUI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_peaksearch_helper.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_peaksearch_helper", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_polaritytweak.py b/fieldtrip/__contrib/__nutmegtrip/nmt_polaritytweak.py new file mode 100644 index 0000000..157af95 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_polaritytweak.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def nmt_polaritytweak(*args, **kwargs): + """ + nmt_polaritytweak is a function. + source = nmt_polaritytweak(cfg, source) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_polaritytweak.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_polaritytweak", *args, **kwargs) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_reducerank.py b/fieldtrip/__contrib/__nutmegtrip/nmt_reducerank.py new file mode 100644 index 0000000..a86f032 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_reducerank.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def nmt_reducerank(*args, **kwargs): + """ + leadgrid = nmt_reducerank(cfg,leadgrid); + + Reduces the rank of a lead field after it has been computed. Particularly + useful for testing reduced rank versions of BEM/FEM models. + e.g., use cfg.reducerank = 2; + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_reducerank.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_reducerank", *args, **kwargs) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_repos.py b/fieldtrip/__contrib/__nutmegtrip/nmt_repos.py new file mode 100644 index 0000000..208ecaa --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_repos.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def nmt_repos(*args, **kwargs): + """ + nmt_repos([x y z], t) + nmt_repos([x y z], [t0 t1]) + nmt_repos(pos_idx, t_idx) + nmt_repos(pos_idx, [t0_idx t1_idx]) + + moves to selected voxel/time, then resyncs functional data + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_repos.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_repos", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_sourceoriplot.py b/fieldtrip/__contrib/__nutmegtrip/nmt_sourceoriplot.py new file mode 100644 index 0000000..c96fa47 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_sourceoriplot.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def nmt_sourceoriplot(*args, **kwargs): + """ + NMT_SOURCEORIPLOT + plots functional source orientation data on slices or on + a surface, optionally as an overlay on anatomical MRI data, where + statistical data can be used to determine the opacity of the mask. Input + data comes from FT_SOURCEANALYSIS. + + Use as + ft_sourceoriplot(cfg, data) + + No cfg options are implemented yet. + + Requires spm_ov_quivernmt.m to be installed as SPM plugin in + spm_orthviews subdirectory + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_sourceoriplot.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_sourceoriplot", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_sourceplot.py b/fieldtrip/__contrib/__nutmegtrip/nmt_sourceplot.py new file mode 100644 index 0000000..b4779ec --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_sourceplot.py @@ -0,0 +1,163 @@ +from fieldtrip._runtime import Runtime + + +def nmt_sourceplot(*args, **kwargs): + """ + NMT_SOURCEPLOT + plots functional source reconstruction data on slices or on + a surface, optionally as an overlay on anatomical MRI data, where + statistical data can be used to determine the opacity of the mask. Input + data comes from FT_SOURCEANALYSIS, FT_SOURCEGRANDAVERAGE or statistical + values from FT_SOURCESTATISTICS. + + Use as + ft_sourceplot(cfg, data) + where the input data can contain an anatomical MRI, functional source + reconstruction results and/or statistical data. Interpolation is not + necessary for this function; performance is best [no "gaps" or overlaps + displayed activation map] if the functional data consists of a uniform + grid in the chosen coordinate space. If the functional data is evenly + spaced in MNI coordinates, for example, the data is best plotted on the + MNI brain or the subject's MNI-warped MRI. + + + The configuration should contain: + cfg.funparameter = string, field in data with the functional parameter of interest (default = []) + cfg.mripath = string, location of Nifti-format MRI + cfg.maskparameter = string, field in the data to be used for opacity masking of fun data (default = []) + If values are between 0 and 1, zero is fully transparant and one is fully opaque. + If values in the field are not between 0 and 1 they will be scaled depending on the values + of cfg.opacitymap and cfg.opacitylim (see below) + You can use masking in several ways, f.i. + - use outcome of statistics to show only the significant values and mask the insignificant + NB see also cfg.opacitymap and cfg.opacitylim below + - use the functional data itself as mask, the highest value (and/or lowest when negative) + will be opaque and the value closest to zero transparent + - Make your own field in the data with values between 0 and 1 to control opacity directly + + The following parameters can be used in all methods: + cfg.atlas = string, filename of atlas to use (default = []) see FT_READ_ATLAS + for ROI masking (see "masking" below) or in "ortho-plotting" mode (see "ortho-plotting" below) + + The following parameters can be used for the functional data: + **TODO** cfg.funcolormap = colormap for functional data, see COLORMAP (default = 'auto') + 'auto', depends structure funparameter, or on funcolorlim + - funparameter: only positive values, or funcolorlim:'zeromax' -> 'hot' + - funparameter: only negative values, or funcolorlim:'minzero' -> 'cool' + - funparameter: both pos and neg values, or funcolorlim:'maxabs' -> 'default' + - funcolorlim: [min max] if min & max pos-> 'hot', neg-> 'cool', both-> 'default' + **TODO** cfg.funcolorlim = color range of the functional data (default = 'auto') + [min max] + 'maxabs', from -max(abs(funparameter)) to +max(abs(funparameter)) + 'zeromax', from 0 to max(funparameter) + 'minzero', from min(funparameter) to 0 + 'auto', if funparameter values are all positive: 'zeromax', + all negative: 'minzero', both possitive and negative: 'maxabs' + + The following parameters can be used for the masking data: + **TODO** cfg.opacitymap = opacitymap for mask data, see ALPHAMAP (default = 'auto') + 'auto', depends structure maskparameter, or on opacitylim + - maskparameter: only positive values, or opacitylim:'zeromax' -> 'rampup' + - maskparameter: only negative values, or opacitylim:'minzero' -> 'rampdown' + - maskparameter: both pos and neg values, or opacitylim:'maxabs' -> 'vdown' + - opacitylim: [min max] if min & max pos-> 'rampup', neg-> 'rampdown', both-> 'vdown' + - NB. to use p-values use 'rampdown' to get lowest p-values opaque and highest transparent + **TODO** cfg.opacitylim = range of mask values to which opacitymap is scaled (default = 'auto') + [min max] + 'maxabs', from -max(abs(maskparameter)) to +max(abs(maskparameter)) + 'zeromax', from 0 to max(abs(maskparameter)) + 'minzero', from min(abs(maskparameter)) to 0 + 'auto', if maskparameter values are all positive: 'zeromax', + all negative: 'minzero', both possitive and negative: 'maxabs' + **TODO** cfg.roi = string or cell of strings, region(s) of interest from anatomical atlas (see cfg.atlas above) + everything is masked except for ROI + + The following parameters apply for ortho-plotting + **TODO** cfg.location = location of cut, (default = 'auto') + 'auto', 'center' if only anatomy, 'max' if functional data + 'min' and 'max' position of min/max funparameter + 'center' of the brain + [x y z], coordinates in voxels or head, see cfg.locationcoordinates + **TODO** cfg.locationcoordinates = coordinate system used in cfg.location, 'head' or 'voxel' (default = 'head') + 'head', headcoordinates as mm or cm + 'voxel', voxelcoordinates as indices + **TODO** cfg.crosshair = 'yes' or 'no' (default = 'yes') + **TODO** cfg.axis = 'on' or 'off' (default = 'on') + **TODO** cfg.queryrange = number, in atlas voxels (default 3) + + + The following parameters apply for slice-plotting + **TODO** cfg.title = string, title of the figure window + + **TODO** + When cfg.method = 'surface', the functional data will be rendered onto a + cortical mesh (can be an inflated mesh). If the input source data + contains a tri-field, no interpolation is needed. If the input source + data does not contain a tri-field (i.e. a description of a mesh), an + interpolation is performed onto a specified surface. Note that the + coordinate system in which the surface is defined should be the same as + the coordinate system that is represented in source.pos. + + The following parameters apply to surface-plotting when an interpolation + is required + cfg.surffile = string, file that contains the surface (default = 'surface_white_both.mat') + 'surface_white_both.mat' contains a triangulation that corresponds with the + SPM anatomical template in MNI coordinates + cfg.surfinflated = string, file that contains the inflated surface (default = []) + may require specifying a point-matching (uninflated) surffile + cfg.surfdownsample = number (default = 1, i.e. no downsampling) + cfg.projmethod = projection method, how functional volume data is projected onto surface + 'nearest', 'project', 'sphere_avg', 'sphere_weighteddistance' + cfg.projvec = vector (in mm) to allow different projections that + are combined with the method specified in cfg.projcomb + cfg.projcomb = 'mean', 'max', method to combine the different projections + cfg.projweight = vector of weights for the different projections (default = 1) + cfg.projthresh = implements thresholding on the surface level + for example, 0.7 means 70% of maximum + cfg.sphereradius = maximum distance from each voxel to the surface to be + included in the sphere projection methods, expressed in mm + cfg.distmat = precomputed distance matrix (default = []) + + The following parameters apply to surface-plotting independent of whether + an interpolation is required + cfg.camlight = 'yes' or 'no' (default = 'yes') + cfg.renderer = 'painters', 'zbuffer',' opengl' or 'none' (default = 'opengl') + note that when using opacity the OpenGL renderer is required. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + If you specify this option the input data will be read from a *.mat + file on disk. This mat files should contain only a single variable named 'data', + corresponding to the input structure. + + See also FT_SOURCEANALYSIS, FT_SOURCEGRANDAVERAGE, FT_SOURCESTATISTICS, + FT_VOLUMELOOKUP, FT_READ_ATLAS, FT_READ_MRI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_sourceplot.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_sourceplot", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_spm_plot.py b/fieldtrip/__contrib/__nutmegtrip/nmt_spm_plot.py new file mode 100644 index 0000000..203ec89 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_spm_plot.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def nmt_spm_plot(*args, **kwargs): + """ + nmt_spm_plot(cfg) + plots desired activation on SPM8 viewer + designed for use via nmt_sourceplot, but possibly usable independently + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_spm_plot.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_spm_plot", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_spm_write_deformationinv.py b/fieldtrip/__contrib/__nutmegtrip/nmt_spm_write_deformationinv.py new file mode 100644 index 0000000..3ccff77 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_spm_write_deformationinv.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def nmt_spm_write_deformationinv(*args, **kwargs): + """ + nmt_spm_write_deformationinv(mrifullpath) + + writes out the forward and inverse deformation fields + associated with an MRI normalized with SPM8 (or SPM12 'OldNorm') + + input: full path of MRI in subject space (e.g. /home/nemo/data/Subject.nii) + also requires: normalized MRI (wSubject.nii) generated by SPM + normalization transform file (Subject_SN.mat) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_spm_write_deformationinv.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_spm_write_deformationinv", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_spmfig_setup.py b/fieldtrip/__contrib/__nutmegtrip/nmt_spmfig_setup.py new file mode 100644 index 0000000..c6431de --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_spmfig_setup.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def nmt_spmfig_setup(*args, **kwargs): + """ + adds custom features to SPM MRI display window + e.g., head coords, MNI coords, activation intensity, + additional axes and associated GUI controls + Author: Sarang S. Dalal, NEMOlab + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_spmfig_setup.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_spmfig_setup", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_svdtrunc.py b/fieldtrip/__contrib/__nutmegtrip/nmt_svdtrunc.py new file mode 100644 index 0000000..dca0da8 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_svdtrunc.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def nmt_svdtrunc(*args, **kwargs): + """ + [Rtrunc,q,u,v] = nmt_svdtrunc(R,signalspace) + + Allows user to reject undesired SVD components of an arbitrary matrix R. + It can be used to, e.g., reduce the matrix's rank. + + signalspace should be vector of which components to include, e.g. [1 2] + for the equivalent of cfg.reducerank=2 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_svdtrunc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_svdtrunc", *args, **kwargs) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_svdtruncinv.py b/fieldtrip/__contrib/__nutmegtrip/nmt_svdtruncinv.py new file mode 100644 index 0000000..a1247f6 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_svdtruncinv.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def nmt_svdtruncinv(*args, **kwargs): + """ + [Rtrunc,q,u,v] = nmt_svdtruncinv(R,signalspace) + + Allows user to define signalspace of an arbitrary matrix R and perform an + SVD-based pseudoinverse using knowledge of the defined signalspace. + This provides more control than the pinv function and often better + results than Tikhonov regularization for heavily rank-deficient matrices. + + signalspace should be vector of which SVD components to include, e.g. [1:90] + to set rank to 90. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_svdtruncinv.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_svdtruncinv", *args, **kwargs) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_tbxdti_quiver3.py b/fieldtrip/__contrib/__nutmegtrip/nmt_tbxdti_quiver3.py new file mode 100644 index 0000000..67deea8 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_tbxdti_quiver3.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def nmt_tbxdti_quiver3(*args, **kwargs): + """ + QUIVER3 3-D quiver plot. + QUIVER3(X,Y,Z,U,V,W) plots velocity vectors as arrows with components + (u,v,w) at the points (x,y,z). The matrices X,Y,Z,U,V,W must all be + the same size and contain the corresponding position and velocity + components. QUIVER3 automatically scales the arrows to fit. + + QUIVER3(Z,U,V,W) plots velocity vectors at the equally spaced + surface points specified by the matrix Z. + + QUIVER3(Z,U,V,W,S) or QUIVER3(X,Y,Z,U,V,W,S) automatically + scales the arrows to fit and then stretches them by S. + Use S=0 to plot the arrows without the automatic scaling. + + QUIVER3(...,LINESPEC) uses the plot linestyle specified for + the velocity vectors. Any marker in LINESPEC is drawn at the base + instead of an arrow on the tip. Use a marker of '.' to specify + no marker at all. See PLOT for other possibilities. + + QUIVER3(...,'filled') fills any markers specified. + + H = QUIVER3(...) returns a vector of line handles. + + Example: + [x,y] = meshgrid(-2:.2:2,-1:.15:1); + z = x .* exp(-x.^2 - y.^2); + [u,v,w] = surfnorm(x,y,z); + quiver3(x,y,z,u,v,w); hold on, surf(x,y,z), hold off + + See also QUIVER, PLOT, PLOT3, SCATTER. + + Courtesy of SPM Tools / tbxDiffusion: + https://sourceforge.net/projects/spmtools/ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_tbxdti_quiver3.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_tbxdti_quiver3", *args, **kwargs) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_timeselect.py b/fieldtrip/__contrib/__nutmegtrip/nmt_timeselect.py new file mode 100644 index 0000000..5947545 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_timeselect.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def nmt_timeselect(*args, **kwargs): + """ + nmt_timeselect is a function. + nmt_timeselect(op) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_timeselect.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_timeselect", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__contrib/__nutmegtrip/nmt_transform_coord.py b/fieldtrip/__contrib/__nutmegtrip/nmt_transform_coord.py new file mode 100644 index 0000000..8139e49 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/nmt_transform_coord.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def nmt_transform_coord(*args, **kwargs): + """ + [XYZ_O]=NMT_COORDTFM(A,XYZ_I) + [X_O,Y_O,Z_O]=NMT_COORDTFM(A,X_I,Y_I,Z_I) + Performs coordinate transformation using transform matrix A. + Supply either xyz_i as an N x 3 matrix containing cartesian coordinates + or x_i, y_i, and z_i in separate N x 1 vectors. + A should be 4 x 4. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/nmt_transform_coord.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nmt_transform_coord", *args, **kwargs) diff --git a/fieldtrip/__contrib/__nutmegtrip/spm_ov_quivernmt.py b/fieldtrip/__contrib/__nutmegtrip/spm_ov_quivernmt.py new file mode 100644 index 0000000..c0ea355 --- /dev/null +++ b/fieldtrip/__contrib/__nutmegtrip/spm_ov_quivernmt.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def spm_ov_quivernmt(*args, **kwargs): + """ + This routine is a plugin to spm_orthviews for SPM12 / SPM8. + Used by NutmegTrip / nmt_sourceoriplot.m to plot vector fields + (e.g., orientations) on MRI + + For general help about + spm_orthviews and plugins type + help spm_orthviews + at the matlab prompt. + _______________________________________________________________________ + + adapted from spm_ov_quiver.m disributed with SPM Tools / tbxDiffusion: + https://sourceforge.net/projects/spmtools/ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/nutmegtrip/spm_ov_quivernmt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("spm_ov_quivernmt", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/__init__.py b/fieldtrip/__contrib/__spike/__init__.py new file mode 100644 index 0000000..ad9495c --- /dev/null +++ b/fieldtrip/__contrib/__spike/__init__.py @@ -0,0 +1,58 @@ +from .ft_spike_isi import ft_spike_isi +from .ft_spike_jpsth import ft_spike_jpsth +from .ft_spike_maketrials import ft_spike_maketrials +from .ft_spike_plot_isi import ft_spike_plot_isi +from .ft_spike_plot_isireturn import ft_spike_plot_isireturn +from .ft_spike_plot_jpsth import ft_spike_plot_jpsth +from .ft_spike_plot_psth import ft_spike_plot_psth +from .ft_spike_plot_raster import ft_spike_plot_raster +from .ft_spike_psth import ft_spike_psth +from .ft_spike_rate import ft_spike_rate +from .ft_spike_rate_orituning import ft_spike_rate_orituning +from .ft_spike_select import ft_spike_select +from .ft_spike_waveform import ft_spike_waveform +from .ft_spike_xcorr import ft_spike_xcorr +from .ft_spikedensity import ft_spikedensity +from .ft_spikedetection import ft_spikedetection +from .ft_spikedownsample import ft_spikedownsample +from .ft_spikefixdmafile import ft_spikefixdmafile +from .ft_spikesimulation import ft_spikesimulation +from .ft_spikesorting import ft_spikesorting +from .ft_spikesplitting import ft_spikesplitting +from .ft_spiketriggeredaverage import ft_spiketriggeredaverage +from .ft_spiketriggeredinterpolation import ft_spiketriggeredinterpolation +from .ft_spiketriggeredspectrum import ft_spiketriggeredspectrum +from .ft_spiketriggeredspectrum_convol import ft_spiketriggeredspectrum_convol +from .ft_spiketriggeredspectrum_fft import ft_spiketriggeredspectrum_fft +from .ft_spiketriggeredspectrum_stat import ft_spiketriggeredspectrum_stat + + +__all__ = [ + "ft_spike_isi", + "ft_spike_jpsth", + "ft_spike_maketrials", + "ft_spike_plot_isi", + "ft_spike_plot_isireturn", + "ft_spike_plot_jpsth", + "ft_spike_plot_psth", + "ft_spike_plot_raster", + "ft_spike_psth", + "ft_spike_rate", + "ft_spike_rate_orituning", + "ft_spike_select", + "ft_spike_waveform", + "ft_spike_xcorr", + "ft_spikedensity", + "ft_spikedetection", + "ft_spikedownsample", + "ft_spikefixdmafile", + "ft_spikesimulation", + "ft_spikesorting", + "ft_spikesplitting", + "ft_spiketriggeredaverage", + "ft_spiketriggeredinterpolation", + "ft_spiketriggeredspectrum", + "ft_spiketriggeredspectrum_convol", + "ft_spiketriggeredspectrum_fft", + "ft_spiketriggeredspectrum_stat", +] diff --git a/fieldtrip/__contrib/__spike/_cluster_ward.py b/fieldtrip/__contrib/__spike/_cluster_ward.py new file mode 100644 index 0000000..23fe62e --- /dev/null +++ b/fieldtrip/__contrib/__spike/_cluster_ward.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _cluster_ward(*args, **kwargs): + """ + CLUSTER_WARD Hierarchical cluster algorithm + + [grootte,ordening] = cluster(realdist,optie,absoluut,aantal) + + input: distance matrix, clustering optie, absolute or relative scale, + number of required clusters + output: weights of cluster, ordening of dendogram + three options: single-link, complete-link, and ward's algorithm + produces dendogram + + See also WARD_DISTANCE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/private/cluster_ward.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("cluster_ward", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/_getdimord.py b/fieldtrip/__contrib/__spike/_getdimord.py new file mode 100644 index 0000000..ea28af8 --- /dev/null +++ b/fieldtrip/__contrib/__spike/_getdimord.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _getdimord(*args, **kwargs): + """ + GETDIMORD determine the dimensions and order of a data field in a FieldTrip + structure. + + Use as + dimord = getdimord(data, field) + + See also GETDIMSIZ, GETDATFIELD, FIXDIMORD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/private/getdimord.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getdimord", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/_getdimsiz.py b/fieldtrip/__contrib/__spike/_getdimsiz.py new file mode 100644 index 0000000..a80c852 --- /dev/null +++ b/fieldtrip/__contrib/__spike/_getdimsiz.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _getdimsiz(*args, **kwargs): + """ + GETDIMSIZ + + Use as + dimsiz = getdimsiz(data, field) + or + dimsiz = getdimsiz(data, field, numdim) + + MATLAB will not return the size of a field in the data structure that has trailing + singleton dimensions, since those are automatically squeezed out. With the optional + numdim parameter you can specify how many dimensions the data element has. This + will result in the trailing singleton dimensions being added to the output vector. + + Example use + dimord = getdimord(datastructure, fieldname); + dimtok = tokenize(dimord, '_'); + dimsiz = getdimsiz(datastructure, fieldname, numel(dimtok)); + + See also GETDIMORD, GETDATFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/private/getdimsiz.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getdimsiz", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/_isrealmat.py b/fieldtrip/__contrib/__spike/_isrealmat.py new file mode 100644 index 0000000..466b40b --- /dev/null +++ b/fieldtrip/__contrib/__spike/_isrealmat.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _isrealmat(*args, **kwargs): + """ + ISREALMAT returns true for a real matrix + + Use as + status = isrealmat(x) + + See also ISNUMERIC, ISREAL, ISVECTOR, ISREALVEC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/private/isrealmat.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("isrealmat", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/_isrealvec.py b/fieldtrip/__contrib/__spike/_isrealvec.py new file mode 100644 index 0000000..f1b7034 --- /dev/null +++ b/fieldtrip/__contrib/__spike/_isrealvec.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _isrealvec(*args, **kwargs): + """ + ISREALVEC returns true for a real row or column vector + + Use as + status = isrealvec(x) + + See also ISNUMERIC, ISREAL, ISVECTOR, ISREALMAT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/private/isrealvec.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("isrealvec", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/_neuralynx_crc.py b/fieldtrip/__contrib/__spike/_neuralynx_crc.py new file mode 100644 index 0000000..6da30d0 --- /dev/null +++ b/fieldtrip/__contrib/__spike/_neuralynx_crc.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _neuralynx_crc(*args, **kwargs): + """ + NEURALYNX_CRC computes a cyclic redundancy check + + Use as + crc = neuralynx_crc(dat) + + Note that the CRC is computed along the first dimension. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/private/neuralynx_crc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("neuralynx_crc", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/_neuralynx_getheader.py b/fieldtrip/__contrib/__spike/_neuralynx_getheader.py new file mode 100644 index 0000000..9cd66c3 --- /dev/null +++ b/fieldtrip/__contrib/__spike/_neuralynx_getheader.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _neuralynx_getheader(*args, **kwargs): + """ + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + SUBFUNCTION for reading the 16384 byte header from any Neuralynx file + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/private/neuralynx_getheader.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("neuralynx_getheader", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/_offset2time.py b/fieldtrip/__contrib/__spike/_offset2time.py new file mode 100644 index 0000000..aa8a55f --- /dev/null +++ b/fieldtrip/__contrib/__spike/_offset2time.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _offset2time(*args, **kwargs): + """ + OFFSET2TIME converts the offset of a trial definition into a time-axis + according to the definition from DEFINETRIAL + + Use as + [time] = offset2time(offset, fsample, nsamples) + + The trialdefinition "trl" is an Nx3 matrix. The first column contains + the sample-indices of the begin of the trial relative to the begin + of the raw data , the second column contains the sample_indices of + the end of the trials, and the third column contains the offset of + the trigger with respect to the trial. An offset of 0 means that + the first sample of the trial corresponds to the trigger. A positive + offset indicates that the first sample is later than the trigger, a + negative offset indicates a trial beginning before the trigger. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/private/offset2time.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("offset2time", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/_peakdetect3.py b/fieldtrip/__contrib/__spike/_peakdetect3.py new file mode 100644 index 0000000..7b29e28 --- /dev/null +++ b/fieldtrip/__contrib/__spike/_peakdetect3.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _peakdetect3(*args, **kwargs): + """ + PEAKDETECT3 detects peaks above a certain threshold in single-channel data + + Use as + [pindx, pval] = peakdetect3(dat, threshold, mindist) + + See also PEAKDETECT, PEAKDETECT2 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/private/peakdetect3.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("peakdetect3", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/_preproc.py b/fieldtrip/__contrib/__spike/_preproc.py new file mode 100644 index 0000000..6cb9762 --- /dev/null +++ b/fieldtrip/__contrib/__spike/_preproc.py @@ -0,0 +1,146 @@ +from fieldtrip._runtime import Runtime + + +def _preproc(*args, **kwargs): + """ + PREPROC applies various preprocessing steps on a single piece of EEG/MEG data + that has been read from a data file. + + This low-level function serves as a subfunction for all FieldTrip modules that want + to preprocess the data, such as FT_PREPROCESSING, FT_ARTIFACT_XXX, + FT_TIMELOCKANALYSIS, etc. It ensures consistent handling of both MEG and EEG data + and consistency in the use of all preprocessing configuration options. + + Use as + [dat, label, time, cfg] = preproc(dat, label, time, cfg, begpadding, endpadding) + + The required input arguments are + dat Nchan x Ntime data matrix + label Nchan x 1 cell-array with channel labels + time Ntime x 1 vector with the latency in seconds + cfg configuration structure, see below + and the optional input arguments are + begpadding number of samples that was used for padding (see below) + endpadding number of samples that was used for padding (see below) + + The output is + dat Nchan x Ntime data matrix + label Nchan x 1 cell-array with channel labels + time Ntime x 1 vector with the latency in seconds + cfg configuration structure, optionally with extra defaults set + + Note that the number of input channels and the number of output channels can be + different, for example when the user specifies that he/she wants to add the + implicit EEG reference channel to the data matrix. + + The filtering of the data can introduce artifacts at the edges, hence it is better + to pad the data with some extra signal at the begin and end. After filtering, this + padding is removed and the other preprocessing steps are applied to the remainder + of the data. The input fields begpadding and endpadding should be specified in + samples. You can also leave them empty, which implies that the data is not padded. + + The configuration can contain + cfg.lpfilter = 'no' or 'yes' lowpass filter + cfg.hpfilter = 'no' or 'yes' highpass filter + cfg.bpfilter = 'no' or 'yes' bandpass filter + cfg.bsfilter = 'no' or 'yes' bandstop filter + cfg.dftfilter = 'no' or 'yes' line noise removal using discrete fourier transform + cfg.medianfilter = 'no' or 'yes' jump preserving median filter + cfg.lpfreq = lowpass frequency in Hz + cfg.hpfreq = highpass frequency in Hz + cfg.bpfreq = bandpass frequency range, specified as [low high] in Hz + cfg.bsfreq = bandstop frequency range, specified as [low high] in Hz + cfg.dftfreq = line noise frequencies for DFT filter, default [50 100 150] Hz + cfg.lpfiltord = lowpass filter order (default set in low-level function) + cfg.hpfiltord = highpass filter order (default set in low-level function) + cfg.bpfiltord = bandpass filter order (default set in low-level function) + cfg.bsfiltord = bandstop filter order (default set in low-level function) + cfg.medianfiltord = length of median filter + cfg.lpfilttype = digital filter type, 'but' (default) or 'firws' or 'fir' or 'firls' + cfg.hpfilttype = digital filter type, 'but' (default) or 'firws' or 'fir' or 'firls' + cfg.bpfilttype = digital filter type, 'but' (default) or 'firws' or 'fir' or 'firls' + cfg.bsfilttype = digital filter type, 'but' (default) or 'firws' or 'fir' or 'firls' + cfg.lpfiltdir = filter direction, 'twopass' (default), 'onepass' or 'onepass-reverse' or 'onepass-zerophase' (default for firws) or 'onepass-minphase' (firws, non-linear!) + cfg.hpfiltdir = filter direction, 'twopass' (default), 'onepass' or 'onepass-reverse' or 'onepass-zerophase' (default for firws) or 'onepass-minphase' (firws, non-linear!) + cfg.bpfiltdir = filter direction, 'twopass' (default), 'onepass' or 'onepass-reverse' or 'onepass-zerophase' (default for firws) or 'onepass-minphase' (firws, non-linear!) + cfg.bsfiltdir = filter direction, 'twopass' (default), 'onepass' or 'onepass-reverse' or 'onepass-zerophase' (default for firws) or 'onepass-minphase' (firws, non-linear!) + cfg.lpinstabilityfix = deal with filter instability, 'no', 'reduce', 'split' (default = 'no') + cfg.hpinstabilityfix = deal with filter instability, 'no', 'reduce', 'split' (default = 'no') + cfg.bpinstabilityfix = deal with filter instability, 'no', 'reduce', 'split' (default = 'no') + cfg.bsinstabilityfix = deal with filter instability, 'no', 'reduce', 'split' (default = 'no') + cfg.lpfiltdf = lowpass transition width (firws, overrides order, default set in low-level function) + cfg.hpfiltdf = highpass transition width (firws, overrides order, default set in low-level function) + cfg.bpfiltdf = bandpass transition width (firws, overrides order, default set in low-level function) + cfg.bsfiltdf = bandstop transition width (firws, overrides order, default set in low-level function) + cfg.lpfiltwintype = lowpass window type, 'hann' or 'hamming' (default) or 'blackman' or 'kaiser' (firws) + cfg.hpfiltwintype = highpass window type, 'hann' or 'hamming' (default) or 'blackman' or 'kaiser' (firws) + cfg.bpfiltwintype = bandpass window type, 'hann' or 'hamming' (default) or 'blackman' or 'kaiser' (firws) + cfg.bsfiltwintype = bandstop window type, 'hann' or 'hamming' (default) or 'blackman' or 'kaiser' (firws) + cfg.lpfiltdev = lowpass max passband deviation (firws with 'kaiser' window, default 0.001 set in low-level function) + cfg.hpfiltdev = highpass max passband deviation (firws with 'kaiser' window, default 0.001 set in low-level function) + cfg.bpfiltdev = bandpass max passband deviation (firws with 'kaiser' window, default 0.001 set in low-level function) + cfg.bsfiltdev = bandstop max passband deviation (firws with 'kaiser' window, default 0.001 set in low-level function) + cfg.dftreplace = 'zero' or 'neighbour', method used to reduce line noise, 'zero' implies DFT filter, 'neighbour' implies spectrum interpolation (default = 'zero') + cfg.dftbandwidth = bandwidth of line noise frequencies, applies to spectrum interpolation, in Hz (default = [1 2 3]) + cfg.dftneighbourwidth = bandwidth of frequencies neighbouring line noise frequencies, applies to spectrum interpolation, in Hz (default = [2 2 2]) + cfg.plotfiltresp = 'no' or 'yes', plot filter responses (firws, default = 'no') + cfg.usefftfilt = 'no' or 'yes', use fftfilt instead of filter (firws, default = 'no') + cfg.demean = 'no' or 'yes' + cfg.baselinewindow = [begin end] in seconds, the default is the complete trial + cfg.detrend = 'no' or 'yes', this is done on the complete trial + cfg.polyremoval = 'no' or 'yes', this is done on the complete trial + cfg.polyorder = polynome order (default = 2) + cfg.derivative = 'no' (default) or 'yes', computes the first order derivative of the data, using the MATLAB gradient function + cfg.hilbert = 'no', 'abs', 'complex', 'real', 'imag', 'absreal', 'absimag' or 'angle' (default = 'no') + cfg.rectify = 'no' or 'yes' + cfg.precision = 'single' or 'double' (default = 'double') + cfg.absdiff = 'no' or 'yes', computes absolute of the first order difference (i.e. first diff then rectify), using the MATLAB diff function + + Preprocessing options that you should only use for EEG data are + cfg.reref = 'no' or 'yes' (default = 'no') + cfg.refchannel = cell-array with new EEG reference channel(s) + cfg.refmethod = 'avg', 'median', 'rest', 'bipolar' or 'laplace' (default = 'avg') + cfg.groupchans = 'yes' or 'no', should channels be rereferenced in separate groups + for bipolar and laplace methods, this requires channnels to be + named using an alphanumeric code, where letters represent the + group and numbers represent the order of the channel whithin + its group (default = 'no') + cfg.leadfield = matrix or cell-array, this is required when refmethod is 'rest' + The leadfield can be a single matrix (channels X sources) which + is calculated by using the forward theory, based on the + electrode montage, head model and equivalent source model. + It can also be the output of FT_PREPARE_LEADFIELD based on a + realistic head model. + cfg.implicitref = 'label' or empty, add the implicit EEG reference as zeros (default = []) + cfg.montage = 'no' or a montage structure (default = 'no') + + See also FT_READ_DATA, FT_READ_HEADER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/private/preproc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("preproc", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/_read_neuralynx_dma.py b/fieldtrip/__contrib/__spike/_read_neuralynx_dma.py new file mode 100644 index 0000000..abc463e --- /dev/null +++ b/fieldtrip/__contrib/__spike/_read_neuralynx_dma.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuralynx_dma(*args, **kwargs): + """ + READ_NEURALYNX_DMA reads specified samples and channels data from a Neuralynx DMA log file + + Use as + [hdr] = read_neuralynx_dma(filename) + [dat] = read_neuralynx_dma(filename, begsample, endsample) + [dat] = read_neuralynx_dma(filename, begsample, endsample, chanindx) + + The channel specification can be a vector with indices, or a single string with the value + 'all', 'stx', 'pid', 'siz', 'tsh', 'tsl', + 'cpu', 'ttl', 'x01', ..., 'x10' + + This function returns the electrophysiological data in AD units + and not in uV. You should look up the details of the headstage and + the Neuralynx amplifier and scale the values accordingly. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/private/read_neuralynx_dma.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuralynx_dma", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/_sine_taper.py b/fieldtrip/__contrib/__spike/_sine_taper.py new file mode 100644 index 0000000..0eff1f6 --- /dev/null +++ b/fieldtrip/__contrib/__spike/_sine_taper.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _sine_taper(*args, **kwargs): + """ + Compute Riedel & Sidorenko sine tapers. + sine_taper(n, k) produces the first 2*k tapers of length n, + returned as the columns of d. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/private/sine_taper.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sine_taper", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/_smartinput.py b/fieldtrip/__contrib/__spike/_smartinput.py new file mode 100644 index 0000000..55e9cdd --- /dev/null +++ b/fieldtrip/__contrib/__spike/_smartinput.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _smartinput(*args, **kwargs): + """ + SMARTINPUT helper function for smart interactive input from the command line + + Use as + [newval, change] = smartinput(question, oldval) + + See also INPUT, PAUSE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/private/smartinput.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("smartinput", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/_specest_nanfft.py b/fieldtrip/__contrib/__spike/_specest_nanfft.py new file mode 100644 index 0000000..1ab46ea --- /dev/null +++ b/fieldtrip/__contrib/__spike/_specest_nanfft.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _specest_nanfft(*args, **kwargs): + """ + SPECEST_NANFFT computes a fast Fourier transform in the presence of NaNs + in the data + + Use as + [spectrum] = specest_nanfft(dat, ...) + where + dat = matrix of chan*sample + time = vector, containing time in seconds for each sample + spectrum = matrix of taper*chan*foi*toi of fourier coefficients + + Optional arguments should be specified in key-value pairs and can include: + basis = precomputes set of basis functions (sines/cosines) + datataype = 0, 1, 2 + + FIXME: FFT speed not yet optimized, e.g. MATLAB version, transpose or not, ... + FIXME: function is recursive, should be avoided in favor of transparancy + + See also SPECEST_MTMFFT, SPECEST_CONVOL, SPECEST_HILBERT, SPECEST_MTMCONVOL, SPECEST_MVAR, SPECEST_WAVELET + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/private/specest_nanfft.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("specest_nanfft", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/_spike_crossx.py b/fieldtrip/__contrib/__spike/_spike_crossx.py new file mode 100644 index 0000000..6db47f5 --- /dev/null +++ b/fieldtrip/__contrib/__spike/_spike_crossx.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _spike_crossx(*args, **kwargs): + """ + FT_SPIKE_SUB_CROSSX computes cross-correlations between two + point-processes. + + Use as [C,bins] = ft_spike_sub_crossx(t1,t2,binsize,nbins) + + Inputs: + t1 and t2 are two sorted vectors containing spike-times + binsize: the binsize for the cross-correlation histogram in seconds + nbins: the number of bins to use for the cross-correlation histogram + + Ouputs: + C is the cross-correlation histogram + bins: vector with the times corresponding to the bin centers + + Note that this function is implemented as a mex file. If the mex file is + missing on your platform, it will make an attempt to automatically + compile it + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/private/spike_crossx.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("spike_crossx", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spike_isi.py b/fieldtrip/__contrib/__spike/ft_spike_isi.py new file mode 100644 index 0000000..7a0e710 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spike_isi.py @@ -0,0 +1,74 @@ +from fieldtrip._runtime import Runtime + + +def ft_spike_isi(*args, **kwargs): + """ + FT_SPIKE_ISI computes the interspike interval histogram + + The input SPIKE should be organised as + a) the spike datatype, obtained from FT_SPIKE_MAKETRIALS + b) the raw datatype, containing binary spike trains, obtained from + FT_APPENDSPIKE or FT_CHECKDATA. In this case the raw datatype is + converted to the spike datatype. + + Use as + [isih] = ft_spike_isi(cfg, spike) + + Configurations: + cfg.outputunit = 'spikecount' (default) or 'proportion' (sum of all bins = 1). + cfg.spikechannel = string or index of spike channels to + trigger on (default = 'all') + See FT_CHANNELSELECTION for details. + cfg.trials = numeric selection of trials (default = 'all') + cfg.bins = ascending vector of isi bin edges. + cfg.latency = [begin end] in seconds, 'max' (default), 'min', 'prestim'(t<=0), or + 'poststim' (t>=0). + If 'max', we use all available latencies. + If 'min', we use only the time window contained by all trials. + If 'prestim' or 'poststim', we use time to or + from 0, respectively. + ` cfg.keeptrials = 'yes' or 'no'. If 'yes', we keep the individual + isis between spikes and output as isih.isi + cfg.param = string, one of + 'gamfit' : returns [shape scale] for gamma distribution fit + 'coeffvar' : coefficient of variation (sd / mean) + 'lv' : Shinomoto's Local Variation measure (2009) + + Outputs: + isih.avg = nUnits-by-nBins interspike interval histogram + isih.time = 1 x nBins bincenters corresponding to isih.avg + isih.isi = 1-by-nUnits cell with interval to previous spike per spike. + For example isih.isi{1}(2) = 0.1 means that the + second spike fired was 0.1 s later than the + first. Note that jumps within trials or first + spikes within trials are given NaNs. + isih.label = 1-by-nUnits cell-array with labels + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spike_isi.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spike_isi", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spike_jpsth.py b/fieldtrip/__contrib/__spike/ft_spike_jpsth.py new file mode 100644 index 0000000..0d14844 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spike_jpsth.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def ft_spike_jpsth(*args, **kwargs): + """ + FT_SPIKE_JPSTH computes the joint peristimulus histograms for spiketrains + and a shift predictor (for example see Aertsen et al. 1989). + + The shift predictor is computed in consecutive trials in a symmetric way. + For example, we compute the jpsth for chan 1 in trial 1 versus chan 2 in + trial 2, but also for chan 1 in trial 2 versus chan 2 in trial 1. This + gives (nTrials-1)*2 jpsth matrices for individual trials. Picking + consecutive trials and computing the shift predictor in a symmetric way + ensures that slow changes in the temporal structure do not affect the + shift predictor (as opposed to shuffling the order of all trials for one + of the two channels). + + Use as + [jpsth] = ft_spike_jpsth(cfg,psth) + + The input PSTH should be organised as the input from FT_SPIKE_PSTH, + FT_SPIKE_DENSITY or FT_TIMELOCKANALYSIS containing a field PSTH.trial and + PSTH.time. In any case, one is expected to use cfg.keeptrials = 'yes' in + these functions. + + Configurations: + cfg.method = 'jpsth' or 'shiftpredictor'. If 'jpsth', we + output the normal stat. If 'shiftpredictor', + we compute the jpsth after shuffling subsequent + trials. + cfg.normalization = 'no' (default), or 'yes'. If requested, the joint psth is normalized as in van Aertsen et al. (1989). + cfg.channelcmb = Mx2 cell-array with selection of channel pairs (default = {'all' 'all'}), see FT_CHANNELCOMBINATION for details + cfg.trials = 'all' (default) or numerical or logical array of to be selected trials. + cfg.latency = [begin end] in seconds, 'maxperiod' (default), 'prestim'(t<=0), or 'poststim' (t>=0) + cfg.keeptrials = 'yes' or 'no' (default) + + See also FT_SPIKE_PSTH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spike_jpsth.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spike_jpsth", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spike_maketrials.py b/fieldtrip/__contrib/__spike/ft_spike_maketrials.py new file mode 100644 index 0000000..1649f6d --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spike_maketrials.py @@ -0,0 +1,83 @@ +from fieldtrip._runtime import Runtime + + +def ft_spike_maketrials(*args, **kwargs): + """ + FT_SPIKE_MAKETRIALS converts raw timestamps in a SPIKE structure to spike times + that are relative to an event trigger in an SPIKE structure. This is a + preprocessing step to use functions such as FT_SPIKE_PSTH. + + The main function of FT_SPIKE_MAKETRIALS is to create the field spike.time and + spike.trial, which contain the trial numbers in which the spikes were recorded, and + the onset and offset of the trial relative to trigger time t = 0. + + Use as + [spike] = ft_spike_maketrials(cfg,spike) + where the input data structure consists of raw spikes obtained from FT_READ_SPIKE + + Configurations: + + cfg.trl = is an nTrials-by-M matrix, with at least 3 columns: + Every row contains start (col 1), end (col 2) and offset of the event trigger + in the trial in timestamp or sample units (cfg.trlunit). For example, an offset + of -1000 means that the trigger (t = 0 sec) occurred 1000 timestamps or samples + after the trial start. + If more columns are added than 3, these are used to construct the + spike.trialinfo field having information about the trial. Note that values in + cfg.trl get inaccurate above 2^53 (in that case it is better to use the + original uint64 representation) + + cfg.trlunit = 'timestamps' (default) or 'samples'. + If 'samples', cfg.trl should be specified in samples, and cfg.hdr = data.hdr + should be specified. This option can be used to reuse a cfg.trl that was used + for preprocessing LFP data. + If 'timestamps', cfg.timestampspersecond should be specified, but cfg.hdr + should not. + + cfg.hdr = struct, this should be specified if cfg.trlunit = 'samples'. + This should be specified as cfg.hdr = data.hdr, where data.hdr contains the + subfields data.hdr.Fs (sampling frequency of the LFP), data.hdr.FirstTimeStamp, + and data.hdr.TimeStampPerSecond. + + cfg.timestampspersecond = number of timestaps per second (e.g. 1000000 for + Neuralynx). This can be computed for example from the LFP hdr + (cfg.timestampspersecond = data.hdr.Fs*data.hdr.TimeStampPerSecond) or is a + priori known. + + The following outputs are appended to the input spike structure: + spike.time = 1-by-nUnits cell-array, containing the spike times in + seconds relative to the event trigger. + spike.trial = 1-by-nUnits cell-array, containing the trial number for + every spike telling in which trial it was recorded. + spike.trialtime = nTrials-by-2 matrix specifying the start and end of + every trial in seconds. + spike.trialinfo = contains trial information + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spike_maketrials.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spike_maketrials", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spike_plot_isi.py b/fieldtrip/__contrib/__spike/ft_spike_plot_isi.py new file mode 100644 index 0000000..b6ac5f8 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spike_plot_isi.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def ft_spike_plot_isi(*args, **kwargs): + """ + FT_SPIKE_PLOT_ISI makes an inter-spike-interval bar plot. + + Use as + ft_spike_plot_isi(cfg, isih) + + Inputs: + ISIH is the output from FT_SPIKE_ISIHIST + + Configurations: + cfg.spikechannel = string or index or logical array to to select 1 spike channel. + (default = 1). + cfg.ylim = [min max] or 'auto' (default) + If 'auto', we plot from 0 to 110% of maximum plotted value); + cfg.plotfit = 'yes' (default) or 'no'. This requires that when calling + FT_SPIKESTATION_ISI, cfg.gammafit = 'yes'. + + Outputs: + hdl.fit = handle for line fit. Use SET and GET to access. + hdl.isih = handle for bar isi histogram. Use SET and GET to access. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spike_plot_isi.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spike_plot_isi", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spike_plot_isireturn.py b/fieldtrip/__contrib/__spike/ft_spike_plot_isireturn.py new file mode 100644 index 0000000..48c3907 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spike_plot_isireturn.py @@ -0,0 +1,69 @@ +from fieldtrip._runtime import Runtime + + +def ft_spike_plot_isireturn(*args, **kwargs): + """ + FT_SPIKE_PLOT_ISIRETURN makes a return plot from ISIH structure. A return + plot (also called Poincare plot) plots the isi to the next spike versus the isi + from the next spike to the second next spike, and thus gives insight in + the second order isi statistics. This func also plots the raw + isi-histogram on left and bottom and thereby give a rather complete + visualization of the spike-train interval statistics. + + Use as + ft_spike_plot_isireturn(cfg, data) + + Inputs: + ISIH must be the output structure from FT_SPIKE_ISI and contain the field + ISIH.isi. + + General configurations: + cfg.spikechannel = string or index of single spike channel to trigger on (default = 1) + Only one spikechannel can be plotted at a time. + cfg.density = 'yes' or 'no', if 'yes', we will use color shading on top of + the individual datapoints to indicate the density. + cfg.scatter = 'yes' (default) or 'no'. If 'yes', we plot the individual values. + cfg.dt = resolution of the 2-D histogram, or of the kernel plot in seconds. Since we + have to smooth for a finite number of values, cfg.dt determines + the resolution of our smooth density plot. + cfg.colormap = N-by-3 colormap (see COLORMAP). Default = hot(256); + cfg.interpolate = integer (default = 1), we perform interpolating + with extra number of spacings determined by + cfg.interpolate. For example cfg.interpolate = 5 + means 5 times more dense axis. + cfg.window = 'no', 'gausswin' or 'boxcar' + 'gausswin' is N-by-N multivariate gaussian, where the diagonal of the + covariance matrix is set by cfg.gaussvar. + 'boxcar' is N-by-N rectangular window. + cfg.gaussvar = variance (default = 1/16 of window length in sec). + cfg.winlen = window length in seconds (default = 5*cfg.dt). The total + length of our window is 2*round*(cfg.winlen/cfg.dt) +1; + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spike_plot_isireturn.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spike_plot_isireturn", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spike_plot_jpsth.py b/fieldtrip/__contrib/__spike/ft_spike_plot_jpsth.py new file mode 100644 index 0000000..c8d0f59 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spike_plot_jpsth.py @@ -0,0 +1,65 @@ +from fieldtrip._runtime import Runtime + + +def ft_spike_plot_jpsth(*args, **kwargs): + """ + FT_SPIKE_PLOT_JPSTH makes a plot from JPSTH structure. + + Use as + ft_spike_plot_jpsth(cfg, jpsth) + + Inputs: + JPSTH must be the output structure from FT_SPIKE_JPSTH and contain the + field JPSTH.avg. If cfg.psth = 'yes', the field JPSTH.psth must be + present as well. + + General configurations: + cfg.channelcmb = string or index of single channel combination to trigger on. + See SPIKESTATION_FT_SUB_CHANNELCOMBINATION for details. + cfg.psth = 'yes' (default) or 'no'. Plot PSTH with JPSTH if 'yes'; + cfg.latency = [begin end] in seconds or 'max' (default), 'prestim' or 'poststim'; + cfg.colorbar = 'yes' (default) or 'no' + cfg.colormap = N-by-3 colormap (see COLORMAP). or 'auto' (default,hot(256)) + cfg.interpolate = integer (default = 1), we perform interpolating + with extra number of spacings determined by + cfg.interpolate. For example cfg.interpolate = 5 + means 5 times more dense axis. + cfg.window = 'string' or N-by-N matrix + 'no': apply no smoothing + ' gausswin' use a Gaussian smooth function + ' boxcar' use a box-car to smooth + cfg.gaussvar = variance (default = 1/16 of window length in sec). + cfg.winlen = window length in seconds (default = 5*binwidth). + length of our window is 2*round*(cfg.winlen/binwidth) + where binwidth is the binwidth of the jpsth (jpsth.time(2)-jpsth.time(1)). + + See also FT_SPIKE_JPSTH, FT_SPIKE_PSTH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spike_plot_jpsth.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spike_plot_jpsth", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spike_plot_psth.py b/fieldtrip/__contrib/__spike/ft_spike_plot_psth.py new file mode 100644 index 0000000..445e79f --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spike_plot_psth.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def ft_spike_plot_psth(*args, **kwargs): + """ + FT_SPIKE_PLOT_PSTH makes a bar plot of PSTH structure with error bars. + + Use as + ft_spike_plot_psth(cfg, psth) + + Inputs: + PSTH typically is a structure from FT_SPIKE_PSTH. + + Configurations: + cfg.latency = [begin end] in seconds, 'maxperiod' (default), 'prestim'(t<=0), or + 'poststim' (t>=0). + cfg.errorbars = 'no', 'std', 'sem' (default), 'conf95%' (requires statistic toolbox, + according to student-T distribution), 'var' + cfg.spikechannel = string or index of single spike channel to trigger on (default = 1) + Only one spikechannel can be plotted at a time. + cfg.ylim = [min max] or 'auto' (default) + If 'standard', we plot from 0 to 110% of maximum plotted value); + Outputs: + cfg.hdl.avg = figure handle for the bar plot, psth average. + cfg.hdl.var = figure handle for the error lines. + + See also FT_SPIKE_PSTH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spike_plot_psth.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spike_plot_psth", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spike_plot_raster.py b/fieldtrip/__contrib/__spike/ft_spike_plot_raster.py new file mode 100644 index 0000000..53f5c2a --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spike_plot_raster.py @@ -0,0 +1,70 @@ +from fieldtrip._runtime import Runtime + + +def ft_spike_plot_raster(*args, **kwargs): + """ + FT_SPIKE_PLOT_RASTER makes a raster plot of spike-trains and allows for a + spike-density or a PSTH plot on top. + + Use as + ft_spike_plot_raster(cfg, spike) + or + ft_spike_plot_raster(cfg, spike, timelock) + + The input SPIKE data structure should be organized as the spike or the + raw datatype The optional input TIMELOCK should be organized as the + timelock datatype, e.g. the output from FT_SPIKE_PSTH or FT_SPIKEDENSITY, + having the average firing rate / spike count per time-point / time-bin. + However, timelock could also be the output from FT_TIMELOCKANALYSIS. + + Configuration options + cfg.spikechannel = see FT_CHANNELSELECTION for details + cfg.latency = [begin end] in seconds, 'maxperiod' (default), 'minperiod', + 'prestim' (all t<=0), or 'poststim' (all t>=0). + cfg.linewidth = number indicating the width of the lines (default = 1); + cfg.cmapneurons = 'auto' (default), or nUnits-by-3 matrix. + Controls coloring of spikes and psth/density + data if multiple cells are present. + cfg.spikelength = number >0 and <=1 indicating the length of the spike. If + cfg.spikelength = 1, then no space will be left between + subsequent rows representing trials (row-unit is 1). + cfg.trialborders = 'yes' or 'no'. If 'yes', borders of trials are + plotted + cfg.plotselection = 'yes' or 'no' (default). If yes plot Y axis only for selection in cfg.trials + cfg.topplotsize = number ranging from 0 to 1, indicating the proportion of the + rasterplot that the top plot will take (e.g., with 0.7 the top + plot will be 70% of the rasterplot in size). Default = 0.5. + cfg.topplotfunc = 'bar' (default) or 'line'. + cfg.errorbars = 'no', 'std', 'sem' (default), 'conf95%','var' + + cfg.interactive = 'yes' (default) or 'no'. If 'yes', zooming and panning operate via callbacks. + cfg.trials = numeric or logical selection of trials (default = 'all'). + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spike_plot_raster.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spike_plot_raster", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spike_psth.py b/fieldtrip/__contrib/__spike/ft_spike_psth.py new file mode 100644 index 0000000..53bfef5 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spike_psth.py @@ -0,0 +1,93 @@ +from fieldtrip._runtime import Runtime + + +def ft_spike_psth(*args, **kwargs): + """ + FT_SPIKE_PSTH computes the peristimulus histogram of spiketrains. + + Use as + [psth] = ft_spike_psth(cfg, spike) + + The input SPIKE should be organised as either the spike datatype, + obtained from FT_SPIKE_MAKETRIALS, or the raw datatype, containing binary + spike trains, obtained from FT_APPENDSPIKE or FT_CHECKDATA. In this case + the raw datatype is converted to the spike datatype. + + Configurations: + cfg.binsize = [binsize] in sec or string. + If 'scott', we estimate the optimal bin width + using Scott's formula (1979). If 'sqrt', we take + the number of bins as the square root of the + number of observations. The optimal bin width is + derived over all neurons; thus, this procedure + works best if the input contains only one neuron + at a time. + cfg.outputunit = 'rate' (default) or 'spikecount' or + 'proportion'. If 'rate', we + convert the output per trial to firing rates + (spikes/sec). If 'spikecount', we count the + number spikes per trial. If 'proportion', we + normalize the area under the PSTH to 1. + cfg.spikechannel = See FT_CHANNELSELECTION for details. cfg.trials + is vector of indices (e.g., 1:2:10) + logical selection of trials (e.g., [1010101010]) + 'all' (default), selects all trials + cfg.vartriallen = 'yes' (default) + Accept variable trial lengths and use all + available trials and the samples in every trial. + Missing values will be ignored in the + computation of the average and the variance and + stored as NaNs in the output psth.trial. 'no' + Only select those trials that fully cover the + window as specified by cfg.latency and discard + those trials that do not. + cfg.latency = [begin end] in seconds + 'maxperiod' (default), i.e., maximum period + available 'minperiod', i.e., the minimal period + all trials share, 'prestim' (all t<=0) 'poststim' + (all t>=0). + cfg.keeptrials = 'yes' or 'no' (default) + cfg.trials = numeric or logical selection of trials (default = 'all') + + Outputs: + Psth is a timelock datatype (see FT_DATATYPE_TIMELOCK) + Psth.time = center histogram bin points + Psth.fsample = 1/binsize; + Psth.avg = contains average PSTH per unit + Psth.trial = contains PSTH per unit per trial + Psth.var = contains variance of PSTH per unit across trials + + For subsequent processing you can use + FT_SPIKE_PLOT_PSTH : plot only the PSTH, for a single neuron + FT_TIMELOCKSTATISTICS : compute statistics on the PSTH + FT_SPIKE_PLOT_RASTER : plot PSTH with raster for one or more neurons + FT_SPIKE_JPSTH : compute the JPSTH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spike_psth.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spike_psth", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spike_rate.py b/fieldtrip/__contrib/__spike/ft_spike_rate.py new file mode 100644 index 0000000..bbe25c4 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spike_rate.py @@ -0,0 +1,71 @@ +from fieldtrip._runtime import Runtime + + +def ft_spike_rate(*args, **kwargs): + """ + FT_SPIKE_RATE computes the firing rate of spiketrains and their variance + + Use as + [rate] = ft_spike_rate(cfg, spike) + + The input SPIKE should be organised as the spike or the (binary) raw + datatype, obtained from FT_SPIKE_MAKETRIALS or FT_APPENDSPIKE (in that + case, conversion is done within the function) + + Configurations: + cfg.outputunit = 'rate' (default) or 'spikecount'. If 'rate', we convert + the output per trial to firing rates (spikes/sec). + If 'spikecount', we count the number spikes per trial. + cfg.spikechannel = see FT_CHANNELSELECTION for details + cfg.trials = vector of indices (e.g., 1:2:10) + logical selection of trials (e.g., [1010101010]) + 'all' (default), selects all trials% cfg.trials + cfg.vartriallen = 'yes' (default) or 'no'. + If 'yes' - accept variable trial lengths and use all available trials + and the samples in every trial. + If 'no' - only select those trials that fully cover the window as + specified by cfg.latency and discard those trials that do not. + cfg.latency = [begin end] in seconds + 'maxperiod' (default) + 'minperiod', i.e., the minimal period all trials share + 'prestim' (all t<=0) + 'poststim' (all t>=0). + cfg.keeptrials = 'yes' or 'no' (default). + + The outputs from spike is a TIMELOCK structure (see FT_DATATYPE_TIMELOCK) + rate.trial: nTrials x nUnits matrix containing the firing rate per unit and trial + rate.avg: nTrials array containing the average firing rate per unit + rate.var: nTrials array containing the variance of firing rates per unit + rate.dof: nTrials array containing the degree of freedom per unit + rate.label: nUnits cell-array containing the labels of the neuronal units% + rate.time: Mean latency (this field ensures it is TIMELOCK + struct) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spike_rate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spike_rate", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spike_rate_orituning.py b/fieldtrip/__contrib/__spike/ft_spike_rate_orituning.py new file mode 100644 index 0000000..9185480 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spike_rate_orituning.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def ft_spike_rate_orituning(*args, **kwargs): + """ + FT_SPIKE_RATE_ORITUNING computes a model of the firing rate as a function + of orientation or direction. + + Use as + [stat] = ft_spike_rate_tuning(cfg, rate1, rate2, ... rateN) + + The inputs RATE should be the output from FT_SPIKE_RATE. + + Configurations: + cfg.stimuli = should be an 1 x nConditions array of orientations or + directions in radians + varargin{i} corresponds to cfg.stimuli(i) + cfg.method = model to apply, implemented are 'orientation' and 'direction' + + Outputs: + stat.ang = mean angle of orientation / direction (1 x nUnits) + stat.osi = orientation selectivity index (Womelsdorf et al., 2012, + PNAS), that is resultant length. + if cfg.method = 'orientation', then orientations are + first projected on the unit circle. + stat.di = direction index, 1 - min/max response + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spike_rate_orituning.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spike_rate_orituning", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spike_select.py b/fieldtrip/__contrib/__spike/ft_spike_select.py new file mode 100644 index 0000000..e129b42 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spike_select.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def ft_spike_select(*args, **kwargs): + """ + FT_SPIKE_SELECT selects subsets of spikes, channels and trials from a + spike structure. + + Use as + [spike] = ft_spike_select(cfg, spike) + + The input SPIKE should be organised as the spike datatype (see + FT_DATATYPE_SPIKE) + + Configurations: + cfg.spikechannel = See FT_CHANNELSELECTION for details. + cfg.trials = vector of indices (e.g., 1:2:10) + logical selection of trials (e.g., [1010101010]) + 'all' (default), selects all trials + cfg.latency = [begin end] in seconds + 'maxperiod' (default), i.e., maximum period available + 'minperiod', i.e., the minimal period all trials share + 'prestim' (all t<=0) + 'poststim' (all t>=0). + Outputs: + Spike structure with selections + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spike_select.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spike_select", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spike_waveform.py b/fieldtrip/__contrib/__spike/ft_spike_waveform.py new file mode 100644 index 0000000..42f5bd8 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spike_waveform.py @@ -0,0 +1,68 @@ +from fieldtrip._runtime import Runtime + + +def ft_spike_waveform(*args, **kwargs): + """ + FT_SPIKE_WAVEFORM computes descriptive parameters on + waveform (mean and variance), and performs operations like realignment, outlier rejection, + invertation, normalization and interpolation (see configurations). + + Use as + [wave] = ft_spike_waveform(cfg, spike) + Or + [wave, spike] = ft_spike_waveform(cfg, spike) + The input SPIKE should be organised as the SPIKE datatype (see FT_DATATYPE_SPIKE) + + Configurations: + cfg.rejectonpeak = 'yes' (default) or 'no': takes away waveforms with too late peak, and no + rising AP towards peak of other waveforms + cfg.rejectclippedspikes = 'yes' (default) or 'no': removes spikes that + saturated the voltage range. + cfg.normalize = 'yes' (default) or 'no': normalizes all + waveforms + to have peak-to-through amp of 2 + cfg.interpolate = double integer (default = 1). Increaes the + density of samples by a factor cfg.interpolate + cfg.align = 'yes' (def). or 'no'. If 'yes', we align all waves to + maximum + cfg.fsample = sampling frequency of waveform time-axis. + Obligatory field. + cfg.spikechannel = See FT_CHANNELSELECTION for details. + + Outputs: + Wave.avg = average waveform + Wave.time = time of waveform axis + Wave.var = variance of waveform + Wave.dof = number of spikes contributing to average + + Spike structure if two outputs are desired: waveform is replaced by interpolated and + cleaned waveforms, removing also their associated time-stamps and data. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spike_waveform.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spike_waveform", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spike_xcorr.py b/fieldtrip/__contrib/__spike/ft_spike_xcorr.py new file mode 100644 index 0000000..29626f1 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spike_xcorr.py @@ -0,0 +1,98 @@ +from fieldtrip._runtime import Runtime + + +def ft_spike_xcorr(*args, **kwargs): + """ + FT_SPIKE_XCORR computes the cross-correlation histogram and shift predictor. + + Use as + [stat] = ft_spike_xcorr(cfg, data) + + The input SPIKE should be organised as the spike or the raw datatype, obtained from + FT_SPIKE_MAKETRIALS or FT_PREPROCESSING (in that case, conversion is done + within the function). A mex file is located in /contrib/spike/private + which will be automatically mexed. + + Configurations options for xcorr general: + cfg.maxlag = number in seconds, indicating the maximum lag for the + cross-correlation function in sec (default = 0.1 sec). + cfg.debias = 'yes' (default) or 'no'. If 'yes', we scale the + cross-correlogram by M/(M-abs(lags)), where M = 2*N -1 with N + the length of the data segment. + cfg.method = 'xcorr' or 'shiftpredictor'. If 'shiftpredictor' + we do not compute the normal cross-correlation + but shuffle the subsequent trials. + If two channels are independent, then the shift + predictor should give the same correlogram as the raw + correlogram calculated from the same trials. + Typically, the shift predictor is subtracted from the + correlogram. + cfg.outputunit = - 'proportion' (value in each bin indicates proportion of occurence) + - 'center' (values are scaled to center value which is set to 1) + - 'raw' (default) unnormalized crosscorrelogram. + cfg.binsize = [binsize] in sec (default = 0.001 sec). + cfg.channelcmb = Mx2 cell-array with selection of channel pairs (default = {'all' 'all'}), + see FT_CHANNELCOMBINATION for details + cfg.latency = [begin end] in seconds, 'max' (default), 'min', 'prestim'(t<=0), or + 'poststim' (t>=0).% + cfg.vartriallen = 'yes' (default) or 'no'. + If 'yes' - accept variable trial lengths and use all available trials + and the samples in every trial. + If 'no' - only select those trials that fully cover the window as + specified by cfg.latency and discard those trials that do not. + if cfg.method = 'yes', then cfg.vartriallen + should be 'no' (otherwise, fewer coincidences + will occur because of non-overlapping windows) + cfg.trials = numeric selection of trials (default = 'all') + cfg.keeptrials = 'yes' or 'no' (default) + + A peak at a negative lag for stat.xcorr(chan1,chan2,:) means that chan1 is leading + chan2. Thus, a negative lag represents a spike in the second dimension of + stat.xcorr before the channel in the third dimension of stat.stat. + + Variable trial length is controlled by the option cfg.vartriallen. If it is + specified as cfg.vartriallen='yes', all trials are selected that have a minimum + overlap with the latency window of cfg.maxlag. However, the shift predictor + calculation demands that following trials have the same amount of data, otherwise, + it does not control for rate non-stationarities. If cfg.vartriallen = 'yes', all + trials should fall in the latency window, otherwise we do not compute the shift + predictor. + + Output: + stat.xcorr = nchans-by-nchans-by-(2*nlags+1) cross correlation histogram with dimord 'chan_chan_time' + or + stat.shiftpredictor = nchans-by-nchans-by-(2*nlags+1) shift predictor with dimord 'chan_chan_time' + and + stat.lags = (2*nlags + 1) vector with lags in seconds. + stat.trial = ntrials-by-nchans-by-nchans-by-(2*nlags + 1) with single trials and dimord 'rpt_chan_chan_time' + stat.label = corresponding labels to channels in stat.xcorr + stat.cfg = configurations used in this function + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spike_xcorr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spike_xcorr", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spikedensity.py b/fieldtrip/__contrib/__spike/ft_spikedensity.py new file mode 100644 index 0000000..11f2c54 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spikedensity.py @@ -0,0 +1,97 @@ +from fieldtrip._runtime import Runtime + + +def ft_spikedensity(*args, **kwargs): + """ + FT_SPIKEDENSITY computes the spike density function of the spike trains by + convolving the data with a window. + + Use as + [sdf] = ft_spike_density(cfg, data) + [sdf, sdfdata] = ft_spike_density(cfg, data) + + If you specify one output argument, only the average and variance of spike density + function across trials will be computed and individual trials are not kept. See + cfg.winfunc below for more information on the smoothing kernel to use. + + Inputs: + DATA should be organised in a RAW structure with binary spike + representations obtained from FT_APPENDSPIKE or FT_CHECKDATA, or + a SPIKE structure. + + Configurations: + cfg.timwin = [begin end], time of the smoothing kernel (default = [-0.05 0.05]) + If cfg.winfunc = @alphawin, cfg.timwin(1) will be + set to 0. Hence, it is possible to use asymmetric + kernels. + cfg.outputunit = 'rate' (default) or 'spikecount'. This determines the physical unit + of our spikedensityfunction, either in firing rate or in spikecount. + cfg.winfunc = (a) string or function handle, type of window to convolve with (def = 'gauss'). + - 'gauss' (default) + - 'alphawin', given by win = x*exp(-x/timeconstant) + - For standard window functions in the signal processing toolbox see + WINDOW. + (b) vector of length nSamples, used directly as window + cfg.winfuncopt = options that go with cfg.winfunc + For cfg.winfunc = 'alpha': the timeconstant in seconds (default = 0.005s) + For cfg.winfunc = 'gauss': the standard deviation in seconds (default = + 1/4 of window duration in seconds) + For cfg.winfunc = 'wname' with 'wname' any standard window function + see window opts in that function and add as cell-array + If cfg.winfunctopt = [], default opts are taken. + cfg.latency = [begin end] in seconds, 'maxperiod' (default), 'minperiod', + 'prestim'(t>=0), or 'poststim' (t>=0). + cfg.vartriallen = 'yes' (default) or 'no'. + 'yes' - accept variable trial lengths and use all available trials + and the samples in every trial. Missing values will be ignored in + the computation of the average and the variance. + 'no' - only select those trials that fully cover the window as + specified by cfg.latency. + cfg.spikechannel = cell-array ,see FT_CHANNELSELECTION for details + cfg.trials = numeric or logical selection of trials (default = 'all') + cfg.keeptrials = 'yes' or 'no' (default). If 'yes', we store the trials in a matrix + in the output SDF as well + cfg.fsample = additional user input that can be used when input + is a SPIKE structure, in that case a continuous + representation is created using cfg.fsample + (default = 1000) + + The SDF output is a data structure similar to the TIMELOCK structure from FT_TIMELOCKANALYSIS. + For subsequent processing you can use for example + FT_TIMELOCKSTATISTICS Compute statistics on SDF + FT_SPIKE_PLOT_RASTER Plot together with the raster plots + FT_SINGLEPLOTER and FT_MULTIPLOTER Plot spike-density alone + + The SDFDATA output is a data structure similar to DATA type structure from FT_PREPROCESSING. + For subsequent processing you can use for example + FT_TIMELOCKANALYSIS Compute time-locked average and variance + FT_FREQANALYSIS Compute frequency and time-ferquency spectrum. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spikedensity.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spikedensity", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spikedetection.py b/fieldtrip/__contrib/__spike/ft_spikedetection.py new file mode 100644 index 0000000..98900ab --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spikedetection.py @@ -0,0 +1,92 @@ +from fieldtrip._runtime import Runtime + + +def ft_spikedetection(*args, **kwargs): + """ + FT_SPIKEDETECTION reads continuous data from disk and detects spikes. The + function writes the unsorted spike waveforms to disk in another file. + + Use as + [cfg] = ft_spikedetection(cfg) + + The configuration options can contain + cfg.dataset = string with the input dataset + cfg.output = string with the output dataset (default is determined automatic) + cfg.dataformat = string with the output dataset format, see FT_WRITE_FCDC_SPIKE + cfg.method = string with the method to use, can be 'all', 'zthresh', 'ztrig', 'flank' + cfg.interactive = 'yes' or 'no' + cfg.timestampdefinition = 'orig' or 'sample' + + The default is to process the full dataset. You can select a latency range with + cfg.latency = [begin end], default is [0 inf] + or you can specify multiple latency segments with + cfg.latency = [b1 e1; b2 e2; ...] + + Specific settings for the zthresh spike detection method are + cfg.zthresh.neg = negative threshold, e.g. -3 + cfg.zthresh.pos = positive threshold, e.g. 3 + cfg.zthresh.offset = number of samples before peak (default = 16) + cfg.zthresh.mindist = mininum distance in samples between detected peaks + + Specific settings for the flank spike detection method are + cfg.flank.value = positive or negative threshold + cfg.flank.offset = number of samples before peak + cfg.flank.ztransform = 'yes' or 'no' + cfg.flank.mindist = mininum distance in samples between detected peaks + + Furthermore, the configuration can contain options for preprocessing + cfg.preproc.lpfilter = 'no' or 'yes' lowpass filter + cfg.preproc.hpfilter = 'no' or 'yes' highpass filter + cfg.preproc.bpfilter = 'no' or 'yes' bandpass filter + cfg.preproc.lnfilter = 'no' or 'yes' line noise removal using notch filter + cfg.preproc.dftfilter = 'no' or 'yes' line noise removal using discrete fourier transform + cfg.preproc.medianfilter = 'no' or 'yes' jump preserving median filter + cfg.preproc.lpfreq = lowpass frequency in Hz + cfg.preproc.hpfreq = highpass frequency in Hz + cfg.preproc.bpfreq = bandpass frequency range, specified as [low high] in Hz + cfg.preproc.lnfreq = line noise frequency in Hz, default 50Hz + cfg.preproc.lpfiltord = lowpass filter order + cfg.preproc.hpfiltord = highpass filter order + cfg.preproc.bpfiltord = bandpass filter order + cfg.preproc.lnfiltord = line noise notch filter order + cfg.preproc.medianfiltord = length of median filter + cfg.preproc.lpfilttype = digital filter type, 'but' (default) or 'fir' + cfg.preproc.hpfilttype = digital filter type, 'but' (default) or 'fir' + cfg.preproc.bpfilttype = digital filter type, 'but' (default) or 'fir' + cfg.preproc.lpfiltdir = filter direction, 'twopass' (default) or 'onepass' + cfg.preproc.hpfiltdir = filter direction, 'twopass' (default) or 'onepass' + cfg.preproc.bpfiltdir = filter direction, 'twopass' (default) or 'onepass' + cfg.preproc.detrend = 'no' or 'yes' + cfg.preproc.demean = 'no' or 'yes' + cfg.preproc.baselinewindow = [begin end] in seconds, the default is the complete trial + cfg.preproc.hilbert = 'no' or 'yes' + cfg.preproc.rectify = 'no' or 'yes' + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spikedetection.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spikedetection", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spikedownsample.py b/fieldtrip/__contrib/__spike/ft_spikedownsample.py new file mode 100644 index 0000000..c1e7c1e --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spikedownsample.py @@ -0,0 +1,96 @@ +from fieldtrip._runtime import Runtime + + +def ft_spikedownsample(*args, **kwargs): + """ + FT_SPIKEDOWNSAMPLE takes electrophysiological data that was continuoudly + sampled at 32KHz and preprocesses and downsamples it to obtain the LFP + data, which can subsequently be processed in more detail. + + Use as + [cfg] = ft_spikedownsample(cfg) + + The configuration should contain + cfg.dataset = string with the input dataset + cfg.output = string with the output dataset (default is determined automatic) + cfg.dataformat = string with the output dataset format, see WRITE_DATA + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), + see FT_CHANNELSELECTION for details + cfg.fsample = desired sampling frequency in Hz (default = 1000) + cfg.method = resampling method, can be 'resample', 'decimate' or 'downsample' + cfg.timestampdefinition = 'orig' or 'sample' + cfg.channelprefix = string, will be added to channel name, e.g. 'lfp' -> 'lfp_ncs001' (default = []) + cfg.calibration = optional scaling factor to apply to the data to convert it in uV, see below + + The Neuralynx acquisition system at the FCDC in Nijmegen makes use of + Plexon headstages which have a amplification of 20x. The data that is + written by the Neuralynx acquisition software therefore is 20x larger + than the true microvolt values. When operating FT_SPIKEDOWNSAMPLE on the + *.ncs files that are recorded with the Neuralynx Cheetah software, the + calibration should be set to 1/20. The raw dma file (*.nrd) and the + splitted DMA files contains AD values that are not scaled in uV and + require an additional factor of 64x. If you operate FT_SPIKEDOWNSAMPLE on + raw dma files or on splitted DMA files, the calibration should be set to + 1/(64*20). + + The default is to process the full dataset. You can select a latency range with + cfg.latency = [begin end], default is [0 inf] + or you can specify multiple latency segments with + cfg.latency = [b1 e1; b2 e2; ...] + + Furthermore, the configuration can contain the following preprocessing options + cfg.preproc.lpfilter = 'no' or 'yes' lowpass filter + cfg.preproc.hpfilter = 'no' or 'yes' highpass filter + cfg.preproc.bpfilter = 'no' or 'yes' bandpass filter + cfg.preproc.lnfilter = 'no' or 'yes' line noise removal using notch filter + cfg.preproc.dftfilter = 'no' or 'yes' line noise removal using discrete fourier transform + cfg.preproc.medianfilter = 'no' or 'yes' jump preserving median filter + cfg.preproc.lpfreq = lowpass frequency in Hz + cfg.preproc.hpfreq = highpass frequency in Hz + cfg.preproc.bpfreq = bandpass frequency range, specified as [low high] in Hz + cfg.preproc.lnfreq = line noise frequency in Hz, default 50Hz + cfg.preproc.lpfiltord = lowpass filter order + cfg.preproc.hpfiltord = highpass filter order + cfg.preproc.bpfiltord = bandpass filter order + cfg.preproc.lnfiltord = line noise notch filter order + cfg.preproc.medianfiltord = length of median filter + cfg.preproc.lpfilttype = digital filter type, 'but' (default) or 'fir' + cfg.preproc.hpfilttype = digital filter type, 'but' (default) or 'fir' + cfg.preproc.bpfilttype = digital filter type, 'but' (default) or 'fir' + cfg.preproc.lpfiltdir = filter direction, 'twopass' (default) or 'onepass' + cfg.preproc.hpfiltdir = filter direction, 'twopass' (default) or 'onepass' + cfg.preproc.bpfiltdir = filter direction, 'twopass' (default) or 'onepass' + cfg.preproc.detrend = 'no' or 'yes' + cfg.preproc.demean = 'no' or 'yes' + cfg.preproc.baselinewindow = [begin end] in seconds, the default is the complete trial + cfg.preproc.hilbert = 'no' or 'yes' + cfg.preproc.rectify = 'no' or 'yes' + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spikedownsample.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spikedownsample", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spikefixdmafile.py b/fieldtrip/__contrib/__spike/ft_spikefixdmafile.py new file mode 100644 index 0000000..1eab779 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spikefixdmafile.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def ft_spikefixdmafile(*args, **kwargs): + """ + FT_SPIKEFIXDMAFILE fixes the problem in DMA files due to stopping and + restarting the acquisition. It takes one Neuralynx DMA file and and + creates separate DMA files, each corresponding with one continuous + section of the recording. + + Use as + ft_spikefixdmafile(cfg) + where the configuration should contain + cfg.dataset = string with the name of the DMA log file + cfg.output = string with the name of the DMA log file, (default is determined automatic) + cfg.numchans = number of channels (default = 256) + + See also FT_SPIKESPLITTING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spikefixdmafile.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spikefixdmafile", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__contrib/__spike/ft_spikesimulation.py b/fieldtrip/__contrib/__spike/ft_spikesimulation.py new file mode 100644 index 0000000..e9fc7f3 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spikesimulation.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def ft_spikesimulation(*args, **kwargs): + """ + FT_SPIKESIMULATION simulates a spiketrain with a structured timing in the neuronal + firing. + + Use as + data = ft_spikesimulation(cfg) + and please look in the code for the cfg details. + + See also FT_DIPOLESIMULATION, FT_FREQSIMULATION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spikesimulation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spikesimulation", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spikesorting.py b/fieldtrip/__contrib/__spike/ft_spikesorting.py new file mode 100644 index 0000000..1868c0b --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spikesorting.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def ft_spikesorting(*args, **kwargs): + """ + FT_SPIKESORTING performs clustering of spike-waveforms and returns the + unit number to which each spike belongs. + + Use as + [spike] = ft_spikesorting(cfg, spike) + + The configuration can contain + cfg.channel = cell-array with channel selection (default = 'all'), see FT_CHANNELSELECTION for details + cfg.method = 'kmeans', 'ward' + cfg.feedback = 'no', 'text', 'textbar', 'gui' (default = 'textbar') + cfg.kmeans = substructure with additional low-level options for this method + cfg.ward = substructure with additional low-level options for this method + cfg.ward.distance = 'L1', 'L2', 'correlation', 'cosine' + + The input spike structure can be imported using READ_FCDC_SPIKE and should contain + spike.label = 1 x Nchans cell-array, with channel labels + spike.waveform = 1 x Nchans cell-array, each element contains a matrix (Nsamples x Nspikes), can be empty + spike.timestamp = 1 x Nchans cell-array, each element contains a vector (1 x Nspikes) + spike.unit = 1 x Nchans cell-array, each element contains a vector (1 x Nspikes) + + See also FT_READ_SPIKE, FT_SPIKEDOWNSAMPLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spikesorting.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spikesorting", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spikesplitting.py b/fieldtrip/__contrib/__spike/ft_spikesplitting.py new file mode 100644 index 0000000..97e93e7 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spikesplitting.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def ft_spikesplitting(*args, **kwargs): + """ + FT_SPIKESPLITTING reads a single Neuralynx DMA log file and writes each + individual channel to a separate file. + + Use as + [cfg] = ft_spikesplitting(cfg) + + The configuration should contain + cfg.dataset = string with the name of the DMA log file + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION for details + cfg.output = string with the name of the splitted DMA dataset directory, (default is determined automatic) + cfg.latency = [begin end], (default = 'all') + cfg.feedback = string, (default = 'textbar') + cfg.format = 'int16' or 'int32' (default = 'int32') + cfg.downscale = single number or vector (for each channel), corresponding to the number of bits removed from the LSB side (default = 0) + + This function expects the DMA file to be read as AD units (and not in uV) + and will write the same AD values to the splitted DMA files. If you + subsequently want to process the splitted DMA, you should look up the + details of the headstage amplification and the Neuralynx amplifier and + scale the values accordingly. + + See also FT_SPIKEDOWNSAMPLE, FT_SPIKEANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spikesplitting.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spikesplitting", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spiketriggeredaverage.py b/fieldtrip/__contrib/__spike/ft_spiketriggeredaverage.py new file mode 100644 index 0000000..fcef972 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spiketriggeredaverage.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def ft_spiketriggeredaverage(*args, **kwargs): + """ + FT_SPIKETRIGGEREDAVERAGE computes the avererage of the LFP around the + spikes. + + Use as + [timelock] = ft_spiketriggeredaverage(cfg, data) + + The input data should be organised in a structure as obtained from + the FT_PREPROCESSING function. The configuration should be according to + + cfg.timwin = [begin end], time around each spike (default = [-0.1 0.1]) + cfg.spikechannel = string, name of single spike channel to trigger on + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), + see FT_CHANNELSELECTION for details + cfg.latency + cfg.keeptrials = 'yes' or 'no', return individual trials or average (default = 'no') + cfg.feedback = 'no', 'text', 'textbar', 'gui' (default = 'no') + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spiketriggeredaverage.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spiketriggeredaverage", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spiketriggeredinterpolation.py b/fieldtrip/__contrib/__spike/ft_spiketriggeredinterpolation.py new file mode 100644 index 0000000..e30222a --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spiketriggeredinterpolation.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def ft_spiketriggeredinterpolation(*args, **kwargs): + """ + FT_SPIKETRIGGEREDINTERPOLATION interpolates the data in the LFP channels + around the spikes that are detected in the spike channels, or replaces + the LFP around the spike with NaNs. The purpose of this procedure is to + allow analysis of spikes and LFPs recorded from the same electrode, as + the spike energy would bleed in the LFP. + + Use as + [data] = ft_spiketriggeredinterpolation(cfg, data) + + The input data should be organised in a structure as obtained from the + FT_PREPROCESSING function. The configuration should be according to + + cfg.method = string, The interpolation method can be 'nan', + 'cubic', 'linear', 'nearest', spline', 'pchip' + (default = 'nan'). See INTERP1 for more details. + cfg.timwin = [begin end], duration of LFP segment around each spike (default = + [-0.005 0.005]) to be removed + cfg.interptoi = value, time in seconds used for interpolation, which + must be larger than timwin (default = 0.2) + cfg.spikechannel = string, name of single spike channel to trigger on + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), + see FT_CHANNELSELECTION for details + cfg.feedback = 'no', 'text', 'textbar', 'gui' (default = 'no') + + The output will contain all channels of the input, only the data in the + selected channels will be interpolated or replaced with NaNs. + + See also FT_SPIKETRIGGEREDSPECTRUM, FT_SPIKETRIGGEREDAVERAGE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spiketriggeredinterpolation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spiketriggeredinterpolation", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spiketriggeredspectrum.py b/fieldtrip/__contrib/__spike/ft_spiketriggeredspectrum.py new file mode 100644 index 0000000..8993eb1 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spiketriggeredspectrum.py @@ -0,0 +1,90 @@ +from fieldtrip._runtime import Runtime + + +def ft_spiketriggeredspectrum(*args, **kwargs): + """ + FT_SPIKETRIGGEREDSPECTRUM computes the Fourier spectrup (amplitude and phase) of + the LFP around the spikes. A phase of zero corresponds to the spike being on the + peak of the LFP oscillation. A phase of 180 degree corresponds to the spike being in + the through of the oscillation. A phase of 45 degrees corresponds to the spike being + just after the peak in the LFP. + + Use as + [sts] = ft_spiketriggeredspectrum(cfg, data) + or + [sts] = ft_spiketriggeredspectrum(cfg, data, spike) + + Configurations: + cfg.method = 'mtmfft' or 'mtmconvol' (see below) + + If you specify the method 'mtmconvol', FT_SPIKETRIGGEREDSPECTRUM_CONVOL is used. If + you specify 'mtmfft', FT_SPIKETRIGGEREDSPECTRUM_FFT is used (which corresponds to the + old FT_SPIKETRIGGEREDSPECTRUM). + + %%%%%%%%%%%%% + + FT_SPIKETRIGGEREDSPECTRUM_FFT determines the spike phases by taking the + FFT locally around every spike, for one unit. This is an efficient + algorithm when we have few neurons recorded simultaneously with low + firing rates. All frequencies are computed using the same time-window. + + The function must then be called as + [sts] = ft_spiketriggeredspectrum(cfg, data) + where some channels of DATA are spike channels, and data is in the raw + format. + + For configuration options see FT_SPIKETRIGGEREDSPECTRUM_FFT. + + %%%%%%%%%%%%% + + FT_SPIKETRIGGEREDSPECTRUM_CONVOL computes the Fourier spectrum of the LFP + around the spikes using convolution of the complete LFP traces. + This is a very efficient algorithm if we many spikes per trial. The + function allows to compute phases for multiple neurons at the same time. + An additional feature is that every frequency is processed separately (as + its done through convolution), such that different time-windows can be + used per frequency. + Finally, the function can be called by adding a third input (SPIKE) which + has the same trial definitions as DATA. + + The function must then be called as + [sts] = ft_spiketriggeredspectrum(cfg, data) + or + [sts] = ft_spiketriggeredspectrum(cfg, data, spike) + where the spiking information can either be represented in the first data + input or in the second spike input structure. + + For configurations options see FT_SPIKETRIGGEREDSPECTRUM_CONVOL + + %%%%%%%%%%%%% + + The output STS data structure can be further analyzed using FT_SPIKETRIGGEREDSPECTRUM_STAT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spiketriggeredspectrum.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spiketriggeredspectrum", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spiketriggeredspectrum_convol.py b/fieldtrip/__contrib/__spike/ft_spiketriggeredspectrum_convol.py new file mode 100644 index 0000000..6de7f67 --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spiketriggeredspectrum_convol.py @@ -0,0 +1,116 @@ +from fieldtrip._runtime import Runtime + + +def ft_spiketriggeredspectrum_convol(*args, **kwargs): + """ + FT_SPIKETRIGGEREDSPECTRUM_CONVOL computes the Fourier spectrum (amplitude and + phase) of the LFP around the spikes using convolution of the complete LFP traces. A + phase of zero corresponds to the spike being on the peak of the LFP oscillation. A + phase of 180 degree corresponds to the spike being in the through of the oscillation. + A phase of 45 degrees corresponds to the spike being just after the peak in the LFP. + + The difference to FT_SPIKETRIGGEREDSPECTRUM_FFT is that this function allows for + multiple frequencies to be processed with different time-windows per frequency, and + that FT_SPIKETRIGGEREDSPECTRUM_FFT is based on taking the FFT of a limited LFP + segment around each spike. + + Use as + [sts] = ft_spiketriggeredspectrum_convol(cfg,data,spike) + or + [sts] = ft_spiketriggeredspectrum_convol(cfg,data) + The spike data can either be contained in the data input or in the spike + input. + + The input DATA should be organised as the raw datatype, obtained from + FT_PREPROCESSING or FT_APPENDSPIKE. + + The input SPIKE should be organised as the spike or the raw datatype, obtained from + FT_SPIKE_MAKETRIALS or FT_PREPROCESSING, in which case the conversion is done + within this function. + + Important is that data.time and spike.trialtime should be referenced + relative to the same trial trigger times! + + Configurations (following largely FT_FREQNALYSIS with method mtmconvol) + cfg.tapsmofrq = vector 1 x numfoi, the amount of spectral smoothing through + multi-tapering. Note that 4 Hz smoothing means + plus-minus 4 Hz, i.e. a 8 Hz smoothing box. + cfg.foi = vector 1 x numfoi, frequencies of interest + cfg.taper = 'dpss', 'hanning' or many others, see WINDOW (default = 'hanning') + cfg.t_ftimwin = vector 1 x numfoi, length of time window (in + seconds) + cfg.taperopt = parameter that goes in WINDOW function (only + applies to windows like KAISER). + cfg.spikechannel = cell-array with selection of channels (default = 'all') + see FT_CHANNELSELECTION for details + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), + see FT_CHANNELSELECTION for details + cfg.borderspikes = 'yes' (default) or 'no'. If 'yes', we process the spikes + falling at the border using an LFP that is not centered + on the spike. If 'no', we output NaNs for spikes + around which we could not center an LFP segment. + cfg.rejectsaturation= 'yes' (default) or 'no'. If 'yes', we set + EEG segments where the maximum or minimum + voltage range is reached + with zero derivative (i.e., saturated signal) to + NaN, effectively setting all spikes phases that + use these parts of the EEG to NaN. An EEG that + saturates always returns the same phase at all + frequencies and should be ignored. + + Note: some adjustment of the frequencies can occur as the chosen time-window may not + be appropriate for the chosen frequency. + For example, suppose that cfg.foi = 80, data.fsample = 1000, and + cfg.t_ftimwin = 0.0625. The DFT frequencies in that case are + linspace(0,1000,63) such that cfg.foi --> 80.645. In practice, this error + can only become large if the number of cycles per frequency is very + small and the frequency is high. For example, suppose that cfg.foi = 80 + and cfg.t_ftimwin = 0.0125. In that case cfg.foi-->83.33. + The error is smaller as data.fsample is larger. + + Outputs: + sts is a spike structure, containing new fields: + sts.fourierspctrm = 1 x nUnits cell-array with dimord spike_lfplabel_freq + sts.lfplabel = 1 x nChan cell-array with EEG labels + sts.freq = 1 x nFreq frequencies. Note that per default, not + all frequencies can be used as we compute the DFT + around the spike based on an uneven number of + samples. This introduces a slight adjustment of the + selected frequencies. + + Note: sts.fourierspctrm can contain NaNs, for example if + cfg.borderspikes = 'no', or if cfg.rejectsaturation = 'yes', or if the + trial length was too short for the window desired. + + WHen using multitapering, the phase distortion is corrected for. + + The output STS data structure can be input to FT_SPIKETRIGGEREDSPECTRUM_STAT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spiketriggeredspectrum_convol.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spiketriggeredspectrum_convol", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spiketriggeredspectrum_fft.py b/fieldtrip/__contrib/__spike/ft_spiketriggeredspectrum_fft.py new file mode 100644 index 0000000..67743ec --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spiketriggeredspectrum_fft.py @@ -0,0 +1,82 @@ +from fieldtrip._runtime import Runtime + + +def ft_spiketriggeredspectrum_fft(*args, **kwargs): + """ + FT_SPIKETRIGGEREDSPECTRUM_FFT computes the Fourier spectrum (amplitude and phase) + of the LFP around the % spikes. A phase of zero corresponds to the spike being on + the peak of the LFP oscillation. A phase of 180 degree corresponds to the spike being + in the through of the oscillation. A phase of 45 degrees corresponds to the spike + being just after the peak in the LFP. + + If the triggered spike leads a spike in another channel, then the angle of the Fourier + spectrum of that other channel will be negative. Earlier phases are in clockwise + direction. + + Use as + [sts] = ft_spiketriggeredspectrum_convol(cfg,data,spike) + or + [sts] = ft_spiketriggeredspectrum_convol(cfg,data) + where the spike data can either be contained in the DATA input or in the SPIKE input. + + The input DATA should be organised as the raw datatype, obtained from FT_PREPROCESSING + or FT_APPENDSPIKE. + + The (optional) input SPIKE should be organised as the spike or the raw datatype, + obtained from FT_SPIKE_MAKETRIALS or FT_PREPROCESSING (in that case, conversion is done + within the function) + + Important is that data.time and spike.trialtime should be referenced relative to the + same trial trigger times. + + The configuration should be according to + cfg.timwin = [begin end], time around each spike (default = [-0.1 0.1]) + cfg.foilim = [begin end], frequency band of interest (default = [0 150]) + cfg.taper = 'dpss', 'hanning' or many others, see WINDOW (default = 'hanning') + cfg.tapsmofrq = number, the amount of spectral smoothing through + multi-tapering. Note that 4 Hz smoothing means plus-minus 4 Hz, + i.e. a 8 Hz smoothing box. Note: multitapering rotates phases (no + problem for consistency) + cfg.spikechannel = string, name of spike channels to trigger on cfg.channel = Nx1 + cell-array with selection of channels (default = 'all'), + see FT_CHANNELSELECTION for details + cfg.feedback = 'no', 'text', 'textbar', 'gui' (default = 'no') + + The output STS data structure can be input to FT_SPIKETRIGGEREDSPECTRUM_STAT + + This function uses a NaN-aware spectral estimation technique, which will default to the + standard Matlab FFT routine if no NaNs are present. The fft_along_rows subfunction below + demonstrates the expected function behavior. + + See FT_SPIKETRIGGEREDINTERPOLATION to remove segments of LFP around spikes. + See FT_SPIKETRIGGEREDSPECTRUM_CONVOL for an alternative implementation based + on convolution + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spiketriggeredspectrum_fft.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spiketriggeredspectrum_fft", *args, **kwargs) diff --git a/fieldtrip/__contrib/__spike/ft_spiketriggeredspectrum_stat.py b/fieldtrip/__contrib/__spike/ft_spiketriggeredspectrum_stat.py new file mode 100644 index 0000000..568e02c --- /dev/null +++ b/fieldtrip/__contrib/__spike/ft_spiketriggeredspectrum_stat.py @@ -0,0 +1,110 @@ +from fieldtrip._runtime import Runtime + + +def ft_spiketriggeredspectrum_stat(*args, **kwargs): + """ + FT_SPIKETRIGGEREDSPECTRUM_STAT computes phase-locking statistics for spike-LFP + phases. These contain the PPC statistics according to Vinck et al. 2010 (Neuroimage) + and Vinck et al. 2011 (Journal of Computational Neuroscience). + + Use as: + [stat] = ft_spiketriggeredspectrum_stat(cfg, spike) + + The input SPIKE should be a structure as obtained from the FT_SPIKETRIGGEREDSPECTRUM function. + + Configurations (cfg) + + cfg.method = string, indicating which statistic to compute. Can be: + -'plv' : phase-locking value, computes the resultant length over spike + phases. More spikes -> lower value (bias). + -'ang' : computes the angular mean of the spike phases. + -'ral' : computes the rayleigh p-value. + -'ppc0': computes the pairwise-phase consistency across all available + spike pairs (Vinck et al., 2010). + -'ppc1': computes the pairwise-phase consistency across all available + spike pairs with exclusion of spike pairs in the same trial. + This avoids history effects within spike-trains to influence + phase lock statistics. + -'ppc2': computes the PPC across all spike pairs with exclusion of + spike pairs in the same trial, but applies a normalization + for every set of trials. This estimator has more variance but + is more robust against dependencies between spike phase and + spike count. + + cfg.timwin = double or 'all' (default) + - double: indicates we compute statistic with a + sliding window of cfg.timwin, i.e. time-resolved analysis. + - 'all': we compute statistic over all time-points, + i.e. in non-time resolved fashion. + + cfg.winstepsize = double, stepsize of sliding window in seconds. For + example if cfg.winstepsize = 0.1, we compute stat every other 100 ms. + + cfg.channel = Nx1 cell-array or numerical array with selection of + channels (default = 'all'),See CHANNELSELECTION for details + + cfg.spikechannel = label of ONE unit, according to FT_CHANNELSELECTION + + cfg.spikesel = 'all' (default) or numerical or logical selection of spikes. + + cfg.foi = 'all' or numerical vector that specifies a subset of + frequencies in Hz, e.g. cfg.foi = spike.freq(1:10); + + cfg.latency = [beg end] in sec, or 'maxperiod', 'poststim' or + 'prestim'. This determines the start and end of analysis window. + + cfg.avgoverchan = 'weighted', 'unweighted' (default) or 'no'. + This regulates averaging of fourierspectra prior to + computing the statistic. + - 'weighted' : we average across channels by weighting by the LFP power. + This is identical to adding the raw LFP signals in time + and then taking their FFT. + - 'unweighted': we average across channels after normalizing for LFP power. + This is identical to normalizing LFP signals for + their power, averaging them, and then taking their FFT. + - 'no' : no weighting is performed, statistic is computed for + every LFP channel. + cfg.trials = vector of indices (e.g., 1:2:10), + logical selection of trials (e.g., [1010101010]), or + 'all' (default) + + Main outputs: + stat.nspikes = nChancmb-by-nFreqs-nTimepoints number + of spikes used to compute stat + stat.dimord = 'chan_freq_time' + stat.labelcmb = nChancmbs cell-array with spike vs + LFP labels + stat.(cfg.method) = nChancmb-by-nFreqs-nTimepoints statistic + stat.freq = 1xnFreqs array of frequencies + stat.nspikes = number of spikes used to compute + + The output stat structure can be plotted using ft_singleplotTFR or ft_multiplotTFR. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/contrib/spike/ft_spiketriggeredspectrum_stat.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_spiketriggeredspectrum_stat", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ReadHeader.py b/fieldtrip/__fileio/_ReadHeader.py new file mode 100644 index 0000000..05b4fd7 --- /dev/null +++ b/fieldtrip/__fileio/_ReadHeader.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _ReadHeader(*args, **kwargs): + """ + H = ReadHeader(fp) + + Reads NSMA header, leaves file-read-location at end of header + + INPUT: + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ReadHeader.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ReadHeader", *args, **kwargs) diff --git a/fieldtrip/__fileio/__init__.py b/fieldtrip/__fileio/__init__.py new file mode 100644 index 0000000..3ec264b --- /dev/null +++ b/fieldtrip/__fileio/__init__.py @@ -0,0 +1,68 @@ +from .ft_chantype import ft_chantype +from .ft_chanunit import ft_chanunit +from .ft_create_buffer import ft_create_buffer +from .ft_destroy_buffer import ft_destroy_buffer +from .ft_filetype import ft_filetype +from .ft_filter_event import ft_filter_event +from .ft_flush_data import ft_flush_data +from .ft_flush_event import ft_flush_event +from .ft_flush_header import ft_flush_header +from .ft_poll_buffer import ft_poll_buffer +from .ft_read_atlas import ft_read_atlas +from .ft_read_cifti import ft_read_cifti +from .ft_read_data import ft_read_data +from .ft_read_event import ft_read_event +from .ft_read_header import ft_read_header +from .ft_read_headmodel import ft_read_headmodel +from .ft_read_headshape import ft_read_headshape +from .ft_read_json import ft_read_json +from .ft_read_mri import ft_read_mri +from .ft_read_sens import ft_read_sens +from .ft_read_spike import ft_read_spike +from .ft_read_tsv import ft_read_tsv +from .ft_read_vol import ft_read_vol +from .ft_write_cifti import ft_write_cifti +from .ft_write_data import ft_write_data +from .ft_write_event import ft_write_event +from .ft_write_headshape import ft_write_headshape +from .ft_write_json import ft_write_json +from .ft_write_mri import ft_write_mri +from .ft_write_sens import ft_write_sens +from .ft_write_spike import ft_write_spike +from .ft_write_tsv import ft_write_tsv + + +__all__ = [ + "ft_chantype", + "ft_chanunit", + "ft_create_buffer", + "ft_destroy_buffer", + "ft_filetype", + "ft_filter_event", + "ft_flush_data", + "ft_flush_event", + "ft_flush_header", + "ft_poll_buffer", + "ft_read_atlas", + "ft_read_cifti", + "ft_read_data", + "ft_read_event", + "ft_read_header", + "ft_read_headmodel", + "ft_read_headshape", + "ft_read_json", + "ft_read_mri", + "ft_read_sens", + "ft_read_spike", + "ft_read_tsv", + "ft_read_vol", + "ft_write_cifti", + "ft_write_data", + "ft_write_event", + "ft_write_headshape", + "ft_write_json", + "ft_write_mri", + "ft_write_sens", + "ft_write_spike", + "ft_write_tsv", +] diff --git a/fieldtrip/__fileio/_add_mex_source.py b/fieldtrip/__fileio/_add_mex_source.py new file mode 100644 index 0000000..75c861f --- /dev/null +++ b/fieldtrip/__fileio/_add_mex_source.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _add_mex_source(*args, **kwargs): + """ + function L = add_mex_source(L, directory, relName, matchPlatform, excludePlatform, extras) + + Input + output argument L is a structure array of directory names, source file names, + and extra arguments required for the compilation of MEX files. This function will + create a new element of this structure and append it to L. + + Further inputs: + directory + target directory of the mex-file + relName + source file relative to 'directory' + matchPlatform + list of platforms this MEX file should only be compiled for. + use an empty matrix [] to compile for all platforms + excludePlatform + list of platforms this MEX file should NOT be compiled for. + extras + extra arguments to the MEX command, e.g. additional source files + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/add_mex_source.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("add_mex_source", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ama2headmodel.py b/fieldtrip/__fileio/_ama2headmodel.py new file mode 100644 index 0000000..3ef897a --- /dev/null +++ b/fieldtrip/__fileio/_ama2headmodel.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _ama2headmodel(*args, **kwargs): + """ + AMA2HEADMODEL converts a dipoli structure with boundary geometries + and a boundary element method transfer matrix to a volume conduction + model. + + Use as + headmodel = ama2headmodel(ama) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ama2headmodel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ama2headmodel", *args, **kwargs) diff --git a/fieldtrip/__fileio/_appendstruct.py b/fieldtrip/__fileio/_appendstruct.py new file mode 100644 index 0000000..e8f0f7a --- /dev/null +++ b/fieldtrip/__fileio/_appendstruct.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _appendstruct(*args, **kwargs): + """ + APPENDSTRUCT appends a structure or a struct-array to another structure or + struct-array. It also works if the initial structure is an empty structure or an + empty double array. It also works if the input structures have different fields. + + Use as + ab = appendstruct(a, b) + + See also PRINTSTRUCT, MERGESTRUCT, COPYFIELDS, KEEPFIELDS, REMOVEFIELDS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/appendstruct.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("appendstruct", *args, **kwargs) diff --git a/fieldtrip/__fileio/_avw_hdr_make.py b/fieldtrip/__fileio/_avw_hdr_make.py new file mode 100644 index 0000000..3c944a1 --- /dev/null +++ b/fieldtrip/__fileio/_avw_hdr_make.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _avw_hdr_make(*args, **kwargs): + """ + AVW_HDR_MAKE - Create Analyze format data header (avw.hdr) + + [ avw ] = avw_hdr_make + + avw.hdr - a struct, all fields returned from the header. + For details, find a good description on the web + or see the Analyze File Format pdf in the + mri_toolbox doc folder or see avw_hdr_read.m + + See also, AVW_HDR_READ AVW_HDR_WRITE + AVW_IMG_READ AVW_IMG_WRITE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/avw_hdr_make.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("avw_hdr_make", *args, **kwargs) diff --git a/fieldtrip/__fileio/_avw_hdr_read.py b/fieldtrip/__fileio/_avw_hdr_read.py new file mode 100644 index 0000000..70a6289 --- /dev/null +++ b/fieldtrip/__fileio/_avw_hdr_read.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def _avw_hdr_read(*args, **kwargs): + """ + avw_hdr_read - read Analyze format data header (*.hdr) + + [ avw, machine ] = avw_hdr_read(fileprefix, [machine], [verbose]) + + fileprefix - string filename (without .hdr); the file name + can be given as a full path or relative to the + current directory. + + machine - a string, see machineformat in fread for details. + The default here is 'ieee-le' but the routine + will automatically switch between little and big + endian to read any such Analyze header. It + reports the appropriate machine format and can + return the machine value. + + avw.hdr - a struct, all fields returned from the header. + For details, find a good description on the web + or see the Analyze File Format pdf in the + mri_toolbox doc folder or read this .m file. + + verbose - the default is to output processing information to the command + window. If verbose = 0, this will not happen. + + This function is called by avw_img_read + + See also avw_hdr_write, avw_hdr_make, avw_view_hdr, avw_view + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/avw_hdr_read.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("avw_hdr_read", *args, **kwargs) diff --git a/fieldtrip/__fileio/_avw_img_read.py b/fieldtrip/__fileio/_avw_img_read.py new file mode 100644 index 0000000..8ab3a43 --- /dev/null +++ b/fieldtrip/__fileio/_avw_img_read.py @@ -0,0 +1,91 @@ +from fieldtrip._runtime import Runtime + + +def _avw_img_read(*args, **kwargs): + """ + avw_img_read - read Analyze format data image (*.img) + + [ avw, machine ] = avw_img_read(fileprefix,[orient],[machine],[verbose]) + + fileprefix - a string, the filename without the .img extension + + orient - read a specified orientation, integer values: + + '', use header history orient field + 0, transverse unflipped (LAS*) + 1, coronal unflipped (LA*S) + 2, sagittal unflipped (L*AS) + 3, transverse flipped (LPS*) + 4, coronal flipped (LA*I) + 5, sagittal flipped (L*AI) + + where * follows the slice dimension and letters indicate +XYZ + orientations (L left, R right, A anterior, P posterior, + I inferior, & S superior). + + Some files may contain data in the 3-5 orientations, but this + is unlikely. For more information about orientation, see the + documentation at the end of this .m file. See also the + AVW_FLIP function for orthogonal reorientation. + + machine - a string, see machineformat in fread for details. + The default here is 'ieee-le' but the routine + will automatically switch between little and big + endian to read any such Analyze header. It + reports the appropriate machine format and can + return the machine value. + + verbose - the default is to output processing information to the command + window. If verbose = 0, this will not happen. + + Returned values: + + avw.hdr - a struct with image data parameters. + avw.img - a 3D matrix of image data (double precision). + + A returned 3D matrix will correspond with the + default ANALYZE coordinate system, which + is Left-handed: + + X-Y plane is Transverse + X-Z plane is Coronal + Y-Z plane is Sagittal + + X axis runs from patient right (low X) to patient Left (high X) + Y axis runs from posterior (low Y) to Anterior (high Y) + Z axis runs from inferior (low Z) to Superior (high Z) + + The function can read a 4D Analyze volume, but only if it is in the + axial unflipped orientation. + + See also: avw_hdr_read (called by this function), + avw_view, avw_write, avw_img_write, avw_flip + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/avw_img_read.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("avw_img_read", *args, **kwargs) diff --git a/fieldtrip/__fileio/_avw_img_write.py b/fieldtrip/__fileio/_avw_img_write.py new file mode 100644 index 0000000..5de546a --- /dev/null +++ b/fieldtrip/__fileio/_avw_img_write.py @@ -0,0 +1,84 @@ +from fieldtrip._runtime import Runtime + + +def _avw_img_write(*args, **kwargs): + """ + avw_img_write - write Analyze image files (*.img) + + avw_img_write(avw,fileprefix,[IMGorient],[machine],[verbose]) + + avw.img - a 3D matrix of image data (double precision). + avw.hdr - a struct with image data parameters. If + not empty, this function calls avw_hdr_write. + + fileprefix - a string, the filename without the .img + extension. If empty, may use avw.fileprefix + + IMGorient - optional int, force writing of specified + orientation, with values: + + [], if empty, will use avw.hdr.hist.orient field + 0, transverse/axial unflipped (default, radiological) + 1, coronal unflipped + 2, sagittal unflipped + 3, transverse/axial flipped, left to right + 4, coronal flipped, anterior to posterior + 5, sagittal flipped, superior to inferior + + This function will set avw.hdr.hist.orient and write the + image data in a corresponding order. This function is + in alpha development, so it has not been exhaustively + tested (07/2003). See avw_img_read for more information + and documentation on the orientation option. + Orientations 3-5 are NOT recommended! They are part + of the Analyze format, but only used in Analyze + for faster raster graphics during movies. + + machine - a string, see machineformat in fread for details. + The default here is 'ieee-le'. + + verbose - the default is to output processing information to the command + window. If verbose = 0, this will not happen. + + Tip: to change the data type, set avw.hdr.dime.datatype to: + + 1 Binary ( 1 bit per voxel) + 2 Unsigned character ( 8 bits per voxel) + 4 Signed short ( 16 bits per voxel) + 8 Signed integer ( 32 bits per voxel) + 16 Floating point ( 32 bits per voxel) + 32 Complex, 2 floats ( 64 bits per voxel), not supported + 64 Double precision ( 64 bits per voxel) + 128 Red-Green-Blue (128 bits per voxel), not supported + + See also: avw_write, avw_hdr_write, + avw_read, avw_hdr_read, avw_img_read, avw_view + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/avw_img_write.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("avw_img_write", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_bids_datafile.py b/fieldtrip/__fileio/_bids_datafile.py new file mode 100644 index 0000000..2b9e1fb --- /dev/null +++ b/fieldtrip/__fileio/_bids_datafile.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _bids_datafile(*args, **kwargs): + """ + BIDS_DATAFILE will search for the data file, given one of the corresponding sidecar files + + Use as + [datafile, jsonfile] = bids-datafile(filename) + + See also BIDS_SIDECAR, BIDS_TSV, EVENTS_TSV + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/bids_datafile.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("bids_datafile", *args, **kwargs) diff --git a/fieldtrip/__fileio/_bids_sidecar.py b/fieldtrip/__fileio/_bids_sidecar.py new file mode 100644 index 0000000..e843b7a --- /dev/null +++ b/fieldtrip/__fileio/_bids_sidecar.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _bids_sidecar(*args, **kwargs): + """ + BIDS_SIDECAR will search for corresponding BIDS sidecar files that go together with + a specific data file. This function respects the inheritance rules and will also + search higher up in the directory structure. + + Use as + sidecar = bids_sidecar(filename, sidecar, extension) + where filename refers to a BIDS data file and suffix is a string that refers to the + specific sidecar file. To read the json sidecar corresponding to the data itself, + you can keep the suffix empty. In that case the suffix (e.g., meg or eeg) will + be determined from the filename. + + This supports, but is not restricted to the following json sidecar files + 'meg' + 'eeg' + 'ieeg' + 'nirs' + 'coordsystem' + + This supports, but is not restricted to the following tsv sidecar files + 'channels' + 'electrodes' + 'optodes' + 'events' + + You can specify the file extension (tsv or json) to be returned. When not specified + and in case both a tsv and a json sidecar file are present that match the suffix, + the tsv file will be returned. + + See https://bids-specification.readthedocs.io/ for the specification and + http://bids.neuroimaging.io/ for background information. + + See also BIDS_DATAFILE, BIDS_TSV, EVENTS_TSV, FT_READ_HEADER, FT_READ_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/bids_sidecar.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("bids_sidecar", *args, **kwargs) diff --git a/fieldtrip/__fileio/_bids_tsv.py b/fieldtrip/__fileio/_bids_tsv.py new file mode 100644 index 0000000..6f44e4d --- /dev/null +++ b/fieldtrip/__fileio/_bids_tsv.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _bids_tsv(*args, **kwargs): + """ + BIDS_TSV reads time series data from a BIDS tsv and json file pair. This can for + example be used to read the header and data from physio and stim files. + + Use as + hdr = bids_tsv(filename); + dat = bids_tsv(filename, hdr, begsample, endsample, chanindx); + evt = bids_tsv(filename, hdr); + to read either the header, the data or the events. + + You should specify the name of the file containing the data as the filename, e.g. + the _physio.tsv or the _stim.tsv file. + + See https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/06-physiological-and-other-continuous-recordings.html + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/bids_tsv.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("bids_tsv", *args, **kwargs) diff --git a/fieldtrip/__fileio/_bigendian.py b/fieldtrip/__fileio/_bigendian.py new file mode 100644 index 0000000..0779901 --- /dev/null +++ b/fieldtrip/__fileio/_bigendian.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _bigendian(*args, **kwargs): + """ + BIGENDIAN returns 1 (true) on a big endian machine, e.g. with a SUN Sparc + or Apple G4 processor, or 0 (false) otherwise + + Example + if (bigendian) + % do something, e.g. swap some bytes + end + + See also LITTLEENDIAN, SWAPBYTES, TYPECAST + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/bigendian.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("bigendian", *args, **kwargs) diff --git a/fieldtrip/__fileio/_biopac_acq.py b/fieldtrip/__fileio/_biopac_acq.py new file mode 100644 index 0000000..26348eb --- /dev/null +++ b/fieldtrip/__fileio/_biopac_acq.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _biopac_acq(*args, **kwargs): + """ + BIOPAC_ACQ is a wrapper to for the reading function from Mathworks file exchange. + + Use as + hdr = biopac_acq(filename); + dat = biopac_acq(filename, hdr, begsample, endsample, chanindx); + evt = biopac_acq(filename, hdr); + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/biopac_acq.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("biopac_acq", *args, **kwargs) diff --git a/fieldtrip/__fileio/_biosig2fieldtripevent.py b/fieldtrip/__fileio/_biosig2fieldtripevent.py new file mode 100644 index 0000000..a649f89 --- /dev/null +++ b/fieldtrip/__fileio/_biosig2fieldtripevent.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _biosig2fieldtripevent(*args, **kwargs): + """ + BIOSIG2FIELDTRIPEVENT converts event information from a biosig hdr into + fieldtrip events + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/biosig2fieldtripevent.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("biosig2fieldtripevent", *args, **kwargs) diff --git a/fieldtrip/__fileio/_bnd2tri.py b/fieldtrip/__fileio/_bnd2tri.py new file mode 100644 index 0000000..0c07df7 --- /dev/null +++ b/fieldtrip/__fileio/_bnd2tri.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _bnd2tri(*args, **kwargs): + """ + BND2TRI takes a struct array with one triangulated surface mesh per + tissue and converts it into a single triangulated surface mesh + represented as one long list of triangles with per triangle a tissue or + region type. + + Use as + [pos, tri, tissue] = bnd2tri(bnd) + + See also MESH2EDGE, POLY2TRI, TRI2BND + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/bnd2tri.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("bnd2tri", *args, **kwargs) diff --git a/fieldtrip/__fileio/_bti2grad.py b/fieldtrip/__fileio/_bti2grad.py new file mode 100644 index 0000000..44c68c8 --- /dev/null +++ b/fieldtrip/__fileio/_bti2grad.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def _bti2grad(*args, **kwargs): + """ + BTI2GRAD converts a 4D header to a gradiometer structure that can be + understood by FieldTrip and Robert Oostenveld's low-level forward and + inverse routines. This function only works for headers that have been + read using the READ_4D_HDR function. + + Use as: + [hdr] = read_4d_hdr(filename) + [grad] = bti2grad(hdr) + + or + + [hdr] = read_4d_hdr(filename) + [grad, elec] = bti2grad(hdr) + + This function only computes the hardware magnetometer definition + for the 4D system. This function is based on ctf2grad and Gavin + Paterson's code, which was adapted from Eugene Kronberg's code + + See also CTF2GRAD, FIF2GRAD, MNE2GRAD, ITAB2GRAD, YOKOGAWA2GRAD, + FT_READ_SENS, FT_READ_HEADER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/bti2grad.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("bti2grad", *args, **kwargs) diff --git a/fieldtrip/__fileio/_bucn_txt.py b/fieldtrip/__fileio/_bucn_txt.py new file mode 100644 index 0000000..0580589 --- /dev/null +++ b/fieldtrip/__fileio/_bucn_txt.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _bucn_txt(*args, **kwargs): + """ + BUCN_TXT reads the txt files produced by the UCL-Birkbeck NIRS machines, also known + as the NTS fNIRS system from Gowerlabs. See https://www.gowerlabs.co.uk/nts + + Use as + hdr = bucn_txt(filename); + dat = bucn_txt(filename, hdr, begsample, endsample, chanindx); + evt = bucn_txt(filename, hdr); + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT, READ_BUCN_NIRSHDR, READ_BUCN_NIRSDATA, READ_BUCN_NIRSEVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/bucn_txt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("bucn_txt", *args, **kwargs) diff --git a/fieldtrip/__fileio/_buffer_wait_dat.py b/fieldtrip/__fileio/_buffer_wait_dat.py new file mode 100644 index 0000000..e738868 --- /dev/null +++ b/fieldtrip/__fileio/_buffer_wait_dat.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _buffer_wait_dat(*args, **kwargs): + """ + BUFFER_WAIT_DAT implementation that is also backwards compatibility with ft buffer version 1 + + Use as + available = buffer_wait_dat(selection, host, port) + where + selection(1) = nsamples, 0 indicates not to wait + selection(2) = nevents, 0 indicates not to wait + selection(3) = timeout in seconds + + It returns a structure with the available nsamples and nevents. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/buffer_wait_dat.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("buffer_wait_dat", *args, **kwargs) diff --git a/fieldtrip/__fileio/_channelposition.py b/fieldtrip/__fileio/_channelposition.py new file mode 100644 index 0000000..ff914d6 --- /dev/null +++ b/fieldtrip/__fileio/_channelposition.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _channelposition(*args, **kwargs): + """ + CHANNELPOSITION computes the channel positions and orientations from the + MEG coils, EEG electrodes or NIRS optodes + + Use as + [pos, ori, lab] = channelposition(sens) + where sens is an gradiometer, electrode, or optode array. + + See also FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/channelposition.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("channelposition", *args, **kwargs) diff --git a/fieldtrip/__fileio/_compile_mex_list.py b/fieldtrip/__fileio/_compile_mex_list.py new file mode 100644 index 0000000..91ed8b1 --- /dev/null +++ b/fieldtrip/__fileio/_compile_mex_list.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _compile_mex_list(*args, **kwargs): + """ + function compile_mex_list(L, baseDir) + + Compile a list of MEX files as determined by the input argument L. + The second argument 'baseDir' is the common base directory for the + files listed in L. The third argument is a flag that determines + whether to force (re-)compilation even if the MEX file is up-to-date. + + See also ft_compile_mex, add_mex_source. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/compile_mex_list.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("compile_mex_list", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_cornerpoints.py b/fieldtrip/__fileio/_cornerpoints.py new file mode 100644 index 0000000..8b080b1 --- /dev/null +++ b/fieldtrip/__fileio/_cornerpoints.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _cornerpoints(*args, **kwargs): + """ + CORNERPOINTS returns the eight corner points of an anatomical volume + in voxel and in head coordinates + + Use as + [voxel, head] = cornerpoints(dim, transform) + which will return two 8x3 matrices. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/cornerpoints.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("cornerpoints", *args, **kwargs) diff --git a/fieldtrip/__fileio/_cstructdecode.py b/fieldtrip/__fileio/_cstructdecode.py new file mode 100644 index 0000000..7141ca5 --- /dev/null +++ b/fieldtrip/__fileio/_cstructdecode.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _cstructdecode(*args, **kwargs): + """ + CSTRUCTDECODE decodes a structure from a uint8 buffer + + See READ_NEURALYNX_NEV for an example + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/cstructdecode.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("cstructdecode", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ctf2grad.py b/fieldtrip/__fileio/_ctf2grad.py new file mode 100644 index 0000000..7724c0c --- /dev/null +++ b/fieldtrip/__fileio/_ctf2grad.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _ctf2grad(*args, **kwargs): + """ + CTF2GRAD converts a CTF header to a gradiometer structure that can be understood by + the FieldTrip low-level forward and inverse routines. The fieldtrip/fileio + read_header function can use three different implementations of the low-level code + for CTF data. Each of these implementations is dealt with here. + + Use as + [grad, elec] = ctf2grad(hdr, dewar, coilaccuracy) + where + dewar = boolean, whether to return it in dewar or head coordinates (default is head coordinates) + coilaccuracy = empty or a number (default is empty) + coildeffile = empty or a filename of a valid coil_def.dat file + + See also BTI2GRAD, FIF2GRAD, MNE2GRAD, ITAB2GRAD, YOKOGAWA2GRAD, + FT_READ_SENS, FT_READ_HEADER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ctf2grad.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ctf2grad", *args, **kwargs) diff --git a/fieldtrip/__fileio/_dataset2files.py b/fieldtrip/__fileio/_dataset2files.py new file mode 100644 index 0000000..c1c11b5 --- /dev/null +++ b/fieldtrip/__fileio/_dataset2files.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _dataset2files(*args, **kwargs): + """ + DATASET2FILES manages the filenames for the dataset, headerfile, datafile and eventfile + and tries to maintain a consistent mapping between them for each of the known fileformats + + Use as + [filename, headerfile, datafile] = dataset2files(filename, format) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/dataset2files.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("dataset2files", *args, **kwargs) diff --git a/fieldtrip/__fileio/_db_close.py b/fieldtrip/__fileio/_db_close.py new file mode 100644 index 0000000..6f4907c --- /dev/null +++ b/fieldtrip/__fileio/_db_close.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _db_close(*args, **kwargs): + """ + DB_CLOSE closes the connection to the database + + Use as + db_close + + See also DB_OPEN, DB_SELECT, DB_INSERT, DB_SELECT_BLOB, DB_INSERT_BLOB + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/db_close.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("db_close", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_db_insert.py b/fieldtrip/__fileio/_db_insert.py new file mode 100644 index 0000000..5950b3a --- /dev/null +++ b/fieldtrip/__fileio/_db_insert.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _db_insert(*args, **kwargs): + """ + DB_INSERT inserts a structure into a database table. Each field of + the structure should correspond with one of the fields in the table. + + Use as + db_insert(tablename, s) + + See also DB_OPEN, DB_SELECT, DB_SELECT_BLOB, DB_INSERT_BLOB, DB_CLOSE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/db_insert.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("db_insert", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_db_insert_blob.py b/fieldtrip/__fileio/_db_insert_blob.py new file mode 100644 index 0000000..bf406b8 --- /dev/null +++ b/fieldtrip/__fileio/_db_insert_blob.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _db_insert_blob(*args, **kwargs): + """ + DB_INSERT_BLOB converts a Matlab variable of arbitrary type into + a binary stream and inserts this stream into a binary blob in the + database table. + + Use as + db_insert_blob(tablename, fieldname, s) + + See also DB_OPEN, DB_SELECT, DB_SELECT_BLOB, DB_INSERT, DB_CLOSE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/db_insert_blob.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("db_insert_blob", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_db_open.py b/fieldtrip/__fileio/_db_open.py new file mode 100644 index 0000000..8082d0d --- /dev/null +++ b/fieldtrip/__fileio/_db_open.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _db_open(*args, **kwargs): + """ + DB_OPEN opens the connection to the database + + Use as + db_open + db_open(user, password, server, port, database) + db_open('mysql://:@:') + + See also DB_CLOSE, DB_SELECT, DB_INSERT, DB_SELECT_BLOB, DB_INSERT_BLOB + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/db_open.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("db_open", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_db_select.py b/fieldtrip/__fileio/_db_select.py new file mode 100644 index 0000000..6640d6e --- /dev/null +++ b/fieldtrip/__fileio/_db_select.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _db_select(*args, **kwargs): + """ + DB_SELECT selects data from a database table and converts it into a + Matlab structure.Each of the fields in the database table will be + represented as field in the strucure. + + Use as + s = db_select(tablename, fields) + s = db_select(tablename, fields, num) + + The optional argument num allows you to select a specific row number. + + See also DB_OPEN, DB_INSERT, DB_SELECT_BLOB, DB_INSERT_BLOB, DB_CLOSE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/db_select.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("db_select", *args, **kwargs) diff --git a/fieldtrip/__fileio/_db_select_blob.py b/fieldtrip/__fileio/_db_select_blob.py new file mode 100644 index 0000000..5980e95 --- /dev/null +++ b/fieldtrip/__fileio/_db_select_blob.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _db_select_blob(*args, **kwargs): + """ + DB_SELECT_BLOB selects a binary blob from a database table and converts + it back into a Matlab variable. The variable can be of an arbitrary type. + + Use as + s = db_select_blob(tablename, fieldname) + s = db_select_blob(tablename, fieldname, num) + + The optional argument num allows you to select a specific row number. + + See also DB_OPEN, DB_INSERT, DB_SELECT, DB_INSERT_BLOB, DB_CLOSE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/db_select_blob.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("db_select_blob", *args, **kwargs) diff --git a/fieldtrip/__fileio/_decode_fif.py b/fieldtrip/__fileio/_decode_fif.py new file mode 100644 index 0000000..36183c4 --- /dev/null +++ b/fieldtrip/__fileio/_decode_fif.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _decode_fif(*args, **kwargs): + """ + DECODE_FIF is a helper function for real-time processing of Neuromag data. This + function is used to decode the content of the optional neuromag_fif chunk(s). + + See also DECODE_RES4, DECODE_NIFTI1, SAP2MATLAB + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/decode_fif.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("decode_fif", *args, **kwargs) diff --git a/fieldtrip/__fileio/_decode_nifti1.py b/fieldtrip/__fileio/_decode_nifti1.py new file mode 100644 index 0000000..8557dc5 --- /dev/null +++ b/fieldtrip/__fileio/_decode_nifti1.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _decode_nifti1(*args, **kwargs): + """ + DECODE_NIFTI1 is a helper function for real-time processing of MRI data + + Use as + H = decode_nifti1(blob) + + Decodes a NIFTI-1 header given as raw 348 bytes (uint8) into a Matlab structure + that matches the C struct defined in nifti1.h, with the only difference that the + variable length arrays "dim" and "pixdim" are cut off to the right size, e.g., the + "dim" entry will only contain the relevant elements: + dim[0..7]={3,64,64,18,x,x,x,x} in C would become dim=[64,64,18] in Matlab. + + WARNING: This function currently ignores endianness !!! + + See also DECODE_RES4, DECODE_NIFTI1, SAP2MATLAB + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/decode_nifti1.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("decode_nifti1", *args, **kwargs) diff --git a/fieldtrip/__fileio/_decode_res4.py b/fieldtrip/__fileio/_decode_res4.py new file mode 100644 index 0000000..4b151ef --- /dev/null +++ b/fieldtrip/__fileio/_decode_res4.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _decode_res4(*args, **kwargs): + """ + DECODE_RES4 is a helper function for real-time processing of CTF data. This + function is used to decode the content of the optional ctf_res4 chunck. + + See also DECODE_FIF, DECODE_NIFTI1, SAP2MATLAB + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/decode_res4.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("decode_res4", *args, **kwargs) diff --git a/fieldtrip/__fileio/_defaultId.py b/fieldtrip/__fileio/_defaultId.py new file mode 100644 index 0000000..b28729d --- /dev/null +++ b/fieldtrip/__fileio/_defaultId.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _defaultId(*args, **kwargs): + """ + DEFAULTID returns a string that can serve as warning or error identifier, + for example 'FieldTip:ft_read_header:line345'. + + See also WARNING, ERROR, FT_NOTICE, FT_INFO, FT_DEBUG + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/defaultId.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("defaultId", *args, **kwargs) diff --git a/fieldtrip/__fileio/_dicom2transform.py b/fieldtrip/__fileio/_dicom2transform.py new file mode 100644 index 0000000..b7eedcd --- /dev/null +++ b/fieldtrip/__fileio/_dicom2transform.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def _dicom2transform(*args, **kwargs): + """ + DICOM2TRANSFORM converts the DICOM header parameters into a 4x4 homogenous + transformation matrix that maps voxel indices to the Patient Coordinate System. + Note that voxel indices are to be counted starting from 1 (MATLAB and Fortran + convention, not C/C++ and Python convention). This implementation is known to + result in a different transformation than FreeSurfer, but corresponds to Horos. + + Use as + M = dicom2transform(dcmheader) + where the input argument dcmheader is a structure array with header information for + each slice. The first structure in the DICOM header array must correspond to slice + 1 and the last one to slice N. + + The header structure for each of the slices must contain + dcmheader(i).ImagePositionPatient + dcmheader(i).ImageOrientationPatient + + The output argument M is a 4x4 homogenous transformation matrix that maps voxel + indices onto PCS world coordinates in millimeter. + + Here are some usefull DICOM references + https://doi.org/10.1016/j.jneumeth.2016.03.001 + https://dicom.innolitics.com/ciods/mr-image/image-plane/00200032 + https://horosproject.org + + See also DCMINFO, LOAD_DICOM_SERIES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/dicom2transform.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("dicom2transform", *args, **kwargs) diff --git a/fieldtrip/__fileio/_dimlength.py b/fieldtrip/__fileio/_dimlength.py new file mode 100644 index 0000000..309729b --- /dev/null +++ b/fieldtrip/__fileio/_dimlength.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _dimlength(*args, **kwargs): + """ + DIMLENGTH(DATA, SELDIM, FLD) is a helper function to obtain n, the number + of elements along dimension seldim from the appropriate field from the + input data containing functional data. + + Use als + [n, fn] = dimlength(data, seldim, fld) + + It can be called with one input argument only, in which case it will + output two cell arrays containing the size of the functional fields, + based on the XXXdimord, and the corresponding XXXdimord fields. + + When the data contains a single dimord field (everything except source + data), the cell-arrays in the output only contain one element. + + See also FIXSOURCE, CREATEDIMORD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/dimlength.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("dimlength", *args, **kwargs) diff --git a/fieldtrip/__fileio/_eegsynth_tsv.py b/fieldtrip/__fileio/_eegsynth_tsv.py new file mode 100644 index 0000000..5e29ea9 --- /dev/null +++ b/fieldtrip/__fileio/_eegsynth_tsv.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _eegsynth_tsv(*args, **kwargs): + """ + EEGSYNTH_TSV is called from FT_READ_EVENT to read the events from a tsv file + written by the recordtrigger module. The .tsv file should also contain a + synchronization trigger from the recordsignal module. + + Use as + hdr = events_tsv(filename) + evt = events_tsv(filename, hdr) + + Note that when reading the header, the number of channels in the actual data is unknown. + + See https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/05-task-events.html + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/eegsynth_tsv.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("eegsynth_tsv", *args, **kwargs) diff --git a/fieldtrip/__fileio/_elproj.py b/fieldtrip/__fileio/_elproj.py new file mode 100644 index 0000000..4fa8326 --- /dev/null +++ b/fieldtrip/__fileio/_elproj.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def _elproj(*args, **kwargs): + """ + ELPROJ makes a azimuthal projection of a 3D electrode cloud on a plane tangent to + the sphere fitted through the electrodes. The projection is along the z-axis. + + Use as + proj = elproj([x, y, z], 'method'); + + Method should be one of these: + 'gnomic' + 'stereographic' + 'orthographic' + 'inverse' + 'polar' + + Imagine a plane being placed against (tangent to) a globe. If + a light source inside the globe projects the graticule onto + the plane the result would be a planar, or azimuthal, map + projection. If the imaginary light is inside the globe a Gnomonic + projection results, if the light is antipodal a Sterographic, + and if at infinity, an Orthographic. + + The default projection is a BESA-like polar projection. + An inverse projection is the opposite of the default polar projection. + + See also PROJECTTRI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/elproj.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("elproj", *args, **kwargs) diff --git a/fieldtrip/__fileio/_encode_nifti1.py b/fieldtrip/__fileio/_encode_nifti1.py new file mode 100644 index 0000000..498c449 --- /dev/null +++ b/fieldtrip/__fileio/_encode_nifti1.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _encode_nifti1(*args, **kwargs): + """ + function blob = encode_nifti1(H) + + Encodes a NIFTI-1 header (=> raw 348 bytes (uint8)) from a Matlab structure + that matches the C struct defined in nifti1.h. + + WARNING: This function currently ignores endianness !!! + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/encode_nifti1.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("encode_nifti1", *args, **kwargs) diff --git a/fieldtrip/__fileio/_events_tsv.py b/fieldtrip/__fileio/_events_tsv.py new file mode 100644 index 0000000..565cfce --- /dev/null +++ b/fieldtrip/__fileio/_events_tsv.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _events_tsv(*args, **kwargs): + """ + EVENTS_TSV is called from FT_READ_EVENT to read the events from a BIDS _events.tsv + file. Although this function also reads the header for the sampling rate, it cannot + be used to read data. Please see BIDS_TSV for reading data. + + Use as + hdr = events_tsv(filename) + evt = events_tsv(filename, hdr) + to read the header or the event information. + + You should specify the _events.tsv file as the filename, the corresponding header + file (with the sampling rate) will automatically be located in the same directory. + + See https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/05-task-events.html + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/events_tsv.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("events_tsv", *args, **kwargs) diff --git a/fieldtrip/__fileio/_fetch_url.py b/fieldtrip/__fileio/_fetch_url.py new file mode 100644 index 0000000..f5724b7 --- /dev/null +++ b/fieldtrip/__fileio/_fetch_url.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _fetch_url(*args, **kwargs): + """ + FETCH_URL checks the filename and downloads the file to a local copy in + case it is specified as an Universal Resource Locator. It returns the + name of the temporary file on the local filesystem. + + Use as + filename = fetch_url(filename) + + In case the filename does not specify an URL, it just returns the original + filename. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/fetch_url.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fetch_url", *args, **kwargs) diff --git a/fieldtrip/__fileio/_fif2grad.py b/fieldtrip/__fileio/_fif2grad.py new file mode 100644 index 0000000..176685e --- /dev/null +++ b/fieldtrip/__fileio/_fif2grad.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _fif2grad(*args, **kwargs): + """ + FIF2GRAD constructs a gradiometer definition from a Neuromag *.fif file + The resulting gradiometer definition can be used by Fieldtrip for forward + and inverse computations. + + Use as + grad = fif2grad(filename) + + See also CTF2GRAD, BTI2GRAD, MNE2GRAD, ITAB2GRAD, YOKOGAWA2GRAD, + FT_READ_SENS, FT_READ_HEADER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/fif2grad.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fif2grad", *args, **kwargs) diff --git a/fieldtrip/__fileio/_fiff_open_le.py b/fieldtrip/__fileio/_fiff_open_le.py new file mode 100644 index 0000000..24a4b3c --- /dev/null +++ b/fieldtrip/__fileio/_fiff_open_le.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _fiff_open_le(*args, **kwargs): + """ + + [fid, tree, dir] = fiff_open_le(fname) + + Open a fif file and provide the directory of tags + + fid the opened file id + tree tag directory organized into a tree + dir the sequential tag directory + + This is a modified version, specific for opening 'little endian' fiff files + Arjen Stolk + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/fiff_open_le.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fiff_open_le", *args, **kwargs) diff --git a/fieldtrip/__fileio/_filetype_check_extension.py b/fieldtrip/__fileio/_filetype_check_extension.py new file mode 100644 index 0000000..44877f3 --- /dev/null +++ b/fieldtrip/__fileio/_filetype_check_extension.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _filetype_check_extension(*args, **kwargs): + """ + FILETYPE_CHECK_EXTENSION helper function to determine the file type + by performing a case insensitive string comparison of the extension. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/filetype_check_extension.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("filetype_check_extension", *args, **kwargs) diff --git a/fieldtrip/__fileio/_filetype_check_header.py b/fieldtrip/__fileio/_filetype_check_header.py new file mode 100644 index 0000000..acd1092 --- /dev/null +++ b/fieldtrip/__fileio/_filetype_check_header.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _filetype_check_header(*args, **kwargs): + """ + FILETYPE_CHECK_HEADER helper function to determine the file type + by reading the first number of bytes of a file and comparing them + to a known string or magic number. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/filetype_check_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("filetype_check_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/_filetype_check_uri.py b/fieldtrip/__fileio/_filetype_check_uri.py new file mode 100644 index 0000000..ab5b6e4 --- /dev/null +++ b/fieldtrip/__fileio/_filetype_check_uri.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def _filetype_check_uri(*args, **kwargs): + """ + FILETYPE_CHECK_URI + + Use as + status = filetype_check_uri(filename, type) + + Supported URIs are + buffer://: + fifo:// + global:// + mysql://:@: + rfb://@: + serial:?key1=value1&key2=value2&... + shm:// + tcp://: + udp://: + ftp://@/path + sftp://@/path + + The URI schemes supproted by these function are not the official schemes. + See the documentation included inside this function for more details. + RFC4395 defines an IANA-maintained registry of URI Schemes. See also + http://www.iana.org/assignments/uri-schemes.html and + http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/filetype_check_uri.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("filetype_check_uri", *args, **kwargs) diff --git a/fieldtrip/__fileio/_find_outermost_boundary.py b/fieldtrip/__fileio/_find_outermost_boundary.py new file mode 100644 index 0000000..78b66f1 --- /dev/null +++ b/fieldtrip/__fileio/_find_outermost_boundary.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _find_outermost_boundary(*args, **kwargs): + """ + FIND_OUTERMOST_BOUNDARY locates outermost compartment of a BEM model + by looking at the containment of the triangular meshes describing + the surface boundaries + + [outermost] = find_innermost_boundary(bnd) + + with the boundaries described by a struct-array bnd with + bnd(i).pnt vertices of boundary i (matrix of size Nx3) + bnd(i).tri triangles of boundary i (matrix of size Mx3) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/find_outermost_boundary.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("find_outermost_boundary", *args, **kwargs) diff --git a/fieldtrip/__fileio/_fixbalance.py b/fieldtrip/__fileio/_fixbalance.py new file mode 100644 index 0000000..1fb81d0 --- /dev/null +++ b/fieldtrip/__fileio/_fixbalance.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _fixbalance(*args, **kwargs): + """ + FIXBALANCE ensures that the balancing representation in grad.balance or + elec.balance field is up to date and consistent, specifically with the + list of linear projections (or montages) being applied specified as + cell-array in "current", and not as a string in "current" and cell-array + in "previous". + + See also FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/fixbalance.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixbalance", *args, **kwargs) diff --git a/fieldtrip/__fileio/_fixcoordsys.py b/fieldtrip/__fileio/_fixcoordsys.py new file mode 100644 index 0000000..28b7663 --- /dev/null +++ b/fieldtrip/__fileio/_fixcoordsys.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _fixcoordsys(*args, **kwargs): + """ + FIXCOORDSYS ensures that the coordinate system is consistently + described. E.g. SPM and MNI are technically the same coordinate + system, but the strings 'spm' and 'mni' are different. + + See also FT_DETERMINE_COORDSYS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/fixcoordsys.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixcoordsys", *args, **kwargs) diff --git a/fieldtrip/__fileio/_fixdimord.py b/fieldtrip/__fileio/_fixdimord.py new file mode 100644 index 0000000..dda51e6 --- /dev/null +++ b/fieldtrip/__fileio/_fixdimord.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def _fixdimord(*args, **kwargs): + """ + FIXDIMORD ensures consistency between the dimord string and the axes + that describe the data dimensions. The main purpose of this function + is to ensure backward compatibility of all functions with data that has + been processed by older FieldTrip versions. + + Use as + [data] = fixdimord(data) + This will modify the data.dimord field to ensure consistency. + The name of the axis is the same as the name of the dimord, i.e. if + dimord='freq_time', then data.freq and data.time should be present. + + The default dimensions in the data are described by + 'time' + 'freq' + 'chan' + 'chancmb' + 'refchan' + 'subj' + 'rpt' + 'rpttap' + 'pos' + 'ori' + 'rgb' + 'comp' + 'voxel' + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/fixdimord.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixdimord", *args, **kwargs) diff --git a/fieldtrip/__fileio/_fixinside.py b/fieldtrip/__fileio/_fixinside.py new file mode 100644 index 0000000..dba9733 --- /dev/null +++ b/fieldtrip/__fileio/_fixinside.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _fixinside(*args, **kwargs): + """ + FIXINSIDE ensures that the region of interest (which is indicated by the + field "inside") is consistently defined for source structures and volume + structures. Furthermore, it solves backward compatibility problems. + + Use as + [source] = fixinside(source, 'logical'); + or + [source] = fixinside(source, 'index'); + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/fixinside.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixinside", *args, **kwargs) diff --git a/fieldtrip/__fileio/_fixname.py b/fieldtrip/__fileio/_fixname.py new file mode 100644 index 0000000..fe7f2a2 --- /dev/null +++ b/fieldtrip/__fileio/_fixname.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _fixname(*args, **kwargs): + """ + FIXNAME changes all inappropriate characters in a string into '_' + so that it can be used as a filename or as a field name in a structure. + If the string begins with a digit, an 'x' is prepended. + + Use as + str = fixname(str) + + MATLAB 2014a introduces the matlab.lang.makeValidName and + matlab.lang.makeUniqueStrings functions for constructing unique + identifiers, but this particular implementation also works with + older MATLAB versions. + + See also DEBLANK, STRIP, PAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/fixname.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixname", *args, **kwargs) diff --git a/fieldtrip/__fileio/_fixoldorg.py b/fieldtrip/__fileio/_fixoldorg.py new file mode 100644 index 0000000..c7baacc --- /dev/null +++ b/fieldtrip/__fileio/_fixoldorg.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _fixoldorg(*args, **kwargs): + """ + FIXOLDORG use "old/new" instead of "org/new" + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/fixoldorg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixoldorg", *args, **kwargs) diff --git a/fieldtrip/__fileio/_fixpos.py b/fieldtrip/__fileio/_fixpos.py new file mode 100644 index 0000000..5c56846 --- /dev/null +++ b/fieldtrip/__fileio/_fixpos.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _fixpos(*args, **kwargs): + """ + FIXPOS helper function to ensure that meshes are described properly + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/fixpos.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixpos", *args, **kwargs) diff --git a/fieldtrip/__fileio/_fixsampleinfo.py b/fieldtrip/__fileio/_fixsampleinfo.py new file mode 100644 index 0000000..5bc55cf --- /dev/null +++ b/fieldtrip/__fileio/_fixsampleinfo.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _fixsampleinfo(*args, **kwargs): + """ + FIXSAMPLEINFO checks for the existence of a sampleinfo and trialinfo field in the + provided raw or timelock data structure. If present, nothing is done; if absent, + this function attempts to reconstruct them based on either an trl-matrix present in + the cfg-tree, or by just assuming the trials are segments of a continuous + recording. + + See also FT_DATATYPE_RAW, FT_DATATYPE_TIMELOCK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/fixsampleinfo.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixsampleinfo", *args, **kwargs) diff --git a/fieldtrip/__fileio/_fopen_or_error.py b/fieldtrip/__fileio/_fopen_or_error.py new file mode 100644 index 0000000..40ffeab --- /dev/null +++ b/fieldtrip/__fileio/_fopen_or_error.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _fopen_or_error(*args, **kwargs): + """ + FOPEN_OR_ERROR Opens a file, like fopen, but throws an exception if the open failed. + + This keeps you from having to write "if fid < 0; error(...)" everywhere + you do an fopen. + + See also FOPEN, ISDIR_OR_MKDIR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/fopen_or_error.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fopen_or_error", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_apply_montage.py b/fieldtrip/__fileio/_ft_apply_montage.py new file mode 100644 index 0000000..9e5338b --- /dev/null +++ b/fieldtrip/__fileio/_ft_apply_montage.py @@ -0,0 +1,78 @@ +from fieldtrip._runtime import Runtime + + +def _ft_apply_montage(*args, **kwargs): + """ + FT_APPLY_MONTAGE changes the montage (i.e. linear combination) of a set of + electrode or gradiometer channels. A montage can be used for EEG rereferencing, MEG + synthetic gradients, MEG planar gradients or unmixing using ICA. This function not + only applies the montage to the EEG or MEG data, but also applies the montage to + the input EEG or MEG sensor array, which can subsequently be used for forward + computation and source reconstruction of the data. + + Use as + [sens] = ft_apply_montage(sens, montage, ...) + [data] = ft_apply_montage(data, montage, ...) + [freq] = ft_apply_montage(freq, montage, ...) + [montage] = ft_apply_montage(montage1, montage2, ...) + + A montage is specified as a structure with the fields + montage.tra = MxN matrix + montage.labelold = Nx1 cell-array + montage.labelnew = Mx1 cell-array + + As an example, a bipolar montage could look like this + bipolar.labelold = {'1', '2', '3', '4'} + bipolar.labelnew = {'1-2', '2-3', '3-4'} + bipolar.tra = [ + +1 -1 0 0 + 0 +1 -1 0 + 0 0 +1 -1 + ]; + + The montage can optionally also specify the channel type and unit of the input + and output data with + montage.chantypeold = Nx1 cell-array + montage.chantypenew = Mx1 cell-array + montage.chanunitold = Nx1 cell-array + montage.chanunitnew = Mx1 cell-array + + Additional options should be specified in key-value pairs and can be + 'keepunused' = string, 'yes' or 'no' (default = 'no') + 'feedback' = string, see FT_PROGRESS (default = 'text') + 'warning' = boolean, whether to show warnings (default = true) + + If the first input is a montage, then the second input montage will be + applied to the first. In effect, the output montage will first do + montage1, then montage2. + + See also FT_READ_SENS, FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_apply_montage.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_apply_montage", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_checkdata.py b/fieldtrip/__fileio/_ft_checkdata.py new file mode 100644 index 0000000..a8d21c4 --- /dev/null +++ b/fieldtrip/__fileio/_ft_checkdata.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def _ft_checkdata(*args, **kwargs): + """ + FT_CHECKDATA checks the input data of the main FieldTrip functions, e.g. whether the + type of data structure corresponds with the required data. If necessary and possible, + this function will adjust the data structure to the input requirements (e.g. change + dimord, average over trials, convert inside from index into logical). + + If the input data does NOT correspond to the requirements, this function will give a + warning message and if applicable point the user to external documentation (link to + website). + + Use as + [data] = ft_checkdata(data, ...) + + Optional input arguments should be specified as key-value pairs and can include + feedback = 'yes' or 'no' + datatype = raw, freq, timelock, comp, spike, source, mesh, dip, volume, segmentation, parcellation + dimord = any combination of time, freq, chan, refchan, rpt, subj, chancmb, rpttap, pos + senstype = ctf151, ctf275, ctf151_planar, ctf275_planar, neuromag122, neuromag306, bti148, bti248, bti248_planar, magnetometer, electrode + fsample = sampling frequency to use to go from SPIKE to RAW representation + ismeg = 'yes' or 'no', requires the data to have a grad structure + iseeg = 'yes' or 'no', requires the data to have an elec structure + isnirs = 'yes' or 'no', requires the data to have an opto structure + hasunit = 'yes' or 'no' + hascoordsys = 'yes' or 'no' + haschantype = 'yes' or 'no' + haschanunit = 'yes' or 'no' + hassampleinfo = 'yes', 'no', or 'ifmakessense' (applies to raw and timelock data) + hascumtapcnt = 'yes' or 'no' (only applies to freq data) + hasdim = 'yes' or 'no' + hasdof = 'yes' or 'no' + hasbrain = 'yes' or 'no' (only applies to segmentation) + insidestyle = logical, index, can also be empty + cmbstyle = sparse, sparsewithpow, full, fullfast, fourier (applies to covariance and cross-spectral density) + segmentationstyle = indexed, probabilistic (only applies to segmentation) + parcellationstyle = indexed, probabilistic (only applies to parcellation) + trialinfostyle = matrix, table or empty + + For some options you can specify multiple values, e.g. + [data] = ft_checkdata(data, 'senstype', {'ctf151', 'ctf275'}), e.g. in megrealign + [data] = ft_checkdata(data, 'datatype', {'timelock', 'freq'}), e.g. in sourceanalysis + + See also FT_DATATYPE_XXX for each of the respective data types. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_checkdata.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_checkdata", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_convert_units.py b/fieldtrip/__fileio/_ft_convert_units.py new file mode 100644 index 0000000..2d53cb3 --- /dev/null +++ b/fieldtrip/__fileio/_ft_convert_units.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def _ft_convert_units(*args, **kwargs): + """ + FT_CONVERT_UNITS changes the geometrical dimension to the specified SI unit. + The units of the input object is determined from the structure field + object.unit, or is estimated based on the spatial extend of the structure, + e.g. a volume conduction model of the head should be approximately 20 cm large. + + Use as + [output] = ft_convert_units(input, target) + + The following input data structures are supported + electrode or gradiometer array, see FT_DATATYPE_SENS + volume conductor, see FT_DATATYPE_HEADMODEL + anatomical mri, see FT_DATATYPE_VOLUME + segmented mri, see FT_DATATYPE_SEGMENTATION + source model, see FT_DATATYPE_SOURCE and FT_PREPARE_SOURCEMODEL + + The possible target units are 'm', 'cm ' or 'mm'. If no target units are specified, + this function will only determine the geometrical units of the input object. + + See also FT_DETERMINE_UNITS, FT_DETERMINE_COORDSYS, FT_CONVERT_COORDSYS, FT_PLOT_AXES, FT_PLOT_XXX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_convert_units.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_convert_units", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_datatype.py b/fieldtrip/__fileio/_ft_datatype.py new file mode 100644 index 0000000..576b726 --- /dev/null +++ b/fieldtrip/__fileio/_ft_datatype.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _ft_datatype(*args, **kwargs): + """ + FT_DATATYPE determines the type of data represented in a FieldTrip data structure + and returns a string with raw, freq, timelock source, comp, spike, source, volume, + dip, montage, event. + + Use as + [type, dimord] = ft_datatype(data) + [bool] = ft_datatype(data, desired) + + See also FT_DATATYPE_COMP, FT_DATATYPE_FREQ, FT_DATATYPE_MVAR, + FT_DATATYPE_SEGMENTATION, FT_DATATYPE_PARCELLATION, FT_DATATYPE_SOURCE, + FT_DATATYPE_TIMELOCK, FT_DATATYPE_DIP, FT_DATATYPE_HEADMODEL, + FT_DATATYPE_RAW, FT_DATATYPE_SENS, FT_DATATYPE_SPIKE, FT_DATATYPE_VOLUME + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_datatype.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_datatype_comp.py b/fieldtrip/__fileio/_ft_datatype_comp.py new file mode 100644 index 0000000..55037b0 --- /dev/null +++ b/fieldtrip/__fileio/_ft_datatype_comp.py @@ -0,0 +1,79 @@ +from fieldtrip._runtime import Runtime + + +def _ft_datatype_comp(*args, **kwargs): + """ + FT_DATATYPE_COMP describes the FieldTrip MATLAB structure for comp data + + The comp data structure represents time-series channel-level data that has + been decomposed or unmixed from the channel level into its components or + "blind sources", for example using ICA (independent component analysis) or + PCA. This data structure is usually generated with the FT_COMPONENTANALYSIS + function. + + An example of a decomposed raw data structure with 100 components that resulted from + a 151-channel MEG recording is shown here: + + topo: [151x100 double] the component topographies + unmixing: [100x151 double] the component unmixing matrix + topolabel: {151x1 cell} the channel labels (e.g. 'MRC13') + label: {100x1 cell} the component labels (e.g. 'runica001') + time: {1x10 cell} the time axis [1*Ntime double] per trial + trial: {1x10 cell} the numeric data [151*Ntime double] per trial + grad: [1x1 struct] information about the sensor array (for EEG it is called elec) + cfg: [1x1 struct] the configuration used by the function that generated this data structure + + The only difference to the raw data structure is that the comp structure contains + the additional fields unmixing, topo and topolabel. Besides representing the time + series information as a raw data structure (see FT_DATATYPE_RAW), it is also + possible for time series information to be represented as timelock or freq + structures (see FT_DATATYPE_TIMELOCK or FT_DATATYPE_FREQ). + + Required fields: + - unmixing, topo, topolabel + + Optional fields: + - cfg, all fields from FT_DATATYPE_RAW, FT_DATATYPE_TIMELOCK or FT_DATATYPE_FREQ + + Historical fields: + - offset, fsample + + Revision history: + (2014) The combination of comp with raw, timelock or freq has been defined explicitly. + + (2011) The unmixing matrix has been added to the component data structure. + + (2003) The initial version was defined + + See also FT_DATATYPE, FT_DATATYPE_COMP, FT_DATATYPE_DIP, FT_DATATYPE_FREQ, + FT_DATATYPE_MVAR, FT_DATATYPE_RAW, FT_DATATYPE_SOURCE, FT_DATATYPE_SPIKE, + FT_DATATYPE_TIMELOCK, FT_DATATYPE_VOLUME + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_datatype_comp.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_comp", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_datatype_dip.py b/fieldtrip/__fileio/_ft_datatype_dip.py new file mode 100644 index 0000000..8880541 --- /dev/null +++ b/fieldtrip/__fileio/_ft_datatype_dip.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _ft_datatype_dip(*args, **kwargs): + """ + FT_DATATYPE_DIP descripts the FieldTrip MATLAB structure for dip data + + The dip structure represents a dipole model that has been fitted to + ERP or ERF data using a non-linear optimization approach. It is + usually generated by the FT_DIPOLEFITTING function. + + FIXME more information should be added here + + See also FT_DATATYPE, FT_DATATYPE_SOURCE, FT_DATATYPE_VOLUME + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_datatype_dip.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_dip", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_datatype_freq.py b/fieldtrip/__fileio/_ft_datatype_freq.py new file mode 100644 index 0000000..7f791b6 --- /dev/null +++ b/fieldtrip/__fileio/_ft_datatype_freq.py @@ -0,0 +1,90 @@ +from fieldtrip._runtime import Runtime + + +def _ft_datatype_freq(*args, **kwargs): + """ + FT_DATATYPE_FREQ describes the FieldTrip MATLAB structure for freq data + + The freq data structure represents frequency or time-frequency decomposed + channel-level data. This data structure is usually generated with the + FT_FREQANALYSIS function. + + An example of a freq data structure containing the powerspectrum for 306 channels + and 120 frequencies is + + dimord: 'chan_freq' defines how the numeric data should be interpreted + powspctrm: [306x120 double] the power spectrum + label: {306x1 cell} the channel labels + freq: [1x120 double] the frequencies expressed in Hz + cfg: [1x1 struct] the configuration used by the function that generated this data structure + + An example of a freq data structure containing the time-frequency resolved + spectral estimates of power (i.e. TFR) for 306 channels, 120 frequencies + and 60 timepoints is + + dimord: 'chan_freq_time' defines how the numeric data should be interpreted + powspctrm: [306x120x60 double] the power spectrum + label: {306x1 cell} the channel labels + freq: [1x120 double] the frequencies, expressed in Hz + time: [1x60 double] the time, expressed in seconds + cfg: [1x1 struct] the configuration used by the function that generated this data structure + + Required fields: + - freq, dimord, label or labelcmb + + Optional fields: + - powspctrm, fouriesspctrm, csdspctrm, cohspctrm, time, grad, elec, cumsumcnt, cumtapcnt, trialinfo + + Deprecated fields: + - + + Obsoleted fields: + - + + Revision history: + + (2011/latest) The description of the sensors has changed, see FT_DATATYPE_SENS + for further information. + + (2008) The presence of labelcmb in case of crsspctrm became optional, + from now on the crsspctrm can also be represented as Nchan * Nchan. + + (2006) The fourierspctrm field was added as alternative to powspctrm and + crsspctrm. The fields foi and toi were renamed to freq and time. + + (2003v2) The fields sgn and sgncmb were renamed into label and labelcmb. + + (2003v1) The initial version was defined. + + See also FT_DATATYPE, FT_DATATYPE_COMP, FT_DATATYPE_DIP, FT_DATATYPE_FREQ, + FT_DATATYPE_MVAR, FT_DATATYPE_RAW, FT_DATATYPE_SOURCE, FT_DATATYPE_SPIKE, + FT_DATATYPE_TIMELOCK, FT_DATATYPE_VOLUME + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_datatype_freq.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_freq", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_datatype_headmodel.py b/fieldtrip/__fileio/_ft_datatype_headmodel.py new file mode 100644 index 0000000..c00f92b --- /dev/null +++ b/fieldtrip/__fileio/_ft_datatype_headmodel.py @@ -0,0 +1,98 @@ +from fieldtrip._runtime import Runtime + + +def _ft_datatype_headmodel(*args, **kwargs): + """ + FT_DATATYPE_HEADMODEL describes the FieldTrip MATLAB structure for a volume + conduction model of the head that can be used for forward computations of the EEG + potentials or the MEG fields. The volume conduction model represents the + geometrical and the conductive properties of the head. These determine how the + secondary (or impressed) currents flow and how these contribute to the model + potential or field. + + A large number of forward solutions for the EEG and MEG are supported in FieldTrip, + each with its own specification of the MATLAB structure that describes the volume + conduction model of th ehead. It would be difficult to list all the possibilities + here. One common feature is that the volume conduction model should specify its + type, and that preferably it should specify the geometrical units in which it is + expressed (for example in mm, cm or m). + + An example of an EEG volume conduction model with 4 concentric spheres is: + + headmodel = + r: [86 88 94 100] + c: [0.33 1.79 0.042 0.33] + o: [0 0 0] + type: 'concentricspheres' + unit: 'mm' + + An example of an MEG volume conduction model with a single sphere fitted to + the scalp with its center 4 cm above the line connecting the ears is: + + headmodel = + r: [12] + o: [0 0 4] + type: 'singlesphere' + unit: 'cm' + + For each of the methods XXX for the volume conduction model, a corresponding + function FT_HEADMODEL_XXX exists that contains all specific details and + references to literature that describes the implementation. + + Required fields: + - type + + Optional fields: + - unit + + Deprecated fields: + - inner_skull_surface, source_surface, skin_surface, source, skin + + Obsoleted fields: + - + + Revision history: + + (2015/latest) Use the field name "pos" instead of "pnt" for vertex positions. + + (2014) All numeric values are represented in double precision. + + (2013) Always use the field "cond" for conductivity. + + (2012) Use consistent names for the volume conductor type in the structure, the + documentation and for the actual implementation, e.g. bem_openmeeg -> openmeeg, + fem_simbio -> simbio, concentric -> concentricspheres. Deprecated the fields + that indicate the index of the innermost and outermost surfaces. + + See also FT_PREPARE_HEADMODEL, FT_DATATYPE, FT_DATATYPE_COMP, FT_DATATYPE_DIP, + FT_DATATYPE_FREQ, FT_DATATYPE_MVAR, FT_DATATYPE_RAW, FT_DATATYPE_SOURCE, + FT_DATATYPE_SPIKE, FT_DATATYPE_TIMELOCK, FT_DATATYPE_VOLUME + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_datatype_headmodel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_headmodel", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_datatype_mvar.py b/fieldtrip/__fileio/_ft_datatype_mvar.py new file mode 100644 index 0000000..5eb56cf --- /dev/null +++ b/fieldtrip/__fileio/_ft_datatype_mvar.py @@ -0,0 +1,85 @@ +from fieldtrip._runtime import Runtime + + +def _ft_datatype_mvar(*args, **kwargs): + """ + FT_DATATYPE_MVAR describes the FieldTrip MATLAB structure for multi-variate + autoregressive model data. + + The mvar datatype represents multivariate model estimates in the time- or + in the frequency-domain. This is usually obtained from FT_MVARANALYSIS, + optionally in combination with FT_FREQANALYSIS. + + The following is an example of sensor level MVAR model data in the time domain + + dimord: 'chan_chan_lag' defines how the numeric data should be interpreted + label: {3x1 cell} the channel labels + coeffs: [3x3x5 double] numeric data (MVAR model coefficients 3 channels x 3 channels x 5 time lags) + noisecov: [3x3 double] more numeric data (covariance matrix of the noise residuals 3 channels x 3 channels) + dof: 500 + fsampleorig: 200 + cfg: [1x1 struct] + + The following is an example of sensor-level MVAR model data in the frequency domain + + dimord: 'chan_chan_freq' defines how the numeric data should be interpreted + label: {3x1 cell} the channel labels + freq: [1x101 double] the frequencies, expressed in Hz + transfer: [3x3x101 double] + itransfer: [3x3x101 double] + noisecov: [3x3 double] + crsspctrm: [3x3x101 double] + dof: 500 + cfg: [1x1 struct] + + Required fields: + - label, dimord, freq + + Optional fields: + - too many to mention + + Deprecated fields: + - + + Obsoleted fields: + - + + Revision history: + + (2011/latest) The description of the sensors has changed, see FT_DATATYPE_SENS + for further information. + + (2008) The initial version was defined. + + See also FT_DATATYPE, FT_DATATYPE_COMP, FT_DATATYPE_DIP, FT_DATATYPE_FREQ, + FT_DATATYPE_MVAR, FT_DATATYPE_RAW, FT_DATATYPE_SOURCE, FT_DATATYPE_SPIKE, + FT_DATATYPE_TIMELOCK, FT_DATATYPE_VOLUME + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_datatype_mvar.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_mvar", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_datatype_raw.py b/fieldtrip/__fileio/_ft_datatype_raw.py new file mode 100644 index 0000000..ff4eab5 --- /dev/null +++ b/fieldtrip/__fileio/_ft_datatype_raw.py @@ -0,0 +1,84 @@ +from fieldtrip._runtime import Runtime + + +def _ft_datatype_raw(*args, **kwargs): + """ + FT_DATATYPE_RAW describes the FieldTrip MATLAB structure for raw data + + The raw datatype represents sensor-level time-domain data typically + obtained after calling FT_DEFINETRIAL and FT_PREPROCESSING. It contains + one or multiple segments of data, each represented as Nchan X Ntime + arrays. + + An example of a raw data structure with 151 MEG channels is + + label: {151x1 cell} the channel labels represented as a cell-array of strings + time: {1x266 cell} the time axis [1*Ntime double] per trial + trial: {1x266 cell} the numeric data as a cell array, with a matrix of [151*Ntime double] per trial + sampleinfo: [266x2 double] the begin and endsample of each trial relative to the recording on disk + trialinfo: [266x1 double] optional trigger or condition codes for each trial + hdr: [1x1 struct] the full header information of the original dataset on disk + grad: [1x1 struct] information about the sensor array (for EEG it is called elec) + cfg: [1x1 struct] the configuration used by the function that generated this data structure + + Required fields: + - time, trial, label + + Optional fields: + - sampleinfo, trialinfo, grad, elec, opto, hdr, cfg + + Deprecated fields: + - fsample + + Obsoleted fields: + - offset + + Revision history: + + (2011/latest) The description of the sensors has changed, see FT_DATATYPE_SENS + for further information. + + (2010v2) The trialdef field has been replaced by the sampleinfo and + trialinfo fields. The sampleinfo corresponds to trl(:,1:2), the trialinfo + to trl(4:end). + + (2010v1) In 2010/Q3 it shortly contained the trialdef field which was a copy + of the trial definition (trl) is generated by FT_DEFINETRIAL. + + (2007) It used to contain the offset field, which corresponds to trl(:,3). + Since the offset field is redundant with the time axis, the offset field is + from now on not present any more. It can be recreated if needed. + + (2003) The initial version was defined + + See also FT_DATATYPE, FT_DATATYPE_COMP, FT_DATATYPE_TIMELOCK, FT_DATATYPE_FREQ, + FT_DATATYPE_SPIKE, FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_datatype_raw.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_raw", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_datatype_sens.py b/fieldtrip/__fileio/_ft_datatype_sens.py new file mode 100644 index 0000000..a94a225 --- /dev/null +++ b/fieldtrip/__fileio/_ft_datatype_sens.py @@ -0,0 +1,127 @@ +from fieldtrip._runtime import Runtime + + +def _ft_datatype_sens(*args, **kwargs): + """ + FT_DATATYPE_SENS describes the FieldTrip structure that represents an MEG, EEG, + sEEG, ECoG, or NIRS sensor array. This structure is commonly called "grad" for MEG, + "elec" for EEG and intranial EEG, "opto" for NIRS, or in general "sens" if it could + be any one. + + For all sensor types a distinction should be made between the channel (i.e. the + output of the transducer that is A/D converted) and the sensor, which may have some + spatial extent. For example in MEG gradiometers are comprised of multiple coils and + with EEG you can have a bipolar channel, where the position of the channel can be + represented as in between the position of the two electrodes. + + The structure for MEG gradiometers and/or magnetometers contains + sens.label = Mx1 cell-array with channel labels + sens.chanpos = Mx3 matrix with channel positions + sens.chanori = Mx3 matrix with channel orientations, used for synthetic planar gradient computation + sens.coilpos = Nx3 matrix with coil positions + sens.coilori = Nx3 matrix with coil orientations + sens.tra = MxN matrix to combine coils into channels + sens.balance = structure containing info about the balancing, See FT_APPLY_MONTAGE + and optionally + sens.chanposold = Mx3 matrix with original channel positions (in case sens.chanpos has been updated to contain NaNs, e.g. after FT_COMPONENTANALYSIS) + sens.chanoriold = Mx3 matrix with original channel orientations + sens.labelold = Mx1 cell-array with original channel labels + + The structure for EEG, sEEG or ECoG channels contains + sens.label = Mx1 cell-array with channel labels + sens.chanpos = Mx3 matrix with channel positions (often the same as electrode positions) + sens.elecpos = Nx3 matrix with electrode positions + sens.tra = MxN matrix to combine electrodes into channels + In case sens.tra is not present in the EEG sensor array, the channels + are assumed to be average referenced. + + The structure for NIRS channels contains + sens.label = Mx1 cell-array with channel labels + sens.chanpos = Mx3 matrix with position of the channels (usually halfway the transmitter and receiver) + sens.optopos = Nx3 matrix with the position of individual optodes + sens.optotype = Nx1 cell-array with information about the type of optode (receiver or transmitter) + sens.optolabel = Nx1 cell-array with optode labels + sens.wavelength = 1xK vector of all wavelengths that were used + sens.tra = MxN matrix that specifies for each of the M channels which of the N optodes transmits at which wavelength (positive integer from 1 to K), or receives (negative ingeger from 1 to K) + + The following fields apply to MEG, EEG, sEEG and ECoG + sens.chantype = Mx1 cell-array with the type of the channel, see FT_CHANTYPE + sens.chanunit = Mx1 cell-array with the units of the channel signal, e.g. 'V', 'fT' or 'T/cm', see FT_CHANUNIT + + Optional fields: + type, unit, fid, chantype, chanunit, coordsys, balance + + Historical fields: + pnt, pos, ori, pnt1, pnt2, fiberpos, fibertype, fiberlabel, transceiver, transmits, laserstrength + + Revision history: + (2025/latest) Explicitly deal with the balance field and sequence of montages. + + (2020/latest) Updated the specification of the NIRS sensor definition. + Dropped the laserstrength and renamed transmits into tra for consistency. + + (2019/latest) Updated the specification of the NIRS sensor definition. + Use "opto" instead of "fibers", see http://bit.ly/33WaqWU for details. + + (2016) The chantype and chanunit have become required fields. + Original channel details are specified with the suffix "old" rather than "org". + All numeric values are represented in double precision. + It is possible to convert the amplitude and distance units (e.g. from T to fT and + from m to mm) and it is possible to express planar and axial gradiometer channels + either in units of amplitude or in units of amplitude/distance (i.e. proper + gradient). + + (2011v2) The chantype and chanunit have been added for MEG. + + (2011v1) To facilitate determining the position of channels (e.g. for plotting) + in case of balanced MEG or bipolar EEG, an explicit distinction has been made + between chanpos+chanori and coilpos+coilori (for MEG) and chanpos and elecpos + (for EEG). The pnt and ori fields are removed. + + (2010) Added support for bipolar or otherwise more complex linear combinations + of EEG electrodes using sens.tra, similar to MEG. + + (2009) Noise reduction has been added for MEG systems in the balance field. + + (2006) The optional fields sens.type and sens.unit were added. + + (2003) The initial version was defined, which looked like this for EEG + sens.pnt = Mx3 matrix with electrode positions + sens.label = Mx1 cell-array with channel labels + and like this for MEG + sens.pnt = Nx3 matrix with coil positions + sens.ori = Nx3 matrix with coil orientations + sens.tra = MxN matrix to combine coils into channels + sens.label = Mx1 cell-array with channel labels + + See also FT_READ_SENS, FT_SENSTYPE, FT_CHANTYPE, FT_APPLY_MONTAGE, CTF2GRAD, FIF2GRAD, + BTI2GRAD, YOKOGAWA2GRAD, ITAB2GRAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_datatype_sens.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_sens", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_datatype_source.py b/fieldtrip/__fileio/_ft_datatype_source.py new file mode 100644 index 0000000..19ad8a2 --- /dev/null +++ b/fieldtrip/__fileio/_ft_datatype_source.py @@ -0,0 +1,87 @@ +from fieldtrip._runtime import Runtime + + +def _ft_datatype_source(*args, **kwargs): + """ + FT_DATATYPE_SOURCE describes the FieldTrip MATLAB structure for data that is + represented at the source level. This is typically obtained with a beamformer of + minimum-norm source reconstruction using FT_SOURCEANALYSIS. + + An example of a source structure obtained after performing DICS (a frequency domain + beamformer scan) is shown here + + pos: [6732x3 double] positions at which the source activity could have been estimated + inside: [6732x1 logical] boolean vector that indicates at which positions the source activity was estimated + dim: [xdim ydim zdim] if the positions can be described as a 3D regular grid, this contains the + dimensionality of the 3D volume + cumtapcnt: [120x1 double] information about the number of tapers per original trial + time: 0.100 the latency at which the activity is estimated (in seconds) + freq: 30 the frequency at which the activity is estimated (in Hz) + pow: [6732x120 double] the estimated power at each source position + powdimord: 'pos_rpt' defines how the numeric data has to be interpreted, + in this case 6732 dipole positions x 120 repetitions (i.e. trials) + cfg: [1x1 struct] the configuration used by the function that generated this data structure + + Required fields: + - pos + + Optional fields: + - inside, pow, coh, eta, mom, ori, leadfield, filter, or any other field with dimensions that are consistent with pos or dim + - dim, transform, unit, coordsys, time, freq, cumtapcnt, dimord + + Deprecated fields: + - method, outside + + Obsoleted fields: + - xgrid, ygrid, zgrid, transform, latency, frequency + + Revision history: + + (2014) The subfields in the avg and trial fields are now present in the + main structure, e.g. source.avg.pow is now source.pow. Furthermore, the + inside is always represented as logical vector. + + (2011) The source representation should always be irregular, i.e. not + a 3-D volume, contain a "pos" field and not contain a "transform". + + (2010) The source structure should contain a general "dimord" or specific + dimords for each of the fields. The source reconstruction in the avg and + trial substructures has been moved to the toplevel. + + (2007) The xgrid/ygrid/zgrid fields have been removed, because they are + redundant. + + (2003) The initial version was defined + + See also FT_DATATYPE, FT_DATATYPE_COMP, FT_DATATYPE_DIP, FT_DATATYPE_FREQ, + FT_DATATYPE_MVAR, FT_DATATYPE_RAW, FT_DATATYPE_SOURCE, FT_DATATYPE_SPIKE, + FT_DATATYPE_TIMELOCK, FT_DATATYPE_VOLUME + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_datatype_source.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_source", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_datatype_spike.py b/fieldtrip/__fileio/_ft_datatype_spike.py new file mode 100644 index 0000000..9511fd3 --- /dev/null +++ b/fieldtrip/__fileio/_ft_datatype_spike.py @@ -0,0 +1,157 @@ +from fieldtrip._runtime import Runtime + + +def _ft_datatype_spike(*args, **kwargs): + """ + FT_DATATYPE_SPIKE describes the FieldTrip MATLAB structure for spike data + + Spike data is obtained using FT_READ_SPIKE to read files from a Plexon, + Neuralynx or other animal electrophysiology data acquisition system. It + is characterised as a sparse point-process, i.e. each neuronal firing is + only represented as the time at which the firing happened. Optionally, + the spike waveform can also be represented. Using this waveform, the + neuronal firing events can be sorted into their single units. + + A required characteristic of the SPIKE structure is a cell-array with the + label of the (single or multi) units. + + label: {'unit1' 'unit2' 'unit3'} + + The fields of the SPIKE structure that contain the specific information + per spike depends on the available information. A relevant distinction + can be made between the representation of raw spikes that are not related + to the temporal structure of the experimental design (i.e trials), and + the data representation in which the spikes are related to the trial. + + For a continuous recording the SPIKE structure must contain a cell-array + with the raw timestamps as recorded by the hardware system. As example, + the original content of the .timestamp field can be + + timestamp: {[1x504 uint64] [1x50 uint64] [1x101 uint64]} + + An optional field that is typically obtained from the raw recording + contains the waveforms for every unit and label as a cell-array. For + example, the content of this field may be + + waveform: {[1x32x504 double] [1x32x50 double] [1x32x101 double]} + + If the data has been organised to reflect the temporal structure of the + experiment (i.e. the trials), the SPIKE structure should contain a + cell-array with the spike times relative to an experimental trigger. The + FT_SPIKE_MAKETRIALS function can be used to reorganise the SPIKE + structure such that the spike times are expressed relative to a trigger + instead of relative to the acquisition devices internal timestamp clock. + The time field then contains only those spikes that occurred within one of + the trials . The spike times are now expressed on seconds relative to the + trigger. + + time: {[1x504 double] [1x50 double] [1x101 double]} + + In addition, for every spike we register in which trial the spike was + recorded: + + trial: {[1x504 double] [1x50 double] [1x101 double]} + + To fully reconstruct the structure of the spike-train, it is required + that the exact start- and end-point of the trial (in seconds) is + represented. This is specified in a nTrials x 2 matrix. + + trialtime: [100x2 double] + + As an example, FT_SPIKE_MAKETRIALS could result in the following + SPIKE structure that represents the spikes of three units that were + observed in 100 trials: + + label: {'unit1' 'unit2' 'unit3'} + timestamp: {[1x504 double] [1x50 double] [1x101 double]} + timestampdimord: '{chan}_spike' + time: {[1x504 double] [1x50 double] [1x101 double]} + trial: {[1x504 double] [1x50 double] [1x101 double]} + trialtime: [100x2 double] + sampleinfo: [100x2 double] + waveform: {[1x32x504 double] [1x32x50 double] [1x32x101 double]} + waveformdimord: '{chan}_lead_time_spike' + + For analysing the relation between the spikes and the local field + potential (e.g. phase-locking), the SPIKE structure can have additional + fields such as fourierspctrm, lfplabel, freq and fourierspctrmdimord. + + For example, from the structure above we may obtain + + label: {'unit1' 'unit2' 'unit3'} + time: {[1x504 double] [1x50 double] [1x101 double]} + trial: {[1x504 double] [1x50 double] [1x101 double]} + trialtime: [100x2 double] + timestamp: {[1x504 double] [1x50 double] [1x101 double]} + timestampdimord: '{chan}_spike' + waveform: {[1x32x504 double] [1x32x50 double] [1x32x101 double]} + waveformdimord: '{chan}_lead_time_spike' + fourierspctrm: {504x2x20, 50x2x20, 101x2x20} + fourierspctrmdimord: '{chan}_spike_lfplabel_freq' + lfplabel: {'lfpchan1', 'lfpchan2'} + freq: [1x20 double] + + Required fields: + - label + - timestamp + + Optional fields: + - time, trial, trialtime + - timestampdimord + - unit, unitdimord + - waveform, waveformdimord + - fourierspctrm, fourierspctrmdimord, freq, lfplabel (these are extra outputs from FT_SPIKETRIGGEREDSPECTRUM and FT_SPIKE_TRIGGEREDSPECTRUM) + - hdr + - cfg + + Deprecated fields: + - origtime, origtrial + + Obsoleted fields: + - + + Revision history: + + (2020/latest) Add an explicit xxxdimord for each of the known fields. + + (2012) Changed the dimensionality of the waveform to allow both + stereotrode and tetrode data to be represented. + + (2011) Defined a consistent spike data representation that can + also contain the Fourier spectrum and other fields. Use the xxxdimord + to indicate the dimensions of the field. + + (2010) Introduced the time and the trialtime fields. + + (2007) Introduced the spike data representation. + + See also FT_DATATYPE, FT_DATATYPE_RAW, FT_DATATYPE_FREQ, FT_DATATYPE_TIMELOCK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_datatype_spike.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_spike", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_datatype_timelock.py b/fieldtrip/__fileio/_ft_datatype_timelock.py new file mode 100644 index 0000000..ee28686 --- /dev/null +++ b/fieldtrip/__fileio/_ft_datatype_timelock.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def _ft_datatype_timelock(*args, **kwargs): + """ + FT_DATATYPE_TIMELOCK describes the FieldTrip MATLAB structure for timelock data + + The timelock data structure represents averaged or non-averaged event-releted + potentials (ERPs, in case of EEG) or ERFs (in case of MEG). This data structure is + usually generated with the FT_TIMELOCKANALYSIS or FT_TIMELOCKGRANDAVERAGE function. + + An example of a timelock structure containing the ERF for 151 channels MEG data is + + dimord: 'chan_time' defines how the numeric data should be interpreted + avg: [151x600 double] the average values of the activity for 151 channels x 600 timepoints + var: [151x600 double] the variance of the activity for 151 channels x 600 timepoints + label: {151x1 cell} the channel labels (e.g. 'MRC13') + time: [1x600 double] the timepoints in seconds + grad: [1x1 struct] information about the sensor array (for EEG data it is called elec) + cfg: [1x1 struct] the configuration used by the function that generated this data structure + + Required fields: + - label, dimord, time + + Optional fields: + - avg, var, dof, cov, trial, trialinfo, sampleinfo, grad, elec, opto, cfg + + Deprecated fields: + - + + Obsoleted fields: + - fsample + + Revision history: + + (2017/latest) The data structure cannot contain an average and simultaneously single + trial information any more, i.e. avg/var/dof and trial/individual are mutually exclusive. + + (2011v2) The description of the sensors has changed, see FT_DATATYPE_SENS + for further information. + + (2011) The field 'fsample' was removed, as it was redundant. + + (2003) The initial version was defined. + + See also FT_DATATYPE, FT_DATATYPE_COMP, FT_DATATYPE_FREQ, FT_DATATYPE_RAW + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_datatype_timelock.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_timelock", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_debug.py b/fieldtrip/__fileio/_ft_debug.py new file mode 100644 index 0000000..08c3b98 --- /dev/null +++ b/fieldtrip/__fileio/_ft_debug.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_debug(*args, **kwargs): + """ + FT_DEBUG prints a debug message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_debug(...) + with arguments similar to fprintf, or + ft_debug(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_debug off + or for specific ones using + ft_debug off msgId + + To switch them back on, you would use + ft_debug on + or for specific ones using + ft_debug on msgId + + Messages are only printed once per timeout period using + ft_debug timeout 60 + ft_debug once + or for specific ones using + ft_debug once msgId + + You can see the most recent messages and identifier using + ft_debug last + + You can query the current on/off/once state for all messages using + ft_debug query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_debug.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_debug", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_determine_units.py b/fieldtrip/__fileio/_ft_determine_units.py new file mode 100644 index 0000000..99ef58b --- /dev/null +++ b/fieldtrip/__fileio/_ft_determine_units.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def _ft_determine_units(*args, **kwargs): + """ + FT_DETERMINE_UNITS tries to determine the units of a geometrical object by + looking at its size and by relating this to the approximate size of the + human head according to the following table: + from 0.050 to 0.500 -> meter + from 0.500 to 5.000 -> decimeter + from 5.000 to 50.000 -> centimeter + from 50.000 to 500.000 -> millimeter + + Use as + [output] = ft_determine_units(input) + + The following input data structures are supported + electrode or gradiometer array, see FT_DATATYPE_SENS + volume conduction model, see FT_DATATYPE_HEADMODEL + source model, see FT_DATATYPE_SOURCE and FT_PREPARE_SOURCEMODEL + anatomical mri, see FT_DATATYPE_VOLUME + segmented mri, see FT_DATATYPE_SEGMENTATION + anatomical or functional atlas, see FT_READ_ATLAS + + This function will add the field 'unit' to the output data structure with the + possible values 'm', 'cm ' or 'mm'. + + See also FT_CONVERT_UNITS, FT_DETERMINE_COODSYS, FT_CONVERT_COORDSYS, FT_PLOT_AXES, FT_PLOT_XXX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_determine_units.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_determine_units", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_error.py b/fieldtrip/__fileio/_ft_error.py new file mode 100644 index 0000000..7c04614 --- /dev/null +++ b/fieldtrip/__fileio/_ft_error.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _ft_error(*args, **kwargs): + """ + FT_ERROR prints an error message on screen, just like the standard ERROR function. + + Use as + ft_error(...) + with arguments similar to fprintf, or + ft_error(msgId, ...) + with arguments similar to error. + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_error.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_error", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_estimate_units.py b/fieldtrip/__fileio/_ft_estimate_units.py new file mode 100644 index 0000000..01800f9 --- /dev/null +++ b/fieldtrip/__fileio/_ft_estimate_units.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _ft_estimate_units(*args, **kwargs): + """ + FT_ESTIMATE_UNITS tries to determine the units of a geometrical object by + looking at its size and by relating this to the approximate size of the + human head according to the following table: + from 0.050 to 0.500 -> meter + from 0.500 to 5.000 -> decimeter + from 5.000 to 50.000 -> centimeter + from 50.000 to 500.000 -> millimeter + + Use as + unit = ft_estimate_units(size) + + This function will return one of the following strings + 'm' + 'cm' + 'mm' + + See also FT_CONVERT_UNITS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_estimate_units.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_estimate_units", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_fetch_data.py b/fieldtrip/__fileio/_ft_fetch_data.py new file mode 100644 index 0000000..5e60f88 --- /dev/null +++ b/fieldtrip/__fileio/_ft_fetch_data.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _ft_fetch_data(*args, **kwargs): + """ + FT_FETCH_DATA mimics the behavior of FT_READ_DATA, but for a FieldTrip + raw data structure instead of a file on disk. + + Use as + [dat] = ft_fetch_data(data, ...) + + See also FT_READ_DATA, FT_FETCH_HEADER, FT_FETCH_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_fetch_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_fetch_data", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_fetch_header.py b/fieldtrip/__fileio/_ft_fetch_header.py new file mode 100644 index 0000000..803d2d2 --- /dev/null +++ b/fieldtrip/__fileio/_ft_fetch_header.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _ft_fetch_header(*args, **kwargs): + """ + FT_FETCH_HEADER mimics the behavior of FT_READ_HEADER, but for a FieldTrip + raw data structure instead of a file on disk. + + Use as + hdr = ft_fetch_header(data) + + See also FT_READ_HEADER, FT_FETCH_DATA, FT_FETCH_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_fetch_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_fetch_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_findcfg.py b/fieldtrip/__fileio/_ft_findcfg.py new file mode 100644 index 0000000..b189e68 --- /dev/null +++ b/fieldtrip/__fileio/_ft_findcfg.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _ft_findcfg(*args, **kwargs): + """ + FT_FINDCFG searches for an element in the cfg structure + or in the nested previous cfgs + + Use as + val = ft_findcfg(cfg, var) + where the name of the variable should be specified as string. + + e.g. + trl = ft_findcfg(cfg, 'trl') + event = ft_findcfg(cfg, 'event') + + See also FT_GETOPT, FT_CFG2KEYVAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_findcfg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_findcfg", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_getopt.py b/fieldtrip/__fileio/_ft_getopt.py new file mode 100644 index 0000000..937ff23 --- /dev/null +++ b/fieldtrip/__fileio/_ft_getopt.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def _ft_getopt(*args, **kwargs): + """ + FT_GETOPT gets the value of a specified option from a configuration structure + or from a cell-array with key-value pairs. + + Use as + val = ft_getopt(s, key, default, emptymeaningful) + where the input values are + s = structure or cell-array + key = string + default = any valid MATLAB data type (optional, default = []) + emptymeaningful = boolean value (optional, default = false) + + If the key is present as field in the structure, or as key-value pair in the + cell-array, the corresponding value will be returned. + + If the key is not present, ft_getopt will return the default, or an empty array + when no default was specified. + + If the key is present but has an empty value, then the emptymeaningful flag + specifies whether the empty value or the default value should be returned. + If emptymeaningful==true, then the empty array will be returned. + If emptymeaningful==false, then the specified default will be returned. + + See also FT_SETOPT, FT_CHECKOPT, INPUTPARSER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_getopt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_getopt", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_hastoolbox.py b/fieldtrip/__fileio/_ft_hastoolbox.py new file mode 100644 index 0000000..541202e --- /dev/null +++ b/fieldtrip/__fileio/_ft_hastoolbox.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _ft_hastoolbox(*args, **kwargs): + """ + FT_HASTOOLBOX tests whether an external toolbox is installed. Optionally it will + try to determine the path to the toolbox and install it automatically. + + Use as + [status] = ft_hastoolbox(toolbox, autoadd, silent) + + autoadd = -1 means that it will check and give an error when not yet installed + autoadd = 0 means that it will check and give a warning when not yet installed + autoadd = 1 means that it will check and give an error if it cannot be added + autoadd = 2 means that it will check and give a warning if it cannot be added + autoadd = 3 means that it will check but remain silent if it cannot be added + + silent = 0 means that it will give some feedback about adding the toolbox + silent = 1 means that it will not give feedback + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_hastoolbox.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_hastoolbox", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_headcoordinates.py b/fieldtrip/__fileio/_ft_headcoordinates.py new file mode 100644 index 0000000..0b4308e --- /dev/null +++ b/fieldtrip/__fileio/_ft_headcoordinates.py @@ -0,0 +1,126 @@ +from fieldtrip._runtime import Runtime + + +def _ft_headcoordinates(*args, **kwargs): + """ + FT_HEADCOORDINATES returns the homogeneous coordinate transformation matrix + that converts the specified fiducials in any coordinate system (e.g. MRI) + into the rotated and translated headcoordinate system. + + Use as + [transform, coordsys] = ft_headcoordinates(fid1, fid2, fid3, coordsys) + or + [transform, coordsys] = ft_headcoordinates(fid1, fid2, fid3, fid4, coordsys) + + Depending on the desired coordinate system, the order of the fiducials is + interpreted as follows + + fid1 = nas + fid2 = lpa + fid3 = rpa + fid4 = extra point (optional) + + fid1 = ac + fid2 = pc + fid3 = midsagittal + fid4 = extra point (optional) + + fid1 = pt1 + fid2 = pt2 + fid3 = pt3 + fid4 = extra point (optional) + + fid1 = bregma + fid2 = lambda + fid3 = midsagittal + fid4 = extra point (optional) + + The fourth argument fid4 is optional and can be specified as an an extra point + which is assumed to have a positive Z-coordinate. It will be used to ensure correct + orientation of the Z-axis (ctf, 4d, bti, eeglab, yokogawa, neuromag, itab) or + X-axis (acpc, spm, mni, tal). The specification of this extra point may result in + the handedness of the transformation to be changed, but ensures consistency with + the handedness of the input coordinate system. + + The coordsys input argument is a string that determines how the location of the + origin and the direction of the axis is to be defined relative to the fiducials: + according to CTF conventions: coordsys = 'ctf' + according to 4D conventions: coordsys = '4d' or 'bti' + according to EEGLAB conventions: coordsys = 'eeglab' + according to NEUROMAG conventions: coordsys = 'itab' + according to ITAB conventions: coordsys = 'neuromag' + according to YOKOGAWA conventions: coordsys = 'yokogawa' + according to ASA conventions: coordsys = 'asa' + according to FTG conventions: coordsys = 'ftg' + according to ACPC conventions: coordsys = 'acpc' + according to SPM conventions: coordsys = 'spm' + according to MNI conventions: coordsys = 'mni' + according to Talairach conventions: coordsys = 'tal' + according to PAXINOS conventions: coordsys = 'paxinos' + If the coordsys input argument is not specified, it will default to 'ctf'. + + The CTF, 4D, YOKOGAWA and EEGLAB coordinate systems are defined as follows: + the origin is exactly between lpa and rpa + the X-axis goes towards nas + the Y-axis goes approximately towards lpa, orthogonal to X and in the plane spanned by the fiducials + the Z-axis goes approximately towards the vertex, orthogonal to X and Y + + The TALAIRACH, SPM and ACPC coordinate systems are defined as: + the origin corresponds with the anterior commissure + the Y-axis is along the line from the posterior commissure to the anterior commissure + the Z-axis is towards the vertex, in between the hemispheres + the X-axis is orthogonal to the midsagittal-plane, positive to the right + + The NEUROMAG and ITAB coordinate systems are defined as follows: + the X-axis is from the origin towards the RPA point (exactly through) + the Y-axis is from the origin towards the nasion (exactly through) + the Z-axis is from the origin upwards orthogonal to the XY-plane + the origin is the intersection of the line through LPA and RPA and a line orthogonal to L passing through the nasion + + The ASA coordinate system is defined as follows: + the origin is at the orthogonal intersection of the line from rpa-lpa and the line through nas + the X-axis goes towards nas + the Y-axis goes through rpa and lpa + the Z-axis goes approximately towards the vertex, orthogonal to X and Y + + The FTG coordinate system is defined as: + the origin corresponds with pt1 + the x-axis is along the line from pt1 to pt2 + the z-axis is orthogonal to the plane spanned by pt1, pt2 and pt3 + + The PAXINOS coordinate system is defined as: + the origin is at bregma + the x-axis extends along the Medial-Lateral direction, with positive towards the right + the y-axis points from dorsal to ventral, i.e. from inferior to superior + the z-axis passes through bregma and lambda and points from cranial to caudal, i.e. from anterior to posterior + + See also FT_ELECTRODEREALIGN, FT_VOLUMEREALIGN, FT_INTERACTIVEREALIGN, FT_AFFINECOORDINATES, COORDSYS2LABEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_headcoordinates.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headcoordinates", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_headmodeltype.py b/fieldtrip/__fileio/_ft_headmodeltype.py new file mode 100644 index 0000000..76bf608 --- /dev/null +++ b/fieldtrip/__fileio/_ft_headmodeltype.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def _ft_headmodeltype(*args, **kwargs): + """ + FT_HEADMODELTYPE determines the type of volume conduction model of the head + + Use as + [type] = ft_headmodeltype(headmodel) + to get a string describing the type, or + [flag] = ft_headmodeltype(headmodel, desired) + to get a boolean value. + + For EEG the following volume conduction models are recognized + singlesphere analytical single sphere model + concentricspheres analytical concentric sphere model with up to 4 spheres + halfspace infinite homogenous medium on one side, vacuum on the other + openmeeg boundary element method, based on the OpenMEEG software + bemcp boundary element method, based on the implementation from Christophe Phillips + dipoli boundary element method, based on the implementation from Thom Oostendorp + asa boundary element method, based on the (commercial) ASA software + simbio finite element method, based on the SimBio software + fns finite difference method, based on the FNS software + interpolate interpolate the potential based on pre-computed leadfields + + and for MEG the following volume conduction models are recognized + singlesphere analytical single sphere model + localspheres local spheres model for MEG, one sphere per channel + singleshell realisically shaped single shell approximation, based on the implementation from Guido Nolte + infinite magnetic dipole in an infinite vacuum + interpolate interpolate the potential based on pre-computed leadfields + + See also FT_COMPUTE_LEADFIELD, FT_READ_HEADMODEL, FT_HEADMODEL_BEMCP, + FT_HEADMODEL_ASA, FT_HEADMODEL_DIPOLI, FT_HEADMODEL_SIMBIO, + FT_HEADMODEL_FNS, FT_HEADMODEL_HALFSPACE, FT_HEADMODEL_INFINITE, + FT_HEADMODEL_OPENMEEG, FT_HEADMODEL_SINGLESPHERE, + FT_HEADMODEL_CONCENTRICSPHERES, FT_HEADMODEL_LOCALSPHERES, + FT_HEADMODEL_SINGLESHELL, FT_HEADMODEL_INTERPOLATE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_headmodeltype.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodeltype", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_info.py b/fieldtrip/__fileio/_ft_info.py new file mode 100644 index 0000000..c959222 --- /dev/null +++ b/fieldtrip/__fileio/_ft_info.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_info(*args, **kwargs): + """ + FT_INFO prints an info message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_info(...) + with arguments similar to fprintf, or + ft_info(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_info off + or for specific ones using + ft_info off msgId + + To switch them back on, you would use + ft_info on + or for specific ones using + ft_info on msgId + + Messages are only printed once per timeout period using + ft_info timeout 60 + ft_info once + or for specific ones using + ft_info once msgId + + You can see the most recent messages and identifier using + ft_info last + + You can query the current on/off/once state for all messages using + ft_info query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_info.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_info", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_notice.py b/fieldtrip/__fileio/_ft_notice.py new file mode 100644 index 0000000..c636242 --- /dev/null +++ b/fieldtrip/__fileio/_ft_notice.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_notice(*args, **kwargs): + """ + FT_NOTICE prints a notice message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_notice(...) + with arguments similar to fprintf, or + ft_notice(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_notice off + or for specific ones using + ft_notice off msgId + + To switch them back on, you would use + ft_notice on + or for specific ones using + ft_notice on msgId + + Messages are only printed once per timeout period using + ft_notice timeout 60 + ft_notice once + or for specific ones using + ft_notice once msgId + + You can see the most recent messages and identifier using + ft_notice last + + You can query the current on/off/once state for all messages using + ft_notice query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_notice.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_notice", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_notification.py b/fieldtrip/__fileio/_ft_notification.py new file mode 100644 index 0000000..5a0f70c --- /dev/null +++ b/fieldtrip/__fileio/_ft_notification.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _ft_notification(*args, **kwargs): + """ + FT_NOTIFICATION works mostly like the WARNING and ERROR commands in MATLAB and + is called by FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO and FT_DEBUG. Please note + that you should not call this function directly. + + Some examples: + ft_info on + ft_info on msgId + ft_info off + ft_info off msgId + ft_info once + ft_info once msgId + ft_info on backtrace + ft_info off backtrace + ft_info on verbose + ft_info off verbose + + ft_info query % shows the status of all notifications + ft_info last % shows the last notification + ft_info clear % clears the status of all notifications + ft_info timeout 10 % sets the timeout (for 'once') to 10 seconds + + See also DEFAULTID, FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_notification.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_notification", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_platform_supports.py b/fieldtrip/__fileio/_ft_platform_supports.py new file mode 100644 index 0000000..38d91ad --- /dev/null +++ b/fieldtrip/__fileio/_ft_platform_supports.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def _ft_platform_supports(*args, **kwargs): + """ + FT_PLATFORM_SUPPORTS returns a boolean indicating whether the current platform + supports a specific capability + + Use as + status = ft_platform_supports(what) + or + status = ft_platform_supports('matlabversion', min_version, max_version) + + The following values are allowed for the 'what' parameter, which means means that + the specific feature explained on the right is supported: + + 'which-all' which(...,'all') + 'exists-in-private-directory' exists(...) will look in the /private subdirectory to see if a file exists + 'onCleanup' onCleanup(...) + 'alim' alim(...) + 'int32_logical_operations' bitand(a,b) with a, b of type int32 + 'graphics_objects' graphics system is object-oriented + 'libmx_c_interface' libmx is supported through mex in the C-language (recent MATLAB versions only support C++) + 'images' all image processing functions in FieldTrip's external/images directory + 'signal' all signal processing functions in FieldTrip's external/signal directory + 'stats' all statistical functions in FieldTrip's external/stats directory + 'program_invocation_name' program_invocation_name() (GNU Octave) + 'singleCompThread' start MATLAB with -singleCompThread + 'nosplash' start MATLAB with -nosplash + 'nodisplay' start MATLAB with -nodisplay + 'nojvm' start MATLAB with -nojvm + 'no-gui' start GNU Octave with --no-gui + 'RandStream.setGlobalStream' RandStream.setGlobalStream(...) + 'RandStream.setDefaultStream' RandStream.setDefaultStream(...) + 'rng' rng(...) + 'rand-state' rand('state') + 'urlread-timeout' urlread(..., 'Timeout', t) + 'griddata-vector-input' griddata(...,...,...,a,b) with a and b vectors + 'griddata-v4' griddata(...,...,...,...,...,'v4') with v4 interpolation support + 'uimenu' uimenu(...) + 'weboptions' weboptions(...) + 'parula' parula(...) + 'datetime' datetime structure + 'html' html rendering in desktop + + See also FT_VERSION, VERSION, VER, VERLESSTHAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_platform_supports.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_platform_supports", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_progress.py b/fieldtrip/__fileio/_ft_progress.py new file mode 100644 index 0000000..d9dc7ca --- /dev/null +++ b/fieldtrip/__fileio/_ft_progress.py @@ -0,0 +1,63 @@ +from fieldtrip._runtime import Runtime + + +def _ft_progress(*args, **kwargs): + """ + FT_PROGRESS shows a graphical or non-graphical progress indication similar to the + standard WAITBAR function, but with the extra option of printing it in the command + window as a plain text string or as a rotating dial. Alternatively, you can also + specify it not to give feedback on the progress. + + Prior to the for-loop, you should call either + ft_progress('init', 'none', 'Please wait...') + ft_progress('init', 'text', 'Please wait...') + ft_progress('init', 'textbar', 'Please wait...') % ascii progress bar + ft_progress('init', 'dial', 'Please wait...') % rotating dial + ft_progress('init', 'etf', 'Please wait...') % estimated time to finish + ft_progress('init', 'gui', 'Please wait...') + + In each iteration of the for-loop, you should call either + ft_progress(x) % only show percentage + ft_progress(x, 'Processing event %d from %d', i, N) % show string, x=i/N + + After finishing the for-loop, you should call + ft_progress('close') + + Here is an example for the use of a progress indicator + ft_progress('init', 'etf', 'Please wait...'); + for i=1:100 + ft_progress(i/100, 'Processing event %d from %d', i, 100); + pause(0.03); + end + ft_progress('close') + + See also WAITBAR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_progress.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_progress", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_ft_scalingfactor.py b/fieldtrip/__fileio/_ft_scalingfactor.py new file mode 100644 index 0000000..95a327a --- /dev/null +++ b/fieldtrip/__fileio/_ft_scalingfactor.py @@ -0,0 +1,91 @@ +from fieldtrip._runtime import Runtime + + +def _ft_scalingfactor(*args, **kwargs): + """ + FT_SCALINGFACTOR determines the scaling factor from old to new units, i.e. it + returns a number with which the data in the old units needs to be multiplied + to get it expressed in the new units. + + Use as + factor = ft_scalingfactor(old, new) + where old and new are strings that specify the units. + + For example + ft_scalingfactor('m', 'cm') % returns 100 + ft_scalingfactor('V', 'uV') % returns 1000 + ft_scalingfactor('T/cm', 'fT/m') % returns 10^15 divided by 10^-2, which is 10^17 + ft_scalingfactor('cm^2', 'mm^2') % returns 100 + ft_scalingfactor('1/ms', 'Hz') % returns 1000 + + The following fundamental units are supported + metre m length l (a lowercase L), x, r L + kilogram kg mass m M + second s time t T + ampere A electric current I (an uppercase i) I + kelvin K thermodynamic temperature T # + mole mol amount of substance n N + candela cd luminous intensity Iv (an uppercase i with lowercase non-italicized v subscript) J + + The following derived units are supported + hertz Hz frequency 1/s T-1 + radian rad angle m/m dimensionless + steradian sr solid angle m2/m2 dimensionless + newton N force, weight kg#m/s2 M#L#T-2 + pascal Pa pressure, stress N/m2 M#L-1#T-2 + joule J energy, work, heat N#m = C#V = W#s M#L2#T-2 + coulomb C electric charge or quantity of electricity s#A T#I + volt V voltage, electrical potential difference, electromotive force W/A = J/C M#L2#T-3#I-1 + farad F electric capacitance C/V M-1#L-2#T4#I2 + siemens S electrical conductance 1/# = A/V M-1#L-2#T3#I2 + weber Wb magnetic flux J/A M#L2#T-2#I-1 + tesla T magnetic field strength V#s/m2 = Wb/m2 = N/(A#m) M#T-2#I-1 + henry H inductance V#s/A = Wb/A M#L2#T-2#I-2 + lumen lm luminous flux cd#sr J + lux lx illuminance lm/m2 L-2#J + becquerel Bq radioactivity (decays per unit time) 1/s T-1 + gray Gy absorbed dose (of ionizing radiation) J/kg L2#T-2 + sievert Sv equivalent dose (of ionizing radiation) J/kg L2#T-2 + katal kat catalytic activity mol/s T-1#N + + The following alternative units are supported + inch inch length + feet feet length + gauss gauss magnetic field strength + + The following derived units are not supported due to potential confusion + between their ascii character representation + ohm # electric resistance, impedance, reactance V/A M#L2#T-3#I-2 + watt W power, radiant flux J/s = V#A M#L2#T-3 + degree Celsius ?C temperature relative to 273.15 K K ? + + See also http://en.wikipedia.org/wiki/International_System_of_Units + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_scalingfactor.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_scalingfactor", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_senslabel.py b/fieldtrip/__fileio/_ft_senslabel.py new file mode 100644 index 0000000..9c7b22b --- /dev/null +++ b/fieldtrip/__fileio/_ft_senslabel.py @@ -0,0 +1,89 @@ +from fieldtrip._runtime import Runtime + + +def _ft_senslabel(*args, **kwargs): + """ + FT_SENSLABEL returns a list of predefined sensor labels given the + EEG or MEG system type which can be used to detect the type of data. + + Use as + label = ft_senslabel(type) + + The input sensor array type can be any of the following + 'ant128' + 'biosemi64' + 'biosemi128' + 'biosemi256' + 'bti148' + 'bti148_planar' + 'bti248' + 'bti248_planar' + 'btiref' + 'ctf64' + 'ctf64_planar' + 'ctf151' + 'ctf151_planar' + 'ctf275' + 'ctf275_planar' + 'ctfheadloc' + 'ctfref' + 'eeg1005' + 'eeg1010' + 'eeg1020' + 'ext1020' + 'egi32' + 'egi64' + 'egi128' + 'egi256' + 'neuromag122' + 'neuromag122_planar' + 'neuromag306' + 'neuromag306_planar' + 'itab28' + 'itab153' + 'itab153_planar' + 'yokogawa9' + 'yokogawa64' + 'yokogawa64_planar' + 'yokogawa160' + 'yokogawa160_planar' + 'yokogawa208' + 'yokogawa208_planar' + 'yokogawa440' + 'yokogawa440_planar' + + It is also possible to specify + 'eeg' + 'electrode' + although for these an empty set of labels (i.e. {}) will be returned. + + See also FT_SENSTYPE, FT_CHANNELSELECTION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_senslabel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_senslabel", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_senstype.py b/fieldtrip/__fileio/_ft_senstype.py new file mode 100644 index 0000000..751106c --- /dev/null +++ b/fieldtrip/__fileio/_ft_senstype.py @@ -0,0 +1,132 @@ +from fieldtrip._runtime import Runtime + + +def _ft_senstype(*args, **kwargs): + """ + FT_SENSTYPE determines the type of acquisition device by looking at the channel + names and comparing them with predefined lists. + + Use as + [type] = ft_senstype(sens) + or + [flag] = ft_senstype(sens, desired) + + The output type can be any of the following + 'ctf64' + 'ctf151' + 'ctf151_planar' + 'ctf275' + 'ctf275_planar' + 'bti148' + 'bti148_planar' + 'bti248' + 'bti248_planar' + 'bti248grad' + 'bti248grad_planar' + 'itab28' + 'itab153' + 'itab153_planar' + 'yokogawa9' + 'yokogawa64' + 'yokogawa64_planar' + 'yokogawa160' + 'yokogawa160_planar' + 'yokogawa208' + 'yokogawa208_planar' + 'yokogawa440' + 'neuromag122' + 'neuromag122_combined' + 'neuromag306' + 'neuromag306_combined' + 'babysquid74' this is a BabySQUID system from Tristan Technologies + 'artemis123' this is a BabySQUID system from Tristan Technologies + 'magview' this is a BabySQUID system from Tristan Technologies + 'fieldline_v2' + 'fieldline_v3' + 'egi32' + 'egi64' + 'egi128' + 'egi256' + 'biosemi64' + 'biosemi128' + 'biosemi256' + 'ant128' + 'neuralynx' + 'plexon' + 'artinis' + 'nirx' + 'shimadzu' + 'hitachi' + 'nirs' + 'meg' + 'eeg' + 'ieeg' + 'seeg' + 'ecog' + 'eeg1020' + 'eeg1010' + 'eeg1005' + 'ext1020' in case it is a small subset of eeg1020, eeg1010 or eeg1005 + 'nex5' + + The optional input argument for the desired type can be any of the above, or any of + the following generic classes of acquisition systems + 'eeg' + 'ieeg' + 'ext1020' + 'ant' + 'biosemi' + 'egi' + 'meg' + 'meg_planar' + 'meg_axial' + 'ctf' + 'bti' + 'neuromag' + 'yokogawa' + 'itab' + 'babysquid' + 'fieldline' + If you specify the desired type, this function will return a boolean flag + indicating true/false depending on the input data. + + Besides specifying a sensor definition (i.e. a grad or elec structure, see + FT_DATATYPE_SENS), it is also possible to give a data structure containing a grad + or elec field, or giving a list of channel names (as cell-arrray). So assuming that + you have a FieldTrip data structure, any of the following calls would also be fine. + ft_senstype(hdr) + ft_senstype(data) + ft_senstype(data.label) + ft_senstype(data.grad) + ft_senstype(data.grad.label) + + See also FT_SENSLABEL, FT_CHANTYPE, FT_READ_SENS, FT_COMPUTE_LEADFIELD, FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_senstype.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_senstype", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_version.py b/fieldtrip/__fileio/_ft_version.py new file mode 100644 index 0000000..d893fa1 --- /dev/null +++ b/fieldtrip/__fileio/_ft_version.py @@ -0,0 +1,69 @@ +from fieldtrip._runtime import Runtime + + +def _ft_version(*args, **kwargs): + """ + FT_VERSION returns the version of FieldTrip and the path where it is installed + + FieldTrip is not released with version numbers as "2.0", "2.1", etc. Instead, we + share our development version on http://github.com/fieldtrip/fieldtrip. You can use + git to make a local clone of the development version. Furthermore, we make + more-or-less daily releases of the code available on + https://github.com/fieldtrip/fieldtrip/releases and as zip file on our FTP server. + + If you use git with the development version, the version is labeled with the hash + of the latest commit like "128c693". You can access the specific version "XXXXXX" + at https://github.com/fieldtrip/fieldtrip/commit/XXXXXX. + + If you download the daily released version from our FTP server, the version is part + of the file name "fieldtrip-YYYYMMDD.zip", where YYY, MM and DD correspond to year, + month and day. + + Use as + ft_version + to display the latest revision number on screen, or + [ftver, ftpath] = ft_version + to get the version and the installation root directory. + + When using git with the development version, you can also get additional information with + ft_version revision + ft_version branch + ft_version clean + + On macOS you might have installed git along with Xcode instead of with homebrew, + which then requires that you agree to the Apple license. In that case it can + happen that this function stops, as in the background (invisible to you) it is + asking whether you agree. You can check this by typing "/usr/bin/git", which will + show the normal help message, or which will mention the license agreement. To + resolve this please open a terminal and type "sudo xcodebuild -license" + + See also FT_PLATFORM_SUPPORTS, VERSION, VER, VERLESSTHAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_version.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_version", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_warning.py b/fieldtrip/__fileio/_ft_warning.py new file mode 100644 index 0000000..398b201 --- /dev/null +++ b/fieldtrip/__fileio/_ft_warning.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def _ft_warning(*args, **kwargs): + """ + FT_WARNING prints a warning message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. This function works + similar to the standard WARNING function, but also features the "once" mode. + + Use as + ft_warning(...) + with arguments similar to fprintf, or + ft_warning(msgId, ...) + with arguments similar to warning. + + You can switch of all warning messages using + ft_warning off + or for specific ones using + ft_warning off msgId + + To switch them back on, you would use + ft_warning on + or for specific ones using + ft_warning on msgId + + Warning messages are only printed once per timeout period using + ft_warning timeout 60 + ft_warning once + or for specific ones using + ft_warning once msgId + + You can see the most recent messages and identifier using + ft_warning last + + You can query the current on/off/once state for all messages using + ft_warning query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_warning.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_warning", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ft_warp_apply.py b/fieldtrip/__fileio/_ft_warp_apply.py new file mode 100644 index 0000000..b5b8ba5 --- /dev/null +++ b/fieldtrip/__fileio/_ft_warp_apply.py @@ -0,0 +1,83 @@ +from fieldtrip._runtime import Runtime + + +def _ft_warp_apply(*args, **kwargs): + """ + FT_WARP_APPLY performs a 3D linear or nonlinear transformation on the input + coordinates, similar to those in AIR. You can find technical documentation + on warping in general at http://air.bmap.ucla.edu/AIR5 + + Use as + [output] = ft_warp_apply(M, input, method, tol) + where + M vector or matrix with warping parameters + input Nx3 matrix with input coordinates + output Nx3 matrix with the transformed or warped output coordinates + method string describing the transformation or warping method + tol (optional) value determining the numerical precision of the + output, to deal with numerical round-off imprecisions due to + the warping + + The methods 'nonlin0', 'nonlin2' ... 'nonlin5' specify a polynomial transformation. + The size of the transformation matrix depends on the order of the warp + zeroth order : 1 parameter per coordinate (translation) + first order : 4 parameters per coordinate (total 12, affine) + second order : 10 parameters per coordinate + third order : 20 parameters per coordinate + fourth order : 35 parameters per coordinate + fifth order : 56 parameters per coordinate (total 168) + The size of M should be 3xP, where P is the number of parameters per coordinate. + Alternatively, you can specify the method to be 'nonlinear', in which case the + order will be determined from the size of the matrix M. + + If the method 'homogeneous' is selected, the input matrix M should be a 4x4 + homogenous transformation matrix. + + If the method 'sn2individual' or 'individual2sn' is selected, the input M should be + a structure with the nonlinear spatial normalisation (warping) parameters created + by SPM8 or SPM12 for alignment between an individual subject and a template brain. + When using the 'old' method, M will have subfields like this: + Affine: [4x4 double] + Tr: [4-D double] + VF: [1x1 struct] + VG: [1x1 struct] + flags: [1x1 struct] + When using the 'new' or the 'mars' method, M will have subfields like this: + + If any other method is selected, it is assumed that it specifies the name of an + auxiliary function that will, when given the input parameter vector M, return an + 4x4 homogenous transformation matrix. Supplied functions are 'translate', 'rotate', + 'scale', 'rigidbody', 'globalrescale', 'traditional', 'affine', 'perspective', + 'quaternion'. + + See also FT_AFFINECOORDINATES, FT_HEADCOORDINATES, FT_WARP_OPTIM, FT_WARP_ERROR, + MAKETFORM, AFFINE2D, AFFINE3D + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ft_warp_apply.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_warp_apply", *args, **kwargs) diff --git a/fieldtrip/__fileio/_getdatfield.py b/fieldtrip/__fileio/_getdatfield.py new file mode 100644 index 0000000..d6b5aa6 --- /dev/null +++ b/fieldtrip/__fileio/_getdatfield.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _getdatfield(*args, **kwargs): + """ + GETDATFIELD + + Use as + [datfield, dimord] = getdatfield(data) + where the output arguments are cell-arrays. + + See also GETDIMORD, GETDIMSIZ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/getdatfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getdatfield", *args, **kwargs) diff --git a/fieldtrip/__fileio/_getdimord.py b/fieldtrip/__fileio/_getdimord.py new file mode 100644 index 0000000..804e79f --- /dev/null +++ b/fieldtrip/__fileio/_getdimord.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _getdimord(*args, **kwargs): + """ + GETDIMORD determine the dimensions and order of a data field in a FieldTrip + structure. + + Use as + dimord = getdimord(data, field) + + See also GETDIMSIZ, GETDATFIELD, FIXDIMORD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/getdimord.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getdimord", *args, **kwargs) diff --git a/fieldtrip/__fileio/_getdimsiz.py b/fieldtrip/__fileio/_getdimsiz.py new file mode 100644 index 0000000..60c8513 --- /dev/null +++ b/fieldtrip/__fileio/_getdimsiz.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _getdimsiz(*args, **kwargs): + """ + GETDIMSIZ + + Use as + dimsiz = getdimsiz(data, field) + or + dimsiz = getdimsiz(data, field, numdim) + + MATLAB will not return the size of a field in the data structure that has trailing + singleton dimensions, since those are automatically squeezed out. With the optional + numdim parameter you can specify how many dimensions the data element has. This + will result in the trailing singleton dimensions being added to the output vector. + + Example use + dimord = getdimord(datastructure, fieldname); + dimtok = tokenize(dimord, '_'); + dimsiz = getdimsiz(datastructure, fieldname, numel(dimtok)); + + See also GETDIMORD, GETDATFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/getdimsiz.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getdimsiz", *args, **kwargs) diff --git a/fieldtrip/__fileio/_getorthoviewpos.py b/fieldtrip/__fileio/_getorthoviewpos.py new file mode 100644 index 0000000..9f960d4 --- /dev/null +++ b/fieldtrip/__fileio/_getorthoviewpos.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _getorthoviewpos(*args, **kwargs): + """ + GETORTHOVIEWPOS obtains the orthographic projections of 3D positions + based on a given coordinate system and viewpoint + + Use as + getorthoviewpos(pos, coordsys, viewpoint) + + For example + getorthoviewpoint(pos, 'mni', 'superior') + + See alo SETVIEWPOINT, COORDSYS2LABEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/getorthoviewpos.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getorthoviewpos", *args, **kwargs) diff --git a/fieldtrip/__fileio/_getsubfield.py b/fieldtrip/__fileio/_getsubfield.py new file mode 100644 index 0000000..bf4f17d --- /dev/null +++ b/fieldtrip/__fileio/_getsubfield.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _getsubfield(*args, **kwargs): + """ + GETSUBFIELD returns a field from a structure just like the standard + GETFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = getsubfield(s, 'fieldname') + or as + f = getsubfield(s, 'fieldname.subfieldname') + + See also GETFIELD, ISSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/getsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getsubfield", *args, **kwargs) diff --git a/fieldtrip/__fileio/_hasricoh.py b/fieldtrip/__fileio/_hasricoh.py new file mode 100644 index 0000000..c963504 --- /dev/null +++ b/fieldtrip/__fileio/_hasricoh.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _hasricoh(*args, **kwargs): + """ + HASRICOH tests whether the official toolbox for RICOH MEG systems by + Ricoh Company, Ltd. is installed or not. + Use as + string = hasricoh; + which returns a string describing the toolbox version '1.0'. + An empty string is returned if the toolbox is not installed. + The string "unknown" is returned if it is installed but + the version is unknown. + + Alternatively you can use it as + [boolean] = hasricoh(desired); + where desired is a string with the desired version. + + See also READ_RICOH_HEADER, READ_RICOH_DATA, READ_RICOH_EVENT, RICOH2GRAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/hasricoh.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("hasricoh", *args, **kwargs) diff --git a/fieldtrip/__fileio/_hasyokogawa.py b/fieldtrip/__fileio/_hasyokogawa.py new file mode 100644 index 0000000..7658ecf --- /dev/null +++ b/fieldtrip/__fileio/_hasyokogawa.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _hasyokogawa(*args, **kwargs): + """ + HASYOKOGAWA tests whether the data input toolbox for MEG systems by + Yokogawa (www.yokogawa.com, designed by KIT/EagleTechnology) is + installed. Only the newest version of the toolbox is accepted. + + Use as + string = hasyokogawa; + which returns a string describing the toolbox version, e.g. "12bitBeta3", + "16bitBeta3", or "16bitBeta6" for preliminary versions, or '1.5' for the + official Yokogawa MEG Reader Toolbox. An empty string is returned if the toolbox + is not installed. The string "unknown" is returned if it is installed but + the version is unknown. + + Alternatively you can use it as + [boolean] = hasyokogawa(desired); + where desired is a string with the desired version. + + See also READ_YOKOGAWA_HEADER, READ_YOKOGAWA_DATA, READ_YOKOGAWA_EVENT, + YOKOGAWA2GRAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/hasyokogawa.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("hasyokogawa", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ignorefields.py b/fieldtrip/__fileio/_ignorefields.py new file mode 100644 index 0000000..b31ef7c --- /dev/null +++ b/fieldtrip/__fileio/_ignorefields.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _ignorefields(*args, **kwargs): + """ + IGNOREFIELDS returns a list of fields that can be present in the cfg structure that + should be ignored at various places in the code, e.g. for provenance, history, + size-checking, etc. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ignorefields.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ignorefields", *args, **kwargs) diff --git a/fieldtrip/__fileio/_inflate_file.py b/fieldtrip/__fileio/_inflate_file.py new file mode 100644 index 0000000..1abfef1 --- /dev/null +++ b/fieldtrip/__fileio/_inflate_file.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _inflate_file(*args, **kwargs): + """ + INFLATE_FILE helper function to uncompress a compressed file of arbitrary + compression type. Returns the full path to the extracted file or + directory, which will be located in a temporary location. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/inflate_file.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("inflate_file", *args, **kwargs) diff --git a/fieldtrip/__fileio/_inifile.py b/fieldtrip/__fileio/_inifile.py new file mode 100644 index 0000000..d2d201b --- /dev/null +++ b/fieldtrip/__fileio/_inifile.py @@ -0,0 +1,89 @@ +from fieldtrip._runtime import Runtime + + +def _inifile(*args, **kwargs): + """ + readsett = INIFILE(fileName,operation,keys,style) + Creates, reads, or writes data from/to ini (ascii) file. + + - fileName: ini file name + - operation: can be one of the following: + 'new' (rewrites an existing or creates a new, empty file), + 'deletekeys'(deletes keys and their values - if they exist), + 'read' (reads values as strings), + 'write' (writes values given as strings), + - keys: cell-array of STRINGS; max 5 columns, min + 3 columns. Each row has the same number of columns. The columns are: + 'section': section name string (the root is considered if empty or not given) + 'subsection': subsection name string (the root is considered if empty or not given) + 'key': name of the field to write/read from (given as a string). + 'value': (optional) string-value to write to the ini file in case of 'write' operation + 'defaultValue': (optional) value that is returned when the key is not found when reading ('read' operation) + - style: 'tabbed' writes sections, subsections and keys in a tabbed style + to get a more readable file. The 'plain' style is the + default style. This only affects the keys that will be written/rewritten. + + - readsett: read setting in the case of the 'read' operation. If + the keys are not found, the default values are returned + as strings (if given in the 5-th column). + + EXAMPLE: + Suppose we want a new ini file, test1.ini with 3 fields. + We can write them into the file using: + + inifile('test1.ini','new'); + writeKeys = {'measurement','person','name','Primoz Cermelj';... + 'measurement','protocol','id','1';... + 'application','','description','some...'}; + inifile('test1.ini','write',writeKeys,'plain'); + + Later, you can read them out. Additionally, if any of them won't + exist, a default value will be returned (if the 5-th column is given as below). + + readKeys = {'measurement','person','name','','John Doe';... + 'measurement','protocol','id','','0';... + 'application','','description','','none'}; + readSett = inifile('test1.ini','read',readKeys); + + + NOTES: When the operation is 'new', only the first 2 parameters are + required. If the operation is 'write' and the file is empty or does not exist, + a new file is created. When writing and if any of the section or subsection or key does not exist, + it creates (adds) a new one. + Everything but value is NOT case sensitive. Given keys and values + will be trimmed (leading and trailing spaces will be removed). + Any duplicates (section, subsection, and keys) are ignored. Empty section and/or + subsection can be given as an empty string, '', but NOT as an empty matrix, []. + + This function was tested on the win32 platform only but it should + also work on Unix/Linux platforms. Since some short-circuit operators + are used, at least Matlab 6.5 should be used. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/inifile.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("inifile", *args, **kwargs) diff --git a/fieldtrip/__fileio/_isdir_or_mkdir.py b/fieldtrip/__fileio/_isdir_or_mkdir.py new file mode 100644 index 0000000..8a3d543 --- /dev/null +++ b/fieldtrip/__fileio/_isdir_or_mkdir.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _isdir_or_mkdir(*args, **kwargs): + """ + ISDIR_OR_MKDIR Checks that a directory exists, or if not, creates the directory and + all its parent directories. + + See also FOPEN_OR_ERROR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/isdir_or_mkdir.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("isdir_or_mkdir", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_isricohmegfile.py b/fieldtrip/__fileio/_isricohmegfile.py new file mode 100644 index 0000000..a63aa1a --- /dev/null +++ b/fieldtrip/__fileio/_isricohmegfile.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _isricohmegfile(*args, **kwargs): + """ + The extentions, .con, .ave, and .mrk are common between Ricoh and Yokogawa systems. + isricohmegfile idetifies whether the file is generated from Ricoh system or not. + This function uses a function in YOKOGAWA_MEG_READER toolbox, getYkgwHdrSystem. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/isricohmegfile.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("isricohmegfile", *args, **kwargs) diff --git a/fieldtrip/__fileio/_issubfield.py b/fieldtrip/__fileio/_issubfield.py new file mode 100644 index 0000000..bb9943c --- /dev/null +++ b/fieldtrip/__fileio/_issubfield.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _issubfield(*args, **kwargs): + """ + ISSUBFIELD tests for the presence of a field in a structure just like the standard + Matlab ISFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = issubfield(s, 'fieldname') + or as + f = issubfield(s, 'fieldname.subfieldname') + + This function returns true if the field is present and false if the field + is not present. + + See also ISFIELD, GETSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/issubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("issubfield", *args, **kwargs) diff --git a/fieldtrip/__fileio/_istrue.py b/fieldtrip/__fileio/_istrue.py new file mode 100644 index 0000000..fe3ebff --- /dev/null +++ b/fieldtrip/__fileio/_istrue.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _istrue(*args, **kwargs): + """ + ISTRUE converts an input argument like "yes/no", "true/false" or "on/off" into a + boolean. If the input is boolean, then it will remain like that. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/istrue.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("istrue", *args, **kwargs) diff --git a/fieldtrip/__fileio/_itab2grad.py b/fieldtrip/__fileio/_itab2grad.py new file mode 100644 index 0000000..a07b4c1 --- /dev/null +++ b/fieldtrip/__fileio/_itab2grad.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _itab2grad(*args, **kwargs): + """ + ITAB2GRAD converts the original Chieti ITAB header structure into + a gradiometer definition that is compatible with FieldTrip forward + and inverse computations + + See also CTF2GRAD, BTI2GRAD, FIF2GRAD, MNE2GRAD, YOKOGAWA2GRAD, + FT_READ_SENS, FT_READ_HEADER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/itab2grad.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("itab2grad", *args, **kwargs) diff --git a/fieldtrip/__fileio/_jaga16_packet.py b/fieldtrip/__fileio/_jaga16_packet.py new file mode 100644 index 0000000..91f3690 --- /dev/null +++ b/fieldtrip/__fileio/_jaga16_packet.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _jaga16_packet(*args, **kwargs): + """ + JAGA16_PACKET converts the JAGA16 byte stream into packets + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/jaga16_packet.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("jaga16_packet", *args, **kwargs) diff --git a/fieldtrip/__fileio/_keyval.py b/fieldtrip/__fileio/_keyval.py new file mode 100644 index 0000000..3125143 --- /dev/null +++ b/fieldtrip/__fileio/_keyval.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _keyval(*args, **kwargs): + """ + KEYVAL returns the value that corresponds to the requested key in a + key-value pair list of variable input arguments + + Use as + [val] = keyval(key, varargin) + + See also VARARGIN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/keyval.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("keyval", *args, **kwargs) diff --git a/fieldtrip/__fileio/_labelcmb2indx.py b/fieldtrip/__fileio/_labelcmb2indx.py new file mode 100644 index 0000000..29b2a42 --- /dev/null +++ b/fieldtrip/__fileio/_labelcmb2indx.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def _labelcmb2indx(*args, **kwargs): + """ + LABELCMB2INDX computes an array with indices, corresponding to the order + in a list of labels, for an Nx2 list of label combinations + + Use as + [indx] = labelcmb2indx(labelcmb, label) + or + [indx] = labelcmb2indx(labelcmb) + + Labelcmb is an Nx2 cell-array with label combinations, label is an Mx1 + cell-array with labels. If only one input is provided, the indices are + with respect to the rows in the labelcmb matrix, where the corresponding + auto combinations are located. As a consequence, the labelcmb matrix + needs to contain rows containing auto-combinations + + Example: + labelcmb = {'a' 'b';'a' 'c';'b' 'c';'a' 'a';'b' 'b';'c' 'c'}; + label = {'a';'b';'c'}; + + indx = labelcmb2indx(labelcmb, label) + returns: [1 2;1 3;2 3;1 1;2 2;3 3] + + indx = labelcmb2indx(labelcmb) + returns: [4 5;4 6;5 6;4 4;5 5;6;6] + + This is a helper function to FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/labelcmb2indx.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("labelcmb2indx", *args, **kwargs) diff --git a/fieldtrip/__fileio/_liberty_csv.py b/fieldtrip/__fileio/_liberty_csv.py new file mode 100644 index 0000000..c0ab374 --- /dev/null +++ b/fieldtrip/__fileio/_liberty_csv.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _liberty_csv(*args, **kwargs): + """ + LIBERTY_CSV reads motion capture data from the Polhemus Liberty system + + Use as + hdr = liberty_csv(filename); + dat = liberty_csv(filename, hdr, begsample, endsample, chanindx); + evt = liberty_csv(filename, hdr); + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/liberty_csv.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("liberty_csv", *args, **kwargs) diff --git a/fieldtrip/__fileio/_littleendian.py b/fieldtrip/__fileio/_littleendian.py new file mode 100644 index 0000000..fa3b925 --- /dev/null +++ b/fieldtrip/__fileio/_littleendian.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _littleendian(*args, **kwargs): + """ + LITTLEENDIAN returns 1 (true) on a little endian machine, e.g. with an + Intel or AMD, or 0 (false) otherwise + + Example + if (littleendian) + % do something, e.g. swap some bytes + end + + See also BIGENDIAN, SWAPBYTES, TYPECAST + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/littleendian.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("littleendian", *args, **kwargs) diff --git a/fieldtrip/__fileio/_load_curry_data_file.py b/fieldtrip/__fileio/_load_curry_data_file.py new file mode 100644 index 0000000..286eb7a --- /dev/null +++ b/fieldtrip/__fileio/_load_curry_data_file.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _load_curry_data_file(*args, **kwargs): + """ + load_curry_data_file is a function. + [orig, data] = load_curry_data_file(datafile) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/load_curry_data_file.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("load_curry_data_file", *args, **kwargs) diff --git a/fieldtrip/__fileio/_loadama.py b/fieldtrip/__fileio/_loadama.py new file mode 100644 index 0000000..ecaba02 --- /dev/null +++ b/fieldtrip/__fileio/_loadama.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _loadama(*args, **kwargs): + """ + LOADAMA read an inverted A-matrix and associated geometry information + from an ama file that was written by Tom Oostendorp's DIPOLI + + Use as + [ama] = loadama(filename) + + See also LOADTRI, LOADMAT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/loadama.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("loadama", *args, **kwargs) diff --git a/fieldtrip/__fileio/_loadvar.py b/fieldtrip/__fileio/_loadvar.py new file mode 100644 index 0000000..02fce8e --- /dev/null +++ b/fieldtrip/__fileio/_loadvar.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _loadvar(*args, **kwargs): + """ + LOADVAR is a helper function for cfg.inputfile + + See also SAVEVAR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/loadvar.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("loadvar", *args, **kwargs) diff --git a/fieldtrip/__fileio/_makessense.py b/fieldtrip/__fileio/_makessense.py new file mode 100644 index 0000000..85dc4f5 --- /dev/null +++ b/fieldtrip/__fileio/_makessense.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _makessense(*args, **kwargs): + """ + MAKESSENSE determines whether a some specific fields in a FieldTrip data structure + make sense. + + Use as + status = makessense(data, field) + + See also GETDIMORD, GETDIMSIZ, GETDATFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/makessense.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("makessense", *args, **kwargs) diff --git a/fieldtrip/__fileio/_mat2ades.py b/fieldtrip/__fileio/_mat2ades.py new file mode 100644 index 0000000..45d5ed9 --- /dev/null +++ b/fieldtrip/__fileio/_mat2ades.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _mat2ades(*args, **kwargs): + """ + write in the current folder ADES and DAT files from matrix in MATLAB workspace + data = matrix of data (nbchannel * time points) - the data have to be in microVolt + fileName = string of the output files without extension ; the ades and dat files will have the same name + FS = sampling rate + labels = cell-array with channel labels + labelType : 'EEG' or 'MEG' + + Data are stored in a binary file which name is exactly the same than the header file except the extension: .dat + The samples are stored as float, 4 bytes per sample, little endian. The channels are multiplexed. + + Sophie Chen - January 2014 + Modified by Robert Oostenveld - February 2019 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/mat2ades.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mat2ades", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_match_str.py b/fieldtrip/__fileio/_match_str.py new file mode 100644 index 0000000..b912916 --- /dev/null +++ b/fieldtrip/__fileio/_match_str.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _match_str(*args, **kwargs): + """ + MATCH_STR looks for matching labels in two lists of strings + and returns the indices into both the 1st and 2nd list of the matches. + They will be ordered according to the first input argument. + + Use as + [sel1, sel2] = match_str(strlist1, strlist2) + + The strings can be stored as a char matrix or as an vertical array of + cells, the matching is done for each row. + + When including a 1 as the third input argument, the output lists of + indices will be expanded to the size of the largest input argument. + Entries that occur only in one of the two inputs will correspond to a 0 + in the output, in this case. This can be convenient in rare cases if the + size of the input lists is meaningful. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/match_str.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("match_str", *args, **kwargs) diff --git a/fieldtrip/__fileio/_maus_textgrid.py b/fieldtrip/__fileio/_maus_textgrid.py new file mode 100644 index 0000000..b2bddc7 --- /dev/null +++ b/fieldtrip/__fileio/_maus_textgrid.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _maus_textgrid(*args, **kwargs): + """ + MAUS_TEXTGRID reads speech segments from a file that has been processed with MAUS + see https://clarin.phonetik.uni-muenchen.de/BASWebServices + + Use as + hdr = maus_textgrid(filename); + dat = maus_textgrid(filename, hdr, begsample, endsample, chanindx); + evt = maus_textgrid(filename, hdr); + + You should pass the *.TextGrid file as the filename, There should be a + corresponding wav file with the same filename in the same directory. + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/maus_textgrid.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("maus_textgrid", *args, **kwargs) diff --git a/fieldtrip/__fileio/_mne2grad.py b/fieldtrip/__fileio/_mne2grad.py new file mode 100644 index 0000000..f2fe330 --- /dev/null +++ b/fieldtrip/__fileio/_mne2grad.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _mne2grad(*args, **kwargs): + """ + MNE2GRAD converts a header from a fif file that was read using the MNE toolbox into + a gradiometer structure that can be understood by the FieldTrip low-level forward + and inverse routines. + + Use as + [grad, elec] = mne2grad(hdr, dewar, coilaccuracy) + where + dewar = boolean, whether to return it in dewar or head coordinates (default = false, i.e. head coordinates) + coilaccuracy = empty or a number (default = []) + coildeffile = empty or a filename of a valid coil_def.dat file + + See also CTF2GRAD, BTI2GRAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/mne2grad.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mne2grad", *args, **kwargs) diff --git a/fieldtrip/__fileio/_motion_c3d.py b/fieldtrip/__fileio/_motion_c3d.py new file mode 100644 index 0000000..2df906c --- /dev/null +++ b/fieldtrip/__fileio/_motion_c3d.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _motion_c3d(*args, **kwargs): + """ + MOTION_C3D reads motion tracking data from a C3D file, see https://www.c3d.org + + Use as + hdr = motion_c3d(filename); + dat = motion_c3d(filename, hdr, begsample, endsample, chanindx); + evt = motion_c3d(filename, hdr); + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/motion_c3d.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("motion_c3d", *args, **kwargs) diff --git a/fieldtrip/__fileio/_mxDeserialize.py b/fieldtrip/__fileio/_mxDeserialize.py new file mode 100644 index 0000000..de53ca1 --- /dev/null +++ b/fieldtrip/__fileio/_mxDeserialize.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _mxDeserialize(*args, **kwargs): + """ + MXDESERIALIZE reconstructs a MATLAB object from a uint8 array suitable + for passing down a comms channel to be reconstructed at the other end. + + See also MXSERIALIZE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/mxDeserialize.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mxDeserialize", *args, **kwargs) diff --git a/fieldtrip/__fileio/_mxSerialize.py b/fieldtrip/__fileio/_mxSerialize.py new file mode 100644 index 0000000..26e243f --- /dev/null +++ b/fieldtrip/__fileio/_mxSerialize.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _mxSerialize(*args, **kwargs): + """ + MXSERIALIZE converts any MATLAB object into a uint8 array suitable + for passing down a comms channel to be reconstructed at the other end. + + See also MXDESERIALIZE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/mxSerialize.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mxSerialize", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ndgrid.py b/fieldtrip/__fileio/_ndgrid.py new file mode 100644 index 0000000..294141a --- /dev/null +++ b/fieldtrip/__fileio/_ndgrid.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def _ndgrid(*args, **kwargs): + """ + NDGRID Generation of arrays for N-D functions and interpolation. + [X1,X2,X3,...] = NDGRID(x1,x2,x3,...) transforms the domain + specified by vectors x1,x2,x3, etc. into arrays X1,X2,X3, etc. that + can be used for the evaluation of functions of N variables and N-D + interpolation. The i-th dimension of the output array Xi are copies + of elements of the vector xi. + + [X1,X2,...] = NDGRID(x) is the same as [X1,X2,...] = NDGRID(x,x,...). + + For example, to evaluate the function x2*exp(-x1^2-x2^2-x^3) over the + range -2 < x1 < 2, -2 < x2 < 2, -2 < x3 < 2, + + [x1,x2,x3] = ndgrid(-2:.2:2, -2:.25:2, -2:.16:2); + z = x2 .* exp(-x1.^2 - x2.^2 - x3.^2); + slice(x2,x1,x3,z,[-1.2 .8 2],2,[-2 -.2]) + + NDGRID is like MESHGRID except that the order of the first two input + arguments are switched (i.e., [X1,X2,X3] = NDGRID(x1,x2,x3) produces + the same result as [X2,X1,X3] = MESHGRID(x2,x1,x3)). Because of + this, NDGRID is better suited to N-D problems that aren't spatially + based, while MESHGRID is better suited to problems in cartesian + space (2-D or 3-D). + + This is a drop-in replacement for the MATLAB version in elmat, which is + relatively slow for big grids. Note that this function only works up + to 5 dimensions + + See also MESHGRID, INTERPN. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ndgrid.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ndgrid", *args, **kwargs) diff --git a/fieldtrip/__fileio/_netmeg2grad.py b/fieldtrip/__fileio/_netmeg2grad.py new file mode 100644 index 0000000..caef021 --- /dev/null +++ b/fieldtrip/__fileio/_netmeg2grad.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _netmeg2grad(*args, **kwargs): + """ + NETMEG2GRAD converts a NetMEG header to a gradiometer structure + that can be understood by FieldTrip and Robert Oostenveld's low-level + forward and inverse routines. This function only works for headers + that have been read using FT_READ_DATA and NETCDF. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/netmeg2grad.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("netmeg2grad", *args, **kwargs) diff --git a/fieldtrip/__fileio/_neuralynx_crc.py b/fieldtrip/__fileio/_neuralynx_crc.py new file mode 100644 index 0000000..701e2f4 --- /dev/null +++ b/fieldtrip/__fileio/_neuralynx_crc.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _neuralynx_crc(*args, **kwargs): + """ + NEURALYNX_CRC computes a cyclic redundancy check + + Use as + crc = neuralynx_crc(dat) + + Note that the CRC is computed along the first dimension. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/neuralynx_crc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("neuralynx_crc", *args, **kwargs) diff --git a/fieldtrip/__fileio/_neuralynx_getheader.py b/fieldtrip/__fileio/_neuralynx_getheader.py new file mode 100644 index 0000000..56b263a --- /dev/null +++ b/fieldtrip/__fileio/_neuralynx_getheader.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _neuralynx_getheader(*args, **kwargs): + """ + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + SUBFUNCTION for reading the 16384 byte header from any Neuralynx file + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/neuralynx_getheader.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("neuralynx_getheader", *args, **kwargs) diff --git a/fieldtrip/__fileio/_neuralynx_timestamp.py b/fieldtrip/__fileio/_neuralynx_timestamp.py new file mode 100644 index 0000000..36ff367 --- /dev/null +++ b/fieldtrip/__fileio/_neuralynx_timestamp.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _neuralynx_timestamp(*args, **kwargs): + """ + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + SUBFUNCTION for reading a single timestamp of a single channel Neuralynx file + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/neuralynx_timestamp.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("neuralynx_timestamp", *args, **kwargs) diff --git a/fieldtrip/__fileio/_np_read_splitted_fileinfo.py b/fieldtrip/__fileio/_np_read_splitted_fileinfo.py new file mode 100644 index 0000000..04c846f --- /dev/null +++ b/fieldtrip/__fileio/_np_read_splitted_fileinfo.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _np_read_splitted_fileinfo(*args, **kwargs): + """ + + function [np_info] = np_read_splitted_fileinfo (filename, option) + + This function is necessary for np_readfileinfo.m. + + eldith GmbH + Gustav-Kirchhoff-Str. 5 + D-98693 Ilmenau + Germany + 02.02.2005 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/np_read_splitted_fileinfo.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("np_read_splitted_fileinfo", *args, **kwargs) diff --git a/fieldtrip/__fileio/_np_readdata.py b/fieldtrip/__fileio/_np_readdata.py new file mode 100644 index 0000000..489e196 --- /dev/null +++ b/fieldtrip/__fileio/_np_readdata.py @@ -0,0 +1,79 @@ +from fieldtrip._runtime import Runtime + + +def _np_readdata(*args, **kwargs): + """ + + function [np_data] = np_readdata (filename, idx_begin, data_length, option) + + np_readdata reads data from a NEURO PRAX data file (*.EEG). + + + Syntax: + + [np_data] = np_readdata(filename,idx_begin,data_length,'samples'); + [np_data] = np_readdata(filename,idx_begin,data_length,'time'); + + Input data: + + filename - the complete filename with path + (e. g. C:\Document...\20030716103637.EEG) + idx_begin - the start index of the data block to be read + data_length - the length of the data block to be read + option - if option = 'samples': + the data block starts at sample 'idx_begin' from the recording; + data_length is the number of samples to be read + if option = 'time': + the data block starts at time 'idx_begin' from the recording; + data_length is the number of seconds to be read + + To read all data use: idx_start = 0, data_length = inf, option = + 'samples'. + + Output data: + + np_data - structure + np_data.data - data matrix of unipolar raw data + dimension of the matrix: (NxK) + N: number of samples + K: number of channels (each column is one channel) + np_data.t - discrete time vector for the recording + + Version: 1.2. (2005-02-02) + + See also: np_readfileinfo, np_readmarker + + eldith GmbH + Gustav-Kirchhoff-Str. 5 + D-98693 Ilmenau + Germany + 02.02.2005 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/np_readdata.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("np_readdata", *args, **kwargs) diff --git a/fieldtrip/__fileio/_np_readfileinfo.py b/fieldtrip/__fileio/_np_readfileinfo.py new file mode 100644 index 0000000..397f310 --- /dev/null +++ b/fieldtrip/__fileio/_np_readfileinfo.py @@ -0,0 +1,115 @@ +from fieldtrip._runtime import Runtime + + +def _np_readfileinfo(*args, **kwargs): + """ + + function [np_info] = np_readfileinfo (filename, option) + + Purpose: + + np_readfileinfo reads out header information from a NEURO PRAX + data file (*.EEG). + + Syntax: + + [np_info] = np_readfileinfo(filename); + [np_info] = np_readfileinfo(filename,'NO_MINMAX'); + + Input data: + + filename - the complete filename with path + (e. g. C:\Document...\20030716103637.EEG) + option - if option = 'NO_MINMAX' then physical minima + (optional) and maxima off all channels will not be calculated + (faster for long recordings) + + Output data: + + np_info - structure + + np_info.filename - filename of *.EEG file + np_info.pathname - pathname of *.EEG file + np_info.name - patient's name + np_info.firstname - patient's firstname + np_info.birthday - patient's birthday + np_info.ID - identification number + np_info.date - start date of the recording (format: 'dd-mmm-yyyy') + np_info.time - start time of the recording (format: 'hh:mm:ss') + np_info.duration - duration of the recording (global for splitted EEG files!) + np_info.setup - electrode setup + np_info.pmtype - type of primary montage + np_info.algorithm - used algorithm for measurement + np_info.channels - cell-array with channel names + np_info.channeltypes - cell-array with channel types + np_info.units - cell-array with channel units + np_info.PhysMin - physical minimum for each channel (global for splitted EEG files!) + np_info.PhysMax - physical maximum for each channel (global for splitted EEG files!) + np_info.N - number of samples per channel (global for splitted EEG files!) + np_info.K - number of channels + np_info.fa - sampling frequency + np_info.fp_data - filepointer to data + --- additional SPLITTING information --- + np_info.SPLIT_Z - number of splitted EEG files (=Z; Z = 1 : no splitting) + np_info.SPLIT_filename - all filenames of splitted EEG file (Zx1 cell-array) + np_info.SPLIT_N - samples of splitted EEG file (Zx1 array) + np_info.SPLIT_fp_data - file pointers of splitted EEG file (Zx1 array) + np_info.SPLIT_PhysMin - physical minimum for each channel and each file (ZxK array) + np_info.SPLIT_PhysMax - physical maximum for each channel and each file (ZxK array) + + Version: 1.3. (2005-09-19) + + (1) The field 'units' will be read correctly from the channel header. + + (2) The sampling frequency (fa) is identical for all channels and is set + to the value of the first channel. + + (3) The channel types will be read from the channel header directly. + + (4) The field 'time' is set to the correct recording time. + + (5) Additional structure fields: + setup - the electrode setup (previously "primmon") + pmtype - the type of the primary montage + algorithm - the feedback algorithm + + (6) No longer available: the structure field "primmon". + + (7) Splitted EEG files will be supported. + + See also: np_readdata, np_readmarker + + eldith GmbH + Gustav-Kirchhoff-Str. 5 + D-98693 Ilmenau + Germany + 02.02.2005 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/np_readfileinfo.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("np_readfileinfo", *args, **kwargs) diff --git a/fieldtrip/__fileio/_np_readmarker.py b/fieldtrip/__fileio/_np_readmarker.py new file mode 100644 index 0000000..01ca6d2 --- /dev/null +++ b/fieldtrip/__fileio/_np_readmarker.py @@ -0,0 +1,83 @@ +from fieldtrip._runtime import Runtime + + +def _np_readmarker(*args, **kwargs): + """ + + function [np_marker] = np_readmarker (filename, idx_begin, data_length, option) + + np_readmarker reads marker from a NEURO PRAX marker file (*.EE_). + + Syntax: + + [np_marker] = np_readdata(filename,idx_begin,data_length,'samples'); + [np_marker] = np_readdata(filename,idx_begin,data_length,'time'); + + Input data: + + filename - the complete filename with path + (e. g. C:\Document...\20030716103637.EEG) + idx_begin - the start index of the data block to be read + data_length - the length of the data block to be read + option - if option = 'samples': + marker will be read from sample index 'idx_begin' + to sample index 'idx_begin' + 'data_length' - 1 + if option = 'time': + marker will be read from time index 'idx_begin' + to time index 'idx_begin' + 'data_length' + + To read all markers use: idx_start = 0, data_length = inf, option = + 'samples'. + + Output data: + + np_marker - structure + + np_marker.markernames - cell-array with markernames + np_marker.markertyp - vector array with markertypes + np_marker.marker - cell-array with marker vectors + ( = sample indices if option = 'samples', + = time indices if option = 'time'); + + Version: 1.2. (2005-01-19) + 1.1. (2004-10-22) + + 1. Artefact trials will not be considered. + 2. Trials within pause intervals will not be considered. + + See also: np_readfileinfo, np_readdata + + eldith GmbH + Gustav-Kirchhoff-Str. 5 + D-98693 Ilmenau + Germany + 22.10.2004 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/np_readmarker.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("np_readmarker", *args, **kwargs) diff --git a/fieldtrip/__fileio/_openbci_txt.py b/fieldtrip/__fileio/_openbci_txt.py new file mode 100644 index 0000000..a150dd9 --- /dev/null +++ b/fieldtrip/__fileio/_openbci_txt.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _openbci_txt(*args, **kwargs): + """ + OPENBCI_TXT reads time series data from a OpenBCI txt file + + Use as + hdr = openbci_txt(filename); + dat = openbci_txt(filename, hdr, begsample, endsample, chanindx); + evt = openbci_txt(filename, hdr); + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/openbci_txt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("openbci_txt", *args, **kwargs) diff --git a/fieldtrip/__fileio/_openpose_keypoints.py b/fieldtrip/__fileio/_openpose_keypoints.py new file mode 100644 index 0000000..51d032d --- /dev/null +++ b/fieldtrip/__fileio/_openpose_keypoints.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _openpose_keypoints(*args, **kwargs): + """ + OPENPOSE_KEYPOINTS reads keypoints from a series of OpenPose JSON files + + Use as + hdr = openpose_keypoints(filename); + dat = openpose_keypoints(filename, hdr, begsample, endsample, chanindx); + evt = openpose_keypoints(filename, hdr); + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/openpose_keypoints.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("openpose_keypoints", *args, **kwargs) diff --git a/fieldtrip/__fileio/_opensignals_txt.py b/fieldtrip/__fileio/_opensignals_txt.py new file mode 100644 index 0000000..d3e0534 --- /dev/null +++ b/fieldtrip/__fileio/_opensignals_txt.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _opensignals_txt(*args, **kwargs): + """ + OPENSIGNALS_TXT reads time series data from a Bitalino OpenSignals txt file + + Use as + hdr = opensignals_txt(filename); + dat = opensignals_txt(filename, hdr, begsample, endsample, chanindx); + evt = opensignals_txt(filename, hdr); + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/opensignals_txt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("opensignals_txt", *args, **kwargs) diff --git a/fieldtrip/__fileio/_openvibe_mat.py b/fieldtrip/__fileio/_openvibe_mat.py new file mode 100644 index 0000000..9e32c9a --- /dev/null +++ b/fieldtrip/__fileio/_openvibe_mat.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _openvibe_mat(*args, **kwargs): + """ + OPENVIBE_MAT reads EEG data from MATLAB file with OpenVibe data that was converted + according to http://openvibe.inria.fr/converting-ov-files-to-matlab/ + + Use as + hdr = openvibe_mat(filename); + dat = openvibe_mat(filename, hdr, begsample, endsample, chanindx); + evt = openvibe_mat(filename, hdr); + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/openvibe_mat.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("openvibe_mat", *args, **kwargs) diff --git a/fieldtrip/__fileio/_opm_fil.py b/fieldtrip/__fileio/_opm_fil.py new file mode 100644 index 0000000..2bc7e0a --- /dev/null +++ b/fieldtrip/__fileio/_opm_fil.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _opm_fil(*args, **kwargs): + """ + OPM_FIL reads header, data and events from OPM MEG recordings that are done at the FIL (UCL, London). + + Use as + hdr = opm_fil(filename); + dat = opm_fil(filename, hdr, begsample, endsample, chanindx); + evt = opm_fil(filename, hdr); + + See https://github.com/tierneytim/OPM for technical details. + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/opm_fil.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("opm_fil", *args, **kwargs) diff --git a/fieldtrip/__fileio/_parameterselection.py b/fieldtrip/__fileio/_parameterselection.py new file mode 100644 index 0000000..550bcd0 --- /dev/null +++ b/fieldtrip/__fileio/_parameterselection.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _parameterselection(*args, **kwargs): + """ + PARAMETERSELECTION selects the parameters that are present as a volume in the data + add that have a dimension that is compatible with the specified dimensions of the + volume, i.e. either as a vector or as a 3D volume. + + Use as + [select] = parameterselection(param, data) + where + param cell-array, or single string, can be 'all' + data structure with anatomical or functional data + select returns the selected parameters as a cell-array + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/parameterselection.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("parameterselection", *args, **kwargs) diff --git a/fieldtrip/__fileio/_physionet_hea.py b/fieldtrip/__fileio/_physionet_hea.py new file mode 100644 index 0000000..ba4ae41 --- /dev/null +++ b/fieldtrip/__fileio/_physionet_hea.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _physionet_hea(*args, **kwargs): + """ + PHYSIONET_HEA reads data from PhysioNet .hea and .dat files + + Use as + hdr = motion_c3d(filename); + dat = motion_c3d(filename, hdr, begsample, endsample, chanindx); + evt = motion_c3d(filename, hdr); + + This is for data hosted on https://physionet.org following the format + documentd on https://wfdb.io + + The format specification is not very clear and example files that I downloaded from + Physionet seem to be inconsistent with the specification. The code below works for + one example, but your mileage may vary. + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/physionet_hea.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("physionet_hea", *args, **kwargs) diff --git a/fieldtrip/__fileio/_plx_orig_header.py b/fieldtrip/__fileio/_plx_orig_header.py new file mode 100644 index 0000000..7bfdf46 --- /dev/null +++ b/fieldtrip/__fileio/_plx_orig_header.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _plx_orig_header(*args, **kwargs): + """ + PLX_ORIG_HEADER Extracts the header informations of plx files using the + Plexon Offline SDK, which is available from + http://www.plexon.com/assets/downloads/sdk/ReadingPLXandDDTfilesinMatlab-mexw.zip + + Use as + [orig] = plx_orig_header(filename) + + Copyright (C) 2012 by Thomas Hartmann + + This code can be redistributed under the terms of the GPL version 3 or + newer. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/plx_orig_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("plx_orig_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/_pos2dim.py b/fieldtrip/__fileio/_pos2dim.py new file mode 100644 index 0000000..4aeec4f --- /dev/null +++ b/fieldtrip/__fileio/_pos2dim.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _pos2dim(*args, **kwargs): + """ + POS2DIM reconstructs the volumetric dimensions from an ordered list of + positions. + + Use as + [dim] = pos2dim(pos) + where pos is an ordered list of positions. + + The output dim is a 3-element vector which correspond to the 3D + volumetric dimensions + + See also POS2TRANSFORM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/pos2dim.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("pos2dim", *args, **kwargs) diff --git a/fieldtrip/__fileio/_pos2dim3d.py b/fieldtrip/__fileio/_pos2dim3d.py new file mode 100644 index 0000000..cecd489 --- /dev/null +++ b/fieldtrip/__fileio/_pos2dim3d.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _pos2dim3d(*args, **kwargs): + """ + POS2DIM3D reconstructs the volumetric dimensions from an ordered list of + positions. optionally, the original dim can be provided, and the (2:end) + elements are appended to the output. + + Use as + [dim] = pos2dim3d(pos, dimold) + where pos is an ordered list of positions and where the (optional) + dimold is a vector with the original dimensionality of the anatomical + or functional data. + + The output dim is a 1x3 or 1xN vector of which the first three elements + correspond to the 3D volumetric dimensions. + + See also POS2DIM, POS2TRANSFORM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/pos2dim3d.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("pos2dim3d", *args, **kwargs) diff --git a/fieldtrip/__fileio/_pos2transform.py b/fieldtrip/__fileio/_pos2transform.py new file mode 100644 index 0000000..c14b609 --- /dev/null +++ b/fieldtrip/__fileio/_pos2transform.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _pos2transform(*args, **kwargs): + """ + POS2TRANSFORM reconstructs a transformation matrix from an ordered list + of positions. + + Use as + [transform] = pos2transform(pos, dim) + where pos is an ordered list of positions that should specify a full 3D volume. + + The output transform is a 4x4 homogenous transformation matrix which transforms + from 'voxelspace' into the positions provided in the input + + See also POS2DIM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/pos2transform.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("pos2transform", *args, **kwargs) diff --git a/fieldtrip/__fileio/_printor.py b/fieldtrip/__fileio/_printor.py new file mode 100644 index 0000000..fc8d1da --- /dev/null +++ b/fieldtrip/__fileio/_printor.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _printor(*args, **kwargs): + """ + PRINTOR prints a single or multiple strings as "x1, x2, x3 or x4". If there is + only one string, that string is returned without additional formatting. + + See also PRINTAND + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/printor.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("printor", *args, **kwargs) diff --git a/fieldtrip/__fileio/_qualisys_tsv.py b/fieldtrip/__fileio/_qualisys_tsv.py new file mode 100644 index 0000000..0b05d09 --- /dev/null +++ b/fieldtrip/__fileio/_qualisys_tsv.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _qualisys_tsv(*args, **kwargs): + """ + QUALISYS_TSV reads motion tracking data from a Qualisys tsv file. + + Use as + hdr = qualysis_tsv(filename); + dat = qualysis_tsv(filename, hdr, begsample, endsample, chanindx); + evt = qualysis_tsv(filename, hdr); + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/qualisys_tsv.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("qualisys_tsv", *args, **kwargs) diff --git a/fieldtrip/__fileio/_quaternion.py b/fieldtrip/__fileio/_quaternion.py new file mode 100644 index 0000000..bc95cf1 --- /dev/null +++ b/fieldtrip/__fileio/_quaternion.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _quaternion(*args, **kwargs): + """ + QUATERNION returns the homogenous coordinate transformation matrix corresponding to + a coordinate transformation described by 7 quaternion parameters. + + Use as + [H] = quaternion(Q) + where + Q [q0, q1, q2, q3, q4, q5, q6] vector with parameters + H corresponding homogenous transformation matrix + + If the input vector has length 6, it is assumed to represent a unit quaternion without scaling. + + See Neuromag/Elekta/Megin MaxFilter manual version 2.2, section "D2 Coordinate Matching", page 77 for more details and + https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#Conversion_to_and_from_the_matrix_representation + + See also TRANSLATE, ROTATE, SCALE, HOMOGENOUS2QUATERNION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/quaternion.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("quaternion", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_4d_hdr.py b/fieldtrip/__fileio/_read_4d_hdr.py new file mode 100644 index 0000000..630d2e0 --- /dev/null +++ b/fieldtrip/__fileio/_read_4d_hdr.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _read_4d_hdr(*args, **kwargs): + """ + hdr=READ_4D_HDR(datafile, configfile) + Collects the required Fieldtrip header data from the data file 'filename' + and the associated 'config' file for that data. + + Adapted from the MSI>>Matlab code written by Eugene Kronberg + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_4d_hdr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_4d_hdr", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ah5_data.py b/fieldtrip/__fileio/_read_ah5_data.py new file mode 100644 index 0000000..954ddfb --- /dev/null +++ b/fieldtrip/__fileio/_read_ah5_data.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _read_ah5_data(*args, **kwargs): + """ + read_ah5_data is a function. + [data] = read_ah5_data(filename, hdr, begsample, endsample, chanindx) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ah5_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ah5_data", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ah5_markers.py b/fieldtrip/__fileio/_read_ah5_markers.py new file mode 100644 index 0000000..e107408 --- /dev/null +++ b/fieldtrip/__fileio/_read_ah5_markers.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _read_ah5_markers(*args, **kwargs): + """ + read_ah5_markers is a function. + [event] = read_ah5_markers(hdr, filename) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ah5_markers.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ah5_markers", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ahdf5_hdr.py b/fieldtrip/__fileio/_read_ahdf5_hdr.py new file mode 100644 index 0000000..cbae7cd --- /dev/null +++ b/fieldtrip/__fileio/_read_ahdf5_hdr.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _read_ahdf5_hdr(*args, **kwargs): + """ + read header + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ahdf5_hdr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ahdf5_hdr", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_asa_bnd.py b/fieldtrip/__fileio/_read_asa_bnd.py new file mode 100644 index 0000000..997f302 --- /dev/null +++ b/fieldtrip/__fileio/_read_asa_bnd.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _read_asa_bnd(*args, **kwargs): + """ + READ_ASA_BND reads an ASA boundary triangulation file + converting the units of the vertices to mm + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_asa_bnd.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_asa_bnd", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_asa_dip.py b/fieldtrip/__fileio/_read_asa_dip.py new file mode 100644 index 0000000..4424b82 --- /dev/null +++ b/fieldtrip/__fileio/_read_asa_dip.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _read_asa_dip(*args, **kwargs): + """ + READ_ASA_DIP reads the dipole position, moment and amplitude + This importer is designed for fixed-dipole models and only supports + a limited number of the options that ASA has. + + Use as + [pos, mom, ampl, time] = read_asa_dip(filename) + + See also READ_ASA_VOL, READ_ASA_MRI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_asa_dip.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_asa_dip", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_asa_elc.py b/fieldtrip/__fileio/_read_asa_elc.py new file mode 100644 index 0000000..8d6356f --- /dev/null +++ b/fieldtrip/__fileio/_read_asa_elc.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _read_asa_elc(*args, **kwargs): + """ + READ_ASA_ELC reads electrodes from an ASA electrode file + converting the units to mm + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_asa_elc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_asa_elc", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_asa_mri.py b/fieldtrip/__fileio/_read_asa_mri.py new file mode 100644 index 0000000..a9d21b1 --- /dev/null +++ b/fieldtrip/__fileio/_read_asa_mri.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _read_asa_mri(*args, **kwargs): + """ + READ_ASA_MRI reads an ASA format MRI file + + Use as + [mri, seg, hdr] = read_asa_mri(filename) + + The raw image data is returned, together with the position of the + external head markers in raw image coordinates. + + In the ASA default PAN (pre-auricular/nasion) coordinate system + PointOnPositiveYAxis -> LPA + PointOnNegativeYAxis -> RPA + PointOnPositiveXAxis -> nasion + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_asa_mri.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_asa_mri", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_asa_msr.py b/fieldtrip/__fileio/_read_asa_msr.py new file mode 100644 index 0000000..17d130f --- /dev/null +++ b/fieldtrip/__fileio/_read_asa_msr.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _read_asa_msr(*args, **kwargs): + """ + READ_ASA_MSR reads EEG or MEG data from an ASA data file + converting the units to uV or fT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_asa_msr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_asa_msr", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_asa_vol.py b/fieldtrip/__fileio/_read_asa_vol.py new file mode 100644 index 0000000..76f55ee --- /dev/null +++ b/fieldtrip/__fileio/_read_asa_vol.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _read_asa_vol(*args, **kwargs): + """ + READ_ASA_VOL reads an ASA volume conductor file + + all data is converted to the following units + vertices mm + conductivities S/m + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_asa_vol.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_asa_vol", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_bdf.py b/fieldtrip/__fileio/_read_bdf.py new file mode 100644 index 0000000..8ebffea --- /dev/null +++ b/fieldtrip/__fileio/_read_bdf.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _read_bdf(*args, **kwargs): + """ + READ_BDF Read EEG data from a Biosemi BDF file + + [data, header] = read_bdf(filename) + [data, header] = read_bdf(filename, 'Param', value, ...) + + Inputs: + filename - BDF filename (including .bdf extension) + + Outputs: + data - EEG data matrix (Nchannels × Ntimepoints) + header - Structure containing header information + + Optional parameters: + 'Channels' - Cell array of channel names to read (default: all) + 'TimeRange' - [start end] in seconds (default: all) + 'Verbose' - Display progress info (default: true) + + Example: + [eeg, hdr] = read_bdf('eeg_data.bdf'); + [eeg, hdr] = read_bdf('eeg_data.bdf', 'Channels', {'Fz', 'Cz', 'Pz'}, 'TimeRange', [10 20]); + + See also WRITE_BDF + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_bdf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_bdf", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_besa_avr.py b/fieldtrip/__fileio/_read_besa_avr.py new file mode 100644 index 0000000..87684ca --- /dev/null +++ b/fieldtrip/__fileio/_read_besa_avr.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _read_besa_avr(*args, **kwargs): + """ + READ_BESA_AVR reads average EEG data in BESA format + + Use as + [avr] = read_besa_avr(filename) + + This will return a structure with the header information in + avr.npnt + avr.tsb + avr.di + avr.sb + avr.sc + avr.Nchan (optional) + avr.label (optional) + and the ERP data is contained in the Nchan X Nsamples matrix + avr.data + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_besa_avr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_besa_avr", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_besa_besa.py b/fieldtrip/__fileio/_read_besa_besa.py new file mode 100644 index 0000000..d3a93e3 --- /dev/null +++ b/fieldtrip/__fileio/_read_besa_besa.py @@ -0,0 +1,73 @@ +from fieldtrip._runtime import Runtime + + +def _read_besa_besa(*args, **kwargs): + """ + READ_BESA_BESA reads data and header information from a BESA file + See formatting document here + + Use as + [header] = read_besa_besa(filename); + where + filename name of the datafile, including the .besa extension + This returns a header structure with the following elements + header.Fs sampling frequency + header.nChans number of channels + header.nSamples number of samples per trial + header.nSamplesPre number of pre-trigger samples in each trial + header.nTrials number of trials + header.label cell-array with labels of each channel + header.orig detailed BESA header information + + Use as + [header] = read_besa_besa(filename, [], chanindx); + where + filename name of the datafile, including the .besa extension + chanindx index of channels to read (optional, default is all) + This returns a header structure with the following elements + header.Fs sampling frequency + header.nChans number of channels + header.nSamples number of samples per trial + header.nSamplesPre number of pre-trigger samples in each trial + header.nTrials number of trials + header.label cell-array with labels of each channel + header.orig detailed BESA header information + + Or use as + [dat] = read_besa_besa(filename, header, begsample, endsample, chanindx); + where + filename name of the datafile, including the .besa extension + header header structure, see above + begsample index of the first sample to read + endsample index of the last sample to read + chanindx index of channels to read (optional, default is all) + This returns a Nchans X Nsamples data matrix + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_besa_besa.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_besa_besa", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_besa_sfp.py b/fieldtrip/__fileio/_read_besa_sfp.py new file mode 100644 index 0000000..f9ad4fb --- /dev/null +++ b/fieldtrip/__fileio/_read_besa_sfp.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _read_besa_sfp(*args, **kwargs): + """ + READ_BESA_SFP reads a besa style electrode location file. + + Use as: + [lab, pos] = read_besa_sfp(filename, uniqueonly) + + Input arguments: + filename = the file name + uniqueonly = flag to determine behavior, to return the positions of the + unique labels only (default behavior: uniqueonly=1), or + also return double occurrences, which may be useful when + headshape information is represented in the file (as is + done in SPM) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_besa_sfp.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_besa_sfp", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_besa_swf.py b/fieldtrip/__fileio/_read_besa_swf.py new file mode 100644 index 0000000..1f54432 --- /dev/null +++ b/fieldtrip/__fileio/_read_besa_swf.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _read_besa_swf(*args, **kwargs): + """ + READ_BESA_SWF + + Use as + [swf] = read_besa_swf(filename) + + This will return a structure with the header information in + swf.label cell-array with labels + swf.data data matrix, Nchan X Npnts + swf.npnt + swf.tsb + swf.di + swf.sb + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_besa_swf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_besa_swf", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_bham.py b/fieldtrip/__fileio/_read_bham.py new file mode 100644 index 0000000..4a0264a --- /dev/null +++ b/fieldtrip/__fileio/_read_bham.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _read_bham(*args, **kwargs): + """ + READ_BHAM reads the EEG data files as recorded by Praamstra in Birmingham + the datafiles are in a particular ascii format + + [dat, lab] = read_bham(filename) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_bham.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_bham", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_biff.py b/fieldtrip/__fileio/_read_biff.py new file mode 100644 index 0000000..c8d40e9 --- /dev/null +++ b/fieldtrip/__fileio/_read_biff.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _read_biff(*args, **kwargs): + """ + READ_BIFF reads data and header information from a BIFF file + + This is a attemt for a reference implementation to read the BIFF + file format as defined by the Clinical Neurophysiology department of + the University Medical Centre, Nijmegen. + + read all data and information + [data] = read_biff(filename) + or read a selected top-level chunk + [chunk] = read_biff(filename, chunkID) + + known top-level chunk id's are + data : measured data (matrix) + dati : information on data (struct) + expi : information on experiment (struct) + pati : information on patient (struct) + evnt : event markers (struct) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_biff.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_biff", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_bioimage_mgrid.py b/fieldtrip/__fileio/_read_bioimage_mgrid.py new file mode 100644 index 0000000..968c777 --- /dev/null +++ b/fieldtrip/__fileio/_read_bioimage_mgrid.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _read_bioimage_mgrid(*args, **kwargs): + """ + READ_BIOIMAGE_MGRID reads BioImage Suite *.mgrid files and converts them + into a FieldTrip-compatible elec datatype structure with electrode + positions in xyz coordinates (equals voxel coordinates in mm) + + Use as + elec = read_bioimage_mgrid(filename) + where the filename has the .mgrid file extension + + See also FT_READ_SENS, FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_bioimage_mgrid.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_bioimage_mgrid", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_biosemi_bdf.py b/fieldtrip/__fileio/_read_biosemi_bdf.py new file mode 100644 index 0000000..7624d6e --- /dev/null +++ b/fieldtrip/__fileio/_read_biosemi_bdf.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def _read_biosemi_bdf(*args, **kwargs): + """ + READ_BIOSEMI_BDF reads specified samples from a BDF continuous datafile + It neglects all trial boundaries as if the data was acquired in + non-continuous mode. + + Use as + [hdr] = read_biosemi_bdf(filename); + where + filename name of the datafile, including the .bdf extension + This returns a header structure with the following elements + hdr.Fs sampling frequency + hdr.nChans number of channels + hdr.nSamples number of samples per trial + hdr.nSamplesPre number of pre-trigger samples in each trial + hdr.nTrials number of trials + hdr.label cell-array with labels of each channel + hdr.orig detailed EDF header information + + Or use as + [dat] = read_biosemi_bdf(filename, hdr, begsample, endsample, chanindx); + where + filename name of the datafile, including the .bdf extension + hdr header structure, see above + begsample index of the first sample to read + endsample index of the last sample to read + chanindx index of channels to read (optional, default is all) + This returns a Nchans X Nsamples data matrix + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_biosemi_bdf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_biosemi_bdf", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_biosig_data.py b/fieldtrip/__fileio/_read_biosig_data.py new file mode 100644 index 0000000..47ccc72 --- /dev/null +++ b/fieldtrip/__fileio/_read_biosig_data.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _read_biosig_data(*args, **kwargs): + """ + READ_BIOSIG_DATA reads data from EEG file using the BIOSIG + toolbox and returns it in the FCDC framework standard format + + Use as + [dat] = read_biosig_data(filename, hdr, begsample, endsample, chanindx) + where the header has to be read before with READ_BIOSIG_HEADER. + + The following data formats are supported: EDF, BKR, CNT, BDF, GDF + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_biosig_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_biosig_data", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_biosig_header.py b/fieldtrip/__fileio/_read_biosig_header.py new file mode 100644 index 0000000..0712c48 --- /dev/null +++ b/fieldtrip/__fileio/_read_biosig_header.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _read_biosig_header(*args, **kwargs): + """ + READ_BIOSIG_HEADER reads header from EEG file using the BIOSIG + toolbox and returns it in the FCDC framework standard format + + Use as + [hdr] = read_biosig_header(filename) + + The following data formats are supported: EDF, BKR, CNT, BDF, GDF, + see for full documentation http://biosig.sourceforge.net/ + + See also READ_BIOSIG_DATA + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_biosig_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_biosig_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_brainstorm_data.py b/fieldtrip/__fileio/_read_brainstorm_data.py new file mode 100644 index 0000000..8348ddc --- /dev/null +++ b/fieldtrip/__fileio/_read_brainstorm_data.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _read_brainstorm_data(*args, **kwargs): + """ + READ_BRAINSTORM_DATA reads .EEG files that have been generated by + the Nihon Kohden system. The function constitutes a wrapper around + BrainStorm3 functionalities + + Use as + [dat] = read_brainstorm_data(filename, hdr, begsample, endsample, chanindx) + + The function has not been tested on NK1200 files with multiple epochs + + See also READ_BRAINSTORM_HEADER, READ_BRAINSTORM_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_brainstorm_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_brainstorm_data", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_brainstorm_event.py b/fieldtrip/__fileio/_read_brainstorm_event.py new file mode 100644 index 0000000..40998fc --- /dev/null +++ b/fieldtrip/__fileio/_read_brainstorm_event.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _read_brainstorm_event(*args, **kwargs): + """ + READ_BRAINSTORM_EVENT reads the event information from .EEG files + that have been generated by the Nihon Kohden system. The function + constitutes a wrapper around BrainStorm3 functionalities + + Use as + [event] = read_brainstorm_event(filename) + + See also READ_NK1200_HEADER, READ_NK1200_DATA + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_brainstorm_event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_brainstorm_event", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_brainstorm_header.py b/fieldtrip/__fileio/_read_brainstorm_header.py new file mode 100644 index 0000000..0c34559 --- /dev/null +++ b/fieldtrip/__fileio/_read_brainstorm_header.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _read_brainstorm_header(*args, **kwargs): + """ + READ_BRAINSTORM_HEADER reads the header information from .EEG files + that have been generated by the Nihon Kohden system. The function + constitutes a wrapper around BrainStorm3 functionalities + + Use as + [hdr] = read_brainstorm_header(filename) + + See also READ_BRAINSTORM_DATA, READ_BRAINSTORM_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_brainstorm_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_brainstorm_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_brainvision_eeg.py b/fieldtrip/__fileio/_read_brainvision_eeg.py new file mode 100644 index 0000000..12ddb92 --- /dev/null +++ b/fieldtrip/__fileio/_read_brainvision_eeg.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _read_brainvision_eeg(*args, **kwargs): + """ + READ_BRAINVISION_EEG reads raw data from an EEG file and returns it as a Nchans x + Nsamples matrix. + + Use as + dat = read_brainvision_eeg(filename, hdr, begsample, endsample) + where the header should be first read using READ_BRAINVISION_VHDR + + See https://www.brainproducts.com/productdetails.php?id=21&tab=5 for the formal + specification. + + See also READ_BRAINVISION_VHDR, READ_BRAINVISION_VMRK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_brainvision_eeg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_brainvision_eeg", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_brainvision_vhdr.py b/fieldtrip/__fileio/_read_brainvision_vhdr.py new file mode 100644 index 0000000..ecb0acb --- /dev/null +++ b/fieldtrip/__fileio/_read_brainvision_vhdr.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _read_brainvision_vhdr(*args, **kwargs): + """ + READ_BRAINVISION_VHDR reads the known items from the BrainVision EEG + header file and returns them in a structure. + + Use as + vhdr = read_brainvision_vhdr(filename) + + See also READ_BRAINVISION_EEG, READ_BRAINVISION_VMRK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_brainvision_vhdr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_brainvision_vhdr", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_brainvision_vmrk.py b/fieldtrip/__fileio/_read_brainvision_vmrk.py new file mode 100644 index 0000000..0501951 --- /dev/null +++ b/fieldtrip/__fileio/_read_brainvision_vmrk.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _read_brainvision_vmrk(*args, **kwargs): + """ + READ_BRAINVISION_VMRK reads the markers and latencies + it returns the stimulus/response code and latency in ms. + + Use as + event = read_brainvision_vmrk(filename) + + See also READ_BRAINVISION_VHDR, READ_BRAINVISION_EEG + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_brainvision_vmrk.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_brainvision_vmrk", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_bti_ascii.py b/fieldtrip/__fileio/_read_bti_ascii.py new file mode 100644 index 0000000..824eb7a --- /dev/null +++ b/fieldtrip/__fileio/_read_bti_ascii.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _read_bti_ascii(*args, **kwargs): + """ + READ_BTI_ASCII reads general data from a BTI configuration file + + The file should be formatted like + Group: + item1 : value1a value1b value1c + item2 : value2a value2b value2c + item3 : value3a value3b value3c + item4 : value4a value4b value4c + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_bti_ascii.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_bti_ascii", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_bti_hs.py b/fieldtrip/__fileio/_read_bti_hs.py new file mode 100644 index 0000000..da31e29 --- /dev/null +++ b/fieldtrip/__fileio/_read_bti_hs.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _read_bti_hs(*args, **kwargs): + """ + read_hs_file Reads in BTI-Headshape files + filename: file with the headshape informations + outfile: if present, a ctf ".shape" file is written + output: if present, a 3xN matrix containing the headshape-points + + (C) 2007 by Thomas Hartmann + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_bti_hs.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_bti_hs", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_bti_m4d.py b/fieldtrip/__fileio/_read_bti_m4d.py new file mode 100644 index 0000000..3537a27 --- /dev/null +++ b/fieldtrip/__fileio/_read_bti_m4d.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _read_bti_m4d(*args, **kwargs): + """ + READ_BTI_M4D + + Use as + msi = read_bti_m4d(filename) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_bti_m4d.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_bti_m4d", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_bucn_nirsdata.py b/fieldtrip/__fileio/_read_bucn_nirsdata.py new file mode 100644 index 0000000..4df25e6 --- /dev/null +++ b/fieldtrip/__fileio/_read_bucn_nirsdata.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _read_bucn_nirsdata(*args, **kwargs): + """ + READ_BUCN_NIRSDATA reads ASCII-formatted NIRS data acquired with the + UCL-BIRKBECK machine and postprocessed by the Paris group. The first line + contains the channel labels and the rest of the file contains per line a + time sample. The first column specifies the time axis. + + Use as + [dat] = read_bucn_nirsdata(filename, hdr, begsample, endsample, chanindx) + + See also READ_BUCN_NIRSHDR, READ_BUCN_NIRSEVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_bucn_nirsdata.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_bucn_nirsdata", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_bucn_nirsevent.py b/fieldtrip/__fileio/_read_bucn_nirsevent.py new file mode 100644 index 0000000..e3617b8 --- /dev/null +++ b/fieldtrip/__fileio/_read_bucn_nirsevent.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _read_bucn_nirsevent(*args, **kwargs): + """ + READ_BUCN_NIRSEVENT reads the event information of ASCII-formatted NIRS + data acquired with the UCL-BIRKBECK machine and postprocessed by the + Paris group. The first line contains the header-info and the rest of + the file contains per line an event. The first column specifies the + time of the event in samples, the second column specifies the time of the + event in seconds, the third column contains the event type and the fourth + column is the event value. + + Use as + [event] = read_bucn_nirshdr(filename) + + See also READ_BUCN_NIRSHDR, READ_BUCN_NIRSDATA + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_bucn_nirsevent.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_bucn_nirsevent", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_bucn_nirshdr.py b/fieldtrip/__fileio/_read_bucn_nirshdr.py new file mode 100644 index 0000000..709b038 --- /dev/null +++ b/fieldtrip/__fileio/_read_bucn_nirshdr.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _read_bucn_nirshdr(*args, **kwargs): + """ + READ_BUCN_NIRSHDR reads the header information of ASCII-formatted NIRS + data acquired with the UCL-BIRKBECK machine and postprocessed by the + Paris group. The first line contains the channel labels and the rest of + the file contains per line a time sample. The first column specifies the + time axis. + + Use as + [hdr] = read_bucn_nirshdr(filename) + + See also READ_BUCN_NIRSDATA, READ_BUCN_NIRSEVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_bucn_nirshdr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_bucn_nirshdr", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_buffer_offline_data.py b/fieldtrip/__fileio/_read_buffer_offline_data.py new file mode 100644 index 0000000..53017cd --- /dev/null +++ b/fieldtrip/__fileio/_read_buffer_offline_data.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _read_buffer_offline_data(*args, **kwargs): + """ + function dat = read_buffer_offline_data(datafile, header, range) + + This function reads FCDC buffer-type data from a binary file. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_buffer_offline_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_buffer_offline_data", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_buffer_offline_events.py b/fieldtrip/__fileio/_read_buffer_offline_events.py new file mode 100644 index 0000000..b973805 --- /dev/null +++ b/fieldtrip/__fileio/_read_buffer_offline_events.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _read_buffer_offline_events(*args, **kwargs): + """ + function E = read_buffer_offline_events(eventfile, header) + + This function reads FCDC buffer-type events from a binary file. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_buffer_offline_events.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_buffer_offline_events", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_buffer_offline_header.py b/fieldtrip/__fileio/_read_buffer_offline_header.py new file mode 100644 index 0000000..0d426f6 --- /dev/null +++ b/fieldtrip/__fileio/_read_buffer_offline_header.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _read_buffer_offline_header(*args, **kwargs): + """ + function [hdr, nameFlag] = read_buffer_offline_header(headerfile) + + This function reads a FCDC buffer header from a binary file or text file + + On return, nameFlag has one of the following values: + 0 = No labels were generated (fMRI etc.) + 1 = Fake labels were generated + 2 = Got channel labels from chunk information + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_buffer_offline_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_buffer_offline_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_bv_srf.py b/fieldtrip/__fileio/_read_bv_srf.py new file mode 100644 index 0000000..d707724 --- /dev/null +++ b/fieldtrip/__fileio/_read_bv_srf.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _read_bv_srf(*args, **kwargs): + """ + READ_BV_SRF reads a triangulated surface from a BrainVoyager *.srf file + + Use as + [pnt, tri] = read_bv_srf(filename) or + [pnt, tri, srf] = read_bv_srf(filename) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_bv_srf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_bv_srf", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_caret_spec.py b/fieldtrip/__fileio/_read_caret_spec.py new file mode 100644 index 0000000..dc7a1b4 --- /dev/null +++ b/fieldtrip/__fileio/_read_caret_spec.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _read_caret_spec(*args, **kwargs): + """ + READ_CARET_SPEC reads in a caret .spec file. + + Use as + [spec, headerinfo] = read_caret_spec(specfile) + + Output arguments: + spec = structure containing per file type the files listed + headerinfo = structure containing the specfile header + + The file can be an xml-file or an ascii formatted file + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_caret_spec.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_caret_spec", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ced_son.py b/fieldtrip/__fileio/_read_ced_son.py new file mode 100644 index 0000000..df28427 --- /dev/null +++ b/fieldtrip/__fileio/_read_ced_son.py @@ -0,0 +1,81 @@ +from fieldtrip._runtime import Runtime + + +def _read_ced_son(*args, **kwargs): + """ + READ_CED_SON + + [OUT] = read_ced_son(DATAFILE,VARARGIN); + + Reads a analog and event data from a CED SON file + (SON files are created by Spike2 software). Currently, only + analog channels and event data can be read. + + Optional parameter Default + 'readevents' 'no' + 'readdata' 'no' + 'readtimestamps' 'no' + 'begsample' -1 + 'endsample' -1 + 'channels' [] + + Please note that CED DAQ systems do a sequential ADC, thus + channels do not share the same time axis: The timestamps of the + analog channels differ on a subsample level. Use the 'readtimestamps' + input parameter to get a matrix with time axes corresponding + to the data channels. + + Use begsample and endsample parameters to specify the boundaries + of the requested data chunk. Setting these parameters to -1 will + return data from the start or until the end of the datafile, + respectively. + + Specifying [1,2] for 'channels' will load the 1st and the 2nd + analog channel, __regardless of the actual channel number__ + If, for example channel 1,2,3 are event channels, 4 as an analog + channel, 5 is an event channel, and 6 is and analog channel, + specifying [1 2] for 'channels' will load analog channel 4 and 6. + Specifying [] for channels will return all analog channels. + + Setting 'readtimestamps' to 'yes' will return a time vector for + each analog channel. + + Depending on the input parameters, the function will return a structure + with fields: + 'header' Header information of the SON file + 'event' All data from event channels are pooled + and stored in this structure. + 'data' Cell-array with analog data + 'time' Cell-array with time vectors corresponding to 'data' + + Uses Neuroshare libraries to read Spike2 SON data + (see: http://neuroshare.sourceforge.net) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ced_son.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ced_son", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_combined_ds.py b/fieldtrip/__fileio/_read_combined_ds.py new file mode 100644 index 0000000..9597ca2 --- /dev/null +++ b/fieldtrip/__fileio/_read_combined_ds.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _read_combined_ds(*args, **kwargs): + """ + READ_COMBINED_DS reads electrophysiological data from a collection + of files that are located in one directory, where each of the files + should contain one channel and should have the same sampling frequency + and number of samples as all other files. + + Use as + hdr = read_combined_ds(dirname) + dat = read_combined_ds(dirname, hdr, begsample, endsample, chanindx) + + This is supported for single channel files in one of the following formats + plexon_nex + neuralynx_bin + neuralynx_ncs + fcdc_matbin + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_combined_ds.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_combined_ds", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ctf_ascii.py b/fieldtrip/__fileio/_read_ctf_ascii.py new file mode 100644 index 0000000..da9c507 --- /dev/null +++ b/fieldtrip/__fileio/_read_ctf_ascii.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_ascii(*args, **kwargs): + """ + READ_CTF_ASCII reads general data from an CTF configuration file + + The file should be formatted like + Group + { + item1 : value1a value1b value1c + item2 : value2a value2b value2c + item3 : value3a value3b value3c + item4 : value4a value4b value4c + } + + This fileformat structure is used in + params.avg + default.hdm + multiSphere.hdm + processing.cfg + and maybe for other files as well. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ctf_ascii.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_ascii", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ctf_cls.py b/fieldtrip/__fileio/_read_ctf_cls.py new file mode 100644 index 0000000..03adc9d --- /dev/null +++ b/fieldtrip/__fileio/_read_ctf_cls.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_cls(*args, **kwargs): + """ + READ_CTF_CLS reads the classification file from a CTF dataset + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ctf_cls.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_cls", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ctf_coef.py b/fieldtrip/__fileio/_read_ctf_coef.py new file mode 100644 index 0000000..0924c7f --- /dev/null +++ b/fieldtrip/__fileio/_read_ctf_coef.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_coef(*args, **kwargs): + """ + READ_CTF_COEF returns the spatial filter coefficients for the CTF MEG system + that has been installed at the F.C. Donders Centre (id 1706) + + This function actually does not read the coefficients from a file, but the + coefficients themselves are included in this function. + + The original location of the coefficients included in this file is + odin:/opt/ctf/hardware/M016/M017_1706.coef + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ctf_coef.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_coef", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ctf_dat.py b/fieldtrip/__fileio/_read_ctf_dat.py new file mode 100644 index 0000000..301716b --- /dev/null +++ b/fieldtrip/__fileio/_read_ctf_dat.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_dat(*args, **kwargs): + """ + READ_CTF_DAT reads MEG data from an ascii format CTF file + + meg = read_ctf_dat(filename) + + returns a structure with the following fields: + meg.data Nchans x Ntime + meg.time 1xNtime in miliseconds + meg.trigger 1xNtime with trigger values + meg.label 1xNchans cell-array with channel labels (string) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ctf_dat.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_dat", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ctf_hc.py b/fieldtrip/__fileio/_read_ctf_hc.py new file mode 100644 index 0000000..7862f7e --- /dev/null +++ b/fieldtrip/__fileio/_read_ctf_hc.py @@ -0,0 +1,65 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_hc(*args, **kwargs): + """ + READ_CTF_HC reads the MEG headcoil marker positions from an ascii file + and computes the coordinate transformation required to get from from + dewar to head-coordinates + + the definition of head coordinates is according to CTF standard: + - the origin is exactly between LPA and RPA + - the positive x-axis goes throught NAS + - the positive y-axis goes (approximately) through LPA + - the positive z-axis goes up, orthogonal to the x- and y-axes + + hc = read_ctf_hc(filename) + + returns a structure with the following fields + hc.dewar.nas marker positions relative to dewar + hc.dewar.lpa + hc.dewar.rpa + hc.head.nas marker positions relative to head (measured) + hc.head.lpa + hc.head.rpa + hc.standard.nas marker positions relative to head (expected) + hc.standard.lpa + hc.standard.rpa + and + hc.affine parameter for affine transformation (1x12) + hc.homogenous homogenous transformation matrix (4x4, see warp3d) + hc.translation translation vector (1x3) + hc.rotation rotation matrix (3x3) + + Gradiometer positions can be transformed into head coordinates using the + homogeneous transformation matrix, or using the affine parameters and + the warp3d function from the WARPING toolbox + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ctf_hc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_hc", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ctf_hdm.py b/fieldtrip/__fileio/_read_ctf_hdm.py new file mode 100644 index 0000000..adece95 --- /dev/null +++ b/fieldtrip/__fileio/_read_ctf_hdm.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_hdm(*args, **kwargs): + """ + READ_CTF_HDM reads the head volume conductor model from a *.hdm file + + vol = read_ctf_hdm(filename) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ctf_hdm.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_hdm", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ctf_hist.py b/fieldtrip/__fileio/_read_ctf_hist.py new file mode 100644 index 0000000..17ca653 --- /dev/null +++ b/fieldtrip/__fileio/_read_ctf_hist.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_hist(*args, **kwargs): + """ + READ_CTF_HIST + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ctf_hist.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_hist", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ctf_meg4.py b/fieldtrip/__fileio/_read_ctf_meg4.py new file mode 100644 index 0000000..9702638 --- /dev/null +++ b/fieldtrip/__fileio/_read_ctf_meg4.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_meg4(*args, **kwargs): + """ + READ_CTF_MEG4 reads specified samples from a CTF continuous datafile + It neglects all trial boundaries as if the data was acquired in + non-continuous mode. + + Use as + [meg] = read_ctf_meg4(filename, hdr, begsample, endsample, chanindx) + where + filename name of the datafile, including the .meg4 extension + header with all data information (from read_ctf_meg4) + begsample index of the first sample to read + endsample index of the last sample to read + chanindx index of channels to read (optional, default is all) + + See also READ_CTF_MEG4 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ctf_meg4.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_meg4", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ctf_mri.py b/fieldtrip/__fileio/_read_ctf_mri.py new file mode 100644 index 0000000..c0cb07c --- /dev/null +++ b/fieldtrip/__fileio/_read_ctf_mri.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_mri(*args, **kwargs): + """ + READ_CTF_MRI reads header and image data from a CTF version 2.2 MRI file + + Use as + [mri, hdr] = read_ctf_mri(filename) + + See also READ_CTF_MRI4 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ctf_mri.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_mri", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ctf_mri4.py b/fieldtrip/__fileio/_read_ctf_mri4.py new file mode 100644 index 0000000..7ecdb29 --- /dev/null +++ b/fieldtrip/__fileio/_read_ctf_mri4.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_mri4(*args, **kwargs): + """ + READ_CTF_MRI reads header and imnage data from CTF format MRI file + + [mri, hdr] = read_ctf_mri(filename) + + See also READ_CTF_MEG4, READ_CTF_RES4 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ctf_mri4.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_mri4", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ctf_pos.py b/fieldtrip/__fileio/_read_ctf_pos.py new file mode 100644 index 0000000..c547193 --- /dev/null +++ b/fieldtrip/__fileio/_read_ctf_pos.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_pos(*args, **kwargs): + """ + READ_CTF_POS reads Polhemus file created with the CTF digitizer application + + Use as + [fid, pnt, label] = read_ctf_pos(filename) + Input: + filename - Polhemus ASCII file containing digitized points + + Output: + fid - fiducial locations of fiducials + pnt - sensor/headshape locations + label - labels of the fiducials + + IMPORTANT: Note that Polhemus data files should be -ASCII files with + extension .pos generated by the CTF digitizer + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ctf_pos.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_pos", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ctf_res4.py b/fieldtrip/__fileio/_read_ctf_res4.py new file mode 100644 index 0000000..0a64360 --- /dev/null +++ b/fieldtrip/__fileio/_read_ctf_res4.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_res4(*args, **kwargs): + """ + READ_CTF_RES4 reads the header in RES4 format from a CTF dataset + + Use as + [hdr] = read_ctf_res4(filename) + + See also READ_CTF_MEG4 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ctf_res4.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_res4", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ctf_sens.py b/fieldtrip/__fileio/_read_ctf_sens.py new file mode 100644 index 0000000..0609841 --- /dev/null +++ b/fieldtrip/__fileio/_read_ctf_sens.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_sens(*args, **kwargs): + """ + READ_CTF_SENS reads MEG sensor information from CTF configuration file + + magn = read_ctf_sens(filename) + + where the returned structure meg has the fields + magn.pnt position first coil + magn.ori orientation first coil + magn.pnt2 position second coil + magn.ori2 orientation second coil + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ctf_sens.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_sens", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ctf_shape.py b/fieldtrip/__fileio/_read_ctf_shape.py new file mode 100644 index 0000000..cbd0ff6 --- /dev/null +++ b/fieldtrip/__fileio/_read_ctf_shape.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_shape(*args, **kwargs): + """ + READ_CTF_SHAPE reads headshape points and header information + from a CTF *.shape the accompanying *.shape_info file. + + Use as + [shape] = read_ctf_shape(filename) + where filename should have the .shape extension + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ctf_shape.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_shape", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ctf_shm.py b/fieldtrip/__fileio/_read_ctf_shm.py new file mode 100644 index 0000000..c73cbb8 --- /dev/null +++ b/fieldtrip/__fileio/_read_ctf_shm.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_shm(*args, **kwargs): + """ + READ_CTF_SHM reads metainformation or selected blocks of data from + shared memory. This function can be used for real-time processing of + data while it is being acquired. + + Use as + [msgType msgId sampleNumber numSamples numChannels] = read_ctf_shm; + or + [data] = read_ctf_shm(msgNumber); + [data] = read_ctf_shm(msgNumber, numValues); + + See also WRITE_CTF_SHM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ctf_shm.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_shm", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ctf_trigger.py b/fieldtrip/__fileio/_read_ctf_trigger.py new file mode 100644 index 0000000..e655b88 --- /dev/null +++ b/fieldtrip/__fileio/_read_ctf_trigger.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_trigger(*args, **kwargs): + """ + READ_CTF_TRIGGER reads the STIM channel from a dataset and detects + the trigger moments and values + + [backpanel, frontpanel] = read_ctf_trigger(dataset) + + This returns all samples of the STIM channel, converted to backpanel + and frontpanel trigger values. Triggers are placed at the rising flank + of the STIM channel. + + Triggers should be at least 9 samples long (for 1200Hz samplerate) and + should not overlap each other. + + See also READ_CTF_MEG4, READ_CTF_RES4 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ctf_trigger.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_trigger", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_curry.py b/fieldtrip/__fileio/_read_curry.py new file mode 100644 index 0000000..2ab5fe8 --- /dev/null +++ b/fieldtrip/__fileio/_read_curry.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _read_curry(*args, **kwargs): + """ + READ_CURRY reads and parses Curry V2 and V4 ascii files and returns the + content in a structure that is similar to the block-structured layout of + the file. This function does not interpret the content of the file, but + is intended as a helper function for READ_CURRY_XXX functions (where XXX + is the extension of the file). + + Use as + s = read_curry(filename) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_curry.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_curry", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_deymed_dat.py b/fieldtrip/__fileio/_read_deymed_dat.py new file mode 100644 index 0000000..3b826e3 --- /dev/null +++ b/fieldtrip/__fileio/_read_deymed_dat.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _read_deymed_dat(*args, **kwargs): + """ + READ_DEYMED_DAT reads EEG data from the Deymed Truescan file format + + Use as + dat = read_deymed_dat(filename, hdr, begsample, endsample) + + See also READ_DEYMED_INI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_deymed_dat.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_deymed_dat", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_deymed_ini.py b/fieldtrip/__fileio/_read_deymed_ini.py new file mode 100644 index 0000000..df77834 --- /dev/null +++ b/fieldtrip/__fileio/_read_deymed_ini.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _read_deymed_ini(*args, **kwargs): + """ + READ_DEYMED_INI reads EEG data from the Deymed Truescan file format + + Use as + hdr = read_deymed_ini(filename) + + See also READ_DEYMED_DAT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_deymed_ini.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_deymed_ini", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_dhn_med10.py b/fieldtrip/__fileio/_read_dhn_med10.py new file mode 100644 index 0000000..4e6db1a --- /dev/null +++ b/fieldtrip/__fileio/_read_dhn_med10.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _read_dhn_med10(*args, **kwargs): + """ + READ_DHN_MED10 read header, event, and waveform data formated in Dark Horse Neuron MED 1.0 + + Syntax: + hdr = read_dhn_med10(filename) + hdr = read_dhn_med10(filename, password) + hdr = read_dhn_med10(filename, password, sortchannel) + evt = read_dhn_med10(filename, password, sortchannel, hdr) + dat = read_dhn_med10(filename, password, sortchannel, hdr, begsample, endsample, chanindx) + + Input(s): + filename - [char] name of the file or folder of the dataset + password - [struct] (opt) password structure of MED 1.0 data (see + MEDSession_1p0) + sortchannel - [char] (opt) sort channel order either alphabetically + 'alphabet' or numerically 'number' (default = 'alphabet') + hdr - [struct] (opt) header structure of the dataset (see FT_READ_HEADER; default = struct([])) + begsample - [num] (opt) first sample to read (default = []) + endsample - [num] (opt) last smaple to read (default = []) + chanindx - [num] (opt) list of channel indices to read (default = []) + + Output(s): + hdr - [struct] header structure of the dataset (see FT_READ_HEADER) + evt - [struct] event structure of the dataset (see FT_READ_EVENT) + dat - [num] data read in + + Example: + + Note: + + References: + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_EVENT, FT_READ_DATA. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_dhn_med10.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_dhn_med10", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_edf.py b/fieldtrip/__fileio/_read_edf.py new file mode 100644 index 0000000..41fc468 --- /dev/null +++ b/fieldtrip/__fileio/_read_edf.py @@ -0,0 +1,80 @@ +from fieldtrip._runtime import Runtime + + +def _read_edf(*args, **kwargs): + """ + READ_EDF reads specified samples from an EDF datafile. It neglects all trial or + data block boundaries as if the data was acquired in non-continuous mode. + + Note that since FieldTrip only accommodates a single sampling rate in a given + dataset, whereas EDF allows specification of a sampling rate for each channel. If + there are heterogenous sampling rates then this function will automatically choose + a subset. If the last such channel is different from the rest, the assumption will + be made that it is the annotation channel and the rest will be selected. If that + is not the case, then the largest subset of channels with a consistent sampling + rate will be chosen. To avoid this automatic selection process, the user may + specify their own choice of channels using chanindx. In this case, the automatic + selection will only occur if the user selected channels still have heterogenous + sampling rates. In this case the automatic selection will occur amongst the user + specified channels. While reading the header the resulting channel selection + decision will be stored in hdr.orig.chansel and the contents of this field will + override chanindx during data reading. + + Use as + [hdr] = read_edf(filename) + where + filename name of the datafile, including the .edf extension + This returns a header structure with the following elements + hdr.Fs sampling frequency + hdr.nChans number of channels + hdr.nSamples number of samples per trial + hdr.nSamplesPre number of pre-trigger samples in each trial + hdr.nTrials number of trials + hdr.label cell-array with labels of each channel + hdr.orig detailed EDF header information + + Or use as + [dat] = read_edf(filename, hdr, begsample, endsample, chanindx) + where + filename name of the datafile, including the .edf extension + hdr header structure, see above + begsample index of the first sample to read + endsample index of the last sample to read + chanindx index of channels to read (optional, default is all) + This returns a Nchans X Nsamples data matrix + + Or use as + [evt] = read_edf(filename, hdr) + where + filename name of the datafile, including the .edf extension + hdr header structure, see above + This returns an Nsamples data vector of just the annotation channel + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_edf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_edf", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_egis_data.py b/fieldtrip/__fileio/_read_egis_data.py new file mode 100644 index 0000000..863c982 --- /dev/null +++ b/fieldtrip/__fileio/_read_egis_data.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def _read_egis_data(*args, **kwargs): + """ + READ_EGIS_DATA reads the data from an EGI EGIS format file + + Use as + dat = read_egis_data(filename, hdr, begtrial, endtrial, chanindx); + where + filename name of the input file + hdr header structure, see FT_READ_HEADER + begtrial first trial to read, mutually exclusive with begsample+endsample + endtrial last trial to read, mutually exclusive with begsample+endsample + chanindx list with channel indices to read + + This function returns a 3-D matrix of size Nchans*Nsamples*Ntrials. + Note that EGIS session files are defined as always being epoched. + For session files the trials are organized with the members of each cell grouped + together. For average files the "trials" (subjects) are organized with the cells + also grouped together (e.g., "cell1sub1, cell1sub2, ...). + _______________________________________________________________________ + + + Modified from EGI's EGI Toolbox with permission 2007-06-28 Joseph Dien + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_egis_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_egis_data", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_egis_header.py b/fieldtrip/__fileio/_read_egis_header.py new file mode 100644 index 0000000..63e638f --- /dev/null +++ b/fieldtrip/__fileio/_read_egis_header.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _read_egis_header(*args, **kwargs): + """ + READ_EGIS_HEADER reads the header information from an EGI EGIS format file + + Use as + [fhdr chdr] = read_egia_header(filename) + with + fhdr - the file header information + chdr - the cell header information + ename - experiment name + cnames - cell names + fcom - comments + ftext - general text + and + filename - the name of the data file + _______________________________________________________________________ + + + Modified from EGI's EGI Toolbox with permission 2007-06-28 Joseph Dien + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_egis_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_egis_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_elec.py b/fieldtrip/__fileio/_read_elec.py new file mode 100644 index 0000000..012ca2c --- /dev/null +++ b/fieldtrip/__fileio/_read_elec.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _read_elec(*args, **kwargs): + """ + READ_ELEC reads "la/mu" electrode parameters from a MBF electrode file + which are used to position them on a triangulated surface + + [el, lab] = read_elec(filename) + + where el = [tri, la, mu] + and lab contains the electrode labels (if present) + + See also READ_TRI, TRANSFER_ELEC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_elec.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_elec", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_eyelink_asc.py b/fieldtrip/__fileio/_read_eyelink_asc.py new file mode 100644 index 0000000..1742530 --- /dev/null +++ b/fieldtrip/__fileio/_read_eyelink_asc.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _read_eyelink_asc(*args, **kwargs): + """ + READ_EYELINK_ASC reads the header information, input triggers, messages + and all data points from an Eyelink *.asc file. The output events are + represented as matlab tables (after Aug 2022) + + Use as + asc = read_eyelink_asc(filename) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_eyelink_asc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_eyelink_asc", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_fcdc_trl.py b/fieldtrip/__fileio/_read_fcdc_trl.py new file mode 100644 index 0000000..6c2adaa --- /dev/null +++ b/fieldtrip/__fileio/_read_fcdc_trl.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def _read_fcdc_trl(*args, **kwargs): + """ + READ_FCDC_TRL reads trial definitions from a file + + Given a file which defines N trials, this function returns a Nx3 + matrix with the begin latency, end latency, and the latency offset + of the first sample of each trial. The latencies are in seconds. + + [trl] = read_fcdc_trl(filename) + + An FCD trial definition file is formatted like + begin end offset + 0.0000 1.0000 0.0000 + 3.0000 4.0000 0.0000 + 5.0000 5.5000 0.0000 + ... + + The trial begin and end are given in seconds relative to the start + of the recorded datafile. The offset is given in seconds and indicates + the latency of the first sample, relative to the trial marker or + trigger. E.g., given a trigger at 7000ms (relative to the recording + begin), a trial of 1000ms with a pretrigger interval of 300ms would + correspond to "6.700 7.700 -0.300". + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_fcdc_trl.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_fcdc_trl", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_gmsh_binary.py b/fieldtrip/__fileio/_read_gmsh_binary.py new file mode 100644 index 0000000..8c81055 --- /dev/null +++ b/fieldtrip/__fileio/_read_gmsh_binary.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _read_gmsh_binary(*args, **kwargs): + """ + READ_GMSH_BINARY reads a gmsh .msh binary file. Current support is only + for version 2. There are some ASCII-readers floating around on the net, + but they do not seem to work with the primary use case in FieldTrip (and + the test data that I have available), which is SimNibs generated data. + + See also MESH_LOAD_GMSH4 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_gmsh_binary.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_gmsh_binary", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ini.py b/fieldtrip/__fileio/_read_ini.py new file mode 100644 index 0000000..58a9776 --- /dev/null +++ b/fieldtrip/__fileio/_read_ini.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def _read_ini(*args, **kwargs): + """ + READ_INI reads a specified element from a Windows *.ini file + + Use as + val = read_ini(filename, element, type, number) + where the element is a string such as + NumberSlices + NumberPositions + Rows + Columns + etc. + + and format specifies the datatype to be returned according to + %d (integer value) + %f (floating point value) + %s (string) + + The number argument is optional to specify how many lines of data + should be read, the default is 1 for strings and Inf for numbers. + + The token argument is optional to specifiy a character that separates + the values from anything not wanted. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ini.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ini", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_itab_mhd.py b/fieldtrip/__fileio/_read_itab_mhd.py new file mode 100644 index 0000000..0e1a5be --- /dev/null +++ b/fieldtrip/__fileio/_read_itab_mhd.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _read_itab_mhd(*args, **kwargs): + """ + read_itab_mhd is a function. + mhd = read_itab_mhd(filename) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_itab_mhd.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_itab_mhd", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_mat.py b/fieldtrip/__fileio/_read_mat.py new file mode 100644 index 0000000..0b2e3b9 --- /dev/null +++ b/fieldtrip/__fileio/_read_mat.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _read_mat(*args, **kwargs): + """ + READ_MAT reads a matrix from an ascii or binary MBF format file + + Usage: m = loadmat('file'); + or [m,extra] = loadmat('file'); + + LOADMAT('file') returns the matrix stored in 'file' and + the extra information stored at the bottom of that file. + LOADMAT works for binary as well as asci matrix files. + + See also WRITE_MAT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_mat.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_mat", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_mayo_mef21.py b/fieldtrip/__fileio/_read_mayo_mef21.py new file mode 100644 index 0000000..2d2b787 --- /dev/null +++ b/fieldtrip/__fileio/_read_mayo_mef21.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def _read_mayo_mef21(*args, **kwargs): + """ + READ_MAYO_MEF21 read header, event and data from the files formatted in MEF2.1 + + Syntax: + hdr = read_mayo_mef21(filename) + hdr = read_mayo_mef21(filename, password) + evt = read_mayo_mef21(filename, password, hdr) + dat = read_mayo_mef21(filename, password, hdr, begsample, endsample, chanindx) + + Input(s): + filename - [char] name of the file or folder of the dataset + password - [struct] (opt) password structure of MEF 2.1 data (see + MEFSession_2.1) + hdr - [struct] (opt) header structure of the dataset (see + ft_read_header; default = struct([])) + begsample - [num] (opt) first sample to read (default = []) + endsample - [num] (opt) last smaple to read (default = []) + chanindx - [num] (opt) list of channel indices to read (default + = []) + + Output(s): + hdr - [struct] header structure of the dataset (see + FT_READ_HEADER) + evt - [struct] event structure of the dataset (see + FT_READ_EVENT) + dat - [num] data read in + + Example: + + Note: + + References: + + See also ft_filetype, ft_read_header, ft_read_event, ft_read_data. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_mayo_mef21.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_mayo_mef21", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_mayo_mef30.py b/fieldtrip/__fileio/_read_mayo_mef30.py new file mode 100644 index 0000000..c1d6f0c --- /dev/null +++ b/fieldtrip/__fileio/_read_mayo_mef30.py @@ -0,0 +1,65 @@ +from fieldtrip._runtime import Runtime + + +def _read_mayo_mef30(*args, **kwargs): + """ + READ_MAYO_MEF30 read header, event and data from the files formatted in MEF 3.0 + + Syntax: + hdr = read_mayo_mef30(filename) + hdr = read_mayo_mef30(filename, password) + hdr = read_mayo_mef30(filename, password, sortchannel) + evt = read_mayo_mef30(filename, password, sortchannel, hdr) + dat = read_mayo_mef30(filename, password, sortchannel, hdr, begsample, endsample, chanindx) + + Input(s): + filename - [char] name of the file or folder of the dataset + password - [struct] (opt) password structure of MEF 3.0 data (see MEFSession_3p0) + sortchannel - [char] (opt) sort channel order either alphabetically 'alphabet' or + numerically 'number' (default = 'alphabet') + hdr - [struct] (opt) header structure of the dataset (see FT_READ_HEADER; default = struct([])) + begsample - [num] (opt) first sample to read (default = []) + endsample - [num] (opt) last smaple to read (default = []) + chanindx - [num] (opt) list of channel indices to read (default = []) + + Output(s): + hdr - [struct] header structure of the dataset (see FT_READ_HEADER) + evt - [struct] event structure of the dataset (see FT_READ_EVENT) + dat - [num] data read in + + Example: + + Note: + + References: + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_EVENT, FT_READ_DATA + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_mayo_mef30.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_mayo_mef30", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_mclust_t.py b/fieldtrip/__fileio/_read_mclust_t.py new file mode 100644 index 0000000..df24932 --- /dev/null +++ b/fieldtrip/__fileio/_read_mclust_t.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _read_mclust_t(*args, **kwargs): + """ + adapted from M-clust function LoadSpikes + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_mclust_t.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_mclust_t", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_mff_bin.py b/fieldtrip/__fileio/_read_mff_bin.py new file mode 100644 index 0000000..b716d82 --- /dev/null +++ b/fieldtrip/__fileio/_read_mff_bin.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _read_mff_bin(*args, **kwargs): + """ + READ_MFF_BIN + + Use as + [hdr] = read_mff_bin(filename) + or + [dat] = read_mff_bin(filename, begblock, endblock); + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_mff_bin.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_mff_bin", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_micromed_event.py b/fieldtrip/__fileio/_read_micromed_event.py new file mode 100644 index 0000000..4a364db --- /dev/null +++ b/fieldtrip/__fileio/_read_micromed_event.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _read_micromed_event(*args, **kwargs): + """ + reads the events of the Micromed TRC format files + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_micromed_event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_micromed_event", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_micromed_trc.py b/fieldtrip/__fileio/_read_micromed_trc.py new file mode 100644 index 0000000..77dcfe5 --- /dev/null +++ b/fieldtrip/__fileio/_read_micromed_trc.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _read_micromed_trc(*args, **kwargs): + """ + -------------------------------------------------------------------------- + reads Micromed .TRC file into matlab, version Mariska, edited by Romain + input: filename + output: datamatrix + -------------------------------------------------------------------------- + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_micromed_trc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_micromed_trc", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_mpi_dap.py b/fieldtrip/__fileio/_read_mpi_dap.py new file mode 100644 index 0000000..0d541a8 --- /dev/null +++ b/fieldtrip/__fileio/_read_mpi_dap.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _read_mpi_dap(*args, **kwargs): + """ + READ_MPI_DAP read the analog channels from a DAP file + and returns the values in microvolt (uV) + + Use as + [dap] = read_mpi_dap(filename) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_mpi_dap.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_mpi_dap", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_mpi_ds.py b/fieldtrip/__fileio/_read_mpi_ds.py new file mode 100644 index 0000000..fddfb5d --- /dev/null +++ b/fieldtrip/__fileio/_read_mpi_ds.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _read_mpi_ds(*args, **kwargs): + """ + READ_MPI_DS reads all DAP files from a directory containing files or + alternatively a single DAP file and returns it in a simplified FieldTrip + format. The analog channels and spike channels are both returned in a + continuous format. + + Use as + [hdr, dat] = read_mpi_ds(dirname) + or + [hdr, dat] = read_mpi_ds(filename) + + See also READ_MPI_DAP + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_mpi_ds.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_mpi_ds", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_nervus_data.py b/fieldtrip/__fileio/_read_nervus_data.py new file mode 100644 index 0000000..d2f9810 --- /dev/null +++ b/fieldtrip/__fileio/_read_nervus_data.py @@ -0,0 +1,70 @@ +from fieldtrip._runtime import Runtime + + +def _read_nervus_data(*args, **kwargs): + """ + read_nervus_data Returns data from Nicolet file. + + OUT = read_nervus_data(NRVHDR, SEGMENT, RANGE, CHIDX) returns data in an n x m array of + doubles where n is the number of datapoints and m is the number + of channels. + + NRVHDR is a header from the function read_nervus_header + SEGMENT is the segment number in the file to read from + RANGE is a 1x2 array with the [StartIndex EndIndex] - default: all + and CHIDX is a vector of channel indeces - default: all + + FILENAME is the file name of a file in the Natus/Nicolet/Nervus(TM) + format (originally designed by Taugagreining HF in Iceland) + + Based on ieeg-portal/Nicolet-Reader + at https://github.com/ieeg-portal/Nicolet-Reader + + Copyright (C) 2016, Jan Brogger and Joost Wagenaar + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + + $Id: $ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_nervus_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_nervus_data", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_nervus_header.py b/fieldtrip/__fileio/_read_nervus_header.py new file mode 100644 index 0000000..9122faa --- /dev/null +++ b/fieldtrip/__fileio/_read_nervus_header.py @@ -0,0 +1,61 @@ +from fieldtrip._runtime import Runtime + + +def _read_nervus_header(*args, **kwargs): + """ + read_nervus_header Returns header information from Nicolet file. + + FILENAME is the file name of a file in the Natus/Nicolet/Nervus(TM) + format (originally designed by Taugagreining HF in Iceland) + + Based on ieeg-portal/Nicolet-Reader + at https://github.com/ieeg-portal/Nicolet-Reader + + Copyright (C) 2016, Jan Brogger and Joost Wagenaar + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + + $Id: $ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_nervus_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_nervus_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neuralynx_bin.py b/fieldtrip/__fileio/_read_neuralynx_bin.py new file mode 100644 index 0000000..a95754f --- /dev/null +++ b/fieldtrip/__fileio/_read_neuralynx_bin.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuralynx_bin(*args, **kwargs): + """ + READ_NEURALYNX_BIN + + Use as + hdr = read_neuralynx_bin(filename) + or + dat = read_neuralynx_bin(filename, begsample, endsample) + + This is not a formal Neuralynx file format, but at the + F.C. Donders Centre we use it in conjunction with Neuralynx, + SPIKESPLITTING and SPIKEDOWNSAMPLE. + + The first version of this file format contained in the first 8 bytes the + channel label as string. Subsequently it contained 32 bit integer values. + + The second version of this file format starts with 8 bytes describing (as + a space-padded string) the data type. The channel label is contained in + the filename as dataset.chanlabel.bin. + + The third version of this file format starts with 7 bytes describing (as + a zero-padded string) the data type, followed by the 8th byte which + describes the downscaling for the 8 and 16 bit integer representations. + The downscaling itself is represented as uint8 and should be interpreted as + the number of bits to shift. The channel label is contained in the + filename as dataset.chanlabel.bin. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neuralynx_bin.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuralynx_bin", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neuralynx_cds.py b/fieldtrip/__fileio/_read_neuralynx_cds.py new file mode 100644 index 0000000..5eda96b --- /dev/null +++ b/fieldtrip/__fileio/_read_neuralynx_cds.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuralynx_cds(*args, **kwargs): + """ + READ_NEURALYNX_CDS reads selected samples and channels from a combined Neuralynx dataset with separate subdirectories for the LFP, MUA and spike channels + + Use as + hdr = read_neuralynx_cds(parentdir) + dat = read_neuralynx_cds(parentdir, hdr, begsample, endsample, chanindx) + + This is not a formal Neuralynx file format, but at the F.C. Donders + Centre we use it as a directory/file organization in conjunction + with Neuralynx, SPIKESPLITTING and SPIKEDOWNSAMPLE. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neuralynx_cds.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuralynx_cds", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neuralynx_dma.py b/fieldtrip/__fileio/_read_neuralynx_dma.py new file mode 100644 index 0000000..d38a96d --- /dev/null +++ b/fieldtrip/__fileio/_read_neuralynx_dma.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuralynx_dma(*args, **kwargs): + """ + READ_NEURALYNX_DMA reads specified samples and channels data from a Neuralynx DMA log file + + Use as + [hdr] = read_neuralynx_dma(filename) + [dat] = read_neuralynx_dma(filename, begsample, endsample) + [dat] = read_neuralynx_dma(filename, begsample, endsample, chanindx) + + The channel specification can be a vector with indices, or a single string with the value + 'all', 'stx', 'pid', 'siz', 'tsh', 'tsl', + 'cpu', 'ttl', 'x01', ..., 'x10' + + This function returns the electrophysiological data in AD units + and not in uV. You should look up the details of the headstage and + the Neuralynx amplifier and scale the values accordingly. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neuralynx_dma.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuralynx_dma", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neuralynx_ds.py b/fieldtrip/__fileio/_read_neuralynx_ds.py new file mode 100644 index 0000000..dd4a575 --- /dev/null +++ b/fieldtrip/__fileio/_read_neuralynx_ds.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuralynx_ds(*args, **kwargs): + """ + READ_NEURALYNX_DS reads multiple single-channel Neuralynx files that are + all contained in a single directory. Each file is treated as a single + channel of a combined multi-channel dataset. + + Use as + [hdr] = read_neuralynx_ds(dirname) + [dat] = read_neuralynx_ds(dirname, hdr, begsample, endsample, chanindx) + + A Neuralynx dataset consists of a directory containing separate files, + one for each channel. All Neuralynx datafiles starts with a 16k header + (in ascii format), followed by an arbitrary number of data records. The + format of the data records depend on the type of data contained in the + channel (e.g. continuous or spike data). + + To read the timestamps of spike waveforms (nse) or clustered spikes (nts), + the header should contain the fields + hdr.FirstTimeStamp + hdr.TimeStampPerSample + These can only be obtained from the corresponding simultaneous LFP + and/or MUA recordings. + + See also READ_NEURALYNX_NCS, READ_NEURALYNX_NSE, READ_NEURALYNX_NTS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neuralynx_ds.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuralynx_ds", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neuralynx_ncs.py b/fieldtrip/__fileio/_read_neuralynx_ncs.py new file mode 100644 index 0000000..aa12cd9 --- /dev/null +++ b/fieldtrip/__fileio/_read_neuralynx_ncs.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuralynx_ncs(*args, **kwargs): + """ + READ_NEURALYNX_NCS reads a single continuous channel file + + Use as + [ncs] = read_neuralynx_ncs(filename) + [ncs] = read_neuralynx_ncs(filename, begrecord, endrecord) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neuralynx_ncs.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuralynx_ncs", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neuralynx_nev.py b/fieldtrip/__fileio/_read_neuralynx_nev.py new file mode 100644 index 0000000..1b8b5a3 --- /dev/null +++ b/fieldtrip/__fileio/_read_neuralynx_nev.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuralynx_nev(*args, **kwargs): + """ + READ_NEURALYNX_NEV reads the event information from the *.nev file in a + Neuralynx dataset directory + + Use as + nev = read_neuralynx_hdr(datadir, ...) + nev = read_neuralynx_hdr(eventfile, ...) + + Optional input arguments should be specified in key-value pairs and may include + implementation should be 1, 2 or 3 (default = 3) + value number or list of numbers + mintimestamp number + maxtimestamp number + minnumber number + maxnumber number + + The output structure contains all events and timestamps. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neuralynx_nev.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuralynx_nev", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neuralynx_nse.py b/fieldtrip/__fileio/_read_neuralynx_nse.py new file mode 100644 index 0000000..7c50bfc --- /dev/null +++ b/fieldtrip/__fileio/_read_neuralynx_nse.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuralynx_nse(*args, **kwargs): + """ + READ_NEURALYNX_NSE reads a single electrode waveform file + + Use as + [nse] = read_neuralynx_nse(filename) + [nse] = read_neuralynx_nse(filename, begrecord, endrecord) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neuralynx_nse.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuralynx_nse", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neuralynx_nst.py b/fieldtrip/__fileio/_read_neuralynx_nst.py new file mode 100644 index 0000000..721194a --- /dev/null +++ b/fieldtrip/__fileio/_read_neuralynx_nst.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuralynx_nst(*args, **kwargs): + """ + READ_NEURALYNX_NST reads a single stereotrode file + + Use as + [nst] = read_neuralynx_nst(filename) + [nst] = read_neuralynx_nst(filename, begrecord, endrecord) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neuralynx_nst.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuralynx_nst", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neuralynx_nts.py b/fieldtrip/__fileio/_read_neuralynx_nts.py new file mode 100644 index 0000000..a3f5894 --- /dev/null +++ b/fieldtrip/__fileio/_read_neuralynx_nts.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuralynx_nts(*args, **kwargs): + """ + READ_NEURALYNX_NTS reads spike timestamps + + Use as + [nts] = read_neuralynx_nts(filename) + [nts] = read_neuralynx_nts(filename, begrecord, endrecord) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neuralynx_nts.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuralynx_nts", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neuralynx_ntt.py b/fieldtrip/__fileio/_read_neuralynx_ntt.py new file mode 100644 index 0000000..a6b60ed --- /dev/null +++ b/fieldtrip/__fileio/_read_neuralynx_ntt.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuralynx_ntt(*args, **kwargs): + """ + READ_NEURALYNX_NTT reads a single tetrode file + + Use as + [ntt] = read_neuralynx_ntt(filename) + [ntt] = read_neuralynx_ntt(filename, begrecord, endrecord) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neuralynx_ntt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuralynx_ntt", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neuralynx_sdma.py b/fieldtrip/__fileio/_read_neuralynx_sdma.py new file mode 100644 index 0000000..da193b5 --- /dev/null +++ b/fieldtrip/__fileio/_read_neuralynx_sdma.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuralynx_sdma(*args, **kwargs): + """ + READ_NEURALYNX_SDMA read specified channels and samples from a Neuralynx splitted DMA dataset + + Use as + [hdr] = read_neuralynx_sdma(dataset) + [dat] = read_neuralynx_sdma(dataset, begsample, endsample, chanindx) + + The splitted DMA dataset is not a formal Neuralynx format, but at + the FCDC we use it in conjunction with SPIKEDOWNSAMPLE. The dataset + directory contains files, one for each channel, each containing a + 8-byte header followed by the binary values for all samples. Commonly + the binary values are represented as int32, but it is possible to use + int16 or other numeric representations. The 8-byte header specifies the + numeric representation and the bitshift that should be applied (in case + of integer representations). + + This function returns the electrophysiological data in AD units + and not in uV. You should look up the details of the headstage and + the Neuralynx amplifier and scale the values accordingly. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neuralynx_sdma.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuralynx_sdma", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neuralynx_ttl.py b/fieldtrip/__fileio/_read_neuralynx_ttl.py new file mode 100644 index 0000000..c0e4857 --- /dev/null +++ b/fieldtrip/__fileio/_read_neuralynx_ttl.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuralynx_ttl(*args, **kwargs): + """ + READ_NEURALYNX_TTL reads the Parallel_in values from a *.ttl file + + Use as + [dat] = read_neuralynx_ttl(filename, begsample, endsample); + + The *.ttl file is not a formal Neuralynx file format, but at the + F.C. Donders Centre we use it in conjunction with Neuralynx and + SPIKEDOWNSAMPLE. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neuralynx_ttl.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuralynx_ttl", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neuromag_eve.py b/fieldtrip/__fileio/_read_neuromag_eve.py new file mode 100644 index 0000000..1f88ba8 --- /dev/null +++ b/fieldtrip/__fileio/_read_neuromag_eve.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuromag_eve(*args, **kwargs): + """ + READ_NEUROMAG_EVE imports events from the *.eve marker file that can accompany a + *.fif dataset. + + Use as + [smp, tim, val3, val4] = read_neuromag_eve(filename) + + Column one is the sample number. Column two is the time. Column three is is most + cases always zero, but is useful when you need to mark a segment rather than a + time point. Column four value is the event type you assign, i.e. the value of + the trigger. + + The recording of the data to disk may start later than the actual data + acquisition. This is represented in hdr.orig.raw.first_samp. This potential + offset needs to be taken into acocunt when combining it with the data from the + file on disk. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neuromag_eve.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuromag_eve", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neuromag_hc.py b/fieldtrip/__fileio/_read_neuromag_hc.py new file mode 100644 index 0000000..92cdcbf --- /dev/null +++ b/fieldtrip/__fileio/_read_neuromag_hc.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuromag_hc(*args, **kwargs): + """ + READ_NEUROMAG_HC extracts the MEG headcoil marker positions from a neuromag + fif file or from the FieldTrip buffer + + the definition of head coordinates is according to CTF standard: + - Origin: Intersection of the line through LPA and RPA and a line orthogonal + to L passing through the nasion + - X-axis from the origin towards the RPA point (exactly through) + - Y-axis from the origin towards the nasion (exactly through) + - Z-axis from the origin upwards orthogonal to the XY-plane + + hc = read_neuromag_hc(filename) + + returns a structure with the following fields + hc.dewar.nas marker positions relative to dewar + hc.dewar.lpa + hc.dewar.rpa + hc.head.nas marker positions relative to head (measured) + hc.head.lpa + hc.head.rpa + hc.standard.nas marker positions relative to head (expected) + hc.standard.lpa + hc.standard.rpa + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neuromag_hc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuromag_hc", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neuromag_headpos.py b/fieldtrip/__fileio/_read_neuromag_headpos.py new file mode 100644 index 0000000..2bb617b --- /dev/null +++ b/fieldtrip/__fileio/_read_neuromag_headpos.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuromag_headpos(*args, **kwargs): + """ + READ_NEUROMAG_HEADPOS reads head position information from file. The file + contains information about Time, Quaternions (q1-q6), goodness of + fit (g-value) and error. + Time q1 q2 q3 q4 q5 q6 g-value error + + data = read_neuromag_headpos(filename) + + where the returned structure data has the fields + data.data Contains the numeric values + data.textdata Contains the Column name + data.coldata Contains the Column name + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neuromag_headpos.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuromag_headpos", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neuromag_maxfilterlog.py b/fieldtrip/__fileio/_read_neuromag_maxfilterlog.py new file mode 100644 index 0000000..2f1c8e8 --- /dev/null +++ b/fieldtrip/__fileio/_read_neuromag_maxfilterlog.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuromag_maxfilterlog(*args, **kwargs): + """ + READ_NEUROMAG_MAXFILTERLOG reads the ascii logfile that is produced by MaxFilter + + Use as + log = read_neuromag_maxfilterlog(filename) + + See also READ_NEUROMAG_EVE, READ_NEUROMAG_HC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neuromag_maxfilterlog.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuromag_maxfilterlog", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neuroshare.py b/fieldtrip/__fileio/_read_neuroshare.py new file mode 100644 index 0000000..1c16072 --- /dev/null +++ b/fieldtrip/__fileio/_read_neuroshare.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def _read_neuroshare(*args, **kwargs): + """ + READ_NEUROSHARE reads header information or data from any file format + supported by Neuroshare. The file can contain event timestamps, spike + timestamps and waveforms, and continuous (analog) variable data. + + Use as: + hdr = read_neuroshare(filename, ...) + dat = read_neuroshare(filename, ...) + + Optional input arguments should be specified in key-value pairs and may include: + 'dataformat' = string + 'readevent' = 'yes' or 'no' (default) + 'readspike' = 'yes' or 'no' (default) + 'readanalog' = 'yes' or 'no' (default) + 'chanindx' = list with channel indices to read + 'begsample = first sample to read + 'endsample = last sample to read + + NEUROSHARE: http://www.neuroshare.org is a site created to support the + collaborative development of open library and data file format + specifications for neurophysiology and distribute open-source data + handling software tools for neuroscientists. + + Note that this is a test version, WINDOWS only + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neuroshare.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neuroshare", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neurosim_evolution.py b/fieldtrip/__fileio/_read_neurosim_evolution.py new file mode 100644 index 0000000..210f4f3 --- /dev/null +++ b/fieldtrip/__fileio/_read_neurosim_evolution.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _read_neurosim_evolution(*args, **kwargs): + """ + READ_NEUROSIM_EVOLUTION reads the "evolution" file that is written + by Jan van der Eerden's NeuroSim software. When a directory is used + as input, the default filename 'evolution' is read. + + Use as + [hdr, dat] = read_neurosim_evolution(filename, ...) + where additional options should come in key-value pairs and can include + Vonly = 0 or 1, only give the membrane potentials as output + headerOnly = 0 or 1, only read the header information (skip the data), automatically set to 1 if nargout==1 + + See also FT_READ_HEADER, FT_READ_DATA + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neurosim_evolution.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neurosim_evolution", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neurosim_signals.py b/fieldtrip/__fileio/_read_neurosim_signals.py new file mode 100644 index 0000000..fd37cdf --- /dev/null +++ b/fieldtrip/__fileio/_read_neurosim_signals.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _read_neurosim_signals(*args, **kwargs): + """ + READ_NEUROSIM_SIGNALS reads the "signals" file that is written by Jan + van der Eerden's NeuroSim software. + + See also FT_READ_HEADER, FT_READ_DATA + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neurosim_signals.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neurosim_signals", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_neurosim_spikes.py b/fieldtrip/__fileio/_read_neurosim_spikes.py new file mode 100644 index 0000000..afefbcd --- /dev/null +++ b/fieldtrip/__fileio/_read_neurosim_spikes.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _read_neurosim_spikes(*args, **kwargs): + """ + READ_NEUROSIM_SPIKES reads the "spikes" file that is written by Jan + van der Eerden's NeuroSim software. The output is represented in a + structure that is consistent with the FieldTrip spike representation. + + OUTPUT + spike: A FieldTrip raw spike structure (including header information + in spike.hdr + + INPUT + filename: name of spike files or directory (this will default to using + the 'spikes' file in the directory, the default neurosim naming + convention) + + headerOnly: (OPTIONAL) if this is true, only the header information is + given directly as output, the spike data itself is not read in. (used by + FT_READ_HEADER) + + See also FT_READ_SPIKE, FT_DATATYPE_SPIKE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_neurosim_spikes.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_neurosim_spikes", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_nex5.py b/fieldtrip/__fileio/_read_nex5.py new file mode 100644 index 0000000..bf4c651 --- /dev/null +++ b/fieldtrip/__fileio/_read_nex5.py @@ -0,0 +1,76 @@ +from fieldtrip._runtime import Runtime + + +def _read_nex5(*args, **kwargs): + """ + READ_NEX5 reads header or data from a Nex Technologies *.nex5 file, + which is a file containing action-potential (spike) timestamps and waveforms + (spike channels), event timestamps (event channels), and continuous + variable data (continuous A/D channels). + + LFP and spike waveform data that is returned by this function is + expressed in microVolt. + + Use as + [hdr] = read_nex5(filename) + [dat] = read_nex5(filename, ...) + [dat1, dat2, dat3, hdr] = read_nex5(filename, ...) + + Optional arguments should be specified in key-value pairs and can be + header structure with header information + feedback 0 or 1 + tsonly 0 or 1, read only the timestamps and not the waveforms + channel number, or list of numbers (that will result in multiple outputs) + begsample number (for continuous only) + endsample number (for continuous only) + + See also READ_NEX5_HEADER + + Copyright (C) 2020 Robert Oostenveld, Alex Kirillov + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + + $Id$ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_nex5.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_nex5", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_nex5_event.py b/fieldtrip/__fileio/_read_nex5_event.py new file mode 100644 index 0000000..10b02c1 --- /dev/null +++ b/fieldtrip/__fileio/_read_nex5_event.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def _read_nex5_event(*args, **kwargs): + """ + READ_NEX5_EVENT for Nex Technologies *.nex5 file, supports NEX5 variable types: + marker, interval, and event + + Use as + [event] = read_nex5_event(filename) + + The event.type used to select events in ft_trialfun_general is the + variable name from the NEX file (hdr.varheader.name - not to be confused + with hdr.varheader.type). + + The sample numbers returned in event.sample correspond with the + timestamps, correcting for the difference in sampling frequency in the + continuous LFP channels and the system sampling frequency. Assuming 40kHz + sampling frequency for the system and 1kHz for the LFP channels, it is + event.sample = timestamp / (40000/1000); + If there are no continuous variables in the file, the system sampling + frequency is used throughout, so + event.sample = timestamp; + + See also READ_NEX5_HEADER, READ_NEX5 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_nex5_event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_nex5_event", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_nex5_header.py b/fieldtrip/__fileio/_read_nex5_header.py new file mode 100644 index 0000000..562be6f --- /dev/null +++ b/fieldtrip/__fileio/_read_nex5_header.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _read_nex5_header(*args, **kwargs): + """ + READ_NEX5_HEADER for Nex Technologies *.nex5 file + + Use as + [hdr] = read_nex5_header(filename) + + See also RAD_NEX5_DATA, READ_NEX5_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_nex5_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_nex5_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_nex_data.py b/fieldtrip/__fileio/_read_nex_data.py new file mode 100644 index 0000000..56073d8 --- /dev/null +++ b/fieldtrip/__fileio/_read_nex_data.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _read_nex_data(*args, **kwargs): + """ + READ_NEX_DATA for Plexon *.nex file + + Use as + [dat] = read_nex_data(filename, hdr, begsample, endsample, chanindx) + + See also READ_NEX_HEADER, READ_NEX_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_nex_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_nex_data", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_nex_event.py b/fieldtrip/__fileio/_read_nex_event.py new file mode 100644 index 0000000..14bf550 --- /dev/null +++ b/fieldtrip/__fileio/_read_nex_event.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def _read_nex_event(*args, **kwargs): + """ + READ_NEX_EVENT for Plexon *.nex file, supports NEX variable types: + marker, interval, and event + + Use as + [event] = read_nex_event(filename) + + The event.type used to select events in ft_trialfun_general is the + variable name from the NEX file (hdr.varheader.name - not to be confused + with hdr.varheader.type). + + The sample numbers returned in event.sample correspond with the + timestamps, correcting for the difference in sampling frequency in the + continuous LFP channels and the system sampling frequency. Assuming 40kHz + sampling frequency for the system and 1kHz for the LFP channels, it is + event.sample = timestamp / (40000/1000); + If there are no continuous variables in the file, the system sampling + frequency is used throughout, so + event.sample = timestamp; + + See also READ_NEX_HEADER, READ_NEX_DATA + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_nex_event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_nex_event", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_nex_header.py b/fieldtrip/__fileio/_read_nex_header.py new file mode 100644 index 0000000..825f18a --- /dev/null +++ b/fieldtrip/__fileio/_read_nex_header.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _read_nex_header(*args, **kwargs): + """ + READ_NEX_HEADER for Plexon *.nex file + + Use as + [hdr] = read_nex_header(filename) + + See also RAD_NEX_DATA, READ_NEX_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_nex_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_nex_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_nexstim_event.py b/fieldtrip/__fileio/_read_nexstim_event.py new file mode 100644 index 0000000..505b9be --- /dev/null +++ b/fieldtrip/__fileio/_read_nexstim_event.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _read_nexstim_event(*args, **kwargs): + """ + Use as + [event] = read_nexstim_event(filename) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_nexstim_event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_nexstim_event", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_nexstim_nxe.py b/fieldtrip/__fileio/_read_nexstim_nxe.py new file mode 100644 index 0000000..16109b3 --- /dev/null +++ b/fieldtrip/__fileio/_read_nexstim_nxe.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _read_nexstim_nxe(*args, **kwargs): + """ + READ_NEXSTIM_NXE reads specified samples from a NXE continuous datafile + + Use as + [hdr] = read_nexstim_nxe(filename) + where + filename name of the datafile, including the .bdf extension + This returns a header structure with the following elements + hdr.Fs sampling frequency + hdr.nChans number of channels + hdr.nSamples number of samples per trial + hdr.nSamplesPre number of pre-trigger samples in each trial + hdr.nTrials number of trials + hdr.label cell-array with labels of each channel + + Or use as + [dat] = read_nexstim_nxe(filename, begsample, endsample, chanindx) + where + filename name of the datafile, including the .nxe extension + begsample index of the first sample to read + endsample index of the last sample to read + chanindx index of channels to read (optional, default is all) + This returns a Nchans X Nsamples data matrix + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_nexstim_nxe.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_nexstim_nxe", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_nifti2_hdr.py b/fieldtrip/__fileio/_read_nifti2_hdr.py new file mode 100644 index 0000000..929137a --- /dev/null +++ b/fieldtrip/__fileio/_read_nifti2_hdr.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _read_nifti2_hdr(*args, **kwargs): + """ + READ_NIFTI2_HDR + + Use as + [hdr] = read_nifti2_hdr(filename) + where + filename = string + + This implements the format as described at + http://www.nitrc.org/forum/forum.php?thread_id=2148&forum_id=1941 + + Please note that it is different from the suggested format described here + http://www.nitrc.org/forum/forum.php?thread_id=2070&forum_id=1941 + and + https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2011-February/017482.html + Notably, the unused fields have been removed and the size has been + reduced from 560 to 540 bytes. + + See also WRITE_NIFTI_HDR, READ_CIFTI, WRITE_CIFTI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_nifti2_hdr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_nifti2_hdr", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_nihonkohden_m00.py b/fieldtrip/__fileio/_read_nihonkohden_m00.py new file mode 100644 index 0000000..013c2d1 --- /dev/null +++ b/fieldtrip/__fileio/_read_nihonkohden_m00.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _read_nihonkohden_m00(*args, **kwargs): + """ + READ_NIHONKOHDEN_M00 reads the header and data from a file in the Nihon Kohden *.m00 format. + This implementation is an adaptation of convert_nkascii2mat.m and get_nkheader.m written + by Timothy Ellmore, see https://openwetware.org/wiki/Beauchamp:AnalyzeEEGinMatlab. + + Use as + [hdr, dat] = read_nihonkohden_m00(filename) + + This returns a FieldTrip compatible header structure and the data matrix. + + See also FT_READ_HEADER, FT_READ_DATA + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_nihonkohden_m00.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_nihonkohden_m00", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_nimh_cortex.py b/fieldtrip/__fileio/_read_nimh_cortex.py new file mode 100644 index 0000000..1bc1a8a --- /dev/null +++ b/fieldtrip/__fileio/_read_nimh_cortex.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _read_nimh_cortex(*args, **kwargs): + """ + READ_NIMH_CORTEX + + Use as + cortex = read_nimh_cortex(filename, ...) + + Optional input arguments should come in key-value pairs and may + include + begtrial = number (default = 1) + endtrial = number (default = inf) + epp = read the EPP data, 'yes' or 'no' (default = 'yes') + eog = read the EOG data, 'yes' or 'no' (default = 'yes') + feedback = display the progress on the screen, 'yes' or 'no' (default = 'no') + + The output is a structure array with one structure for every trial that was read. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_nimh_cortex.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_nimh_cortex", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_nmc_archive_k_data.py b/fieldtrip/__fileio/_read_nmc_archive_k_data.py new file mode 100644 index 0000000..f65a4e3 --- /dev/null +++ b/fieldtrip/__fileio/_read_nmc_archive_k_data.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _read_nmc_archive_k_data(*args, **kwargs): + """ + READ_NMC_ARCHIVE_K_DATA reads data from nmc_archive_k datasets + + Used in read_data as + dat = read_nmc_archive_k_data(datafile, hdr, begsample, endsample, channelsel); + + + This function specifically only reads data from one of the archived + datasets of the Neurophysiological Mechanisms of Cognition group of + Eric Maris, at the Donders Centre for Cognition, Radboud University, + Nijmegen, the Netherlands. It should not be used for any other data + format. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_nmc_archive_k_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_nmc_archive_k_data", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_nmc_archive_k_event.py b/fieldtrip/__fileio/_read_nmc_archive_k_event.py new file mode 100644 index 0000000..67bb4ca --- /dev/null +++ b/fieldtrip/__fileio/_read_nmc_archive_k_event.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _read_nmc_archive_k_event(*args, **kwargs): + """ + READ_NMC_ARCHIVE_K_EVENT extracts event-data from nmc_archive_k datasets + + Use as + event = read_nmc_archive_k_event(eventfile) + + + This function specifically only reads data from one of the archived + datasets of the Neurophysiological Mechanisms of Cognition group of + Eric Maris, at the Donders Centre for Cognition, Radboud University, + Nijmegen, the Netherlands. It should not be used for any other data + format. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_nmc_archive_k_event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_nmc_archive_k_event", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_nmc_archive_k_hdr.py b/fieldtrip/__fileio/_read_nmc_archive_k_hdr.py new file mode 100644 index 0000000..3df2601 --- /dev/null +++ b/fieldtrip/__fileio/_read_nmc_archive_k_hdr.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _read_nmc_archive_k_hdr(*args, **kwargs): + """ + READ_NMC_ARCHIVE_K_HDR extracts 'header-data' for nmc_archive_k datasets + + Use as + hdr = read_nmc_archive_k_hdr(paramfile) + + + This function specifically only reads data from one of the archived + datasets of the Neurophysiological Mechanisms of Cognition group of + Eric Maris, at the Donders Centre for Cognition, Radboud University, + Nijmegen, the Netherlands. It should not be used for any other data + format. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_nmc_archive_k_hdr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_nmc_archive_k_hdr", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ns_avg.py b/fieldtrip/__fileio/_read_ns_avg.py new file mode 100644 index 0000000..4a20261 --- /dev/null +++ b/fieldtrip/__fileio/_read_ns_avg.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _read_ns_avg(*args, **kwargs): + """ + READ_NS_AVG read a NeuroScan 3.x or 4.x AVG File + + [avg] = read_ns_avg(filename) + + The output data structure avg has the fields: + avg.data - ERP signal in uV (Nchan x Npnt) + avg.nsweeps - number of accepted trials/sweeps in avg + avg.variance - variance of the signal (Nchan x Npnt) + avg.label - electrode labels + avg.nchan - number of channels + avg.npnt - number of samplepoints in ERP waveform + avg.rate - sample rate (Hz) + avg.time - time for each sample OR + avg.frequency - frequency for each sample + hdr.domain - flag indicating time (0) or frequency (1) domain + avg.xmin - prestimulus epoch start (e.g., -100 msec) + avg.xmax - poststimulus epoch end (e.g., 900 msec) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ns_avg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ns_avg", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ns_eeg.py b/fieldtrip/__fileio/_read_ns_eeg.py new file mode 100644 index 0000000..13fe6b9 --- /dev/null +++ b/fieldtrip/__fileio/_read_ns_eeg.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _read_ns_eeg(*args, **kwargs): + """ + READ_NS_EEG read a NeuroScan 3.x or 4.x EEG File + + [eeg] = read_ns_eeg(filename, epoch) + + filename input Neuroscan .eeg file (version 3.x) + epoch which epoch to read (default is all) + + The output data structure eeg has the fields: + eeg.data(..) - epoch signal in uV (size: Nepoch x Nchan x Npnt) + and + eeg.label - electrode labels + eeg.nchan - number of channels + eeg.npnt - number of samplepoints in ERP waveform + eeg.time - time for each sample + eeg.rate - sample rate (Hz) + eeg.xmin - prestimulus epoch start (e.g., -100 msec) + eeg.xmax - poststimulus epoch end (e.g., 900 msec) + eeg.nsweeps - number of accepted trials/sweeps + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ns_eeg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ns_eeg", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ns_hdr.py b/fieldtrip/__fileio/_read_ns_hdr.py new file mode 100644 index 0000000..3f4da4d --- /dev/null +++ b/fieldtrip/__fileio/_read_ns_hdr.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _read_ns_hdr(*args, **kwargs): + """ + READ_NS_HDR read the header from a NeuroScan 3.x or 4.x AVG/EEG/CNT File + + [hdr] = read_ns_hdr(filename) + + The output data structure hdr has the fields: + hdr.label - electrode labels + hdr.nchan - number of channels + hdr.npnt - number of samplepoints in ERP waveform + hdr.rate - sample rate (Hz) + hdr.xmin - prestimulus epoch start (e.g., -100 msec) + hdr.xmax - poststimulus epoch end (e.g., 900 msec) + hdr.nsweeps - number of accepted trials/sweeps + hdr.domain - time (0) or frequency (1) domain + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ns_hdr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ns_hdr", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_nwb_spike.py b/fieldtrip/__fileio/_read_nwb_spike.py new file mode 100644 index 0000000..247c857 --- /dev/null +++ b/fieldtrip/__fileio/_read_nwb_spike.py @@ -0,0 +1,61 @@ +from fieldtrip._runtime import Runtime + + +def _read_nwb_spike(*args, **kwargs): + """ + READ_NWB_SPIKE reads spike timestamps and waveforms (if present-not currently supported) + from NWB files and converts them to fieldtrip spike data format. + + INPUT: filename = (Path and) name of the .nwb file + + OUTPUT: spike = FieldTrip spike structure + + Notes: + This function was written during the NWB hackathon May 2020. It is + based on example data in .nwb format schema version 2.0.1: + https://gui.dandiarchive.org/#/file-browser/folder/5e6eb2b776569eb93f451f8d + + NWB is a complicated data format and under active development. We + recommend to use the latest stable release of MatNWB from the github + page: https://github.com/NeurodataWithoutBorders/matnwb/releases + and familiarize yourself with the use of generateCore(): + https://neurodatawithoutborders.github.io/matnwb + + With util.getSchemaVersion(file.nwb) the nwb file version can be + querried. It may be necessary to replace the files in ..\matnwb\nwb-schema\core + with the files from the nwb-schema version the file was created in from + ..\nwb-schema\core. + Nwb-schemas can be obtained from here: + https://github.com/NeurodataWithoutBorders/nwb-schema/releases + + ----- + Latest change: 01/06/2020 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_nwb_spike.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_nwb_spike", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_off.py b/fieldtrip/__fileio/_read_off.py new file mode 100644 index 0000000..920376f --- /dev/null +++ b/fieldtrip/__fileio/_read_off.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _read_off(*args, **kwargs): + """ + READ_OFF reads vertices and triangles from a OFF format triangulation file + + [pnt, tri] = read_off(filename) + + See also READ_TRI, READ_BND + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_off.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_off", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_plexon_ddt.py b/fieldtrip/__fileio/_read_plexon_ddt.py new file mode 100644 index 0000000..41439c9 --- /dev/null +++ b/fieldtrip/__fileio/_read_plexon_ddt.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _read_plexon_ddt(*args, **kwargs): + """ + READ_PLEXON_DDT reads header or data from a Plexon *.ddt file, + which is a Plexon continuous data file optimized for continuous + (streaming) recording where every channel is continuously recorded + without gaps and the recording includes any dead time between spikes. + + Use as + [hdr] = read_plexon_ddt(filename) + [dat] = read_plexon_ddt(filename, begsample, endsample) + + samples start counting at 1 + returned values are in mV + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_plexon_ddt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_plexon_ddt", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_plexon_ds.py b/fieldtrip/__fileio/_read_plexon_ds.py new file mode 100644 index 0000000..46da76b --- /dev/null +++ b/fieldtrip/__fileio/_read_plexon_ds.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _read_plexon_ds(*args, **kwargs): + """ + READ_PLEXON_DS reads multiple single-channel Plexon files that are + all contained in a single directory. Each file is treated as a single + channel of a combined multi-channel dataset. + + Use as + hdr = read_plexon_ds(dirname) + dat = read_plexon_ds(dirname, hdr, begsample, endsample, chanindx) + + See also READ_PLEXON_NEX, READ_PLEXON_PLX, READ_PLEXON_DDT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_plexon_ds.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_plexon_ds", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_plexon_nex.py b/fieldtrip/__fileio/_read_plexon_nex.py new file mode 100644 index 0000000..a8e0111 --- /dev/null +++ b/fieldtrip/__fileio/_read_plexon_nex.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _read_plexon_nex(*args, **kwargs): + """ + READ_PLEXON_NEX reads header or data from a Plexon *.nex file, which + is a file containing action-potential (spike) timestamps and waveforms + (spike channels), event timestamps (event channels), and continuous + variable data (continuous A/D channels). + + LFP and spike waveform data that is returned by this function is + expressed in microVolt. + + Use as + [hdr] = read_plexon_nex(filename) + [dat] = read_plexon_nex(filename, ...) + [dat1, dat2, dat3, hdr] = read_plexon_nex(filename, ...) + + Optional arguments should be specified in key-value pairs and can be + header structure with header information + feedback 0 or 1 + tsonly 0 or 1, read only the timestamps and not the waveforms + channel number, or list of numbers (that will result in multiple outputs) + begsample number (for continuous only) + endsample number (for continuous only) + + See also READ_PLEXON_PLX, READ_PLEXON_DDT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_plexon_nex.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_plexon_nex", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_plexon_plx.py b/fieldtrip/__fileio/_read_plexon_plx.py new file mode 100644 index 0000000..c67641f --- /dev/null +++ b/fieldtrip/__fileio/_read_plexon_plx.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _read_plexon_plx(*args, **kwargs): + """ + READ_PLEXON_PLX reads header or data from a Plexon *.plx file, which + is a file containing action-potential (spike) timestamps and waveforms + (spike channels), event timestamps (event channels), and continuous + variable data (continuous A/D channels). + + Use as + [hdr] = read_plexon_plx(filename) + [dat] = read_plexon_plx(filename, ...) + [dat1, dat2, dat3, hdr] = read_plexon_plx(filename, ...) + + Optional input arguments should be specified in key-value pairs + 'header' = structure with header information + 'memmap' = 0 or 1 + 'feedback' = 0 or 1 + 'ChannelIndex' = number, or list of numbers (that will result in multiple outputs) + 'SlowChannelIndex' = number, or list of numbers (that will result in multiple outputs) + 'EventIndex' = number, or list of numbers (that will result in multiple outputs) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_plexon_plx.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_plexon_plx", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ply.py b/fieldtrip/__fileio/_read_ply.py new file mode 100644 index 0000000..a5606c4 --- /dev/null +++ b/fieldtrip/__fileio/_read_ply.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _read_ply(*args, **kwargs): + """ + READ_PLY reads triangles, tetrahedrons or hexahedrons from a Stanford *.ply file + + Use as + [vert, face, prop, face_prop] = read_ply(filename) + + Documentation is provided on + http://paulbourke.net/dataformats/ply/ + http://en.wikipedia.org/wiki/PLY_(file_format) + + See also WRITE_PLY, WRITE_VTK, READ_VTK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ply.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ply", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_polhemus_fil.py b/fieldtrip/__fileio/_read_polhemus_fil.py new file mode 100644 index 0000000..c657f35 --- /dev/null +++ b/fieldtrip/__fileio/_read_polhemus_fil.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def _read_polhemus_fil(*args, **kwargs): + """ + Reads Polhemus files: + either sensor file or headshape file or both + + FORMAT [fid, sens, label] = read_polhemus_fil(Fname_pol,skip) + Input: + Fname_pol - Polhemus ASCII file containing sensor locations (cm) + (headshape can also be considered here instead of sensors) + skip - first channels to skip + + Output: + fid - fiducial locations (mm) in rows + sens - sensor/headshape locations (mm) in rows + label - labels of the fiducials + + IMPORTANT: Note that Polhemus data files should be -ASCII files with + extension .pol + It is assumed that the .pol file contains the location (cm) of fiducials + (sampled twice), possibly followed by some additional named points and + then unnamed location of the sensors. In some instances the first + few channel locations may pertain to reference channels; the skip + variable allows these to be skipped if necessary. The fiducial locations + are flaged with the strings 'NZ','LE' and 'RE'; indicating the Nasion, + left and right eare respectively. + _________________________________________________________________________ + Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_polhemus_fil.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_polhemus_fil", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_polhemus_pos.py b/fieldtrip/__fileio/_read_polhemus_pos.py new file mode 100644 index 0000000..684005e --- /dev/null +++ b/fieldtrip/__fileio/_read_polhemus_pos.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _read_polhemus_pos(*args, **kwargs): + """ + READ_POLHEMUS_POS reads electrode positions measured with the Polhemus tracker in + one of the EEG labs at the DCCN. The software used with the Polhemus is from CTF. + + Use as: + [elec] = read_polhemus_pos(filename) + + This returns an electrode structure with + elec.label cell-array with electrode labels (strings) + elec.pnt position of each electrode + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_polhemus_pos.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_polhemus_pos", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_presentation_log.py b/fieldtrip/__fileio/_read_presentation_log.py new file mode 100644 index 0000000..882f4bd --- /dev/null +++ b/fieldtrip/__fileio/_read_presentation_log.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _read_presentation_log(*args, **kwargs): + """ + READ_PRESENTATION_LOG reads a NBS Presentation scenario log file and + represents it as a FieldTrip event structure. + + See also FT_READ_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_presentation_log.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_presentation_log", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ricoh_data.py b/fieldtrip/__fileio/_read_ricoh_data.py new file mode 100644 index 0000000..bfd80c0 --- /dev/null +++ b/fieldtrip/__fileio/_read_ricoh_data.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _read_ricoh_data(*args, **kwargs): + """ + function [dat] = read_ricoh_data(filename, hdr, begsample, endsample, chanindx) + + READ_RICOH_DATA reads continuous or averaged MEG data + generated by the RICOH MEG system and software, + and allows the data to be used in FieldTrip. + + Use as + [dat] = read_ricoh_data(filename, hdr, begsample, endsample, chanindx) + + This is a wrapper function around the function getRData + + See also READ_RICOH_HEADER, READ_RICOH_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ricoh_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ricoh_data", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ricoh_event.py b/fieldtrip/__fileio/_read_ricoh_event.py new file mode 100644 index 0000000..f640a49 --- /dev/null +++ b/fieldtrip/__fileio/_read_ricoh_event.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _read_ricoh_event(*args, **kwargs): + """ + READ_RICOH_EVENT reads event information from continuous, + epoched or averaged MEG data that has been generated by the Ricoh + MEG system and software and allows those events to be used in + combination with FieldTrip. + + Use as + [event] = read_ricoh_event(filename) + + See also READ_RICOH_HEADER, READ_RICOH_DATA + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ricoh_event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ricoh_event", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_ricoh_header.py b/fieldtrip/__fileio/_read_ricoh_header.py new file mode 100644 index 0000000..d766266 --- /dev/null +++ b/fieldtrip/__fileio/_read_ricoh_header.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _read_ricoh_header(*args, **kwargs): + """ + READ_RICOH_HEADER reads the header information from continuous + or averaged MEG data generated by the Ricoh MEG system and software + and allows the data to be used in FieldTrip. + + Use as + [hdr] = read_ricoh_header(filename) + + This is a wrapper function around the functions + getRHdrSystem + getRHdrChannel + getRHdrAcqCond + getRHdrCoregist + getRHdrDigitize + getRHdrSource + + See also READ_RICOH_DATA, READ_RICOH_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_ricoh_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ricoh_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_sbin_data.py b/fieldtrip/__fileio/_read_sbin_data.py new file mode 100644 index 0000000..c09ec86 --- /dev/null +++ b/fieldtrip/__fileio/_read_sbin_data.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _read_sbin_data(*args, **kwargs): + """ + READ_SBIN_DATA reads the data from an EGI segmented simple binary format file + + Use as + [trialData] = read_sbin_data(filename, hdr, begtrial, endtrial, chanindx) + with + filename name of the input file + hdr header structure, see FT_READ_HEADER + begtrial first trial to read, mutually exclusive with begsample+endsample + endtrial last trial to read, mutually exclusive with begsample+endsample + chanindx list with channel indices to read + + This function returns a 3-D matrix of size Nchans*Nsamples*Ntrials. + _______________________________________________________________________ + + + Modified from EGI's readEGLY.m with permission 2008-03-31 Joseph Dien + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_sbin_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_sbin_data", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_sbin_events.py b/fieldtrip/__fileio/_read_sbin_events.py new file mode 100644 index 0000000..b1914e9 --- /dev/null +++ b/fieldtrip/__fileio/_read_sbin_events.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _read_sbin_events(*args, **kwargs): + """ + READ_SBIN_EVENTS reads the events information from an EGI segmented simple binary format file + + Use as + [EventCodes, segHdr, eventData] = read_sbin_events(filename) + with + EventCodes - if NEvent (from header_array) != 0, then array of 4-char event names + segHdr - condition codes and time stamps for each segment + eventData - if NEvent != 0 then event state for each sample, else 'none' + and + filename - the name of the data file + _______________________________________________________________________ + + + Modified from EGI's readEGLY.m with permission 2008-03-31 Joseph Dien + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_sbin_events.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_sbin_events", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_sbin_header.py b/fieldtrip/__fileio/_read_sbin_header.py new file mode 100644 index 0000000..f665d82 --- /dev/null +++ b/fieldtrip/__fileio/_read_sbin_header.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def _read_sbin_header(*args, **kwargs): + """ + READ_SBIN_HEADER reads the header information from an EGI segmented simple binary format file + + Use as + [header_array, CateNames, CatLengths, preBaseline] = read_sbin_header(filename) + with + header_array - differs between versions, read code for details + CateNames - category names + CatLengths - length of category names + preBaseline - number of samples in the baseline prior to the baseline event + and + filename - the name of the data file + + Since there is no unique event code for the segmentation event, and hence the baseline period, + the first event code in the list will be assumed to be the segmentation event. + NetStation itself simply ignores possible baseline information when importing simple binary files. + _______________________________________________________________________ + + + Modified from EGI's readEGLY.m with permission 2008-03-31 Joseph Dien + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_sbin_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_sbin_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_serial_event.py b/fieldtrip/__fileio/_read_serial_event.py new file mode 100644 index 0000000..e1b0b34 --- /dev/null +++ b/fieldtrip/__fileio/_read_serial_event.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _read_serial_event(*args, **kwargs): + """ + READ_SERIAL_EVENT + + changed A.Hadjipapas 2010 + + The only thing transmitted is the event.value (no info about sample) but it works + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_serial_event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_serial_event", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_shm_data.py b/fieldtrip/__fileio/_read_shm_data.py new file mode 100644 index 0000000..b29cea7 --- /dev/null +++ b/fieldtrip/__fileio/_read_shm_data.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _read_shm_data(*args, **kwargs): + """ + READ_SHM_DATA reads the data in real-time from shared memory + this is a helper function for READ_DATA + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_shm_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_shm_data", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_shm_event.py b/fieldtrip/__fileio/_read_shm_event.py new file mode 100644 index 0000000..73935cf --- /dev/null +++ b/fieldtrip/__fileio/_read_shm_event.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _read_shm_event(*args, **kwargs): + """ + READ_SHM_EVENT reads the events in real-time from shared memory + this is a helper function for READ_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_shm_event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_shm_event", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_shm_header.py b/fieldtrip/__fileio/_read_shm_header.py new file mode 100644 index 0000000..8e01e31 --- /dev/null +++ b/fieldtrip/__fileio/_read_shm_header.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _read_shm_header(*args, **kwargs): + """ + READ_SHM_HEADER reads the header in real-time from shared memory + this is a helper function for FT_READ_HEADER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_shm_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_shm_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_smi_txt.py b/fieldtrip/__fileio/_read_smi_txt.py new file mode 100644 index 0000000..2c7def6 --- /dev/null +++ b/fieldtrip/__fileio/_read_smi_txt.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _read_smi_txt(*args, **kwargs): + """ + READ_SMI_TXT reads the header information, input triggers, messages + and all data points from an SensoMotoric Instruments (SMI) *.txt file + + Use as + smi = read_smi_txt(filename) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_smi_txt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_smi_txt", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_spike6mat_data.py b/fieldtrip/__fileio/_read_spike6mat_data.py new file mode 100644 index 0000000..90545cb --- /dev/null +++ b/fieldtrip/__fileio/_read_spike6mat_data.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def _read_spike6mat_data(*args, **kwargs): + """ + read_spike6mat_data() - read Matlab files exported from Spike 6 + + Usage: + >> header = read_spike6mat_data(filename, varargin); + + Inputs: + filename - [string] file name + + Optional inputs: + 'begsample' first sample to read + 'endsample' last sample to read + 'chanindx' - list with channel indices to read + 'header' - FILEIO structure header + + Outputs: + dat - data over the specified range + _______________________________________________________________________ + Copyright (C) 2008 Institute of Neurology, UCL + Vladimir Litvak + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_spike6mat_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_spike6mat_data", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_spike6mat_header.py b/fieldtrip/__fileio/_read_spike6mat_header.py new file mode 100644 index 0000000..93e5a1c --- /dev/null +++ b/fieldtrip/__fileio/_read_spike6mat_header.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _read_spike6mat_header(*args, **kwargs): + """ + read_spike6mat_header() - read Matlab files exported from Spike 6 + + Usage: + >> header = read_spike6mat_header(filename); + + Inputs: + filename - [string] file name + + Outputs: + header - FILEIO toolbox type structure + _______________________________________________________________________ + Copyright (C) 2008 Institute of Neurology, UCL + Vladimir Litvak + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_spike6mat_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_spike6mat_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_spmeeg_data.py b/fieldtrip/__fileio/_read_spmeeg_data.py new file mode 100644 index 0000000..9171e58 --- /dev/null +++ b/fieldtrip/__fileio/_read_spmeeg_data.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def _read_spmeeg_data(*args, **kwargs): + """ + read_spmeeg_data() - import SPM5 and SPM8 meeg datasets + + Usage: + >> header = read_spmeeg_data(filename, varargin); + + Inputs: + filename - [string] file name + + Optional inputs: + 'begsample' first sample to read + 'endsample' last sample to read + 'chanindx' - list with channel indices to read + 'header' - FILEIO structure header + + Outputs: + dat - data over the specified range + _______________________________________________________________________ + Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging + Vladimir Litvak + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_spmeeg_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_spmeeg_data", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_spmeeg_event.py b/fieldtrip/__fileio/_read_spmeeg_event.py new file mode 100644 index 0000000..155827e --- /dev/null +++ b/fieldtrip/__fileio/_read_spmeeg_event.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _read_spmeeg_event(*args, **kwargs): + """ + read_spmeeg_event() - import evtns from SPM5 and SPM8 meeg datasets + + Usage: + >> header = read_spmeeg_event(filename); + + Inputs: + filename - [string] file name + + Outputs: + event - FILEIO toolbox event structure + _______________________________________________________________________ + Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging + Vladimir Litvak + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_spmeeg_event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_spmeeg_event", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_spmeeg_header.py b/fieldtrip/__fileio/_read_spmeeg_header.py new file mode 100644 index 0000000..ff3906f --- /dev/null +++ b/fieldtrip/__fileio/_read_spmeeg_header.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _read_spmeeg_header(*args, **kwargs): + """ + read_spmeeg_header() - import SPM5 and SPM8 meeg datasets + + Usage: + >> header = read_spmeeg_header(filename); + + Inputs: + filename - [string] file name + + Outputs: + header - FILEIO toolbox type structure + _______________________________________________________________________ + Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging + Vladimir Litvak + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_spmeeg_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_spmeeg_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_stl.py b/fieldtrip/__fileio/_read_stl.py new file mode 100644 index 0000000..e0867db --- /dev/null +++ b/fieldtrip/__fileio/_read_stl.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _read_stl(*args, **kwargs): + """ + READ_STL reads a triangulation from an ascii or binary *.stl file, which + is a file format native to the stereolithography CAD software created by + 3D Systems. + + Use as + [pnt, tri, nrm] = read_stl(filename) + + The format is described at http://en.wikipedia.org/wiki/STL_(file_format) + + See also WRITE_STL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_stl.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_stl", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_tck.py b/fieldtrip/__fileio/_read_tck.py new file mode 100644 index 0000000..46fbfd3 --- /dev/null +++ b/fieldtrip/__fileio/_read_tck.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _read_tck(*args, **kwargs): + """ + READ_TCK reads tractography information from an mrtrix-generated .tck + file. Requires the matlab functions from mrtrix. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_tck.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_tck", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_tdt_sev.py b/fieldtrip/__fileio/_read_tdt_sev.py new file mode 100644 index 0000000..bc8769b --- /dev/null +++ b/fieldtrip/__fileio/_read_tdt_sev.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _read_tdt_sev(*args, **kwargs): + """ + READ_TDT_SEV + + Use as + sev = read_tdt_sev(filename, dtype, begsample, endsample) + + Note: sev files contain raw broadband data that is streamed to the RS4 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_tdt_sev.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_tdt_sev", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_tdt_tbk.py b/fieldtrip/__fileio/_read_tdt_tbk.py new file mode 100644 index 0000000..69811a0 --- /dev/null +++ b/fieldtrip/__fileio/_read_tdt_tbk.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _read_tdt_tbk(*args, **kwargs): + """ + tbk file has block events information and time marks + for efficiently locate event if query by time + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_tdt_tbk.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_tdt_tbk", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_tdt_tdx.py b/fieldtrip/__fileio/_read_tdt_tdx.py new file mode 100644 index 0000000..0d5592f --- /dev/null +++ b/fieldtrip/__fileio/_read_tdt_tdx.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _read_tdt_tdx(*args, **kwargs): + """ + tdx file contains just information about epoc, + is generated after recording if necessary for fast retrieve epoc information + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_tdt_tdx.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_tdt_tdx", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_tdt_tev.py b/fieldtrip/__fileio/_read_tdt_tev.py new file mode 100644 index 0000000..efe3ad1 --- /dev/null +++ b/fieldtrip/__fileio/_read_tdt_tev.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _read_tdt_tev(*args, **kwargs): + """ + READ_TDT_TANK + + Use as + [tev, tsq] = read_tdt_tank(filename) + + Note: + tev file contains event binary data + tev and tsq files work together to get an event's data and attributes + sev files contains streamed binary data + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_tdt_tev.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_tdt_tev", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_tdt_tsq.py b/fieldtrip/__fileio/_read_tdt_tsq.py new file mode 100644 index 0000000..297345d --- /dev/null +++ b/fieldtrip/__fileio/_read_tdt_tsq.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _read_tdt_tsq(*args, **kwargs): + """ + READ_TDT_TSQ reads the headers from a Tucker_Davis_technologies TSQ file + + tsq file is a heap of event headers, which is ?40 byte each, + ordered strictly by time + + Use as + tsq = read_tdt_tsq(filename, begblock, endblock) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_tdt_tsq.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_tdt_tsq", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_tmsi_poly5.py b/fieldtrip/__fileio/_read_tmsi_poly5.py new file mode 100644 index 0000000..dbf735a --- /dev/null +++ b/fieldtrip/__fileio/_read_tmsi_poly5.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _read_tmsi_poly5(*args, **kwargs): + """ + READ_TMSI_POLY5 + + Use as + hdr = read_tmri_poly5(filename) + dat = read_tmsi_poly5(filename, hdr, begblock, endblock) + + This implementation is as closely as possible based on the original "tms_read", + which contains the comments + + Changed on 08-10-2014 by TL, TMSi + - Now supports loading a file from different directory than the script file + - Feedback on the validity of arguments and whether a file could be found or not. + - Dialogue is opened when no argument was given. + + Changed on 18-10-2022 by JMS, DCCN + - Massive speed up: no intermediate double->single->double conversion ,and + - Don't store metadata that is not broadcasted to outside function in a struct array, and + - Allow for a selection of channels to be read, reducing memory footprint, and calibration step + + 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. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_tmsi_poly5.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_tmsi_poly5", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_tobii_tsv.py b/fieldtrip/__fileio/_read_tobii_tsv.py new file mode 100644 index 0000000..b0b3b9d --- /dev/null +++ b/fieldtrip/__fileio/_read_tobii_tsv.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _read_tobii_tsv(*args, **kwargs): + """ + READ_TOBII_TSV + + Use as + hdr = read_tobii_tsv(filename) + or + dat = read_tobii_tsv(filename, tsv, begsample, endsample) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_tobii_tsv.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_tobii_tsv", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_trigger.py b/fieldtrip/__fileio/_read_trigger.py new file mode 100644 index 0000000..238f79a --- /dev/null +++ b/fieldtrip/__fileio/_read_trigger.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _read_trigger(*args, **kwargs): + """ + READ_TRIGGER extracts the events from a continuous trigger channel + This function is a helper function to read_event and can be used for all + dataformats that have one or multiple continuously sampled TTL channels + in the data. + + This is a helper function for FT_READ_EVENT. Please look at the code of + this function for further details. + + TODO + - merge read_ctf_trigger into this function (requires trigshift and bitmasking option) + - merge biosemi code into this function (requires bitmasking option) + + See also FT_READ_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_trigger.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_trigger", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_trk.py b/fieldtrip/__fileio/_read_trk.py new file mode 100644 index 0000000..d0fbac0 --- /dev/null +++ b/fieldtrip/__fileio/_read_trk.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _read_trk(*args, **kwargs): + """ + read TrackVis .trk format data + fillPath: filename of track to read. + for format details http://www.trackvis.org/docs/?subsect=fileformat + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_trk.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_trk", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_video.py b/fieldtrip/__fileio/_read_video.py new file mode 100644 index 0000000..09503df --- /dev/null +++ b/fieldtrip/__fileio/_read_video.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _read_video(*args, **kwargs): + """ + READ_VIDEO + + Use as + hdr = read_video(filename) + or + dat = read_video(filename, hdr, begsample, endsample) + + See also READ_VIDEOMEG_VID, LOAD_VIDEO123 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_video.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_video", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_videomeg_aud.py b/fieldtrip/__fileio/_read_videomeg_aud.py new file mode 100644 index 0000000..edae9cb --- /dev/null +++ b/fieldtrip/__fileio/_read_videomeg_aud.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _read_videomeg_aud(*args, **kwargs): + """ + READ_VIDEOMEG_AUD + + Use as + hdr = read_videomeg_aud(filename) + or + dat = read_videomeg_aud(filename, hdr, begsample, endsample) + + See also READ_VIDEOMEG_VID, LOAD_AUDIO0123, LOAD_VIDEO123 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_videomeg_aud.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_videomeg_aud", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_videomeg_vid.py b/fieldtrip/__fileio/_read_videomeg_vid.py new file mode 100644 index 0000000..136b564 --- /dev/null +++ b/fieldtrip/__fileio/_read_videomeg_vid.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _read_videomeg_vid(*args, **kwargs): + """ + READ_VIDEOMEG_VID + + Use as + hdr = read_videomeg_vid(filename) + or + dat = read_videomeg_vid(filename, hdr, begsample, endsample) + + See also READ_VIDEOMEG_AUD, LOAD_AUDIO0123, LOAD_VIDEO123 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_videomeg_vid.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_videomeg_vid", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_vtk.py b/fieldtrip/__fileio/_read_vtk.py new file mode 100644 index 0000000..40618a2 --- /dev/null +++ b/fieldtrip/__fileio/_read_vtk.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _read_vtk(*args, **kwargs): + """ + READ_VTK reads a triangulation from a VTK (Visualisation ToolKit) format file. + Supported are triangles, triangle strips, and other polygons. + + Use as + [pnt, tri] = read_vtk(filename) + + See https://docs.vtk.org/en/latest/design_documents/VTKFileFormats.html + and https://www.princeton.edu/~efeibush/viscourse/vtk.pdf + + See also WRITE_VTK, READ_VTK_XML + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_vtk.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_vtk", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_vtk_xml.py b/fieldtrip/__fileio/_read_vtk_xml.py new file mode 100644 index 0000000..4df7df6 --- /dev/null +++ b/fieldtrip/__fileio/_read_vtk_xml.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _read_vtk_xml(*args, **kwargs): + """ + READ_VTK_XML reads a XML-formatted vtk file containing points in 3D and + connecting elements. + + this function is a trial-and-error based implementation to read xml-style + vtk files. There is some documentation online, which seems somewhat + incomplete, or at least not fully understood by me. + + See also READ_VTK, WRITE_VTK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_vtk_xml.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_vtk_xml", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_wdq_data.py b/fieldtrip/__fileio/_read_wdq_data.py new file mode 100644 index 0000000..f458f74 --- /dev/null +++ b/fieldtrip/__fileio/_read_wdq_data.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _read_wdq_data(*args, **kwargs): + """ + READ_WDQ_DATA reads data from wdq files + + Use as + [dat] = read_wdq_data(filename, hdr, begsample, endsample, chanindx) + or + [dat] = read_wdq_data(filename, hdr, 'lowbits') + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_wdq_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_wdq_data", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_wdq_header.py b/fieldtrip/__fileio/_read_wdq_header.py new file mode 100644 index 0000000..1be22f1 --- /dev/null +++ b/fieldtrip/__fileio/_read_wdq_header.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _read_wdq_header(*args, **kwargs): + """ + READ_WDQ_HEADER reads header information from wdq files + + Use as + [hdr] = read_wdq_header(filename) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_wdq_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_wdq_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_yokogawa_data.py b/fieldtrip/__fileio/_read_yokogawa_data.py new file mode 100644 index 0000000..2e5ec78 --- /dev/null +++ b/fieldtrip/__fileio/_read_yokogawa_data.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _read_yokogawa_data(*args, **kwargs): + """ + READ_YOKAGAWA_DATA reads continuous, epoched or averaged MEG data + that has been generated by the Yokogawa MEG system and software + and allows that data to be used in combination with FieldTrip. + + Use as + [dat] = read_yokogawa_data(filename, hdr, begsample, endsample, chanindx) + + This is a wrapper function around the functions + GetMeg160ContinuousRawDataM + GetMeg160EvokedAverageDataM + GetMeg160EvokedRawDataM + + See also READ_YOKOGAWA_HEADER, READ_YOKOGAWA_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_yokogawa_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_yokogawa_data", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_yokogawa_data_new.py b/fieldtrip/__fileio/_read_yokogawa_data_new.py new file mode 100644 index 0000000..a022882 --- /dev/null +++ b/fieldtrip/__fileio/_read_yokogawa_data_new.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _read_yokogawa_data_new(*args, **kwargs): + """ + READ_YOKAGAWA_DATA_NEW reads continuous, epoched or averaged MEG data + that has been generated by the Yokogawa MEG system and software + and allows that data to be used in combination with FieldTrip. + + Use as + [dat] = read_yokogawa_data_new(filename, hdr, begsample, endsample, chanindx) + + This is a wrapper function around the function + getYkgwData + + See also READ_YOKOGAWA_HEADER_NEW, READ_YOKOGAWA_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_yokogawa_data_new.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_yokogawa_data_new", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_yokogawa_event.py b/fieldtrip/__fileio/_read_yokogawa_event.py new file mode 100644 index 0000000..246bd75 --- /dev/null +++ b/fieldtrip/__fileio/_read_yokogawa_event.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _read_yokogawa_event(*args, **kwargs): + """ + READ_YOKOGAWA_EVENT reads event information from continuous, + epoched or averaged MEG data that has been generated by the Yokogawa + MEG system and software and allows those events to be used in + combination with FieldTrip. + + Use as + [event] = read_yokogawa_event(filename) + + See also READ_YOKOGAWA_HEADER, READ_YOKOGAWA_DATA + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_yokogawa_event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_yokogawa_event", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_yokogawa_header.py b/fieldtrip/__fileio/_read_yokogawa_header.py new file mode 100644 index 0000000..1244285 --- /dev/null +++ b/fieldtrip/__fileio/_read_yokogawa_header.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def _read_yokogawa_header(*args, **kwargs): + """ + READ_YOKOGAWA_HEADER reads the header information from continuous, + epoched or averaged MEG data that has been generated by the Yokogawa + MEG system and software and allows that data to be used in combination + with FieldTrip. + + Use as + [hdr] = read_yokogawa_header(filename) + + This is a wrapper function around the functions + GetMeg160SystemInfoM + GetMeg160ChannelCountM + GetMeg160ChannelInfoM + GetMeg160CalibInfoM + GetMeg160AmpGainM + GetMeg160DataAcqTypeM + GetMeg160ContinuousAcqCondM + GetMeg160EvokedAcqCondM + + See also READ_YOKOGAWA_DATA, READ_YOKOGAWA_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_yokogawa_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_yokogawa_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_yokogawa_header_new.py b/fieldtrip/__fileio/_read_yokogawa_header_new.py new file mode 100644 index 0000000..d46ffa8 --- /dev/null +++ b/fieldtrip/__fileio/_read_yokogawa_header_new.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _read_yokogawa_header_new(*args, **kwargs): + """ + READ_YOKOGAWA_HEADER_NEW reads the header information from continuous, + epoched or averaged MEG data that has been generated by the Yokogawa + MEG system and software and allows that data to be used in combination + with FieldTrip. + + Use as + [hdr] = read_yokogawa_header_new(filename) + + This is a wrapper function around the functions + getYkgwHdrSystem + getYkgwHdrChannel + getYkgwHdrAcqCond + getYkgwHdrCoregist + getYkgwHdrDigitize + getYkgwHdrSource + + See also CTF2GRAD, BTI2GRAD, FIF2GRAD, MNE2GRAD, ITAB2GRAD, FT_READ_SENS, + FT_READ_HEADER, READ_YOKOGAWA_DATA_NEW, READ_YOKOGAWA_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_yokogawa_header_new.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_yokogawa_header_new", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_yorkinstruments_hdf5_meta.py b/fieldtrip/__fileio/_read_yorkinstruments_hdf5_meta.py new file mode 100644 index 0000000..7df3bb3 --- /dev/null +++ b/fieldtrip/__fileio/_read_yorkinstruments_hdf5_meta.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _read_yorkinstruments_hdf5_meta(*args, **kwargs): + """ + READ_YPRKINSTRUMENTS_HDF5_META reads the metatada and header information from a .meghdf5 file + + Use as + info=read_yorkinstruments_hdf5_meta(datafile) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_yorkinstruments_hdf5_meta.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_yorkinstruments_hdf5_meta", *args, **kwargs) diff --git a/fieldtrip/__fileio/_read_zebris.py b/fieldtrip/__fileio/_read_zebris.py new file mode 100644 index 0000000..41013e6 --- /dev/null +++ b/fieldtrip/__fileio/_read_zebris.py @@ -0,0 +1,63 @@ +from fieldtrip._runtime import Runtime + + +def _read_zebris(*args, **kwargs): + """ + Reads Zebris files: + fiducials locations, and + either sensor file or headshape file or both + + FORMAT [fid, sens, label] = read_zebris(Fname_zeb,skip) + Input: + Fname_zeb - Zebris ASCII file containing sensor locations (mm) + (headshape can also be considered here instead of sensors) + skip - first channels to skip + + Output: + fid - fiducial locations (mm) in rows + sens - sensor/headshape locations (mm) in rows + label - labels of the fiducials + sens_label - labels of the surface points, electrodes + headshape + + IMPORTANT: Note that Zebris data files should be -ASCII files with + extension .sfp + It is assumed that the .sfp file contains the location (mm) of fiducials + (possibly twice), possibly followed by some additional named points for + the electrodes, and then so more named location starting with 'sfl' for + headshape locations. + In some instances the first few channel locations may pertain to + reference channels; the skip variable allows these to be skipped if + necessary. + The fiducial locations are flaged with the strings 'fidt9','fidnz' and + 'fidt10'; indicating the leaft ear, nasion, and right ear, respectively. + _________________________________________________________________________ + Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/read_zebris.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_zebris", *args, **kwargs) diff --git a/fieldtrip/__fileio/_readmarkerfile.py b/fieldtrip/__fileio/_readmarkerfile.py new file mode 100644 index 0000000..97f6ce6 --- /dev/null +++ b/fieldtrip/__fileio/_readmarkerfile.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _readmarkerfile(*args, **kwargs): + """ + Read the MarkerFile.mrk file in a CTF dataset. + + Use as + marker = readmarkerfile(folder) + + Creates a marker structure which contains number_markers, + number_samples, marker_names, and trial_times. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/readmarkerfile.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("readmarkerfile", *args, **kwargs) diff --git a/fieldtrip/__fileio/_refine.py b/fieldtrip/__fileio/_refine.py new file mode 100644 index 0000000..b927b00 --- /dev/null +++ b/fieldtrip/__fileio/_refine.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def _refine(*args, **kwargs): + """ + REFINE a 3D surface that is described by a triangulation + + Use as + [pos, tri] = refine(pos, tri) + [pos, tri] = refine(pos, tri, 'banks') + [pos, tri, texture] = refine(pos, tri, 'banks', texture) + [pos, tri] = refine(pos, tri, 'updown', numtri) + + If no method is specified, the default is to refine the mesh globally by bisecting + each edge according to the algorithm described in Banks, 1983. + + The Banks method allows the specification of a subset of triangles to be refined + according to Banks' algorithm. Adjacent triangles will be gracefully dealt with. + + The alternative 'updown' method refines the mesh a couple of times + using Banks' algorithm, followed by a downsampling using the REDUCEPATCH + function. + + If the textures of the vertices are specified, the textures for the new + vertices are computed + + The Banks method is a memory efficient implementation which remembers the + previously inserted vertices. The refinement algorithm executes in linear + time with the number of triangles. It is mentioned in + http://www.cs.rpi.edu/~flaherje/pdf/fea8.pdf, which also contains the original + reference. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/refine.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("refine", *args, **kwargs) diff --git a/fieldtrip/__fileio/_remove_double_vertices.py b/fieldtrip/__fileio/_remove_double_vertices.py new file mode 100644 index 0000000..6bee49b --- /dev/null +++ b/fieldtrip/__fileio/_remove_double_vertices.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _remove_double_vertices(*args, **kwargs): + """ + REMOVE_DOUBLE_VERTICES removes double vertices from a triangular, tetrahedral or + hexahedral mesh, renumbering the vertex-indices for the elements. + + Use as + [pos, tri] = remove_double_vertices(pos, tri) + [pos, tet] = remove_double_vertices(pos, tet) + [pos, hex] = remove_double_vertices(pos, hex) + + See also REMOVE_VERTICES, REMOVE_UNUSED_VERTICES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/remove_double_vertices.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("remove_double_vertices", *args, **kwargs) diff --git a/fieldtrip/__fileio/_remove_unused_vertices.py b/fieldtrip/__fileio/_remove_unused_vertices.py new file mode 100644 index 0000000..4b189da --- /dev/null +++ b/fieldtrip/__fileio/_remove_unused_vertices.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _remove_unused_vertices(*args, **kwargs): + """ + REMOVE_UNUSED_VERTICES removes unused vertices from a triangular, tetrahedral or + hexahedral mesh, renumbering the vertex-indices for the elements. + + Use as + [pos, tri] = remove_unused_vertices(pos, tri) + [pos, tet] = remove_unused_vertices(pos, tet) + [pos, hex] = remove_unused_vertices(pos, hex) + + See also REMOVE_VERTICES, REMOVE_DOUBLE_VERTICES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/remove_unused_vertices.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("remove_unused_vertices", *args, **kwargs) diff --git a/fieldtrip/__fileio/_remove_vertices.py b/fieldtrip/__fileio/_remove_vertices.py new file mode 100644 index 0000000..8127d5b --- /dev/null +++ b/fieldtrip/__fileio/_remove_vertices.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _remove_vertices(*args, **kwargs): + """ + REMOVE_VERTICES removes specified indexed vertices from a triangular, tetrahedral + or hexahedral mesh renumbering the vertex-indices for the elements and removing all + resulting 'open' elements. + + Use as + [pos, tri] = remove_vertices(pos, tri, sel) + [pos, tet] = remove_vertices(pos, tet, sel) + [pos, hex] = remove_vertices(pos, hex, sel) + + See also REMOVE_DOUBLE_VERTICES, REMOVE_UNUSED_VERTICES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/remove_vertices.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("remove_vertices", *args, **kwargs) diff --git a/fieldtrip/__fileio/_ricoh2grad.py b/fieldtrip/__fileio/_ricoh2grad.py new file mode 100644 index 0000000..6e40d0f --- /dev/null +++ b/fieldtrip/__fileio/_ricoh2grad.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _ricoh2grad(*args, **kwargs): + """ + RICOH2GRAD converts the position and weights of all coils that + compromise a gradiometer system into a structure that can be used + by FieldTrip. This implementation uses the "ricoh_meg_reader" toolbox. + + See also FT_READ_HEADER, CTF2GRAD, BTI2GRAD, FIF2GRAD, YOKOGAWA2GRAD_NEW + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/ricoh2grad.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ricoh2grad", *args, **kwargs) diff --git a/fieldtrip/__fileio/_rmsubfield.py b/fieldtrip/__fileio/_rmsubfield.py new file mode 100644 index 0000000..4670bb0 --- /dev/null +++ b/fieldtrip/__fileio/_rmsubfield.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _rmsubfield(*args, **kwargs): + """ + RMSUBFIELD removes the contents of the specified field from a structure + just like the standard Matlab RMFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = rmsubfield(s, 'fieldname') + or as + s = rmsubfield(s, 'fieldname.subfieldname') + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/rmsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rmsubfield", *args, **kwargs) diff --git a/fieldtrip/__fileio/_rotate.py b/fieldtrip/__fileio/_rotate.py new file mode 100644 index 0000000..d32ee92 --- /dev/null +++ b/fieldtrip/__fileio/_rotate.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _rotate(*args, **kwargs): + """ + ROTATE returns the homogenous coordinate transformation matrix + corresponding to a rotation around the x, y and z-axis. The direction of + the rotation is according to the right-hand rule. + + Use as + [H] = rotate(R) + where + R [rx, ry, rz] in degrees + H corresponding homogenous transformation matrix + + Note that the order in which the rotations are performs matters. The + rotation is first done around the z-axis, then the y-axis and finally the + x-axis. + + See also TRANSLATE, SCALE, RIGIDBODY, QUATERNION, HOMOGENOUS2TRADITIONAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/rotate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rotate", *args, **kwargs) diff --git a/fieldtrip/__fileio/_sccn_xdf.py b/fieldtrip/__fileio/_sccn_xdf.py new file mode 100644 index 0000000..471426e --- /dev/null +++ b/fieldtrip/__fileio/_sccn_xdf.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _sccn_xdf(*args, **kwargs): + """ + This is a wrapper to the reading function from the XDF MATLAB toolbox. + + Use as + hdr = sccn_xdf(filename); + dat = sccn_xdf(filename, hdr, begsample, endsample, chanindx); + evt = sccn_xdf(filename, hdr); + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT, XDF2FIELDTRIP + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/sccn_xdf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sccn_xdf", *args, **kwargs) diff --git a/fieldtrip/__fileio/_sensys_csv.py b/fieldtrip/__fileio/_sensys_csv.py new file mode 100644 index 0000000..aaa133c --- /dev/null +++ b/fieldtrip/__fileio/_sensys_csv.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _sensys_csv(*args, **kwargs): + """ + SENSYS_CSV reads fluxgate magnetometer from the Sensys FGM3D TD system + + See https://sensysmagnetometer.com/products/fgm3d/ + + Use as + hdr = sensys_csv(filename); + dat = sensys_csv(filename, hdr, begsample, endsample, chanindx); + evt = sensys_csv(filename, hdr); + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/sensys_csv.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sensys_csv", *args, **kwargs) diff --git a/fieldtrip/__fileio/_setsubfield.py b/fieldtrip/__fileio/_setsubfield.py new file mode 100644 index 0000000..98014b1 --- /dev/null +++ b/fieldtrip/__fileio/_setsubfield.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _setsubfield(*args, **kwargs): + """ + SETSUBFIELD sets the contents of the specified field to a specified value + just like the standard Matlab SETFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = setsubfield(s, 'fieldname', value) + or as + s = setsubfield(s, 'fieldname.subfieldname', value) + + where nested is a logical, false denoting that setsubfield will create + s.subfieldname instead of s.fieldname.subfieldname + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/setsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("setsubfield", *args, **kwargs) diff --git a/fieldtrip/__fileio/_snirf.py b/fieldtrip/__fileio/_snirf.py new file mode 100644 index 0000000..acc25ca --- /dev/null +++ b/fieldtrip/__fileio/_snirf.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _snirf(*args, **kwargs): + """ + SNIRF reads data from a SNIRF file and returns it in a format that FieldTrip understands. + + See https://github.com/fNIRS/snirf/blob/master/snirf_specification.md + + Use as + hdr = snirf(filename); + dat = snirf(filename, hdr, begsample, endsample, chanindx); + evt = snirf(filename, hdr); + + The SNIRF format allows for multiple blocks of data channels anx aux channels, each + with a different sampling frequency. That is not allowed in this code; all channels + must have the same sampling rate and be sampled at the same time. + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT, SNIRF2OPTO + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/snirf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("snirf", *args, **kwargs) diff --git a/fieldtrip/__fileio/_snirf2opto.py b/fieldtrip/__fileio/_snirf2opto.py new file mode 100644 index 0000000..c6def4b --- /dev/null +++ b/fieldtrip/__fileio/_snirf2opto.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _snirf2opto(*args, **kwargs): + """ + SNIRF2OPTO converts the SNIRF probe and measurementList structures to a FieldTrip + optode structure. + + See https://github.com/fNIRS/snirf/blob/master/snirf_specification.md + + The FieldTrip optode structure is defined in FT_DATATYPE_SENS + + See also OPTO2HOMER, BTI2GRAD, CTF2GRAD, FIF2GRAD, ITAB2GRAD, MNE2GRAD, NETMEG2GRAD, YOKOGAWA2GRAD, FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/snirf2opto.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("snirf2opto", *args, **kwargs) diff --git a/fieldtrip/__fileio/_solid_angle.py b/fieldtrip/__fileio/_solid_angle.py new file mode 100644 index 0000000..d60a591 --- /dev/null +++ b/fieldtrip/__fileio/_solid_angle.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _solid_angle(*args, **kwargs): + """ + SOLID_ANGLE of a planar triangle as seen from the origin + + The solid angle W subtended by a surface S is defined as the surface + area W of a unit sphere covered by the surface's projection onto the + sphere. Solid angle is measured in steradians, and the solid angle + corresponding to all of space being subtended is 4*pi sterradians. + + Use: + [w] = solid_angle(v1, v2, v3) + or + [w] = solid_angle(pnt, tri) + where v1, v2 and v3 are the vertices of a single triangle in 3D or + pnt and tri contain a description of a triangular mesh (this will + compute the solid angle for each triangle) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/solid_angle.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("solid_angle", *args, **kwargs) diff --git a/fieldtrip/__fileio/_spikeglx_bin.py b/fieldtrip/__fileio/_spikeglx_bin.py new file mode 100644 index 0000000..2be0a69 --- /dev/null +++ b/fieldtrip/__fileio/_spikeglx_bin.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _spikeglx_bin(*args, **kwargs): + """ + SPIKEGLX_BIN reads Neuropixel data from SpikeGLX .bin files + + See https://github.com/jenniferColonell/SpikeGLX_Datafile_Tools + + Use as + hdr = spikeglx_bin(filename); + dat = spikeglx_bin(filename, hdr, begsample, endsample, chanindx); + evt = spikeglx_bin(filename, hdr); + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/spikeglx_bin.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("spikeglx_bin", *args, **kwargs) diff --git a/fieldtrip/__fileio/_surf_to_tetgen.py b/fieldtrip/__fileio/_surf_to_tetgen.py new file mode 100644 index 0000000..dec85ad --- /dev/null +++ b/fieldtrip/__fileio/_surf_to_tetgen.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _surf_to_tetgen(*args, **kwargs): + """ + This function converts a triangulated mesh in FieldTrip format into a + surface structure readable by Tetgen software + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/surf_to_tetgen.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("surf_to_tetgen", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_surface_inside.py b/fieldtrip/__fileio/_surface_inside.py new file mode 100644 index 0000000..469c004 --- /dev/null +++ b/fieldtrip/__fileio/_surface_inside.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _surface_inside(*args, **kwargs): + """ + SURFACE_INSIDE determines if a point is inside/outside a triangle mesh + whereby the bounding triangle mesh should be closed. + + Use as + inside = surface_inside(dippos, pos, tri) + where + dippos position of point of interest (can be 1x3 or Nx3) + pos bounding mesh vertices + tri bounding mesh triangles + + See also SURFACE_AREA, SURFACE_ORIENTATION, SURFACE_NORMALS, SURFACE_NESTING, SOLID_ANGLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/surface_inside.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("surface_inside", *args, **kwargs) diff --git a/fieldtrip/__fileio/_surface_normals.py b/fieldtrip/__fileio/_surface_normals.py new file mode 100644 index 0000000..483b903 --- /dev/null +++ b/fieldtrip/__fileio/_surface_normals.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _surface_normals(*args, **kwargs): + """ + SURFACE_NORMALS compute the surface normals of a triangular mesh + for each triangle or for each vertex + + Use as + nrm = surface_normals(pnt, tri, opt) + where opt is either 'vertex' (default) or 'triangle'. + + See also SURFACE_AREA, SURFACE_ORIENTATION, SURFACE_INSIDE, SURFACE_NESTING, PROJECTTRI, PCNORMALS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/surface_normals.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("surface_normals", *args, **kwargs) diff --git a/fieldtrip/__fileio/_time2offset.py b/fieldtrip/__fileio/_time2offset.py new file mode 100644 index 0000000..194ff73 --- /dev/null +++ b/fieldtrip/__fileio/_time2offset.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _time2offset(*args, **kwargs): + """ + TIME2OFFSET converts a time-axis of a trial into the offset in samples + according to the definition from DEFINETRIAL + + Use as + [offset] = time2offset(time, fsample) + + The trialdefinition "trl" is an Nx3 matrix. The first column contains + the sample-indices of the begin of the trial relative to the begin + of the raw data , the second column contains the sample_indices of + the end of the trials, and the third column contains the offset of + the trigger with respect to the trial. An offset of 0 means that + the first sample of the trial corresponds to the trigger. A positive + offset indicates that the first sample is later than the trigger, a + negative offset indicates a trial beginning before the trigger. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/time2offset.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("time2offset", *args, **kwargs) diff --git a/fieldtrip/__fileio/_timestamp_neuralynx.py b/fieldtrip/__fileio/_timestamp_neuralynx.py new file mode 100644 index 0000000..ae65405 --- /dev/null +++ b/fieldtrip/__fileio/_timestamp_neuralynx.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _timestamp_neuralynx(*args, **kwargs): + """ + TIMESTAMP_NEURALYNX merge the low and high part of Neuralynx timestamps + into a single uint64 value + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/timestamp_neuralynx.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("timestamp_neuralynx", *args, **kwargs) diff --git a/fieldtrip/__fileio/_timestamp_plexon.py b/fieldtrip/__fileio/_timestamp_plexon.py new file mode 100644 index 0000000..ac374be --- /dev/null +++ b/fieldtrip/__fileio/_timestamp_plexon.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _timestamp_plexon(*args, **kwargs): + """ + TIMESTAMP_PLEXON merge the low and high part of the timestamps + into a single uint64 value + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/timestamp_plexon.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("timestamp_plexon", *args, **kwargs) diff --git a/fieldtrip/__fileio/_tokenize.py b/fieldtrip/__fileio/_tokenize.py new file mode 100644 index 0000000..a004b49 --- /dev/null +++ b/fieldtrip/__fileio/_tokenize.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _tokenize(*args, **kwargs): + """ + TOKENIZE cuts a string into pieces, returning the pieces in a cell-array + + Use as + t = tokenize(str) + t = tokenize(str, sep) + t = tokenize(str, sep, rep) + where + str = the string that you want to cut into pieces + sep = the separator at which to cut (default is whitespace) + rep = whether to treat repeating separator characters as one (default is false) + + With the optional boolean flag "rep" you can specify whether repeated + separator characters should be squeezed together (e.g. multiple + spaces between two words). The default is rep=1, i.e. repeated + separators are treated as one. + + See also STRSPLIT, SPLIT, STRTOK, TEXTSCAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/tokenize.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("tokenize", *args, **kwargs) diff --git a/fieldtrip/__fileio/_translate.py b/fieldtrip/__fileio/_translate.py new file mode 100644 index 0000000..04fb25e --- /dev/null +++ b/fieldtrip/__fileio/_translate.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _translate(*args, **kwargs): + """ + TRANSLATE returns the homogenous coordinate transformation matrix + corresponding to a translation along the x, y and z-axis + + Use as + [H] = translate(T) + where + T [tx, ty, tz] translation along each of the axes + H corresponding homogenous transformation matrix + + See also ROTATE, SCALE, RIGIDBODY, QUATERNION, HOMOGENOUS2TRADITIONAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/translate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("translate", *args, **kwargs) diff --git a/fieldtrip/__fileio/_tri2bnd.py b/fieldtrip/__fileio/_tri2bnd.py new file mode 100644 index 0000000..a91ad39 --- /dev/null +++ b/fieldtrip/__fileio/_tri2bnd.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _tri2bnd(*args, **kwargs): + """ + TRI2BND takes a triangulated surface mesh that is represented as one + long list of triangles with per triangle a tissue or region type, and + converts it in a struct array with one surface mesh per tissue. + + Use as + [bnd, bndtissue] = tri2bnd(pos, tri, tritissue) + + The output "bnd" is a structure array with the fields bnd.pos and bnd.tri. + + See also MESH2EDGE, POLY2TRI, BND2TRI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/tri2bnd.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("tri2bnd", *args, **kwargs) diff --git a/fieldtrip/__fileio/_undobalancing.py b/fieldtrip/__fileio/_undobalancing.py new file mode 100644 index 0000000..cd4863c --- /dev/null +++ b/fieldtrip/__fileio/_undobalancing.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _undobalancing(*args, **kwargs): + """ + UNDOBALANCING removes all balancing coefficients from the gradiometer sensor array + + This is used in CHANNELPOSITION, FT_PREPARE_LAYOUT, FT_SENSTYPE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/undobalancing.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("undobalancing", *args, **kwargs) diff --git a/fieldtrip/__fileio/_unicorn_csv.py b/fieldtrip/__fileio/_unicorn_csv.py new file mode 100644 index 0000000..f60195d --- /dev/null +++ b/fieldtrip/__fileio/_unicorn_csv.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _unicorn_csv(*args, **kwargs): + """ + UNICORN_CSV reads EEG data from the Gtec/Unicorn Hybrid Black + + See http://unicorn-bi.com/ + + Use as + hdr = unicorn_csv(filename); + dat = unicorn_csv(filename, hdr, begsample, endsample, chanindx); + evt = unicorn_csv(filename, hdr); + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/unicorn_csv.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("unicorn_csv", *args, **kwargs) diff --git a/fieldtrip/__fileio/_volumewrite_spm.py b/fieldtrip/__fileio/_volumewrite_spm.py new file mode 100644 index 0000000..9581f06 --- /dev/null +++ b/fieldtrip/__fileio/_volumewrite_spm.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _volumewrite_spm(*args, **kwargs): + """ + VOLUMEWRITE_SPM writes anatomical or functional MRI volume data to analyze or nifti format + using the SPM toolbox. + + Use as + [Va] = volumewrite_spm(filename, data, transform) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/volumewrite_spm.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("volumewrite_spm", *args, **kwargs) diff --git a/fieldtrip/__fileio/_write_bdf.py b/fieldtrip/__fileio/_write_bdf.py new file mode 100644 index 0000000..c09ca3a --- /dev/null +++ b/fieldtrip/__fileio/_write_bdf.py @@ -0,0 +1,63 @@ +from fieldtrip._runtime import Runtime + + +def _write_bdf(*args, **kwargs): + """ + WRITE_BDF Write EEG data to a Biosemi BDF file + + write_bdf(filename, data, fs, channel_names) + write_bdf(filename, data, fs, channel_names, 'Param', value, ...) + + Inputs: + filename - Output BDF filename (including .bdf extension) + data - EEG data matrix (Nchannels × Ntimepoints) + fs - Sampling frequency (Hz) + channel_names - Cell array of channel names (length Nchannels) + + Optional parameters: + 'SubjectID' - Subject identification string (default: 'X') + 'RecordingID' - Recording identification string (default: 'X') + 'PhysicalMax' - Physical maximum for each channel (default: 32767) + 'PhysicalMin' - Physical minimum for each channel (default: -32768) + 'DigitalMax' - Digital maximum for each channel (default: 8388607) + 'DigitalMin' - Digital minimum for each channel (default: -8388608) + 'ScaleFactor' - Scaling factor for each channel (default: 1) + 'Transducer' - Transducer type for each channel (default: 'Active electrode') + 'Prefilter' - Prefiltering for each channel (default: 'HP:0.16Hz LP:500Hz') + + Example: + data = randn(32, 1000); % 32 channels, 1000 timepoints + fs = 256; % 256 Hz sampling rate + ch_names = arrayfun(@(x) sprintf('EEG%02d', x), 1:32, 'UniformOutput', false); + write_bdf('test.bdf', data, fs, ch_names, 'SubjectID', 'SUBJ01'); + + See also READ_BDF + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/write_bdf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_bdf", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_write_bioimage_mgrid.py b/fieldtrip/__fileio/_write_bioimage_mgrid.py new file mode 100644 index 0000000..29e28e3 --- /dev/null +++ b/fieldtrip/__fileio/_write_bioimage_mgrid.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _write_bioimage_mgrid(*args, **kwargs): + """ + -------------------------------------------------------- + WRITE_BIOIMAGE_MGRID writes BioImage Suite .mgrid files from a FieldTrip + elec datatype structure + + Use as: + write_bioimage_mgrid(filename, elec) + where filename has an .mgrid file extension and elec has both a label + and an elecpos field + + To view the mgrid file in BioImage Suite, ensure that the orientation of + the scan (e.g., RAS) corresponds with the orientation of the electrode + positions (in head coordinates) of elec + + Copyright (C) 2017, Arjen Stolk & Sandon Griffin + -------------------------------------------------------- + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/write_bioimage_mgrid.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_bioimage_mgrid", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_write_brainvision_eeg.py b/fieldtrip/__fileio/_write_brainvision_eeg.py new file mode 100644 index 0000000..09fd6cf --- /dev/null +++ b/fieldtrip/__fileio/_write_brainvision_eeg.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _write_brainvision_eeg(*args, **kwargs): + """ + WRITE_BRAINVISION_EEG exports continuous EEG data to a BrainVision *.eeg + and corresponding *.vhdr file. The samples in the exported file are + multiplexed and stored in ieee-le float32 format. + + Use as + write_brainvision_eeg(filename, hdr, dat, evt) + + See also READ_BRAINVISION_EEG, READ_BRAINVISION_VHDR, READ_BRAINVISION_VMRK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/write_brainvision_eeg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_brainvision_eeg", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_write_brainvoyager.py b/fieldtrip/__fileio/_write_brainvoyager.py new file mode 100644 index 0000000..5ca0efb --- /dev/null +++ b/fieldtrip/__fileio/_write_brainvoyager.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _write_brainvoyager(*args, **kwargs): + """ + helper function to write volumetric data for brainvoyager. + this is old code that moved from ft_volumewrite to clean up + the high level function a bit. it is assumed that the orientation + of the volume is correct. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/write_brainvoyager.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_brainvoyager", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_write_ctf_shm.py b/fieldtrip/__fileio/_write_ctf_shm.py new file mode 100644 index 0000000..ef755db --- /dev/null +++ b/fieldtrip/__fileio/_write_ctf_shm.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _write_ctf_shm(*args, **kwargs): + """ + WRITE_CTF_SHM writes metainformation and data as a packet to shared memory. + This function can be used for real-time processing of data while it is + being acquired. + + Use as + write_ctf_shm(msgType, msgId, sampleNumber, numSamples, numChannels, data); + + See also READ_CTF_SHM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/write_ctf_shm.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_ctf_shm", *args, **kwargs) diff --git a/fieldtrip/__fileio/_write_edf.py b/fieldtrip/__fileio/_write_edf.py new file mode 100644 index 0000000..15e60b4 --- /dev/null +++ b/fieldtrip/__fileio/_write_edf.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _write_edf(*args, **kwargs): + """ + WRITE_EDF(filename, header, data) + + Writes a EDF file from the given header (only label, Fs, nChans are of interest) + and the data (unmodified). Digital and physical limits are derived from the data + via min and max operators. The EDF file will contain N records of 1 sample each, + where N is the number of columns in 'data'. + + For sampling rates > 1 Hz, this means that the duration of one data "record" + is less than 1s, which some EDF reading programs might complain about. At the + same time, there is an upper limit of how big (in bytes) a record should be, + which we could easily violate if we write the whole data as *one* record. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/write_edf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_edf", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_write_gdf.py b/fieldtrip/__fileio/_write_gdf.py new file mode 100644 index 0000000..1f1e1e3 --- /dev/null +++ b/fieldtrip/__fileio/_write_gdf.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _write_gdf(*args, **kwargs): + """ + WRITE_GDF(filename, header, data) + + Writes a GDF file from the given header (only label, Fs, nChans are of interest) + and the data (unmodified). Digital and physical limits are derived from the data + via min and max operators. The GDF file will contain N records of 1 sample each, + where N is the number of columns in 'data'. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/write_gdf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_gdf", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_write_neuralynx_ncs.py b/fieldtrip/__fileio/_write_neuralynx_ncs.py new file mode 100644 index 0000000..820c862 --- /dev/null +++ b/fieldtrip/__fileio/_write_neuralynx_ncs.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _write_neuralynx_ncs(*args, **kwargs): + """ + WRITE_NEURALYNX_NCS writes continuous data to a NCS file + + Use as + write_neuralynx_ncs(filename, ncs) + + The input data should be scaled in uV. + + See also READ_NEURALYNX_NCS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/write_neuralynx_ncs.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_neuralynx_ncs", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_write_neuralynx_nts.py b/fieldtrip/__fileio/_write_neuralynx_nts.py new file mode 100644 index 0000000..2bbb24d --- /dev/null +++ b/fieldtrip/__fileio/_write_neuralynx_nts.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _write_neuralynx_nts(*args, **kwargs): + """ + WRITE_NEURALYNX_NTS writes spike timestamps to a NTS file + + Use as + write_neuralynx_nts(filename, nts) + + See also READ_NEURALYNX_NTS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/write_neuralynx_nts.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_neuralynx_nts", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_write_nifti2_hdr.py b/fieldtrip/__fileio/_write_nifti2_hdr.py new file mode 100644 index 0000000..a92d5a4 --- /dev/null +++ b/fieldtrip/__fileio/_write_nifti2_hdr.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _write_nifti2_hdr(*args, **kwargs): + """ + WRITE_NIFTI2_HDR + + Use as + write_nifti2_hdr(filename, hdr) + where + filename = string + hdr = structure with nifti-2 header information + + See also READ_NIFTI_HDR, READ_CIFTI, WRITE_CIFTI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/write_nifti2_hdr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_nifti2_hdr", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_write_off.py b/fieldtrip/__fileio/_write_off.py new file mode 100644 index 0000000..acab70f --- /dev/null +++ b/fieldtrip/__fileio/_write_off.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _write_off(*args, **kwargs): + """ + WRITE_OFF writes a set of geometrical planar forms (called piecewise linear complex, PLC) + to an ascii *.off file, which is a file format created by Princeton Shape Benchmark + + Use as + write_stl(filename, pnt, tri) + + See also READ_OFF + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/write_off.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_off", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_write_plexon_nex.py b/fieldtrip/__fileio/_write_plexon_nex.py new file mode 100644 index 0000000..4f7ffbb --- /dev/null +++ b/fieldtrip/__fileio/_write_plexon_nex.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _write_plexon_nex(*args, **kwargs): + """ + WRITE_PLEXON_NEX writes a Plexon *.nex file, which is a file + containing action-potential (spike) timestamps and waveforms (spike + channels), event timestamps (event channels), and continuous variable + data (continuous A/D channels). + + Use as + write_plexon_nex(filename, nex); + + The data structure should contain + nex.hdr.FileHeader.Frequency = TimeStampFreq + nex.hdr.VarHeader.Type = type, 5 for continuous + nex.hdr.VarHeader.Name = label, padded to length 64 + nex.hdr.VarHeader.WFrequency = sampling rate of continuous channel + nex.var.dat = data + nex.var.ts = timestamps + + See also READ_PLEXON_NEX, READ_PLEXON_PLX, READ_PLEXON_DDT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/write_plexon_nex.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_plexon_nex", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_write_ply.py b/fieldtrip/__fileio/_write_ply.py new file mode 100644 index 0000000..df9149c --- /dev/null +++ b/fieldtrip/__fileio/_write_ply.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _write_ply(*args, **kwargs): + """ + WRITE_PLY writes triangles, tetrahedrons or hexahedrons to a Stanford *.ply format file + + Use as + write_ply(filename, vertex, element) + + Documentation is provided on + http://paulbourke.net/dataformats/ply/ + http://en.wikipedia.org/wiki/PLY_(file_format) + + See also READ_PLY, READ_VTK, WRITE_VTK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/write_ply.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_ply", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_write_serial_event.py b/fieldtrip/__fileio/_write_serial_event.py new file mode 100644 index 0000000..49e643d --- /dev/null +++ b/fieldtrip/__fileio/_write_serial_event.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _write_serial_event(*args, **kwargs): + """ + WRITE_SERIAL_EVENT + + changed A.Hadjipapas 2010 + + write to phyiscal serial port + serial port on windows or linux platform + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/write_serial_event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_serial_event", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_write_stl.py b/fieldtrip/__fileio/_write_stl.py new file mode 100644 index 0000000..2017b77 --- /dev/null +++ b/fieldtrip/__fileio/_write_stl.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _write_stl(*args, **kwargs): + """ + WRITE_STL writes a triangulation to an ASCII *.stl file, which is a file + format native to the stereolithography CAD software created by 3D Systems. + + Use as + write_stl(filename, pos, tri, nrm) + where nrm refers to the triangle normals. + + See also READ_STL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/write_stl.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_stl", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_write_vtk.py b/fieldtrip/__fileio/_write_vtk.py new file mode 100644 index 0000000..9934e88 --- /dev/null +++ b/fieldtrip/__fileio/_write_vtk.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _write_vtk(*args, **kwargs): + """ + WRITE_VTK writes a mesh to a VTK (Visualisation ToolKit) format file. + Supported are triangles, tetrahedrons and hexahedrons. + + Use as + write_vtk(filename, pos, tri, val) + write_vtk(filename, pos, tet, val) + write_vtk(filename, pos, hex, val) + where pos describes the vertex positions and tri/tet/hex describe the connectivity + of the surface or volume elements. + + The optional val argument can be used to write scalar or vector values for + each vertex or element. + + See also READ_VTK, READ_VTK_XML, WRITE_PLY + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/write_vtk.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_vtk", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/_xml2struct.py b/fieldtrip/__fileio/_xml2struct.py new file mode 100644 index 0000000..658f883 --- /dev/null +++ b/fieldtrip/__fileio/_xml2struct.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def _xml2struct(*args, **kwargs): + """ + Convert xml file into a MATLAB structure + [ s ] = xml2struct( file ) + + A file containing: + + Some text + Some more text + Even more text + + + Used to produce: + s.XMLname.Attributes.attrib1 = "Some value"; + s.XMLname.Element.Text = "Some text"; + s.XMLname.DifferentElement{1}.Attributes.attrib2 = "2"; + s.XMLname.DifferentElement{1}.Text = "Some more text"; + s.XMLname.DifferentElement{2}.Attributes.attrib3 = "2"; + s.XMLname.DifferentElement{2}.Attributes.attrib4 = "1"; + s.XMLname.DifferentElement{2}.Text = "Even more text"; + + Will produce (gp: to matche the output of xml2struct in XML4MAT, but note that Element(2) is empty): + Element: Some text + DifferentElement: + attrib2: 2 + DifferentElement: Some more text + attrib1: Some value + + Element: + DifferentElement: + attrib3: 2 + attrib4: 1 + DifferentElement: Even more text + attrib1: + + Note the characters : - and . are not supported in structure fieldnames and + are replaced by _ + + Written by W. Falkena, ASTI, TUDelft, 21-08-2010 + Attribute parsing speed increased by 40% by A. Wanner, 14-6-2011 + 2011/12/14 giopia: changes in the main function to make more similar to xml2struct of the XML4MAT toolbox, bc it's used by fieldtrip + 2012/04/04 roboos: added the original license clause, see also http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=645#c11 + 2012/04/04 roboos: don't print the filename that is being read + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/xml2struct.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("xml2struct", *args, **kwargs) diff --git a/fieldtrip/__fileio/_xsens_mvnx.py b/fieldtrip/__fileio/_xsens_mvnx.py new file mode 100644 index 0000000..07f96f2 --- /dev/null +++ b/fieldtrip/__fileio/_xsens_mvnx.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _xsens_mvnx(*args, **kwargs): + """ + XSENS_MVNX reads motion tracking data from a file that was created by XSens MVN + motion capture systems. This function is designed to read in .mvnx files from + release version 4. + + See https://www.xsens.com/motion-capture + + Use as + hdr = xsens_mvnx(filename); + dat = xsens_mvnx(filename, hdr, begsample, endsample, chanindx); + evt = xsens_mvnx(filename, hdr); + + See also FT_FILETYPE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + See also BIDS_TSV, BIOPAC_ACQ, BUCN_TXT, EEGSYNTH_TSV, EVENTS_TSV, LIBERTY_CSV, MAUS_TEXTGRID, MOTION_C3D, OPENBCI_TXT, OPENPOSE_KEYPOINTS, OPENSIGNALS_TXT, OPENVIBE_MAT, OPM_FIL, QUALISYS_TSV, SCCN_XDF, SENSYS_CSV, SNIRF, SPIKEGLX_BIN, UNICORN_CSV, XSENS_MVNX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/xsens_mvnx.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("xsens_mvnx", *args, **kwargs) diff --git a/fieldtrip/__fileio/_yokogawa2grad.py b/fieldtrip/__fileio/_yokogawa2grad.py new file mode 100644 index 0000000..b2f7485 --- /dev/null +++ b/fieldtrip/__fileio/_yokogawa2grad.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _yokogawa2grad(*args, **kwargs): + """ + YOKOGAWA2GRAD converts the position and weights of all coils that + compromise a gradiometer system into a structure that can be used + by FieldTrip. This implementation uses the old "yokogawa" toolbox. + + See also CTF2GRAD, BTI2GRAD, FIF2GRAD, MNE2GRAD, ITAB2GRAD, + FT_READ_SENS, FT_READ_HEADER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/yokogawa2grad.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("yokogawa2grad", *args, **kwargs) diff --git a/fieldtrip/__fileio/_yokogawa2grad_new.py b/fieldtrip/__fileio/_yokogawa2grad_new.py new file mode 100644 index 0000000..70ac582 --- /dev/null +++ b/fieldtrip/__fileio/_yokogawa2grad_new.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _yokogawa2grad_new(*args, **kwargs): + """ + YOKOGAWA2GRAD_NEW converts the position and weights of all coils that + compromise a gradiometer system into a structure that can be used + by FieldTrip. This implementation uses the new "yokogawa_meg_reader" + toolbox. + + See also FT_READ_HEADER, CTF2GRAD, BTI2GRAD, FIF2GRAD, YOKOGAWA2GRAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/yokogawa2grad_new.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("yokogawa2grad_new", *args, **kwargs) diff --git a/fieldtrip/__fileio/_yokogawa2headmodel.py b/fieldtrip/__fileio/_yokogawa2headmodel.py new file mode 100644 index 0000000..a6db6cb --- /dev/null +++ b/fieldtrip/__fileio/_yokogawa2headmodel.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _yokogawa2headmodel(*args, **kwargs): + """ + YOKOGAWA2HEADMODEL converts a spherical volume conductor model that can + be present in the header of a datafile into a structure that can + be used by FieldTrip. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/private/yokogawa2headmodel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("yokogawa2headmodel", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_chantype.py b/fieldtrip/__fileio/ft_chantype.py new file mode 100644 index 0000000..63f4920 --- /dev/null +++ b/fieldtrip/__fileio/ft_chantype.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def ft_chantype(*args, **kwargs): + """ + FT_CHANTYPE determines for each individual channel what chantype of data it + represents, e.g. a planar gradiometer, axial gradiometer, magnetometer, + trigger channel, etc. If you want to know what the acquisition system is + (e.g. ctf151 or neuromag306), you should not use this function but + FT_SENSTYPE instead. + + Use as + type = ft_chantype(hdr) + type = ft_chantype(sens) + type = ft_chantype(label) + or as + type = ft_chantype(hdr, desired) + type = ft_chantype(sens, desired) + type = ft_chantype(label, desired) + + If the desired unit is not specified as second input argument, this + function returns a Nchan*1 cell-array with a string describing the type + of each channel. + + If the desired unit is specified as second input argument, this function + returns a Nchan*1 boolean vector with "true" for the channels of the + desired type and "false" for the ones that do not match. + + The specification of the channel types depends on the acquisition system, + for example the ctf275 system includes the following type of channels: + meggrad, refmag, refgrad, adc, trigger, eeg, headloc, headloc_gof. + + See also FT_READ_HEADER, FT_SENSTYPE, FT_CHANUNIT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_chantype.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_chantype", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_chanunit.py b/fieldtrip/__fileio/ft_chanunit.py new file mode 100644 index 0000000..7403277 --- /dev/null +++ b/fieldtrip/__fileio/ft_chanunit.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def ft_chanunit(*args, **kwargs): + """ + FT_CHANUNIT is a helper function that tries to determine the physical + units of each channel. In case the type of channel is not detected, it + will return 'unknown' for that channel. + + Use as + unit = ft_chanunit(hdr) + or as + unit = ft_chanunit(hdr, desired) + + If the desired unit is not specified as second input argument, this + function returns a Nchan*1 cell-array with a string describing the + physical units of each channel, or 'unknown' if those cannot be + determined. + + If the desired unit is specified as second input argument, this function + returns a Nchan*1 boolean vector with "true" for the channels that match + the desired physical units and "false" for the ones that do not match. + + The specification of the channel units depends on the acquisition system, + for example the neuromag306 system includes channel with the following + units: uV, T and T/cm. + + See also FT_CHANTYPE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_chanunit.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_chanunit", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_create_buffer.py b/fieldtrip/__fileio/ft_create_buffer.py new file mode 100644 index 0000000..5c8eb11 --- /dev/null +++ b/fieldtrip/__fileio/ft_create_buffer.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def ft_create_buffer(*args, **kwargs): + """ + FT_CREATE_BUFFER starts the thread with the TCP server attached to the local + MATLAB instance. The TCP server will listen to the specified network + port, and accept incoming read and write requests. + + Use as + ft_create_buffer(port) + where port is the TCP port to which the server listens. The default port + number is 1972. + + See also FT_DESTROY_BUFFER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_create_buffer.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_create_buffer", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/ft_destroy_buffer.py b/fieldtrip/__fileio/ft_destroy_buffer.py new file mode 100644 index 0000000..6403c77 --- /dev/null +++ b/fieldtrip/__fileio/ft_destroy_buffer.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def ft_destroy_buffer(*args, **kwargs): + """ + FT_DESTROY_BUFFER stops the thread with the TCP server attached to + the local MATLAB instance and removes all data from memory. + + Use as + ft_destroy_buffer + + See also FT_CREATE_BUFFER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_destroy_buffer.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_destroy_buffer", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/ft_filetype.py b/fieldtrip/__fileio/ft_filetype.py new file mode 100644 index 0000000..97920a6 --- /dev/null +++ b/fieldtrip/__fileio/ft_filetype.py @@ -0,0 +1,107 @@ +from fieldtrip._runtime import Runtime + + +def ft_filetype(*args, **kwargs): + """ + FT_FILETYPE determines the filetype of many EEG/MEG/MRI data files by + looking at the name, extension and optionally (part of) its contents. + It tries to determine the global type of file (which usually + corresponds to the manufacturer, the recording system or to the + software used to create the file) and the particular subtype (e.g. + continuous, average). + + Use as + type = ft_filetype(filename) + type = ft_filetype(dirname) + + This gives you a descriptive string with the data type, and can be + used in a switch-statement. The descriptive string that is returned + usually is something like 'XXX_YYY'/ where XXX refers to the + manufacturer and YYY to the type of the data. + + Alternatively, use as + flag = ft_filetype(filename, type) + flag = ft_filetype(dirname, type) + This gives you a boolean flag (0 or 1) indicating whether the file + is of the desired type, and can be used to check whether the + user-supplied file is what your subsequent code expects. + + Alternatively, use as + flag = ft_filetype(dirlist, type) + where the dirlist contains a list of files contained within one + directory. This gives you a boolean vector indicating for each file + whether it is of the desired type. + + Most filetypes of the following manufacturers and/or software programs are recognized + - 4D/BTi + - AFNI + - ASA + - Analyse + - Analyze/SPM + - BESA + - Bioimage Suite *.mgrid + - BrainSuite + - BrainVisa + - BrainVision + - Curry + - Dataq + - EDF + - EEProbe + - Elektra/Neuromag + - EEGsynth *.tsv + - FreeSurfer + - LORETA + - Localite + - MINC + - Neuralynx + - Neuroscan + - Nihon Koden *.m00 + - OpenVibe MATLAB files *.mat + - Plexon + - SR Research Eyelink + - SensoMotoric Instruments (SMI) *.txt + - Tobii *.tsv + - Stanford *.ply + - Tucker Davis Technology + - CTF + - Yokogawa & Ricoh + - nifti, gifti + - Nicolet *.e (currently from Natus, formerly Carefusion, Viasys and Taugagreining. Also known as Oxford/Teca/Medelec Valor Nervus) + - Biopac *.acq + - AnyWave *.ades + - Qualisys *.tsv + - Mrtrix *.mif + - MAUS *.TextGrid + - Neurodata Without Borders *.nwb + - PhysioNet *.hea and *.dat + - NIRx *.tpl, *.wl1 and *.wl2 + - York Instruments *.meghdf5 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_filetype.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_filetype", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_filter_event.py b/fieldtrip/__fileio/ft_filter_event.py new file mode 100644 index 0000000..b1a2009 --- /dev/null +++ b/fieldtrip/__fileio/ft_filter_event.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def ft_filter_event(*args, **kwargs): + """ + FT_FILTER_EVENT does what its name implies + + Use as + event = ft_filter_event(event, ...) + + The optional arguments should come in key-value pairs and determine the + filter characteristics: + type = cell-array with strings + value = numeric array + sample = numeric array + timestamp = numeric array + offset = numeric array + duration = numeric array + minsample = value + maxsample = value + minduration = value + maxduration = value + mintimestamp = value + maxtimestamp = value + minnumber = value, applies only if event.number is present + maxnmumber = value, applies only if event.number is present + + See also FT_READ_EVENT, FT_WRITE_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_filter_event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_filter_event", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_flush_data.py b/fieldtrip/__fileio/ft_flush_data.py new file mode 100644 index 0000000..5b486e6 --- /dev/null +++ b/fieldtrip/__fileio/ft_flush_data.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def ft_flush_data(*args, **kwargs): + """ + FT_FLUSH_DATA removes all data from the data queue + + Use as + ft_flush_data(filename, ...) + + See also FT_FLUSH_HEADER, FT_FLUSH_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_flush_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_flush_data", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/ft_flush_event.py b/fieldtrip/__fileio/ft_flush_event.py new file mode 100644 index 0000000..f7c4bea --- /dev/null +++ b/fieldtrip/__fileio/ft_flush_event.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def ft_flush_event(*args, **kwargs): + """ + FT_FLUSH_EVENT removes all events from the event queue + + Use as + ft_flush_event(filename, ...) + + See also FT_FLUSH_HEADER, FT_FLUSH_DATA + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_flush_event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_flush_event", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/ft_flush_header.py b/fieldtrip/__fileio/ft_flush_header.py new file mode 100644 index 0000000..f3019fe --- /dev/null +++ b/fieldtrip/__fileio/ft_flush_header.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def ft_flush_header(*args, **kwargs): + """ + FT_FLUSH_HEADER removes the header information from the data queue + this also removes all data associated with the specific header. + + Use as + ft_flush_header(filename, ...) + + See also FT_FLUSH_DATA, FT_FLUSH_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_flush_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_flush_header", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/ft_poll_buffer.py b/fieldtrip/__fileio/ft_poll_buffer.py new file mode 100644 index 0000000..9876898 --- /dev/null +++ b/fieldtrip/__fileio/ft_poll_buffer.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def ft_poll_buffer(*args, **kwargs): + """ + FT_POLL_BUFFER is deprecated. + + Please use FT_READ_DATA and FT_READ_EVENT with the 'blocking' and + the 'timeout' options. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_poll_buffer.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_poll_buffer", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_read_atlas.py b/fieldtrip/__fileio/ft_read_atlas.py new file mode 100644 index 0000000..272493b --- /dev/null +++ b/fieldtrip/__fileio/ft_read_atlas.py @@ -0,0 +1,108 @@ +from fieldtrip._runtime import Runtime + + +def ft_read_atlas(*args, **kwargs): + """ + FT_READ_ATLAS reads an template/individual segmentation or parcellation from disk. + + The volumetric segmentation or the surface-based parcellation can either represent + a template atlas (for example AAL or the Talairach Daemon), it can represent an + individualized atlas (for example obtained from FreeSurfer) or it can represent an + unlabeled parcellation/segmentation obtained from an individual's DTi, anatomical, + or resting state fMRI scan. + + Use as + atlas = ft_read_atlas(filename, ...) + or + atlas = ft_read_atlas({filenamelabels, filenamemesh}, ...) + + Additional options should be specified in key-value pairs and can include + 'format' = string, see below + 'unit' = string, for example 'mm' (default is to keep it in the native units of the file) + 'map' = string, 'maxprob' (default), or 'prob', for FSL-based atlases, providing + either a probabilistic segmentation or a maximum a posterior probability map + 'labelfile' = string, point to a (generic) txt or xml file for the interpretation of + the values in the atlas (default is automatic) + + For individual surface-based atlases from FreeSurfer you should specify two + filenames as a cell-array: the first points to the file that contains information + with respect to the parcels' labels, the second points to the file that defines the + mesh on which the parcellation is defined. + + The 'format' variable in general is not needed to be specified, it will be determined + automatically. The following formats are supported: + + Volumetric atlases based on a (gzipped) nifti-file with an companion txt-file for interpretation + 'aal' assumes filename starting with 'ROI_MNI' + 'brainnetome' assumes companion lookuptable txt-file starting with 'Brainnetome Atlas' + 'simnibs_v4' assumes filename starting with 'final_tissues', with companion freesurfer-style lookuptable txt-file + 'wfu' assumes specific formatting of companion lookuptable txt-file + + Volumetric atlases based on a (gzipped) nifti-file with hard coded assumption on the labels + 'yeo7' + 'yeo17' + + Volumetric atlases based on a folder with (gzipped) nifti-files with a companion xml-file for interpretation + 'fsl' assumes path to folder with data mentioned in the xml-file. Use xml-file as filename + + Volumetric atlases based on the freesurfer mgz format with standard lookuptable txt-file for interpretation + 'freesurfer_volume' assumes the freesurfer LUT file for interpretation, and assumes aparc or aseg in the + filename, used for subject-specific parcellations + + Volumetric atlases based on the afni software + 'afni' assumes filename containing BRIK or HEAD, assumes generic interpretation of the labels + for the TTatlas+tlrc, or otherwise the interpretation should be in the file + + Volumetric atlas based on the spm_anatomy toolbox + 'spm_anatomy' pair of .hdr/.img files, and an associated mat-file for the interpretation. Please + specify the associated mat-file with MPM as the filename. + + Surface based atlases, requiring a pair of files, containing the labels, and the associated geometry + 'caret_label' hcp-workbench/caret style .gii, with .label. in filename, requires additional file describing the geometry + 'freesurfer_surface' freesurfer style annotation file, requires additional file describing the geometry + + Miscellaneous formats + 'vtpm' + 'mat' mat-file, with FieldTrip style struct, or other MATLAB data that FieldTrip knows to + handle, this can also be Brainstorm derived surfaces + + A list of fake tissue labels will be generated if the volume data does not have a + companion file for the interpretation of the labels or for volume data for which + the format cannot be automatically detected. + + The output atlas will be represented as structure according to FT_DATATYPE_SEGMENTATION or + FT_DATATYPE_PARCELLATION. + + The 'lines' and the 'colorcube' colormaps are useful for plotting the different + patches, for example using FT_PLOT_MESH, or FT_SOURCEPLOT. + + See also FT_READ_MRI, FT_READ_HEADSHAPE, FT_PREPARE_SOURCEMODEL, FT_SOURCEPARCELLATE, FT_PLOT_MESH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_read_atlas.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_read_atlas", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_read_cifti.py b/fieldtrip/__fileio/ft_read_cifti.py new file mode 100644 index 0000000..0f328b6 --- /dev/null +++ b/fieldtrip/__fileio/ft_read_cifti.py @@ -0,0 +1,64 @@ +from fieldtrip._runtime import Runtime + + +def ft_read_cifti(*args, **kwargs): + """ + FT_READ_CIFTI read functional data or functional connectivity from a cifti-1 or + cifti-2 file. The functional data can consist of a dense or a parcellated + representation. The geometrical description of the brainordinates can consist of + triangulated surfaces or voxels in a regular 3-D volumetric grid. If available, + it also reads the geometrical description of the surfaces from the accompanying + gifti files. + + Use as + data = ft_read_cifti(filename, ...) + + If the file contains a dense representation of functional data, the output data + structure is organized according to the FT_DATATYPE_SOURCE or FT_DATATYPE_VOLUME + definition. + + If the contains a parcellated representation of functional data, the output data + structure is organized according to the FT_DATATYPE_TIMELOCK or FT_DATATYPE_FREQ + definition. In addition, the description of the geometry wil be represented in a + data.brainordinate field, which is organized according to the FT_DATATYPE_SOURCE + or FT_DATATYPE_VOLUME definition. + + Any optional input arguments should come in key-value pairs and may include + 'readdata' = boolean, can be false or true (default depends on file size) + 'readsurface' = boolean, can be false or true (default = true) + 'cortexleft' = string, filename with left cortex (optional, default is automatic) + 'cortexright' = string, filename with right cortex (optional, default is automatic) + 'hemisphereoffset' = number, amount in milimeter to move the hemispheres apart from each other (default = 0) + 'mapname' = string, 'field' to represent multiple maps separately, or 'array' to represent as array (default = 'field') + 'debug' = boolean, write a debug.xml file (default = false) + + See also FT_WRITE_CIFTI, FT_READ_MRI, FT_WRITE_MRI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_read_cifti.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_read_cifti", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_read_data.py b/fieldtrip/__fileio/ft_read_data.py new file mode 100644 index 0000000..1c85cfb --- /dev/null +++ b/fieldtrip/__fileio/ft_read_data.py @@ -0,0 +1,70 @@ +from fieldtrip._runtime import Runtime + + +def ft_read_data(*args, **kwargs): + """ + FT_READ_DATA reads data from a variety of EEG, MEG and other time series data files + and represents it in a common data-independent format. The supported formats are + listed in the accompanying FT_READ_HEADER function. + + Use as + dat = ft_read_data(filename, ...) + + Additional options should be specified in key-value pairs and can be + 'header' header structure, see FT_READ_HEADER + 'begsample' first sample to read + 'endsample' last sample to read + 'begtrial' first trial to read, mutually exclusive with begsample+endsample + 'endtrial' last trial to read, mutually exclusive with begsample+endsample + 'chanindx' list with channel indices to read + 'chanunit' cell-array with strings, convert each channel to the desired unit + 'checkboundary' boolean, whether to check for reading segments over a trial boundary + 'checkmaxfilter' boolean, whether to check that maxfilter has been correctly applied (default = true) + 'cache' boolean, whether to use caching for multiple reads + 'dataformat' string + 'headerformat' string + 'fallback' can be empty or 'biosig' (default = []) + 'blocking' wait for the selected number of events (default = 'no') + 'timeout' amount of time in seconds to wait when blocking (default = 5) + 'password' password structure for encrypted data set (only for dhn_med10, mayo_mef30 and mayo_mef21) + + This function returns a 2-D matrix of size Nchans*Nsamples for continuous + data when begevent and endevent are specified, or a 3-D matrix of size + Nchans*Nsamples*Ntrials for epoched or trial-based data when begtrial + and endtrial are specified. + + To use an external reading function, you can specify an external function as the + 'dataformat' option. This function should take five input arguments: filename, hdr, + begsample, endsample, chanindx. Please check the code of this function for details, + and search for BIDS_TSV as example. + + See also FT_READ_HEADER, FT_READ_EVENT, FT_WRITE_DATA, FT_WRITE_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_read_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_read_data", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_read_event.py b/fieldtrip/__fileio/ft_read_event.py new file mode 100644 index 0000000..d19a14e --- /dev/null +++ b/fieldtrip/__fileio/ft_read_event.py @@ -0,0 +1,104 @@ +from fieldtrip._runtime import Runtime + + +def ft_read_event(*args, **kwargs): + """ + FT_READ_EVENT reads all events from an EEG, MEG or other time series dataset and + returns them in a common data-independent structure. The supported formats are + listed in the accompanying FT_READ_HEADER function. + + Use as + [event] = ft_read_event(filename, ...) + + Additional options should be specified in key-value pairs and can be + 'dataformat' = string + 'headerformat' = string + 'eventformat' = string + 'header' = header structure, see FT_READ_HEADER + 'detectflank' = string, can be 'up', 'updiff', 'down', 'downdiff', 'both', 'any', 'biton', 'bitoff' (default is system specific) + 'trigshift' = integer, number of samples to shift from flank to detect trigger value (default = 0) + 'chanindx' = list with channel numbers for trigger detection, specify -1 in case you don't want to detect triggers (default is automatic) + 'threshold' = threshold for analog trigger channels (default is system specific) + 'tolerance' = tolerance in samples when merging Neuromag analogue trigger channels (default = 1, meaning that a shift of one sample in both directions is compensated for) + 'blocking' = wait for the selected number of events (default = 'no') + 'timeout' = amount of time in seconds to wait when blocking (default = 5) + 'password' = password structure for encrypted data set (only for dhn_med10, mayo_mef30 and mayo_mef21) + 'readbids' = 'yes', no', or 'ifmakessense', whether to read information from the BIDS sidecar files (default = 'ifmakessense') + + This function returns an event structure with the following fields + event.type = string + event.sample = expressed in samples, the first sample of a recording is 1 + event.value = number or string + event.offset = expressed in samples + event.duration = expressed in samples + event.timestamp = expressed in timestamp units, which vary over systems (optional) + + You can specify optional arguments as key-value pairs for filtering the events, + e.g. to select only events of a specific type, of a specific value, or events + between a specific begin and end sample. This event filtering is especially usefull + for real-time processing. See FT_FILTER_EVENT for more details. + + Some data formats have trigger channels that are sampled continuously with the same + rate as the electrophysiological data. The default is to detect only the up-going + TTL flanks. The trigger events will correspond with the first sample where the TTL + value is up. This behavior can be changed using the 'detectflank' option, which + also allows for detecting the down-going flank or both. In case of detecting the + down-going flank, the sample number of the event will correspond with the first + sample at which the TTF went down, and the value will correspond to the TTL value + just prior to going down. + + To use an external reading function, you can specify an external function as the + 'eventformat' option. This function should take the filename and the headeras + input arguments. Please check the code of this function for details, and search for + BIDS_TSV as example. + + The event type and sample fields are always defined, other fields are present but + can be empty, depending on the type of event file. Events are sorted by the sample + on which they occur. After reading the event structure, you can use the following + tricks to extract information about those events in which you are interested. + + Determine the different event types + unique({event.type}) + + Get the index of all trial events + find(strcmp('trial', {event.type})) + + Make a vector with all triggers that occurred on the backpanel + [event(find(strcmp('backpanel trigger', {event.type}))).value] + + Find the events that occurred in trial 26 + t=26; samples_trials = [event(find(strcmp('trial', {event.type}))).sample]; + find([event.sample]>samples_trials(t) & [event.sample]. + """ + + return Runtime.call("ft_read_event", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_read_header.py b/fieldtrip/__fileio/ft_read_header.py new file mode 100644 index 0000000..1725b11 --- /dev/null +++ b/fieldtrip/__fileio/ft_read_header.py @@ -0,0 +1,133 @@ +from fieldtrip._runtime import Runtime + + +def ft_read_header(*args, **kwargs): + """ + FT_READ_HEADER reads header information from a variety of EEG, MEG and other time + series data files and represents the header information in a common + data-independent structure. The supported formats are listed below. + + Use as + hdr = ft_read_header(filename, ...) + + Additional options should be specified in key-value pairs and can be + 'headerformat' = string + 'fallback' = can be empty or 'biosig' (default = []) + 'checkmaxfilter' = boolean, whether to check that maxfilter has been correctly applied (default = true) + 'chanindx' = list with channel indices in case of different sampling frequencies (only for EDF) + 'chantype' = string or cell-array with strings, channel types to be read (only for NeuroOmega and BlackRock) + 'coordsys' = string, 'head' or 'dewar' (default = 'head') + 'headerformat' = name of a MATLAB function that takes the filename as input (default is automatic) + 'password' = password structure for encrypted data set (for dhn_med10, mayo_mef30, mayo_mef21) + 'readbids' = string, 'yes', no', or 'ifmakessense', whether to read information from the BIDS sidecar files (default = 'ifmakessense') + 'splitlabel' = string, 'yes' or 'no', split the channel labels on the '-' and return the first part (default = 'yes' for CTF and FieldLine, 'no' for others) + + This returns a header structure with the following fields + hdr.Fs = sampling frequency + hdr.nChans = number of channels + hdr.nSamples = number of samples per trial + hdr.nSamplesPre = number of pre-trigger samples in each trial + hdr.nTrials = number of trials + hdr.label = Nx1 cell-array with the label of each channel + hdr.chantype = Nx1 cell-array with the channel type, see FT_CHANTYPE + hdr.chanunit = Nx1 cell-array with the physical units, see FT_CHANUNIT + + For continuously recorded data, this will return nSamplesPre=0 and nTrials=1. + + For some data formats that are recorded on animal electrophysiology + systems (e.g. Neuralynx, Plexon), the following optional fields are + returned, which allows for relating the timing of spike and LFP data + hdr.FirstTimeStamp number, represented as 32-bit or 64-bit unsigned integer + hdr.TimeStampPerSample number, represented in double precision + + Depending on the file format, additional header information can be + returned in the hdr.orig subfield. + + To use an external reading function, you can specify an external function as the + 'headerformat' option. This function should take the filename as input argument. + Please check the code of this function for details, and search for BIDS_TSV as + example. + + The following MEG dataformats are supported + CTF (*.ds, *.res4, *.meg4) + Neuromag/Elekta/Megin (*.fif) + BTi/4D (*.m4d, *.pdf, *.xyz) + Yokogawa/Ricoh (*.ave, *.con, *.raw) + NetMEG (*.nc) + ITAB - Chieti (*.mhd) + Tristan Babysquid (*.fif) + York Instruments (*.meghdf5) + + The following EEG dataformats are supported + ANT - Advanced Neuro Technology, EEProbe (*.avr, *.eeg, *.cnt) + BCI2000 (*.dat) + Biosemi (*.bdf) + Bitalino OpenSignals (*.txt) + BrainVision (*.eeg, *.seg, *.dat, *.vhdr, *.vmrk) + CED - Cambridge Electronic Design (*.smr) + EGI - Electrical Geodesics, Inc. (*.egis, *.ave, *.gave, *.ses, *.raw, *.sbin, *.mff) + GTec (*.mat, *.hdf5) + GTec Unicorn (*.csv) + Generic data formats (*.edf, *.gdf) + Megis/BESA (*.avr, *.swf, *.besa) + Mega Neurone (directory) + Natus/Nicolet/Nervus (.e files) + Nihon Kohden (*.m00, *.EEG) + NeuroScan (*.eeg, *.cnt, *.avg) + Nexstim (*.nxe) + OpenBCI (*.txt) + PhysioNet (*.hea, *.dat) + TMSi (*.Poly5) + + The following spike and LFP dataformats are supported + CED - Cambridge Electronic Design (*.smr) + MPI - Max Planck Institute (*.dap) + Neuralynx (*.ncs, *.nse, *.nts, *.nev, *.nrd, *.dma, *.log) + Neurodata Without Borders (*.nwb) + Neurosim (neurosim_spikes, neurosim_signals, neurosim_ds) + NeuroOmega (*.mat transformed from *.mpx) + Neuropixel data recorded with SpikeGLX (*.bin, *.meta) + Plextor (*.nex, *.plx, *.ddt) + Windaq (*.wdq) + + The following NIRS dataformats are supported + Artinis - Artinis Medical Systems B.V. (*.oxy3, *.oxy4, *.oxy5, *.oxyproj) + BUCN - Birkbeck college, London (*.txt) + SNIRF - Society for functional near-infrared spectroscopy (*.snirf) + + The following Eyetracker dataformats are supported + EyeLink - SR Research (*.asc) + SensoMotoric Instruments - (*.txt) + Tobii - (*.tsv) + + See also FT_READ_DATA, FT_READ_EVENT, FT_WRITE_DATA, FT_WRITE_EVENT, + FT_CHANTYPE, FT_CHANUNIT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_read_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_read_header", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_read_headmodel.py b/fieldtrip/__fileio/ft_read_headmodel.py new file mode 100644 index 0000000..c839bb4 --- /dev/null +++ b/fieldtrip/__fileio/ft_read_headmodel.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def ft_read_headmodel(*args, **kwargs): + """ + FT_READ_HEADMODEL reads a head model (or volume conduction model of the head) from + various manufacturer specific files. Currently supported are ASA, CTF, Neuromag, + MBFYS, MATLAB and SimNIBS. The volume conduction model is represented as a + structure with fields that depend on the type of model. + + Use as + headmodel = ft_read_headmodel(filename, ...) + + Additional options should be specified in key-value pairs and can be + 'fileformat' = string + + If the fileformat is 'simnibs', an additional options can be used to specify the + type of model that is to be returned. + 'meshtype' = string, 'volume' or 'surface' (default is automatic) + + See also FT_DATATYPE_HEADMODEL, FT_PREPARE_HEADMODEL, FT_READ_HEADMODEL, + FT_PREPARE_VOL_SENS, FT_COMPUTE_LEADFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_read_headmodel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_read_headmodel", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_read_headshape.py b/fieldtrip/__fileio/ft_read_headshape.py new file mode 100644 index 0000000..b8e6951 --- /dev/null +++ b/fieldtrip/__fileio/ft_read_headshape.py @@ -0,0 +1,103 @@ +from fieldtrip._runtime import Runtime + + +def ft_read_headshape(*args, **kwargs): + """ + FT_READ_HEADSHAPE reads the fiducials and/or the measured headshape and/or meshes + that describe headsurfaces, headmodels or cortical sheets from a variety of files + (like CTF and Polhemus). The headshape and fiducials can for example be used for + coregistration. + + Use as + [shape] = ft_read_headshape(filename, ...) + or + [shape] = ft_read_headshape({filename1, filename2}, ...) + + If you specify the filename as a cell-array, the following situations are supported: + - a two-element cell-array with the file names for the left and right hemisphere, + e.g., FreeSurfer's {'lh.orig' 'rh.orig'}, or Caret's {'X.L.Y.Z.surf.gii' 'X.R.Y.Z.surf.gii'} + - a two-element cell-array points to files that represent the coordinates and topology + in separate files, e.g., Caret's {'X.L.Y.Z.coord.gii' 'A.L.B.C.topo.gii'} + By default all information from the two files will be assumed to correspond to the + left and right hemispeheres and concatenated. The option 'concatenate' can be set + to 'no' to prevent them from being concatenated in a single structure. + + Additional options should be specified in key-value pairs and can include + 'format' = string, see below + 'coordsys' = string, e.g. 'head' or 'dewar' (only supported for CTF) + 'unit' = string, e.g. 'mm' (default is the native units of the file) + 'concatenate' = 'yes' or 'no' (default = 'yes') + 'image' = path to corresponding image/jpg file + 'surface' = specific surface to be read (only for Caret spec files) + 'refine' = number, used for refining Structure Sensor meshes (default = 1) + 'jmeshopt' = cell-array with {'name', 'value'} pairs, options for reading JSON/JMesh files + 'meshtype' = string, which type of mesh to read in case the file contains multiple types, can be 'tri', 'tet' or 'hex' + + Supported input file formats include + 'gifti' see https://www.nitrc.org/projects/gifti/ + 'gmsh_ascii' see https://gmsh.info + 'gmsh_binary' see https://gmsh.info + 'matlab' containing FieldTrip or BrainStorm headshapes or cortical meshes + 'mne_tri' MNE surface description in ASCII format + 'mne_pos' MNE source grid in ascii format, described as 3D points + 'neurojson_jmesh' NeuroJSON ascii JSON-based format + 'neurojson_bmesh' NeuroJSON binary JSON-based format + 'obj' Wavefront .obj file obtained with the Structure Sensor + 'off' see http://www.geomview.org/docs/html/OFF.html + 'ply' Stanford Polygon file format, for use with Paraview or Meshlab + 'stl' STereoLithography file format, for use with CAD and/or generic 3D mesh editing programs + 'tck' Mrtrix track file + 'trk' Trackvis trk file + 'vista' see http://www.cs.ubc.ca/nest/lci/vista/vista.html + 'vtk' Visualization ToolKit file format, for use with Paraview + 'vtk_xml' Visualization ToolKit file format + 'itab_asc' + 'ctf_*' + '4d_*' + 'neuromag_*' + 'yokogawa_*' + 'yorkinstruments_hdf5' + 'polhemus_*' + 'freesurfer_*' + 'mne_source' + 'spmeeg_mat' + 'netmeg' + 'tet' + 'tetgen_ele' + 'caret_surf' + 'caret_coord' + 'caret_topo' + 'caret_spec' + 'brainvisa_mesh' + 'brainsuite_dfs' + + See also FT_READ_HEADMODEL, FT_READ_SENS, FT_READ_ATLAS, FT_WRITE_HEADSHAPE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_read_headshape.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_read_headshape", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_read_json.py b/fieldtrip/__fileio/ft_read_json.py new file mode 100644 index 0000000..a0c72a3 --- /dev/null +++ b/fieldtrip/__fileio/ft_read_json.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def ft_read_json(*args, **kwargs): + """ + FT_READ_JSON reads information from a JSON file and represents it as a MATLAB structure + + Use as + json = ft_read_json(filename) + + See also FT_WRITE_JSON, FT_READ_TSV, FT_WRITE_TSV, JSONDECODE, JSONENCODE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_read_json.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_read_json", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_read_mri.py b/fieldtrip/__fileio/ft_read_mri.py new file mode 100644 index 0000000..a283c5a --- /dev/null +++ b/fieldtrip/__fileio/ft_read_mri.py @@ -0,0 +1,110 @@ +from fieldtrip._runtime import Runtime + + +def ft_read_mri(*args, **kwargs): + """ + FT_READ_MRI reads anatomical and functional MRI data from different file formats. + The output data is structured in such a way that it is compatible with + FT_DATATYPE_VOLUME. + + Use as + [mri] = ft_read_mri(filename, ...) + + Additional options should be specified in key-value pairs and can include + 'dataformat' = string specifying the file format, determining the low-level + reading routine to be used. If no explicit format is given, + it is determined automatically from the filename. + 'volumes' = vector with the volume indices to read from a 4D nifti (only for 'nifti_spm') + 'outputfield' = string specifying the name of the field in the structure in which the + numeric data is stored (default = 'anatomy') + 'fixel2voxel' = string, the operation to apply to the fixels belonging to the + same voxel, can be 'max', 'min', 'mean' (only for 'mrtrix_mif', default = 'max') + 'indexfile' = string, pointing to a fixel index file, if not present in the same directory + as the functional data (only for 'mrtrix_mif') + 'spmversion' = string, version of SPM to be used (default = 'spm12') + 'readbids' = string, 'yes', no', or 'ifmakessense', whether to read information from + the BIDS sidecar files (default = 'ifmakessense') + + The supported dataformats are + 'afni_head'/'afni_brik' uses AFNI code + 'analyze_img'/'analyze_hdr' uses SPM code + 'analyze_old' uses Darren Webber's code + 'asa_mri' + 'ctf_mri' + 'ctf_mri4' + 'ctf_svl' + 'dicom' uses SPM code, same as dicom_spm + 'dicom_spm' uses SPM code, also allows for multiframe dicoms (one volume in a file) + 'dicom_fs' uses FreeSurfer code, which relies on MATLAB image processing toolbox + 'dicom_old' uses MATLAB image processing toolbox code + 'freesurfer_mgh' uses FreeSurfer code + 'freesurfer_mgz' uses FreeSurfer code + 'jnifti_jnii' + 'jnifti_bnii' + 'matlab' assumes a MATLAB *.mat file containing a struct + 'minc' uses SPM, this requires SPM5 or older + 'mrtrix_mif' uses mrtrix code + 'neuromag_fif' uses MNE toolbox code + 'neuromag_fif_old' uses meg-pd toolbox + 'nifti' uses FreeSurfer code + 'nifti_spm' uses SPM code + 'seg3d_mat' MATLAB file from Seg3D with a scirunnrrd structure + 'yokogawa_mri' + + The following MRI file formats are supported + AFNI (*.head, *.brik) + ANT - Advanced Neuro Technology (*.mri) + Analyze (*.img, *.hdr) + CTF (*.svl, *.mri version 4 and 5) + DICOM (*.dcm, *.ima) + FreeSurfer (*.mgz, *.mgh) + MATLAB (*.mat) + MINC (*.mnc) + Mrtrix image format (*.mif) + NIFTi (*.nii) and zipped NIFTi (*.nii.gz) + Neuromag/Elekta/Megin (*.fif) + Yokogawa (*.mrk, incomplete) + + If you have a series of DICOM files, please provide the name of any of the files in + the series (e.g. the first one). The files corresponding to the whole volume will + be found automatically. + + The output MRI may have a homogenous transformation matrix that converts the + coordinates of each voxel (in xgrid/ygrid/zgrid) into head coordinates. + + If the input file is a 4D nifti, and you wish to load in just a subset of the + volumes, for example due to memory constraints, you should use as dataformat 'nifti_spm', + which uses the optional key-value pair 'volumes' = vector, with the indices of the + to-be-read volumes. The order of the indices is ignored, and the volumes will be + sorted according to the original numeric indices, i.e., 1:10 yields the same as 10:-1:1 + + See also FT_DATATYPE_VOLUME, FT_WRITE_MRI, FT_READ_DATA, FT_READ_HEADER, FT_READ_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_read_mri.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_read_mri", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_read_sens.py b/fieldtrip/__fileio/ft_read_sens.py new file mode 100644 index 0000000..ae5b766 --- /dev/null +++ b/fieldtrip/__fileio/ft_read_sens.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def ft_read_sens(*args, **kwargs): + """ + FT_READ_SENS read sensor positions from various manufacturer specific files. See + further down for the list of file types that are supported. + + Use as + elec = ft_read_sens(filename, 'senstype', 'eeg', ...) % for EEG electrodes + grad = ft_read_sens(filename, 'senstype', 'meg', ...) % for MEG gradiometers + opto = ft_read_sens(filename, 'senstype', 'nirs', ...) % for NIRS optodes + + Additional options should be specified in key-value pairs and can be + 'fileformat' = string, see the list of supported file formats (the default is determined automatically) + 'senstype' = string, can be 'eeg', 'meg' or 'nirs', specifies which type of sensors to read from the file (default = 'eeg') + 'coordsys' = string, 'head' or 'dewar' (default = 'head') + 'coilaccuracy' = scalar, can be empty or a number (0, 1 or 2) to specify the accuracy (default = []) + 'coildeffile' = string, can be empty, to specify a coil_def.dat file if coilaccuracy ~= [] + 'readbids' = string, 'yes', no', or 'ifmakessense', whether to read information from the BIDS sidecar files (default = 'ifmakessense') + + The electrode, gradiometer and optode structures are defined in more detail + in FT_DATATYPE_SENS. + + Files from the following acquisition systems and analysis platforms file formats + are supported. + asa_elc besa_elp besa_pos besa_sfp yokogawa_ave yokogawa_con yokogawa_raw 4d + 4d_pdf 4d_m4d 4d_xyz ctf_ds ctf_res4 itab_raw itab_mhd netmeg neuromag_fif + neuromag_mne neuromag_mne_elec neuromag_mne_grad polhemus_fil polhemus_pos + zebris_sfp spmeeg_mat eeglab_set localite_pos artinis_oxy3 artinis_oxy4 + artinis_oxy5 artinis_oxyproj yorkinstruments_hdf5 matlab + + See also FT_READ_HEADER, FT_DATATYPE_SENS, FT_PREPARE_VOL_SENS, FT_COMPUTE_LEADFIELD, + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_read_sens.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_read_sens", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_read_spike.py b/fieldtrip/__fileio/ft_read_spike.py new file mode 100644 index 0000000..5b409c3 --- /dev/null +++ b/fieldtrip/__fileio/ft_read_spike.py @@ -0,0 +1,68 @@ +from fieldtrip._runtime import Runtime + + +def ft_read_spike(*args, **kwargs): + """ + FT_READ_SPIKE reads spike timestamps and waveforms from various data formats. + + Use as + [spike] = ft_read_spike(filename, ...) + + Additional options should be specified in key-value pairs and can be + 'spikeformat' = string, described the fileformat (default is automatic) + + The following file formats are supported + 'blackrock_nev' + 'mclust_t' + 'neuralynx_ncs' + 'neuralynx_nse' + 'neuralynx_nst' + 'neuralynx_ntt' + 'neuralynx_nts' + 'neuroshare' + 'neurosim_spikes' + 'nwb' + 'plexon_ddt' + 'plexon_nex' + 'plexon_nex5' + 'plexon_plx' + 'wave_clus' + + The output spike structure usually contains + spike.label = 1xNchans cell-array, with channel labels + spike.waveform = 1xNchans cell-array, each element contains a matrix (Nleads x Nsamples X Nspikes) + spike.waveformdimord = '{chan}_lead_time_spike' + spike.timestamp = 1xNchans cell-array, each element contains a vector (1 X Nspikes) + spike.unit = 1xNchans cell-array, each element contains a vector (1 X Nspikes) + and is described in more detail in FT_DATATYPE_SPIKE + + See also FT_DATATYPE_SPIKE, FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_read_spike.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_read_spike", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_read_tsv.py b/fieldtrip/__fileio/ft_read_tsv.py new file mode 100644 index 0000000..f761b40 --- /dev/null +++ b/fieldtrip/__fileio/ft_read_tsv.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def ft_read_tsv(*args, **kwargs): + """ + FT_READ_TSV reads information from a tab-separated-values file and represents it as a MATLAB table + + Use as + tsv = ft_read_tsv(filename) + + See also FT_WRITE_TSV, FT_READ_JSON, FT_WRITE_JSON, READTABLE, WRITETABLE, TDFREAD, TBLREAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_read_tsv.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_read_tsv", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_read_vol.py b/fieldtrip/__fileio/ft_read_vol.py new file mode 100644 index 0000000..394ab28 --- /dev/null +++ b/fieldtrip/__fileio/ft_read_vol.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def ft_read_vol(*args, **kwargs): + """ + This function is a backward compatibility wrapper for existing MATLAB scripts + that call a function that is not part of the FieldTrip toolbox any more. + + Please update your code to make it future-proof. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_read_vol.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_read_vol", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_write_cifti.py b/fieldtrip/__fileio/ft_write_cifti.py new file mode 100644 index 0000000..0f24b2f --- /dev/null +++ b/fieldtrip/__fileio/ft_write_cifti.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def ft_write_cifti(*args, **kwargs): + """ + FT_WRITE_CIFTI writes functional data or functional connectivity to a cifti-2 + file. The geometrical description of the brainordinates can consist of + triangulated surfaces or voxels in a regular 3-D volumetric grid. The functional + data can consist of a dense or a parcellated representation. Furthermore, it + writes the geometrical description of the surfaces to one or multiple gifti + files. + + Use as + ft_write_cifti(filename, data, ...) + where the filename is a string and the data according to the description below. + + If the input data describes a dense representation of functional data, the data + structure should conform to the FT_DATATYPE_SOURCE or FT_DATATYPE_VOLUME + definition. + + If the input data describes a parcellated representation of functional data, the + data structure should conform to the FT_DATATYPE_TIMELOCK or FT_DATATYPE_FREQ + definition. In addition, the description of the geometry should be specified in + the data.brainordinate field, which should conform to the FT_DATATYPE_SOURCE or + FT_DATATYPE_VOLUME definition. + + Any optional input arguments should come in key-value pairs and may include + 'parameter' = string, fieldname that contains the functional data + 'brainstructure' = string, fieldname that describes the brain structures (default = 'brainstructure') + 'parcellation' = string, fieldname that describes the parcellation (default = 'parcellation') + 'precision' = string, can be 'single', 'double', 'int32', etc. (default ='single') + 'writesurface' = boolean, can be false or true (default = true) + 'debug' = boolean, write a debug.xml file (default = false) + + The brainstructure refers to the global anatomical structure, such as CortexLeft, Thalamus, etc. + The parcellation refers to the the detailed parcellation, such as BA1, BA2, BA3, etc. + + See also FT_READ_CIFTI, FT_READ_MRI, FT_WRITE_MRI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_write_cifti.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_write_cifti", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/ft_write_data.py b/fieldtrip/__fileio/ft_write_data.py new file mode 100644 index 0000000..5d64764 --- /dev/null +++ b/fieldtrip/__fileio/ft_write_data.py @@ -0,0 +1,71 @@ +from fieldtrip._runtime import Runtime + + +def ft_write_data(*args, **kwargs): + """ + FT_WRITE_DATA exports electrophysiological data such as EEG to a file. + + Use as + ft_write_data(filename, dat, ...) + + The specified filename can contain the filename extension. If it has no filename + extension not, it will be added automatically. + + Additional options should be specified in key-value pairs and can be + 'header' = header structure that describes the data, see FT_READ_HEADER + 'event' = event structure that corresponds to the data, see FT_READ_EVENT + 'chanindx' = 1xN array, for selecting a subset of channels from header and data + 'dataformat' = string, see below + 'append' = boolean, not supported for all formats + + The supported dataformats for writing are + edf + gdf + anywave_ades + biosemi_bdf + brainvision_eeg + neuralynx_ncs + neuralynx_sdma + plexon_nex + fcdc_matbin + fcdc_mysql + fcdc_buffer + flac, m4a, mp4, oga, ogg, wav (audio formats) + matlab + homer_nirs + snirf + csv + + For EEG data, the input data is assumed to be scaled in microvolt. + For NIRS data, the input data is assumed to represent optical densities. + + See also FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT, FT_WRITE_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_write_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_write_data", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/ft_write_event.py b/fieldtrip/__fileio/ft_write_event.py new file mode 100644 index 0000000..9118f07 --- /dev/null +++ b/fieldtrip/__fileio/ft_write_event.py @@ -0,0 +1,69 @@ +from fieldtrip._runtime import Runtime + + +def ft_write_event(*args, **kwargs): + """ + FT_WRITE_EVENT writes an event structure to a file, a message daemon listening on a + network socked, or to another computer connected through the serial port. Note that + this function is mostly for real-time streaming of events. For most data files on + disk the writing of events is done simultaneously with the header and data in + FT_WRITE_DATA. + + Use as + ft_write_event(filename, event, ...) + + The first argument is a string containing the filename. The second argument is a + structure with the event. Multiple events can be represented as a structure array. + Events are represented in the same format as those returned by FT_READ_EVENT. + event.type = string + event.sample = expressed in samples, the first sample of a recording is 1 + event.value = number or string + event.offset = expressed in samples + event.duration = expressed in samples + event.timestamp = expressed in timestamp units, which vary over systems (optional) + + Additional options should be specified in key-value pairs and can be + 'eventformat' = string, see below + 'append' = boolean, not supported for all formats + + Events can be written to special communication streams by specifying the target as + URI instead of a filename. Supported are + buffer://: + fifo:// + tcp://: + udp://: + mysql://:@: + rfb://@: + serial:?key1=value1&key2=value2&... + rfb://@: + + See also FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT, FT_WRITE_DATA + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_write_event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_write_event", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/ft_write_headshape.py b/fieldtrip/__fileio/ft_write_headshape.py new file mode 100644 index 0000000..45844ff --- /dev/null +++ b/fieldtrip/__fileio/ft_write_headshape.py @@ -0,0 +1,74 @@ +from fieldtrip._runtime import Runtime + + +def ft_write_headshape(*args, **kwargs): + """ + FT_WRITE_HEADSHAPE writes a head surface, cortical sheet or geometrical descrition + of the volume conduction model or source model to a file for further processing in + external software. + + Use as + ft_write_headshape(filename, mesh, ...) + or + ft_write_headshape(filename, pos, ...) + where the input mesh is a structure containing the vertices and triangles (mesh.pos + and mesh.tri), or where the input pos is a Nx3 matrix that describes the surface + vertices. + + Required input arguments should be specified as key-value pairs and should include + 'format' = string, see below + + Optional input arguments should be specified as key-value pairs and can include + 'data' = data vector or matrix, the size along the 1st dimension should correspond to the number of vertices + 'unit' = string, desired geometrical units for the data, for example 'mm' + 'coordsys' = string, desired coordinate system for the data + 'jmeshopt' = cell-array with {'name', 'value'} pairs, options for writing JSON/JMesh files + + Supported output formats are + 'freesurfer' Freesurfer surf-file format, using write_surf from FreeSurfer + 'gifti' see https://www.nitrc.org/projects/gifti/ + 'gmsh_ascii' see https://gmsh.info + 'gmsh_binary' see https://gmsh.info + 'mne_pos' MNE source grid in ascii format, described as 3D points + 'mne_tri' MNE surface desciption in ascii format + 'neurojson_bmesh' NeuroJSON binary JSON-based format + 'neurojson_jmesh' NeuroJSON ascii JSON-based format + 'off' see http://www.geomview.org/docs/html/OFF.html + 'ply' Stanford Polygon file format, for use with Paraview or Meshlab + 'stl' STereoLithography file format, for use with CAD and generic 3D mesh editing programs + 'tetgen' see https://wias-berlin.de/software/tetgen/ + 'vista' see http://www.cs.ubc.ca/nest/lci/vista/vista.html + 'vtk' Visualization ToolKit file format, for use with Paraview + 'dgf' Duneuro geometry file format, for hexahedral meshes (uses io function from Brainstorm) + 'geo' Cauchy geometry file format (simbio), for tetrahedral meshes (uses io function from Brainstorm) + + See also FT_READ_HEADSHAPE, FT_WRITE_DATA, FT_WRITE_MRI, FT_WRITE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_write_headshape.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_write_headshape", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/ft_write_json.py b/fieldtrip/__fileio/ft_write_json.py new file mode 100644 index 0000000..707b907 --- /dev/null +++ b/fieldtrip/__fileio/ft_write_json.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def ft_write_json(*args, **kwargs): + """ + FT_WRITE_JSON writes a MATLAB structure to a JSON file. Compared to the builtin + MATLAB function, this implementation deals a bit different with missing values, + booleans, and NaNs, and results in a more human-readable file. + + Use as + ft_write_json(filename, struct) + + See also FT_READ_JSON, JSONDECODE, JSONENCODE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_write_json.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_write_json", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/ft_write_mri.py b/fieldtrip/__fileio/ft_write_mri.py new file mode 100644 index 0000000..ff3a3b1 --- /dev/null +++ b/fieldtrip/__fileio/ft_write_mri.py @@ -0,0 +1,71 @@ +from fieldtrip._runtime import Runtime + + +def ft_write_mri(*args, **kwargs): + """ + FT_WRITE_MRI exports volumetric data such as anatomical and functional MRI + to a file. + + Use as + ft_write_mri(filename, dat, ...) + where the input argument dat represents the 3D array with the values. + + The 3-D array with the values can be further described with + 'transform' = 4x4 homogenous transformation matrix, specifying the transformation from voxel coordinates to head or world coordinates + 'unit' = string, desired geometrical units for the data, for example 'mm' + 'coordsys' = string, desired coordinate system for the data + + Additional options should be specified in key-value pairs and can be + 'dataformat' = string, see below + 'spmversion' = string, version of SPM to be used (default = 'spm12') + 'scl_slope' = slope parameter for nifti files + 'scl_inter' = intersect parameter for nifti files + 'vmpversion' = 1 or 2, version of the vmp format to use (default = 2) + + The specified filename can already contain the filename extention. If not present, + it will be added automatically. + + The supported dataformats are + 'analyze' outdated format and not recommended + 'mgz' FreeSurfer specific format + 'mgh' FreeSurfer specific format + 'nifti' uses FreeSurfer code + 'nifti2' uses FreeSurfer code + 'nifti_gz' uses FreeSurfer code + 'nifti_spm' uses SPM + 'seg3d_mat' MATLAB file for Seg3D with a scirunnrrd structure + 'vista' SIMBIO specific format + 'vmr' Brainvoyager specific format + 'vmp' Brainvoyager specific format + 'vtk' Visualization ToolKit file format, for use with Paraview + + See also FT_READ_MRI, FT_DATATYPE_VOLUME, FT_WRITE_DATA, FT_WRITE_HEADSHAPE, FT_WRITE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_write_mri.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_write_mri", *args, **kwargs) diff --git a/fieldtrip/__fileio/ft_write_sens.py b/fieldtrip/__fileio/ft_write_sens.py new file mode 100644 index 0000000..df259cd --- /dev/null +++ b/fieldtrip/__fileio/ft_write_sens.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def ft_write_sens(*args, **kwargs): + """ + FT_WRITE_SENS writes electrode information to an external file for further processing in external software. + + Use as + ft_write_sens(filename, sens, ...) + + The specified filename can already contain the filename extention, + but that is not required since it will be added automatically. + + Additional options should be specified in key-value pairs and can be + 'format' string, see below + + The supported file formats are + bioimage_mgrid + besa_sfp + polhemus_pos + matlab + + See also FT_READ_SENS, FT_DATATYPE_SENS, FT_WRITE_DATA, FT_WRITE_MRI, FT_WRITE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_write_sens.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_write_sens", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/ft_write_spike.py b/fieldtrip/__fileio/ft_write_spike.py new file mode 100644 index 0000000..558c722 --- /dev/null +++ b/fieldtrip/__fileio/ft_write_spike.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def ft_write_spike(*args, **kwargs): + """ + FT_WRITE_SPIKE writes animal electrophysiology spike timestamps and/or waveforms + to file + + Use as + ft_write_spike(filename, spike, ...) + + Additional options should be specified in key-value pairs and can be + 'dataformat' string, see below + 'fsample' sampling frequency of the waveforms + 'chanindx' index of selected channels + 'TimeStampPerSample' number of timestamps per sample + + The supported dataformats are + neuralynx_nse + neuralynx_nts + plexon_nex + matlab + + See also FT_READ_SPIKE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_write_spike.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_write_spike", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__fileio/ft_write_tsv.py b/fieldtrip/__fileio/ft_write_tsv.py new file mode 100644 index 0000000..9f9d16c --- /dev/null +++ b/fieldtrip/__fileio/ft_write_tsv.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def ft_write_tsv(*args, **kwargs): + """ + FT_WRITE_TSV writes a MATLAB table to a tab-separated-values file. Compared to the + builtin MATLAB function, this implementation deals a bit different with missing + values, booleans, and NaNs. + + Use as + ft_write_tsv(filename, table) + + See also FT_READ_TSV, FT_READ_JSON, FT_WRITE_JSON, READTABLE, WRITETABLE, TBLWRITE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fileio/ft_write_tsv.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_write_tsv", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__forward/__init__.py b/fieldtrip/__forward/__init__.py new file mode 100644 index 0000000..8ad693e --- /dev/null +++ b/fieldtrip/__forward/__init__.py @@ -0,0 +1,56 @@ +from .ft_compute_leadfield import ft_compute_leadfield +from .ft_convert_units import ft_convert_units +from .ft_determine_units import ft_determine_units +from .ft_estimate_units import ft_estimate_units +from .ft_headmodel_asa import ft_headmodel_asa +from .ft_headmodel_bemcp import ft_headmodel_bemcp +from .ft_headmodel_concentricspheres import ft_headmodel_concentricspheres +from .ft_headmodel_dipoli import ft_headmodel_dipoli +from .ft_headmodel_duneuro import ft_headmodel_duneuro +from .ft_headmodel_fns import ft_headmodel_fns +from .ft_headmodel_halfspace import ft_headmodel_halfspace +from .ft_headmodel_hbf import ft_headmodel_hbf +from .ft_headmodel_infinite import ft_headmodel_infinite +from .ft_headmodel_interpolate import ft_headmodel_interpolate +from .ft_headmodel_localspheres import ft_headmodel_localspheres +from .ft_headmodel_openmeeg import ft_headmodel_openmeeg +from .ft_headmodel_simbio import ft_headmodel_simbio +from .ft_headmodel_singleshell import ft_headmodel_singleshell +from .ft_headmodel_singlesphere import ft_headmodel_singlesphere +from .ft_headmodel_slab import ft_headmodel_slab +from .ft_headmodeltype import ft_headmodeltype +from .ft_inside_headmodel import ft_inside_headmodel +from .ft_prepare_vol_sens import ft_prepare_vol_sens +from .ft_senslabel import ft_senslabel +from .ft_senstype import ft_senstype +from .ft_sourcedepth import ft_sourcedepth + + +__all__ = [ + "ft_compute_leadfield", + "ft_convert_units", + "ft_determine_units", + "ft_estimate_units", + "ft_headmodel_asa", + "ft_headmodel_bemcp", + "ft_headmodel_concentricspheres", + "ft_headmodel_dipoli", + "ft_headmodel_duneuro", + "ft_headmodel_fns", + "ft_headmodel_halfspace", + "ft_headmodel_hbf", + "ft_headmodel_infinite", + "ft_headmodel_interpolate", + "ft_headmodel_localspheres", + "ft_headmodel_openmeeg", + "ft_headmodel_simbio", + "ft_headmodel_singleshell", + "ft_headmodel_singlesphere", + "ft_headmodel_slab", + "ft_headmodeltype", + "ft_inside_headmodel", + "ft_prepare_vol_sens", + "ft_senslabel", + "ft_senstype", + "ft_sourcedepth", +] diff --git a/fieldtrip/__forward/_add_mex_source.py b/fieldtrip/__forward/_add_mex_source.py new file mode 100644 index 0000000..338344f --- /dev/null +++ b/fieldtrip/__forward/_add_mex_source.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _add_mex_source(*args, **kwargs): + """ + function L = add_mex_source(L, directory, relName, matchPlatform, excludePlatform, extras) + + Input + output argument L is a structure array of directory names, source file names, + and extra arguments required for the compilation of MEX files. This function will + create a new element of this structure and append it to L. + + Further inputs: + directory + target directory of the mex-file + relName + source file relative to 'directory' + matchPlatform + list of platforms this MEX file should only be compiled for. + use an empty matrix [] to compile for all platforms + excludePlatform + list of platforms this MEX file should NOT be compiled for. + extras + extra arguments to the MEX command, e.g. additional source files + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/add_mex_source.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("add_mex_source", *args, **kwargs) diff --git a/fieldtrip/__forward/_ama2headmodel.py b/fieldtrip/__forward/_ama2headmodel.py new file mode 100644 index 0000000..cc8b222 --- /dev/null +++ b/fieldtrip/__forward/_ama2headmodel.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _ama2headmodel(*args, **kwargs): + """ + AMA2HEADMODEL converts a dipoli structure with boundary geometries + and a boundary element method transfer matrix to a volume conduction + model. + + Use as + headmodel = ama2headmodel(ama) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ama2headmodel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ama2headmodel", *args, **kwargs) diff --git a/fieldtrip/__forward/_bmesh2bnd.py b/fieldtrip/__forward/_bmesh2bnd.py new file mode 100644 index 0000000..c20f170 --- /dev/null +++ b/fieldtrip/__forward/_bmesh2bnd.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _bmesh2bnd(*args, **kwargs): + """ + Helper to convert the fieldtrip bnd format for meshes into the bmesh + format for the HBF toolbox, and vice versa. + + George O'Neill + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/bmesh2bnd.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("bmesh2bnd", *args, **kwargs) diff --git a/fieldtrip/__forward/_channelposition.py b/fieldtrip/__forward/_channelposition.py new file mode 100644 index 0000000..6ec150b --- /dev/null +++ b/fieldtrip/__forward/_channelposition.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _channelposition(*args, **kwargs): + """ + CHANNELPOSITION computes the channel positions and orientations from the + MEG coils, EEG electrodes or NIRS optodes + + Use as + [pos, ori, lab] = channelposition(sens) + where sens is an gradiometer, electrode, or optode array. + + See also FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/channelposition.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("channelposition", *args, **kwargs) diff --git a/fieldtrip/__forward/_compile_mex_list.py b/fieldtrip/__forward/_compile_mex_list.py new file mode 100644 index 0000000..24bb804 --- /dev/null +++ b/fieldtrip/__forward/_compile_mex_list.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _compile_mex_list(*args, **kwargs): + """ + function compile_mex_list(L, baseDir) + + Compile a list of MEX files as determined by the input argument L. + The second argument 'baseDir' is the common base directory for the + files listed in L. The third argument is a flag that determines + whether to force (re-)compilation even if the MEX file is up-to-date. + + See also ft_compile_mex, add_mex_source. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/compile_mex_list.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("compile_mex_list", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__forward/_cornerpoints.py b/fieldtrip/__forward/_cornerpoints.py new file mode 100644 index 0000000..1a74720 --- /dev/null +++ b/fieldtrip/__forward/_cornerpoints.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _cornerpoints(*args, **kwargs): + """ + CORNERPOINTS returns the eight corner points of an anatomical volume + in voxel and in head coordinates + + Use as + [voxel, head] = cornerpoints(dim, transform) + which will return two 8x3 matrices. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/cornerpoints.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("cornerpoints", *args, **kwargs) diff --git a/fieldtrip/__forward/_current_dipole.py b/fieldtrip/__forward/_current_dipole.py new file mode 100644 index 0000000..0499753 --- /dev/null +++ b/fieldtrip/__forward/_current_dipole.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _current_dipole(*args, **kwargs): + """ + CURRENT_DIPOLE leadfield for a current dipole in an infinite homogenous medium + + [lf] = current_dipole(R, pos, ori) + + with input arguments + R position dipole + pos position magnetometers + ori orientation magnetometers + + This implements equation 9.3-1 from R.M. Gulrajani (1998) Bioelectricity and + Biomagnetism, John Wiley and Sons, ISBN 04712485252. + + See also MAGNETIC_DIPOLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/current_dipole.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("current_dipole", *args, **kwargs) diff --git a/fieldtrip/__forward/_defaultId.py b/fieldtrip/__forward/_defaultId.py new file mode 100644 index 0000000..f3a3477 --- /dev/null +++ b/fieldtrip/__forward/_defaultId.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _defaultId(*args, **kwargs): + """ + DEFAULTID returns a string that can serve as warning or error identifier, + for example 'FieldTip:ft_read_header:line345'. + + See also WARNING, ERROR, FT_NOTICE, FT_INFO, FT_DEBUG + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/defaultId.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("defaultId", *args, **kwargs) diff --git a/fieldtrip/__forward/_eeg_halfspace_dipole.py b/fieldtrip/__forward/_eeg_halfspace_dipole.py new file mode 100644 index 0000000..a8e7ffb --- /dev/null +++ b/fieldtrip/__forward/_eeg_halfspace_dipole.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _eeg_halfspace_dipole(*args, **kwargs): + """ + EEG_HALFSPACE_DIPOLE calculate the leadfield on electrode positions elc + for a dipole at position dippos. The halfspace solution requires a plane dividing a + conductive zone (cond > 0), from a non-coductive zone (cond = 0). + + Use as + [lf] = eeg_halfspace_dipole(dippos, elc, vol) + + See also EEG_INFINITE_DIPOLE, EEG_INFINITE_MONOPOLE, EEG_HALFSPACE_MONOPOLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/eeg_halfspace_dipole.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("eeg_halfspace_dipole", *args, **kwargs) diff --git a/fieldtrip/__forward/_eeg_halfspace_monopole.py b/fieldtrip/__forward/_eeg_halfspace_monopole.py new file mode 100644 index 0000000..a7d2282 --- /dev/null +++ b/fieldtrip/__forward/_eeg_halfspace_monopole.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _eeg_halfspace_monopole(*args, **kwargs): + """ + EEG_HALFSPACE_MONOPOLE calculate the leadfield on positions elc for a monopole at + position monpos. The halfspace solution requires a plane dividing a conductive zone + (cond > 0), from a non-coductive zone (cond = 0). + + Use as + [lf] = eeg_halfspace_monopole(monpos, elc, vol) + + See also EEG_INFINITE_DIPOLE, EEG_INFINITE_MONOPOLE, EEG_HALFSPACE_DIPOLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/eeg_halfspace_monopole.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("eeg_halfspace_monopole", *args, **kwargs) diff --git a/fieldtrip/__forward/_eeg_infinite_dipole.py b/fieldtrip/__forward/_eeg_infinite_dipole.py new file mode 100644 index 0000000..8919d48 --- /dev/null +++ b/fieldtrip/__forward/_eeg_infinite_dipole.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _eeg_infinite_dipole(*args, **kwargs): + """ + EEG_INFINITE_DIPOLE calculate the infinite medium leadfield on electrode positions + elc for a dipole at dippos and with the conductivity cond. + + Use as + [lf] = eeg_infinite_dipole(R, elc, vol) + + See also EEG_INFINITE_MONOPOLE, EEG_HALFSPACE_DIPOLE, EEG_HALFSPACE_MONOPOLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/eeg_infinite_dipole.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("eeg_infinite_dipole", *args, **kwargs) diff --git a/fieldtrip/__forward/_eeg_infinite_monopole.py b/fieldtrip/__forward/_eeg_infinite_monopole.py new file mode 100644 index 0000000..1d9c1f7 --- /dev/null +++ b/fieldtrip/__forward/_eeg_infinite_monopole.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _eeg_infinite_monopole(*args, **kwargs): + """ + EEG_INFINITE_MONOPOLE calculate the infinite medium potential for a monopole + + Use as + [lf] = eeg_infinite_monopole(monpos, elc, vol) + + Implemented from Malmivuo J, Plonsey R, Bioelectromagnetism (1993) + http://www.bem.fi/book/08/08.htm + + See also EEG_INFINITE_DIPOLE, EEG_HALFSPACE_DIPOLE, EEG_HALFSPACE_MONOPOLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/eeg_infinite_monopole.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("eeg_infinite_monopole", *args, **kwargs) diff --git a/fieldtrip/__forward/_eeg_leadfield1.py b/fieldtrip/__forward/_eeg_leadfield1.py new file mode 100644 index 0000000..b0686f6 --- /dev/null +++ b/fieldtrip/__forward/_eeg_leadfield1.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def _eeg_leadfield1(*args, **kwargs): + """ + EEG_LEADFIELD1 electric leadfield for a dipole in a single sphere + + [lf] = eeg_leadfield1(R, elc, vol) + + with input arguments + R position dipole (vector of length 3) + elc position electrodes + and vol being a structure with the elements + vol.r radius of sphere + vol.cond conductivity of sphere + + The center of the sphere should be at the origin. + + This implementation is adapted from + Luetkenhoener, Habilschrift '92 + The original reference is + R. Kavanagh, T. M. Darccey, D. Lehmann, and D. H. Fender. Evaluation of methods + for three-dimensional localization of electric sources in the human brain. IEEE + Trans Biomed Eng, 25:421-429, 1978. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/eeg_leadfield1.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("eeg_leadfield1", *args, **kwargs) diff --git a/fieldtrip/__forward/_eeg_leadfield4.py b/fieldtrip/__forward/_eeg_leadfield4.py new file mode 100644 index 0000000..2694a9e --- /dev/null +++ b/fieldtrip/__forward/_eeg_leadfield4.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def _eeg_leadfield4(*args, **kwargs): + """ + EEG_LEADFIELD4 electric leadfield for a dipole in 4 concentric spheres + + [lf] = eeg_leadfield4(R, elc, vol) + + with input arguments + R position of the dipole + elc position of the electrodes + and vol being a structure with the elements + vol.r radius of the 4 spheres + vol.cond conductivity of the 4 spheres + vol.t constant factors for series expansion (optional) + + The center of the spheres should be at the origin. + + This implementation is adapted from + Lutkenhoner, Habilschrift 1992. + The original reference is + Cuffin BN, Cohen D. Comparison of the magnetoencephalogram and electroencephalogram. Electroencephalogr Clin Neurophysiol. 1979 Aug;47(2):132-46. + + See also EEG_LEADFIELD4_PREPARE for precomputing the constant factors, + which can save time when multiple leadfield computations are done. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/eeg_leadfield4.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("eeg_leadfield4", *args, **kwargs) diff --git a/fieldtrip/__forward/_eeg_leadfield4_prepare.py b/fieldtrip/__forward/_eeg_leadfield4_prepare.py new file mode 100644 index 0000000..f6e827e --- /dev/null +++ b/fieldtrip/__forward/_eeg_leadfield4_prepare.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def _eeg_leadfield4_prepare(*args, **kwargs): + """ + EEG_LEADFIELD4_PREPARE computes constant factors for series expansion + for the 4 concentric sphere electric leadfield computation. Calling + this function speeds up subsequent computations, as the constant + factors "t" do not have to be computed each time in eeg_leadfield4. + + Use as + vol.t = eeg_leadfield4_prepare(vol, order); + where + vol.r radius of the 4 spheres + vol.cond conductivity of the 4 spheres + and N is the number of terms for the series (default 60). + + The center of the spheres should be at the origin. + + This implementation is adapted from + Lutkenhoner, Habilschrift 1992. + which again is taken from + B. N. Cuffin and D. Cohen. Comparion of the Magnetoencephalogram and the Electroencephalogram. Electroencephalogr Clin Neurophysiol, 47:131-146, 1979. + + See also EEG_LEADFIELD4 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/eeg_leadfield4_prepare.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("eeg_leadfield4_prepare", *args, **kwargs) diff --git a/fieldtrip/__forward/_eeg_leadfieldb.py b/fieldtrip/__forward/_eeg_leadfieldb.py new file mode 100644 index 0000000..bb8a6f2 --- /dev/null +++ b/fieldtrip/__forward/_eeg_leadfieldb.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _eeg_leadfieldb(*args, **kwargs): + """ + EEG_LEADFIELDB computes the electric leadfield for a dipole in a volume + using the boundary element method + + Use as + [lf] = eeg_leadfieldb(dippos, elc, vol) + with the input arguments + dippos = position dipole, 1x3 or Nx3 + elc = electrode positions, Nx3 (optional, can be empty) + vol = volume conductor model + + The volume conductor model is a structure and should have the fields + vol.bnd = structure array with vertices and triangles of each boundary + vol.cond = conductivity for each compartment + vol.mat = system matrix, which can include the electrode interpolation + + The compartment boundaries are described by a structure array with + vol.bnd(i).pos + vol.bnd(i).pos + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/eeg_leadfieldb.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("eeg_leadfieldb", *args, **kwargs) diff --git a/fieldtrip/__forward/_eeg_slab_monopole.py b/fieldtrip/__forward/_eeg_slab_monopole.py new file mode 100644 index 0000000..8f2c7e3 --- /dev/null +++ b/fieldtrip/__forward/_eeg_slab_monopole.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _eeg_slab_monopole(*args, **kwargs): + """ + EEG_SLAB_MONOPOLE calculate the strip medium leadfield + on positions pnt for a monopole at position rd and conductivity cond + The halfspace solution requires a plane dividing a conductive zone of + conductivity cond, from a non coductive zone (cond = 0) + + [lf] = eeg_slab_monopole(rd, elc, cond) + + Implemented from Malmivuo J, Plonsey R, Bioelectromagnetism (1993) + http://www.bem.fi/book/index.htm + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/eeg_slab_monopole.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("eeg_slab_monopole", *args, **kwargs) diff --git a/fieldtrip/__forward/_elproj.py b/fieldtrip/__forward/_elproj.py new file mode 100644 index 0000000..0377c8e --- /dev/null +++ b/fieldtrip/__forward/_elproj.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def _elproj(*args, **kwargs): + """ + ELPROJ makes a azimuthal projection of a 3D electrode cloud on a plane tangent to + the sphere fitted through the electrodes. The projection is along the z-axis. + + Use as + proj = elproj([x, y, z], 'method'); + + Method should be one of these: + 'gnomic' + 'stereographic' + 'orthographic' + 'inverse' + 'polar' + + Imagine a plane being placed against (tangent to) a globe. If + a light source inside the globe projects the graticule onto + the plane the result would be a planar, or azimuthal, map + projection. If the imaginary light is inside the globe a Gnomonic + projection results, if the light is antipodal a Sterographic, + and if at infinity, an Orthographic. + + The default projection is a BESA-like polar projection. + An inverse projection is the opposite of the default polar projection. + + See also PROJECTTRI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/elproj.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("elproj", *args, **kwargs) diff --git a/fieldtrip/__forward/_find_innermost_boundary.py b/fieldtrip/__forward/_find_innermost_boundary.py new file mode 100644 index 0000000..f7011ca --- /dev/null +++ b/fieldtrip/__forward/_find_innermost_boundary.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _find_innermost_boundary(*args, **kwargs): + """ + FIND_INNERMOST_BOUNDARY locates innermost compartment of a BEM model + by looking at the containment of the triangular meshes describing + the surface boundaries + + [innermost] = find_innermost_boundary(bnd) + + with the boundaries described by a struct-array bnd with + bnd(i).pnt vertices of boundary i (matrix of size Nx3) + bnd(i).tri triangles of boundary i (matrix of size Mx3) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/find_innermost_boundary.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("find_innermost_boundary", *args, **kwargs) diff --git a/fieldtrip/__forward/_find_mesh_edge.py b/fieldtrip/__forward/_find_mesh_edge.py new file mode 100644 index 0000000..97d3e5d --- /dev/null +++ b/fieldtrip/__forward/_find_mesh_edge.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _find_mesh_edge(*args, **kwargs): + """ + FIND_MESH_EDGE returns the edge of a triangulated mesh + + [pnt, line] = find_mesh_edge(pnt, tri), where + + pnt contains the vertex locations and + line contains the indices of the linepieces connecting the vertices + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/find_mesh_edge.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("find_mesh_edge", *args, **kwargs) diff --git a/fieldtrip/__forward/_find_outermost_boundary.py b/fieldtrip/__forward/_find_outermost_boundary.py new file mode 100644 index 0000000..07dc667 --- /dev/null +++ b/fieldtrip/__forward/_find_outermost_boundary.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _find_outermost_boundary(*args, **kwargs): + """ + FIND_OUTERMOST_BOUNDARY locates outermost compartment of a BEM model + by looking at the containment of the triangular meshes describing + the surface boundaries + + [outermost] = find_innermost_boundary(bnd) + + with the boundaries described by a struct-array bnd with + bnd(i).pnt vertices of boundary i (matrix of size Nx3) + bnd(i).tri triangles of boundary i (matrix of size Mx3) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/find_outermost_boundary.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("find_outermost_boundary", *args, **kwargs) diff --git a/fieldtrip/__forward/_find_triangle_neighbours.py b/fieldtrip/__forward/_find_triangle_neighbours.py new file mode 100644 index 0000000..147a82d --- /dev/null +++ b/fieldtrip/__forward/_find_triangle_neighbours.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _find_triangle_neighbours(*args, **kwargs): + """ + FIND_TRIANGLE_NEIGHBOURS determines the three neighbours for each triangle + in a mesh. It returns NaN's if the triangle does not have a neighbour on + that particular side. + + [nb] = find_triangle_neighbours(pnt, tri) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/find_triangle_neighbours.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("find_triangle_neighbours", *args, **kwargs) diff --git a/fieldtrip/__forward/_fitsphere.py b/fieldtrip/__forward/_fitsphere.py new file mode 100644 index 0000000..855f09f --- /dev/null +++ b/fieldtrip/__forward/_fitsphere.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _fitsphere(*args, **kwargs): + """ + FITSPHERE fits the centre and radius of a sphere to a set of points + using Taubin's method. + + Use as + [center,radius] = fitsphere(pnt) + where + pnt = Nx3 matrix with the Cartesian coordinates of the surface points + and + center = the center of the fitted sphere + radius = the radius of the fitted sphere + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/fitsphere.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fitsphere", *args, **kwargs) diff --git a/fieldtrip/__forward/_fixbalance.py b/fieldtrip/__forward/_fixbalance.py new file mode 100644 index 0000000..2872fb4 --- /dev/null +++ b/fieldtrip/__forward/_fixbalance.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _fixbalance(*args, **kwargs): + """ + FIXBALANCE ensures that the balancing representation in grad.balance or + elec.balance field is up to date and consistent, specifically with the + list of linear projections (or montages) being applied specified as + cell-array in "current", and not as a string in "current" and cell-array + in "previous". + + See also FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/fixbalance.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixbalance", *args, **kwargs) diff --git a/fieldtrip/__forward/_fixcoordsys.py b/fieldtrip/__forward/_fixcoordsys.py new file mode 100644 index 0000000..a89ae65 --- /dev/null +++ b/fieldtrip/__forward/_fixcoordsys.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _fixcoordsys(*args, **kwargs): + """ + FIXCOORDSYS ensures that the coordinate system is consistently + described. E.g. SPM and MNI are technically the same coordinate + system, but the strings 'spm' and 'mni' are different. + + See also FT_DETERMINE_COORDSYS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/fixcoordsys.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixcoordsys", *args, **kwargs) diff --git a/fieldtrip/__forward/_fixname.py b/fieldtrip/__forward/_fixname.py new file mode 100644 index 0000000..a1cb007 --- /dev/null +++ b/fieldtrip/__forward/_fixname.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _fixname(*args, **kwargs): + """ + FIXNAME changes all inappropriate characters in a string into '_' + so that it can be used as a filename or as a field name in a structure. + If the string begins with a digit, an 'x' is prepended. + + Use as + str = fixname(str) + + MATLAB 2014a introduces the matlab.lang.makeValidName and + matlab.lang.makeUniqueStrings functions for constructing unique + identifiers, but this particular implementation also works with + older MATLAB versions. + + See also DEBLANK, STRIP, PAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/fixname.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixname", *args, **kwargs) diff --git a/fieldtrip/__forward/_fixoldorg.py b/fieldtrip/__forward/_fixoldorg.py new file mode 100644 index 0000000..c6d7b09 --- /dev/null +++ b/fieldtrip/__forward/_fixoldorg.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _fixoldorg(*args, **kwargs): + """ + FIXOLDORG use "old/new" instead of "org/new" + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/fixoldorg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixoldorg", *args, **kwargs) diff --git a/fieldtrip/__forward/_fixpos.py b/fieldtrip/__forward/_fixpos.py new file mode 100644 index 0000000..f572d63 --- /dev/null +++ b/fieldtrip/__forward/_fixpos.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _fixpos(*args, **kwargs): + """ + FIXPOS helper function to ensure that meshes are described properly + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/fixpos.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixpos", *args, **kwargs) diff --git a/fieldtrip/__forward/_ft_apply_montage.py b/fieldtrip/__forward/_ft_apply_montage.py new file mode 100644 index 0000000..89034f5 --- /dev/null +++ b/fieldtrip/__forward/_ft_apply_montage.py @@ -0,0 +1,78 @@ +from fieldtrip._runtime import Runtime + + +def _ft_apply_montage(*args, **kwargs): + """ + FT_APPLY_MONTAGE changes the montage (i.e. linear combination) of a set of + electrode or gradiometer channels. A montage can be used for EEG rereferencing, MEG + synthetic gradients, MEG planar gradients or unmixing using ICA. This function not + only applies the montage to the EEG or MEG data, but also applies the montage to + the input EEG or MEG sensor array, which can subsequently be used for forward + computation and source reconstruction of the data. + + Use as + [sens] = ft_apply_montage(sens, montage, ...) + [data] = ft_apply_montage(data, montage, ...) + [freq] = ft_apply_montage(freq, montage, ...) + [montage] = ft_apply_montage(montage1, montage2, ...) + + A montage is specified as a structure with the fields + montage.tra = MxN matrix + montage.labelold = Nx1 cell-array + montage.labelnew = Mx1 cell-array + + As an example, a bipolar montage could look like this + bipolar.labelold = {'1', '2', '3', '4'} + bipolar.labelnew = {'1-2', '2-3', '3-4'} + bipolar.tra = [ + +1 -1 0 0 + 0 +1 -1 0 + 0 0 +1 -1 + ]; + + The montage can optionally also specify the channel type and unit of the input + and output data with + montage.chantypeold = Nx1 cell-array + montage.chantypenew = Mx1 cell-array + montage.chanunitold = Nx1 cell-array + montage.chanunitnew = Mx1 cell-array + + Additional options should be specified in key-value pairs and can be + 'keepunused' = string, 'yes' or 'no' (default = 'no') + 'feedback' = string, see FT_PROGRESS (default = 'text') + 'warning' = boolean, whether to show warnings (default = true) + + If the first input is a montage, then the second input montage will be + applied to the first. In effect, the output montage will first do + montage1, then montage2. + + See also FT_READ_SENS, FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ft_apply_montage.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_apply_montage", *args, **kwargs) diff --git a/fieldtrip/__forward/_ft_datatype_headmodel.py b/fieldtrip/__forward/_ft_datatype_headmodel.py new file mode 100644 index 0000000..678d5fa --- /dev/null +++ b/fieldtrip/__forward/_ft_datatype_headmodel.py @@ -0,0 +1,98 @@ +from fieldtrip._runtime import Runtime + + +def _ft_datatype_headmodel(*args, **kwargs): + """ + FT_DATATYPE_HEADMODEL describes the FieldTrip MATLAB structure for a volume + conduction model of the head that can be used for forward computations of the EEG + potentials or the MEG fields. The volume conduction model represents the + geometrical and the conductive properties of the head. These determine how the + secondary (or impressed) currents flow and how these contribute to the model + potential or field. + + A large number of forward solutions for the EEG and MEG are supported in FieldTrip, + each with its own specification of the MATLAB structure that describes the volume + conduction model of th ehead. It would be difficult to list all the possibilities + here. One common feature is that the volume conduction model should specify its + type, and that preferably it should specify the geometrical units in which it is + expressed (for example in mm, cm or m). + + An example of an EEG volume conduction model with 4 concentric spheres is: + + headmodel = + r: [86 88 94 100] + c: [0.33 1.79 0.042 0.33] + o: [0 0 0] + type: 'concentricspheres' + unit: 'mm' + + An example of an MEG volume conduction model with a single sphere fitted to + the scalp with its center 4 cm above the line connecting the ears is: + + headmodel = + r: [12] + o: [0 0 4] + type: 'singlesphere' + unit: 'cm' + + For each of the methods XXX for the volume conduction model, a corresponding + function FT_HEADMODEL_XXX exists that contains all specific details and + references to literature that describes the implementation. + + Required fields: + - type + + Optional fields: + - unit + + Deprecated fields: + - inner_skull_surface, source_surface, skin_surface, source, skin + + Obsoleted fields: + - + + Revision history: + + (2015/latest) Use the field name "pos" instead of "pnt" for vertex positions. + + (2014) All numeric values are represented in double precision. + + (2013) Always use the field "cond" for conductivity. + + (2012) Use consistent names for the volume conductor type in the structure, the + documentation and for the actual implementation, e.g. bem_openmeeg -> openmeeg, + fem_simbio -> simbio, concentric -> concentricspheres. Deprecated the fields + that indicate the index of the innermost and outermost surfaces. + + See also FT_PREPARE_HEADMODEL, FT_DATATYPE, FT_DATATYPE_COMP, FT_DATATYPE_DIP, + FT_DATATYPE_FREQ, FT_DATATYPE_MVAR, FT_DATATYPE_RAW, FT_DATATYPE_SOURCE, + FT_DATATYPE_SPIKE, FT_DATATYPE_TIMELOCK, FT_DATATYPE_VOLUME + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ft_datatype_headmodel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_headmodel", *args, **kwargs) diff --git a/fieldtrip/__forward/_ft_datatype_sens.py b/fieldtrip/__forward/_ft_datatype_sens.py new file mode 100644 index 0000000..4457b20 --- /dev/null +++ b/fieldtrip/__forward/_ft_datatype_sens.py @@ -0,0 +1,127 @@ +from fieldtrip._runtime import Runtime + + +def _ft_datatype_sens(*args, **kwargs): + """ + FT_DATATYPE_SENS describes the FieldTrip structure that represents an MEG, EEG, + sEEG, ECoG, or NIRS sensor array. This structure is commonly called "grad" for MEG, + "elec" for EEG and intranial EEG, "opto" for NIRS, or in general "sens" if it could + be any one. + + For all sensor types a distinction should be made between the channel (i.e. the + output of the transducer that is A/D converted) and the sensor, which may have some + spatial extent. For example in MEG gradiometers are comprised of multiple coils and + with EEG you can have a bipolar channel, where the position of the channel can be + represented as in between the position of the two electrodes. + + The structure for MEG gradiometers and/or magnetometers contains + sens.label = Mx1 cell-array with channel labels + sens.chanpos = Mx3 matrix with channel positions + sens.chanori = Mx3 matrix with channel orientations, used for synthetic planar gradient computation + sens.coilpos = Nx3 matrix with coil positions + sens.coilori = Nx3 matrix with coil orientations + sens.tra = MxN matrix to combine coils into channels + sens.balance = structure containing info about the balancing, See FT_APPLY_MONTAGE + and optionally + sens.chanposold = Mx3 matrix with original channel positions (in case sens.chanpos has been updated to contain NaNs, e.g. after FT_COMPONENTANALYSIS) + sens.chanoriold = Mx3 matrix with original channel orientations + sens.labelold = Mx1 cell-array with original channel labels + + The structure for EEG, sEEG or ECoG channels contains + sens.label = Mx1 cell-array with channel labels + sens.chanpos = Mx3 matrix with channel positions (often the same as electrode positions) + sens.elecpos = Nx3 matrix with electrode positions + sens.tra = MxN matrix to combine electrodes into channels + In case sens.tra is not present in the EEG sensor array, the channels + are assumed to be average referenced. + + The structure for NIRS channels contains + sens.label = Mx1 cell-array with channel labels + sens.chanpos = Mx3 matrix with position of the channels (usually halfway the transmitter and receiver) + sens.optopos = Nx3 matrix with the position of individual optodes + sens.optotype = Nx1 cell-array with information about the type of optode (receiver or transmitter) + sens.optolabel = Nx1 cell-array with optode labels + sens.wavelength = 1xK vector of all wavelengths that were used + sens.tra = MxN matrix that specifies for each of the M channels which of the N optodes transmits at which wavelength (positive integer from 1 to K), or receives (negative ingeger from 1 to K) + + The following fields apply to MEG, EEG, sEEG and ECoG + sens.chantype = Mx1 cell-array with the type of the channel, see FT_CHANTYPE + sens.chanunit = Mx1 cell-array with the units of the channel signal, e.g. 'V', 'fT' or 'T/cm', see FT_CHANUNIT + + Optional fields: + type, unit, fid, chantype, chanunit, coordsys, balance + + Historical fields: + pnt, pos, ori, pnt1, pnt2, fiberpos, fibertype, fiberlabel, transceiver, transmits, laserstrength + + Revision history: + (2025/latest) Explicitly deal with the balance field and sequence of montages. + + (2020/latest) Updated the specification of the NIRS sensor definition. + Dropped the laserstrength and renamed transmits into tra for consistency. + + (2019/latest) Updated the specification of the NIRS sensor definition. + Use "opto" instead of "fibers", see http://bit.ly/33WaqWU for details. + + (2016) The chantype and chanunit have become required fields. + Original channel details are specified with the suffix "old" rather than "org". + All numeric values are represented in double precision. + It is possible to convert the amplitude and distance units (e.g. from T to fT and + from m to mm) and it is possible to express planar and axial gradiometer channels + either in units of amplitude or in units of amplitude/distance (i.e. proper + gradient). + + (2011v2) The chantype and chanunit have been added for MEG. + + (2011v1) To facilitate determining the position of channels (e.g. for plotting) + in case of balanced MEG or bipolar EEG, an explicit distinction has been made + between chanpos+chanori and coilpos+coilori (for MEG) and chanpos and elecpos + (for EEG). The pnt and ori fields are removed. + + (2010) Added support for bipolar or otherwise more complex linear combinations + of EEG electrodes using sens.tra, similar to MEG. + + (2009) Noise reduction has been added for MEG systems in the balance field. + + (2006) The optional fields sens.type and sens.unit were added. + + (2003) The initial version was defined, which looked like this for EEG + sens.pnt = Mx3 matrix with electrode positions + sens.label = Mx1 cell-array with channel labels + and like this for MEG + sens.pnt = Nx3 matrix with coil positions + sens.ori = Nx3 matrix with coil orientations + sens.tra = MxN matrix to combine coils into channels + sens.label = Mx1 cell-array with channel labels + + See also FT_READ_SENS, FT_SENSTYPE, FT_CHANTYPE, FT_APPLY_MONTAGE, CTF2GRAD, FIF2GRAD, + BTI2GRAD, YOKOGAWA2GRAD, ITAB2GRAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ft_datatype_sens.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_sens", *args, **kwargs) diff --git a/fieldtrip/__forward/_ft_debug.py b/fieldtrip/__forward/_ft_debug.py new file mode 100644 index 0000000..f56da57 --- /dev/null +++ b/fieldtrip/__forward/_ft_debug.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_debug(*args, **kwargs): + """ + FT_DEBUG prints a debug message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_debug(...) + with arguments similar to fprintf, or + ft_debug(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_debug off + or for specific ones using + ft_debug off msgId + + To switch them back on, you would use + ft_debug on + or for specific ones using + ft_debug on msgId + + Messages are only printed once per timeout period using + ft_debug timeout 60 + ft_debug once + or for specific ones using + ft_debug once msgId + + You can see the most recent messages and identifier using + ft_debug last + + You can query the current on/off/once state for all messages using + ft_debug query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ft_debug.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_debug", *args, **kwargs) diff --git a/fieldtrip/__forward/_ft_error.py b/fieldtrip/__forward/_ft_error.py new file mode 100644 index 0000000..b0a1c3d --- /dev/null +++ b/fieldtrip/__forward/_ft_error.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _ft_error(*args, **kwargs): + """ + FT_ERROR prints an error message on screen, just like the standard ERROR function. + + Use as + ft_error(...) + with arguments similar to fprintf, or + ft_error(msgId, ...) + with arguments similar to error. + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ft_error.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_error", *args, **kwargs) diff --git a/fieldtrip/__forward/_ft_getopt.py b/fieldtrip/__forward/_ft_getopt.py new file mode 100644 index 0000000..81a1f5e --- /dev/null +++ b/fieldtrip/__forward/_ft_getopt.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def _ft_getopt(*args, **kwargs): + """ + FT_GETOPT gets the value of a specified option from a configuration structure + or from a cell-array with key-value pairs. + + Use as + val = ft_getopt(s, key, default, emptymeaningful) + where the input values are + s = structure or cell-array + key = string + default = any valid MATLAB data type (optional, default = []) + emptymeaningful = boolean value (optional, default = false) + + If the key is present as field in the structure, or as key-value pair in the + cell-array, the corresponding value will be returned. + + If the key is not present, ft_getopt will return the default, or an empty array + when no default was specified. + + If the key is present but has an empty value, then the emptymeaningful flag + specifies whether the empty value or the default value should be returned. + If emptymeaningful==true, then the empty array will be returned. + If emptymeaningful==false, then the specified default will be returned. + + See also FT_SETOPT, FT_CHECKOPT, INPUTPARSER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ft_getopt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_getopt", *args, **kwargs) diff --git a/fieldtrip/__forward/_ft_hastoolbox.py b/fieldtrip/__forward/_ft_hastoolbox.py new file mode 100644 index 0000000..5cede44 --- /dev/null +++ b/fieldtrip/__forward/_ft_hastoolbox.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _ft_hastoolbox(*args, **kwargs): + """ + FT_HASTOOLBOX tests whether an external toolbox is installed. Optionally it will + try to determine the path to the toolbox and install it automatically. + + Use as + [status] = ft_hastoolbox(toolbox, autoadd, silent) + + autoadd = -1 means that it will check and give an error when not yet installed + autoadd = 0 means that it will check and give a warning when not yet installed + autoadd = 1 means that it will check and give an error if it cannot be added + autoadd = 2 means that it will check and give a warning if it cannot be added + autoadd = 3 means that it will check but remain silent if it cannot be added + + silent = 0 means that it will give some feedback about adding the toolbox + silent = 1 means that it will not give feedback + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ft_hastoolbox.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_hastoolbox", *args, **kwargs) diff --git a/fieldtrip/__forward/_ft_headcoordinates.py b/fieldtrip/__forward/_ft_headcoordinates.py new file mode 100644 index 0000000..d1324f2 --- /dev/null +++ b/fieldtrip/__forward/_ft_headcoordinates.py @@ -0,0 +1,126 @@ +from fieldtrip._runtime import Runtime + + +def _ft_headcoordinates(*args, **kwargs): + """ + FT_HEADCOORDINATES returns the homogeneous coordinate transformation matrix + that converts the specified fiducials in any coordinate system (e.g. MRI) + into the rotated and translated headcoordinate system. + + Use as + [transform, coordsys] = ft_headcoordinates(fid1, fid2, fid3, coordsys) + or + [transform, coordsys] = ft_headcoordinates(fid1, fid2, fid3, fid4, coordsys) + + Depending on the desired coordinate system, the order of the fiducials is + interpreted as follows + + fid1 = nas + fid2 = lpa + fid3 = rpa + fid4 = extra point (optional) + + fid1 = ac + fid2 = pc + fid3 = midsagittal + fid4 = extra point (optional) + + fid1 = pt1 + fid2 = pt2 + fid3 = pt3 + fid4 = extra point (optional) + + fid1 = bregma + fid2 = lambda + fid3 = midsagittal + fid4 = extra point (optional) + + The fourth argument fid4 is optional and can be specified as an an extra point + which is assumed to have a positive Z-coordinate. It will be used to ensure correct + orientation of the Z-axis (ctf, 4d, bti, eeglab, yokogawa, neuromag, itab) or + X-axis (acpc, spm, mni, tal). The specification of this extra point may result in + the handedness of the transformation to be changed, but ensures consistency with + the handedness of the input coordinate system. + + The coordsys input argument is a string that determines how the location of the + origin and the direction of the axis is to be defined relative to the fiducials: + according to CTF conventions: coordsys = 'ctf' + according to 4D conventions: coordsys = '4d' or 'bti' + according to EEGLAB conventions: coordsys = 'eeglab' + according to NEUROMAG conventions: coordsys = 'itab' + according to ITAB conventions: coordsys = 'neuromag' + according to YOKOGAWA conventions: coordsys = 'yokogawa' + according to ASA conventions: coordsys = 'asa' + according to FTG conventions: coordsys = 'ftg' + according to ACPC conventions: coordsys = 'acpc' + according to SPM conventions: coordsys = 'spm' + according to MNI conventions: coordsys = 'mni' + according to Talairach conventions: coordsys = 'tal' + according to PAXINOS conventions: coordsys = 'paxinos' + If the coordsys input argument is not specified, it will default to 'ctf'. + + The CTF, 4D, YOKOGAWA and EEGLAB coordinate systems are defined as follows: + the origin is exactly between lpa and rpa + the X-axis goes towards nas + the Y-axis goes approximately towards lpa, orthogonal to X and in the plane spanned by the fiducials + the Z-axis goes approximately towards the vertex, orthogonal to X and Y + + The TALAIRACH, SPM and ACPC coordinate systems are defined as: + the origin corresponds with the anterior commissure + the Y-axis is along the line from the posterior commissure to the anterior commissure + the Z-axis is towards the vertex, in between the hemispheres + the X-axis is orthogonal to the midsagittal-plane, positive to the right + + The NEUROMAG and ITAB coordinate systems are defined as follows: + the X-axis is from the origin towards the RPA point (exactly through) + the Y-axis is from the origin towards the nasion (exactly through) + the Z-axis is from the origin upwards orthogonal to the XY-plane + the origin is the intersection of the line through LPA and RPA and a line orthogonal to L passing through the nasion + + The ASA coordinate system is defined as follows: + the origin is at the orthogonal intersection of the line from rpa-lpa and the line through nas + the X-axis goes towards nas + the Y-axis goes through rpa and lpa + the Z-axis goes approximately towards the vertex, orthogonal to X and Y + + The FTG coordinate system is defined as: + the origin corresponds with pt1 + the x-axis is along the line from pt1 to pt2 + the z-axis is orthogonal to the plane spanned by pt1, pt2 and pt3 + + The PAXINOS coordinate system is defined as: + the origin is at bregma + the x-axis extends along the Medial-Lateral direction, with positive towards the right + the y-axis points from dorsal to ventral, i.e. from inferior to superior + the z-axis passes through bregma and lambda and points from cranial to caudal, i.e. from anterior to posterior + + See also FT_ELECTRODEREALIGN, FT_VOLUMEREALIGN, FT_INTERACTIVEREALIGN, FT_AFFINECOORDINATES, COORDSYS2LABEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ft_headcoordinates.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headcoordinates", *args, **kwargs) diff --git a/fieldtrip/__forward/_ft_info.py b/fieldtrip/__forward/_ft_info.py new file mode 100644 index 0000000..29afb62 --- /dev/null +++ b/fieldtrip/__forward/_ft_info.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_info(*args, **kwargs): + """ + FT_INFO prints an info message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_info(...) + with arguments similar to fprintf, or + ft_info(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_info off + or for specific ones using + ft_info off msgId + + To switch them back on, you would use + ft_info on + or for specific ones using + ft_info on msgId + + Messages are only printed once per timeout period using + ft_info timeout 60 + ft_info once + or for specific ones using + ft_info once msgId + + You can see the most recent messages and identifier using + ft_info last + + You can query the current on/off/once state for all messages using + ft_info query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ft_info.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_info", *args, **kwargs) diff --git a/fieldtrip/__forward/_ft_notice.py b/fieldtrip/__forward/_ft_notice.py new file mode 100644 index 0000000..adf00c7 --- /dev/null +++ b/fieldtrip/__forward/_ft_notice.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_notice(*args, **kwargs): + """ + FT_NOTICE prints a notice message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_notice(...) + with arguments similar to fprintf, or + ft_notice(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_notice off + or for specific ones using + ft_notice off msgId + + To switch them back on, you would use + ft_notice on + or for specific ones using + ft_notice on msgId + + Messages are only printed once per timeout period using + ft_notice timeout 60 + ft_notice once + or for specific ones using + ft_notice once msgId + + You can see the most recent messages and identifier using + ft_notice last + + You can query the current on/off/once state for all messages using + ft_notice query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ft_notice.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_notice", *args, **kwargs) diff --git a/fieldtrip/__forward/_ft_notification.py b/fieldtrip/__forward/_ft_notification.py new file mode 100644 index 0000000..755779e --- /dev/null +++ b/fieldtrip/__forward/_ft_notification.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _ft_notification(*args, **kwargs): + """ + FT_NOTIFICATION works mostly like the WARNING and ERROR commands in MATLAB and + is called by FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO and FT_DEBUG. Please note + that you should not call this function directly. + + Some examples: + ft_info on + ft_info on msgId + ft_info off + ft_info off msgId + ft_info once + ft_info once msgId + ft_info on backtrace + ft_info off backtrace + ft_info on verbose + ft_info off verbose + + ft_info query % shows the status of all notifications + ft_info last % shows the last notification + ft_info clear % clears the status of all notifications + ft_info timeout 10 % sets the timeout (for 'once') to 10 seconds + + See also DEFAULTID, FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ft_notification.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_notification", *args, **kwargs) diff --git a/fieldtrip/__forward/_ft_platform_supports.py b/fieldtrip/__forward/_ft_platform_supports.py new file mode 100644 index 0000000..a5388f0 --- /dev/null +++ b/fieldtrip/__forward/_ft_platform_supports.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def _ft_platform_supports(*args, **kwargs): + """ + FT_PLATFORM_SUPPORTS returns a boolean indicating whether the current platform + supports a specific capability + + Use as + status = ft_platform_supports(what) + or + status = ft_platform_supports('matlabversion', min_version, max_version) + + The following values are allowed for the 'what' parameter, which means means that + the specific feature explained on the right is supported: + + 'which-all' which(...,'all') + 'exists-in-private-directory' exists(...) will look in the /private subdirectory to see if a file exists + 'onCleanup' onCleanup(...) + 'alim' alim(...) + 'int32_logical_operations' bitand(a,b) with a, b of type int32 + 'graphics_objects' graphics system is object-oriented + 'libmx_c_interface' libmx is supported through mex in the C-language (recent MATLAB versions only support C++) + 'images' all image processing functions in FieldTrip's external/images directory + 'signal' all signal processing functions in FieldTrip's external/signal directory + 'stats' all statistical functions in FieldTrip's external/stats directory + 'program_invocation_name' program_invocation_name() (GNU Octave) + 'singleCompThread' start MATLAB with -singleCompThread + 'nosplash' start MATLAB with -nosplash + 'nodisplay' start MATLAB with -nodisplay + 'nojvm' start MATLAB with -nojvm + 'no-gui' start GNU Octave with --no-gui + 'RandStream.setGlobalStream' RandStream.setGlobalStream(...) + 'RandStream.setDefaultStream' RandStream.setDefaultStream(...) + 'rng' rng(...) + 'rand-state' rand('state') + 'urlread-timeout' urlread(..., 'Timeout', t) + 'griddata-vector-input' griddata(...,...,...,a,b) with a and b vectors + 'griddata-v4' griddata(...,...,...,...,...,'v4') with v4 interpolation support + 'uimenu' uimenu(...) + 'weboptions' weboptions(...) + 'parula' parula(...) + 'datetime' datetime structure + 'html' html rendering in desktop + + See also FT_VERSION, VERSION, VER, VERLESSTHAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ft_platform_supports.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_platform_supports", *args, **kwargs) diff --git a/fieldtrip/__forward/_ft_scalingfactor.py b/fieldtrip/__forward/_ft_scalingfactor.py new file mode 100644 index 0000000..e93e820 --- /dev/null +++ b/fieldtrip/__forward/_ft_scalingfactor.py @@ -0,0 +1,91 @@ +from fieldtrip._runtime import Runtime + + +def _ft_scalingfactor(*args, **kwargs): + """ + FT_SCALINGFACTOR determines the scaling factor from old to new units, i.e. it + returns a number with which the data in the old units needs to be multiplied + to get it expressed in the new units. + + Use as + factor = ft_scalingfactor(old, new) + where old and new are strings that specify the units. + + For example + ft_scalingfactor('m', 'cm') % returns 100 + ft_scalingfactor('V', 'uV') % returns 1000 + ft_scalingfactor('T/cm', 'fT/m') % returns 10^15 divided by 10^-2, which is 10^17 + ft_scalingfactor('cm^2', 'mm^2') % returns 100 + ft_scalingfactor('1/ms', 'Hz') % returns 1000 + + The following fundamental units are supported + metre m length l (a lowercase L), x, r L + kilogram kg mass m M + second s time t T + ampere A electric current I (an uppercase i) I + kelvin K thermodynamic temperature T # + mole mol amount of substance n N + candela cd luminous intensity Iv (an uppercase i with lowercase non-italicized v subscript) J + + The following derived units are supported + hertz Hz frequency 1/s T-1 + radian rad angle m/m dimensionless + steradian sr solid angle m2/m2 dimensionless + newton N force, weight kg#m/s2 M#L#T-2 + pascal Pa pressure, stress N/m2 M#L-1#T-2 + joule J energy, work, heat N#m = C#V = W#s M#L2#T-2 + coulomb C electric charge or quantity of electricity s#A T#I + volt V voltage, electrical potential difference, electromotive force W/A = J/C M#L2#T-3#I-1 + farad F electric capacitance C/V M-1#L-2#T4#I2 + siemens S electrical conductance 1/# = A/V M-1#L-2#T3#I2 + weber Wb magnetic flux J/A M#L2#T-2#I-1 + tesla T magnetic field strength V#s/m2 = Wb/m2 = N/(A#m) M#T-2#I-1 + henry H inductance V#s/A = Wb/A M#L2#T-2#I-2 + lumen lm luminous flux cd#sr J + lux lx illuminance lm/m2 L-2#J + becquerel Bq radioactivity (decays per unit time) 1/s T-1 + gray Gy absorbed dose (of ionizing radiation) J/kg L2#T-2 + sievert Sv equivalent dose (of ionizing radiation) J/kg L2#T-2 + katal kat catalytic activity mol/s T-1#N + + The following alternative units are supported + inch inch length + feet feet length + gauss gauss magnetic field strength + + The following derived units are not supported due to potential confusion + between their ascii character representation + ohm # electric resistance, impedance, reactance V/A M#L2#T-3#I-2 + watt W power, radiant flux J/s = V#A M#L2#T-3 + degree Celsius ?C temperature relative to 273.15 K K ? + + See also http://en.wikipedia.org/wiki/International_System_of_Units + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ft_scalingfactor.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_scalingfactor", *args, **kwargs) diff --git a/fieldtrip/__forward/_ft_version.py b/fieldtrip/__forward/_ft_version.py new file mode 100644 index 0000000..99e59d4 --- /dev/null +++ b/fieldtrip/__forward/_ft_version.py @@ -0,0 +1,69 @@ +from fieldtrip._runtime import Runtime + + +def _ft_version(*args, **kwargs): + """ + FT_VERSION returns the version of FieldTrip and the path where it is installed + + FieldTrip is not released with version numbers as "2.0", "2.1", etc. Instead, we + share our development version on http://github.com/fieldtrip/fieldtrip. You can use + git to make a local clone of the development version. Furthermore, we make + more-or-less daily releases of the code available on + https://github.com/fieldtrip/fieldtrip/releases and as zip file on our FTP server. + + If you use git with the development version, the version is labeled with the hash + of the latest commit like "128c693". You can access the specific version "XXXXXX" + at https://github.com/fieldtrip/fieldtrip/commit/XXXXXX. + + If you download the daily released version from our FTP server, the version is part + of the file name "fieldtrip-YYYYMMDD.zip", where YYY, MM and DD correspond to year, + month and day. + + Use as + ft_version + to display the latest revision number on screen, or + [ftver, ftpath] = ft_version + to get the version and the installation root directory. + + When using git with the development version, you can also get additional information with + ft_version revision + ft_version branch + ft_version clean + + On macOS you might have installed git along with Xcode instead of with homebrew, + which then requires that you agree to the Apple license. In that case it can + happen that this function stops, as in the background (invisible to you) it is + asking whether you agree. You can check this by typing "/usr/bin/git", which will + show the normal help message, or which will mention the license agreement. To + resolve this please open a terminal and type "sudo xcodebuild -license" + + See also FT_PLATFORM_SUPPORTS, VERSION, VER, VERLESSTHAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ft_version.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_version", *args, **kwargs) diff --git a/fieldtrip/__forward/_ft_warning.py b/fieldtrip/__forward/_ft_warning.py new file mode 100644 index 0000000..07dcbe3 --- /dev/null +++ b/fieldtrip/__forward/_ft_warning.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def _ft_warning(*args, **kwargs): + """ + FT_WARNING prints a warning message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. This function works + similar to the standard WARNING function, but also features the "once" mode. + + Use as + ft_warning(...) + with arguments similar to fprintf, or + ft_warning(msgId, ...) + with arguments similar to warning. + + You can switch of all warning messages using + ft_warning off + or for specific ones using + ft_warning off msgId + + To switch them back on, you would use + ft_warning on + or for specific ones using + ft_warning on msgId + + Warning messages are only printed once per timeout period using + ft_warning timeout 60 + ft_warning once + or for specific ones using + ft_warning once msgId + + You can see the most recent messages and identifier using + ft_warning last + + You can query the current on/off/once state for all messages using + ft_warning query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ft_warning.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_warning", *args, **kwargs) diff --git a/fieldtrip/__forward/_ft_warp_apply.py b/fieldtrip/__forward/_ft_warp_apply.py new file mode 100644 index 0000000..11b997f --- /dev/null +++ b/fieldtrip/__forward/_ft_warp_apply.py @@ -0,0 +1,83 @@ +from fieldtrip._runtime import Runtime + + +def _ft_warp_apply(*args, **kwargs): + """ + FT_WARP_APPLY performs a 3D linear or nonlinear transformation on the input + coordinates, similar to those in AIR. You can find technical documentation + on warping in general at http://air.bmap.ucla.edu/AIR5 + + Use as + [output] = ft_warp_apply(M, input, method, tol) + where + M vector or matrix with warping parameters + input Nx3 matrix with input coordinates + output Nx3 matrix with the transformed or warped output coordinates + method string describing the transformation or warping method + tol (optional) value determining the numerical precision of the + output, to deal with numerical round-off imprecisions due to + the warping + + The methods 'nonlin0', 'nonlin2' ... 'nonlin5' specify a polynomial transformation. + The size of the transformation matrix depends on the order of the warp + zeroth order : 1 parameter per coordinate (translation) + first order : 4 parameters per coordinate (total 12, affine) + second order : 10 parameters per coordinate + third order : 20 parameters per coordinate + fourth order : 35 parameters per coordinate + fifth order : 56 parameters per coordinate (total 168) + The size of M should be 3xP, where P is the number of parameters per coordinate. + Alternatively, you can specify the method to be 'nonlinear', in which case the + order will be determined from the size of the matrix M. + + If the method 'homogeneous' is selected, the input matrix M should be a 4x4 + homogenous transformation matrix. + + If the method 'sn2individual' or 'individual2sn' is selected, the input M should be + a structure with the nonlinear spatial normalisation (warping) parameters created + by SPM8 or SPM12 for alignment between an individual subject and a template brain. + When using the 'old' method, M will have subfields like this: + Affine: [4x4 double] + Tr: [4-D double] + VF: [1x1 struct] + VG: [1x1 struct] + flags: [1x1 struct] + When using the 'new' or the 'mars' method, M will have subfields like this: + + If any other method is selected, it is assumed that it specifies the name of an + auxiliary function that will, when given the input parameter vector M, return an + 4x4 homogenous transformation matrix. Supplied functions are 'translate', 'rotate', + 'scale', 'rigidbody', 'globalrescale', 'traditional', 'affine', 'perspective', + 'quaternion'. + + See also FT_AFFINECOORDINATES, FT_HEADCOORDINATES, FT_WARP_OPTIM, FT_WARP_ERROR, + MAKETFORM, AFFINE2D, AFFINE3D + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ft_warp_apply.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_warp_apply", *args, **kwargs) diff --git a/fieldtrip/__forward/_get_dip_halfspace.py b/fieldtrip/__forward/_get_dip_halfspace.py new file mode 100644 index 0000000..f2633a6 --- /dev/null +++ b/fieldtrip/__forward/_get_dip_halfspace.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _get_dip_halfspace(*args, **kwargs): + """ + GET_DIP_HALFSPACE checks if the dipole is in the empty halfspace and + returns true if this happens. The normal of the plane points by + convention to the empty halfspace. + + is_in_empty = get_dip_halfspace(P,vol); + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/get_dip_halfspace.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("get_dip_halfspace", *args, **kwargs) diff --git a/fieldtrip/__forward/_getdimord.py b/fieldtrip/__forward/_getdimord.py new file mode 100644 index 0000000..0c56997 --- /dev/null +++ b/fieldtrip/__forward/_getdimord.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _getdimord(*args, **kwargs): + """ + GETDIMORD determine the dimensions and order of a data field in a FieldTrip + structure. + + Use as + dimord = getdimord(data, field) + + See also GETDIMSIZ, GETDATFIELD, FIXDIMORD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/getdimord.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getdimord", *args, **kwargs) diff --git a/fieldtrip/__forward/_getdimsiz.py b/fieldtrip/__forward/_getdimsiz.py new file mode 100644 index 0000000..56c59a2 --- /dev/null +++ b/fieldtrip/__forward/_getdimsiz.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _getdimsiz(*args, **kwargs): + """ + GETDIMSIZ + + Use as + dimsiz = getdimsiz(data, field) + or + dimsiz = getdimsiz(data, field, numdim) + + MATLAB will not return the size of a field in the data structure that has trailing + singleton dimensions, since those are automatically squeezed out. With the optional + numdim parameter you can specify how many dimensions the data element has. This + will result in the trailing singleton dimensions being added to the output vector. + + Example use + dimord = getdimord(datastructure, fieldname); + dimtok = tokenize(dimord, '_'); + dimsiz = getdimsiz(datastructure, fieldname, numel(dimtok)); + + See also GETDIMORD, GETDATFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/getdimsiz.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getdimsiz", *args, **kwargs) diff --git a/fieldtrip/__forward/_getsubfield.py b/fieldtrip/__forward/_getsubfield.py new file mode 100644 index 0000000..955191c --- /dev/null +++ b/fieldtrip/__forward/_getsubfield.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _getsubfield(*args, **kwargs): + """ + GETSUBFIELD returns a field from a structure just like the standard + GETFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = getsubfield(s, 'fieldname') + or as + f = getsubfield(s, 'fieldname.subfieldname') + + See also GETFIELD, ISSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/getsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getsubfield", *args, **kwargs) diff --git a/fieldtrip/__forward/_halfspace_medium_leadfield.py b/fieldtrip/__forward/_halfspace_medium_leadfield.py new file mode 100644 index 0000000..c521d80 --- /dev/null +++ b/fieldtrip/__forward/_halfspace_medium_leadfield.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _halfspace_medium_leadfield(*args, **kwargs): + """ + HALFSPACE_MEDIUM_LEADFIELD calculate the halfspace medium leadfield + on positions pnt for a dipole at position rd and conductivity cond + The halfspace solution requires a plane dividing a conductive zone of + conductivity cond, from a non coductive zone (cond = 0) + + [lf] = halfspace_medium_leadfield(rd, elc, cond) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/halfspace_medium_leadfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("halfspace_medium_leadfield", *args, **kwargs) diff --git a/fieldtrip/__forward/_hasyokogawa.py b/fieldtrip/__forward/_hasyokogawa.py new file mode 100644 index 0000000..529d6a7 --- /dev/null +++ b/fieldtrip/__forward/_hasyokogawa.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _hasyokogawa(*args, **kwargs): + """ + HASYOKOGAWA tests whether the data input toolbox for MEG systems by + Yokogawa (www.yokogawa.com, designed by KIT/EagleTechnology) is + installed. Only the newest version of the toolbox is accepted. + + Use as + string = hasyokogawa; + which returns a string describing the toolbox version, e.g. "12bitBeta3", + "16bitBeta3", or "16bitBeta6" for preliminary versions, or '1.5' for the + official Yokogawa MEG Reader Toolbox. An empty string is returned if the toolbox + is not installed. The string "unknown" is returned if it is installed but + the version is unknown. + + Alternatively you can use it as + [boolean] = hasyokogawa(desired); + where desired is a string with the desired version. + + See also READ_YOKOGAWA_HEADER, READ_YOKOGAWA_DATA, READ_YOKOGAWA_EVENT, + YOKOGAWA2GRAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/hasyokogawa.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("hasyokogawa", *args, **kwargs) diff --git a/fieldtrip/__forward/_headsurface.py b/fieldtrip/__forward/_headsurface.py new file mode 100644 index 0000000..f36abea --- /dev/null +++ b/fieldtrip/__forward/_headsurface.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _headsurface(*args, **kwargs): + """ + HEADSURFACE constructs a triangulated description of the skin or brain + surface from a volume conduction model, from a set of electrodes or + gradiometers, or from a combination of the two. It returns a closed + surface. + + Use as + [pos, tri] = headsurface(headmodel, sens, ...) + where + headmodel = volume conduction model (structure) + sens = electrode or gradiometer array (structure) + + Optional arguments should be specified in key-value pairs: + surface = 'skin' or 'brain' (default = 'skin') + npos = number of vertices (default is determined automatic) + downwardshift = boolean, this will shift the lower rim of the helmet down with approximately 1/4th of its radius (default is 1) + inwardshift = number (default = 0) + headshape = string, file containing the head shape + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/headsurface.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("headsurface", *args, **kwargs) diff --git a/fieldtrip/__forward/_issubfield.py b/fieldtrip/__forward/_issubfield.py new file mode 100644 index 0000000..5120e2c --- /dev/null +++ b/fieldtrip/__forward/_issubfield.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _issubfield(*args, **kwargs): + """ + ISSUBFIELD tests for the presence of a field in a structure just like the standard + Matlab ISFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = issubfield(s, 'fieldname') + or as + f = issubfield(s, 'fieldname.subfieldname') + + This function returns true if the field is present and false if the field + is not present. + + See also ISFIELD, GETSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/issubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("issubfield", *args, **kwargs) diff --git a/fieldtrip/__forward/_istrue.py b/fieldtrip/__forward/_istrue.py new file mode 100644 index 0000000..2c4e5f1 --- /dev/null +++ b/fieldtrip/__forward/_istrue.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _istrue(*args, **kwargs): + """ + ISTRUE converts an input argument like "yes/no", "true/false" or "on/off" into a + boolean. If the input is boolean, then it will remain like that. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/istrue.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("istrue", *args, **kwargs) diff --git a/fieldtrip/__forward/_keyval.py b/fieldtrip/__forward/_keyval.py new file mode 100644 index 0000000..404894d --- /dev/null +++ b/fieldtrip/__forward/_keyval.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _keyval(*args, **kwargs): + """ + KEYVAL returns the value that corresponds to the requested key in a + key-value pair list of variable input arguments + + Use as + [val] = keyval(key, varargin) + + See also VARARGIN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/keyval.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("keyval", *args, **kwargs) diff --git a/fieldtrip/__forward/_leadfield_duneuro.py b/fieldtrip/__forward/_leadfield_duneuro.py new file mode 100644 index 0000000..d0c70bd --- /dev/null +++ b/fieldtrip/__forward/_leadfield_duneuro.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _leadfield_duneuro(*args, **kwargs): + """ + LEADFIELD_DUNEURO computes EEG/MEG leadfields for a set of given dipoles + using the finite element method (FEM), implemented in the duneuro + software + + [lf] = leadfield_duneuro(pos, headmodel, sens, method); + + with input arguments + pos a matrix of dipole positions + (there can be 'deep electrodes', too) + headmodel contains a FE volume conductor (output of ft_prepare_vol_sens) + sens contains a sensor array description (output of ft_prepare_vol_sens) + method string defining the modality ('eeg' or 'meg) + The output lf is the leadfield matrix of dimensions m (rows) x n*3 (columns) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/leadfield_duneuro.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("leadfield_duneuro", *args, **kwargs) diff --git a/fieldtrip/__forward/_leadfield_fns.py b/fieldtrip/__forward/_leadfield_fns.py new file mode 100644 index 0000000..0787217 --- /dev/null +++ b/fieldtrip/__forward/_leadfield_fns.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _leadfield_fns(*args, **kwargs): + """ + LEADFIELD_FNS calculates the FDM forward solution for a set of given + dipolar sources + + [lf] = leadfield_fns(posin, vol, tol); + + with input arguments + dip positions of the dipolar sources (MX3 matrix) + vol structure of the volume conductor + tol tolerance + + The output argument lf + + The key elements of the vol structure are: + vol.condmatrix a 9XT (T tissues) matrix containing the conductivities + vol.seg a segmented/labelled MRI + vol.deepelec positions of the deep electrodes (NX3 matrix) + or + vol.bnd positions of the external surface vertices + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/leadfield_fns.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("leadfield_fns", *args, **kwargs) diff --git a/fieldtrip/__forward/_leadfield_interpolate.py b/fieldtrip/__forward/_leadfield_interpolate.py new file mode 100644 index 0000000..75ce2b6 --- /dev/null +++ b/fieldtrip/__forward/_leadfield_interpolate.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _leadfield_interpolate(*args, **kwargs): + """ + LEADFIELD_INTERPOLATE interpolates the leadfield for a source at + an arbitrary location given the pre-computed leadfields on a regular + grid. + + Use as + lf = leadfield_interpolate(pos, vol) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/leadfield_interpolate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("leadfield_interpolate", *args, **kwargs) diff --git a/fieldtrip/__forward/_leadfield_simbio.py b/fieldtrip/__forward/_leadfield_simbio.py new file mode 100644 index 0000000..871a56c --- /dev/null +++ b/fieldtrip/__forward/_leadfield_simbio.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _leadfield_simbio(*args, **kwargs): + """ + leadfield_simbio leadfields for a set of dipoles + + [lf] = leadfield_simbio(pos, vol); + + with input arguments + pos a matrix of dipole positions + there can be 'deep electrodes' too! + vol contains a FE volume conductor (output of ft_prepare_vol_sens) + + the output lf is the leadfield matrix of dimensions m (rows) x n*3 (cols) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/leadfield_simbio.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("leadfield_simbio", *args, **kwargs) diff --git a/fieldtrip/__forward/_leadsphere_all.py b/fieldtrip/__forward/_leadsphere_all.py new file mode 100644 index 0000000..36a8f4e --- /dev/null +++ b/fieldtrip/__forward/_leadsphere_all.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _leadsphere_all(*args, **kwargs): + """ + usage: out=leadsphere_all(xloc,sensorloc,sensorori) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/leadsphere_all.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("leadsphere_all", *args, **kwargs) diff --git a/fieldtrip/__forward/_legs.py b/fieldtrip/__forward/_legs.py new file mode 100644 index 0000000..d332a30 --- /dev/null +++ b/fieldtrip/__forward/_legs.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def _legs(*args, **kwargs): + """ + usage: [basis,gradbasis]=legs(x,dir,n,scale) + + returns the values and directional derivatives of (n+1)^2-1 basis functions + constructed from spherical harmonics at locations given in x and, for the + gradients, for (in general non-normalized) directions given in dir. + + input: x set of N locations given as an Nx3 matrix + dir set of N direction vectors given as an Nx3 matrix + (dir is not normalized (it hence can be a dipole moment)) + n order of spherical harmonics + + output: basis: Nx((n+1)^2-1) matrix containing in the j.th row the real + and imaginary parts of r^kY_{kl}(theta,Phi)/(N_{kl}*scale^k) ( (r,theta,phi) + are the spherical coordinates corresponding to the j.th row in x) + for k=1 to n and l=0 to k + the order is: + real parts for k=1 and l=0,1 (2 terms) + then imaginary parts for k=1 and l=1 (1 term) + then real parts for k=2 and l=0,1,2 (3 terms) + then imaginary parts for k=2 and l=1,2 (2 term) + etc. + the spherical harmonics are normalized with + N_{kl}=sqrt(4pi (k+l)!/((k-l)!(2k+1))) + the phase does not contain the usual (-1)^l term !!! + scale is constant preferably set to the avererage radius + + gradbasis: Nx((n+1)^2-1) matrix containing in the j.th row the scalar + product of the gradient of the former with the j.th row of dir + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/legs.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("legs", *args, **kwargs) diff --git a/fieldtrip/__forward/_lmoutr.py b/fieldtrip/__forward/_lmoutr.py new file mode 100644 index 0000000..bd3e2fa --- /dev/null +++ b/fieldtrip/__forward/_lmoutr.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _lmoutr(*args, **kwargs): + """ + LMOUTR computes the la/mu parameters of a point projected to a triangle + + Use as + [la, mu, dist] = lmoutr(v1, v2, v3, r) + where v1, v2 and v3 are three vertices of the triangle, and r is + the point that is projected onto the plane spanned by the vertices + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/lmoutr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("lmoutr", *args, **kwargs) diff --git a/fieldtrip/__forward/_lmoutrn.py b/fieldtrip/__forward/_lmoutrn.py new file mode 100644 index 0000000..81e12f4 --- /dev/null +++ b/fieldtrip/__forward/_lmoutrn.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _lmoutrn(*args, **kwargs): + """ + LMOUTRN computes the la/mu parameters of a point projected to triangles + + Use as + [la, mu, dist, proj] = lmoutrn(v1, v2, v3, r) + where v1, v2 and v3 are Nx3 matrices with vertex positions of the triangles, + and r is the point that is projected onto the planes spanned by the vertices + This is a vectorized version of Robert's lmoutrn function and is + generally faster than a for-loop around the mex-file. It also returns the + projection of the point r onto the planes of the triangles, and the signed + distance to the triangles. The sign of the distance is negative if the point + lies closer to the average across all vertices and the triangle under consideration. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/lmoutrn.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("lmoutrn", *args, **kwargs) diff --git a/fieldtrip/__forward/_loadama.py b/fieldtrip/__forward/_loadama.py new file mode 100644 index 0000000..ea30a54 --- /dev/null +++ b/fieldtrip/__forward/_loadama.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _loadama(*args, **kwargs): + """ + LOADAMA read an inverted A-matrix and associated geometry information + from an ama file that was written by Tom Oostendorp's DIPOLI + + Use as + [ama] = loadama(filename) + + See also LOADTRI, LOADMAT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/loadama.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("loadama", *args, **kwargs) diff --git a/fieldtrip/__forward/_magnetic_dipole.py b/fieldtrip/__forward/_magnetic_dipole.py new file mode 100644 index 0000000..2c3d857 --- /dev/null +++ b/fieldtrip/__forward/_magnetic_dipole.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _magnetic_dipole(*args, **kwargs): + """ + MAGNETIC_DIPOLE leadfield for a magnetic dipole in an infinite medium + + [lf] = magnetic_dipole(R, pos, ori) + + with input arguments + R position dipole + pos position magnetometers + ori orientation magnetometers + + See also CURRENT_DIPOLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/magnetic_dipole.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("magnetic_dipole", *args, **kwargs) diff --git a/fieldtrip/__forward/_match_str.py b/fieldtrip/__forward/_match_str.py new file mode 100644 index 0000000..ad91db7 --- /dev/null +++ b/fieldtrip/__forward/_match_str.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _match_str(*args, **kwargs): + """ + MATCH_STR looks for matching labels in two lists of strings + and returns the indices into both the 1st and 2nd list of the matches. + They will be ordered according to the first input argument. + + Use as + [sel1, sel2] = match_str(strlist1, strlist2) + + The strings can be stored as a char matrix or as an vertical array of + cells, the matching is done for each row. + + When including a 1 as the third input argument, the output lists of + indices will be expanded to the size of the largest input argument. + Entries that occur only in one of the two inputs will correspond to a 0 + in the output, in this case. This can be convenient in rare cases if the + size of the input lists is meaningful. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/match_str.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("match_str", *args, **kwargs) diff --git a/fieldtrip/__forward/_meg_forward.py b/fieldtrip/__forward/_meg_forward.py new file mode 100644 index 0000000..69d2309 --- /dev/null +++ b/fieldtrip/__forward/_meg_forward.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def _meg_forward(*args, **kwargs): + """ + calculates the magnetic field of n dipoles + in a realistic volume conductor + usage: field=meg_forward(dip_par,forwpar) + + input: + dip_par nx6 matrix where each row contains location (first 3 numbers) + and moment (second 3 numbers) of a dipole + forwpar structure containing all information relevant for this + calculation; forwpar is calculated with meg_ini + You have here an option to include linear transformations in + the forward model by specifying forpwar.lintrafo=A + where A is an NxM matrix. Then field -> A field + You can use that, e.g., if you can write the forward model + with M magnetometer-channels plus a matrix multiplication + transforming this to a (eventually higher order) gradiometer. + + output: + field mxn matrix where the i.th column is the field in m channels + of the i.th dipole + + note: No assumptions about units are made (i.e. no scaling factors) + + Copyright (C) 2003, Guido Nolte + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + + $Id$ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/meg_forward.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("meg_forward", *args, **kwargs) diff --git a/fieldtrip/__forward/_meg_ini.py b/fieldtrip/__forward/_meg_ini.py new file mode 100644 index 0000000..9d0497f --- /dev/null +++ b/fieldtrip/__forward/_meg_ini.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def _meg_ini(*args, **kwargs): + """ + initializes MEG-forward calculation + usage: forwpar=meg_ini(vc,center,order,sens,refs,gradlocs,weights) + + input: + vc: Nx6 matrix; N is the number of surface points + the first three numbers in each row are the location + and the second three are the orientation of the surface + normal + center: 3x1 vector denoting the center of volume the conductor + order: desired order of spherical spherical harmonics; + for 'real' realistic volume conductors order=10 is o.k + sens: Mx6 matrix containing sensor location and orientation, + format as for vc + refs: optional argument. If provided, refs contains the location and oriantion + (format as sens) of additional sensors which are subtracted from the original + ones. This makes a gradiometer. One can also do this with the + magnetometer version of this program und do the subtraction outside this program, + but the gradiometer version is faster. + gradlocs, weights: optional two arguments (they must come together!). + gradlocs are the location of additional channels (e.g. to calculate + a higher order gradiometer) and weights. The i.th row in weights contains + the weights to correct if the i.th cannel. These extra fields are added! + (has historical reasons). + + output: + forpwar: structure containing all parameters needed for forward calculation + + note: it is assumed that locations are in cm. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/meg_ini.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("meg_ini", *args, **kwargs) diff --git a/fieldtrip/__forward/_mesh2edge.py b/fieldtrip/__forward/_mesh2edge.py new file mode 100644 index 0000000..829983b --- /dev/null +++ b/fieldtrip/__forward/_mesh2edge.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _mesh2edge(*args, **kwargs): + """ + MESH2EDGE finds the edge lines from a triangulated mesh or the edge + surfaces from a tetrahedral or hexahedral mesh. An edge is defined as an + element that does not border any other element. This also implies that a + closed triangulated surface has no edges. + + Use as + [edge] = mesh2edge(mesh) + + See also POLY2TRI, TRI2BND + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/mesh2edge.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh2edge", *args, **kwargs) diff --git a/fieldtrip/__forward/_mesh_icosahedron.py b/fieldtrip/__forward/_mesh_icosahedron.py new file mode 100644 index 0000000..010fa44 --- /dev/null +++ b/fieldtrip/__forward/_mesh_icosahedron.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_icosahedron(*args, **kwargs): + """ + MESH_ICOSAHEDRON returns the vertices and triangle of a 12-vertex icosahedral + mesh. + + Use as + [pos, tri] = mesh_icosahedron + + See also MESH_TETRAHEDRON, MESH_OCTAHEDRON, MESH_SPHERE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/mesh_icosahedron.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_icosahedron", *args, **kwargs) diff --git a/fieldtrip/__forward/_mesh_octahedron.py b/fieldtrip/__forward/_mesh_octahedron.py new file mode 100644 index 0000000..b6a1829 --- /dev/null +++ b/fieldtrip/__forward/_mesh_octahedron.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_octahedron(*args, **kwargs): + """ + MESH_OCTAHEDRON returns the vertices and triangles of an octahedron + + Use as + [pos tri] = mesh_octahedron; + + See also MESH_TETRAHEDRON, MESH_OCTAHEDRON, MESH_SPHERE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/mesh_octahedron.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_octahedron", *args, **kwargs) diff --git a/fieldtrip/__forward/_mesh_sphere.py b/fieldtrip/__forward/_mesh_sphere.py new file mode 100644 index 0000000..e08b492 --- /dev/null +++ b/fieldtrip/__forward/_mesh_sphere.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_sphere(*args, **kwargs): + """ + MESH_SPHERE creates spherical mesh, with approximately nvertices vertices + + Use as + [pos, tri] = mesh_sphere(n, method) + + The input parameter 'n' specifies the (approximate) number of vertices. If n is + empty, or undefined, a 12 vertex icosahedron will be returned. If n is specified + but the method is not specified, the most optimal method will be selected based on + n. + - If log4((n-2)/10) is an integer, the mesh will be based on an icosahedron. + - If log4((n-2)/4) is an integer, the mesh will be based on a refined octahedron. + - If log4((n-2)/2) is an integer, the mesh will be based on a refined tetrahedron. + - Otherwise, an msphere will be used. + + The input parameter 'method' defines which algorithm or approach to use. This can + be 'icosahedron', 'octahedron', 'tetrahedron', 'fibonachi', 'msphere', or 'ksphere'. + + See also MESH_TETRAHEDRON, MESH_OCTAHEDRON, MESH_ICOSAHEDRON + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/mesh_sphere.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_sphere", *args, **kwargs) diff --git a/fieldtrip/__forward/_mesh_tetrahedron.py b/fieldtrip/__forward/_mesh_tetrahedron.py new file mode 100644 index 0000000..6de15a4 --- /dev/null +++ b/fieldtrip/__forward/_mesh_tetrahedron.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_tetrahedron(*args, **kwargs): + """ + MESH_TETRAHEDRON returns the vertices and triangles of a tetrahedron. + + Use as + [pos, tri] = mesh_tetrahedron; + + See also MESH_ICOSAHEDRON, MESH_OCTAHEDRON, MESH_SPHERE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/mesh_tetrahedron.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_tetrahedron", *args, **kwargs) diff --git a/fieldtrip/__forward/_pinvNx2.py b/fieldtrip/__forward/_pinvNx2.py new file mode 100644 index 0000000..4088516 --- /dev/null +++ b/fieldtrip/__forward/_pinvNx2.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _pinvNx2(*args, **kwargs): + """ + PINVNX2 computes a pseudo-inverse of the M slices of an MxNx2 real-valued matrix. + Output has dimensionality Mx2xN. This implementation is generally faster + than calling pinv in a for-loop, once M > 2 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/pinvNx2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("pinvNx2", *args, **kwargs) diff --git a/fieldtrip/__forward/_plgndr.py b/fieldtrip/__forward/_plgndr.py new file mode 100644 index 0000000..2a33949 --- /dev/null +++ b/fieldtrip/__forward/_plgndr.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _plgndr(*args, **kwargs): + """ + PLGNDR associated Legendre function + + y = plgndr(n,k,x) computes the values of the associated Legendre functions + of degree N and order K + + implemented as MEX file + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/plgndr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("plgndr", *args, **kwargs) diff --git a/fieldtrip/__forward/_plinprojn.py b/fieldtrip/__forward/_plinprojn.py new file mode 100644 index 0000000..d858461 --- /dev/null +++ b/fieldtrip/__forward/_plinprojn.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _plinprojn(*args, **kwargs): + """ + PLINPROJN projects a point onto a line or linepiece + + [proj, dist] = plinprojn(l1, l2, r, flag) + + where l1 and l2 are Nx3 matrices with the begin and endpoints of the linepieces, + and r is the point that is projected onto the lines + This is a vectorized version of Robert's plinproj function and is + generally faster than a for-loop around the mex-file. + + the optional flag can be: + 0 (default) project the point anywhere on the complete line + 1 project the point within or on the edge of the linepiece + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/plinprojn.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("plinprojn", *args, **kwargs) diff --git a/fieldtrip/__forward/_project_elec.py b/fieldtrip/__forward/_project_elec.py new file mode 100644 index 0000000..1911c06 --- /dev/null +++ b/fieldtrip/__forward/_project_elec.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _project_elec(*args, **kwargs): + """ + PROJECT_ELEC projects electrodes on a triangulated surface + and returns triangle index, la/mu parameters and distance + + Use as + [el, prj] = project_elec(elc, pnt, tri) + which returns + el = Nx4 matrix with [tri, la, mu, dist] for each electrode + prj = Nx3 matrix with the projected electrode position + + See also TRANSFER_ELEC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/project_elec.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("project_elec", *args, **kwargs) diff --git a/fieldtrip/__forward/_projecttri.py b/fieldtrip/__forward/_projecttri.py new file mode 100644 index 0000000..8a8aa25 --- /dev/null +++ b/fieldtrip/__forward/_projecttri.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _projecttri(*args, **kwargs): + """ + PROJECTTRI makes a closed triangulation of a list of vertices by + projecting them onto a unit sphere and subsequently by constructing + a convex hull triangulation. + + Use as + tri = projecttri(pos, method) + where method is either 'convhull' (default) or 'delaunay'. + + See also SURFACE_NORMALS, PCNORMALS, ELPROJ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/projecttri.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("projecttri", *args, **kwargs) diff --git a/fieldtrip/__forward/_ptriproj.py b/fieldtrip/__forward/_ptriproj.py new file mode 100644 index 0000000..117192d --- /dev/null +++ b/fieldtrip/__forward/_ptriproj.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _ptriproj(*args, **kwargs): + """ + PTRIPROJ projects a point onto the plane going through a triangle + + Use as + [proj, dist] = ptriproj(v1, v2, v3, r, flag) + where v1, v2 and v3 are three vertices of the triangle, and r is + the point that is projected onto the plane spanned by the vertices + + the optional flag can be: + 0 (default) project the point anywhere on the complete plane + 1 project the point within or on the edge of the triangle + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ptriproj.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ptriproj", *args, **kwargs) diff --git a/fieldtrip/__forward/_ptriprojn.py b/fieldtrip/__forward/_ptriprojn.py new file mode 100644 index 0000000..439739f --- /dev/null +++ b/fieldtrip/__forward/_ptriprojn.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _ptriprojn(*args, **kwargs): + """ + PTRIPROJN projects a point onto the plane going through a set of + triangles + + Use as + [proj, dist] = ptriprojn(v1, v2, v3, r, flag) + where v1, v2 and v3 are Nx3 matrices with vertex positions of the triangles, + and r is the point that is projected onto the planes spanned by the vertices + This is a vectorized version of Robert's ptriproj function and is + generally faster than a for-loop around the mex-file. + + the optional flag can be: + 0 (default) project the point anywhere on the complete plane + 1 project the point within or on the edge of the triangle + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/ptriprojn.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ptriprojn", *args, **kwargs) diff --git a/fieldtrip/__forward/_refine.py b/fieldtrip/__forward/_refine.py new file mode 100644 index 0000000..a1624ca --- /dev/null +++ b/fieldtrip/__forward/_refine.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def _refine(*args, **kwargs): + """ + REFINE a 3D surface that is described by a triangulation + + Use as + [pos, tri] = refine(pos, tri) + [pos, tri] = refine(pos, tri, 'banks') + [pos, tri, texture] = refine(pos, tri, 'banks', texture) + [pos, tri] = refine(pos, tri, 'updown', numtri) + + If no method is specified, the default is to refine the mesh globally by bisecting + each edge according to the algorithm described in Banks, 1983. + + The Banks method allows the specification of a subset of triangles to be refined + according to Banks' algorithm. Adjacent triangles will be gracefully dealt with. + + The alternative 'updown' method refines the mesh a couple of times + using Banks' algorithm, followed by a downsampling using the REDUCEPATCH + function. + + If the textures of the vertices are specified, the textures for the new + vertices are computed + + The Banks method is a memory efficient implementation which remembers the + previously inserted vertices. The refinement algorithm executes in linear + time with the number of triangles. It is mentioned in + http://www.cs.rpi.edu/~flaherje/pdf/fea8.pdf, which also contains the original + reference. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/refine.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("refine", *args, **kwargs) diff --git a/fieldtrip/__forward/_remove_double_vertices.py b/fieldtrip/__forward/_remove_double_vertices.py new file mode 100644 index 0000000..5d9aa92 --- /dev/null +++ b/fieldtrip/__forward/_remove_double_vertices.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _remove_double_vertices(*args, **kwargs): + """ + REMOVE_DOUBLE_VERTICES removes double vertices from a triangular, tetrahedral or + hexahedral mesh, renumbering the vertex-indices for the elements. + + Use as + [pos, tri] = remove_double_vertices(pos, tri) + [pos, tet] = remove_double_vertices(pos, tet) + [pos, hex] = remove_double_vertices(pos, hex) + + See also REMOVE_VERTICES, REMOVE_UNUSED_VERTICES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/remove_double_vertices.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("remove_double_vertices", *args, **kwargs) diff --git a/fieldtrip/__forward/_remove_unused_vertices.py b/fieldtrip/__forward/_remove_unused_vertices.py new file mode 100644 index 0000000..1ec8ad4 --- /dev/null +++ b/fieldtrip/__forward/_remove_unused_vertices.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _remove_unused_vertices(*args, **kwargs): + """ + REMOVE_UNUSED_VERTICES removes unused vertices from a triangular, tetrahedral or + hexahedral mesh, renumbering the vertex-indices for the elements. + + Use as + [pos, tri] = remove_unused_vertices(pos, tri) + [pos, tet] = remove_unused_vertices(pos, tet) + [pos, hex] = remove_unused_vertices(pos, hex) + + See also REMOVE_VERTICES, REMOVE_DOUBLE_VERTICES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/remove_unused_vertices.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("remove_unused_vertices", *args, **kwargs) diff --git a/fieldtrip/__forward/_remove_vertices.py b/fieldtrip/__forward/_remove_vertices.py new file mode 100644 index 0000000..ef30b23 --- /dev/null +++ b/fieldtrip/__forward/_remove_vertices.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _remove_vertices(*args, **kwargs): + """ + REMOVE_VERTICES removes specified indexed vertices from a triangular, tetrahedral + or hexahedral mesh renumbering the vertex-indices for the elements and removing all + resulting 'open' elements. + + Use as + [pos, tri] = remove_vertices(pos, tri, sel) + [pos, tet] = remove_vertices(pos, tet, sel) + [pos, hex] = remove_vertices(pos, hex, sel) + + See also REMOVE_DOUBLE_VERTICES, REMOVE_UNUSED_VERTICES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/remove_vertices.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("remove_vertices", *args, **kwargs) diff --git a/fieldtrip/__forward/_retriangulate.py b/fieldtrip/__forward/_retriangulate.py new file mode 100644 index 0000000..1454987 --- /dev/null +++ b/fieldtrip/__forward/_retriangulate.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def _retriangulate(*args, **kwargs): + """ + RETRIANGULATE projects a triangulation onto another triangulation + thereby providing a a new triangulation of the old one. + + Use as + [pnt, tri] = retriangulate(pnt1, tri1, pnt2, tri2, flag) + where + pnt1, tri1 describe the desired surface + pnt2, tri2 describe the triangulation that will be projected on surface 1 + + The optional flag determines whether the center of the triangulations should be + shifted to the origin before the projection is done. The resulting surface will + be shifted back to its original location. + + flag=0 means no shift (default) + flag=1 means shifting to the geometrical mean of the respective triangulations + flag=2 means shifting to the center of the bounding box of the respective triangulations + flag=3 means shifting to the geometrical mean of the first triangulation + flag=4 means shifting to the center of the bounding box of the first triangulation + flag=5 means shifting to the geometrical mean of the second triangulation + flag=6 means shifting to the center of the bounding box of the second triangulation + + The projection is done from the coordinate system origin (0,0,0). + + See also ICOSAHEDRONxxx, ISOSURFACE, REDUCEPATCH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/retriangulate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("retriangulate", *args, **kwargs) diff --git a/fieldtrip/__forward/_rmsubfield.py b/fieldtrip/__forward/_rmsubfield.py new file mode 100644 index 0000000..9a1ccba --- /dev/null +++ b/fieldtrip/__forward/_rmsubfield.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _rmsubfield(*args, **kwargs): + """ + RMSUBFIELD removes the contents of the specified field from a structure + just like the standard Matlab RMFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = rmsubfield(s, 'fieldname') + or as + s = rmsubfield(s, 'fieldname.subfieldname') + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/rmsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rmsubfield", *args, **kwargs) diff --git a/fieldtrip/__forward/_setsubfield.py b/fieldtrip/__forward/_setsubfield.py new file mode 100644 index 0000000..f555b57 --- /dev/null +++ b/fieldtrip/__forward/_setsubfield.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _setsubfield(*args, **kwargs): + """ + SETSUBFIELD sets the contents of the specified field to a specified value + just like the standard Matlab SETFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = setsubfield(s, 'fieldname', value) + or as + s = setsubfield(s, 'fieldname.subfieldname', value) + + where nested is a logical, false denoting that setsubfield will create + s.subfieldname instead of s.fieldname.subfieldname + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/setsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("setsubfield", *args, **kwargs) diff --git a/fieldtrip/__forward/_solid_angle.py b/fieldtrip/__forward/_solid_angle.py new file mode 100644 index 0000000..49696bd --- /dev/null +++ b/fieldtrip/__forward/_solid_angle.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _solid_angle(*args, **kwargs): + """ + SOLID_ANGLE of a planar triangle as seen from the origin + + The solid angle W subtended by a surface S is defined as the surface + area W of a unit sphere covered by the surface's projection onto the + sphere. Solid angle is measured in steradians, and the solid angle + corresponding to all of space being subtended is 4*pi sterradians. + + Use: + [w] = solid_angle(v1, v2, v3) + or + [w] = solid_angle(pnt, tri) + where v1, v2 and v3 are the vertices of a single triangle in 3D or + pnt and tri contain a description of a triangular mesh (this will + compute the solid angle for each triangle) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/solid_angle.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("solid_angle", *args, **kwargs) diff --git a/fieldtrip/__forward/_surface_inside.py b/fieldtrip/__forward/_surface_inside.py new file mode 100644 index 0000000..128eb49 --- /dev/null +++ b/fieldtrip/__forward/_surface_inside.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _surface_inside(*args, **kwargs): + """ + SURFACE_INSIDE determines if a point is inside/outside a triangle mesh + whereby the bounding triangle mesh should be closed. + + Use as + inside = surface_inside(dippos, pos, tri) + where + dippos position of point of interest (can be 1x3 or Nx3) + pos bounding mesh vertices + tri bounding mesh triangles + + See also SURFACE_AREA, SURFACE_ORIENTATION, SURFACE_NORMALS, SURFACE_NESTING, SOLID_ANGLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/surface_inside.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("surface_inside", *args, **kwargs) diff --git a/fieldtrip/__forward/_surface_nesting.py b/fieldtrip/__forward/_surface_nesting.py new file mode 100644 index 0000000..2fe8249 --- /dev/null +++ b/fieldtrip/__forward/_surface_nesting.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _surface_nesting(*args, **kwargs): + """ + SURFACE_NESTING determines what the order of multiple boundaries is to + get them sorted with the innermost or outermost surface first. + + Use as + order = surface_nesting(bnd, desired) + where bnd is a structure-array with multiple closed and nested meshes. + + Note that it does not check for intersections and may fail for + intersecting surfaces. + + See also SURFACE_ORIENTATION, SURFACE_NORMALS, SURFACE_INSIDE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/surface_nesting.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("surface_nesting", *args, **kwargs) diff --git a/fieldtrip/__forward/_surface_normals.py b/fieldtrip/__forward/_surface_normals.py new file mode 100644 index 0000000..6acb0d5 --- /dev/null +++ b/fieldtrip/__forward/_surface_normals.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _surface_normals(*args, **kwargs): + """ + SURFACE_NORMALS compute the surface normals of a triangular mesh + for each triangle or for each vertex + + Use as + nrm = surface_normals(pnt, tri, opt) + where opt is either 'vertex' (default) or 'triangle'. + + See also SURFACE_AREA, SURFACE_ORIENTATION, SURFACE_INSIDE, SURFACE_NESTING, PROJECTTRI, PCNORMALS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/surface_normals.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("surface_normals", *args, **kwargs) diff --git a/fieldtrip/__forward/_surface_orientation.py b/fieldtrip/__forward/_surface_orientation.py new file mode 100644 index 0000000..021bde2 --- /dev/null +++ b/fieldtrip/__forward/_surface_orientation.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _surface_orientation(*args, **kwargs): + """ + SURFACE_ORIENTATION returns the string 'inward' or 'outward' or 'unknown', + depending on the surface orientation. + + Use as + str = surface_orientation(pos, tri) + or + str = surface_orientation(pos, tri, ori) + + See also SURFACE_AREA, SURFACE_NESTING, SURFACE_NORMALS, SURFACE_NESTING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/surface_orientation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("surface_orientation", *args, **kwargs) diff --git a/fieldtrip/__forward/_surface_shift.py b/fieldtrip/__forward/_surface_shift.py new file mode 100644 index 0000000..3a72752 --- /dev/null +++ b/fieldtrip/__forward/_surface_shift.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _surface_shift(*args, **kwargs): + """ + SURFACE_SHIFT inflates or deflates a triangulated surface by moving the + vertices outward or inward along their normals. + + Use as + pos = surface_inflate(pos, tri, amount) + where pos and tri describe the surface. + + See also SURFACE_NORMALS, SURFACE_ORIENTATION, SURFACE_INSIDE, + SURFACE_NESTING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/surface_shift.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("surface_shift", *args, **kwargs) diff --git a/fieldtrip/__forward/_transfer_elec.py b/fieldtrip/__forward/_transfer_elec.py new file mode 100644 index 0000000..5e82b4b --- /dev/null +++ b/fieldtrip/__forward/_transfer_elec.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _transfer_elec(*args, **kwargs): + """ + TRANSFER_ELEC is the transfermatrix from vertex to electrode potentials + using bi-linear interpolation over the triangles + + tra = transfer_elec(pnt, tri, el) + + the Nx3 matrix el shold contain [tri, la, mu] for each electrode + + See also PROJECT_ELEC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/transfer_elec.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("transfer_elec", *args, **kwargs) diff --git a/fieldtrip/__forward/_triangle4pt.py b/fieldtrip/__forward/_triangle4pt.py new file mode 100644 index 0000000..082ead2 --- /dev/null +++ b/fieldtrip/__forward/_triangle4pt.py @@ -0,0 +1,70 @@ +from fieldtrip._runtime import Runtime + + +def _triangle4pt(*args, **kwargs): + """ + TRIANGLE4PNT takes the volume model and estimates the 4th point of each + triangle of each mesh. + + Use as + headmodel = triangle4pt(headmodel) + + In each headmodel.bnd sub-structure, a field '.pnt4' is added. The '.pnt4' + field is a Ntri*3 matrix, with the coordinates of a point for each + triangle in the meshed surface. + + Explanations: + The point is that for some BEM, specifically 'solid angle', calculation + it is necessary to estimate the local curvature of the true surface which + is approximated by the flat triangle. One way to proceed is to use + "close by" vertices to estimate the overall area's curvature. + A more elegant(?) way uses a 4th point for each triangle: the "centroid" + of the triangle is simply pusehd away from the triangle surface to fix + the local surface curvature (assuming the surface is smooth enough). + This 4th point is thus hovering above/under the triangle and can be used + to fit a sphere on the triangle in a realistic way. + + Method: + - The 4th point can/could be defined at the tessalation stage, based on + the anatomical images directly. + - With any model, the curvature can be estimated/approximated by looking + at the vertices around the triangle considered and fit a sphere on + those few vertices, assuming the surface is smooth enough + The latter option is the one followed here. + The extra-vertices considered here are those 3 which are linked to the + triangle by 2 edges. + __________________________________________________________________________ + + written by Christophe Phillips, 2009/01/19 + Cyclotron Research Centre, University of li?ge, belgium + + $Id$ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/triangle4pt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("triangle4pt", *args, **kwargs) diff --git a/fieldtrip/__forward/_undobalancing.py b/fieldtrip/__forward/_undobalancing.py new file mode 100644 index 0000000..c6e59d3 --- /dev/null +++ b/fieldtrip/__forward/_undobalancing.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _undobalancing(*args, **kwargs): + """ + UNDOBALANCING removes all balancing coefficients from the gradiometer sensor array + + This is used in CHANNELPOSITION, FT_PREPARE_LAYOUT, FT_SENSTYPE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/private/undobalancing.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("undobalancing", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_compute_leadfield.py b/fieldtrip/__forward/ft_compute_leadfield.py new file mode 100644 index 0000000..493e1a6 --- /dev/null +++ b/fieldtrip/__forward/ft_compute_leadfield.py @@ -0,0 +1,96 @@ +from fieldtrip._runtime import Runtime + + +def ft_compute_leadfield(*args, **kwargs): + """ + FT_COMPUTE_LEADFIELD computes a forward solution for a dipole in a a volume + conductor model. The forward solution is expressed as the leadfield matrix + (Nchan*3), where each column corresponds with the potential or field distributions + on all sensors for one of the x,y,z-orientations of the dipole. + + Use as + [lf] = ft_compute_leadfield(dippos, sens, headmodel, ...) + with input arguments + dippos = position dipole (1*3 or Ndip*3) + sens = structure with gradiometer or electrode definition + headmodel = structure with volume conductor definition + + The headmodel represents a volume conductor model, its contents + depend on the type of model. The sens structure represents a sensor + array, i.e. EEG electrodes or MEG gradiometers. + + It is possible to compute a simultaneous forward solution for EEG and MEG + by specifying sens and grad as two cell-arrays, e.g. + sens = {senseeg, sensmeg} + headmodel = {voleeg, volmeg} + This results in the computation of the leadfield of the first element of + sens and headmodel, followed by the second, etc. The leadfields of the + different imaging modalities are subsequently concatenated. + + Additional input arguments can be specified as key-value pairs, supported + optional arguments are + 'reducerank' = 'no' or number (default = 3 for EEG, 2 for MEG) + 'backproject' = 'yes' or 'no', in the case of a rank reduction this parameter determines whether the result will be backprojected onto the original subspace (default = 'yes') + 'normalize' = 'no', 'yes' or 'column' (default = 'no') + 'normalizeparam' = parameter for depth normalization (default = 0.5) + 'weight' = number or Nx1 vector, weight for each dipole position to compensate for the size of the corresponding patch (default = 1) + + The leadfield weight may be used to specify a (normalized) corresponding surface + area for each dipole, e.g. when the dipoles represent a folded cortical surface + with varying triangle size. + + Depending on the specific input arguments for the sensor and volume, this function + will select the appropriate low-level EEG or MEG forward model. The leadfield + matrix for EEG will have an average reference over all the electrodes. + + The supported forward solutions for MEG are + infinite homogenous medium + single sphere (Cuffin and Cohen, 1977) + multiple spheres with one sphere per channel (Huang et al, 1999) + realistic single shell using superposition of basis functions (Nolte, 2003) + leadfield interpolation using a precomputed sourcemodel + boundary element method (BEM) + + The supported forward solutions for EEG are + infinite homogenous medium + infinite halfspace homogenous medium + single sphere + multiple concentric spheres (up to 4 spheres) + leadfield interpolation using a precomputed sourcemodel + boundary element method (BEM) + finite element method (FEM) + + See also FT_PREPARE_VOL_SENS, FT_HEADMODEL_ASA, FT_HEADMODEL_BEMCP, + FT_HEADMODEL_CONCENTRICSPHERES, FT_HEADMODEL_DIPOLI, FT_HEADMODEL_HALFSPACE, + FT_HEADMODEL_INFINITE, FT_HEADMODEL_LOCALSPHERES, FT_HEADMODEL_OPENMEEG, + FT_HEADMODEL_SINGLESHELL, FT_HEADMODEL_SINGLESPHERE, + FT_HEADMODEL_HALFSPACE, FT_HEADMODEL_DUNEURO + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_compute_leadfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_compute_leadfield", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_convert_units.py b/fieldtrip/__forward/ft_convert_units.py new file mode 100644 index 0000000..62596be --- /dev/null +++ b/fieldtrip/__forward/ft_convert_units.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def ft_convert_units(*args, **kwargs): + """ + FT_CONVERT_UNITS changes the geometrical dimension to the specified SI unit. + The units of the input object is determined from the structure field + object.unit, or is estimated based on the spatial extend of the structure, + e.g. a volume conduction model of the head should be approximately 20 cm large. + + Use as + [output] = ft_convert_units(input, target) + + The following input data structures are supported + electrode or gradiometer array, see FT_DATATYPE_SENS + volume conductor, see FT_DATATYPE_HEADMODEL + anatomical mri, see FT_DATATYPE_VOLUME + segmented mri, see FT_DATATYPE_SEGMENTATION + source model, see FT_DATATYPE_SOURCE and FT_PREPARE_SOURCEMODEL + + The possible target units are 'm', 'cm ' or 'mm'. If no target units are specified, + this function will only determine the geometrical units of the input object. + + See also FT_DETERMINE_UNITS, FT_DETERMINE_COORDSYS, FT_CONVERT_COORDSYS, FT_PLOT_AXES, FT_PLOT_XXX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_convert_units.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_convert_units", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_determine_units.py b/fieldtrip/__forward/ft_determine_units.py new file mode 100644 index 0000000..08aef45 --- /dev/null +++ b/fieldtrip/__forward/ft_determine_units.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def ft_determine_units(*args, **kwargs): + """ + FT_DETERMINE_UNITS tries to determine the units of a geometrical object by + looking at its size and by relating this to the approximate size of the + human head according to the following table: + from 0.050 to 0.500 -> meter + from 0.500 to 5.000 -> decimeter + from 5.000 to 50.000 -> centimeter + from 50.000 to 500.000 -> millimeter + + Use as + [output] = ft_determine_units(input) + + The following input data structures are supported + electrode or gradiometer array, see FT_DATATYPE_SENS + volume conduction model, see FT_DATATYPE_HEADMODEL + source model, see FT_DATATYPE_SOURCE and FT_PREPARE_SOURCEMODEL + anatomical mri, see FT_DATATYPE_VOLUME + segmented mri, see FT_DATATYPE_SEGMENTATION + anatomical or functional atlas, see FT_READ_ATLAS + + This function will add the field 'unit' to the output data structure with the + possible values 'm', 'cm ' or 'mm'. + + See also FT_CONVERT_UNITS, FT_DETERMINE_COODSYS, FT_CONVERT_COORDSYS, FT_PLOT_AXES, FT_PLOT_XXX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_determine_units.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_determine_units", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_estimate_units.py b/fieldtrip/__forward/ft_estimate_units.py new file mode 100644 index 0000000..ea096dc --- /dev/null +++ b/fieldtrip/__forward/ft_estimate_units.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def ft_estimate_units(*args, **kwargs): + """ + FT_ESTIMATE_UNITS tries to determine the units of a geometrical object by + looking at its size and by relating this to the approximate size of the + human head according to the following table: + from 0.050 to 0.500 -> meter + from 0.500 to 5.000 -> decimeter + from 5.000 to 50.000 -> centimeter + from 50.000 to 500.000 -> millimeter + + Use as + unit = ft_estimate_units(size) + + This function will return one of the following strings + 'm' + 'cm' + 'mm' + + See also FT_CONVERT_UNITS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_estimate_units.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_estimate_units", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_headmodel_asa.py b/fieldtrip/__forward/ft_headmodel_asa.py new file mode 100644 index 0000000..d0377be --- /dev/null +++ b/fieldtrip/__forward/ft_headmodel_asa.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmodel_asa(*args, **kwargs): + """ + FT_HEADMODEL_ASA reads a volume conduction model from an ASA *.vol + file + + ASA is commercial software (http://www.ant-neuro.com) that supports + among others the boundary element method (BEM) for EEG. This function + allows you to read an EEG BEM volume conduction model from an ASA + format file (*.vol) and use that for leadfield computations in + MATLAB. Constructing the geometry of the head model from an anatomical + MRI and the computation of the BEM system are both handled by ASA. + + Use as + headmodel = ft_headmodel_asa(filename) + + See also FT_PREPARE_VOL_SENS, FT_COMPUTE_LEADFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_headmodel_asa.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodel_asa", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_headmodel_bemcp.py b/fieldtrip/__forward/ft_headmodel_bemcp.py new file mode 100644 index 0000000..c52a760 --- /dev/null +++ b/fieldtrip/__forward/ft_headmodel_bemcp.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmodel_bemcp(*args, **kwargs): + """ + FT_HEADMODEL_BEMCP creates a volume conduction model of the head + using the boundary element method (BEM) for EEG. This function + takes as input the triangulated surfaces that describe the boundaries + and returns as output a volume conduction model which can be used + to compute leadfields. + + The implementation of this function is based on Christophe Phillips' + MATLAB code, hence the name "bemcp". + + Use as + headmodel = ft_headmodel_bemcp(mesh, ...) + + Optional input arguments should be specified in key-value pairs and can + include + conductivity = vector, conductivity of each compartment + checkmesh = 'yes' or 'no' + + See also FT_PREPARE_VOL_SENS, FT_COMPUTE_LEADFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_headmodel_bemcp.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodel_bemcp", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_headmodel_concentricspheres.py b/fieldtrip/__forward/ft_headmodel_concentricspheres.py new file mode 100644 index 0000000..561b82c --- /dev/null +++ b/fieldtrip/__forward/ft_headmodel_concentricspheres.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmodel_concentricspheres(*args, **kwargs): + """ + FT_HEADMODEL_CONCENTRICSPHERES creates a volume conduction model + of the head based on three or four concentric spheres. For a 3-sphere + model the spheres represent the skin surface, the outside of the + skull and the inside of the skull For a 4-sphere model, the surfaces + describe the skin, the outside-skull, the inside-skull and the inside of the + cerebro-spinal fluid (CSF) boundaries. + + The innermost surface is sometimes also referred to as the brain + surface, i.e. as the outside of the brain volume. + + This function takes as input a single headshape described with + points and fits the spheres to this surface. If you have a set of + points describing each surface, then this function fits the spheres + to all individual surfaces. + + Use as + headmodel = ft_headmodel_concentricspheres(mesh, ...) + + Optional input arguments should be specified in key-value pairs and can include + conductivity = vector with the conductivity of each compartment + fitind = vector with indices of the surfaces to use in fitting the center of the spheres + order = number of iterations in series expansion (default = 60) + + See also FT_PREPARE_VOL_SENS, FT_COMPUTE_LEADFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_headmodel_concentricspheres.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodel_concentricspheres", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_headmodel_dipoli.py b/fieldtrip/__forward/ft_headmodel_dipoli.py new file mode 100644 index 0000000..bc04caf --- /dev/null +++ b/fieldtrip/__forward/ft_headmodel_dipoli.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmodel_dipoli(*args, **kwargs): + """ + FT_HEADMODEL_DIPOLI creates a volume conduction model of the head + using the boundary element method (BEM) for EEG. This function takes + as input the triangulated surfaces that describe the boundaries and + returns as output a volume conduction model which can be used to + compute leadfields. + + This implements + Oostendorp TF, van Oosterom A. "Source parameter estimation in + inhomogeneous volume conductors of arbitrary shape." IEEE Trans + Biomed Eng. 1989 Mar;36(3):382-91. + + The implementation of this function uses an external command-line + executable with the name "dipoli" which is provided by Thom Oostendorp. + + Use as + headmodel = ft_headmodel_dipoli(mesh, ...) + + The mesh is given as a boundary or a struct-array of boundaries (surfaces) + + Optional input arguments should be specified in key-value pairs and can + include + isolatedsource = string, 'yes' or 'no' + conductivity = vector, conductivity of each compartment + tempdir = string, allows you to specify the path for the tempory files (default is automatic) + tempname = string, allows you to specify the full tempory name including path (default is automatic) + checkmesh = 'yes' or 'no' + + See also FT_PREPARE_VOL_SENS, FT_COMPUTE_LEADFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_headmodel_dipoli.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodel_dipoli", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_headmodel_duneuro.py b/fieldtrip/__forward/ft_headmodel_duneuro.py new file mode 100644 index 0000000..85d1630 --- /dev/null +++ b/fieldtrip/__forward/ft_headmodel_duneuro.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmodel_duneuro(*args, **kwargs): + """ + FT_HEADMODEL_DUNEURO creates a volume conduction model of the head using the finite element method (FEM) for EEG and MEG. + Different source models are implemented, including the St. Venant, the subtraction and partial integration model. This + function takes as input a mesh with tetrahedral or hexahedral elements and corresponding conductivities and returns + as output a volume conduction model which can be used to compute EEG/MEG leadfields. + + Use as + headmodel = ft_headmodel_duneuro(mesh,'conductivity', conductivities, ...) + headmodel = ft_headmodel_duneuro(mesh,'grid_filename', grid_filename, 'tensors_filename', tensors_filename, ...) + + Required input arguments should be specified in key-value pairs and have to include either + grid_filename = string, filename for grid in "msh" fileformat (see here: https://gmsh.info/doc/texinfo/gmsh.html#File-formats) + tensors_filename= string, filename for conductivities, txt file with conductivity values + or + conductivity = vector, conductivity values for tissues + + if a pair of filenames is provided, the input mesh is not considered, but will be generated from the grid_filename + + In addition, an optional struct with configuration options can be provided, which can specify the options + related to the functional behavior of the duneuro software. See DUNEURO_DEFAULTS for the configureable options, and + their default values. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_headmodel_duneuro.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodel_duneuro", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_headmodel_fns.py b/fieldtrip/__forward/ft_headmodel_fns.py new file mode 100644 index 0000000..8d9424c --- /dev/null +++ b/fieldtrip/__forward/ft_headmodel_fns.py @@ -0,0 +1,61 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmodel_fns(*args, **kwargs): + """ + FT_HEADMODEL_FNS creates the volume conduction structure to be used + in the FNS forward solver. + + Use as + headmodel = ft_headmodel_fns(seg, ...) + + Optional input arguments should be specified in key-value pairs and + can include + tissuecond = matrix C [9XN tissue types]; where N is the number of + tissues and a 3x3 tensor conductivity matrix is stored + in each column. + tissue = see fns_contable_write + tissueval = match tissues of segmentation input + transform = 4x4 transformation matrix (default eye(4)) + sens = sensor information (for which ft_datatype(sens,'sens')==1) + deepelec = used in the case of deep voxel solution + tolerance = scalar (default 1e-8) + + Standard default values for conductivity matrix C are derived from + Saleheen HI, Ng KT. New finite difference formulations for general + inhomogeneous anisotropic bioelectric problems. IEEE Trans Biomed Eng. + 1997 + + Additional documentation available at: + http://hunghienvn.nmsu.edu/wiki/index.php/FNS + + See also FT_PREPARE_VOL_SENS, FT_COMPUTE_LEADFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_headmodel_fns.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodel_fns", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_headmodel_halfspace.py b/fieldtrip/__forward/ft_headmodel_halfspace.py new file mode 100644 index 0000000..359bbfe --- /dev/null +++ b/fieldtrip/__forward/ft_headmodel_halfspace.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmodel_halfspace(*args, **kwargs): + """ + FT_HEADMODEL_HALFSPACE creates an EEG volume conduction model that + is described with an infinite conductive halfspace. You can think + of this as a plane with on one side a infinite mass of conductive + material (e.g. water) and on the other side non-conductive material + (e.g. air). + + Use as + headmodel = ft_headmodel_halfspace(mesh, Pc, ...) + where + mesh.pos = Nx3 vector specifying N points through which a plane is fitted + Pc = 1x3 vector specifying the spatial position of a single point that + is lying in the conductive halfspace + + Additional optional arguments should be specified as key-value pairs and can include + 'sourcemodel' = string, 'monopole' or 'dipole' (default = 'dipole') + 'conductivity' = number, conductivity value of the conductive halfspace (default = 1) + + See also FT_PREPARE_VOL_SENS, FT_COMPUTE_LEADFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_headmodel_halfspace.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodel_halfspace", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_headmodel_hbf.py b/fieldtrip/__forward/ft_headmodel_hbf.py new file mode 100644 index 0000000..05726f4 --- /dev/null +++ b/fieldtrip/__forward/ft_headmodel_hbf.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmodel_hbf(*args, **kwargs): + """ + FT_HEADMODEL_HBF creates a volume conduction model of the head + using the boundary element method (BEM) for M/EEG. This function + takes as input the triangulated surfaces that describe the boundaries + and returns as output a volume conduction model which can be used + to compute leadfields. + + The implementation of this function is based on Matti Stenroos' public + version of the Hesinki BEM Freamework hence the name "hbf". + + Use as + headmodel = ft_headmodel_hbf(mesh, ...) + + Optional input arguments should be specified in key-value pairs and can + include + conductivity = 2 x n array, conductivity on inside and outside of + compartment + checkmesh = 'yes' or 'no' + isolatedsource = which compartment number should ISA apply to? + DEFAULT: [] + + See also FT_PREPARE_VOL_SENS, FT_COMPUTE_LEADFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_headmodel_hbf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodel_hbf", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_headmodel_infinite.py b/fieldtrip/__forward/ft_headmodel_infinite.py new file mode 100644 index 0000000..29ee222 --- /dev/null +++ b/fieldtrip/__forward/ft_headmodel_infinite.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmodel_infinite(*args, **kwargs): + """ + FT_HEADMODEL_INFINITE returns an infinitely large homogenous + volume conduction model. For EEG the volume conductor can be used + to compute the leadfield of electric current dipoles, for MEG it + can be used for computing the leadfield of magnetic dipoles. + + Use as + headmodel = ft_headmodel_infinite; + + See also FT_PREPARE_VOL_SENS, FT_COMPUTE_LEADFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_headmodel_infinite.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodel_infinite", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_headmodel_interpolate.py b/fieldtrip/__forward/ft_headmodel_interpolate.py new file mode 100644 index 0000000..f4e7f2e --- /dev/null +++ b/fieldtrip/__forward/ft_headmodel_interpolate.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmodel_interpolate(*args, **kwargs): + """ + FT_HEADMODEL_INTERPOLATE describes a volume conduction model of the head in which + subsequent leadfield computations can be performed using a simple interpolation + scheme. + + Use as + headmodel = ft_headmodel_interpolate(filename, sens, leadfield) + or + headmodel = ft_headmodel_interpolate(filename, sens, leadfield) + + The input parameters are the filename to which the model will be written, + the electrode definition (see ft_DATATYPE_SENS). The third input argument + is either a pre-computed leadfield structure from FT_PREPARE_LEADFIELD + or a the output of a previous call to FT_HEADMODEL_INTERPOLATE. + + The output volume conduction model is stored on disk in a MATLAB file together with a + number of NIFTi files. The mat file contains a structure with the following fields + headmodel.sens = structure, electrode sensor description, see FT_DATATYE_SENS + headmodel.filename = cell-array with NIFTI filenames, one file per channel + and contains + headmodel.dim = [Nx Ny Nz] vector with the number of grid points along each dimension + headmodel.transform = 4x4 homogenous transformation matrix + headmodel.unit = string with the geometrical units of the positions, e.g. 'cm' or 'mm' + to describe the source positions. + + See also FT_PREPARE_VOL_SENS, FT_COMPUTE_LEADFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_headmodel_interpolate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodel_interpolate", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_headmodel_localspheres.py b/fieldtrip/__forward/ft_headmodel_localspheres.py new file mode 100644 index 0000000..db7f219 --- /dev/null +++ b/fieldtrip/__forward/ft_headmodel_localspheres.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmodel_localspheres(*args, **kwargs): + """ + FT_HEADMODEL_LOCALSPHERES constructs a MEG volume conduction model in + with a local sphere fitted to the head or brain surface for each separate + channel + + This implements + Huang MX, Mosher JC, Leahy RM. "A sensor-weighted overlapping-sphere + head model and exhaustive head model comparison for MEG." Phys Med + Biol. 1999 Feb;44(2):423-40 + + Use as + headmodel = ft_headmodel_localspheres(mesh, grad, ...) + + Optional arguments should be specified in key-value pairs and can include + radius = number, radius of sphere within which headshape points will + be included for the fitting algorithm + maxradius = number, if for a given sensor the fitted radius exceeds + this value, the radius and origin will be replaced with the + single sphere fit + baseline = number + feedback = boolean, true or false + + See also FT_PREPARE_HEADMODEL, FT_PREPARE_VOL_SENS, FT_COMPUTE_LEADFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_headmodel_localspheres.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodel_localspheres", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_headmodel_openmeeg.py b/fieldtrip/__forward/ft_headmodel_openmeeg.py new file mode 100644 index 0000000..97c957c --- /dev/null +++ b/fieldtrip/__forward/ft_headmodel_openmeeg.py @@ -0,0 +1,63 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmodel_openmeeg(*args, **kwargs): + """ + FT_HEADMODEL_OPENMEEG creates a volume conduction model of the head using the + boundary element method (BEM). This function takes as input the triangulated + surfaces that describe the boundaries and returns as output a volume conduction + model which can be used to compute leadfields. + + This function implements + Gramfort et al. OpenMEEG: opensource software for quasistatic + bioelectromagnetics. Biomedical engineering online (2010) vol. 9 (1) pp. 45 + http://www.biomedical-engineering-online.com/content/9/1/45 + doi:10.1186/1475-925X-9-45 + and + Kybic et al. Generalized head models for MEG/EEG: boundary element method + beyond nested volumes. Phys. Med. Biol. (2006) vol. 51 pp. 1333-1346 + doi:10.1088/0031-9155/51/5/021 + + This link with FieldTrip is derived from the OpenMEEG project with contributions + from Daniel Wong and Sarang Dalal, and uses external command-line executables. + See http://openmeeg.github.io/ + + Use as + headmodel = ft_headmodel_openmeeg(bnd, ...) + + Optional input arguments should be specified in key-value pairs and can + include + conductivity = vector, conductivity of each compartment + tissue = cell-array with the tissue labels for each compartment + checkmesh = 'yes' or 'no' + + See also FT_PREPARE_VOL_SENS, FT_COMPUTE_LEADFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_headmodel_openmeeg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodel_openmeeg", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_headmodel_simbio.py b/fieldtrip/__forward/ft_headmodel_simbio.py new file mode 100644 index 0000000..4578c46 --- /dev/null +++ b/fieldtrip/__forward/ft_headmodel_simbio.py @@ -0,0 +1,68 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmodel_simbio(*args, **kwargs): + """ + FT_HEADMODEL_SIMBIO creates a volume conduction model of the head + using the finite element method (FEM) for EEG. This function takes + as input a volumetric mesh (hexahedral or tetrahedral) and + returns as output a volume conduction model which can be used to + compute leadfields. + + This implements + ... + + Use as + headmodel = ft_headmodel_simbio(mesh,'conductivity', conductivities, ...) + + The mesh is given as a volumetric mesh, using ft_datatype_parcellation + mesh.pos = vertex positions + mesh.tet/mesh.hex = list of volume elements + mesh.tissue = tissue assignment for elements + mesh.tissuelabel = labels correspondig to tissues + + Required input arguments should be specified in key-value pairs and have + to include + conductivity = vector containing tissue conductivities using ordered + corresponding to mesh.tissuelabel + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + To run this on Windows the following packages are necessary: + + Microsoft Visual C++ 2008 Redistributable + + Intel Visual Fortran Redistributables + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + See also FT_PREPARE_VOL_SENS, FT_COMPUTE_LEADFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_headmodel_simbio.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodel_simbio", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_headmodel_singleshell.py b/fieldtrip/__forward/ft_headmodel_singleshell.py new file mode 100644 index 0000000..ec7a294 --- /dev/null +++ b/fieldtrip/__forward/ft_headmodel_singleshell.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmodel_singleshell(*args, **kwargs): + """ + FT_HEADMODEL_SINGLESHELL creates a volume conduction model of the + head for MEG based on a realistic shaped surface of the inside of + the skull. + + The method implemented in this function allows for a simple and + fast method for the MEG forward calculation for one shell of arbitrary + shape, based on a correction of the lead field for a spherical + volume conductor by a superposition of basis functions, gradients + of harmonic functions constructed from spherical harmonics. + + This function implements + G. Nolte, "The magnetic lead field theorem in the quasi-static + approximation and its use for magnetoencephalography forward calculation + in realistic volume conductors", Phys Med Biol. 2003 Nov 21;48(22):3637-52. + + Use as + headmodel = ft_headmodel_singleshell(mesh, ...) + + Optional input arguments should be specified in key-value pairs and can include + order = number of iterations in series expansion (default = 10) + + See also FT_PREPARE_VOL_SENS, FT_COMPUTE_LEADFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_headmodel_singleshell.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodel_singleshell", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_headmodel_singlesphere.py b/fieldtrip/__forward/ft_headmodel_singlesphere.py new file mode 100644 index 0000000..367a9ae --- /dev/null +++ b/fieldtrip/__forward/ft_headmodel_singlesphere.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmodel_singlesphere(*args, **kwargs): + """ + FT_HEADMODEL_SINGLESPHERE creates a volume conduction model of the + head by fitting a spherical model to a set of points that describe + the head surface. + + For MEG this implements Cuffin BN, Cohen D. "Magnetic fields of a dipole in + special volume conductor shapes" IEEE Trans Biomed Eng. 1977 Jul;24(4):372-81. + + For EEG this implements R. Kavanagh, T. M. Darccey, D. Lehmann, and D. H. Fender. + Evaluation of methods for three-dimensional localization of electric sources in the + human brain. IEEE Trans Biomed Eng, 25:421-429, 1978. + + Use as + headmodel = ft_headmodel_singlesphere(mesh, ...) + + Optional arguments should be specified in key-value pairs and can include + conductivity = number, conductivity of the sphere + + See also FT_PREPARE_VOL_SENS, FT_COMPUTE_LEADFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_headmodel_singlesphere.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodel_singlesphere", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_headmodel_slab.py b/fieldtrip/__forward/ft_headmodel_slab.py new file mode 100644 index 0000000..a5abb10 --- /dev/null +++ b/fieldtrip/__forward/ft_headmodel_slab.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmodel_slab(*args, **kwargs): + """ + FT_HEADMODEL_SLAB creates an EEG volume conduction model that + is described with an infinite conductive slab. You can think + of this as two parallel planes containing a mass of conductive + material (e.g. water) and externally to them a non-conductive material + (e.g. air). + + Use as + headmodel = ft_headmodel_slab(mesh1, mesh2, Pc, varargin) + where + mesh1.pos = Nx3 vector specifying N points through which the 'upper' plane is fitted + mesh2.pos = Nx3 vector specifying N points through which the 'lower' plane is fitted + Pc = 1x3 vector specifying the spatial position of a point lying in the conductive slab + (this determines the plane's normal's direction) + + Optional arguments should be specified in key-value pairs and can include + 'sourcemodel' = 'monopole' + 'conductivity' = number , conductivity value of the conductive halfspace (default = 1) + + See also FT_PREPARE_VOL_SENS, FT_COMPUTE_LEADFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_headmodel_slab.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodel_slab", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_headmodeltype.py b/fieldtrip/__forward/ft_headmodeltype.py new file mode 100644 index 0000000..b3533d6 --- /dev/null +++ b/fieldtrip/__forward/ft_headmodeltype.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmodeltype(*args, **kwargs): + """ + FT_HEADMODELTYPE determines the type of volume conduction model of the head + + Use as + [type] = ft_headmodeltype(headmodel) + to get a string describing the type, or + [flag] = ft_headmodeltype(headmodel, desired) + to get a boolean value. + + For EEG the following volume conduction models are recognized + singlesphere analytical single sphere model + concentricspheres analytical concentric sphere model with up to 4 spheres + halfspace infinite homogenous medium on one side, vacuum on the other + openmeeg boundary element method, based on the OpenMEEG software + bemcp boundary element method, based on the implementation from Christophe Phillips + dipoli boundary element method, based on the implementation from Thom Oostendorp + asa boundary element method, based on the (commercial) ASA software + simbio finite element method, based on the SimBio software + fns finite difference method, based on the FNS software + interpolate interpolate the potential based on pre-computed leadfields + + and for MEG the following volume conduction models are recognized + singlesphere analytical single sphere model + localspheres local spheres model for MEG, one sphere per channel + singleshell realisically shaped single shell approximation, based on the implementation from Guido Nolte + infinite magnetic dipole in an infinite vacuum + interpolate interpolate the potential based on pre-computed leadfields + + See also FT_COMPUTE_LEADFIELD, FT_READ_HEADMODEL, FT_HEADMODEL_BEMCP, + FT_HEADMODEL_ASA, FT_HEADMODEL_DIPOLI, FT_HEADMODEL_SIMBIO, + FT_HEADMODEL_FNS, FT_HEADMODEL_HALFSPACE, FT_HEADMODEL_INFINITE, + FT_HEADMODEL_OPENMEEG, FT_HEADMODEL_SINGLESPHERE, + FT_HEADMODEL_CONCENTRICSPHERES, FT_HEADMODEL_LOCALSPHERES, + FT_HEADMODEL_SINGLESHELL, FT_HEADMODEL_INTERPOLATE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_headmodeltype.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodeltype", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_inside_headmodel.py b/fieldtrip/__forward/ft_inside_headmodel.py new file mode 100644 index 0000000..30d6608 --- /dev/null +++ b/fieldtrip/__forward/ft_inside_headmodel.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def ft_inside_headmodel(*args, **kwargs): + """ + FT_INSIDE_HEADMODEL locates dipole locations inside/outside the source + compartment of a volume conductor model. + + Use as + [inside] = ft_inside_headmodel(dippos, headmodel, ...) + + The input should be + dippos = Nx3 matrix with dipole positions + headmodel = structure with volume conductor model + and the output is + inside = boolean vector indicating for each dipole wether it is inside the source compartment + + Additional optional input arguments should be given in key value pairs and can include + inwardshift = number + grad = structure with gradiometer information, used for localspheres + headshape = structure with headshape, used for old CTF localspheres strategy + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_inside_headmodel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_inside_headmodel", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_prepare_vol_sens.py b/fieldtrip/__forward/ft_prepare_vol_sens.py new file mode 100644 index 0000000..7d2418c --- /dev/null +++ b/fieldtrip/__forward/ft_prepare_vol_sens.py @@ -0,0 +1,69 @@ +from fieldtrip._runtime import Runtime + + +def ft_prepare_vol_sens(*args, **kwargs): + """ + FT_PREPARE_VOL_SENS does some bookkeeping to ensure that the volume conductor model + and the sensor array are ready for subsequent forward leadfield computations and + takes care of some pre-computations to make the calculations more efficient. + + Use as + [headmodel, sens] = ft_prepare_vol_sens(headmodel, sens, ...) + with input arguments + headmodel = structure with volume conductor definition + sens = structure with gradiometer or electrode definition + + The headmodel structure represents a volume conductor model of the head, + its contents depend on the type of model. It is described in more detail + in FT_DATATYPE_HEADMODEL. The sens structure represents a electrode or + gradiometer array. It is described in more detail in FT_DATATYPE_SENS. + + Additional options should be specified in key-value pairs and can be + 'channel' = cell-array with strings (default = 'all') + + The detailed behavior of this function depends on whether the input + consists of EEG or MEG and furthermoree depends on the type of volume + conductor model: + - in case of EEG single and concentric sphere models, the electrodes are + projected onto the skin surface. + - in case of EEG boundary element models, the electrodes are projected on + the surface and a blilinear interpoaltion matrix from vertices to + electrodes is computed. + - in case of MEG and a localspheres model, a local sphere is determined + for each coil in the gradiometer definition. + - in case of MEG with a singleshell Nolte model, the volume conduction + model is initialized + In any case channel selection and reordering will be done. The channel + order returned by this function corresponds to the order in the 'channel' + option, or if not specified, to the order in the input sensor array. + + See also FT_COMPUTE_LEADFIELD, FT_READ_HEADMODEL, FT_READ_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_prepare_vol_sens.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_prepare_vol_sens", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_senslabel.py b/fieldtrip/__forward/ft_senslabel.py new file mode 100644 index 0000000..1ff36d4 --- /dev/null +++ b/fieldtrip/__forward/ft_senslabel.py @@ -0,0 +1,89 @@ +from fieldtrip._runtime import Runtime + + +def ft_senslabel(*args, **kwargs): + """ + FT_SENSLABEL returns a list of predefined sensor labels given the + EEG or MEG system type which can be used to detect the type of data. + + Use as + label = ft_senslabel(type) + + The input sensor array type can be any of the following + 'ant128' + 'biosemi64' + 'biosemi128' + 'biosemi256' + 'bti148' + 'bti148_planar' + 'bti248' + 'bti248_planar' + 'btiref' + 'ctf64' + 'ctf64_planar' + 'ctf151' + 'ctf151_planar' + 'ctf275' + 'ctf275_planar' + 'ctfheadloc' + 'ctfref' + 'eeg1005' + 'eeg1010' + 'eeg1020' + 'ext1020' + 'egi32' + 'egi64' + 'egi128' + 'egi256' + 'neuromag122' + 'neuromag122_planar' + 'neuromag306' + 'neuromag306_planar' + 'itab28' + 'itab153' + 'itab153_planar' + 'yokogawa9' + 'yokogawa64' + 'yokogawa64_planar' + 'yokogawa160' + 'yokogawa160_planar' + 'yokogawa208' + 'yokogawa208_planar' + 'yokogawa440' + 'yokogawa440_planar' + + It is also possible to specify + 'eeg' + 'electrode' + although for these an empty set of labels (i.e. {}) will be returned. + + See also FT_SENSTYPE, FT_CHANNELSELECTION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_senslabel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_senslabel", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_senstype.py b/fieldtrip/__forward/ft_senstype.py new file mode 100644 index 0000000..563a125 --- /dev/null +++ b/fieldtrip/__forward/ft_senstype.py @@ -0,0 +1,132 @@ +from fieldtrip._runtime import Runtime + + +def ft_senstype(*args, **kwargs): + """ + FT_SENSTYPE determines the type of acquisition device by looking at the channel + names and comparing them with predefined lists. + + Use as + [type] = ft_senstype(sens) + or + [flag] = ft_senstype(sens, desired) + + The output type can be any of the following + 'ctf64' + 'ctf151' + 'ctf151_planar' + 'ctf275' + 'ctf275_planar' + 'bti148' + 'bti148_planar' + 'bti248' + 'bti248_planar' + 'bti248grad' + 'bti248grad_planar' + 'itab28' + 'itab153' + 'itab153_planar' + 'yokogawa9' + 'yokogawa64' + 'yokogawa64_planar' + 'yokogawa160' + 'yokogawa160_planar' + 'yokogawa208' + 'yokogawa208_planar' + 'yokogawa440' + 'neuromag122' + 'neuromag122_combined' + 'neuromag306' + 'neuromag306_combined' + 'babysquid74' this is a BabySQUID system from Tristan Technologies + 'artemis123' this is a BabySQUID system from Tristan Technologies + 'magview' this is a BabySQUID system from Tristan Technologies + 'fieldline_v2' + 'fieldline_v3' + 'egi32' + 'egi64' + 'egi128' + 'egi256' + 'biosemi64' + 'biosemi128' + 'biosemi256' + 'ant128' + 'neuralynx' + 'plexon' + 'artinis' + 'nirx' + 'shimadzu' + 'hitachi' + 'nirs' + 'meg' + 'eeg' + 'ieeg' + 'seeg' + 'ecog' + 'eeg1020' + 'eeg1010' + 'eeg1005' + 'ext1020' in case it is a small subset of eeg1020, eeg1010 or eeg1005 + 'nex5' + + The optional input argument for the desired type can be any of the above, or any of + the following generic classes of acquisition systems + 'eeg' + 'ieeg' + 'ext1020' + 'ant' + 'biosemi' + 'egi' + 'meg' + 'meg_planar' + 'meg_axial' + 'ctf' + 'bti' + 'neuromag' + 'yokogawa' + 'itab' + 'babysquid' + 'fieldline' + If you specify the desired type, this function will return a boolean flag + indicating true/false depending on the input data. + + Besides specifying a sensor definition (i.e. a grad or elec structure, see + FT_DATATYPE_SENS), it is also possible to give a data structure containing a grad + or elec field, or giving a list of channel names (as cell-arrray). So assuming that + you have a FieldTrip data structure, any of the following calls would also be fine. + ft_senstype(hdr) + ft_senstype(data) + ft_senstype(data.label) + ft_senstype(data.grad) + ft_senstype(data.grad.label) + + See also FT_SENSLABEL, FT_CHANTYPE, FT_READ_SENS, FT_COMPUTE_LEADFIELD, FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_senstype.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_senstype", *args, **kwargs) diff --git a/fieldtrip/__forward/ft_sourcedepth.py b/fieldtrip/__forward/ft_sourcedepth.py new file mode 100644 index 0000000..b88d5ac --- /dev/null +++ b/fieldtrip/__forward/ft_sourcedepth.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def ft_sourcedepth(*args, **kwargs): + """ + FT_SOURCEDEPTH computes the distance from the source to the surface of + the source compartment (usually the brain) in the volume conduction model. + + Use as + depth = ft_sourcedepth(dippos, headmodel); + where + dippos = Nx3 matrix with the position of N sources + headmodel = structure describing volume condition model + + A negative depth indicates that the source is inside the source + compartment, positive indicates outside. + + See also FT_INSIDE_HEADMODEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/forward/ft_sourcedepth.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_sourcedepth", *args, **kwargs) diff --git a/fieldtrip/__init__.py b/fieldtrip/__init__.py new file mode 100644 index 0000000..1676320 --- /dev/null +++ b/fieldtrip/__init__.py @@ -0,0 +1,1162 @@ +from mpython import ( + MatlabClass, + MatlabFunction, + Cell, + Struct, + Array, + SparseArray, +) +from fieldtrip._runtime import Runtime +from fieldtrip._version import __version__ + +from .besa2fieldtrip import besa2fieldtrip +from .bis2fieldtrip import bis2fieldtrip +from .__connectivity import ( + ft_connectivity_cancorr, + ft_connectivity_corr, + ft_connectivity_csd2transfer, + ft_connectivity_dtf, + ft_connectivity_granger, + ft_connectivity_mim, + ft_connectivity_mutualinformation, + ft_connectivity_pdc, + ft_connectivity_plm, + ft_connectivity_powcorr_ortho, + ft_connectivity_ppc, + ft_connectivity_psi, + ft_connectivity_wpli, +) +from .__contrib import ( + ft_icabrowser, + ft_laggedcoherence, + ft_nonlinearassociation, + nmt_addtopo, + nmt_animate, + nmt_close, + nmt_image, + nmt_mni2mri, + nmt_mri2mni, + nmt_peaksearch, + nmt_peaksearch_helper, + nmt_polaritytweak, + nmt_reducerank, + nmt_repos, + nmt_sourceoriplot, + nmt_sourceplot, + nmt_spm_plot, + nmt_spm_write_deformationinv, + nmt_spmfig_setup, + nmt_svdtrunc, + nmt_svdtruncinv, + nmt_tbxdti_quiver3, + nmt_timeselect, + nmt_transform_coord, + spm_ov_quivernmt, + ft_spike_isi, + ft_spike_jpsth, + ft_spike_maketrials, + ft_spike_plot_isi, + ft_spike_plot_isireturn, + ft_spike_plot_jpsth, + ft_spike_plot_psth, + ft_spike_plot_raster, + ft_spike_psth, + ft_spike_rate, + ft_spike_rate_orituning, + ft_spike_select, + ft_spike_waveform, + ft_spike_xcorr, + ft_spikedensity, + ft_spikedetection, + ft_spikedownsample, + ft_spikefixdmafile, + ft_spikesimulation, + ft_spikesorting, + ft_spikesplitting, + ft_spiketriggeredaverage, + ft_spiketriggeredinterpolation, + ft_spiketriggeredspectrum, + ft_spiketriggeredspectrum_convol, + ft_spiketriggeredspectrum_fft, + ft_spiketriggeredspectrum_stat, +) +from .data2bids import data2bids +from .edf2fieldtrip import edf2fieldtrip +from .fieldtrip2besa import fieldtrip2besa +from .fieldtrip2bis import fieldtrip2bis +from .fieldtrip2ctf import fieldtrip2ctf +from .fieldtrip2fiff import fieldtrip2fiff +from .fieldtrip2homer import fieldtrip2homer +from .fieldtrip2spss import fieldtrip2spss +from .__fileio import ( + ft_chantype, + ft_chanunit, + ft_create_buffer, + ft_destroy_buffer, + ft_filetype, + ft_filter_event, + ft_flush_data, + ft_flush_event, + ft_flush_header, + ft_poll_buffer, + ft_read_atlas, + ft_read_cifti, + ft_read_data, + ft_read_event, + ft_read_header, + ft_read_headmodel, + ft_read_headshape, + ft_read_json, + ft_read_mri, + ft_read_sens, + ft_read_spike, + ft_read_tsv, + ft_read_vol, + ft_write_cifti, + ft_write_data, + ft_write_event, + ft_write_headshape, + ft_write_json, + ft_write_mri, + ft_write_sens, + ft_write_spike, + ft_write_tsv, +) +from .__forward import ( + ft_compute_leadfield, + ft_convert_units, + ft_determine_units, + ft_estimate_units, + ft_headmodel_asa, + ft_headmodel_bemcp, + ft_headmodel_concentricspheres, + ft_headmodel_dipoli, + ft_headmodel_duneuro, + ft_headmodel_fns, + ft_headmodel_halfspace, + ft_headmodel_hbf, + ft_headmodel_infinite, + ft_headmodel_interpolate, + ft_headmodel_localspheres, + ft_headmodel_openmeeg, + ft_headmodel_simbio, + ft_headmodel_singleshell, + ft_headmodel_singlesphere, + ft_headmodel_slab, + ft_headmodeltype, + ft_inside_headmodel, + ft_prepare_vol_sens, + ft_senslabel, + ft_senstype, + ft_sourcedepth, +) +from .ft_analysispipeline import ft_analysispipeline +from .ft_annotate import ft_annotate +from .ft_anonymizedata import ft_anonymizedata +from .ft_appenddata import ft_appenddata +from .ft_appendfreq import ft_appendfreq +from .ft_appendlayout import ft_appendlayout +from .ft_appendsens import ft_appendsens +from .ft_appendsource import ft_appendsource +from .ft_appendspike import ft_appendspike +from .ft_appendtimelock import ft_appendtimelock +from .ft_artifact_clip import ft_artifact_clip +from .ft_artifact_ecg import ft_artifact_ecg +from .ft_artifact_eog import ft_artifact_eog +from .ft_artifact_jump import ft_artifact_jump +from .ft_artifact_muscle import ft_artifact_muscle +from .ft_artifact_nan import ft_artifact_nan +from .ft_artifact_threshold import ft_artifact_threshold +from .ft_artifact_tms import ft_artifact_tms +from .ft_artifact_zvalue import ft_artifact_zvalue +from .ft_audiovideobrowser import ft_audiovideobrowser +from .ft_badchannel import ft_badchannel +from .ft_baddata import ft_baddata +from .ft_badsegment import ft_badsegment +from .ft_channelnormalise import ft_channelnormalise +from .ft_channelrepair import ft_channelrepair +from .ft_clusterplot import ft_clusterplot +from .ft_combineplanar import ft_combineplanar +from .ft_componentanalysis import ft_componentanalysis +from .ft_conjunctionanalysis import ft_conjunctionanalysis +from .ft_connectivityanalysis import ft_connectivityanalysis +from .ft_connectivityplot import ft_connectivityplot +from .ft_connectivitysimulation import ft_connectivitysimulation +from .ft_crossfrequencyanalysis import ft_crossfrequencyanalysis +from .ft_databrowser import ft_databrowser +from .ft_defacemesh import ft_defacemesh +from .ft_defacevolume import ft_defacevolume +from .ft_defaults import ft_defaults +from .ft_definetrial import ft_definetrial +from .ft_denoise_amm import ft_denoise_amm +from .ft_denoise_dssp import ft_denoise_dssp +from .ft_denoise_hfc import ft_denoise_hfc +from .ft_denoise_pca import ft_denoise_pca +from .ft_denoise_prewhiten import ft_denoise_prewhiten +from .ft_denoise_ssp import ft_denoise_ssp +from .ft_denoise_sss import ft_denoise_sss +from .ft_denoise_synthetic import ft_denoise_synthetic +from .ft_denoise_tsr import ft_denoise_tsr +from .ft_detect_movement import ft_detect_movement +from .ft_dipolefitting import ft_dipolefitting +from .ft_dipolesimulation import ft_dipolesimulation +from .ft_electrodeplacement import ft_electrodeplacement +from .ft_electroderealign import ft_electroderealign +from .ft_electrodermalactivity import ft_electrodermalactivity +from .ft_eventtiminganalysis import ft_eventtiminganalysis +from .ft_examplefunction import ft_examplefunction +from .ft_freqanalysis import ft_freqanalysis +from .ft_freqanalysis_mvar import ft_freqanalysis_mvar +from .ft_freqbaseline import ft_freqbaseline +from .ft_freqdescriptives import ft_freqdescriptives +from .ft_freqgrandaverage import ft_freqgrandaverage +from .ft_freqinterpolate import ft_freqinterpolate +from .ft_freqsimulation import ft_freqsimulation +from .ft_freqstatistics import ft_freqstatistics +from .ft_geometryplot import ft_geometryplot +from .ft_globalmeanfield import ft_globalmeanfield +from .ft_headcircumference import ft_headcircumference +from .ft_headmovement import ft_headmovement +from .ft_heartrate import ft_heartrate +from .ft_interactiverealign import ft_interactiverealign +from .ft_interpolatenan import ft_interpolatenan +from .ft_lateralizedpotential import ft_lateralizedpotential +from .ft_layoutplot import ft_layoutplot +from .ft_math import ft_math +from .ft_megplanar import ft_megplanar +from .ft_megrealign import ft_megrealign +from .ft_meshrealign import ft_meshrealign +from .ft_movieplotER import ft_movieplotER +from .ft_movieplotTFR import ft_movieplotTFR +from .ft_multiplotCC import ft_multiplotCC +from .ft_multiplotER import ft_multiplotER +from .ft_multiplotTFR import ft_multiplotTFR +from .ft_mvaranalysis import ft_mvaranalysis +from .ft_neighbourplot import ft_neighbourplot +from .ft_networkanalysis import ft_networkanalysis +from .ft_prepare_headmodel import ft_prepare_headmodel +from .ft_prepare_layout import ft_prepare_layout +from .ft_prepare_leadfield import ft_prepare_leadfield +from .ft_prepare_mesh import ft_prepare_mesh +from .ft_prepare_montage import ft_prepare_montage +from .ft_prepare_neighbours import ft_prepare_neighbours +from .ft_prepare_sourcemodel import ft_prepare_sourcemodel +from .ft_preprocessing import ft_preprocessing +from .ft_recodeevent import ft_recodeevent +from .ft_redefinetrial import ft_redefinetrial +from .ft_regressconfound import ft_regressconfound +from .ft_rejectartifact import ft_rejectartifact +from .ft_rejectcomponent import ft_rejectcomponent +from .ft_rejectvisual import ft_rejectvisual +from .ft_removetemplateartifact import ft_removetemplateartifact +from .ft_reproducescript import ft_reproducescript +from .ft_resampledata import ft_resampledata +from .ft_respiration import ft_respiration +from .ft_scalpcurrentdensity import ft_scalpcurrentdensity +from .ft_singleplotER import ft_singleplotER +from .ft_singleplotTFR import ft_singleplotTFR +from .ft_sliceinterp import ft_sliceinterp +from .ft_sourceanalysis import ft_sourceanalysis +from .ft_sourcedescriptives import ft_sourcedescriptives +from .ft_sourcegrandaverage import ft_sourcegrandaverage +from .ft_sourceinterpolate import ft_sourceinterpolate +from .ft_sourcemovie import ft_sourcemovie +from .ft_sourceparcellate import ft_sourceparcellate +from .ft_sourceplot import ft_sourceplot +from .ft_sourceplot_interactive import ft_sourceplot_interactive +from .ft_sourcestatistics import ft_sourcestatistics +from .ft_sourcewrite import ft_sourcewrite +from .ft_statistics_analytic import ft_statistics_analytic +from .ft_statistics_crossvalidate import ft_statistics_crossvalidate +from .ft_statistics_montecarlo import ft_statistics_montecarlo +from .ft_statistics_mvpa import ft_statistics_mvpa +from .ft_statistics_stats import ft_statistics_stats +from .ft_steadystatesimulation import ft_steadystatesimulation +from .ft_stratify import ft_stratify +from .ft_timelockanalysis import ft_timelockanalysis +from .ft_timelockbaseline import ft_timelockbaseline +from .ft_timelockgrandaverage import ft_timelockgrandaverage +from .ft_timelocksimulation import ft_timelocksimulation +from .ft_timelockstatistics import ft_timelockstatistics +from .ft_topoplotCC import ft_topoplotCC +from .ft_topoplotER import ft_topoplotER +from .ft_topoplotIC import ft_topoplotIC +from .ft_topoplotTFR import ft_topoplotTFR +from .ft_virtualchannel import ft_virtualchannel +from .ft_volumebiascorrect import ft_volumebiascorrect +from .ft_volumedownsample import ft_volumedownsample +from .ft_volumelookup import ft_volumelookup +from .ft_volumenormalise import ft_volumenormalise +from .ft_volumerealign import ft_volumerealign +from .ft_volumereslice import ft_volumereslice +from .ft_volumesegment import ft_volumesegment +from .ft_volumewrite import ft_volumewrite +from .ft_wizard import ft_wizard +from .homer2fieldtrip import homer2fieldtrip +from .imotions2fieldtrip import imotions2fieldtrip +from .__inverse import ( + ft_inverse_dics, + ft_inverse_dipolefit, + ft_inverse_eloreta, + ft_inverse_harmony, + ft_inverse_lcmv, + ft_inverse_mne, + ft_inverse_music, + ft_inverse_pcc, + ft_inverse_rv, + ft_inverse_sam, + ft_inverse_sloreta, +) +from .loreta2fieldtrip import loreta2fieldtrip +from .nutmeg2fieldtrip import nutmeg2fieldtrip +from .__plotting import ( + ft_colormap, + ft_headlight, + ft_plot_axes, + ft_plot_box, + ft_plot_cloud, + ft_plot_crosshair, + ft_plot_dipole, + ft_plot_headmodel, + ft_plot_headshape, + ft_plot_layout, + ft_plot_line, + ft_plot_matrix, + ft_plot_mesh, + ft_plot_montage, + ft_plot_ortho, + ft_plot_patch, + ft_plot_sens, + ft_plot_slice, + ft_plot_text, + ft_plot_topo, + ft_plot_topo3d, + ft_plot_vector, + ft_select_box, + ft_select_channel, + ft_select_point, + ft_select_point3d, + ft_select_range, + ft_select_voxel, + ft_uilayout, +) +from .__preproc import ( + ft_preproc_bandpassfilter, + ft_preproc_bandstopfilter, + ft_preproc_baselinecorrect, + ft_preproc_denoise, + ft_preproc_derivative, + ft_preproc_detrend, + ft_preproc_dftfilter, + ft_preproc_highpassfilter, + ft_preproc_hilbert, + ft_preproc_lowpassfilter, + ft_preproc_medianfilter, + ft_preproc_online_downsample_apply, + ft_preproc_online_downsample_init, + ft_preproc_online_filter_apply, + ft_preproc_online_filter_init, + ft_preproc_padding, + ft_preproc_polyremoval, + ft_preproc_rectify, + ft_preproc_rereference, + ft_preproc_resample, + ft_preproc_slidingrange, + ft_preproc_smooth, + ft_preproc_standardize, +) +from .__qsub import qsubcellfun, qsubcompile, qsubexec, qsubfeval, qsubget, qsublist +from .__realtime import ( + bcifun_latidx, + ft_realtime_asaproxy, + ft_realtime_asynchronous, + ft_realtime_average, + ft_realtime_benchmark, + ft_realtime_brainampproxy, + ft_realtime_classification, + ft_realtime_ctfproxy, + ft_realtime_dicomproxy, + ft_realtime_downsample, + ft_realtime_fileproxy, + ft_realtime_fmriproxy, + ft_realtime_fmriviewer, + ft_realtime_heartbeatdetect, + ft_realtime_jaga16proxy, + ft_realtime_modeegproxy, + ft_realtime_neuralynxproxy, + ft_realtime_packettimer, + ft_realtime_pooraudioproxy, + ft_realtime_powerestimate, + ft_realtime_selectiveaverage, + ft_realtime_sensysproxy, + ft_realtime_signalproxy, + ft_realtime_signalrecorder, + ft_realtime_signalviewer, + ft_realtime_synchronous, + ft_realtime_topography, + ft_realtime_unicornproxy, + ft_realtime_oddball, + ft_realtime_ouunpod, + ft_realtime_coillocalizer, + ft_realtime_headlocalizer, + ft_omri_align_init, + ft_omri_align_scan, + ft_omri_info_from_header, + ft_omri_pipeline, + ft_omri_pipeline_nuisance, + ft_omri_quality, + ft_omri_quality_plot, + ft_omri_slice_time_apply, + ft_omri_slice_time_init, + ft_omri_smoothing_kernel, + ft_omri_volume_to_mosaic, + replay_dicoms, + buffer, + compile_buffer, +) +from .spass2fieldtrip import spass2fieldtrip +from .__specest import ( + ft_specest_hilbert, + ft_specest_irasa, + ft_specest_mtmconvol, + ft_specest_mtmfft, + ft_specest_neuvar, + ft_specest_tfr, + ft_specest_wavelet, +) +from .spm2fieldtrip import spm2fieldtrip +from .__src import ( + det2x2, + det3x3, + getpid, + inv2x2, + inv3x3, + lmoutr, + ltrisect, + meg_leadfield1, + mtimes2x2, + mtimes3x3, + mxDeserialize, + mxSerialize, + nanvar, + plgndr, + plinproj, + ptriproj, + read_16bit, + read_24bit, + read_ctf_shm, + rfbevent, + routlm, + sandwich2x2, + sandwich3x3, + solid_angle, + splint_gh, + write_ctf_shm, +) +from .__statfun import ( + ft_statfun_actvsblT, + ft_statfun_bayesfactor, + ft_statfun_cohensd, + ft_statfun_correlationT, + ft_statfun_depsamplesFmultivariate, + ft_statfun_depsamplesFunivariate, + ft_statfun_depsamplesT, + ft_statfun_depsamplesregrT, + ft_statfun_diff, + ft_statfun_diff_itc, + ft_statfun_gcmi, + ft_statfun_indepsamplesF, + ft_statfun_indepsamplesT, + ft_statfun_indepsamplesZcoh, + ft_statfun_indepsamplesregrT, + ft_statfun_mean, + ft_statfun_pooledT, + ft_statfun_roc, +) +from .__trialfun import ( + ft_trialfun_balert, + ft_trialfun_bids, + ft_trialfun_brainvision_segmented, + ft_trialfun_edf, + ft_trialfun_emgdetect, + ft_trialfun_example1, + ft_trialfun_example2, + ft_trialfun_general, + ft_trialfun_gui, + ft_trialfun_hed, + ft_trialfun_imotions, + ft_trialfun_neuromagSTI016fix, + ft_trialfun_realtime, + ft_trialfun_show, + ft_trialfun_trial, + ft_trialfun_twoclass_classification, +) +from .__utilities import ( + appendstruct, + copyfields, + dccnpath, + ft_affinecoordinates, + ft_apply_montage, + ft_average_sens, + ft_cfg2keyval, + ft_channelcombination, + ft_channelselection, + ft_checkconfig, + ft_checkdata, + ft_checkopt, + ft_compile_mex, + ft_compile_standalone, + ft_convert_coordsys, + ft_datatype, + ft_datatype_comp, + ft_datatype_dip, + ft_datatype_freq, + ft_datatype_headmodel, + ft_datatype_mvar, + ft_datatype_parcellation, + ft_datatype_raw, + ft_datatype_segmentation, + ft_datatype_sens, + ft_datatype_source, + ft_datatype_spike, + ft_datatype_timelock, + ft_datatype_volume, + ft_debug, + ft_determine_coordsys, + ft_documentationconfiguration, + ft_documentationreference, + ft_error, + ft_fetch_data, + ft_fetch_event, + ft_fetch_header, + ft_findcfg, + ft_getopt, + ft_hash, + ft_hastoolbox, + ft_headcoordinates, + ft_info, + ft_inverse_montage, + ft_keyval2cfg, + ft_notice, + ft_platform_supports, + ft_postamble, + ft_preamble, + ft_progress, + ft_save_workspace, + ft_scalingfactor, + ft_selectdata, + ft_setopt, + ft_source2full, + ft_source2grid, + ft_source2sparse, + ft_standalone, + ft_struct2char, + ft_struct2double, + ft_struct2single, + ft_struct2string, + ft_test, + ft_trackusage, + ft_transform_geometry, + ft_transform_headmodel, + ft_transform_headshape, + ft_transform_sens, + ft_transform_vol, + ft_version, + ft_warning, + ft_warp_apply, + ft_warp_error, + ft_warp_optim, + getsubfield, + hasyokogawa, + issubfield, + istrue, + keepfields, + keyval, + keyvalcheck, + markdown2matlab, + match_str, + match_val, + matlab2markdown, + memtic, + memtoc, + nearest, + printstruct, + removefields, + renamefields, + rmsubfield, + setsubfield, + strel_bol, + tokenize, +) +from .xdf2fieldtrip import xdf2fieldtrip + + +__all__ = [ + "__version__", + "Runtime", + "MatlabClass", + "MatlabFunction", + "Cell", + "Struct", + "Array", + "SparseArray", + "besa2fieldtrip", + "bis2fieldtrip", + "ft_connectivity_cancorr", + "ft_connectivity_corr", + "ft_connectivity_csd2transfer", + "ft_connectivity_dtf", + "ft_connectivity_granger", + "ft_connectivity_mim", + "ft_connectivity_mutualinformation", + "ft_connectivity_pdc", + "ft_connectivity_plm", + "ft_connectivity_powcorr_ortho", + "ft_connectivity_ppc", + "ft_connectivity_psi", + "ft_connectivity_wpli", + "ft_icabrowser", + "ft_laggedcoherence", + "ft_nonlinearassociation", + "nmt_addtopo", + "nmt_animate", + "nmt_close", + "nmt_image", + "nmt_mni2mri", + "nmt_mri2mni", + "nmt_peaksearch", + "nmt_peaksearch_helper", + "nmt_polaritytweak", + "nmt_reducerank", + "nmt_repos", + "nmt_sourceoriplot", + "nmt_sourceplot", + "nmt_spm_plot", + "nmt_spm_write_deformationinv", + "nmt_spmfig_setup", + "nmt_svdtrunc", + "nmt_svdtruncinv", + "nmt_tbxdti_quiver3", + "nmt_timeselect", + "nmt_transform_coord", + "spm_ov_quivernmt", + "ft_spike_isi", + "ft_spike_jpsth", + "ft_spike_maketrials", + "ft_spike_plot_isi", + "ft_spike_plot_isireturn", + "ft_spike_plot_jpsth", + "ft_spike_plot_psth", + "ft_spike_plot_raster", + "ft_spike_psth", + "ft_spike_rate", + "ft_spike_rate_orituning", + "ft_spike_select", + "ft_spike_waveform", + "ft_spike_xcorr", + "ft_spikedensity", + "ft_spikedetection", + "ft_spikedownsample", + "ft_spikefixdmafile", + "ft_spikesimulation", + "ft_spikesorting", + "ft_spikesplitting", + "ft_spiketriggeredaverage", + "ft_spiketriggeredinterpolation", + "ft_spiketriggeredspectrum", + "ft_spiketriggeredspectrum_convol", + "ft_spiketriggeredspectrum_fft", + "ft_spiketriggeredspectrum_stat", + "data2bids", + "edf2fieldtrip", + "fieldtrip2besa", + "fieldtrip2bis", + "fieldtrip2ctf", + "fieldtrip2fiff", + "fieldtrip2homer", + "fieldtrip2spss", + "ft_chantype", + "ft_chanunit", + "ft_create_buffer", + "ft_destroy_buffer", + "ft_filetype", + "ft_filter_event", + "ft_flush_data", + "ft_flush_event", + "ft_flush_header", + "ft_poll_buffer", + "ft_read_atlas", + "ft_read_cifti", + "ft_read_data", + "ft_read_event", + "ft_read_header", + "ft_read_headmodel", + "ft_read_headshape", + "ft_read_json", + "ft_read_mri", + "ft_read_sens", + "ft_read_spike", + "ft_read_tsv", + "ft_read_vol", + "ft_write_cifti", + "ft_write_data", + "ft_write_event", + "ft_write_headshape", + "ft_write_json", + "ft_write_mri", + "ft_write_sens", + "ft_write_spike", + "ft_write_tsv", + "ft_compute_leadfield", + "ft_convert_units", + "ft_determine_units", + "ft_estimate_units", + "ft_headmodel_asa", + "ft_headmodel_bemcp", + "ft_headmodel_concentricspheres", + "ft_headmodel_dipoli", + "ft_headmodel_duneuro", + "ft_headmodel_fns", + "ft_headmodel_halfspace", + "ft_headmodel_hbf", + "ft_headmodel_infinite", + "ft_headmodel_interpolate", + "ft_headmodel_localspheres", + "ft_headmodel_openmeeg", + "ft_headmodel_simbio", + "ft_headmodel_singleshell", + "ft_headmodel_singlesphere", + "ft_headmodel_slab", + "ft_headmodeltype", + "ft_inside_headmodel", + "ft_prepare_vol_sens", + "ft_senslabel", + "ft_senstype", + "ft_sourcedepth", + "ft_analysispipeline", + "ft_annotate", + "ft_anonymizedata", + "ft_appenddata", + "ft_appendfreq", + "ft_appendlayout", + "ft_appendsens", + "ft_appendsource", + "ft_appendspike", + "ft_appendtimelock", + "ft_artifact_clip", + "ft_artifact_ecg", + "ft_artifact_eog", + "ft_artifact_jump", + "ft_artifact_muscle", + "ft_artifact_nan", + "ft_artifact_threshold", + "ft_artifact_tms", + "ft_artifact_zvalue", + "ft_audiovideobrowser", + "ft_badchannel", + "ft_baddata", + "ft_badsegment", + "ft_channelnormalise", + "ft_channelrepair", + "ft_clusterplot", + "ft_combineplanar", + "ft_componentanalysis", + "ft_conjunctionanalysis", + "ft_connectivityanalysis", + "ft_connectivityplot", + "ft_connectivitysimulation", + "ft_crossfrequencyanalysis", + "ft_databrowser", + "ft_defacemesh", + "ft_defacevolume", + "ft_defaults", + "ft_definetrial", + "ft_denoise_amm", + "ft_denoise_dssp", + "ft_denoise_hfc", + "ft_denoise_pca", + "ft_denoise_prewhiten", + "ft_denoise_ssp", + "ft_denoise_sss", + "ft_denoise_synthetic", + "ft_denoise_tsr", + "ft_detect_movement", + "ft_dipolefitting", + "ft_dipolesimulation", + "ft_electrodeplacement", + "ft_electroderealign", + "ft_electrodermalactivity", + "ft_eventtiminganalysis", + "ft_examplefunction", + "ft_freqanalysis", + "ft_freqanalysis_mvar", + "ft_freqbaseline", + "ft_freqdescriptives", + "ft_freqgrandaverage", + "ft_freqinterpolate", + "ft_freqsimulation", + "ft_freqstatistics", + "ft_geometryplot", + "ft_globalmeanfield", + "ft_headcircumference", + "ft_headmovement", + "ft_heartrate", + "ft_interactiverealign", + "ft_interpolatenan", + "ft_lateralizedpotential", + "ft_layoutplot", + "ft_math", + "ft_megplanar", + "ft_megrealign", + "ft_meshrealign", + "ft_movieplotER", + "ft_movieplotTFR", + "ft_multiplotCC", + "ft_multiplotER", + "ft_multiplotTFR", + "ft_mvaranalysis", + "ft_neighbourplot", + "ft_networkanalysis", + "ft_prepare_headmodel", + "ft_prepare_layout", + "ft_prepare_leadfield", + "ft_prepare_mesh", + "ft_prepare_montage", + "ft_prepare_neighbours", + "ft_prepare_sourcemodel", + "ft_preprocessing", + "ft_recodeevent", + "ft_redefinetrial", + "ft_regressconfound", + "ft_rejectartifact", + "ft_rejectcomponent", + "ft_rejectvisual", + "ft_removetemplateartifact", + "ft_reproducescript", + "ft_resampledata", + "ft_respiration", + "ft_scalpcurrentdensity", + "ft_singleplotER", + "ft_singleplotTFR", + "ft_sliceinterp", + "ft_sourceanalysis", + "ft_sourcedescriptives", + "ft_sourcegrandaverage", + "ft_sourceinterpolate", + "ft_sourcemovie", + "ft_sourceparcellate", + "ft_sourceplot", + "ft_sourceplot_interactive", + "ft_sourcestatistics", + "ft_sourcewrite", + "ft_statistics_analytic", + "ft_statistics_crossvalidate", + "ft_statistics_montecarlo", + "ft_statistics_mvpa", + "ft_statistics_stats", + "ft_steadystatesimulation", + "ft_stratify", + "ft_timelockanalysis", + "ft_timelockbaseline", + "ft_timelockgrandaverage", + "ft_timelocksimulation", + "ft_timelockstatistics", + "ft_topoplotCC", + "ft_topoplotER", + "ft_topoplotIC", + "ft_topoplotTFR", + "ft_virtualchannel", + "ft_volumebiascorrect", + "ft_volumedownsample", + "ft_volumelookup", + "ft_volumenormalise", + "ft_volumerealign", + "ft_volumereslice", + "ft_volumesegment", + "ft_volumewrite", + "ft_wizard", + "homer2fieldtrip", + "imotions2fieldtrip", + "ft_inverse_dics", + "ft_inverse_dipolefit", + "ft_inverse_eloreta", + "ft_inverse_harmony", + "ft_inverse_lcmv", + "ft_inverse_mne", + "ft_inverse_music", + "ft_inverse_pcc", + "ft_inverse_rv", + "ft_inverse_sam", + "ft_inverse_sloreta", + "loreta2fieldtrip", + "nutmeg2fieldtrip", + "ft_colormap", + "ft_headlight", + "ft_plot_axes", + "ft_plot_box", + "ft_plot_cloud", + "ft_plot_crosshair", + "ft_plot_dipole", + "ft_plot_headmodel", + "ft_plot_headshape", + "ft_plot_layout", + "ft_plot_line", + "ft_plot_matrix", + "ft_plot_mesh", + "ft_plot_montage", + "ft_plot_ortho", + "ft_plot_patch", + "ft_plot_sens", + "ft_plot_slice", + "ft_plot_text", + "ft_plot_topo", + "ft_plot_topo3d", + "ft_plot_vector", + "ft_select_box", + "ft_select_channel", + "ft_select_point", + "ft_select_point3d", + "ft_select_range", + "ft_select_voxel", + "ft_uilayout", + "ft_preproc_bandpassfilter", + "ft_preproc_bandstopfilter", + "ft_preproc_baselinecorrect", + "ft_preproc_denoise", + "ft_preproc_derivative", + "ft_preproc_detrend", + "ft_preproc_dftfilter", + "ft_preproc_highpassfilter", + "ft_preproc_hilbert", + "ft_preproc_lowpassfilter", + "ft_preproc_medianfilter", + "ft_preproc_online_downsample_apply", + "ft_preproc_online_downsample_init", + "ft_preproc_online_filter_apply", + "ft_preproc_online_filter_init", + "ft_preproc_padding", + "ft_preproc_polyremoval", + "ft_preproc_rectify", + "ft_preproc_rereference", + "ft_preproc_resample", + "ft_preproc_slidingrange", + "ft_preproc_smooth", + "ft_preproc_standardize", + "qsubcellfun", + "qsubcompile", + "qsubexec", + "qsubfeval", + "qsubget", + "qsublist", + "bcifun_latidx", + "ft_realtime_asaproxy", + "ft_realtime_asynchronous", + "ft_realtime_average", + "ft_realtime_benchmark", + "ft_realtime_brainampproxy", + "ft_realtime_classification", + "ft_realtime_ctfproxy", + "ft_realtime_dicomproxy", + "ft_realtime_downsample", + "ft_realtime_fileproxy", + "ft_realtime_fmriproxy", + "ft_realtime_fmriviewer", + "ft_realtime_heartbeatdetect", + "ft_realtime_jaga16proxy", + "ft_realtime_modeegproxy", + "ft_realtime_neuralynxproxy", + "ft_realtime_packettimer", + "ft_realtime_pooraudioproxy", + "ft_realtime_powerestimate", + "ft_realtime_selectiveaverage", + "ft_realtime_sensysproxy", + "ft_realtime_signalproxy", + "ft_realtime_signalrecorder", + "ft_realtime_signalviewer", + "ft_realtime_synchronous", + "ft_realtime_topography", + "ft_realtime_unicornproxy", + "ft_realtime_oddball", + "ft_realtime_ouunpod", + "ft_realtime_coillocalizer", + "ft_realtime_headlocalizer", + "ft_omri_align_init", + "ft_omri_align_scan", + "ft_omri_info_from_header", + "ft_omri_pipeline", + "ft_omri_pipeline_nuisance", + "ft_omri_quality", + "ft_omri_quality_plot", + "ft_omri_slice_time_apply", + "ft_omri_slice_time_init", + "ft_omri_smoothing_kernel", + "ft_omri_volume_to_mosaic", + "replay_dicoms", + "buffer", + "compile_buffer", + "spass2fieldtrip", + "ft_specest_hilbert", + "ft_specest_irasa", + "ft_specest_mtmconvol", + "ft_specest_mtmfft", + "ft_specest_neuvar", + "ft_specest_tfr", + "ft_specest_wavelet", + "spm2fieldtrip", + "det2x2", + "det3x3", + "getpid", + "inv2x2", + "inv3x3", + "lmoutr", + "ltrisect", + "meg_leadfield1", + "mtimes2x2", + "mtimes3x3", + "mxDeserialize", + "mxSerialize", + "nanvar", + "plgndr", + "plinproj", + "ptriproj", + "read_16bit", + "read_24bit", + "read_ctf_shm", + "rfbevent", + "routlm", + "sandwich2x2", + "sandwich3x3", + "solid_angle", + "splint_gh", + "write_ctf_shm", + "ft_statfun_actvsblT", + "ft_statfun_bayesfactor", + "ft_statfun_cohensd", + "ft_statfun_correlationT", + "ft_statfun_depsamplesFmultivariate", + "ft_statfun_depsamplesFunivariate", + "ft_statfun_depsamplesT", + "ft_statfun_depsamplesregrT", + "ft_statfun_diff", + "ft_statfun_diff_itc", + "ft_statfun_gcmi", + "ft_statfun_indepsamplesF", + "ft_statfun_indepsamplesT", + "ft_statfun_indepsamplesZcoh", + "ft_statfun_indepsamplesregrT", + "ft_statfun_mean", + "ft_statfun_pooledT", + "ft_statfun_roc", + "ft_trialfun_balert", + "ft_trialfun_bids", + "ft_trialfun_brainvision_segmented", + "ft_trialfun_edf", + "ft_trialfun_emgdetect", + "ft_trialfun_example1", + "ft_trialfun_example2", + "ft_trialfun_general", + "ft_trialfun_gui", + "ft_trialfun_hed", + "ft_trialfun_imotions", + "ft_trialfun_neuromagSTI016fix", + "ft_trialfun_realtime", + "ft_trialfun_show", + "ft_trialfun_trial", + "ft_trialfun_twoclass_classification", + "appendstruct", + "copyfields", + "dccnpath", + "ft_affinecoordinates", + "ft_apply_montage", + "ft_average_sens", + "ft_cfg2keyval", + "ft_channelcombination", + "ft_channelselection", + "ft_checkconfig", + "ft_checkdata", + "ft_checkopt", + "ft_compile_mex", + "ft_compile_standalone", + "ft_convert_coordsys", + "ft_datatype", + "ft_datatype_comp", + "ft_datatype_dip", + "ft_datatype_freq", + "ft_datatype_headmodel", + "ft_datatype_mvar", + "ft_datatype_parcellation", + "ft_datatype_raw", + "ft_datatype_segmentation", + "ft_datatype_sens", + "ft_datatype_source", + "ft_datatype_spike", + "ft_datatype_timelock", + "ft_datatype_volume", + "ft_debug", + "ft_determine_coordsys", + "ft_documentationconfiguration", + "ft_documentationreference", + "ft_error", + "ft_fetch_data", + "ft_fetch_event", + "ft_fetch_header", + "ft_findcfg", + "ft_getopt", + "ft_hash", + "ft_hastoolbox", + "ft_headcoordinates", + "ft_info", + "ft_inverse_montage", + "ft_keyval2cfg", + "ft_notice", + "ft_platform_supports", + "ft_postamble", + "ft_preamble", + "ft_progress", + "ft_save_workspace", + "ft_scalingfactor", + "ft_selectdata", + "ft_setopt", + "ft_source2full", + "ft_source2grid", + "ft_source2sparse", + "ft_standalone", + "ft_struct2char", + "ft_struct2double", + "ft_struct2single", + "ft_struct2string", + "ft_test", + "ft_trackusage", + "ft_transform_geometry", + "ft_transform_headmodel", + "ft_transform_headshape", + "ft_transform_sens", + "ft_transform_vol", + "ft_version", + "ft_warning", + "ft_warp_apply", + "ft_warp_error", + "ft_warp_optim", + "getsubfield", + "hasyokogawa", + "issubfield", + "istrue", + "keepfields", + "keyval", + "keyvalcheck", + "markdown2matlab", + "match_str", + "match_val", + "matlab2markdown", + "memtic", + "memtoc", + "nearest", + "printstruct", + "removefields", + "renamefields", + "rmsubfield", + "setsubfield", + "strel_bol", + "tokenize", + "xdf2fieldtrip", +] diff --git a/fieldtrip/__inverse/_SAM_costfun.py b/fieldtrip/__inverse/_SAM_costfun.py new file mode 100644 index 0000000..a3fbeac --- /dev/null +++ b/fieldtrip/__inverse/_SAM_costfun.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _SAM_costfun(*args, **kwargs): + """ + costfunction for non-linear beamformer. Use this cost-function to + find the optimum orientation (in the tangential plane formed by + tanu and tanv) of the targetvoxel maximizes the pseudo_Z (i.e. + minimises the inverse of pseudo_Z) + + positions in mm in CTF co-ordinate system + + AH, 05april 2005: if origin = [], then the localspheres headmodel + will be used for the forward calculations. The localspheres origins + should be given in forward_resource (in mm in CTF co-ordinates) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/SAM_costfun.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("SAM_costfun", *args, **kwargs) diff --git a/fieldtrip/__inverse/__init__.py b/fieldtrip/__inverse/__init__.py new file mode 100644 index 0000000..9e54bd5 --- /dev/null +++ b/fieldtrip/__inverse/__init__.py @@ -0,0 +1,26 @@ +from .ft_inverse_dics import ft_inverse_dics +from .ft_inverse_dipolefit import ft_inverse_dipolefit +from .ft_inverse_eloreta import ft_inverse_eloreta +from .ft_inverse_harmony import ft_inverse_harmony +from .ft_inverse_lcmv import ft_inverse_lcmv +from .ft_inverse_mne import ft_inverse_mne +from .ft_inverse_music import ft_inverse_music +from .ft_inverse_pcc import ft_inverse_pcc +from .ft_inverse_rv import ft_inverse_rv +from .ft_inverse_sam import ft_inverse_sam +from .ft_inverse_sloreta import ft_inverse_sloreta + + +__all__ = [ + "ft_inverse_dics", + "ft_inverse_dipolefit", + "ft_inverse_eloreta", + "ft_inverse_harmony", + "ft_inverse_lcmv", + "ft_inverse_mne", + "ft_inverse_music", + "ft_inverse_pcc", + "ft_inverse_rv", + "ft_inverse_sam", + "ft_inverse_sloreta", +] diff --git a/fieldtrip/__inverse/_avgref.py b/fieldtrip/__inverse/_avgref.py new file mode 100644 index 0000000..9e121de --- /dev/null +++ b/fieldtrip/__inverse/_avgref.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _avgref(*args, **kwargs): + """ + AVGREF computes the average reference in each column + [data] = avgref(data) + + or it computes the re-referenced data relative to the + average over the selected channels + [data] = avgref(data, sel) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/avgref.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("avgref", *args, **kwargs) diff --git a/fieldtrip/__inverse/_calctangent.py b/fieldtrip/__inverse/_calctangent.py new file mode 100644 index 0000000..8830188 --- /dev/null +++ b/fieldtrip/__inverse/_calctangent.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _calctangent(*args, **kwargs): + """ + Based on calcrads.m, only difference is that RDip is alread + with respect to the sphere origin in calctangent.m + MODIFIED 13th JAN 2005 MATT BROOKES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/calctangent.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("calctangent", *args, **kwargs) diff --git a/fieldtrip/__inverse/_defaultId.py b/fieldtrip/__inverse/_defaultId.py new file mode 100644 index 0000000..5951b93 --- /dev/null +++ b/fieldtrip/__inverse/_defaultId.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _defaultId(*args, **kwargs): + """ + DEFAULTID returns a string that can serve as warning or error identifier, + for example 'FieldTip:ft_read_header:line345'. + + See also WARNING, ERROR, FT_NOTICE, FT_INFO, FT_DEBUG + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/defaultId.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("defaultId", *args, **kwargs) diff --git a/fieldtrip/__inverse/_find_innermost_boundary.py b/fieldtrip/__inverse/_find_innermost_boundary.py new file mode 100644 index 0000000..83393fa --- /dev/null +++ b/fieldtrip/__inverse/_find_innermost_boundary.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _find_innermost_boundary(*args, **kwargs): + """ + FIND_INNERMOST_BOUNDARY locates innermost compartment of a BEM model + by looking at the containment of the triangular meshes describing + the surface boundaries + + [innermost] = find_innermost_boundary(bnd) + + with the boundaries described by a struct-array bnd with + bnd(i).pnt vertices of boundary i (matrix of size Nx3) + bnd(i).tri triangles of boundary i (matrix of size Mx3) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/find_innermost_boundary.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("find_innermost_boundary", *args, **kwargs) diff --git a/fieldtrip/__inverse/_fixdipole.py b/fieldtrip/__inverse/_fixdipole.py new file mode 100644 index 0000000..8ad35a4 --- /dev/null +++ b/fieldtrip/__inverse/_fixdipole.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _fixdipole(*args, **kwargs): + """ + FIXDIPOLE ensures that the dipole position and moment are + consistently represented throughout FieldTrip functions. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/fixdipole.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixdipole", *args, **kwargs) diff --git a/fieldtrip/__inverse/_fixinside.py b/fieldtrip/__inverse/_fixinside.py new file mode 100644 index 0000000..2db2349 --- /dev/null +++ b/fieldtrip/__inverse/_fixinside.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _fixinside(*args, **kwargs): + """ + FIXINSIDE ensures that the region of interest (which is indicated by the + field "inside") is consistently defined for source structures and volume + structures. Furthermore, it solves backward compatibility problems. + + Use as + [source] = fixinside(source, 'logical'); + or + [source] = fixinside(source, 'index'); + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/fixinside.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixinside", *args, **kwargs) diff --git a/fieldtrip/__inverse/_fixname.py b/fieldtrip/__inverse/_fixname.py new file mode 100644 index 0000000..65fb085 --- /dev/null +++ b/fieldtrip/__inverse/_fixname.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _fixname(*args, **kwargs): + """ + FIXNAME changes all inappropriate characters in a string into '_' + so that it can be used as a filename or as a field name in a structure. + If the string begins with a digit, an 'x' is prepended. + + Use as + str = fixname(str) + + MATLAB 2014a introduces the matlab.lang.makeValidName and + matlab.lang.makeUniqueStrings functions for constructing unique + identifiers, but this particular implementation also works with + older MATLAB versions. + + See also DEBLANK, STRIP, PAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/fixname.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixname", *args, **kwargs) diff --git a/fieldtrip/__inverse/_fixpos.py b/fieldtrip/__inverse/_fixpos.py new file mode 100644 index 0000000..70374df --- /dev/null +++ b/fieldtrip/__inverse/_fixpos.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _fixpos(*args, **kwargs): + """ + FIXPOS helper function to ensure that meshes are described properly + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/fixpos.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixpos", *args, **kwargs) diff --git a/fieldtrip/__inverse/_ft_debug.py b/fieldtrip/__inverse/_ft_debug.py new file mode 100644 index 0000000..8b2d243 --- /dev/null +++ b/fieldtrip/__inverse/_ft_debug.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_debug(*args, **kwargs): + """ + FT_DEBUG prints a debug message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_debug(...) + with arguments similar to fprintf, or + ft_debug(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_debug off + or for specific ones using + ft_debug off msgId + + To switch them back on, you would use + ft_debug on + or for specific ones using + ft_debug on msgId + + Messages are only printed once per timeout period using + ft_debug timeout 60 + ft_debug once + or for specific ones using + ft_debug once msgId + + You can see the most recent messages and identifier using + ft_debug last + + You can query the current on/off/once state for all messages using + ft_debug query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_debug.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_debug", *args, **kwargs) diff --git a/fieldtrip/__inverse/_ft_error.py b/fieldtrip/__inverse/_ft_error.py new file mode 100644 index 0000000..f27f177 --- /dev/null +++ b/fieldtrip/__inverse/_ft_error.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _ft_error(*args, **kwargs): + """ + FT_ERROR prints an error message on screen, just like the standard ERROR function. + + Use as + ft_error(...) + with arguments similar to fprintf, or + ft_error(msgId, ...) + with arguments similar to error. + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_error.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_error", *args, **kwargs) diff --git a/fieldtrip/__inverse/_ft_getopt.py b/fieldtrip/__inverse/_ft_getopt.py new file mode 100644 index 0000000..0f68cbd --- /dev/null +++ b/fieldtrip/__inverse/_ft_getopt.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def _ft_getopt(*args, **kwargs): + """ + FT_GETOPT gets the value of a specified option from a configuration structure + or from a cell-array with key-value pairs. + + Use as + val = ft_getopt(s, key, default, emptymeaningful) + where the input values are + s = structure or cell-array + key = string + default = any valid MATLAB data type (optional, default = []) + emptymeaningful = boolean value (optional, default = false) + + If the key is present as field in the structure, or as key-value pair in the + cell-array, the corresponding value will be returned. + + If the key is not present, ft_getopt will return the default, or an empty array + when no default was specified. + + If the key is present but has an empty value, then the emptymeaningful flag + specifies whether the empty value or the default value should be returned. + If emptymeaningful==true, then the empty array will be returned. + If emptymeaningful==false, then the specified default will be returned. + + See also FT_SETOPT, FT_CHECKOPT, INPUTPARSER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_getopt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_getopt", *args, **kwargs) diff --git a/fieldtrip/__inverse/_ft_hastoolbox.py b/fieldtrip/__inverse/_ft_hastoolbox.py new file mode 100644 index 0000000..1149e3f --- /dev/null +++ b/fieldtrip/__inverse/_ft_hastoolbox.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _ft_hastoolbox(*args, **kwargs): + """ + FT_HASTOOLBOX tests whether an external toolbox is installed. Optionally it will + try to determine the path to the toolbox and install it automatically. + + Use as + [status] = ft_hastoolbox(toolbox, autoadd, silent) + + autoadd = -1 means that it will check and give an error when not yet installed + autoadd = 0 means that it will check and give a warning when not yet installed + autoadd = 1 means that it will check and give an error if it cannot be added + autoadd = 2 means that it will check and give a warning if it cannot be added + autoadd = 3 means that it will check but remain silent if it cannot be added + + silent = 0 means that it will give some feedback about adding the toolbox + silent = 1 means that it will not give feedback + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_hastoolbox.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_hastoolbox", *args, **kwargs) diff --git a/fieldtrip/__inverse/_ft_headmodeltype.py b/fieldtrip/__inverse/_ft_headmodeltype.py new file mode 100644 index 0000000..e76561f --- /dev/null +++ b/fieldtrip/__inverse/_ft_headmodeltype.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def _ft_headmodeltype(*args, **kwargs): + """ + FT_HEADMODELTYPE determines the type of volume conduction model of the head + + Use as + [type] = ft_headmodeltype(headmodel) + to get a string describing the type, or + [flag] = ft_headmodeltype(headmodel, desired) + to get a boolean value. + + For EEG the following volume conduction models are recognized + singlesphere analytical single sphere model + concentricspheres analytical concentric sphere model with up to 4 spheres + halfspace infinite homogenous medium on one side, vacuum on the other + openmeeg boundary element method, based on the OpenMEEG software + bemcp boundary element method, based on the implementation from Christophe Phillips + dipoli boundary element method, based on the implementation from Thom Oostendorp + asa boundary element method, based on the (commercial) ASA software + simbio finite element method, based on the SimBio software + fns finite difference method, based on the FNS software + interpolate interpolate the potential based on pre-computed leadfields + + and for MEG the following volume conduction models are recognized + singlesphere analytical single sphere model + localspheres local spheres model for MEG, one sphere per channel + singleshell realisically shaped single shell approximation, based on the implementation from Guido Nolte + infinite magnetic dipole in an infinite vacuum + interpolate interpolate the potential based on pre-computed leadfields + + See also FT_COMPUTE_LEADFIELD, FT_READ_HEADMODEL, FT_HEADMODEL_BEMCP, + FT_HEADMODEL_ASA, FT_HEADMODEL_DIPOLI, FT_HEADMODEL_SIMBIO, + FT_HEADMODEL_FNS, FT_HEADMODEL_HALFSPACE, FT_HEADMODEL_INFINITE, + FT_HEADMODEL_OPENMEEG, FT_HEADMODEL_SINGLESPHERE, + FT_HEADMODEL_CONCENTRICSPHERES, FT_HEADMODEL_LOCALSPHERES, + FT_HEADMODEL_SINGLESHELL, FT_HEADMODEL_INTERPOLATE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_headmodeltype.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodeltype", *args, **kwargs) diff --git a/fieldtrip/__inverse/_ft_info.py b/fieldtrip/__inverse/_ft_info.py new file mode 100644 index 0000000..fd112eb --- /dev/null +++ b/fieldtrip/__inverse/_ft_info.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_info(*args, **kwargs): + """ + FT_INFO prints an info message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_info(...) + with arguments similar to fprintf, or + ft_info(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_info off + or for specific ones using + ft_info off msgId + + To switch them back on, you would use + ft_info on + or for specific ones using + ft_info on msgId + + Messages are only printed once per timeout period using + ft_info timeout 60 + ft_info once + or for specific ones using + ft_info once msgId + + You can see the most recent messages and identifier using + ft_info last + + You can query the current on/off/once state for all messages using + ft_info query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_info.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_info", *args, **kwargs) diff --git a/fieldtrip/__inverse/_ft_inside_headmodel.py b/fieldtrip/__inverse/_ft_inside_headmodel.py new file mode 100644 index 0000000..90fcb28 --- /dev/null +++ b/fieldtrip/__inverse/_ft_inside_headmodel.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _ft_inside_headmodel(*args, **kwargs): + """ + FT_INSIDE_HEADMODEL locates dipole locations inside/outside the source + compartment of a volume conductor model. + + Use as + [inside] = ft_inside_headmodel(dippos, headmodel, ...) + + The input should be + dippos = Nx3 matrix with dipole positions + headmodel = structure with volume conductor model + and the output is + inside = boolean vector indicating for each dipole wether it is inside the source compartment + + Additional optional input arguments should be given in key value pairs and can include + inwardshift = number + grad = structure with gradiometer information, used for localspheres + headshape = structure with headshape, used for old CTF localspheres strategy + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_inside_headmodel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_inside_headmodel", *args, **kwargs) diff --git a/fieldtrip/__inverse/_ft_inv.py b/fieldtrip/__inverse/_ft_inv.py new file mode 100644 index 0000000..05cc8ef --- /dev/null +++ b/fieldtrip/__inverse/_ft_inv.py @@ -0,0 +1,87 @@ +from fieldtrip._runtime import Runtime + + +def _ft_inv(*args, **kwargs): + """ + FT_INV computes a matrix inverse with optional regularization. + + Use as + Y = ft_inv(X, ...) + + Additional options should be specified in key-value pairs and can be + method = string, method for inversion and regularization (see below). + The default method is 'lavrentiev'. + lambda = scalar value, or string (expressed as a percentage), specifying + the regularization parameter for Lavrentiev or Tikhonov + regularization, or the replacement value for winsorization. + When lambda is specified as a string containing a percentage, + e.g. '5%', it will be computed as the percentage of the average + eigenvalue. + kappa = scalar integer, reflects the ordinal singular value at which + the singular value spectrum will be truncated. + tolerance = scalar, reflects the fraction of the largest singular value + at which the singular value spectrum will be truncated. + The default is 10*eps*max(size(X)). + feedback = boolean, to visualize the singular value spectrum with the + lambda regularization and kappa truncation. + + The supported methods are: + + 'vanilla' - the MATLAB inv() function is used for inversion, no regularization is + applied. + + 'moorepenrose' - the Moore-Penrose pseudoinverse is computed, no regularization is + applied. + + 'tsvd' - this results in a pseudoinverse based on a singular value decomposition, + truncating the singular values according to either kappa or tolerance parameter + before reassembling the inverse. + + 'tikhonov' - the matrix is regularized according to the Tikhonov method using the + labmda parameter, after which the truncated svd method (i.e. similar to MATLAB + pinv) is used for inversion. + + 'lavrentiev' - the matrix is regularized according to the Lavrentiev method with a + weighted identity matrix using the labmda parameter, after which the truncated svd + method (i.e. similar to MATLAB pinv) is used for inversion. + + 'winsorize' - a truncated svd is computed, based on either kappa or tolerance + parameters, but in addition the singular values smaller than lambda are replaced by + the value according to lambda. + + Both for the lambda and the kappa option you can specify 'interactive' to pop up an + interactive display of the singular value spectrum that allows you to click in the figure. + + Rather than specifying kappa, you can also specify the tolerance as the ratio of + the largest eigenvalue at which eigenvalues will be truncated. + + See also INV, PINV, CONDEST, RANK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_inv.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_inv", *args, **kwargs) diff --git a/fieldtrip/__inverse/_ft_notice.py b/fieldtrip/__inverse/_ft_notice.py new file mode 100644 index 0000000..786f94e --- /dev/null +++ b/fieldtrip/__inverse/_ft_notice.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_notice(*args, **kwargs): + """ + FT_NOTICE prints a notice message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_notice(...) + with arguments similar to fprintf, or + ft_notice(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_notice off + or for specific ones using + ft_notice off msgId + + To switch them back on, you would use + ft_notice on + or for specific ones using + ft_notice on msgId + + Messages are only printed once per timeout period using + ft_notice timeout 60 + ft_notice once + or for specific ones using + ft_notice once msgId + + You can see the most recent messages and identifier using + ft_notice last + + You can query the current on/off/once state for all messages using + ft_notice query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_notice.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_notice", *args, **kwargs) diff --git a/fieldtrip/__inverse/_ft_notification.py b/fieldtrip/__inverse/_ft_notification.py new file mode 100644 index 0000000..3375845 --- /dev/null +++ b/fieldtrip/__inverse/_ft_notification.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _ft_notification(*args, **kwargs): + """ + FT_NOTIFICATION works mostly like the WARNING and ERROR commands in MATLAB and + is called by FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO and FT_DEBUG. Please note + that you should not call this function directly. + + Some examples: + ft_info on + ft_info on msgId + ft_info off + ft_info off msgId + ft_info once + ft_info once msgId + ft_info on backtrace + ft_info off backtrace + ft_info on verbose + ft_info off verbose + + ft_info query % shows the status of all notifications + ft_info last % shows the last notification + ft_info clear % clears the status of all notifications + ft_info timeout 10 % sets the timeout (for 'once') to 10 seconds + + See also DEFAULTID, FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_notification.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_notification", *args, **kwargs) diff --git a/fieldtrip/__inverse/_ft_platform_supports.py b/fieldtrip/__inverse/_ft_platform_supports.py new file mode 100644 index 0000000..08746fa --- /dev/null +++ b/fieldtrip/__inverse/_ft_platform_supports.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def _ft_platform_supports(*args, **kwargs): + """ + FT_PLATFORM_SUPPORTS returns a boolean indicating whether the current platform + supports a specific capability + + Use as + status = ft_platform_supports(what) + or + status = ft_platform_supports('matlabversion', min_version, max_version) + + The following values are allowed for the 'what' parameter, which means means that + the specific feature explained on the right is supported: + + 'which-all' which(...,'all') + 'exists-in-private-directory' exists(...) will look in the /private subdirectory to see if a file exists + 'onCleanup' onCleanup(...) + 'alim' alim(...) + 'int32_logical_operations' bitand(a,b) with a, b of type int32 + 'graphics_objects' graphics system is object-oriented + 'libmx_c_interface' libmx is supported through mex in the C-language (recent MATLAB versions only support C++) + 'images' all image processing functions in FieldTrip's external/images directory + 'signal' all signal processing functions in FieldTrip's external/signal directory + 'stats' all statistical functions in FieldTrip's external/stats directory + 'program_invocation_name' program_invocation_name() (GNU Octave) + 'singleCompThread' start MATLAB with -singleCompThread + 'nosplash' start MATLAB with -nosplash + 'nodisplay' start MATLAB with -nodisplay + 'nojvm' start MATLAB with -nojvm + 'no-gui' start GNU Octave with --no-gui + 'RandStream.setGlobalStream' RandStream.setGlobalStream(...) + 'RandStream.setDefaultStream' RandStream.setDefaultStream(...) + 'rng' rng(...) + 'rand-state' rand('state') + 'urlread-timeout' urlread(..., 'Timeout', t) + 'griddata-vector-input' griddata(...,...,...,a,b) with a and b vectors + 'griddata-v4' griddata(...,...,...,...,...,'v4') with v4 interpolation support + 'uimenu' uimenu(...) + 'weboptions' weboptions(...) + 'parula' parula(...) + 'datetime' datetime structure + 'html' html rendering in desktop + + See also FT_VERSION, VERSION, VER, VERLESSTHAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_platform_supports.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_platform_supports", *args, **kwargs) diff --git a/fieldtrip/__inverse/_ft_progress.py b/fieldtrip/__inverse/_ft_progress.py new file mode 100644 index 0000000..d1b672a --- /dev/null +++ b/fieldtrip/__inverse/_ft_progress.py @@ -0,0 +1,63 @@ +from fieldtrip._runtime import Runtime + + +def _ft_progress(*args, **kwargs): + """ + FT_PROGRESS shows a graphical or non-graphical progress indication similar to the + standard WAITBAR function, but with the extra option of printing it in the command + window as a plain text string or as a rotating dial. Alternatively, you can also + specify it not to give feedback on the progress. + + Prior to the for-loop, you should call either + ft_progress('init', 'none', 'Please wait...') + ft_progress('init', 'text', 'Please wait...') + ft_progress('init', 'textbar', 'Please wait...') % ascii progress bar + ft_progress('init', 'dial', 'Please wait...') % rotating dial + ft_progress('init', 'etf', 'Please wait...') % estimated time to finish + ft_progress('init', 'gui', 'Please wait...') + + In each iteration of the for-loop, you should call either + ft_progress(x) % only show percentage + ft_progress(x, 'Processing event %d from %d', i, N) % show string, x=i/N + + After finishing the for-loop, you should call + ft_progress('close') + + Here is an example for the use of a progress indicator + ft_progress('init', 'etf', 'Please wait...'); + for i=1:100 + ft_progress(i/100, 'Processing event %d from %d', i, 100); + pause(0.03); + end + ft_progress('close') + + See also WAITBAR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_progress.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_progress", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__inverse/_ft_scalingfactor.py b/fieldtrip/__inverse/_ft_scalingfactor.py new file mode 100644 index 0000000..39a5b21 --- /dev/null +++ b/fieldtrip/__inverse/_ft_scalingfactor.py @@ -0,0 +1,91 @@ +from fieldtrip._runtime import Runtime + + +def _ft_scalingfactor(*args, **kwargs): + """ + FT_SCALINGFACTOR determines the scaling factor from old to new units, i.e. it + returns a number with which the data in the old units needs to be multiplied + to get it expressed in the new units. + + Use as + factor = ft_scalingfactor(old, new) + where old and new are strings that specify the units. + + For example + ft_scalingfactor('m', 'cm') % returns 100 + ft_scalingfactor('V', 'uV') % returns 1000 + ft_scalingfactor('T/cm', 'fT/m') % returns 10^15 divided by 10^-2, which is 10^17 + ft_scalingfactor('cm^2', 'mm^2') % returns 100 + ft_scalingfactor('1/ms', 'Hz') % returns 1000 + + The following fundamental units are supported + metre m length l (a lowercase L), x, r L + kilogram kg mass m M + second s time t T + ampere A electric current I (an uppercase i) I + kelvin K thermodynamic temperature T # + mole mol amount of substance n N + candela cd luminous intensity Iv (an uppercase i with lowercase non-italicized v subscript) J + + The following derived units are supported + hertz Hz frequency 1/s T-1 + radian rad angle m/m dimensionless + steradian sr solid angle m2/m2 dimensionless + newton N force, weight kg#m/s2 M#L#T-2 + pascal Pa pressure, stress N/m2 M#L-1#T-2 + joule J energy, work, heat N#m = C#V = W#s M#L2#T-2 + coulomb C electric charge or quantity of electricity s#A T#I + volt V voltage, electrical potential difference, electromotive force W/A = J/C M#L2#T-3#I-1 + farad F electric capacitance C/V M-1#L-2#T4#I2 + siemens S electrical conductance 1/# = A/V M-1#L-2#T3#I2 + weber Wb magnetic flux J/A M#L2#T-2#I-1 + tesla T magnetic field strength V#s/m2 = Wb/m2 = N/(A#m) M#T-2#I-1 + henry H inductance V#s/A = Wb/A M#L2#T-2#I-2 + lumen lm luminous flux cd#sr J + lux lx illuminance lm/m2 L-2#J + becquerel Bq radioactivity (decays per unit time) 1/s T-1 + gray Gy absorbed dose (of ionizing radiation) J/kg L2#T-2 + sievert Sv equivalent dose (of ionizing radiation) J/kg L2#T-2 + katal kat catalytic activity mol/s T-1#N + + The following alternative units are supported + inch inch length + feet feet length + gauss gauss magnetic field strength + + The following derived units are not supported due to potential confusion + between their ascii character representation + ohm # electric resistance, impedance, reactance V/A M#L2#T-3#I-2 + watt W power, radiant flux J/s = V#A M#L2#T-3 + degree Celsius ?C temperature relative to 273.15 K K ? + + See also http://en.wikipedia.org/wiki/International_System_of_Units + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_scalingfactor.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_scalingfactor", *args, **kwargs) diff --git a/fieldtrip/__inverse/_ft_senslabel.py b/fieldtrip/__inverse/_ft_senslabel.py new file mode 100644 index 0000000..89c44f3 --- /dev/null +++ b/fieldtrip/__inverse/_ft_senslabel.py @@ -0,0 +1,89 @@ +from fieldtrip._runtime import Runtime + + +def _ft_senslabel(*args, **kwargs): + """ + FT_SENSLABEL returns a list of predefined sensor labels given the + EEG or MEG system type which can be used to detect the type of data. + + Use as + label = ft_senslabel(type) + + The input sensor array type can be any of the following + 'ant128' + 'biosemi64' + 'biosemi128' + 'biosemi256' + 'bti148' + 'bti148_planar' + 'bti248' + 'bti248_planar' + 'btiref' + 'ctf64' + 'ctf64_planar' + 'ctf151' + 'ctf151_planar' + 'ctf275' + 'ctf275_planar' + 'ctfheadloc' + 'ctfref' + 'eeg1005' + 'eeg1010' + 'eeg1020' + 'ext1020' + 'egi32' + 'egi64' + 'egi128' + 'egi256' + 'neuromag122' + 'neuromag122_planar' + 'neuromag306' + 'neuromag306_planar' + 'itab28' + 'itab153' + 'itab153_planar' + 'yokogawa9' + 'yokogawa64' + 'yokogawa64_planar' + 'yokogawa160' + 'yokogawa160_planar' + 'yokogawa208' + 'yokogawa208_planar' + 'yokogawa440' + 'yokogawa440_planar' + + It is also possible to specify + 'eeg' + 'electrode' + although for these an empty set of labels (i.e. {}) will be returned. + + See also FT_SENSTYPE, FT_CHANNELSELECTION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_senslabel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_senslabel", *args, **kwargs) diff --git a/fieldtrip/__inverse/_ft_senstype.py b/fieldtrip/__inverse/_ft_senstype.py new file mode 100644 index 0000000..84ad099 --- /dev/null +++ b/fieldtrip/__inverse/_ft_senstype.py @@ -0,0 +1,132 @@ +from fieldtrip._runtime import Runtime + + +def _ft_senstype(*args, **kwargs): + """ + FT_SENSTYPE determines the type of acquisition device by looking at the channel + names and comparing them with predefined lists. + + Use as + [type] = ft_senstype(sens) + or + [flag] = ft_senstype(sens, desired) + + The output type can be any of the following + 'ctf64' + 'ctf151' + 'ctf151_planar' + 'ctf275' + 'ctf275_planar' + 'bti148' + 'bti148_planar' + 'bti248' + 'bti248_planar' + 'bti248grad' + 'bti248grad_planar' + 'itab28' + 'itab153' + 'itab153_planar' + 'yokogawa9' + 'yokogawa64' + 'yokogawa64_planar' + 'yokogawa160' + 'yokogawa160_planar' + 'yokogawa208' + 'yokogawa208_planar' + 'yokogawa440' + 'neuromag122' + 'neuromag122_combined' + 'neuromag306' + 'neuromag306_combined' + 'babysquid74' this is a BabySQUID system from Tristan Technologies + 'artemis123' this is a BabySQUID system from Tristan Technologies + 'magview' this is a BabySQUID system from Tristan Technologies + 'fieldline_v2' + 'fieldline_v3' + 'egi32' + 'egi64' + 'egi128' + 'egi256' + 'biosemi64' + 'biosemi128' + 'biosemi256' + 'ant128' + 'neuralynx' + 'plexon' + 'artinis' + 'nirx' + 'shimadzu' + 'hitachi' + 'nirs' + 'meg' + 'eeg' + 'ieeg' + 'seeg' + 'ecog' + 'eeg1020' + 'eeg1010' + 'eeg1005' + 'ext1020' in case it is a small subset of eeg1020, eeg1010 or eeg1005 + 'nex5' + + The optional input argument for the desired type can be any of the above, or any of + the following generic classes of acquisition systems + 'eeg' + 'ieeg' + 'ext1020' + 'ant' + 'biosemi' + 'egi' + 'meg' + 'meg_planar' + 'meg_axial' + 'ctf' + 'bti' + 'neuromag' + 'yokogawa' + 'itab' + 'babysquid' + 'fieldline' + If you specify the desired type, this function will return a boolean flag + indicating true/false depending on the input data. + + Besides specifying a sensor definition (i.e. a grad or elec structure, see + FT_DATATYPE_SENS), it is also possible to give a data structure containing a grad + or elec field, or giving a list of channel names (as cell-arrray). So assuming that + you have a FieldTrip data structure, any of the following calls would also be fine. + ft_senstype(hdr) + ft_senstype(data) + ft_senstype(data.label) + ft_senstype(data.grad) + ft_senstype(data.grad.label) + + See also FT_SENSLABEL, FT_CHANTYPE, FT_READ_SENS, FT_COMPUTE_LEADFIELD, FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_senstype.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_senstype", *args, **kwargs) diff --git a/fieldtrip/__inverse/_ft_setopt.py b/fieldtrip/__inverse/_ft_setopt.py new file mode 100644 index 0000000..128500a --- /dev/null +++ b/fieldtrip/__inverse/_ft_setopt.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _ft_setopt(*args, **kwargs): + """ + FT_SETOPT assigns a value to an configuration structure or to a cell-array + with key-value pairs. It will overwrite the option if already present, or + append the option if not present. + + Use as + s = ft_setopt(s, key, val) + where s is a structure or a cell-array. + + See also FT_GETOPT, FT_CHECKOPT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_setopt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_setopt", *args, **kwargs) diff --git a/fieldtrip/__inverse/_ft_version.py b/fieldtrip/__inverse/_ft_version.py new file mode 100644 index 0000000..64ce077 --- /dev/null +++ b/fieldtrip/__inverse/_ft_version.py @@ -0,0 +1,69 @@ +from fieldtrip._runtime import Runtime + + +def _ft_version(*args, **kwargs): + """ + FT_VERSION returns the version of FieldTrip and the path where it is installed + + FieldTrip is not released with version numbers as "2.0", "2.1", etc. Instead, we + share our development version on http://github.com/fieldtrip/fieldtrip. You can use + git to make a local clone of the development version. Furthermore, we make + more-or-less daily releases of the code available on + https://github.com/fieldtrip/fieldtrip/releases and as zip file on our FTP server. + + If you use git with the development version, the version is labeled with the hash + of the latest commit like "128c693". You can access the specific version "XXXXXX" + at https://github.com/fieldtrip/fieldtrip/commit/XXXXXX. + + If you download the daily released version from our FTP server, the version is part + of the file name "fieldtrip-YYYYMMDD.zip", where YYY, MM and DD correspond to year, + month and day. + + Use as + ft_version + to display the latest revision number on screen, or + [ftver, ftpath] = ft_version + to get the version and the installation root directory. + + When using git with the development version, you can also get additional information with + ft_version revision + ft_version branch + ft_version clean + + On macOS you might have installed git along with Xcode instead of with homebrew, + which then requires that you agree to the Apple license. In that case it can + happen that this function stops, as in the background (invisible to you) it is + asking whether you agree. You can check this by typing "/usr/bin/git", which will + show the normal help message, or which will mention the license agreement. To + resolve this please open a terminal and type "sudo xcodebuild -license" + + See also FT_PLATFORM_SUPPORTS, VERSION, VER, VERLESSTHAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_version.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_version", *args, **kwargs) diff --git a/fieldtrip/__inverse/_ft_warning.py b/fieldtrip/__inverse/_ft_warning.py new file mode 100644 index 0000000..fc6807b --- /dev/null +++ b/fieldtrip/__inverse/_ft_warning.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def _ft_warning(*args, **kwargs): + """ + FT_WARNING prints a warning message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. This function works + similar to the standard WARNING function, but also features the "once" mode. + + Use as + ft_warning(...) + with arguments similar to fprintf, or + ft_warning(msgId, ...) + with arguments similar to warning. + + You can switch of all warning messages using + ft_warning off + or for specific ones using + ft_warning off msgId + + To switch them back on, you would use + ft_warning on + or for specific ones using + ft_warning on msgId + + Warning messages are only printed once per timeout period using + ft_warning timeout 60 + ft_warning once + or for specific ones using + ft_warning once msgId + + You can see the most recent messages and identifier using + ft_warning last + + You can query the current on/off/once state for all messages using + ft_warning query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/ft_warning.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_warning", *args, **kwargs) diff --git a/fieldtrip/__inverse/_getsubfield.py b/fieldtrip/__inverse/_getsubfield.py new file mode 100644 index 0000000..495db1d --- /dev/null +++ b/fieldtrip/__inverse/_getsubfield.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _getsubfield(*args, **kwargs): + """ + GETSUBFIELD returns a field from a structure just like the standard + GETFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = getsubfield(s, 'fieldname') + or as + f = getsubfield(s, 'fieldname.subfieldname') + + See also GETFIELD, ISSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/getsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getsubfield", *args, **kwargs) diff --git a/fieldtrip/__inverse/_hasyokogawa.py b/fieldtrip/__inverse/_hasyokogawa.py new file mode 100644 index 0000000..be43081 --- /dev/null +++ b/fieldtrip/__inverse/_hasyokogawa.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _hasyokogawa(*args, **kwargs): + """ + HASYOKOGAWA tests whether the data input toolbox for MEG systems by + Yokogawa (www.yokogawa.com, designed by KIT/EagleTechnology) is + installed. Only the newest version of the toolbox is accepted. + + Use as + string = hasyokogawa; + which returns a string describing the toolbox version, e.g. "12bitBeta3", + "16bitBeta3", or "16bitBeta6" for preliminary versions, or '1.5' for the + official Yokogawa MEG Reader Toolbox. An empty string is returned if the toolbox + is not installed. The string "unknown" is returned if it is installed but + the version is unknown. + + Alternatively you can use it as + [boolean] = hasyokogawa(desired); + where desired is a string with the desired version. + + See also READ_YOKOGAWA_HEADER, READ_YOKOGAWA_DATA, READ_YOKOGAWA_EVENT, + YOKOGAWA2GRAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/hasyokogawa.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("hasyokogawa", *args, **kwargs) diff --git a/fieldtrip/__inverse/_headsurface.py b/fieldtrip/__inverse/_headsurface.py new file mode 100644 index 0000000..2c06203 --- /dev/null +++ b/fieldtrip/__inverse/_headsurface.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _headsurface(*args, **kwargs): + """ + HEADSURFACE constructs a triangulated description of the skin or brain + surface from a volume conduction model, from a set of electrodes or + gradiometers, or from a combination of the two. It returns a closed + surface. + + Use as + [pos, tri] = headsurface(headmodel, sens, ...) + where + headmodel = volume conduction model (structure) + sens = electrode or gradiometer array (structure) + + Optional arguments should be specified in key-value pairs: + surface = 'skin' or 'brain' (default = 'skin') + npos = number of vertices (default is determined automatic) + downwardshift = boolean, this will shift the lower rim of the helmet down with approximately 1/4th of its radius (default is 1) + inwardshift = number (default = 0) + headshape = string, file containing the head shape + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/headsurface.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("headsurface", *args, **kwargs) diff --git a/fieldtrip/__inverse/_issubfield.py b/fieldtrip/__inverse/_issubfield.py new file mode 100644 index 0000000..008f30e --- /dev/null +++ b/fieldtrip/__inverse/_issubfield.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _issubfield(*args, **kwargs): + """ + ISSUBFIELD tests for the presence of a field in a structure just like the standard + Matlab ISFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = issubfield(s, 'fieldname') + or as + f = issubfield(s, 'fieldname.subfieldname') + + This function returns true if the field is present and false if the field + is not present. + + See also ISFIELD, GETSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/issubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("issubfield", *args, **kwargs) diff --git a/fieldtrip/__inverse/_keyval.py b/fieldtrip/__inverse/_keyval.py new file mode 100644 index 0000000..bcc0398 --- /dev/null +++ b/fieldtrip/__inverse/_keyval.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _keyval(*args, **kwargs): + """ + KEYVAL returns the value that corresponds to the requested key in a + key-value pair list of variable input arguments + + Use as + [val] = keyval(key, varargin) + + See also VARARGIN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/keyval.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("keyval", *args, **kwargs) diff --git a/fieldtrip/__inverse/_mesh_laplacian.py b/fieldtrip/__inverse/_mesh_laplacian.py new file mode 100644 index 0000000..9bc0580 --- /dev/null +++ b/fieldtrip/__inverse/_mesh_laplacian.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_laplacian(*args, **kwargs): + """ + MESH_LAPLACIAN: Laplacian of irregular triangular mesh + + Useage: [lap,edge] = mesh_laplacian(vertex,face) + + Returns 'lap', the Laplacian (2nd spatial derivative) of an + irregular triangular mesh, and 'edge', the linear distances + between vertices of 'face'. 'lap' and 'edge' are square, + [Nvertices,Nvertices] in size, sparse in nature. + + It is assumed that 'vertex' contains the (x,y,z) Cartesian + coordinates of each vertex and that 'face' contains the + triangulation of vertex with indices into 'vertex' that + are numbered from 1:Nvertices. For information about + triangulation, see 'help convhull' or 'help convhulln'. + + The neighbouring vertices of vertex 'i' is given by: + + k = find(edge(i,:)); + + The math of this routine is given by: + + Oostendorp, Oosterom & Huiskamp (1989), + Interpolation on a triangulated 3D surface. + Journal of Computational Physics, 80: 331-343. + + See also, eeg_interp_scalp_mesh + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/mesh_laplacian.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_laplacian", *args, **kwargs) diff --git a/fieldtrip/__inverse/_mkfilt_eloreta.py b/fieldtrip/__inverse/_mkfilt_eloreta.py new file mode 100644 index 0000000..0e64efb --- /dev/null +++ b/fieldtrip/__inverse/_mkfilt_eloreta.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def _mkfilt_eloreta(*args, **kwargs): + """ + makes spatial filter according to eLoreta + usage A=mkfilt_eloreta(L); or A=mkfilt_eloreta(L,regu); + + input L: NxMxP leadfield tensor for N channels, M voxels, and + P dipole directions. Typically P=3. (If you do MEG for + a spherical volume conductor or reduce the rank, you must + reduce L such that it has full rank for each voxel, such that, + e.g., P=2) + regu: optional regularization parameter (default is .05 corresponding + to 5% of the average of the eigenvalues of some matrix to be inverted.) + + output A: NxMxP tensor of spatial filters. If x is the Nx1 data vector at time t. + then A(:,m,p)'*x is the source activity at time t in voxel m in source direction + p. + + code implemented by Guido Nolte + please cite + “R.D. Pascual-Marqui: Discrete, 3D distributed, linear imaging methods of electric neuronal activity. Part 1: exact, zero + error localization. arXiv:0710.3341 [math-ph], 2007-October-17, http://arxiv.org/pdf/0710.3341 ” + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/mkfilt_eloreta.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mkfilt_eloreta", *args, **kwargs) diff --git a/fieldtrip/__inverse/_quaternion.py b/fieldtrip/__inverse/_quaternion.py new file mode 100644 index 0000000..6ce6d7e --- /dev/null +++ b/fieldtrip/__inverse/_quaternion.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _quaternion(*args, **kwargs): + """ + QUATERNION returns the homogenous coordinate transformation matrix corresponding to + a coordinate transformation described by 7 quaternion parameters. + + Use as + [H] = quaternion(Q) + where + Q [q0, q1, q2, q3, q4, q5, q6] vector with parameters + H corresponding homogenous transformation matrix + + If the input vector has length 6, it is assumed to represent a unit quaternion without scaling. + + See Neuromag/Elekta/Megin MaxFilter manual version 2.2, section "D2 Coordinate Matching", page 77 for more details and + https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#Conversion_to_and_from_the_matrix_representation + + See also TRANSLATE, ROTATE, SCALE, HOMOGENOUS2QUATERNION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/quaternion.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("quaternion", *args, **kwargs) diff --git a/fieldtrip/__inverse/_rigidbody.py b/fieldtrip/__inverse/_rigidbody.py new file mode 100644 index 0000000..c149ed1 --- /dev/null +++ b/fieldtrip/__inverse/_rigidbody.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _rigidbody(*args, **kwargs): + """ + RIGIDBODY creates the homogenous spatial transformation matrix + for a 6 parameter rigid-body transformation + + Use as + [H] = rigidbody(f) + + The transformation vector f should contain the + x-shift + y-shift + z-shift + followed by the + pitch (rotation around x-axis, in degrees) + roll (rotation around y-axis, in degrees) + yaw (rotation around z-axis, in degrees) + + See also ROTATE, TRANSLATE, SCALE, QUATERNION, HOMOGENOUS2TRADITIONAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/rigidbody.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rigidbody", *args, **kwargs) diff --git a/fieldtrip/__inverse/_rotate.py b/fieldtrip/__inverse/_rotate.py new file mode 100644 index 0000000..e5b706e --- /dev/null +++ b/fieldtrip/__inverse/_rotate.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _rotate(*args, **kwargs): + """ + ROTATE returns the homogenous coordinate transformation matrix + corresponding to a rotation around the x, y and z-axis. The direction of + the rotation is according to the right-hand rule. + + Use as + [H] = rotate(R) + where + R [rx, ry, rz] in degrees + H corresponding homogenous transformation matrix + + Note that the order in which the rotations are performs matters. The + rotation is first done around the z-axis, then the y-axis and finally the + x-axis. + + See also TRANSLATE, SCALE, RIGIDBODY, QUATERNION, HOMOGENOUS2TRADITIONAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/rotate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rotate", *args, **kwargs) diff --git a/fieldtrip/__inverse/_settang.py b/fieldtrip/__inverse/_settang.py new file mode 100644 index 0000000..8c6f4e5 --- /dev/null +++ b/fieldtrip/__inverse/_settang.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _settang(*args, **kwargs): + """ + set the dipole cartesian direction, given: + 1) the instantenious decomposition vectors tanu and tanv + 2) the instanteneous dipole orientation theta + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/settang.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("settang", *args, **kwargs) diff --git a/fieldtrip/__inverse/_solid_angle.py b/fieldtrip/__inverse/_solid_angle.py new file mode 100644 index 0000000..f251acf --- /dev/null +++ b/fieldtrip/__inverse/_solid_angle.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _solid_angle(*args, **kwargs): + """ + SOLID_ANGLE of a planar triangle as seen from the origin + + The solid angle W subtended by a surface S is defined as the surface + area W of a unit sphere covered by the surface's projection onto the + sphere. Solid angle is measured in steradians, and the solid angle + corresponding to all of space being subtended is 4*pi sterradians. + + Use: + [w] = solid_angle(v1, v2, v3) + or + [w] = solid_angle(pnt, tri) + where v1, v2 and v3 are the vertices of a single triangle in 3D or + pnt and tri contain a description of a triangular mesh (this will + compute the solid angle for each triangle) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/solid_angle.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("solid_angle", *args, **kwargs) diff --git a/fieldtrip/__inverse/_surface_inside.py b/fieldtrip/__inverse/_surface_inside.py new file mode 100644 index 0000000..389f6fb --- /dev/null +++ b/fieldtrip/__inverse/_surface_inside.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _surface_inside(*args, **kwargs): + """ + SURFACE_INSIDE determines if a point is inside/outside a triangle mesh + whereby the bounding triangle mesh should be closed. + + Use as + inside = surface_inside(dippos, pos, tri) + where + dippos position of point of interest (can be 1x3 or Nx3) + pos bounding mesh vertices + tri bounding mesh triangles + + See also SURFACE_AREA, SURFACE_ORIENTATION, SURFACE_NORMALS, SURFACE_NESTING, SOLID_ANGLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/surface_inside.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("surface_inside", *args, **kwargs) diff --git a/fieldtrip/__inverse/_surface_orientation.py b/fieldtrip/__inverse/_surface_orientation.py new file mode 100644 index 0000000..30099ca --- /dev/null +++ b/fieldtrip/__inverse/_surface_orientation.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _surface_orientation(*args, **kwargs): + """ + SURFACE_ORIENTATION returns the string 'inward' or 'outward' or 'unknown', + depending on the surface orientation. + + Use as + str = surface_orientation(pos, tri) + or + str = surface_orientation(pos, tri, ori) + + See also SURFACE_AREA, SURFACE_NESTING, SURFACE_NORMALS, SURFACE_NESTING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/surface_orientation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("surface_orientation", *args, **kwargs) diff --git a/fieldtrip/__inverse/_translate.py b/fieldtrip/__inverse/_translate.py new file mode 100644 index 0000000..2fa6244 --- /dev/null +++ b/fieldtrip/__inverse/_translate.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _translate(*args, **kwargs): + """ + TRANSLATE returns the homogenous coordinate transformation matrix + corresponding to a translation along the x, y and z-axis + + Use as + [H] = translate(T) + where + T [tx, ty, tz] translation along each of the axes + H corresponding homogenous transformation matrix + + See also ROTATE, SCALE, RIGIDBODY, QUATERNION, HOMOGENOUS2TRADITIONAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/private/translate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("translate", *args, **kwargs) diff --git a/fieldtrip/__inverse/ft_inverse_dics.py b/fieldtrip/__inverse/ft_inverse_dics.py new file mode 100644 index 0000000..c58b3fb --- /dev/null +++ b/fieldtrip/__inverse/ft_inverse_dics.py @@ -0,0 +1,81 @@ +from fieldtrip._runtime import Runtime + + +def ft_inverse_dics(*args, **kwargs): + """ + FT_INVERSE_DICS scans on pre-defined dipole locations with a single dipole + and returns the beamformer spatial filter output for a dipole on every + location. + + Use as + [estimate] = ft_inverse_dics(sourcemodel, sens, headmodel, dat, cov, ...) + where + sourcemodel is the input source model, see FT_PREPARE_SOURCEMODEL + sens is the gradiometer or electrode definition, see FT_DATATYPE_SENS + headmodel is the volume conductor definition, see FT_PREPARE_HEADMODEL + dat is the data matrix with the ERP or ERF + cov is the data covariance or cross-spectral density matrix + and + estimate contains the estimated source parameters + + Additional input arguments should be specified as key-value pairs and can include + 'Pr' = power of the external reference channel + 'Cr' = cross spectral density between all data channels and the external reference channel + 'refdip' = location of dipole with which coherence is computed + 'powmethod' = can be 'trace' or 'lambda1' + 'feedback' = can be 'none', 'gui', 'dial', 'textbar', 'text', 'textcr', 'textnl' (default = 'text') + 'fixedori' = use fixed or free orientation, can be 'yes' or 'no' + 'projectnoise' = project noise estimate through filter, can be 'yes' or 'no' + 'realfilter' = construct a real-valued filter, can be 'yes' or 'no' + 'keepfilter' = remember the beamformer filter, can be 'yes' or 'no' + 'keepleadfield' = remember the forward computation, can be 'yes' or 'no' + 'keepcsd' = remember the estimated cross-spectral density, can be 'yes' or 'no' + 'weightnorm' = normalize the beamformer weights, can be 'no', 'unitnoisegain', 'arraygain', or 'nai' + + These options influence the forward computation of the leadfield + 'reducerank' = 'no' or number (default = 3 for EEG, 2 for MEG) + 'backproject' = 'yes' or 'no', in the case of a rank reduction this parameter determines whether the result will be backprojected onto the original subspace (default = 'yes') + 'normalize' = 'no', 'yes' or 'column' (default = 'no') + 'normalizeparam' = parameter for depth normalization (default = 0.5) + 'weight' = number or Nx1 vector, weight for each dipole position to compensate for the size of the corresponding patch (default = 1) + + These options influence the mathematical inversion of the cross-spectral density matrix + 'lambda' = regularisation parameter + 'kappa' = parameter for covariance matrix inversion + 'tol' = parameter for covariance matrix inversion + + If the dipole definition only specifies the dipole location, a rotating + dipole (regional source) is assumed on each location. If a dipole moment + is specified, its orientation will be used and only the strength will + be fitted to the data. + + See also FT_SOURCEANALYSIS, FT_PREPARE_HEADMODEL, FT_PREPARE_SOURCEMODEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/ft_inverse_dics.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_inverse_dics", *args, **kwargs) diff --git a/fieldtrip/__inverse/ft_inverse_dipolefit.py b/fieldtrip/__inverse/ft_inverse_dipolefit.py new file mode 100644 index 0000000..fd27ee8 --- /dev/null +++ b/fieldtrip/__inverse/ft_inverse_dipolefit.py @@ -0,0 +1,78 @@ +from fieldtrip._runtime import Runtime + + +def ft_inverse_dipolefit(*args, **kwargs): + """ + FT_INVERSE_DIPOLEFIT performs an equivalent current dipole fit with a single + or a small number of dipoles to explain an EEG or MEG scalp topography. + + Use as + [estimate] = ft_inverse_dipolefit(sourcemodel, sens, headmodel, dat, ...) + where + sourcemodel is the input source model with a single or a few dipoles + sens is the gradiometer or electrode definition, see FT_DATATYPE_SENS + headmodel is the volume conductor definition, see FT_PREPARE_HEADMODEL + dat is the data matrix with the ERP or ERF + and + estimate contains the estimated source parameters + + Additional input arguments should be specified as key-value pairs and can include + 'display' = Level of display [ off | iter | notify | final ] + 'optimfun' = Function to use [fminsearch | fminunc ] + 'maxiter' = Maximum number of function evaluations allowed [ positive integer ] + 'constr' = Structure with constraints + 'metric' = Error measure to be minimised [ rv | var | abs ] + 'checkinside' = Boolean flag to check whether dipole is inside source compartment [ 0 | 1 ] + 'mleweight' = weight matrix for maximum likelihood estimation, e.g. inverse noise covariance + + These options influence the forward computation of the leadfield + 'reducerank' = 'no' or number (default = 3 for EEG, 2 for MEG) + 'backproject' = 'yes' or 'no', in the case of a rank reduction this parameter determines whether the result will be backprojected onto the original subspace (default = 'yes') + 'normalize' = 'no', 'yes' or 'column' (default = 'no') + 'normalizeparam' = parameter for depth normalization (default = 0.5) + 'weight' = number or Nx1 vector, weight for each dipole position to compensate for the size of the corresponding patch (default = 1) + + The constraints on the source model are specified in a structure + constr.symmetry = boolean, dipole positions are symmetrically coupled to each other + constr.fixedori = boolean, keep dipole orientation fixed over whole data window + constr.rigidbody = boolean, keep relative position of multiple dipoles fixed + constr.mirror = vector, used for symmetric dipole models + constr.reduce = vector, used for symmetric dipole models + constr.expand = vector, used for symmetric dipole models + constr.sequential = boolean, fit different dipoles to sequential slices of the data + + The maximum likelihood estimation implements + - Lutkenhoner B. "Dipole source localization by means of maximum likelihood + estimation I. Theory and simulations" Electroencephalogr Clin Neurophysiol. 1998 + Apr;106(4):314-21. + + See also FT_DIPOLEFITTING, FT_SOURCEANALYSIS, FT_PREPARE_HEADMODEL, FT_PREPARE_SOURCEMODEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/ft_inverse_dipolefit.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_inverse_dipolefit", *args, **kwargs) diff --git a/fieldtrip/__inverse/ft_inverse_eloreta.py b/fieldtrip/__inverse/ft_inverse_eloreta.py new file mode 100644 index 0000000..3245862 --- /dev/null +++ b/fieldtrip/__inverse/ft_inverse_eloreta.py @@ -0,0 +1,70 @@ +from fieldtrip._runtime import Runtime + + +def ft_inverse_eloreta(*args, **kwargs): + """ + FT_INVERSE_ELORETA estimates the source activity using eLORETA + + Use as + [estimate] = ft_inverse_eloreta(sourcemodel, sens, headmodel, dat, cov, ...) + where + sourcemodel is the input source model, see FT_PREPARE_SOURCEMODEL + sens is the gradiometer or electrode definition, see FT_DATATYPE_SENS + headmodel is the volume conductor definition, see FT_PREPARE_HEADMODEL + dat is the data matrix with the ERP or ERF + cov is the data covariance or cross-spectral density matrix + and + estimate contains the estimated source parameters + + Additional input arguments should be specified as key-value pairs and can include + 'keepfilter' = remember the spatial filter, can be 'yes' or 'no' + 'keepleadfield' = remember the forward computation, can be 'yes' or 'no' + 'keepmom' = remember the dipole moment, can be 'yes' or 'no' + 'lambda' = scalar, regularisation parameter (default = 0.05) + + These options influence the forward computation of the leadfield + 'reducerank' = 'no' or number (default = 3 for EEG, 2 for MEG) + 'backproject' = 'yes' or 'no', in the case of a rank reduction this parameter determines whether the result will be backprojected onto the original subspace (default = 'yes') + 'normalize' = 'no', 'yes' or 'column' (default = 'no') + 'normalizeparam' = parameter for depth normalization (default = 0.5) + 'weight' = number or Nx1 vector, weight for each dipole position to compensate for the size of the corresponding patch (default = 1) + + If the dipole definition only specifies the dipole location, a rotating dipole + (regional source) is assumed on each location. If a dipole moment is specified, its + orientation will be used and only the strength will be fitted to the data. + + This implements: + - R.D. Pascual-Marqui; Discrete, 3D distributed, linear imaging methods of electric + neuronal activity. Part 1: exact, zero error localization. arXiv:0710.3341 + 2007-October-17, http://arxiv.org/pdf/0710.3341 + + See also FT_SOURCEANALYSIS, FT_PREPARE_HEADMODEL, FT_PREPARE_SOURCEMODEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/ft_inverse_eloreta.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_inverse_eloreta", *args, **kwargs) diff --git a/fieldtrip/__inverse/ft_inverse_harmony.py b/fieldtrip/__inverse/ft_inverse_harmony.py new file mode 100644 index 0000000..e6a20eb --- /dev/null +++ b/fieldtrip/__inverse/ft_inverse_harmony.py @@ -0,0 +1,72 @@ +from fieldtrip._runtime import Runtime + + +def ft_inverse_harmony(*args, **kwargs): + """ + FT_INVERSE_HARMONY computes a linear estimate of the current in a distributed + source model using a mesh harmonic based low-pass filter. + + Use as + [estimate] = ft_inverse_harmony(sourcemodel, sens, headmodel, dat, ...) + where + sourcemodel is the input source model, see FT_PREPARE_SOURCEMODEL + sens is the gradiometer or electrode definition, see FT_DATATYPE_SENS + headmodel is the volume conductor definition, see FT_PREPARE_HEADMODEL + dat is the data matrix with the ERP or ERF + and + estimate contains the estimated source parameters + + Additional input arguments should be specified as key-value pairs and can include + 'noisecov' = Nchan x Nchan matrix with noise covariance + 'noiselambda' = scalar value, regularisation parameter for the noise covariance matrix (default=0) + 'filter_order' = scalar, order of the mesh Butterwirth filter + 'filter_bs' = scalar, stop-band of the mesh Butterworth filter + 'number_harmonics' = Integer, number of mesh harmonics used (can be empty, the default will then be identity) + 'lambda' = scalar, regularisation parameter (can be empty, it will then be estimated from snr) + 'snr' = scalar, signal to noise ratio + 'scalesourcecov' = 'no' or 'yes', scale the source covariance matrix R such that trace(leadfield*R*leadfield')/trace(C)=1 + 'connected_components' = number of connected components of the source mesh (1 or 2) + 'prewhiten' = 'no' or 'yes', prewhiten the leadfield matrix with the noise covariance matrix C + + These options influence the forward computation of the leadfield + 'reducerank' = 'no' or number (default = 3 for EEG, 2 for MEG) + 'backproject' = 'yes' or 'no', in the case of a rank reduction this parameter determines whether the result will be backprojected onto the original subspace (default = 'yes') + 'normalize' = 'no', 'yes' or 'column' (default = 'no') + 'normalizeparam' = parameter for depth normalization (default = 0.5) + 'weight' = number or Nx1 vector, weight for each dipole position to compensate for the size of the corresponding patch (default = 1) + + This implements + - Petrov Y (2012) Harmony: EEG/MEG Linear Inverse Source Reconstruction in the + Anatomical Basis of Spherical Harmonics. PLoS ONE 7(10): e44439. + doi:10.1371/journal.pone.0044439 + + See also FT_SOURCEANALYSIS, FT_PREPARE_HEADMODEL, FT_PREPARE_SOURCEMODEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/ft_inverse_harmony.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_inverse_harmony", *args, **kwargs) diff --git a/fieldtrip/__inverse/ft_inverse_lcmv.py b/fieldtrip/__inverse/ft_inverse_lcmv.py new file mode 100644 index 0000000..b0243f2 --- /dev/null +++ b/fieldtrip/__inverse/ft_inverse_lcmv.py @@ -0,0 +1,80 @@ +from fieldtrip._runtime import Runtime + + +def ft_inverse_lcmv(*args, **kwargs): + """ + FT_INVERSE_LCMV scans on pre-defined dipole locations with a single dipole + and returns the linear constrained minimum variance beamformer spatial filter + output for a dipole on every location. + + Use as + [estimate] = ft_inverse_lcmv(sourcemodel, sens, headmodel, dat, cov, ...) + where + sourcemodel is the input source model, see FT_PREPARE_SOURCEMODEL + sens is the gradiometer or electrode definition, see FT_DATATYPE_SENS + headmodel is the volume conductor definition, see FT_PREPARE_HEADMODEL + dat is the data matrix with the ERP or ERF + cov is the data covariance or cross-spectral density matrix + and + estimate contains the estimated source parameters + + Additional input arguments should be specified as key-value pairs and can include + 'powmethod' = can be 'trace' or 'lambda1' + 'feedback' = can be 'none', 'gui', 'dial', 'textbar', 'text', 'textcr', 'textnl' (default = 'text') + 'fixedori' = use fixed or free orientation, can be 'yes' or 'no' + 'projectnoise' = project noise estimate through filter, can be 'yes' or 'no' + 'projectmom' = project the dipole moment timecourse on the direction of maximal power, can be 'yes' or 'no' + 'keepfilter' = remember the beamformer filter, can be 'yes' or 'no' + 'keepleadfield' = remember the forward computation, can be 'yes' or 'no' + 'keepmom' = remember the estimated dipole moment timeseries, can be 'yes' or 'no' + 'keepcov' = remember the estimated dipole covariance, can be 'yes' or 'no' + 'kurtosis' = compute the kurtosis of the dipole timeseries, can be 'yes' or 'no' + 'weightnorm' = normalize the beamformer weights, can be 'no', 'unitnoisegain', 'arraygain' or 'nai' + + These options influence the forward computation of the leadfield + 'reducerank' = 'no' or number (default = 3 for EEG, 2 for MEG) + 'backproject' = 'yes' or 'no', in the case of a rank reduction this parameter determines whether the result will be backprojected onto the original subspace (default = 'yes') + 'normalize' = 'no', 'yes' or 'column' (default = 'no') + 'normalizeparam' = parameter for depth normalization (default = 0.5) + 'weight' = number or Nx1 vector, weight for each dipole position to compensate for the size of the corresponding patch (default = 1) + + These options influence the mathematical inversion of the covariance matrix + 'lambda' = regularisation parameter + 'kappa' = parameter for covariance matrix inversion + 'tol' = parameter for covariance matrix inversion + + If the dipole definition only specifies the dipole location, a rotating + dipole (regional source) is assumed on each location. If a dipole moment + is specified, its orientation will be used and only the strength will + be fitted to the data. + + See also FT_SOURCEANALYSIS, FT_PREPARE_HEADMODEL, FT_PREPARE_SOURCEMODEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/ft_inverse_lcmv.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_inverse_lcmv", *args, **kwargs) diff --git a/fieldtrip/__inverse/ft_inverse_mne.py b/fieldtrip/__inverse/ft_inverse_mne.py new file mode 100644 index 0000000..a967928 --- /dev/null +++ b/fieldtrip/__inverse/ft_inverse_mne.py @@ -0,0 +1,78 @@ +from fieldtrip._runtime import Runtime + + +def ft_inverse_mne(*args, **kwargs): + """ + FT_INVERSE_MNE computes a minimum norm linear estimate of the current in a + distributed source model. + + Use as + [estimate] = ft_inverse_mne(sourcemodel, sens, headmodel, dat, ...) + where + sourcemodel is the input source model, see FT_PREPARE_SOURCEMODEL + sens is the gradiometer or electrode definition, see FT_DATATYPE_SENS + headmodel is the volume conductor definition, see FT_PREPARE_HEADMODEL + dat is the data matrix with the ERP or ERF + and + estimate contains the estimated source parameters + + Additional input arguments should be specified as key-value pairs and can include + 'noisecov' = Nchan x Nchan matrix with noise covariance + 'noiselambda' = scalar value, regularisation parameter for the noise covariance matrix (default = 0) + 'sourcecov' = Nsource x Nsource matrix with source covariance (can be empty, the default will then be identity) + 'lambda' = scalar, regularisation parameter (can be empty, it will then be estimated from snr) + 'snr' = scalar, signal to noise ratio + 'keepfilter' = 'no' or 'yes', keep the spatial filter in the output + 'prewhiten' = 'no' or 'yes', prewhiten the leadfield matrix with the noise covariance matrix C + 'scalesourcecov' = 'no' or 'yes', scale the source covariance matrix R such that trace(leadfield*R*leadfield')/trace(C)=1 + + These options influence the forward computation of the leadfield + 'reducerank' = 'no' or number (default = 3 for EEG, 2 for MEG) + 'backproject' = 'yes' or 'no', in the case of a rank reduction this parameter determines whether the result will be backprojected onto the original subspace (default = 'yes') + 'normalize' = 'no', 'yes' or 'column' (default = 'no') + 'normalizeparam' = parameter for depth normalization (default = 0.5) + 'weight' = number or Nx1 vector, weight for each dipole position to compensate for the size of the corresponding patch (default = 1) + + This implements + - Dale AM, Liu AK, Fischl B, Buckner RL, Belliveau JW, Lewine JD, + Halgren E (2000): Dynamic statistical parametric mapping: combining fMRI and MEG + to produce high-resolution spatiotemporal maps of cortical activity. Neuron + 26:55-67. + - Arthur K. Liu, Anders M. Dale, and John W. Belliveau (2002): Monte + Carlo Simulation Studies of EEG and MEG Localization Accuracy. Human Brain + Mapping 16:47-62. + - Fa-Hsuan Lin, Thomas Witzel, Matti S. Hamalainen, Anders M. Dale, + John W. Belliveau, and Steven M. Stufflebeam (2004): Spectral spatiotemporal + imaging of cortical oscillations and interactions in the human brain. NeuroImage + 23:582-595. + + See also FT_SOURCEANALYSIS, FT_PREPARE_HEADMODEL, FT_PREPARE_SOURCEMODEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/ft_inverse_mne.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_inverse_mne", *args, **kwargs) diff --git a/fieldtrip/__inverse/ft_inverse_music.py b/fieldtrip/__inverse/ft_inverse_music.py new file mode 100644 index 0000000..312d1f7 --- /dev/null +++ b/fieldtrip/__inverse/ft_inverse_music.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def ft_inverse_music(*args, **kwargs): + """ + FT_INVERSE_MUSIC source localization using MUltiple SIgnal Classification. + This is a signal subspace method, which covers the techniques for + multiple source localization by using the eigen-structure of the + measured data matrix. + + Use as + [estimate] = ft_inverse_music(sourcemodel, sens, headmodel, dat, ...) + where + sourcemodel is the input source model, see FT_PREPARE_SOURCEMODEL + sens is the gradiometer or electrode definition, see FT_DATATYPE_SENS + headmodel is the volume conductor definition, see FT_PREPARE_HEADMODEL + dat is the data matrix with the ERP or ERF + and + estimate contains the estimated source parameters + + Additional input arguments should be specified as key-value pairs and can include + 'cov' = data covariance matrix + 'numcomponent' = integer number + 'feedback' = can be 'none', 'gui', 'dial', 'textbar', 'text', 'textcr', 'textnl' (default = 'text') + + These options influence the forward computation of the leadfield + 'reducerank' = 'no' or number (default = 3 for EEG, 2 for MEG) + 'backproject' = 'yes' or 'no', in the case of a rank reduction this parameter determines whether the result will be backprojected onto the original subspace (default = 'yes') + 'normalize' = 'no', 'yes' or 'column' (default = 'no') + 'normalizeparam' = parameter for depth normalization (default = 0.5) + 'weight' = number or Nx1 vector, weight for each dipole position to compensate for the size of the corresponding patch (default = 1) + + This implements + - J.C. Mosher, P.S. Lewis and R.M. Leahy, "Multiple dipole modeling and + localization from spatiotemporal MEG data", IEEE Trans. Biomed. Eng., + pp 541-557, June, 1992. + + See also FT_SOURCEANALYSIS, FT_PREPARE_HEADMODEL, FT_PREPARE_SOURCEMODEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/ft_inverse_music.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_inverse_music", *args, **kwargs) diff --git a/fieldtrip/__inverse/ft_inverse_pcc.py b/fieldtrip/__inverse/ft_inverse_pcc.py new file mode 100644 index 0000000..5effc6a --- /dev/null +++ b/fieldtrip/__inverse/ft_inverse_pcc.py @@ -0,0 +1,74 @@ +from fieldtrip._runtime import Runtime + + +def ft_inverse_pcc(*args, **kwargs): + """ + FT_INVERSE_PCC implements a linearly-constrained miminum variance beamformer that + allows for post-hoc computation of canonical or partial coherence or correlation. + Moreover, if cortico-cortical interactions are computed, the spatial filters are + computed with a paired dipole as sourcemodel, thus suppressing the distortive + effect of correlated activity from the seed region. + + Use as + [estimate] = ft_inverse_pcc(sourcemodel, sens, headmodel, dat, cov, ...) + where + sourcemodel is the input source model, see FT_PREPARE_SOURCEMODEL + sens is the gradiometer or electrode definition, see FT_DATATYPE_SENS + headmodel is the volume conductor definition, see FT_PREPARE_HEADMODEL + dat is the data matrix with the ERP or ERF + cov is the data covariance or cross-spectral density matrix + and + estimate contains the estimated source parameters + + Additional input arguments should be specified as key-value pairs and can include + 'refchan' + 'refdip' + 'supchan' + 'supdip' + 'feedback' + 'keepcsd' + 'keepfilter' + 'keepleadfield' + 'keepmom' + 'lambda' + 'projectnoise' + 'realfilter' + 'fixedori' + + These options influence the forward computation of the leadfield + 'reducerank' = 'no' or number (default = 3 for EEG, 2 for MEG) + 'backproject' = 'yes' or 'no', in the case of a rank reduction this parameter determines whether the result will be backprojected onto the original subspace (default = 'yes') + 'normalize' = 'no', 'yes' or 'column' (default = 'no') + 'normalizeparam' = parameter for depth normalization (default = 0.5) + 'weight' = number or Nx1 vector, weight for each dipole position to compensate for the size of the corresponding patch (default = 1) + + See also FT_SOURCEANALYSIS, FT_PREPARE_HEADMODEL, FT_PREPARE_SOURCEMODEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/ft_inverse_pcc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_inverse_pcc", *args, **kwargs) diff --git a/fieldtrip/__inverse/ft_inverse_rv.py b/fieldtrip/__inverse/ft_inverse_rv.py new file mode 100644 index 0000000..c43205c --- /dev/null +++ b/fieldtrip/__inverse/ft_inverse_rv.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def ft_inverse_rv(*args, **kwargs): + """ + FT_INVERSE_RV scan with a single dipole and computes the residual variance + at each dipole location. + + Use as + [estimate] = ft_inverse_rv(sourcemodel, sens, headmodel, dat, ...) + where + sourcemodel is the input source model, see FT_PREPARE_SOURCEMODEL + sens is the gradiometer or electrode definition, see FT_DATATYPE_SENS + headmodel is the volume conductor definition, see FT_PREPARE_HEADMODEL + dat is the data matrix with the ERP or ERF + and + estimate contains the estimated source parameters + + Additional input arguments should be specified as key-value pairs and can include + 'feedback' = can be 'none', 'gui', 'dial', 'textbar', 'text', 'textcr', 'textnl' (default = 'text') + + These options influence the forward computation of the leadfield + 'reducerank' = 'no' or number (default = 3 for EEG, 2 for MEG) + 'backproject' = 'yes' or 'no', in the case of a rank reduction this parameter determines whether the result will be backprojected onto the original subspace (default = 'yes') + 'normalize' = 'no', 'yes' or 'column' (default = 'no') + 'normalizeparam' = parameter for depth normalization (default = 0.5) + 'weight' = number or Nx1 vector, weight for each dipole position to compensate for the size of the corresponding patch (default = 1) + + See also FT_SOURCEANALYSIS, FT_PREPARE_HEADMODEL, FT_PREPARE_SOURCEMODEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/ft_inverse_rv.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_inverse_rv", *args, **kwargs) diff --git a/fieldtrip/__inverse/ft_inverse_sam.py b/fieldtrip/__inverse/ft_inverse_sam.py new file mode 100644 index 0000000..b2f26a3 --- /dev/null +++ b/fieldtrip/__inverse/ft_inverse_sam.py @@ -0,0 +1,68 @@ +from fieldtrip._runtime import Runtime + + +def ft_inverse_sam(*args, **kwargs): + """ + FT_INVERSE_SAM scans on pre-defined dipole locations with a single dipole and + returns the Synthetic Aperture Magnetometry (SAM) beamformer estimates. + + Use as + [estimate] = ft_inverse_sam(sourcemodel, sens, headmodel, dat, cov, ...) + where + sourcemodel is the input source model, see FT_PREPARE_SOURCEMODEL + sens is the gradiometer or electrode definition, see FT_DATATYPE_SENS + headmodel is the volume conductor definition, see FT_PREPARE_HEADMODEL + dat is the data matrix with the ERP or ERF + cov is the data covariance or cross-spectral density matrix + and + estimate contains the estimated source parameters + + Additional input arguments should be specified as key-value pairs and can include + 'feedback' + 'fixedori' deprecated, control behaviour via 'reducerank' instead + 'noisecov' + 'toi' + + If no orientation is specified, the SAM beamformer will try to estimate the orientation from the data. + The beamformer will either try to estimate the whole orientation, or only its tangential component. + This is controlled by the 'reducerank' parameter. For reducerank=3, the whole orientation is estimated, + and for reducerank=2 only the tangential component is estimated, based on an svd of the dipole's leadfield, + treating the 3d component as the 'radial' orientation. + + These options influence the forward computation of the leadfield, if it has not yet been precomputed + 'reducerank' = 'no' or number (default = 3 for EEG, 2 for MEG) + 'backproject' = 'yes' or 'no', in the case of a rank reduction this parameter determines whether the result will be backprojected onto the original subspace (default = 'yes') + 'normalize' = 'no', 'yes' or 'column' (default = 'no') + 'normalizeparam' = parameter for depth normalization (default = 0.5) + 'weight' = number or Nx1 vector, weight for each dipole position to compensate for the size of the corresponding patch (default = 1) + + See also FT_SOURCEANALYSIS, FT_PREPARE_HEADMODEL, FT_PREPARE_SOURCEMODEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/ft_inverse_sam.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_inverse_sam", *args, **kwargs) diff --git a/fieldtrip/__inverse/ft_inverse_sloreta.py b/fieldtrip/__inverse/ft_inverse_sloreta.py new file mode 100644 index 0000000..9fd8f93 --- /dev/null +++ b/fieldtrip/__inverse/ft_inverse_sloreta.py @@ -0,0 +1,73 @@ +from fieldtrip._runtime import Runtime + + +def ft_inverse_sloreta(*args, **kwargs): + """ + FT_INVERSE_SLORETA scans on pre-defined dipole locations with a single dipole and + returns the sLORETA spatial filter output for a dipole on every location. + + Use as + [estimate] = ft_inverse_sloreta(sourcemodel, sens, headmodel, dat, cov, ...) + where + sourcemodel is the input source model, see FT_PREPARE_SOURCEMODEL + sens is the gradiometer or electrode definition, see FT_DATATYPE_SENS + headmodel is the volume conductor definition, see FT_PREPARE_HEADMODEL + dat is the data matrix with the ERP or ERF + cov is the data covariance or cross-spectral density matrix + and + estimate contains the estimated source parameters + + Additional input arguments should be specified as key-value pairs and can include + 'lambda' = regularisation parameter + 'powmethod' = can be 'trace' or 'lambda1' + 'feedback' = can be 'none', 'gui', 'dial', 'textbar', 'text', 'textcr', 'textnl' (default = 'text') + 'fixedori' = use fixed or free orientation, can be 'yes' or 'no' + 'projectnoise' = project noise estimate through filter, can be 'yes' or 'no' + 'projectmom' = project the dipole moment timecourse on the direction of maximal power, can be 'yes' or 'no' + 'keepfilter' = remember the spatial filter, can be 'yes' or 'no' + 'keepleadfield' = remember the forward computation, can be 'yes' or 'no' + 'keepmom' = remember the estimated dipole moment timeseries, can be 'yes' or 'no' + 'keepcov' = remember the estimated dipole covariance, can be 'yes' or 'no' + 'kurtosis' = compute the kurtosis of the dipole timeseries, can be 'yes' or 'no' + + These options influence the forward computation of the leadfield + 'reducerank' = 'no' or number (default = 3 for EEG, 2 for MEG) + 'backproject' = 'yes' or 'no', in the case of a rank reduction this parameter determines whether the result will be backprojected onto the original subspace (default = 'yes') + 'normalize' = 'no', 'yes' or 'column' (default = 'no') + 'normalizeparam' = parameter for depth normalization (default = 0.5) + 'weight' = number or Nx1 vector, weight for each dipole position to compensate for the size of the corresponding patch (default = 1) + + If the dipole definition only specifies the dipole location, a rotating dipole + (regional source) is assumed on each location. If a dipole moment is specified, its + orientation will be used and only the strength will be fitted to the data. + + See also FT_SOURCEANALYSIS, FT_PREPARE_HEADMODEL, FT_PREPARE_SOURCEMODEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/inverse/ft_inverse_sloreta.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_inverse_sloreta", *args, **kwargs) diff --git a/fieldtrip/__plotting/__init__.py b/fieldtrip/__plotting/__init__.py new file mode 100644 index 0000000..c8f0bbc --- /dev/null +++ b/fieldtrip/__plotting/__init__.py @@ -0,0 +1,62 @@ +from .ft_colormap import ft_colormap +from .ft_headlight import ft_headlight +from .ft_plot_axes import ft_plot_axes +from .ft_plot_box import ft_plot_box +from .ft_plot_cloud import ft_plot_cloud +from .ft_plot_crosshair import ft_plot_crosshair +from .ft_plot_dipole import ft_plot_dipole +from .ft_plot_headmodel import ft_plot_headmodel +from .ft_plot_headshape import ft_plot_headshape +from .ft_plot_layout import ft_plot_layout +from .ft_plot_line import ft_plot_line +from .ft_plot_matrix import ft_plot_matrix +from .ft_plot_mesh import ft_plot_mesh +from .ft_plot_montage import ft_plot_montage +from .ft_plot_ortho import ft_plot_ortho +from .ft_plot_patch import ft_plot_patch +from .ft_plot_sens import ft_plot_sens +from .ft_plot_slice import ft_plot_slice +from .ft_plot_text import ft_plot_text +from .ft_plot_topo import ft_plot_topo +from .ft_plot_topo3d import ft_plot_topo3d +from .ft_plot_vector import ft_plot_vector +from .ft_select_box import ft_select_box +from .ft_select_channel import ft_select_channel +from .ft_select_point import ft_select_point +from .ft_select_point3d import ft_select_point3d +from .ft_select_range import ft_select_range +from .ft_select_voxel import ft_select_voxel +from .ft_uilayout import ft_uilayout + + +__all__ = [ + "ft_colormap", + "ft_headlight", + "ft_plot_axes", + "ft_plot_box", + "ft_plot_cloud", + "ft_plot_crosshair", + "ft_plot_dipole", + "ft_plot_headmodel", + "ft_plot_headshape", + "ft_plot_layout", + "ft_plot_line", + "ft_plot_matrix", + "ft_plot_mesh", + "ft_plot_montage", + "ft_plot_ortho", + "ft_plot_patch", + "ft_plot_sens", + "ft_plot_slice", + "ft_plot_text", + "ft_plot_topo", + "ft_plot_topo3d", + "ft_plot_vector", + "ft_select_box", + "ft_select_channel", + "ft_select_point", + "ft_select_point3d", + "ft_select_range", + "ft_select_voxel", + "ft_uilayout", +] diff --git a/fieldtrip/__plotting/_atlas_lookup.py b/fieldtrip/__plotting/_atlas_lookup.py new file mode 100644 index 0000000..4f0697d --- /dev/null +++ b/fieldtrip/__plotting/_atlas_lookup.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _atlas_lookup(*args, **kwargs): + """ + ATLAS_LOOKUP determines the anatomical label of a location in the given atlas. + + Use as + label = atlas_lookup(atlas, pos, ...); + + Optional input arguments should come in key-value pairs and can include + 'method' = 'sphere' (default) searches surrounding voxels in a sphere + 'cube' searches surrounding voxels in a cube + 'queryrange' = number, should be 1, 3, 5, 7, 9 or 11 (default = 3) + 'coordsys' = 'mni' or 'tal' (default = []) + + Dependent on the coordinates if the input points and the coordinates of the atlas, + the input positions are transformed between MNI and Talairach-Tournoux coordinates. + See http://www.mrc-cbu.cam.ac.uk/Imaging/Common/mnispace.shtml for more details. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/atlas_lookup.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("atlas_lookup", *args, **kwargs) diff --git a/fieldtrip/__plotting/_bg_rgba2rgb.py b/fieldtrip/__plotting/_bg_rgba2rgb.py new file mode 100644 index 0000000..ae2c80d --- /dev/null +++ b/fieldtrip/__plotting/_bg_rgba2rgb.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def _bg_rgba2rgb(*args, **kwargs): + """ + BG_RGBA2RGB overlays a transparency masked colored image on a colored background, + and represents the result as an RGB matrix. + + Use as: + rgb = bg_rgba2rgb(bg, rgba) + + or + rgb = bg_rgba2rgb(bg, rgba, cmap, clim, alpha, amap, alim); + + When 2 input arguments are supplied: + bg = Nx3 matrix of background rgb-coded color-values, or MxNx3 + rgba = Nx4 matrix of rgb + alpha values, or MxNx4 + + When 7 input arguments are supplied: + bg = Nx3 matrix, Nx1 vector, 1x3 vector, MxN, or MxNx3. + rgba = Nx1 vector with 'functional values', or MxN. + cmap = Mx3 colormap, or MATLAB-supported name of colormap + clim = 1x2 vector denoting the color limits + alpha = Nx1 vector with 'alpha values', or MxN + amap = Mx1 alphamap, or MATLAB -supported name of alphamap ('rampup/down', 'vup/down') + alim = 1x2 vector denoting the opacity limits + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/bg_rgba2rgb.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("bg_rgba2rgb", *args, **kwargs) diff --git a/fieldtrip/__plotting/_cdat2rgb.py b/fieldtrip/__plotting/_cdat2rgb.py new file mode 100644 index 0000000..e06baf6 --- /dev/null +++ b/fieldtrip/__plotting/_cdat2rgb.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _cdat2rgb(*args, **kwargs): + """ + This function changes the color of pixels to white, regardless of colormap, without using opengl + It does by converting by: + 1) convert the to-be-plotted data to their respective rgb color values (determined by colormap) + 2) convert these rgb color values to hsv values, hue-saturation-value + 3) for to-be-masked-pixels, set saturation to 0 and value to 1 (hue is irrelevant when they are) + 4) convert the hsv values back to rgb values + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/cdat2rgb.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("cdat2rgb", *args, **kwargs) diff --git a/fieldtrip/__plotting/_channelposition.py b/fieldtrip/__plotting/_channelposition.py new file mode 100644 index 0000000..41deffd --- /dev/null +++ b/fieldtrip/__plotting/_channelposition.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _channelposition(*args, **kwargs): + """ + CHANNELPOSITION computes the channel positions and orientations from the + MEG coils, EEG electrodes or NIRS optodes + + Use as + [pos, ori, lab] = channelposition(sens) + where sens is an gradiometer, electrode, or optode array. + + See also FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/channelposition.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("channelposition", *args, **kwargs) diff --git a/fieldtrip/__plotting/_colorspec2rgb.py b/fieldtrip/__plotting/_colorspec2rgb.py new file mode 100644 index 0000000..d523fac --- /dev/null +++ b/fieldtrip/__plotting/_colorspec2rgb.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def _colorspec2rgb(*args, **kwargs): + """ + COLORSPEC2RGB converts the string color specification into the corresponding RGB + triplet(s), unless the string equals 'none', or is a hexadecimal (starting with #). + The optional second input argument determines the number of rows in the output Nx3 matrix, + when applicable. + + If the first input argument equals 'none', or starts with a '#', the output will be + the same as the input argument, and the assumption is that the downstream function + that uses the colorspec knows how to deal with this. Otherwise, a Nx3 matrix or 1x3 + vector will be returned. + + If the input string contains only characters from the following sequence + 'ymcrgbwk', an Mx3 matrix will be returned, where M is the number of characters in + the input string. If a second input argument N is defined (N>M), the output will be + expanded to have N number of rows. + + Otherwise, colorspec2rgb checks whether the input is a valid name for one of the + colors htmlcolors or standardcolors. If this also fails, colorspec2rgb checks + whether the colorspec defines a supported FieldTrip colormap. If this also fails, + an error is thrown. + + See https://nl.mathworks.com/help/matlab/creating_plots/specify-plot-colors.html + and https://nl.mathworks.com/matlabcentral/fileexchange/48155-convert-between-rgb-and-color-names + + See also HTMLCOLORS, STANDARDCOLORS, FT_COLORMAP, COLORMAP, COLORMAPEDITOR, BREWERMAP, MATPLOTLIB, CMOCEAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/colorspec2rgb.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("colorspec2rgb", *args, **kwargs) diff --git a/fieldtrip/__plotting/_combineClusters.py b/fieldtrip/__plotting/_combineClusters.py new file mode 100644 index 0000000..6226c98 --- /dev/null +++ b/fieldtrip/__plotting/_combineClusters.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _combineClusters(*args, **kwargs): + """ + COMBINECLUSTERS is a helper function for FINDCLUSTER. It searches for + adjacent clusters in neighbouring channels and combines them. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/combineClusters.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("combineClusters", *args, **kwargs) diff --git a/fieldtrip/__plotting/_coordsys2label.py b/fieldtrip/__plotting/_coordsys2label.py new file mode 100644 index 0000000..68a2bd8 --- /dev/null +++ b/fieldtrip/__plotting/_coordsys2label.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _coordsys2label(*args, **kwargs): + """ + COORDSYS2LABEL returns the labels for the three axes, given the symbolic + string representation of the coordinate system. + + Use as + [labelx, labely, labelz] = coordsys2label(coordsys, format, both) + + The scalar argument 'format' results in return values like these + 0) 'R' + 1) 'right' + 2) 'the right' + 3) '+X (right)' + + The boolean argument 'both' results in return values like these + 0) 'right' i.e. only the direction that it is pointing to + 1) {'left' 'right'} i.e. both the directions that it is pointing from and to + + See also FT_DETERMINE_COORDSYS, FT_PLOT_AXES, FT_HEADCOORDINATES, SETVIEWPOINT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/coordsys2label.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("coordsys2label", *args, **kwargs) diff --git a/fieldtrip/__plotting/_cornerpoints.py b/fieldtrip/__plotting/_cornerpoints.py new file mode 100644 index 0000000..ee37f91 --- /dev/null +++ b/fieldtrip/__plotting/_cornerpoints.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _cornerpoints(*args, **kwargs): + """ + CORNERPOINTS returns the eight corner points of an anatomical volume + in voxel and in head coordinates + + Use as + [voxel, head] = cornerpoints(dim, transform) + which will return two 8x3 matrices. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/cornerpoints.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("cornerpoints", *args, **kwargs) diff --git a/fieldtrip/__plotting/_defaultId.py b/fieldtrip/__plotting/_defaultId.py new file mode 100644 index 0000000..5789130 --- /dev/null +++ b/fieldtrip/__plotting/_defaultId.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _defaultId(*args, **kwargs): + """ + DEFAULTID returns a string that can serve as warning or error identifier, + for example 'FieldTip:ft_read_header:line345'. + + See also WARNING, ERROR, FT_NOTICE, FT_INFO, FT_DEBUG + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/defaultId.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("defaultId", *args, **kwargs) diff --git a/fieldtrip/__plotting/_dist.py b/fieldtrip/__plotting/_dist.py new file mode 100644 index 0000000..9a195a0 --- /dev/null +++ b/fieldtrip/__plotting/_dist.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _dist(*args, **kwargs): + """ + DIST computes the euclidean distance between the columns of the input matrix + + Use as + [d] = dist(x) + where x is for example an 3xN matrix with positions in 3D space. + + This function serves as a replacement for the dist function in the Neural + Networks toolbox. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/dist.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("dist", *args, **kwargs) diff --git a/fieldtrip/__plotting/_elproj.py b/fieldtrip/__plotting/_elproj.py new file mode 100644 index 0000000..dafaa4a --- /dev/null +++ b/fieldtrip/__plotting/_elproj.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def _elproj(*args, **kwargs): + """ + ELPROJ makes a azimuthal projection of a 3D electrode cloud on a plane tangent to + the sphere fitted through the electrodes. The projection is along the z-axis. + + Use as + proj = elproj([x, y, z], 'method'); + + Method should be one of these: + 'gnomic' + 'stereographic' + 'orthographic' + 'inverse' + 'polar' + + Imagine a plane being placed against (tangent to) a globe. If + a light source inside the globe projects the graticule onto + the plane the result would be a planar, or azimuthal, map + projection. If the imaginary light is inside the globe a Gnomonic + projection results, if the light is antipodal a Sterographic, + and if at infinity, an Orthographic. + + The default projection is a BESA-like polar projection. + An inverse projection is the opposite of the default polar projection. + + See also PROJECTTRI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/elproj.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("elproj", *args, **kwargs) diff --git a/fieldtrip/__plotting/_find_mesh_edge.py b/fieldtrip/__plotting/_find_mesh_edge.py new file mode 100644 index 0000000..56d5ddb --- /dev/null +++ b/fieldtrip/__plotting/_find_mesh_edge.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _find_mesh_edge(*args, **kwargs): + """ + FIND_MESH_EDGE returns the edge of a triangulated mesh + + [pnt, line] = find_mesh_edge(pnt, tri), where + + pnt contains the vertex locations and + line contains the indices of the linepieces connecting the vertices + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/find_mesh_edge.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("find_mesh_edge", *args, **kwargs) diff --git a/fieldtrip/__plotting/_find_triangle_neighbours.py b/fieldtrip/__plotting/_find_triangle_neighbours.py new file mode 100644 index 0000000..1e17208 --- /dev/null +++ b/fieldtrip/__plotting/_find_triangle_neighbours.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _find_triangle_neighbours(*args, **kwargs): + """ + FIND_TRIANGLE_NEIGHBOURS determines the three neighbours for each triangle + in a mesh. It returns NaN's if the triangle does not have a neighbour on + that particular side. + + [nb] = find_triangle_neighbours(pnt, tri) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/find_triangle_neighbours.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("find_triangle_neighbours", *args, **kwargs) diff --git a/fieldtrip/__plotting/_findcluster.py b/fieldtrip/__plotting/_findcluster.py new file mode 100644 index 0000000..3e1baee --- /dev/null +++ b/fieldtrip/__plotting/_findcluster.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def _findcluster(*args, **kwargs): + """ + FINDCLUSTER returns all connected clusters for a three-dimensional six-connected + neighborhood + + Use as + [cluster, num] = findcluster(onoff, spatdimneighbstructmat, minnbchan) + or ar + [cluster, num] = findcluster(onoff, spatdimneighbstructmat, spatdimneighbselmat, minnbchan) + where + onoff = is a 3D boolean matrix with size N1xN2xN3 + spatdimneighbstructmat = defines the neighbouring channels/combinations, see below + minnbchan = the minimum number of neighbouring channels/combinations + spatdimneighbselmat = is a special neighbourhood matrix that is used for selecting + channels/combinations on the basis of the minnbchan criterium + + The neighbourhood structure for the first dimension is specified using + spatdimneighbstructmat, which is a 2D (N1xN1) matrix. Each row and each column + corresponds to a channel (combination) along the first dimension and along that + row/column, elements with "1" define the neighbouring channel(s) (combinations). + The first dimension of onoff should correspond to the channel(s) (combinations). + + See also SPM_BWLABEL, BWLABEL, BWLABELN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/findcluster.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("findcluster", *args, **kwargs) diff --git a/fieldtrip/__plotting/_fitsphere.py b/fieldtrip/__plotting/_fitsphere.py new file mode 100644 index 0000000..2d3d6ae --- /dev/null +++ b/fieldtrip/__plotting/_fitsphere.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _fitsphere(*args, **kwargs): + """ + FITSPHERE fits the centre and radius of a sphere to a set of points + using Taubin's method. + + Use as + [center,radius] = fitsphere(pnt) + where + pnt = Nx3 matrix with the Cartesian coordinates of the surface points + and + center = the center of the fitted sphere + radius = the radius of the fitted sphere + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/fitsphere.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fitsphere", *args, **kwargs) diff --git a/fieldtrip/__plotting/_fixbalance.py b/fieldtrip/__plotting/_fixbalance.py new file mode 100644 index 0000000..83eb1be --- /dev/null +++ b/fieldtrip/__plotting/_fixbalance.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _fixbalance(*args, **kwargs): + """ + FIXBALANCE ensures that the balancing representation in grad.balance or + elec.balance field is up to date and consistent, specifically with the + list of linear projections (or montages) being applied specified as + cell-array in "current", and not as a string in "current" and cell-array + in "previous". + + See also FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/fixbalance.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixbalance", *args, **kwargs) diff --git a/fieldtrip/__plotting/_fixcoordsys.py b/fieldtrip/__plotting/_fixcoordsys.py new file mode 100644 index 0000000..10ea4f4 --- /dev/null +++ b/fieldtrip/__plotting/_fixcoordsys.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _fixcoordsys(*args, **kwargs): + """ + FIXCOORDSYS ensures that the coordinate system is consistently + described. E.g. SPM and MNI are technically the same coordinate + system, but the strings 'spm' and 'mni' are different. + + See also FT_DETERMINE_COORDSYS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/fixcoordsys.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixcoordsys", *args, **kwargs) diff --git a/fieldtrip/__plotting/_fixname.py b/fieldtrip/__plotting/_fixname.py new file mode 100644 index 0000000..80337ab --- /dev/null +++ b/fieldtrip/__plotting/_fixname.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _fixname(*args, **kwargs): + """ + FIXNAME changes all inappropriate characters in a string into '_' + so that it can be used as a filename or as a field name in a structure. + If the string begins with a digit, an 'x' is prepended. + + Use as + str = fixname(str) + + MATLAB 2014a introduces the matlab.lang.makeValidName and + matlab.lang.makeUniqueStrings functions for constructing unique + identifiers, but this particular implementation also works with + older MATLAB versions. + + See also DEBLANK, STRIP, PAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/fixname.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixname", *args, **kwargs) diff --git a/fieldtrip/__plotting/_fixoldorg.py b/fieldtrip/__plotting/_fixoldorg.py new file mode 100644 index 0000000..8dbfba4 --- /dev/null +++ b/fieldtrip/__plotting/_fixoldorg.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _fixoldorg(*args, **kwargs): + """ + FIXOLDORG use "old/new" instead of "org/new" + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/fixoldorg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixoldorg", *args, **kwargs) diff --git a/fieldtrip/__plotting/_fixpos.py b/fieldtrip/__plotting/_fixpos.py new file mode 100644 index 0000000..fa65695 --- /dev/null +++ b/fieldtrip/__plotting/_fixpos.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _fixpos(*args, **kwargs): + """ + FIXPOS helper function to ensure that meshes are described properly + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/fixpos.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixpos", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_apply_montage.py b/fieldtrip/__plotting/_ft_apply_montage.py new file mode 100644 index 0000000..a80668a --- /dev/null +++ b/fieldtrip/__plotting/_ft_apply_montage.py @@ -0,0 +1,78 @@ +from fieldtrip._runtime import Runtime + + +def _ft_apply_montage(*args, **kwargs): + """ + FT_APPLY_MONTAGE changes the montage (i.e. linear combination) of a set of + electrode or gradiometer channels. A montage can be used for EEG rereferencing, MEG + synthetic gradients, MEG planar gradients or unmixing using ICA. This function not + only applies the montage to the EEG or MEG data, but also applies the montage to + the input EEG or MEG sensor array, which can subsequently be used for forward + computation and source reconstruction of the data. + + Use as + [sens] = ft_apply_montage(sens, montage, ...) + [data] = ft_apply_montage(data, montage, ...) + [freq] = ft_apply_montage(freq, montage, ...) + [montage] = ft_apply_montage(montage1, montage2, ...) + + A montage is specified as a structure with the fields + montage.tra = MxN matrix + montage.labelold = Nx1 cell-array + montage.labelnew = Mx1 cell-array + + As an example, a bipolar montage could look like this + bipolar.labelold = {'1', '2', '3', '4'} + bipolar.labelnew = {'1-2', '2-3', '3-4'} + bipolar.tra = [ + +1 -1 0 0 + 0 +1 -1 0 + 0 0 +1 -1 + ]; + + The montage can optionally also specify the channel type and unit of the input + and output data with + montage.chantypeold = Nx1 cell-array + montage.chantypenew = Mx1 cell-array + montage.chanunitold = Nx1 cell-array + montage.chanunitnew = Mx1 cell-array + + Additional options should be specified in key-value pairs and can be + 'keepunused' = string, 'yes' or 'no' (default = 'no') + 'feedback' = string, see FT_PROGRESS (default = 'text') + 'warning' = boolean, whether to show warnings (default = true) + + If the first input is a montage, then the second input montage will be + applied to the first. In effect, the output montage will first do + montage1, then montage2. + + See also FT_READ_SENS, FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_apply_montage.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_apply_montage", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_convert_units.py b/fieldtrip/__plotting/_ft_convert_units.py new file mode 100644 index 0000000..7811b17 --- /dev/null +++ b/fieldtrip/__plotting/_ft_convert_units.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def _ft_convert_units(*args, **kwargs): + """ + FT_CONVERT_UNITS changes the geometrical dimension to the specified SI unit. + The units of the input object is determined from the structure field + object.unit, or is estimated based on the spatial extend of the structure, + e.g. a volume conduction model of the head should be approximately 20 cm large. + + Use as + [output] = ft_convert_units(input, target) + + The following input data structures are supported + electrode or gradiometer array, see FT_DATATYPE_SENS + volume conductor, see FT_DATATYPE_HEADMODEL + anatomical mri, see FT_DATATYPE_VOLUME + segmented mri, see FT_DATATYPE_SEGMENTATION + source model, see FT_DATATYPE_SOURCE and FT_PREPARE_SOURCEMODEL + + The possible target units are 'm', 'cm ' or 'mm'. If no target units are specified, + this function will only determine the geometrical units of the input object. + + See also FT_DETERMINE_UNITS, FT_DETERMINE_COORDSYS, FT_CONVERT_COORDSYS, FT_PLOT_AXES, FT_PLOT_XXX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_convert_units.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_convert_units", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_datatype_sens.py b/fieldtrip/__plotting/_ft_datatype_sens.py new file mode 100644 index 0000000..49d6fc8 --- /dev/null +++ b/fieldtrip/__plotting/_ft_datatype_sens.py @@ -0,0 +1,127 @@ +from fieldtrip._runtime import Runtime + + +def _ft_datatype_sens(*args, **kwargs): + """ + FT_DATATYPE_SENS describes the FieldTrip structure that represents an MEG, EEG, + sEEG, ECoG, or NIRS sensor array. This structure is commonly called "grad" for MEG, + "elec" for EEG and intranial EEG, "opto" for NIRS, or in general "sens" if it could + be any one. + + For all sensor types a distinction should be made between the channel (i.e. the + output of the transducer that is A/D converted) and the sensor, which may have some + spatial extent. For example in MEG gradiometers are comprised of multiple coils and + with EEG you can have a bipolar channel, where the position of the channel can be + represented as in between the position of the two electrodes. + + The structure for MEG gradiometers and/or magnetometers contains + sens.label = Mx1 cell-array with channel labels + sens.chanpos = Mx3 matrix with channel positions + sens.chanori = Mx3 matrix with channel orientations, used for synthetic planar gradient computation + sens.coilpos = Nx3 matrix with coil positions + sens.coilori = Nx3 matrix with coil orientations + sens.tra = MxN matrix to combine coils into channels + sens.balance = structure containing info about the balancing, See FT_APPLY_MONTAGE + and optionally + sens.chanposold = Mx3 matrix with original channel positions (in case sens.chanpos has been updated to contain NaNs, e.g. after FT_COMPONENTANALYSIS) + sens.chanoriold = Mx3 matrix with original channel orientations + sens.labelold = Mx1 cell-array with original channel labels + + The structure for EEG, sEEG or ECoG channels contains + sens.label = Mx1 cell-array with channel labels + sens.chanpos = Mx3 matrix with channel positions (often the same as electrode positions) + sens.elecpos = Nx3 matrix with electrode positions + sens.tra = MxN matrix to combine electrodes into channels + In case sens.tra is not present in the EEG sensor array, the channels + are assumed to be average referenced. + + The structure for NIRS channels contains + sens.label = Mx1 cell-array with channel labels + sens.chanpos = Mx3 matrix with position of the channels (usually halfway the transmitter and receiver) + sens.optopos = Nx3 matrix with the position of individual optodes + sens.optotype = Nx1 cell-array with information about the type of optode (receiver or transmitter) + sens.optolabel = Nx1 cell-array with optode labels + sens.wavelength = 1xK vector of all wavelengths that were used + sens.tra = MxN matrix that specifies for each of the M channels which of the N optodes transmits at which wavelength (positive integer from 1 to K), or receives (negative ingeger from 1 to K) + + The following fields apply to MEG, EEG, sEEG and ECoG + sens.chantype = Mx1 cell-array with the type of the channel, see FT_CHANTYPE + sens.chanunit = Mx1 cell-array with the units of the channel signal, e.g. 'V', 'fT' or 'T/cm', see FT_CHANUNIT + + Optional fields: + type, unit, fid, chantype, chanunit, coordsys, balance + + Historical fields: + pnt, pos, ori, pnt1, pnt2, fiberpos, fibertype, fiberlabel, transceiver, transmits, laserstrength + + Revision history: + (2025/latest) Explicitly deal with the balance field and sequence of montages. + + (2020/latest) Updated the specification of the NIRS sensor definition. + Dropped the laserstrength and renamed transmits into tra for consistency. + + (2019/latest) Updated the specification of the NIRS sensor definition. + Use "opto" instead of "fibers", see http://bit.ly/33WaqWU for details. + + (2016) The chantype and chanunit have become required fields. + Original channel details are specified with the suffix "old" rather than "org". + All numeric values are represented in double precision. + It is possible to convert the amplitude and distance units (e.g. from T to fT and + from m to mm) and it is possible to express planar and axial gradiometer channels + either in units of amplitude or in units of amplitude/distance (i.e. proper + gradient). + + (2011v2) The chantype and chanunit have been added for MEG. + + (2011v1) To facilitate determining the position of channels (e.g. for plotting) + in case of balanced MEG or bipolar EEG, an explicit distinction has been made + between chanpos+chanori and coilpos+coilori (for MEG) and chanpos and elecpos + (for EEG). The pnt and ori fields are removed. + + (2010) Added support for bipolar or otherwise more complex linear combinations + of EEG electrodes using sens.tra, similar to MEG. + + (2009) Noise reduction has been added for MEG systems in the balance field. + + (2006) The optional fields sens.type and sens.unit were added. + + (2003) The initial version was defined, which looked like this for EEG + sens.pnt = Mx3 matrix with electrode positions + sens.label = Mx1 cell-array with channel labels + and like this for MEG + sens.pnt = Nx3 matrix with coil positions + sens.ori = Nx3 matrix with coil orientations + sens.tra = MxN matrix to combine coils into channels + sens.label = Mx1 cell-array with channel labels + + See also FT_READ_SENS, FT_SENSTYPE, FT_CHANTYPE, FT_APPLY_MONTAGE, CTF2GRAD, FIF2GRAD, + BTI2GRAD, YOKOGAWA2GRAD, ITAB2GRAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_datatype_sens.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_sens", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_datatype_volume.py b/fieldtrip/__plotting/_ft_datatype_volume.py new file mode 100644 index 0000000..a5dec67 --- /dev/null +++ b/fieldtrip/__plotting/_ft_datatype_volume.py @@ -0,0 +1,88 @@ +from fieldtrip._runtime import Runtime + + +def _ft_datatype_volume(*args, **kwargs): + """ + FT_DATATYPE_VOLUME describes the FieldTrip MATLAB structure for volumetric data + such as an anatomical MRI. + + The volume data structure represents data on a regular volumetric 3-D grid, like an + anatomical MRI, a functional MRI, etc. It can also represent a source reconstructed + estimate of the activity measured with MEG. In this case the source reconstruction + is estimated or interpolated on the regular 3-D dipole grid (like a box). + + An example volume structure is + anatomy: [181x217x181 double] the numeric data, in this case anatomical information + dim: [181 217 181] the dimensionality of the 3D volume + transform: [4x4 double] 4x4 homogenous transformation matrix, specifying the transformation from voxel coordinates to head or world coordinates + unit: 'mm' geometrical units of the coordinate system + coordsys: 'ctf' description of the coordinate system + + Required fields: + - transform, dim + + Optional fields: + - anatomy, prob, stat, grey, white, csf, or any other field with dimensions that are consistent with dim + - unit, coordsys, fid + + Deprecated fields: + - dimord + + Obsoleted fields: + - none + + Revision history: + + (2014) The subfields in the avg and trial fields are now present in the + main structure, e.g. source.avg.pow is now source.pow. Furthermore, the + inside is always represented as logical array. + + (2012b) Ensure that the anatomy-field (if present) does not contain + infinite values. + + (2012) A placeholder 2012 version was created that ensured the axes + of the coordinate system to be right-handed. This actually never + has made it to the default version. An executive decision regarding + this has not been made as far as I (JM) am aware, and probably it's + a more principled approach to keep the handedness free, so don't mess + with it here. However, keep this snippet of code for reference. + + (2011) The dimord field was deprecated and we agreed that volume + data should be 3-dimensional and not N-dimensional with arbitrary + dimensions. In case time-frequency recolved data has to be represented + on a 3-d grid, the source representation should be used. + + (2010) The dimord field was added by some functions, but not by all + + (2003) The initial version was defined + + See also FT_DATATYPE, FT_DATATYPE_DIP, FT_DATATYPE_SOURCE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_datatype_volume.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_volume", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_debug.py b/fieldtrip/__plotting/_ft_debug.py new file mode 100644 index 0000000..8306011 --- /dev/null +++ b/fieldtrip/__plotting/_ft_debug.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_debug(*args, **kwargs): + """ + FT_DEBUG prints a debug message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_debug(...) + with arguments similar to fprintf, or + ft_debug(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_debug off + or for specific ones using + ft_debug off msgId + + To switch them back on, you would use + ft_debug on + or for specific ones using + ft_debug on msgId + + Messages are only printed once per timeout period using + ft_debug timeout 60 + ft_debug once + or for specific ones using + ft_debug once msgId + + You can see the most recent messages and identifier using + ft_debug last + + You can query the current on/off/once state for all messages using + ft_debug query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_debug.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_debug", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_determine_units.py b/fieldtrip/__plotting/_ft_determine_units.py new file mode 100644 index 0000000..e96501c --- /dev/null +++ b/fieldtrip/__plotting/_ft_determine_units.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def _ft_determine_units(*args, **kwargs): + """ + FT_DETERMINE_UNITS tries to determine the units of a geometrical object by + looking at its size and by relating this to the approximate size of the + human head according to the following table: + from 0.050 to 0.500 -> meter + from 0.500 to 5.000 -> decimeter + from 5.000 to 50.000 -> centimeter + from 50.000 to 500.000 -> millimeter + + Use as + [output] = ft_determine_units(input) + + The following input data structures are supported + electrode or gradiometer array, see FT_DATATYPE_SENS + volume conduction model, see FT_DATATYPE_HEADMODEL + source model, see FT_DATATYPE_SOURCE and FT_PREPARE_SOURCEMODEL + anatomical mri, see FT_DATATYPE_VOLUME + segmented mri, see FT_DATATYPE_SEGMENTATION + anatomical or functional atlas, see FT_READ_ATLAS + + This function will add the field 'unit' to the output data structure with the + possible values 'm', 'cm ' or 'mm'. + + See also FT_CONVERT_UNITS, FT_DETERMINE_COODSYS, FT_CONVERT_COORDSYS, FT_PLOT_AXES, FT_PLOT_XXX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_determine_units.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_determine_units", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_error.py b/fieldtrip/__plotting/_ft_error.py new file mode 100644 index 0000000..18d3093 --- /dev/null +++ b/fieldtrip/__plotting/_ft_error.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _ft_error(*args, **kwargs): + """ + FT_ERROR prints an error message on screen, just like the standard ERROR function. + + Use as + ft_error(...) + with arguments similar to fprintf, or + ft_error(msgId, ...) + with arguments similar to error. + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_error.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_error", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_estimate_units.py b/fieldtrip/__plotting/_ft_estimate_units.py new file mode 100644 index 0000000..e64be66 --- /dev/null +++ b/fieldtrip/__plotting/_ft_estimate_units.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _ft_estimate_units(*args, **kwargs): + """ + FT_ESTIMATE_UNITS tries to determine the units of a geometrical object by + looking at its size and by relating this to the approximate size of the + human head according to the following table: + from 0.050 to 0.500 -> meter + from 0.500 to 5.000 -> decimeter + from 5.000 to 50.000 -> centimeter + from 50.000 to 500.000 -> millimeter + + Use as + unit = ft_estimate_units(size) + + This function will return one of the following strings + 'm' + 'cm' + 'mm' + + See also FT_CONVERT_UNITS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_estimate_units.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_estimate_units", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_getopt.py b/fieldtrip/__plotting/_ft_getopt.py new file mode 100644 index 0000000..0e1b27f --- /dev/null +++ b/fieldtrip/__plotting/_ft_getopt.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def _ft_getopt(*args, **kwargs): + """ + FT_GETOPT gets the value of a specified option from a configuration structure + or from a cell-array with key-value pairs. + + Use as + val = ft_getopt(s, key, default, emptymeaningful) + where the input values are + s = structure or cell-array + key = string + default = any valid MATLAB data type (optional, default = []) + emptymeaningful = boolean value (optional, default = false) + + If the key is present as field in the structure, or as key-value pair in the + cell-array, the corresponding value will be returned. + + If the key is not present, ft_getopt will return the default, or an empty array + when no default was specified. + + If the key is present but has an empty value, then the emptymeaningful flag + specifies whether the empty value or the default value should be returned. + If emptymeaningful==true, then the empty array will be returned. + If emptymeaningful==false, then the specified default will be returned. + + See also FT_SETOPT, FT_CHECKOPT, INPUTPARSER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_getopt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_getopt", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_hastoolbox.py b/fieldtrip/__plotting/_ft_hastoolbox.py new file mode 100644 index 0000000..750f2ac --- /dev/null +++ b/fieldtrip/__plotting/_ft_hastoolbox.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _ft_hastoolbox(*args, **kwargs): + """ + FT_HASTOOLBOX tests whether an external toolbox is installed. Optionally it will + try to determine the path to the toolbox and install it automatically. + + Use as + [status] = ft_hastoolbox(toolbox, autoadd, silent) + + autoadd = -1 means that it will check and give an error when not yet installed + autoadd = 0 means that it will check and give a warning when not yet installed + autoadd = 1 means that it will check and give an error if it cannot be added + autoadd = 2 means that it will check and give a warning if it cannot be added + autoadd = 3 means that it will check but remain silent if it cannot be added + + silent = 0 means that it will give some feedback about adding the toolbox + silent = 1 means that it will not give feedback + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_hastoolbox.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_hastoolbox", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_headmodeltype.py b/fieldtrip/__plotting/_ft_headmodeltype.py new file mode 100644 index 0000000..a423644 --- /dev/null +++ b/fieldtrip/__plotting/_ft_headmodeltype.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def _ft_headmodeltype(*args, **kwargs): + """ + FT_HEADMODELTYPE determines the type of volume conduction model of the head + + Use as + [type] = ft_headmodeltype(headmodel) + to get a string describing the type, or + [flag] = ft_headmodeltype(headmodel, desired) + to get a boolean value. + + For EEG the following volume conduction models are recognized + singlesphere analytical single sphere model + concentricspheres analytical concentric sphere model with up to 4 spheres + halfspace infinite homogenous medium on one side, vacuum on the other + openmeeg boundary element method, based on the OpenMEEG software + bemcp boundary element method, based on the implementation from Christophe Phillips + dipoli boundary element method, based on the implementation from Thom Oostendorp + asa boundary element method, based on the (commercial) ASA software + simbio finite element method, based on the SimBio software + fns finite difference method, based on the FNS software + interpolate interpolate the potential based on pre-computed leadfields + + and for MEG the following volume conduction models are recognized + singlesphere analytical single sphere model + localspheres local spheres model for MEG, one sphere per channel + singleshell realisically shaped single shell approximation, based on the implementation from Guido Nolte + infinite magnetic dipole in an infinite vacuum + interpolate interpolate the potential based on pre-computed leadfields + + See also FT_COMPUTE_LEADFIELD, FT_READ_HEADMODEL, FT_HEADMODEL_BEMCP, + FT_HEADMODEL_ASA, FT_HEADMODEL_DIPOLI, FT_HEADMODEL_SIMBIO, + FT_HEADMODEL_FNS, FT_HEADMODEL_HALFSPACE, FT_HEADMODEL_INFINITE, + FT_HEADMODEL_OPENMEEG, FT_HEADMODEL_SINGLESPHERE, + FT_HEADMODEL_CONCENTRICSPHERES, FT_HEADMODEL_LOCALSPHERES, + FT_HEADMODEL_SINGLESHELL, FT_HEADMODEL_INTERPOLATE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_headmodeltype.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmodeltype", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_info.py b/fieldtrip/__plotting/_ft_info.py new file mode 100644 index 0000000..aa7ddc7 --- /dev/null +++ b/fieldtrip/__plotting/_ft_info.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_info(*args, **kwargs): + """ + FT_INFO prints an info message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_info(...) + with arguments similar to fprintf, or + ft_info(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_info off + or for specific ones using + ft_info off msgId + + To switch them back on, you would use + ft_info on + or for specific ones using + ft_info on msgId + + Messages are only printed once per timeout period using + ft_info timeout 60 + ft_info once + or for specific ones using + ft_info once msgId + + You can see the most recent messages and identifier using + ft_info last + + You can query the current on/off/once state for all messages using + ft_info query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_info.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_info", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_notice.py b/fieldtrip/__plotting/_ft_notice.py new file mode 100644 index 0000000..6acf7d0 --- /dev/null +++ b/fieldtrip/__plotting/_ft_notice.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_notice(*args, **kwargs): + """ + FT_NOTICE prints a notice message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_notice(...) + with arguments similar to fprintf, or + ft_notice(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_notice off + or for specific ones using + ft_notice off msgId + + To switch them back on, you would use + ft_notice on + or for specific ones using + ft_notice on msgId + + Messages are only printed once per timeout period using + ft_notice timeout 60 + ft_notice once + or for specific ones using + ft_notice once msgId + + You can see the most recent messages and identifier using + ft_notice last + + You can query the current on/off/once state for all messages using + ft_notice query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_notice.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_notice", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_notification.py b/fieldtrip/__plotting/_ft_notification.py new file mode 100644 index 0000000..7a93642 --- /dev/null +++ b/fieldtrip/__plotting/_ft_notification.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _ft_notification(*args, **kwargs): + """ + FT_NOTIFICATION works mostly like the WARNING and ERROR commands in MATLAB and + is called by FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO and FT_DEBUG. Please note + that you should not call this function directly. + + Some examples: + ft_info on + ft_info on msgId + ft_info off + ft_info off msgId + ft_info once + ft_info once msgId + ft_info on backtrace + ft_info off backtrace + ft_info on verbose + ft_info off verbose + + ft_info query % shows the status of all notifications + ft_info last % shows the last notification + ft_info clear % clears the status of all notifications + ft_info timeout 10 % sets the timeout (for 'once') to 10 seconds + + See also DEFAULTID, FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_notification.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_notification", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_platform_supports.py b/fieldtrip/__plotting/_ft_platform_supports.py new file mode 100644 index 0000000..47bf2a9 --- /dev/null +++ b/fieldtrip/__plotting/_ft_platform_supports.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def _ft_platform_supports(*args, **kwargs): + """ + FT_PLATFORM_SUPPORTS returns a boolean indicating whether the current platform + supports a specific capability + + Use as + status = ft_platform_supports(what) + or + status = ft_platform_supports('matlabversion', min_version, max_version) + + The following values are allowed for the 'what' parameter, which means means that + the specific feature explained on the right is supported: + + 'which-all' which(...,'all') + 'exists-in-private-directory' exists(...) will look in the /private subdirectory to see if a file exists + 'onCleanup' onCleanup(...) + 'alim' alim(...) + 'int32_logical_operations' bitand(a,b) with a, b of type int32 + 'graphics_objects' graphics system is object-oriented + 'libmx_c_interface' libmx is supported through mex in the C-language (recent MATLAB versions only support C++) + 'images' all image processing functions in FieldTrip's external/images directory + 'signal' all signal processing functions in FieldTrip's external/signal directory + 'stats' all statistical functions in FieldTrip's external/stats directory + 'program_invocation_name' program_invocation_name() (GNU Octave) + 'singleCompThread' start MATLAB with -singleCompThread + 'nosplash' start MATLAB with -nosplash + 'nodisplay' start MATLAB with -nodisplay + 'nojvm' start MATLAB with -nojvm + 'no-gui' start GNU Octave with --no-gui + 'RandStream.setGlobalStream' RandStream.setGlobalStream(...) + 'RandStream.setDefaultStream' RandStream.setDefaultStream(...) + 'rng' rng(...) + 'rand-state' rand('state') + 'urlread-timeout' urlread(..., 'Timeout', t) + 'griddata-vector-input' griddata(...,...,...,a,b) with a and b vectors + 'griddata-v4' griddata(...,...,...,...,...,'v4') with v4 interpolation support + 'uimenu' uimenu(...) + 'weboptions' weboptions(...) + 'parula' parula(...) + 'datetime' datetime structure + 'html' html rendering in desktop + + See also FT_VERSION, VERSION, VER, VERLESSTHAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_platform_supports.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_platform_supports", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_progress.py b/fieldtrip/__plotting/_ft_progress.py new file mode 100644 index 0000000..85ff376 --- /dev/null +++ b/fieldtrip/__plotting/_ft_progress.py @@ -0,0 +1,63 @@ +from fieldtrip._runtime import Runtime + + +def _ft_progress(*args, **kwargs): + """ + FT_PROGRESS shows a graphical or non-graphical progress indication similar to the + standard WAITBAR function, but with the extra option of printing it in the command + window as a plain text string or as a rotating dial. Alternatively, you can also + specify it not to give feedback on the progress. + + Prior to the for-loop, you should call either + ft_progress('init', 'none', 'Please wait...') + ft_progress('init', 'text', 'Please wait...') + ft_progress('init', 'textbar', 'Please wait...') % ascii progress bar + ft_progress('init', 'dial', 'Please wait...') % rotating dial + ft_progress('init', 'etf', 'Please wait...') % estimated time to finish + ft_progress('init', 'gui', 'Please wait...') + + In each iteration of the for-loop, you should call either + ft_progress(x) % only show percentage + ft_progress(x, 'Processing event %d from %d', i, N) % show string, x=i/N + + After finishing the for-loop, you should call + ft_progress('close') + + Here is an example for the use of a progress indicator + ft_progress('init', 'etf', 'Please wait...'); + for i=1:100 + ft_progress(i/100, 'Processing event %d from %d', i, 100); + pause(0.03); + end + ft_progress('close') + + See also WAITBAR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_progress.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_progress", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__plotting/_ft_scalingfactor.py b/fieldtrip/__plotting/_ft_scalingfactor.py new file mode 100644 index 0000000..3ede251 --- /dev/null +++ b/fieldtrip/__plotting/_ft_scalingfactor.py @@ -0,0 +1,91 @@ +from fieldtrip._runtime import Runtime + + +def _ft_scalingfactor(*args, **kwargs): + """ + FT_SCALINGFACTOR determines the scaling factor from old to new units, i.e. it + returns a number with which the data in the old units needs to be multiplied + to get it expressed in the new units. + + Use as + factor = ft_scalingfactor(old, new) + where old and new are strings that specify the units. + + For example + ft_scalingfactor('m', 'cm') % returns 100 + ft_scalingfactor('V', 'uV') % returns 1000 + ft_scalingfactor('T/cm', 'fT/m') % returns 10^15 divided by 10^-2, which is 10^17 + ft_scalingfactor('cm^2', 'mm^2') % returns 100 + ft_scalingfactor('1/ms', 'Hz') % returns 1000 + + The following fundamental units are supported + metre m length l (a lowercase L), x, r L + kilogram kg mass m M + second s time t T + ampere A electric current I (an uppercase i) I + kelvin K thermodynamic temperature T # + mole mol amount of substance n N + candela cd luminous intensity Iv (an uppercase i with lowercase non-italicized v subscript) J + + The following derived units are supported + hertz Hz frequency 1/s T-1 + radian rad angle m/m dimensionless + steradian sr solid angle m2/m2 dimensionless + newton N force, weight kg#m/s2 M#L#T-2 + pascal Pa pressure, stress N/m2 M#L-1#T-2 + joule J energy, work, heat N#m = C#V = W#s M#L2#T-2 + coulomb C electric charge or quantity of electricity s#A T#I + volt V voltage, electrical potential difference, electromotive force W/A = J/C M#L2#T-3#I-1 + farad F electric capacitance C/V M-1#L-2#T4#I2 + siemens S electrical conductance 1/# = A/V M-1#L-2#T3#I2 + weber Wb magnetic flux J/A M#L2#T-2#I-1 + tesla T magnetic field strength V#s/m2 = Wb/m2 = N/(A#m) M#T-2#I-1 + henry H inductance V#s/A = Wb/A M#L2#T-2#I-2 + lumen lm luminous flux cd#sr J + lux lx illuminance lm/m2 L-2#J + becquerel Bq radioactivity (decays per unit time) 1/s T-1 + gray Gy absorbed dose (of ionizing radiation) J/kg L2#T-2 + sievert Sv equivalent dose (of ionizing radiation) J/kg L2#T-2 + katal kat catalytic activity mol/s T-1#N + + The following alternative units are supported + inch inch length + feet feet length + gauss gauss magnetic field strength + + The following derived units are not supported due to potential confusion + between their ascii character representation + ohm # electric resistance, impedance, reactance V/A M#L2#T-3#I-2 + watt W power, radiant flux J/s = V#A M#L2#T-3 + degree Celsius ?C temperature relative to 273.15 K K ? + + See also http://en.wikipedia.org/wiki/International_System_of_Units + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_scalingfactor.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_scalingfactor", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_senslabel.py b/fieldtrip/__plotting/_ft_senslabel.py new file mode 100644 index 0000000..6e9bddc --- /dev/null +++ b/fieldtrip/__plotting/_ft_senslabel.py @@ -0,0 +1,89 @@ +from fieldtrip._runtime import Runtime + + +def _ft_senslabel(*args, **kwargs): + """ + FT_SENSLABEL returns a list of predefined sensor labels given the + EEG or MEG system type which can be used to detect the type of data. + + Use as + label = ft_senslabel(type) + + The input sensor array type can be any of the following + 'ant128' + 'biosemi64' + 'biosemi128' + 'biosemi256' + 'bti148' + 'bti148_planar' + 'bti248' + 'bti248_planar' + 'btiref' + 'ctf64' + 'ctf64_planar' + 'ctf151' + 'ctf151_planar' + 'ctf275' + 'ctf275_planar' + 'ctfheadloc' + 'ctfref' + 'eeg1005' + 'eeg1010' + 'eeg1020' + 'ext1020' + 'egi32' + 'egi64' + 'egi128' + 'egi256' + 'neuromag122' + 'neuromag122_planar' + 'neuromag306' + 'neuromag306_planar' + 'itab28' + 'itab153' + 'itab153_planar' + 'yokogawa9' + 'yokogawa64' + 'yokogawa64_planar' + 'yokogawa160' + 'yokogawa160_planar' + 'yokogawa208' + 'yokogawa208_planar' + 'yokogawa440' + 'yokogawa440_planar' + + It is also possible to specify + 'eeg' + 'electrode' + although for these an empty set of labels (i.e. {}) will be returned. + + See also FT_SENSTYPE, FT_CHANNELSELECTION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_senslabel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_senslabel", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_senstype.py b/fieldtrip/__plotting/_ft_senstype.py new file mode 100644 index 0000000..4de4968 --- /dev/null +++ b/fieldtrip/__plotting/_ft_senstype.py @@ -0,0 +1,132 @@ +from fieldtrip._runtime import Runtime + + +def _ft_senstype(*args, **kwargs): + """ + FT_SENSTYPE determines the type of acquisition device by looking at the channel + names and comparing them with predefined lists. + + Use as + [type] = ft_senstype(sens) + or + [flag] = ft_senstype(sens, desired) + + The output type can be any of the following + 'ctf64' + 'ctf151' + 'ctf151_planar' + 'ctf275' + 'ctf275_planar' + 'bti148' + 'bti148_planar' + 'bti248' + 'bti248_planar' + 'bti248grad' + 'bti248grad_planar' + 'itab28' + 'itab153' + 'itab153_planar' + 'yokogawa9' + 'yokogawa64' + 'yokogawa64_planar' + 'yokogawa160' + 'yokogawa160_planar' + 'yokogawa208' + 'yokogawa208_planar' + 'yokogawa440' + 'neuromag122' + 'neuromag122_combined' + 'neuromag306' + 'neuromag306_combined' + 'babysquid74' this is a BabySQUID system from Tristan Technologies + 'artemis123' this is a BabySQUID system from Tristan Technologies + 'magview' this is a BabySQUID system from Tristan Technologies + 'fieldline_v2' + 'fieldline_v3' + 'egi32' + 'egi64' + 'egi128' + 'egi256' + 'biosemi64' + 'biosemi128' + 'biosemi256' + 'ant128' + 'neuralynx' + 'plexon' + 'artinis' + 'nirx' + 'shimadzu' + 'hitachi' + 'nirs' + 'meg' + 'eeg' + 'ieeg' + 'seeg' + 'ecog' + 'eeg1020' + 'eeg1010' + 'eeg1005' + 'ext1020' in case it is a small subset of eeg1020, eeg1010 or eeg1005 + 'nex5' + + The optional input argument for the desired type can be any of the above, or any of + the following generic classes of acquisition systems + 'eeg' + 'ieeg' + 'ext1020' + 'ant' + 'biosemi' + 'egi' + 'meg' + 'meg_planar' + 'meg_axial' + 'ctf' + 'bti' + 'neuromag' + 'yokogawa' + 'itab' + 'babysquid' + 'fieldline' + If you specify the desired type, this function will return a boolean flag + indicating true/false depending on the input data. + + Besides specifying a sensor definition (i.e. a grad or elec structure, see + FT_DATATYPE_SENS), it is also possible to give a data structure containing a grad + or elec field, or giving a list of channel names (as cell-arrray). So assuming that + you have a FieldTrip data structure, any of the following calls would also be fine. + ft_senstype(hdr) + ft_senstype(data) + ft_senstype(data.label) + ft_senstype(data.grad) + ft_senstype(data.grad.label) + + See also FT_SENSLABEL, FT_CHANTYPE, FT_READ_SENS, FT_COMPUTE_LEADFIELD, FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_senstype.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_senstype", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_version.py b/fieldtrip/__plotting/_ft_version.py new file mode 100644 index 0000000..8920fe3 --- /dev/null +++ b/fieldtrip/__plotting/_ft_version.py @@ -0,0 +1,69 @@ +from fieldtrip._runtime import Runtime + + +def _ft_version(*args, **kwargs): + """ + FT_VERSION returns the version of FieldTrip and the path where it is installed + + FieldTrip is not released with version numbers as "2.0", "2.1", etc. Instead, we + share our development version on http://github.com/fieldtrip/fieldtrip. You can use + git to make a local clone of the development version. Furthermore, we make + more-or-less daily releases of the code available on + https://github.com/fieldtrip/fieldtrip/releases and as zip file on our FTP server. + + If you use git with the development version, the version is labeled with the hash + of the latest commit like "128c693". You can access the specific version "XXXXXX" + at https://github.com/fieldtrip/fieldtrip/commit/XXXXXX. + + If you download the daily released version from our FTP server, the version is part + of the file name "fieldtrip-YYYYMMDD.zip", where YYY, MM and DD correspond to year, + month and day. + + Use as + ft_version + to display the latest revision number on screen, or + [ftver, ftpath] = ft_version + to get the version and the installation root directory. + + When using git with the development version, you can also get additional information with + ft_version revision + ft_version branch + ft_version clean + + On macOS you might have installed git along with Xcode instead of with homebrew, + which then requires that you agree to the Apple license. In that case it can + happen that this function stops, as in the background (invisible to you) it is + asking whether you agree. You can check this by typing "/usr/bin/git", which will + show the normal help message, or which will mention the license agreement. To + resolve this please open a terminal and type "sudo xcodebuild -license" + + See also FT_PLATFORM_SUPPORTS, VERSION, VER, VERLESSTHAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_version.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_version", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_warning.py b/fieldtrip/__plotting/_ft_warning.py new file mode 100644 index 0000000..8bc24dc --- /dev/null +++ b/fieldtrip/__plotting/_ft_warning.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def _ft_warning(*args, **kwargs): + """ + FT_WARNING prints a warning message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. This function works + similar to the standard WARNING function, but also features the "once" mode. + + Use as + ft_warning(...) + with arguments similar to fprintf, or + ft_warning(msgId, ...) + with arguments similar to warning. + + You can switch of all warning messages using + ft_warning off + or for specific ones using + ft_warning off msgId + + To switch them back on, you would use + ft_warning on + or for specific ones using + ft_warning on msgId + + Warning messages are only printed once per timeout period using + ft_warning timeout 60 + ft_warning once + or for specific ones using + ft_warning once msgId + + You can see the most recent messages and identifier using + ft_warning last + + You can query the current on/off/once state for all messages using + ft_warning query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_warning.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_warning", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ft_warp_apply.py b/fieldtrip/__plotting/_ft_warp_apply.py new file mode 100644 index 0000000..73c0d38 --- /dev/null +++ b/fieldtrip/__plotting/_ft_warp_apply.py @@ -0,0 +1,83 @@ +from fieldtrip._runtime import Runtime + + +def _ft_warp_apply(*args, **kwargs): + """ + FT_WARP_APPLY performs a 3D linear or nonlinear transformation on the input + coordinates, similar to those in AIR. You can find technical documentation + on warping in general at http://air.bmap.ucla.edu/AIR5 + + Use as + [output] = ft_warp_apply(M, input, method, tol) + where + M vector or matrix with warping parameters + input Nx3 matrix with input coordinates + output Nx3 matrix with the transformed or warped output coordinates + method string describing the transformation or warping method + tol (optional) value determining the numerical precision of the + output, to deal with numerical round-off imprecisions due to + the warping + + The methods 'nonlin0', 'nonlin2' ... 'nonlin5' specify a polynomial transformation. + The size of the transformation matrix depends on the order of the warp + zeroth order : 1 parameter per coordinate (translation) + first order : 4 parameters per coordinate (total 12, affine) + second order : 10 parameters per coordinate + third order : 20 parameters per coordinate + fourth order : 35 parameters per coordinate + fifth order : 56 parameters per coordinate (total 168) + The size of M should be 3xP, where P is the number of parameters per coordinate. + Alternatively, you can specify the method to be 'nonlinear', in which case the + order will be determined from the size of the matrix M. + + If the method 'homogeneous' is selected, the input matrix M should be a 4x4 + homogenous transformation matrix. + + If the method 'sn2individual' or 'individual2sn' is selected, the input M should be + a structure with the nonlinear spatial normalisation (warping) parameters created + by SPM8 or SPM12 for alignment between an individual subject and a template brain. + When using the 'old' method, M will have subfields like this: + Affine: [4x4 double] + Tr: [4-D double] + VF: [1x1 struct] + VG: [1x1 struct] + flags: [1x1 struct] + When using the 'new' or the 'mars' method, M will have subfields like this: + + If any other method is selected, it is assumed that it specifies the name of an + auxiliary function that will, when given the input parameter vector M, return an + 4x4 homogenous transformation matrix. Supplied functions are 'translate', 'rotate', + 'scale', 'rigidbody', 'globalrescale', 'traditional', 'affine', 'perspective', + 'quaternion'. + + See also FT_AFFINECOORDINATES, FT_HEADCOORDINATES, FT_WARP_OPTIM, FT_WARP_ERROR, + MAKETFORM, AFFINE2D, AFFINE3D + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ft_warp_apply.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_warp_apply", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ftcolors.py b/fieldtrip/__plotting/_ftcolors.py new file mode 100644 index 0000000..80c8d8e --- /dev/null +++ b/fieldtrip/__plotting/_ftcolors.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _ftcolors(*args, **kwargs): + """ + FTCOLORS returns an Nx3 rgb matrix with the + colors of the fieldtrip logo at its extremes. + Can be used as a colormap by FT_COLORMAP + + Use as: + rgb = ftcolors(N), or + rgb = ftcolors + + Without input arguments, N will be set to 64 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ftcolors.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ftcolors", *args, **kwargs) diff --git a/fieldtrip/__plotting/_getdatfield.py b/fieldtrip/__plotting/_getdatfield.py new file mode 100644 index 0000000..972547d --- /dev/null +++ b/fieldtrip/__plotting/_getdatfield.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _getdatfield(*args, **kwargs): + """ + GETDATFIELD + + Use as + [datfield, dimord] = getdatfield(data) + where the output arguments are cell-arrays. + + See also GETDIMORD, GETDIMSIZ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/getdatfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getdatfield", *args, **kwargs) diff --git a/fieldtrip/__plotting/_getsubfield.py b/fieldtrip/__plotting/_getsubfield.py new file mode 100644 index 0000000..5983af4 --- /dev/null +++ b/fieldtrip/__plotting/_getsubfield.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _getsubfield(*args, **kwargs): + """ + GETSUBFIELD returns a field from a structure just like the standard + GETFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = getsubfield(s, 'fieldname') + or as + f = getsubfield(s, 'fieldname.subfieldname') + + See also GETFIELD, ISSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/getsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getsubfield", *args, **kwargs) diff --git a/fieldtrip/__plotting/_headsurface.py b/fieldtrip/__plotting/_headsurface.py new file mode 100644 index 0000000..18e6aa0 --- /dev/null +++ b/fieldtrip/__plotting/_headsurface.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _headsurface(*args, **kwargs): + """ + HEADSURFACE constructs a triangulated description of the skin or brain + surface from a volume conduction model, from a set of electrodes or + gradiometers, or from a combination of the two. It returns a closed + surface. + + Use as + [pos, tri] = headsurface(headmodel, sens, ...) + where + headmodel = volume conduction model (structure) + sens = electrode or gradiometer array (structure) + + Optional arguments should be specified in key-value pairs: + surface = 'skin' or 'brain' (default = 'skin') + npos = number of vertices (default is determined automatic) + downwardshift = boolean, this will shift the lower rim of the helmet down with approximately 1/4th of its radius (default is 1) + inwardshift = number (default = 0) + headshape = string, file containing the head shape + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/headsurface.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("headsurface", *args, **kwargs) diff --git a/fieldtrip/__plotting/_htmlcolors.py b/fieldtrip/__plotting/_htmlcolors.py new file mode 100644 index 0000000..072881d --- /dev/null +++ b/fieldtrip/__plotting/_htmlcolors.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _htmlcolors(*args, **kwargs): + """ + HTMLCOLORS looks up the RGB value for a named color (string), or the name for a given RGB value + + Use as + rgb = htmlcolors(name) + or + name = htmlcolors(rgb) + or + list = htmlcolors + + See https://www.rapidtables.com/web/color/html-color-codes.html + and https://www.color-hex.com/color-palettes/ + + See also STANDARDCOLORS, COLORSPEC2RGB, FT_COLORMAP, COLORMAP, COLORMAPEDITOR, BREWERMAP, MATPLOTLIB, CMOCEAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/htmlcolors.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("htmlcolors", *args, **kwargs) diff --git a/fieldtrip/__plotting/_inside_contour.py b/fieldtrip/__plotting/_inside_contour.py new file mode 100644 index 0000000..d8da3cb --- /dev/null +++ b/fieldtrip/__plotting/_inside_contour.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _inside_contour(*args, **kwargs): + """ + inside_contour is a function. + bool = inside_contour(pos, contour) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/inside_contour.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("inside_contour", *args, **kwargs) diff --git a/fieldtrip/__plotting/_intersect_line.py b/fieldtrip/__plotting/_intersect_line.py new file mode 100644 index 0000000..26e4de1 --- /dev/null +++ b/fieldtrip/__plotting/_intersect_line.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _intersect_line(*args, **kwargs): + """ + INTERSECT_LINE finds the intersection points between a mesh and a line. + + Use as: + [points, pos, indx] = intersect_line(pnt, tri, pnt1, pnt2) + + Where pnt (Nx3) and tri (Mx3) define the mesh, and pnt1 (1x3) and pnt2 + (1x3) define the line. The output argument points (Px3) are the + intersection points, pos (Px1) the location on the line (relative to + pnt1) and indx is the index to the triangles of the mesh that are + intersected. + + This code is based from a function from the geom3d toolbox, that can be + found on matlab's file exchange. The original help is pasted below. The + original function was released under the BSD-license. + + Adapted to FieldTrip by Jan-Mathijs Schoffelen 2012 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/intersect_line.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("intersect_line", *args, **kwargs) diff --git a/fieldtrip/__plotting/_intersect_plane.py b/fieldtrip/__plotting/_intersect_plane.py new file mode 100644 index 0000000..be3ae0e --- /dev/null +++ b/fieldtrip/__plotting/_intersect_plane.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _intersect_plane(*args, **kwargs): + """ + INTERSECT_PLANE intersection between a triangulated surface mesh and a plane. It + returns the coordinates of the begin- and endpoints of the line segments that + together form the contour of the intersection. + + Use as + [X, Y, Z] = intersect_plane(pos, tri, v1, v2, v3) + + where the intersecting plane is spanned by the vertices v1, v2, v3 and the return + values are the X, Y and Z coordinates of the begin- and endpoints for all line + segments. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/intersect_plane.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("intersect_plane", *args, **kwargs) diff --git a/fieldtrip/__plotting/_issubfield.py b/fieldtrip/__plotting/_issubfield.py new file mode 100644 index 0000000..75bc5b7 --- /dev/null +++ b/fieldtrip/__plotting/_issubfield.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _issubfield(*args, **kwargs): + """ + ISSUBFIELD tests for the presence of a field in a structure just like the standard + Matlab ISFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = issubfield(s, 'fieldname') + or as + f = issubfield(s, 'fieldname.subfieldname') + + This function returns true if the field is present and false if the field + is not present. + + See also ISFIELD, GETSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/issubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("issubfield", *args, **kwargs) diff --git a/fieldtrip/__plotting/_istrue.py b/fieldtrip/__plotting/_istrue.py new file mode 100644 index 0000000..f119c68 --- /dev/null +++ b/fieldtrip/__plotting/_istrue.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _istrue(*args, **kwargs): + """ + ISTRUE converts an input argument like "yes/no", "true/false" or "on/off" into a + boolean. If the input is boolean, then it will remain like that. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/istrue.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("istrue", *args, **kwargs) diff --git a/fieldtrip/__plotting/_keyval.py b/fieldtrip/__plotting/_keyval.py new file mode 100644 index 0000000..32d6c0d --- /dev/null +++ b/fieldtrip/__plotting/_keyval.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _keyval(*args, **kwargs): + """ + KEYVAL returns the value that corresponds to the requested key in a + key-value pair list of variable input arguments + + Use as + [val] = keyval(key, varargin) + + See also VARARGIN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/keyval.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("keyval", *args, **kwargs) diff --git a/fieldtrip/__plotting/_keyvalcheck.py b/fieldtrip/__plotting/_keyvalcheck.py new file mode 100644 index 0000000..f24ef33 --- /dev/null +++ b/fieldtrip/__plotting/_keyvalcheck.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _keyvalcheck(*args, **kwargs): + """ + KEYVALCHECK is a helper function for parsing optional key-value input pairs. + + Use as + keyvalcheck(argin, 'required', {'key1', 'key2', ...}) + keyvalcheck(argin, 'forbidden', {'key1', 'key2', ...}) + keyvalcheck(argin, 'optional', {'key1', 'key2', ...}) + + See also KEYVAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/keyvalcheck.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("keyvalcheck", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__plotting/_lmoutrn.py b/fieldtrip/__plotting/_lmoutrn.py new file mode 100644 index 0000000..6053399 --- /dev/null +++ b/fieldtrip/__plotting/_lmoutrn.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _lmoutrn(*args, **kwargs): + """ + LMOUTRN computes the la/mu parameters of a point projected to triangles + + Use as + [la, mu, dist, proj] = lmoutrn(v1, v2, v3, r) + where v1, v2 and v3 are Nx3 matrices with vertex positions of the triangles, + and r is the point that is projected onto the planes spanned by the vertices + This is a vectorized version of Robert's lmoutrn function and is + generally faster than a for-loop around the mex-file. It also returns the + projection of the point r onto the planes of the triangles, and the signed + distance to the triangles. The sign of the distance is negative if the point + lies closer to the average across all vertices and the triangle under consideration. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/lmoutrn.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("lmoutrn", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ltrisect.py b/fieldtrip/__plotting/_ltrisect.py new file mode 100644 index 0000000..3672b42 --- /dev/null +++ b/fieldtrip/__plotting/_ltrisect.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _ltrisect(*args, **kwargs): + """ + LTRISECT intersects a line with a plane spanned by three vertices + + Use as + [sect] = ltrisect(v1, v2, v3, l1, l2) + where v1, v2 and v3 are three vertices spanning the plane, and l1 and l2 + are two points on the line + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ltrisect.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ltrisect", *args, **kwargs) diff --git a/fieldtrip/__plotting/_match_str.py b/fieldtrip/__plotting/_match_str.py new file mode 100644 index 0000000..c446a66 --- /dev/null +++ b/fieldtrip/__plotting/_match_str.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _match_str(*args, **kwargs): + """ + MATCH_STR looks for matching labels in two lists of strings + and returns the indices into both the 1st and 2nd list of the matches. + They will be ordered according to the first input argument. + + Use as + [sel1, sel2] = match_str(strlist1, strlist2) + + The strings can be stored as a char matrix or as an vertical array of + cells, the matching is done for each row. + + When including a 1 as the third input argument, the output lists of + indices will be expanded to the size of the largest input argument. + Entries that occur only in one of the two inputs will correspond to a 0 + in the output, in this case. This can be convenient in rare cases if the + size of the input lists is meaningful. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/match_str.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("match_str", *args, **kwargs) diff --git a/fieldtrip/__plotting/_menu_viewpoint.py b/fieldtrip/__plotting/_menu_viewpoint.py new file mode 100644 index 0000000..015d5be --- /dev/null +++ b/fieldtrip/__plotting/_menu_viewpoint.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _menu_viewpoint(*args, **kwargs): + """ + MENU_VIEWPOINT adds a context menu to a 3D figure. + + See also MENU_FIELDTRIP + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/menu_viewpoint.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("menu_viewpoint", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__plotting/_mesh2edge.py b/fieldtrip/__plotting/_mesh2edge.py new file mode 100644 index 0000000..cb19866 --- /dev/null +++ b/fieldtrip/__plotting/_mesh2edge.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _mesh2edge(*args, **kwargs): + """ + MESH2EDGE finds the edge lines from a triangulated mesh or the edge + surfaces from a tetrahedral or hexahedral mesh. An edge is defined as an + element that does not border any other element. This also implies that a + closed triangulated surface has no edges. + + Use as + [edge] = mesh2edge(mesh) + + See also POLY2TRI, TRI2BND + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/mesh2edge.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh2edge", *args, **kwargs) diff --git a/fieldtrip/__plotting/_mesh_cone.py b/fieldtrip/__plotting/_mesh_cone.py new file mode 100644 index 0000000..2450649 --- /dev/null +++ b/fieldtrip/__plotting/_mesh_cone.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_cone(*args, **kwargs): + """ + MESH_CONE creates a triangulated cone + + Use as + [pnt, tri] = mesh_cone(N) + + This creates a cone with N-2 vertices on the bottom circle and N vertices in total. + + See also MESH_TETRAHEDRON, MESH_OCTAHEDRON, MESH_ICOSAHEDRON, MESH_SPHERE, MESH_CUBE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/mesh_cone.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_cone", *args, **kwargs) diff --git a/fieldtrip/__plotting/_mesh_cube.py b/fieldtrip/__plotting/_mesh_cube.py new file mode 100644 index 0000000..bec07e3 --- /dev/null +++ b/fieldtrip/__plotting/_mesh_cube.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_cube(*args, **kwargs): + """ + MESH_CUBE creates a triangulated cube + + Use as + [pos, tri] = mesh_cube() + + See also MESH_TETRAHEDRON, MESH_OCTAHEDRON, MESH_ICOSAHEDRON, MESH_SPHERE, MESH_CONE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/mesh_cube.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_cube", *args, **kwargs) diff --git a/fieldtrip/__plotting/_mesh_cylinder.py b/fieldtrip/__plotting/_mesh_cylinder.py new file mode 100644 index 0000000..7cf3042 --- /dev/null +++ b/fieldtrip/__plotting/_mesh_cylinder.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_cylinder(*args, **kwargs): + """ + MESH_CYLINDER creates a triangulated cylinder + + Use as + [pnt, tri] = mesh_cylinder(Naz, Nel) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/mesh_cylinder.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_cylinder", *args, **kwargs) diff --git a/fieldtrip/__plotting/_mesh_icosahedron.py b/fieldtrip/__plotting/_mesh_icosahedron.py new file mode 100644 index 0000000..63679f6 --- /dev/null +++ b/fieldtrip/__plotting/_mesh_icosahedron.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_icosahedron(*args, **kwargs): + """ + MESH_ICOSAHEDRON returns the vertices and triangle of a 12-vertex icosahedral + mesh. + + Use as + [pos, tri] = mesh_icosahedron + + See also MESH_TETRAHEDRON, MESH_OCTAHEDRON, MESH_SPHERE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/mesh_icosahedron.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_icosahedron", *args, **kwargs) diff --git a/fieldtrip/__plotting/_mesh_octahedron.py b/fieldtrip/__plotting/_mesh_octahedron.py new file mode 100644 index 0000000..2652282 --- /dev/null +++ b/fieldtrip/__plotting/_mesh_octahedron.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_octahedron(*args, **kwargs): + """ + MESH_OCTAHEDRON returns the vertices and triangles of an octahedron + + Use as + [pos tri] = mesh_octahedron; + + See also MESH_TETRAHEDRON, MESH_OCTAHEDRON, MESH_SPHERE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/mesh_octahedron.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_octahedron", *args, **kwargs) diff --git a/fieldtrip/__plotting/_mesh_sphere.py b/fieldtrip/__plotting/_mesh_sphere.py new file mode 100644 index 0000000..9d54a0d --- /dev/null +++ b/fieldtrip/__plotting/_mesh_sphere.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_sphere(*args, **kwargs): + """ + MESH_SPHERE creates spherical mesh, with approximately nvertices vertices + + Use as + [pos, tri] = mesh_sphere(n, method) + + The input parameter 'n' specifies the (approximate) number of vertices. If n is + empty, or undefined, a 12 vertex icosahedron will be returned. If n is specified + but the method is not specified, the most optimal method will be selected based on + n. + - If log4((n-2)/10) is an integer, the mesh will be based on an icosahedron. + - If log4((n-2)/4) is an integer, the mesh will be based on a refined octahedron. + - If log4((n-2)/2) is an integer, the mesh will be based on a refined tetrahedron. + - Otherwise, an msphere will be used. + + The input parameter 'method' defines which algorithm or approach to use. This can + be 'icosahedron', 'octahedron', 'tetrahedron', 'fibonachi', 'msphere', or 'ksphere'. + + See also MESH_TETRAHEDRON, MESH_OCTAHEDRON, MESH_ICOSAHEDRON + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/mesh_sphere.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_sphere", *args, **kwargs) diff --git a/fieldtrip/__plotting/_mesh_tetrahedron.py b/fieldtrip/__plotting/_mesh_tetrahedron.py new file mode 100644 index 0000000..63e14c5 --- /dev/null +++ b/fieldtrip/__plotting/_mesh_tetrahedron.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_tetrahedron(*args, **kwargs): + """ + MESH_TETRAHEDRON returns the vertices and triangles of a tetrahedron. + + Use as + [pos, tri] = mesh_tetrahedron; + + See also MESH_ICOSAHEDRON, MESH_OCTAHEDRON, MESH_SPHERE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/mesh_tetrahedron.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_tetrahedron", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ndgrid.py b/fieldtrip/__plotting/_ndgrid.py new file mode 100644 index 0000000..b3896c6 --- /dev/null +++ b/fieldtrip/__plotting/_ndgrid.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def _ndgrid(*args, **kwargs): + """ + NDGRID Generation of arrays for N-D functions and interpolation. + [X1,X2,X3,...] = NDGRID(x1,x2,x3,...) transforms the domain + specified by vectors x1,x2,x3, etc. into arrays X1,X2,X3, etc. that + can be used for the evaluation of functions of N variables and N-D + interpolation. The i-th dimension of the output array Xi are copies + of elements of the vector xi. + + [X1,X2,...] = NDGRID(x) is the same as [X1,X2,...] = NDGRID(x,x,...). + + For example, to evaluate the function x2*exp(-x1^2-x2^2-x^3) over the + range -2 < x1 < 2, -2 < x2 < 2, -2 < x3 < 2, + + [x1,x2,x3] = ndgrid(-2:.2:2, -2:.25:2, -2:.16:2); + z = x2 .* exp(-x1.^2 - x2.^2 - x3.^2); + slice(x2,x1,x3,z,[-1.2 .8 2],2,[-2 -.2]) + + NDGRID is like MESHGRID except that the order of the first two input + arguments are switched (i.e., [X1,X2,X3] = NDGRID(x1,x2,x3) produces + the same result as [X2,X1,X3] = MESHGRID(x2,x1,x3)). Because of + this, NDGRID is better suited to N-D problems that aren't spatially + based, while MESHGRID is better suited to problems in cartesian + space (2-D or 3-D). + + This is a drop-in replacement for the MATLAB version in elmat, which is + relatively slow for big grids. Note that this function only works up + to 5 dimensions + + See also MESHGRID, INTERPN. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ndgrid.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ndgrid", *args, **kwargs) diff --git a/fieldtrip/__plotting/_octahedron.py b/fieldtrip/__plotting/_octahedron.py new file mode 100644 index 0000000..cfb3f52 --- /dev/null +++ b/fieldtrip/__plotting/_octahedron.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _octahedron(*args, **kwargs): + """ + OCTAHEDRON + + Use as + [pos tri] = octahedron; + + See also TETRAHEDRON ICOSAHEDRON + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/octahedron.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("octahedron", *args, **kwargs) diff --git a/fieldtrip/__plotting/_pinvNx2.py b/fieldtrip/__plotting/_pinvNx2.py new file mode 100644 index 0000000..08df705 --- /dev/null +++ b/fieldtrip/__plotting/_pinvNx2.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _pinvNx2(*args, **kwargs): + """ + PINVNX2 computes a pseudo-inverse of the M slices of an MxNx2 real-valued matrix. + Output has dimensionality Mx2xN. This implementation is generally faster + than calling pinv in a for-loop, once M > 2 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/pinvNx2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("pinvNx2", *args, **kwargs) diff --git a/fieldtrip/__plotting/_projecttri.py b/fieldtrip/__plotting/_projecttri.py new file mode 100644 index 0000000..cdf6e1c --- /dev/null +++ b/fieldtrip/__plotting/_projecttri.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _projecttri(*args, **kwargs): + """ + PROJECTTRI makes a closed triangulation of a list of vertices by + projecting them onto a unit sphere and subsequently by constructing + a convex hull triangulation. + + Use as + tri = projecttri(pos, method) + where method is either 'convhull' (default) or 'delaunay'. + + See also SURFACE_NORMALS, PCNORMALS, ELPROJ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/projecttri.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("projecttri", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ptriprojn.py b/fieldtrip/__plotting/_ptriprojn.py new file mode 100644 index 0000000..8a6da69 --- /dev/null +++ b/fieldtrip/__plotting/_ptriprojn.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _ptriprojn(*args, **kwargs): + """ + PTRIPROJN projects a point onto the plane going through a set of + triangles + + Use as + [proj, dist] = ptriprojn(v1, v2, v3, r, flag) + where v1, v2 and v3 are Nx3 matrices with vertex positions of the triangles, + and r is the point that is projected onto the planes spanned by the vertices + This is a vectorized version of Robert's ptriproj function and is + generally faster than a for-loop around the mex-file. + + the optional flag can be: + 0 (default) project the point anywhere on the complete plane + 1 project the point within or on the edge of the triangle + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ptriprojn.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ptriprojn", *args, **kwargs) diff --git a/fieldtrip/__plotting/_ptriside.py b/fieldtrip/__plotting/_ptriside.py new file mode 100644 index 0000000..4f18f37 --- /dev/null +++ b/fieldtrip/__plotting/_ptriside.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _ptriside(*args, **kwargs): + """ + PTRISIDE determines the side of a plane on which a set of points lie. It + returns 0 for the points that lie exactly on the plane. + + [side] = ptriside(v1, v2, v3, r) + + the side of points r is determined relative to the plane spanned by + vertices v1, v2 and v3. v1,v2 and v3 should be 1x3 vectors. r should be a + Nx3 matrix + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/ptriside.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ptriside", *args, **kwargs) diff --git a/fieldtrip/__plotting/_quaternion.py b/fieldtrip/__plotting/_quaternion.py new file mode 100644 index 0000000..61fe91b --- /dev/null +++ b/fieldtrip/__plotting/_quaternion.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _quaternion(*args, **kwargs): + """ + QUATERNION returns the homogenous coordinate transformation matrix corresponding to + a coordinate transformation described by 7 quaternion parameters. + + Use as + [H] = quaternion(Q) + where + Q [q0, q1, q2, q3, q4, q5, q6] vector with parameters + H corresponding homogenous transformation matrix + + If the input vector has length 6, it is assumed to represent a unit quaternion without scaling. + + See Neuromag/Elekta/Megin MaxFilter manual version 2.2, section "D2 Coordinate Matching", page 77 for more details and + https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#Conversion_to_and_from_the_matrix_representation + + See also TRANSLATE, ROTATE, SCALE, HOMOGENOUS2QUATERNION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/quaternion.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("quaternion", *args, **kwargs) diff --git a/fieldtrip/__plotting/_refine.py b/fieldtrip/__plotting/_refine.py new file mode 100644 index 0000000..c5ca30b --- /dev/null +++ b/fieldtrip/__plotting/_refine.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def _refine(*args, **kwargs): + """ + REFINE a 3D surface that is described by a triangulation + + Use as + [pos, tri] = refine(pos, tri) + [pos, tri] = refine(pos, tri, 'banks') + [pos, tri, texture] = refine(pos, tri, 'banks', texture) + [pos, tri] = refine(pos, tri, 'updown', numtri) + + If no method is specified, the default is to refine the mesh globally by bisecting + each edge according to the algorithm described in Banks, 1983. + + The Banks method allows the specification of a subset of triangles to be refined + according to Banks' algorithm. Adjacent triangles will be gracefully dealt with. + + The alternative 'updown' method refines the mesh a couple of times + using Banks' algorithm, followed by a downsampling using the REDUCEPATCH + function. + + If the textures of the vertices are specified, the textures for the new + vertices are computed + + The Banks method is a memory efficient implementation which remembers the + previously inserted vertices. The refinement algorithm executes in linear + time with the number of triangles. It is mentioned in + http://www.cs.rpi.edu/~flaherje/pdf/fea8.pdf, which also contains the original + reference. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/refine.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("refine", *args, **kwargs) diff --git a/fieldtrip/__plotting/_remove_vertices.py b/fieldtrip/__plotting/_remove_vertices.py new file mode 100644 index 0000000..14b7fe6 --- /dev/null +++ b/fieldtrip/__plotting/_remove_vertices.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _remove_vertices(*args, **kwargs): + """ + REMOVE_VERTICES removes specified indexed vertices from a triangular, tetrahedral + or hexahedral mesh renumbering the vertex-indices for the elements and removing all + resulting 'open' elements. + + Use as + [pos, tri] = remove_vertices(pos, tri, sel) + [pos, tet] = remove_vertices(pos, tet, sel) + [pos, hex] = remove_vertices(pos, hex, sel) + + See also REMOVE_DOUBLE_VERTICES, REMOVE_UNUSED_VERTICES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/remove_vertices.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("remove_vertices", *args, **kwargs) diff --git a/fieldtrip/__plotting/_rmsubfield.py b/fieldtrip/__plotting/_rmsubfield.py new file mode 100644 index 0000000..d563a01 --- /dev/null +++ b/fieldtrip/__plotting/_rmsubfield.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _rmsubfield(*args, **kwargs): + """ + RMSUBFIELD removes the contents of the specified field from a structure + just like the standard Matlab RMFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = rmsubfield(s, 'fieldname') + or as + s = rmsubfield(s, 'fieldname.subfieldname') + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/rmsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rmsubfield", *args, **kwargs) diff --git a/fieldtrip/__plotting/_rotate.py b/fieldtrip/__plotting/_rotate.py new file mode 100644 index 0000000..3e35ee5 --- /dev/null +++ b/fieldtrip/__plotting/_rotate.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _rotate(*args, **kwargs): + """ + ROTATE returns the homogenous coordinate transformation matrix + corresponding to a rotation around the x, y and z-axis. The direction of + the rotation is according to the right-hand rule. + + Use as + [H] = rotate(R) + where + R [rx, ry, rz] in degrees + H corresponding homogenous transformation matrix + + Note that the order in which the rotations are performs matters. The + rotation is first done around the z-axis, then the y-axis and finally the + x-axis. + + See also TRANSLATE, SCALE, RIGIDBODY, QUATERNION, HOMOGENOUS2TRADITIONAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/rotate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rotate", *args, **kwargs) diff --git a/fieldtrip/__plotting/_scale.py b/fieldtrip/__plotting/_scale.py new file mode 100644 index 0000000..3094764 --- /dev/null +++ b/fieldtrip/__plotting/_scale.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _scale(*args, **kwargs): + """ + SCALE returns the homogenous coordinate transformation matrix + corresponding to a scaling along the x, y and z-axis + + Use as + [H] = translate(S) + where + S [sx, sy, sz] scaling along each of the axes + H corresponding homogenous transformation matrix + + See also TRANSLATE, ROTATE, RIGIDBODY, QUATERNION, HOMOGENOUS2TRADITIONAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/scale.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("scale", *args, **kwargs) diff --git a/fieldtrip/__plotting/_select3d.py b/fieldtrip/__plotting/_select3d.py new file mode 100644 index 0000000..3aa630c --- /dev/null +++ b/fieldtrip/__plotting/_select3d.py @@ -0,0 +1,88 @@ +from fieldtrip._runtime import Runtime + + +def _select3d(*args, **kwargs): + """ + SELECT3D(H) Determines the selected point in 3-D data space. + P = SELECT3D determines the point, P, in data space corresponding + to the current selection position. P is a point on the first + patch or surface face intersected along the selection ray. If no + face is encountered along the selection ray, P returns empty. + + P = SELECT3D(H) constrains selection to graphics handle H and, + if applicable, any of its children. H can be a figure, axes, + patch, or surface object. + + [P V] = SELECT3D(...), V is the closest face or line vertex + selected based on the figure's current object. + + [P V VI] = SELECT3D(...), VI is the index into the object's + x,y,zdata properties corresponding to V, the closest face vertex + selected. + + [P V VI FACEV] = SELECT3D(...), FACE is an array of vertices + corresponding to the face polygon containing P and V. + + [P V VI FACEV FACEI] = SELECT3D(...), FACEI is the row index into + the object's face array corresponding to FACE. For patch + objects, the face array can be obtained by doing + get(mypatch,'faces'). For surface objects, the face array + can be obtained from the output of SURF2PATCH (see + SURF2PATCH for more information). + + RESTRICTIONS: + SELECT3D supports surface, patch, or line object primitives. For surface + and patches, the algorithm assumes non-self-intersecting planar faces. + For line objects, the algorithm always returns P as empty, and V will + be the closest vertex relative to the selection point. + + Example: + + h = surf(peaks); + zoom(10); + disp('Click anywhere on the surface, then hit return') + pause + [p v vi face facei] = select3d; + marker1 = line('xdata',p(1),'ydata',p(2),'zdata',p(3),'marker','o',... + 'erasemode','xor','markerfacecolor','k'); + marker2 = line('xdata',v(1),'ydata',v(2),'zdata',v(3),'marker','o',... + 'erasemode','xor','markerfacecolor','k'); + marker2 = line('erasemode','xor','xdata',face(1,:),'ydata',face(2,:),... + 'zdata',face(3,:),'linewidth',10); + disp(sprintf('\nYou clicked at\nX: %.2f\nY: %.2f\nZ: %.2f',p(1),p(2),p(3)')) + disp(sprintf('\nThe nearest vertex is\nX: %.2f\nY: %.2f\nZ: %.2f',v(1),v(2),v(3)')) + + Version 1.2 2-15-02 + Copyright Joe Conti 2002 + Send comments to jconti@mathworks.com + + See also GINPUT, GCO. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/select3d.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("select3d", *args, **kwargs) diff --git a/fieldtrip/__plotting/_select3dtool.py b/fieldtrip/__plotting/_select3dtool.py new file mode 100644 index 0000000..5287d51 --- /dev/null +++ b/fieldtrip/__plotting/_select3dtool.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _select3dtool(*args, **kwargs): + """ + SELECT3DTOOL A simple tool for interactively obtaining 3-D coordinates + + SELECT3DTOOL(FIG) Specify figure handle + + Example: + surf(peaks); + select3dtool; + % click on surface + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/select3dtool.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("select3dtool", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__plotting/_setsubfield.py b/fieldtrip/__plotting/_setsubfield.py new file mode 100644 index 0000000..db26f68 --- /dev/null +++ b/fieldtrip/__plotting/_setsubfield.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _setsubfield(*args, **kwargs): + """ + SETSUBFIELD sets the contents of the specified field to a specified value + just like the standard Matlab SETFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = setsubfield(s, 'fieldname', value) + or as + s = setsubfield(s, 'fieldname.subfieldname', value) + + where nested is a logical, false denoting that setsubfield will create + s.subfieldname instead of s.fieldname.subfieldname + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/setsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("setsubfield", *args, **kwargs) diff --git a/fieldtrip/__plotting/_setviewpoint.py b/fieldtrip/__plotting/_setviewpoint.py new file mode 100644 index 0000000..d6d258f --- /dev/null +++ b/fieldtrip/__plotting/_setviewpoint.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _setviewpoint(*args, **kwargs): + """ + SETVIEWPOINT changes the viewpoint for a 3D image that contains data in a known coordinate system + + Use as + setviewpoint(ax, coordsys, viewpoint) + + For example + setviewpoint(gca, 'mni', 'left') + + See also GETORTHOVIEWPOS, COORDSYS2LABEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/setviewpoint.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("setviewpoint", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__plotting/_solid_angle.py b/fieldtrip/__plotting/_solid_angle.py new file mode 100644 index 0000000..4201a90 --- /dev/null +++ b/fieldtrip/__plotting/_solid_angle.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _solid_angle(*args, **kwargs): + """ + SOLID_ANGLE of a planar triangle as seen from the origin + + The solid angle W subtended by a surface S is defined as the surface + area W of a unit sphere covered by the surface's projection onto the + sphere. Solid angle is measured in steradians, and the solid angle + corresponding to all of space being subtended is 4*pi sterradians. + + Use: + [w] = solid_angle(v1, v2, v3) + or + [w] = solid_angle(pnt, tri) + where v1, v2 and v3 are the vertices of a single triangle in 3D or + pnt and tri contain a description of a triangular mesh (this will + compute the solid angle for each triangle) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/solid_angle.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("solid_angle", *args, **kwargs) diff --git a/fieldtrip/__plotting/_standardcolors.py b/fieldtrip/__plotting/_standardcolors.py new file mode 100644 index 0000000..9eae210 --- /dev/null +++ b/fieldtrip/__plotting/_standardcolors.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def _standardcolors(*args, **kwargs): + """ + STANDARDCOLORS looks up the RGB value for a named color that is specified as + a string, or looks up the name given the RGB value. + + Use as + rgb = standardcolors(name) + or + name = standardcolors(rgb) + or + list = standardcolors + + This returns a predefined color as [red green blue] values, according to + the following mapping: + red = [255 0 0]/255; + green = [ 0 192 0]/255; + blue = [ 0 0 255]/255; + magenta = [255 255 0]/255; + cyan = [ 0 255 255]/255; + yellow = [255 255 0]/255; + white = [255 255 255]/255; + black = [ 0 0 0]/255; + brain = [202 100 100]/255; + skull = [140 85 85]/255 + cortex = [255 213 119]/255; + cortex_light = [199 194 169]/255; + cortex_dark = [100 97 85]/255; + skin = [249 223 192]/255; + skin_light = [249 223 192]/255; + skin_medium_light = [225 194 158]/255; + skin_medium = [188 142 106]/255; + skin_medium_dark = [155 102 65]/255; + skin_dark = [ 91 71 61]/255; + + The different skin-based colors follow the Fitzpatrick scale with type I and II + combined, and return RGB values that approximate those used by Apple in the emoji + skin tones. See also https://emojipedia.org/emoji-modifier-sequence/ + + If no specific skin tone is specified, this function returns a light skin color. + This corresponds with that of one of the developers who approximated his own skin + color more than 15 years ago upon the first implementation of this function. + + See also HTMLCOLORS, COLORSPEC2RGB, FT_COLORMAP, COLORMAP, COLORMAPEDITOR, BREWERMAP, MATPLOTLIB, CMOCEAM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/standardcolors.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("standardcolors", *args, **kwargs) diff --git a/fieldtrip/__plotting/_surface_normals.py b/fieldtrip/__plotting/_surface_normals.py new file mode 100644 index 0000000..01b20a0 --- /dev/null +++ b/fieldtrip/__plotting/_surface_normals.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _surface_normals(*args, **kwargs): + """ + SURFACE_NORMALS compute the surface normals of a triangular mesh + for each triangle or for each vertex + + Use as + nrm = surface_normals(pnt, tri, opt) + where opt is either 'vertex' (default) or 'triangle'. + + See also SURFACE_AREA, SURFACE_ORIENTATION, SURFACE_INSIDE, SURFACE_NESTING, PROJECTTRI, PCNORMALS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/surface_normals.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("surface_normals", *args, **kwargs) diff --git a/fieldtrip/__plotting/_surface_orientation.py b/fieldtrip/__plotting/_surface_orientation.py new file mode 100644 index 0000000..6224bf3 --- /dev/null +++ b/fieldtrip/__plotting/_surface_orientation.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _surface_orientation(*args, **kwargs): + """ + SURFACE_ORIENTATION returns the string 'inward' or 'outward' or 'unknown', + depending on the surface orientation. + + Use as + str = surface_orientation(pos, tri) + or + str = surface_orientation(pos, tri, ori) + + See also SURFACE_AREA, SURFACE_NESTING, SURFACE_NORMALS, SURFACE_NESTING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/surface_orientation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("surface_orientation", *args, **kwargs) diff --git a/fieldtrip/__plotting/_tetrahedron.py b/fieldtrip/__plotting/_tetrahedron.py new file mode 100644 index 0000000..69ab9fe --- /dev/null +++ b/fieldtrip/__plotting/_tetrahedron.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _tetrahedron(*args, **kwargs): + """ + TETRAHEDRON returns the vertices and triangles of a tetraedron + + Use as + [pos, tri] = tetrahedron; + + See also ICOSAHEDRON, OCTAHEDRON + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/tetrahedron.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("tetrahedron", *args, **kwargs) diff --git a/fieldtrip/__plotting/_translate.py b/fieldtrip/__plotting/_translate.py new file mode 100644 index 0000000..0851577 --- /dev/null +++ b/fieldtrip/__plotting/_translate.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _translate(*args, **kwargs): + """ + TRANSLATE returns the homogenous coordinate transformation matrix + corresponding to a translation along the x, y and z-axis + + Use as + [H] = translate(T) + where + T [tx, ty, tz] translation along each of the axes + H corresponding homogenous transformation matrix + + See also ROTATE, SCALE, RIGIDBODY, QUATERNION, HOMOGENOUS2TRADITIONAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/translate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("translate", *args, **kwargs) diff --git a/fieldtrip/__plotting/_triangle2connectivity.py b/fieldtrip/__plotting/_triangle2connectivity.py new file mode 100644 index 0000000..5972b9c --- /dev/null +++ b/fieldtrip/__plotting/_triangle2connectivity.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _triangle2connectivity(*args, **kwargs): + """ + TRIANGLE2CONNECTIVITY computes a connectivity-matrix from a triangulation. + + Use as + [connmat] = triangle2connectivity(tri) + or + [connmat] = triangle2connectivity(tri, pos) + + The input tri is an Mx3 matrix describing a triangulated surface, + containing indices to connecting vertices. The output connmat is a sparse + logical NxN matrix, with ones, where vertices are connected, and zeros + otherwise. + + If you specify the vertex positions in the second input argument as Nx3 + matrix, the output will be a sparse matrix with the lengths of the + edges between the connected vertices. + + See also CHANNELCONNECTIVIY + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/triangle2connectivity.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("triangle2connectivity", *args, **kwargs) diff --git a/fieldtrip/__plotting/_undobalancing.py b/fieldtrip/__plotting/_undobalancing.py new file mode 100644 index 0000000..71d0dc7 --- /dev/null +++ b/fieldtrip/__plotting/_undobalancing.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _undobalancing(*args, **kwargs): + """ + UNDOBALANCING removes all balancing coefficients from the gradiometer sensor array + + This is used in CHANNELPOSITION, FT_PREPARE_LAYOUT, FT_SENSTYPE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/private/undobalancing.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("undobalancing", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_colormap.py b/fieldtrip/__plotting/ft_colormap.py new file mode 100644 index 0000000..e071e37 --- /dev/null +++ b/fieldtrip/__plotting/ft_colormap.py @@ -0,0 +1,82 @@ +from fieldtrip._runtime import Runtime + + +def ft_colormap(*args, **kwargs): + """ + FT_COLORMAP is a wrapper function with the same usage as the normal COLORMAP + function, but it also knows about the colormaps from BREWERMAP and some colormaps + from MATPLOTLIB. The recommended colormaps include 'parula', 'cividis', 'balance', + and '*RdBu'. + + Use as + ft_colormap(name) + ft_colormap(name, n) + ft_colormap(handle, name) + ft_colormap(handle, name, n) + + The name is a string that specifies the colormap (see below). The optional handle + can be used to specify the current figure (which is the default, see GCF) or the + current axes (see GCA). The optional parameter n determines the number of steps or + unique colors in the map (by default 64). + + The colormaps from MATLAB include 'parula', 'jet', 'hsv', 'hot', 'cool', 'spring', + 'summer', 'autumn', 'winter', 'gray', 'bone', 'copper', 'pink', 'lines', + 'colorcube', 'prism', and 'flag'. + + The colormaps from MATPLOTLIB include 'cividis', 'inferno', 'magma', 'plasma', + 'tab10', 'tab20', 'tab20b', 'tab20c', 'twilight', and 'viridis'. + + The colormaps from BREWERMAP include 'BrBG', 'PRGn', 'PiYG', 'PuOr', 'RdBu', + 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral', 'Accent', 'Dark2', 'Paired', 'Pastel1', + 'Pastel2', 'Set1', 'Set2', 'Set3', 'Blues', 'BuGn', 'BuPu', 'GnBu', 'Greens', + 'Greys', 'OrRd', 'Oranges', 'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu', 'Reds', + 'YlGn', 'YlGnBu', 'YlOrBr', and 'YlOrRd', plus their reverse when prefixed with '*'. + + The colormaps from CMOCEAN include 'thermal', 'haline', 'solar', 'ice', 'gray', + 'oxy', 'deep', 'dense', 'algae', 'matter', 'turbid', 'speed', 'amp', 'tempo', + 'rain', 'phase', 'topo', 'balance', 'delta', 'curl', 'diff', and 'tarn'. + + The colormaps from COLORCET include 'blueternary', 'coolwarm', 'cyclicgrey', + 'depth', 'divbjy', 'fire', 'geographic', 'geographic2', 'gouldian', 'gray', + 'greenternary', 'grey', 'heat', 'phase2', 'phase4', 'rainbow', 'rainbow2', + 'rainbow3', 'rainbow4', 'redternary', 'reducedgrey', 'yellowheat', and all the ones + with symbolic names. + + To reverse any of these these colormaps you can add a minus sign in front, like + '-phase', '-balance' or '-RdBu'. + + Relevant publications: + - Crameri et al. 2020. The misuse of colour in science communication. https://doi.org/10.1038/s41467-020-19160-7 + - Cooper et al. 2021. Over the rainbow: Guidelines for meaningful use of colour maps in neurophysiology. https://doi.org/10.1016/j.neuroimage.2021.118628 + - Kovesi 2015, Good colour maps: How to design them. https://doi.org/10.48550/arXiv.1509.03700 + + See also COLORMAP, COLORMAPEDITOR, BREWERMAP, MATPLOTLIB, CMOCEAN, COLORCET, COLORSPEC2RGB + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_colormap.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_colormap", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_headlight.py b/fieldtrip/__plotting/ft_headlight.py new file mode 100644 index 0000000..a76c4e5 --- /dev/null +++ b/fieldtrip/__plotting/ft_headlight.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def ft_headlight(*args, **kwargs): + """ + FT_HEADLIGHT places a light along the direction of the camera and updates the light + position as you rotate the scene and the camera view point changes. + + Use as + surf(peaks); + ft_headlight; + + See https://stackoverflow.com/questions/30921003/matlab-how-to-make-camera-light-follow-3d-rotation + + See also CAMLIGHT, ROTATE3D + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_headlight.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headlight", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__plotting/ft_plot_axes.py b/fieldtrip/__plotting/ft_plot_axes.py new file mode 100644 index 0000000..0c8a6d8 --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_axes.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_axes(*args, **kwargs): + """ + FT_PLOT_AXES adds three axes of 150 mm and a 10 mm sphere at the origin to the + present 3-D figure. The axes and sphere are scaled according to the units of the + geometrical object that is passed to this function. Furthermore, when possible, + the axes labels will represent the anatomical labels corresponding to the + specified coordinate system. + + Use as + ft_plot_axes(object) + + Additional optional input arguments should be specified as key-value pairs + and can include + 'unit' = string, plot axes that are suitable for the specified geometrical units (default = []) + 'axisscale' = scaling factor for the reference axes and sphere (default = 1) + 'coordsys' = string, assume the data to be in the specified coordinate system (default = 'unknown') + 'transform' = empty or 4x4 homogenous transformation matrix (default = []) + 'fontcolor' = string, color specification (default = [1 .5 0], i.e. orange) + 'fontsize' = number, sets the size of the text (default is automatic) + 'fontunits' = + 'fontname' = + 'fontweight' = + 'tag' = string, the tag assigned to the plotted elements (default = '') + + See also FT_PLOT_SENS, FT_PLOT_MESH, FT_PLOT_ORTHO, FT_PLOT_HEADSHAPE, FT_PLOT_DIPOLE, FT_PLOT_HEADMODEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_axes.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_axes", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__plotting/ft_plot_box.py b/fieldtrip/__plotting/ft_plot_box.py new file mode 100644 index 0000000..07bf3ff --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_box.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_box(*args, **kwargs): + """ + FT_PLOT_BOX plots the outline of a box that is specified by its lower + left and upper right corner + + Use as + ft_plot_box(position, ...) + where the position of the box is specified as is [x1, x2, y1, y2]. + + Optional arguments should come in key-value pairs and can include + 'facealpha' = transparency value between 0 and 1 + 'facecolor' = color specification as [r g b] values or a string, for example 'skin', 'skull', 'brain', 'red', 'r' + 'edgecolor' = color specification as [r g b] values or a string, for example 'skin', 'skull', 'brain', 'red', 'r' + 'parent' = handle which is set as the parent for the plotted elements (default = []) + 'tag' = string, the tag assigned to the plotted elements (default = '') + + It is possible to plot the object in a local pseudo-axis (c.f. subplot), which is specified as follows + 'hpos' = horizontal position of the center of the local axes + 'vpos' = vertical position of the center of the local axes + 'width' = width of the local axes + 'height' = height of the local axes + 'hlim' = horizontal scaling limits within the local axes + 'vlim' = vertical scaling limits within the local axes + 'parent' = handle which is set as the parent for all plots (default = []) + + Example + ft_plot_box([-1 1 2 3], 'facecolor', 'b') + axis([-4 4 -4 4]) + + See also FT_PLOT_LINE, FT_PLOT_CROSSHAIR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_box.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_box", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_plot_cloud.py b/fieldtrip/__plotting/ft_plot_cloud.py new file mode 100644 index 0000000..57c17be --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_cloud.py @@ -0,0 +1,81 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_cloud(*args, **kwargs): + """ + FT_PLOT_CLOUD visualizes spatially sparse scalar data as spheres or + spherical clouds of points and optionally 2D slices through those clouds + + Use as + ft_plot_cloud(pos, val, ...) + where the first argument are the positions and the second argument are the values + for each location. + + Optional input arguments should come in key-value pairs and can include + 'cloudtype' = 'cloud' (default) plots a group of spherically arranged points at each sensor position + 'surf' plots a single spherical surface mesh at each sensor position + 'scalerad' = scale radius with val, can be 'yes' or 'no' (default = 'yes') + 'radius' = scalar, maximum radius of cloud (default = 4 mm) + 'clim' = 1x2 vector specifying the min and max for the colorscale + 'unit' = string, convert the sensor array to the specified geometrical units (default = []) + 'mesh' = string or Nx1 cell-array, triangulated mesh(es), see FT_PREPARE_MESH + 'slice' = requires 'mesh' as input (default = 'none') + '2d', plots 2D slices through the cloud with an outline of the mesh + '3d', draws an outline around the mesh at a particular slice + + The following inputs apply when 'cloudtype' = 'cloud' + 'rmin' = scalar >= 1, minimum radius of cloud if scalerad = 'yes' (default = 1 mm) + 'colormap' = colormap for functional data, see COLORMAP + 'colorgrad' = 'white' or a scalar (e.g. 1), degree to which the saturatoin of points in cloud changes from its center + 'ptsize' = scalar, size of points in cloud (default = 1 mm) + 'ptdensity' = scalar, density of points in cloud (default = 20 per mm^3) + 'ptgradient' = scalar, degree to which density of points in cloud changes from its center (default = 0.5, i.e. uniform density) + + The following inputs apply when 'slice' = '2d' or '3d' + 'ori' = 'x', 'y', or 'z', specifies the orthogonal plane which will be plotted (default = 'y') + 'slicepos' = 'auto' or Nx1 vector specifying the position of the + slice plane along the orientation axis (default = 'auto': chooses slice(s) with + the most data) + 'nslices' = scalar, number of slices to plot if 'slicepos' = 'auto (default = 1) + 'minspace' = scalar, minimum spacing between slices if nslices>1 + (default = 1) + 'intersectcolor' = string, Nx1 cell-array, or Nx3 vector specifying line color (default = 'k') + 'intersectlinestyle' = string or Nx1 cell-array, line style specification (default = '-') + 'intersectlinewidth' = scalar or Nx1 vector, line width specification (default = 2) + + The following inputs apply when 'cloudtype' = 'surf' and 'slice' = '2d' + 'ncirc' = scalar, number of concentric circles to plot for each + cloud slice (default = 15) make this hidden or scale + 'scalealpha' = 'yes' or 'no', scale the maximum alpha value of the center circle + with distance from center of cloud + + See also FT_ELECTRODEPLACEMENT, FT_PLOT_SENS, FT_PLOT_TOPO, FT_PLOT_TOPO3D + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_cloud.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_cloud", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__plotting/ft_plot_crosshair.py b/fieldtrip/__plotting/ft_plot_crosshair.py new file mode 100644 index 0000000..ae46583 --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_crosshair.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_crosshair(*args, **kwargs): + """ + FT_PLOT_CROSSHAIR plots a crosshair at a specified position in two [x, y] or three + [x, y, z] dimensions. + + Use as + h = ft_plot_crosshair(pos, ...) + where pos is the desired position of the crosshair. The handles of the lines are + returned. + + Optional input arguments should be specified in key-value pairs and can include + 'color' = [r g b] value or string, see PLOT + 'parent' = handle which is set as the parent for the plotted elements (default = []) + 'handle' = handle of the existing line objects to be updated + + You can specify the handles of existing line objects which will be then updated, + rather than creating a new set of lines. If both parent and handle ar specified, + the handle option prevail. + + Example + ft_plot_crosshair([0.5 0.5], 'color', 'r') + + See also FT_PLOT_BOX, FT_PLOT_LINE, TEXT, LINE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_crosshair.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_crosshair", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_plot_dipole.py b/fieldtrip/__plotting/ft_plot_dipole.py new file mode 100644 index 0000000..97ff0c0 --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_dipole.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_dipole(*args, **kwargs): + """ + FT_PLOT_DIPOLE makes a 3-D representation of a dipole using a sphere and a stick + pointing along the dipole orientation + + Use as + ft_plot_dipole(pos, mom, ...) + where pos and mom are the dipole mosition and moment. + + Optional input arguments should be specified in key-value pairs and can include + 'diameter' = number indicating sphere diameter (default = 'auto') + 'length' = number indicating length of the stick (default = 'auto') + 'thickness' = number indicating thickness of the stick (default = 'auto') + 'color' = [r g b] values or string, for example 'skin', 'skull', 'brain', 'black', 'red', 'r' (default = 'r') + 'alpha' = alpha value of the plotted dipole + 'scale' = scale the dipole with the amplitude, can be 'none', 'both', 'diameter', 'length' (default = 'none') + 'unit' = 'm', 'cm' or 'mm', used for automatic scaling (default = 'cm') + 'coordsys' = string, assume the data to be in the specified coordinate system (default = 'unknown') + 'axes' = boolean, whether to plot the axes of the 3D coordinate system (default = false) + 'tag' = string, the tag assigned to the plotted elements (default = '') + + Example + ft_plot_dipole([0 0 0], [1 2 3], 'color', 'r', 'alpha', 1) + + See also FT_PLOT_MESH, FT_PLOT_HEADMODEL, FT_PLOT_HEADSHAPE, FT_PLOT_ORTHO, + QUIVER3, PLOT3 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_dipole.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_dipole", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_plot_headmodel.py b/fieldtrip/__plotting/ft_plot_headmodel.py new file mode 100644 index 0000000..5e74740 --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_headmodel.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_headmodel(*args, **kwargs): + """ + FT_PLOT_HEADMODEL visualizes the boundaries in the volume conduction model of the + head as specified in the headmodel structure. This works for any of the head models + supported by FieldTrip. For spherical models, it will construct and plot a + triangulated sphere. + + Use as + ft_plot_headmodel(headmodel, ...) + + Optional arguments should come in key-value pairs and can include + 'facecolor' = [r g b] values or string, for example 'skin', 'skull', 'brain', 'black', 'red', 'r', or an Nx3 or Nx1 array where N is the number of faces + 'facealpha' = transparency, between 0 and 1 (default = 1) + 'faceindex' = true or false + 'vertexcolor' = [r g b] values or string, for example 'skin', 'skull', 'brain', 'black', 'red', 'r', or an Nx3 or Nx1 array where N is the number of vertices + 'vertexindex' = true or false + 'edgecolor' = [r g b] values or string, for example 'skin', 'skull', 'brain', 'black', 'red', 'r' + 'edgealpha' = transparency, between 0 and 1 (default = 1) + 'cutlocation' = 1x3 vector specifying a point on the plane that cuts the mesh + 'cutorientation' = 1x3 vector specifying the direction orthogonal through the plane that cuts the mesh + 'surfaceonly' = true or false, plot only the outer surface of a hexahedral or tetrahedral mesh (default = false) + 'unit' = string, convert to the specified geometrical units (default = []) + 'axes' = boolean, whether to plot the axes of the 3D coordinate system (default = false) + 'grad' = gradiometer array, used in combination with local spheres model + + Example + headmodel = []; + headmodel.r = [86 88 92 100]; + headmodel.o = [0 0 40]; + figure + ft_plot_headmodel(headmodel); + + See also FT_PREPARE_HEADMODEL, FT_DATATAYPE_HEADMODEL, FT_PLOT_MESH, + FT_PLOT_HEADSHAPE, FT_PLOT_SENS, FT_PLOT_DIPOLE, FT_PLOT_ORTHO, FT_PLOT_TOPO3D + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_headmodel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_headmodel", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__plotting/ft_plot_headshape.py b/fieldtrip/__plotting/ft_plot_headshape.py new file mode 100644 index 0000000..510bc40 --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_headshape.py @@ -0,0 +1,70 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_headshape(*args, **kwargs): + """ + FT_PLOT_HEADSHAPE visualizes the shape of a head from a variety of + acquisition system. Usually the head shape is measured with a + Polhemus tracker and some proprietary software (e.g. from CTF, BTi + or Yokogawa). The headshape and fiducials can be used for coregistration. + If present in the headshape, the location of the fiducials will also + be shown. + + Use as + ft_plot_headshape(headshape, ...) + where the headshape is a structure obtained from FT_READ_HEADSHAPE. + + Optional arguments should come in key-value pairs and can include + 'facecolor' = [r g b] values or string, for example 'skin', 'skull', 'brain', 'black', 'red', 'r', or an Nx3 or Nx1 array where N is the number of faces + 'facealpha' = transparency, between 0 and 1 (default = 1) + 'vertexcolor' = [r g b] values or string, for example 'skin', 'skull', 'brain', 'black', 'red', 'r', or an Nx3 or Nx1 array where N is the number of vertices + 'vertexsize' = scalar value specifying the size of the vertices (default = 10) + 'edgecolor' = [r g b] values or string, for example 'skin', 'skull', 'brain', 'black', 'red', 'r' + 'cutlocation' = 1x3 vector specifying a point on the plane that cuts the mesh + 'cutorientation' = 1x3 vector specifying the direction orthogonal through the plane that cuts the mesh + 'unit' = string, convert to the specified geometrical units (default = []) + 'axes' = boolean, whether to plot the axes of the 3D coordinate system (default = false) + 'tag' = string, the tag assigned to the plotted elements (default = '') + + The sensor array can include an optional fid field with fiducials, which will also be plotted. + 'fidcolor' = [r g b] values or string, for example 'red', 'r', or an Nx3 or Nx1 array where N is the number of fiducials + 'fidmarker' = ['.', '*', '+', ...] + 'fidlabel' = ['yes', 'no', 1, 0, 'true', 'false'] + 'transform' = transformation matrix, converts fiducials from MRI voxels into head coordinates + + Example + headshape = ft_read_headshape(filename); + figure + ft_plot_headshape(headshape); + + See also FT_PLOT_MESH, FT_PLOT_HEADMODEL, FT_PLOT_SENS, FT_PLOT_DIPOLE, + FT_PLOT_ORTHO, FT_PLOT_TOPO3D + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_headshape.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_headshape", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_plot_layout.py b/fieldtrip/__plotting/ft_plot_layout.py new file mode 100644 index 0000000..2372a05 --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_layout.py @@ -0,0 +1,74 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_layout(*args, **kwargs): + """ + FT_PLOT_LAYOUT plots a two-dimensional channel layout + + Use as + ft_plot_layout(layout, ...) + where the layout is a FieldTrip structure obtained from FT_PREPARE_LAYOUT. + + Additional options should be specified in key-value pairs and can be + 'chanindx' = logical vector or vector of indices with the channels to plot (default is all) + 'point' = 'yes' or 'no' (default 'yes'), plot markers for sensors, comment and scale + 'box' = 'yes' or 'no' (default 'yes'), plot boxes around the sensors, comment and scale + 'label' = 'yes' or 'no' (default 'yes'), plot the labels of the sensors, comment and scale + 'labeloffset' = offset of label from point (default = 0) + 'labelrotate' = scalar or vector with rotation angle (in degrees) per label (default = 0) + 'labelalignh' = string or cell-array specifying the horizontal alignment of the text (default = 'center') + 'labelalignv' = string or cell-array specifying the vertical alignment of the text (default = 'middle') + 'mask' = 'yes' or 'no' (default 'yes'), plot the interpolation area of the layout + 'outline' = 'yes' or 'no' (default 'yes'), plot the outline of the layout (e.g. head and MEG helmet) + 'verbose' = 'yes' or 'no' (default 'no'), print explanation of the figure to command window + 'fontcolor' = string, text color specification (default = 'k') + 'fontsize' = scalar, sets the size of the text (default = 10) + 'fontunits' = string, units of the font size (default is the Matlab's session default) + 'fontname' = string, font name (default is the Matlab's session default) + 'fontweight' = scalar, sets the size of the text (default = 10) + 'interpreter' = string, 'none', 'tex' or 'latex' (default = 'tex') + + The following options control the markers of the sensors. If any is defined, the other two must be defined as well. + Further note that if 'chanindx' is used, the number of elements in each choice should correspond to the original + labels in the layout, and not to the chosen subset. + 'pointsymbol' = string with symbol (e.g. 'o' or 'oooxxx') + 'pointcolor' = string with color (e.g. 'k'), or an NX3 matrix of RGB values + 'pointsize' = scalar or vector for marker size + The default marker is a blue dot sorrunded by a yellow circle. + + It is possible to plot the object in a local pseudo-axis (c.f. subplot), which is specified as follows + 'hpos' = horizontal position of the lower left corner of the local axes + 'vpos' = vertical position of the lower left corner of the local axes + 'width' = width of the local axes + 'height' = height of the local axes + + See also FT_PREPARE_LAYOUT, FT_PLOT_TOPO + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_layout.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_layout", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__plotting/ft_plot_line.py b/fieldtrip/__plotting/ft_plot_line.py new file mode 100644 index 0000000..52f67d2 --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_line.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_line(*args, **kwargs): + """ + FT_PLOT_LINE helper function for plotting a line, which can also be used in + combination with the multiple channel layout display in FieldTrip. + + Use as + ft_plot_line(X, Y, ...) + + Optional arguments should come in key-value pairs and can include + 'color' = + 'linestyle' = + 'linewidth' = + 'tag' = string, the tag assigned to the plotted elements (default = '') + + It is possible to plot the object in a local pseudo-axis (c.f. subplot), which is specified as follows + 'hpos' = horizontal position of the center of the local axes + 'vpos' = vertical position of the center of the local axes + 'width' = width of the local axes + 'height' = height of the local axes + 'hlim' = horizontal scaling limits within the local axes + 'vlim' = vertical scaling limits within the local axes + + See also FT_PLOT_BOX, FT_PLOT_CROSSHAIR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_line.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_line", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_plot_matrix.py b/fieldtrip/__plotting/ft_plot_matrix.py new file mode 100644 index 0000000..c447ea2 --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_matrix.py @@ -0,0 +1,72 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_matrix(*args, **kwargs): + """ + FT_PLOT_MATRIX visualizes a matrix as an image, similar to IMAGESC. + The position, width and height can be controlled to allow multiple + matrices (i.e. channels) to be plotted in a topographic arrangement. + + Use as + ft_plot_matrix(C, ...) + where C is a 2 dimensional MxN matrix, or + ft_plot_matrix(X, Y, C, ...) + where X and Y describe the 1xN horizontal and 1xM vertical axes + respectively. + + Optional arguments should come in key-value pairs and can include + 'clim' = 1x2 vector with color limits (default is automatic) + 'highlight' = a logical matrix of size C, where 0 means that the corresponding values in C are highlighted according to the highlightstyle + 'highlightstyle' = can be 'saturation', 'opacity', 'outline' or 'colormix' (default = 'opacity') + 'tag' = string, the tag assigned to the plotted elements (default = '') + + It is possible to plot the object in a local pseudo-axis (c.f. subplot), which is specified as follows + 'box' = draw a box around the local axes, can be 'yes' or 'no' + 'hpos' = horizontal position of the center of the local axes + 'vpos' = vertical position of the center of the local axes + 'width' = width of the local axes + 'height' = height of the local axes + 'hlim' = horizontal scaling limits within the local axes + 'vlim' = vertical scaling limits within the local axes + + When using a local pseudo-axis, you can plot a label next to the data + 'label' = string, label to be plotted at the upper left corner + 'fontcolor' = string, color specification (default = 'k') + 'fontsize' = number, sets the size of the text (default = 10) + 'fontunits' = + 'fontname' = + 'fontweight' = + + Example + ft_plot_matrix(randn(30,50), 'width', 1, 'height', 1, 'hpos', 0, 'vpos', 0) + + See also FT_PLOT_VECTOR, IMAGESC, SURF + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_matrix.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_matrix", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__plotting/ft_plot_mesh.py b/fieldtrip/__plotting/ft_plot_mesh.py new file mode 100644 index 0000000..03bae7c --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_mesh.py @@ -0,0 +1,87 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_mesh(*args, **kwargs): + """ + FT_PLOT_MESH visualizes a surface or volumetric mesh, for example with the cortical + folding of the brain, or the scalp surface of the head. Surface meshes are + described by triangles and consist of a structure with the fields "pos" and "tri". + Volumetric meshes are described with tetrahedrons or hexahedrons and have the fields + "pos" and "tet" or "hex". + + Use as + ft_plot_mesh(mesh, ...) + or if you only want to plot the 3-D vertices + ft_plot_mesh(pos, ...) + + Optional arguments should come in key-value pairs and can include + 'facecolor' = [r g b] values or string, for example 'skin', 'skull', 'brain', 'black', 'red', 'r', or an Nx3 or Nx1 array where N is the number of faces + 'facealpha' = transparency, between 0 and 1 (default = 1) + 'faceindex' = true or false (default = false) + 'vertexcolor' = [r g b] values or string, for example 'skin', 'skull', 'brain', 'black', 'red', 'r', or an Nx3 or Nx1 array where N is the number of vertices + 'vertexsize' = scalar or vector with the size for each vertex (default = 10) + 'vertexmarker' = character, e.g. '.', 'o' or 'x' (default = '.') + 'vertexindex' = true or false (default = false) + 'edgecolor' = [r g b] values or string, for example 'skin', 'skull', 'brain', 'black', 'red', 'r' + 'edgealpha' = transparency, between 0 and 1 (default = 1) + 'surfaceonly' = true or false, plot only the outer surface of a hexahedral or tetrahedral mesh (default = false) + 'cutlocation' = 1x3 vector specifying a point on the plane that cuts the mesh + 'cutorientation' = 1x3 vector specifying the direction orthogonal through the plane that cuts the mesh + 'unit' = string, convert to the specified geometrical units (default = []) + 'axes' = boolean, whether to plot the axes of the 3D coordinate system (default = false) + 'maskstyle' = 'opacity' or 'colormix', if the latter is specified, opacity masked color values + are converted (in combination with a background color) to RGB. This bypasses + openGL functionality, which behaves unpredictably on some platforms (e.g. when + using software opengl) + 'fontsize' = number, sets the size of the text (default = 10) + 'fontunits' = + 'fontname' = + 'fontweight' = + 'tag' = string, the tag assigned to the plotted elements (default = '') + + If you don't want the faces, edges or vertices to be plotted, you should specify the color as 'none'. + + Example + [pos, tri] = mesh_sphere(162); + mesh.pos = pos; + mesh.tri = tri; + ft_plot_mesh(mesh, 'facecolor', 'skin', 'edgecolor', 'none'); + camlight + + You can plot an additional contour around specified areas using + 'contour' = inside of contour per vertex, either 0 or 1 + 'contourcolor' = string, color specification + 'contourlinestyle' = string, line specification + 'contourlinewidth' = number + + See also FT_PREPARE_MESH, FT_PLOT_SENS, FT_PLOT_HEADSHAPE, FT_PLOT_HEADMODEL, + FT_PLOT_DIPOLE, TRIMESH, PATCH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_mesh.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_mesh", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_plot_montage.py b/fieldtrip/__plotting/ft_plot_montage.py new file mode 100644 index 0000000..261ceaf --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_montage.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_montage(*args, **kwargs): + """ + FT_PLOT_MONTAGE makes a montage of a 3-D array by selecting slices at regular distances + and combining them in one large 2-D image. Note that the montage of MRI slices is not to + be confused with the EEG montage, which is a way of specifying the reference scheme + between electrodes. + + Use as + ft_plot_montage(dat, ...) + where dat is a 3-D array. + + Additional options should be specified in key-value pairs and can be + 'transform' = 4x4 homogeneous transformation matrix specifying the mapping from voxel space to the coordinate system in which the data are plotted. + 'location' = 1x3 vector specifying a point on the plane which will be plotted, the coordinates are expressed in the coordinate system in which the data will be plotted. location defines the origin of the plane + 'orientation' = 1x3 vector specifying the direction orthogonal through the plane which will be plotted (default = [0 0 1]) + 'srange' = + 'slicesize' = + 'nslice' = scalar, number of slices + 'maskstyle' = string, 'opacity' or 'colormix', defines the rendering + 'background' = needed when maskstyle is 'colormix', 3D-matrix with + the same size as the data matrix, serving as + grayscale image that provides the background + + See also FT_PLOT_ORTHO, FT_PLOT_SLICE, FT_SOURCEPLOT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_montage.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_montage", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__plotting/ft_plot_ortho.py b/fieldtrip/__plotting/ft_plot_ortho.py new file mode 100644 index 0000000..297fbef --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_ortho.py @@ -0,0 +1,68 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_ortho(*args, **kwargs): + """ + FT_PLOT_ORTHO plots three orthographic slices through a 3-D volume and interpolates + the data if needed. + + Use as + ft_plot_ortho(dat, ...) + or + ft_plot_ortho(dat, mask, ...) + where dat and mask are equal-sized 3-D arrays. + + Additional options should be specified in key-value pairs and can be + 'style' = string, 'subplot' or 'intersect' (default = 'subplot') + 'orientation' = 3x3 matrix specifying the directions orthogonal through the planes which will be plotted + 'parents' = (optional) 3-element vector containing the handles of the axes for the subplots (when style = 'subplot') + 'surfhandle' = (optional) 3-element vector containing the handles of the surfaces for each of the sublots (when style = 'subplot'). Parents and surfhandle are mutually exclusive + 'update' = (optional) 3-element boolean vector with the axes that should be updated (default = [true true true]) + 'coordsys' = string, assume the data to be in the specified coordinate system (default = 'unknown') + + The following options are supported and passed on to FT_PLOT_SLICE + 'clim' = [min max], lower and upper color limits + 'facealpha' = transparency when no mask is specified, between 0 and 1 (default = 1) + 'transform' = 4x4 homogeneous transformation matrix specifying the mapping from voxel space to the coordinate system in which the data are plotted + 'location' = 1x3 vector specifying the intersection point at which the three slices will be plotted. The coordinates should be expressed in the coordinate system of the data. + 'datmask' = 3D-matrix with the same size as the matrix dat, serving as opacitymap if the second input argument to the function contains a matrix, this will be used as the mask + 'maskstyle' = string, 'opacity' or 'colormix', defines the rendering + 'background' = needed when maskstyle is 'colormix', 3D-matrix with the same size as the data matrix, serving as grayscale image that provides the background + 'interpmethod' = string specifying the method for the interpolation, see INTERPN (default = 'nearest') + 'colormap' = string, see COLORMAP + 'unit' = string, can be 'm', 'cm' or 'mm' (default is automatic) + 'intersectmesh' = triangulated mesh, see FT_PREPARE_MESH + 'intersectcolor' = string, color specification + 'intersectlinestyle' = string, line specification + 'intersectlinewidth' = number + + See also FT_PLOT_SLICE, FT_PLOT_MONTAGE, FT_PLOT_MESH, FT_SOURCEPLOT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_ortho.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_ortho", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_plot_patch.py b/fieldtrip/__plotting/ft_plot_patch.py new file mode 100644 index 0000000..361dc52 --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_patch.py @@ -0,0 +1,73 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_patch(*args, **kwargs): + """ + FT_PLOT_PATCH plot a colored shape, similar to the MATLAB patch() function. It is + similar in usage as ft_plot_vector, and they can be combined, for example, + to plot an area equivalent to a SEM or STD-DEV around a line. + + Use as + ft_plot_patch(X, Y, ...) + where X and Y are similar as the input to the MATLAB patch() function. + + Optional arguments should come in key-value pairs and can include + 'axis' = draw the local axis, can be 'yes', 'no', 'xy', 'x' or 'y' + 'parent' = handle which is set as the parent for the plotted elements (default = []) + 'tag' = string, the tag assigned to the plotted elements (default = '') + 'facecolor' = see MATLAB standard patch properties + 'facealpha' = see MATLAB standard patch properties (note, approx. transparency can be achieved using 'facecolor') + 'edgecolor' = see MATLAB standard patch properties (default is 'none') (equivalent to 'linecolor' in PLOT) + 'linestyle' = see MATLAB standard patch properties + 'linewidth' = see MATLAB standard patch properties + + The color of the patchand the edges (i.e. border lines) can be specified in a variety of ways + - as a string with one character per line that you want to plot. Supported colors are the same as in PATCH, i.e. 'bgrcmykw'. + - as an 'RGB triplet', a 1x3 vector with values between 0 and 1 + - as 'none' if you do not want the face of the patch to be filled (useful when you want to plot an empty box). + + It is possible to plot the object in a local pseudo-axis (c.f. subplot), which is specified as follows + 'box' = draw a box around the local axes, can be 'yes' or 'no' + 'hpos' = horizontal position of the center of the local axes + 'vpos' = vertical position of the center of the local axes + 'width' = width of the local axes + 'height' = height of the local axes + 'hlim' = horizontal scaling limits within the local axes + 'vlim' = vertical scaling limits within the local axes + + Example + hdat = [1:10 10:-1:1]; + vdat = rand(1,10); + vdat = [vdat vdat(end:-1:1)+1]; + ft_plot_patch(hdat, vdat) + + See also FT_PLOT_VECTOR, PATCH, PLOT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_patch.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_patch", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_plot_sens.py b/fieldtrip/__plotting/ft_plot_sens.py new file mode 100644 index 0000000..741a687 --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_sens.py @@ -0,0 +1,101 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_sens(*args, **kwargs): + """ + FT_PLOT_SENS visualizes the EEG, MEG or NIRS sensor array. + + Use as + ft_plot_sens(sens, ...) + where the first argument is the sensor array as returned by FT_READ_SENS or + by FT_PREPARE_VOL_SENS. + + Optional input arguments should come in key-value pairs and can include + 'chantype' = string or cell-array with strings, for example 'megmag' (default = 'all') + 'chanindx' = logical vector or vector of indices with the channels to plot (default is all) + 'label' = whether to show the channel label, can be 'off', 'label', 'number' (default = 'off') + 'axes' = true/false, whether to plot the axes of the 3D coordinate system (default = false) + 'unit' = string, convert the sensor array to the specified geometrical units (default = []) + 'fontcolor' = string, color specification (default = 'k') + 'fontsize' = number, sets the size of the text (default = 10) + 'fontunits' = 'inches', 'centimeters', 'normalized', 'points' or 'pixels' + 'fontweight' = 'normal' or 'bold' + 'fontname' = string + + The following options apply to MEG magnetometers and/or gradiometers + 'coil' = true/false, plot each individual coil (default = false) + 'orientation' = true/false, plot a line for the orientation of each coil (default = false) + 'coilshape' = 'point', 'circle', 'square', 'sphere' or 'disc' (default is automatic) + 'coilsize' = diameter or edge length of the coils (default is automatic) + The following options apply to EEG electrodes + 'elec' = true/false, plot each individual electrode (default = false) + 'orientation' = true/false, plot a line for the orientation of each electrode (default = false) + 'elecshape' = 'point', 'circle', 'square', 'sphere', or 'disc' (default is automatic) + 'elecsize' = diameter of the electrodes (default is automatic) + 'headshape' = headshape, required for elecshape 'disc' + The following options apply to NIRS optodes + 'opto' = true/false, plot each individual optode (default = false) + 'orientation' = true/false, plot a line for the orientation of each optode (default = false) + 'optoshape' = 'point', 'circle', 'square', 'sphere', or 'disc' (default is automatic) + 'optosize' = diameter of the optodes (default is automatic) + 'headshape' = headshape, required for optoshape 'disc' + + The following options apply when electrodes/coils/optodes are NOT plotted individually + 'style' = plotting style for the points representing the channels, see plot3 (default = []) + 'marker' = marker type representing the channels, see plot3 (default = '.') + The following options apply when electrodes/coils/optodes are plotted individually + 'facecolor' = [r g b] values or string, for example 'black', 'red', 'r', or an Nx3 or Nx1 array where N is the number of faces (default is automatic) + 'edgecolor' = [r g b] values or string, for example 'black', 'red', 'r', color of channels or coils (default is automatic) + 'facealpha' = transparency, between 0 and 1 (default = 1) + 'edgealpha' = transparency, between 0 and 1 (default = 1) + + The following options apply when the orientation is plotted as a line segment per channel + 'linecolor' = [r g b] values or string, or Nx3 matrix for color of orientation line, + default is the default matlab colororder + 'linewidth' = scalar, width of the orientation line (default = 1) + 'linelength' = scalar, length of the orientation line in mm (default = 20) + + The sensor array can include an optional fid field with fiducials, which will also be plotted. + 'fiducial' = rue/false, plot the fiducials (default = true) + 'fidcolor' = [r g b] values or string, for example 'red', 'r', or an Nx3 or Nx1 array where N is the number of fiducials + 'fidmarker' = ['.', '*', '+', ...] + 'fidlabel' = ['yes', 'no', 1, 0, 'true', 'false'] + + Example: + sens = ft_read_sens('Subject01.ds', 'senstype', 'meg'); + figure; ft_plot_sens(sens, 'coilshape', 'point', 'style', 'r*') + figure; ft_plot_sens(sens, 'coilshape', 'circle') + figure; ft_plot_sens(sens, 'coilshape', 'circle', 'coil', true, 'chantype', 'meggrad') + figure; ft_plot_sens(sens, 'coilshape', 'circle', 'coil', false, 'orientation', true) + + See also FT_DATATYPE_SENS, FT_READ_SENS, FT_PLOT_HEADSHAPE, FT_PLOT_HEADMODEL, + FT_PLOT_TOPO3D + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_sens.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_sens", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_plot_slice.py b/fieldtrip/__plotting/ft_plot_slice.py new file mode 100644 index 0000000..4ca926c --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_slice.py @@ -0,0 +1,76 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_slice(*args, **kwargs): + """ + FT_PLOT_SLICE plots a single slice that cuts through a 3-D volume and interpolates + the data if needed. + + Use as + ft_plot_slice(dat, ...) + or + ft_plot_slice(dat, mask, ...) + where dat and mask are equal-sized 3-D arrays. + + Additional options should be specified in key-value pairs and can be + 'transform' = 4x4 homogeneous transformation matrix specifying the mapping from + voxel coordinates to the coordinate system in which the data are plotted. + 'location' = 1x3 vector specifying a point on the plane which will be plotted + the coordinates are expressed in the coordinate system in which the + data will be plotted. location defines the origin of the plane + 'orientation' = 1x3 vector specifying the direction orthogonal through the plane + which will be plotted (default = [0 0 1]) + 'unit' = string, can be 'm', 'cm' or 'mm' (default is automatic) + 'coordsys' = string, assume the data to be in the specified coordinate system (default = 'unknown') + 'resolution' = number (default = 1 mm) + 'datmask' = 3D-matrix with the same size as the data matrix, serving as opacitymap + If the second input argument to the function contains a matrix, this + will be used as the mask + 'maskstyle' = string, 'opacity' or 'colormix', defines the rendering + 'background' = needed when maskstyle is 'colormix', 3D-matrix with + the same size as the data matrix, serving as + grayscale image that provides the background + 'opacitylim' = 1x2 vector specifying the limits for opacity masking + 'interpmethod' = string specifying the method for the interpolation, see INTERPN (default = 'nearest') + 'colormap' = string, see COLORMAP + 'clim' = 1x2 vector specifying the min and max for the colorscale + 'facealpha' = transparency when no mask is specified, between 0 and 1 (default = 1) + 'tag' = string, the tag assigned to the plotted elements (default = '') + + You can plot the slices from the volume together with an intersection of the slices + with a triangulated surface mesh (e.g. a cortical sheet) using + 'intersectmesh' = triangulated mesh, see FT_PREPARE_MESH + 'intersectcolor' = string, color specification + 'intersectlinestyle' = string, line specification + 'intersectlinewidth' = number + + See also FT_PLOT_ORTHO, FT_PLOT_MONTAGE, FT_SOURCEPLOT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_slice.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_slice", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_plot_text.py b/fieldtrip/__plotting/ft_plot_text.py new file mode 100644 index 0000000..a6cb99c --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_text.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_text(*args, **kwargs): + """ + FT_PLOT_TEXT helper function for plotting text, which can also be used in + combination with the multiple channel layout display in FieldTrip. + + Use as + ft_plot_text(X, Y, str, ...) + + Optional arguments should come in key-value pairs and can include + 'fontcolor' = string, color specification (default = 'k') + 'fontsize' = number, sets the size of the text (default = 10) + 'fontunits' = + 'fontname' = + 'fontweight' = + 'horizontalalignment' = + 'verticalalignment' = + 'interpreter' = string, can be 'none', 'tex' or 'latex' (default = 'none') + 'rotation' = + 'tag' = string, the tag assigned to the plotted elements (default = '') + + It is possible to plot the object in a local pseudo-axis (c.f. subplot), which is specified as follows + 'hpos' = horizontal position of the center of the local axes + 'vpos' = vertical position of the center of the local axes + 'width' = width of the local axes + 'height' = height of the local axes + 'hlim' = horizontal scaling limits within the local axes + 'vlim' = vertical scaling limits within the local axes + + Example + figure + ft_plot_vector(randn(1,10), rand(1,10), 'hpos', 1, 'vpos', 1, 'width', 0.2, 'height', 0.2, 'box', true) + ft_plot_text(0, 0 , '+', 'hpos', 1, 'vpos', 1, 'width', 0.2, 'height', 0.2) + axis([0 2 0 2]) + + See also FT_PLOT_VECTOR, FT_PLOT_MATRIX, FT_PLOT_LINE, FT_PLOT_BOX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_text.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_text", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_plot_topo.py b/fieldtrip/__plotting/ft_plot_topo.py new file mode 100644 index 0000000..f47fc8b --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_topo.py @@ -0,0 +1,64 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_topo(*args, **kwargs): + """ + FT_PLOT_TOPO interpolates and plots the 2-D spatial topography of the + potential or field distribution over the head + + Use as + ft_plot_topo(x, y, val, ...) + + Optional arguments should come in key-value pairs and can include + 'gridscale' = scalar, number of points along both directions for interpolation (default = 67) + 'datmask' = vector of same dimensions as val + 'mask' = cell-array with line segments that forms the mask (see FT_PREPARE_LAYOUT) + 'outline' = cell-array with line segments that for the outline (see FT_PREPARE_LAYOUT) + 'isolines' = vector with values for isocontour lines (default = []) + 'interplim' = string, 'sensors' or 'mask' (default = 'sensors') + 'interpmethod' = string, 'nearest', 'linear', 'natural', 'cubic' or 'v4' (default = 'v4') + 'style' = can be 'surf', 'iso', 'isofill', 'surfiso', 'imsat', 'imsatiso', 'colormix' + 'clim' = [min max], limits for color scaling + 'shading' = string, 'none', 'flat', 'interp' (default = 'flat') + 'parent' = handle which is set as the parent for all plots (default = []) + 'tag' = string, the tag assigned to the plotted elements (default = '') + + It is possible to plot the object in a local pseudo-axis (c.f. subplot), which is specified as follows + 'box' = draw a box around the local axes, can be 'yes' or 'no' + 'hpos' = horizontal position of the lower left corner of the local axes + 'vpos' = vertical position of the lower left corner of the local axes + 'width' = width of the local axes + 'height' = height of the local axes + 'hlim' = horizontal scaling limits within the local axes + 'vlim' = vertical scaling limits within the local axes + + See also FT_PLOT_TOPO3D, FT_PLOT_LAYOUT, FT_TOPOPLOTER, FT_TOPOPLOTTFR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_topo.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_topo", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_plot_topo3d.py b/fieldtrip/__plotting/ft_plot_topo3d.py new file mode 100644 index 0000000..49261be --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_topo3d.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_topo3d(*args, **kwargs): + """ + FT_PLOT_TOPO3D visualizes a 3D topographic representation of the electric potential + or magnetic field distribution at the sensor locations. + + Use as + ft_plot_topo3d(pos, val, ...) + where the channel positions are given as a Nx3 matrix and the values are + given as Nx1 vector. + + Optional input arguments should be specified in key-value pairs and can include + 'contourstyle' = string, 'none', 'black', 'color' (default = 'none') + 'isolines' = vector with values at which to draw isocontours, or 'auto' (default = 'auto') + 'facealpha' = scalar, between 0 and 1 (default = 1) + 'refine' = scalar, number of refinement steps for the triangulation, to get a smoother interpolation (default = 0) + 'neighbourdist' = number, maximum distance between neighbouring sensors (default is automatic) + 'unit' = string, 'm', 'cm' or 'mm' (default = 'cm') + 'coordsys' = string, assume the data to be in the specified coordinate system (default = 'unknown') + 'axes' = boolean, whether to plot the axes of the 3D coordinate system (default = false) + + See also FT_PLOT_TOPO, FT_PLOT_SENS, FT_PLOT_MESH, FT_PLOT_HEADSHAPE, + FT_TOPOPLOTER, FT_TOPOPLOTTFR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_topo3d.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_topo3d", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__plotting/ft_plot_vector.py b/fieldtrip/__plotting/ft_plot_vector.py new file mode 100644 index 0000000..fe49f4d --- /dev/null +++ b/fieldtrip/__plotting/ft_plot_vector.py @@ -0,0 +1,107 @@ +from fieldtrip._runtime import Runtime + + +def ft_plot_vector(*args, **kwargs): + """ + FT_PLOT_VECTOR visualizes a vector as a line, similar to PLOT. + + Use as + ft_plot_vector(Y, ...) + or as + ft_plot_vector(X, Y, ...) + where X and Y are similar as the input to the MATLAB plot function. + + Optional arguments should come in key-value pairs and can include + 'color' = see MATLAB standard line properties and see below + 'style' = see MATLAB standard line properties + 'linewidth' = see MATLAB standard line properties + 'markersize' = see MATLAB standard line properties + 'markerfacecolor' = see MATLAB standard line properties + 'axis' = draw the local axis, can be 'yes', 'no', 'xy', 'x' or 'y' + 'highlight' = a logical vector of size Y, where 1 means that the corresponding values in Y are highlighted (according to the highlightstyle) + 'highlightstyle' = can be 'box', 'thickness', 'saturation', 'difference' (default='box') + 'facecolor' = color for the highlighted box/difference (default = [0.6 0.6 0.6]) + 'facealpha' = transparency for the highlighted box/difference, between 0 and 1 (default = 1) + 'parent' = handle which is set as the parent for all plots (default = []) + 'tag' = string, the tag assigned to the plotted elements (default = '') + + The line color can be specified in a variety of ways + - as a string with one character per line that you want to plot, like 'bgrcmykw'. + - as 'none' if you do not want the lines to be plotted, this is useful in combination with the 'difference' highlightstyle. + - as an Nx3 matrix, where N is the number of points along the line, to use graded RGB colors along the line + - as an Nx3 matrix, where N is the number of lines, to use a different color for each line + + It is possible to plot the object in a local pseudo-axis (c.f. subplot), which is specified as follows + 'box' = draw a box around the local axes, can be 'yes' or 'no' + 'hpos' = horizontal position of the center of the local axes + 'vpos' = vertical position of the center of the local axes + 'width' = width of the local axes + 'height' = height of the local axes + 'hlim' = horizontal scaling limits within the local axes + 'vlim' = vertical scaling limits within the local axes + + When using a local pseudo-axis, you can plot a label next to the data + 'label' = string, label to be plotted in the corner of the box + 'labelpos' = string, position for the label (default = 'upperleft') + 'fontcolor' = string, color specification (default = 'k') + 'fontsize' = number, sets the size of the text (default = 10) + 'fontunits' = + 'fontname' = + 'fontweight' = + + Example 1 + subplot(2, 1, 1); ft_plot_vector(1:100, randn(1, 100), 'color', 'r') + subplot(2, 1, 2); ft_plot_vector(1:100, randn(1, 100), 'color', rand(100, 3)) + + Example 2 + ft_plot_vector(randn(1, 100), 'width', 0.9, 'height', 0.9, 'hpos', 0, 'vpos', 0, 'box', 'yes') + ft_plot_vector(randn(1, 100), 'width', 0.9, 'height', 0.9, 'hpos', 1, 'vpos', 0, 'box', 'yes') + ft_plot_vector(randn(1, 100), 'width', 0.9, 'height', 0.9, 'hpos', 0, 'vpos', 1, 'box', 'yes') + + Example 3 + x = 1:100; y = hann(100)'; + subplot(3, 1, 1); ft_plot_vector(x, y, 'highlight', y>0.8, 'highlightstyle', 'box'); + subplot(3, 1, 2); ft_plot_vector(x, y, 'highlight', y>0.8, 'highlightstyle', 'thickness'); + subplot(3, 1, 3); ft_plot_vector(x, y, 'highlight', y>0.8, 'highlightstyle', 'saturation'); + + Example 4 + x = 1:100; y = hann(100)'; ymin = 0.8*y; ymax = 1.2*y; + ft_plot_vector(x, [ymin; ymax], 'highlight', ones(size(y)), 'highlightstyle', 'difference', 'color', 'none'); + ft_plot_vector(x, y); + + Example 5 + r = linspace(0, 1, 100)'; + g = linspace(1, 0, 100)'; + b = zeros(1, 100)'; + ft_plot_vector(1:100, 'color', [r g b], 'linewidth', 5); + + See also FT_PLOT_MATRIX, PLOT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_plot_vector.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_plot_vector", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_select_box.py b/fieldtrip/__plotting/ft_select_box.py new file mode 100644 index 0000000..9abc28a --- /dev/null +++ b/fieldtrip/__plotting/ft_select_box.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def ft_select_box(*args, **kwargs): + """ + FT_SELECT_BOX helper function for selecting a single rectangular region in the + current figure using the mouse. This function is not used as a callback, but blocks + the execution of the code until a selection is made. + + Use as + [x, y] = ft_select_box() + + It returns a 2-element vector x and a 2-element vector y + with the corners of the selected region. + + See also FT_SELECT_CHANNEL, FT_SELECT_POINT, FT_SELECT_POINT3D, FT_SELECT_RANGE, + FT_SELECT_VOXEL, GINPUT, RBBOX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_select_box.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_select_box", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_select_channel.py b/fieldtrip/__plotting/ft_select_channel.py new file mode 100644 index 0000000..a87a349 --- /dev/null +++ b/fieldtrip/__plotting/ft_select_channel.py @@ -0,0 +1,105 @@ +from fieldtrip._runtime import Runtime + + +def ft_select_channel(*args, **kwargs): + """ + FT_SELECT_CHANNEL is a helper function that can be used as callback function + in a figure. It allows the user to select a channel. The channel labels + are returned. + + Use as + label = ft_select_channel(h, eventdata, ...) + The first two arguments are automatically passed by MATLAB to any + callback function. + + Additional options should be specified in key-value pairs and can be + 'callback' = function handle to be executed after channels have been selected + + You can pass additional arguments to the callback function in a cell-array + like {@function_handle,arg1,arg2} + + Example 1 + % create a figure + figure + cfg = []; + cfg.channel = {'chan1', 'chan2', 'chan3', 'chan4'}; + cfg.layout = 'ordered'; + lay = ft_prepare_layout(cfg); + ft_plot_layout(lay) + + % add the required guidata + info = guidata(gcf); + info.x = lay.pos(:,1); + info.y = lay.pos(:,2); + info.label = lay.label; + guidata(gcf, info); + + % add this function as the callback to make a single selection + set(gcf, 'WindowButtonDownFcn', {@ft_select_channel, 'callback', @disp}) + + % or to make multiple selections + set(gcf, 'WindowButtonDownFcn', {@ft_select_channel, 'multiple', true, 'callback', @disp, 'event', 'WindowButtonDownFcn'}) + set(gcf, 'WindowButtonUpFcn', {@ft_select_channel, 'multiple', true, 'callback', @disp, 'event', 'WindowButtonDownFcn'}) + set(gcf, 'WindowButtonMotionFcn', {@ft_select_channel, 'multiple', true, 'callback', @disp, 'event', 'WindowButtonDownFcn'}) + + Example 2, executed from within a subplot + % create a figure + figure + subplot(2,2,1) + cfg = []; + cfg.channel = {'chan1', 'chan2', 'chan3', 'chan4'}; + cfg.layout = 'ordered'; + lay = ft_prepare_layout(cfg); + ft_plot_layout(lay) + + % add the channel information to guidata under identifier linked to this axis + ident = ['axh' num2str(round(sum(clock.*1e6)))]; % unique identifier for this axis + set(gca,'tag',ident); + info = guidata(gcf); + info.(ident).x = lay.pos(:, 1); + info.(ident).y = lay.pos(:, 2); + info.(ident).label = lay.label; + guidata(gcf, info); + + % add this function as the callback to make a single selection + set(gcf, 'WindowButtonDownFcn', {@ft_select_channel, 'callback', @disp}) + + % or to make multiple selections + set(gcf, 'WindowButtonDownFcn', {@ft_select_channel, 'multiple', true, 'callback', @disp, 'event', 'WindowButtonDownFcn'}) + set(gcf, 'WindowButtonUpFcn', {@ft_select_channel, 'multiple', true, 'callback', @disp, 'event', 'WindowButtonDownFcn'}) + set(gcf, 'WindowButtonMotionFcn', {@ft_select_channel, 'multiple', true, 'callback', @disp, 'event', 'WindowButtonDownFcn'}) + + Subsequently you can click in the figure and you'll see that the disp + function is executed as callback and that it displays the selected + channels. + + See also FT_SELECT_BOX, FT_SELECT_POINT, FT_SELECT_POINT3D, FT_SELECT_RANGE, FT_SELECT_VOXEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_select_channel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_select_channel", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__plotting/ft_select_point.py b/fieldtrip/__plotting/ft_select_point.py new file mode 100644 index 0000000..8181131 --- /dev/null +++ b/fieldtrip/__plotting/ft_select_point.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def ft_select_point(*args, **kwargs): + """ + FT_SELECT_POINT helper function for selecting a one or multiple points in the + current figure using the mouse. It returns a list of the [x y] coordinates of the + selected points. + + Use as + [selected] = ft_select_point(pos, ...) + + Optional input arguments should come in key-value pairs and can include + 'multiple' = true/false, make multiple selections, pressing "q" on the keyboard finalizes the selection (default = false) + 'nearest' = true/false (default = true) + + Example + pos = randn(10,2); + figure + plot(pos(:,1), pos(:,2), '.') + ft_select_point(pos) + + See also FT_SELECT_BOX, FT_SELECT_CHANNEL, FT_SELECT_POINT3D, FT_SELECT_RANGE, FT_SELECT_VOXEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_select_point.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_select_point", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_select_point3d.py b/fieldtrip/__plotting/ft_select_point3d.py new file mode 100644 index 0000000..3f67842 --- /dev/null +++ b/fieldtrip/__plotting/ft_select_point3d.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def ft_select_point3d(*args, **kwargs): + """ + FT_SELECT_POINT3D helper function for selecting one or multiple points on a 3D mesh + using the mouse. It returns a list of the [x y z] coordinates of the selected + points. + + Use as + [selected] = ft_select_point3d(bnd, ...) + + Optional input arguments should come in key-value pairs and can include + 'multiple' = true/false, make multiple selections, pressing "q" on the keyboard finalizes the selection (default = false) + 'nearest' = true/false (default = true) + 'marker' = character or empty, for example '.', 'o' or 'x' (default = []) + 'markersize' = scalar, the size of the marker (default = 10) + 'markercolor' = character, for example 'r', 'b' or 'g' (default = 'k') + + Example + [pos, tri] = mesh_sphere(162); + bnd.pos = pos; + bnd.tri = tri; + ft_plot_mesh(bnd) + camlight + ... do something here + + See also FT_SELECT_BOX, FT_SELECT_CHANNEL, FT_SELECT_POINT, FT_SELECT_RANGE, FT_SELECT_VOXEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_select_point3d.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_select_point3d", *args, **kwargs) diff --git a/fieldtrip/__plotting/ft_select_range.py b/fieldtrip/__plotting/ft_select_range.py new file mode 100644 index 0000000..5cc1f8a --- /dev/null +++ b/fieldtrip/__plotting/ft_select_range.py @@ -0,0 +1,77 @@ +from fieldtrip._runtime import Runtime + + +def ft_select_range(*args, **kwargs): + """ + FT_SELECT_RANGE is a helper function that can be used as callback function + in a figure. It allows the user to select a horizontal or a vertical + range, or one or multiple boxes. + + The callback function (and it's arguments) specified in callback is called + on a left-click inside a selection, or using the right-click context-menu. + The callback function will have as its first-to-last input argument the range of + all selections. The last input argument is either empty, or, when using the context + menu, a label of the item clicked. + Context menus are shown as the labels presented in the input. When activated, + the callback function is called, with the last input argument being the label of + the selection option. + + Input arguments: + 'event' = string, event used as hook. + 'callback' = function handle or cell-array containing function handle and additional input arguments + 'contextmenu' = cell-array containing labels shown in right-click menu + 'multiple' = boolean, allowing multiple selection boxes or not + 'xrange' = boolean, xrange variable or not + 'yrange' = boolean, yrange variable or not + 'clear' = boolean + + Example + x = randn(10,1); + y = randn(10,1); + figure; plot(x, y, '.'); + + The following example allows multiple horizontal and vertical selections to be made + set(gcf, 'WindowButtonDownFcn', {@ft_select_range, 'event', 'WindowButtonDownFcn', 'multiple', true, 'callback', @disp}); + set(gcf, 'WindowButtonMotionFcn', {@ft_select_range, 'event', 'WindowButtonMotionFcn', 'multiple', true, 'callback', @disp}); + set(gcf, 'WindowButtonUpFcn', {@ft_select_range, 'event', 'WindowButtonUpFcn', 'multiple', true, 'callback', @disp}); + + The following example allows a single horizontal selection to be made + set(gcf, 'WindowButtonDownFcn', {@ft_select_range, 'event', 'WindowButtonDownFcn', 'multiple', false, 'xrange', true, 'yrange', false, 'callback', @disp}); + set(gcf, 'WindowButtonMotionFcn', {@ft_select_range, 'event', 'WindowButtonMotionFcn', 'multiple', false, 'xrange', true, 'yrange', false, 'callback', @disp}); + set(gcf, 'WindowButtonUpFcn', {@ft_select_range, 'event', 'WindowButtonUpFcn', 'multiple', false, 'xrange', true, 'yrange', false, 'callback', @disp}); + + The following example allows a single point to be selected + set(gcf, 'WindowButtonDownFcn', {@ft_select_range, 'event', 'WindowButtonDownFcn', 'multiple', false, 'xrange', false, 'yrange', false, 'callback', @disp}); + set(gcf, 'WindowButtonMotionFcn', {@ft_select_range, 'event', 'WindowButtonMotionFcn', 'multiple', false, 'xrange', false, 'yrange', false, 'callback', @disp}); + set(gcf, 'WindowButtonUpFcn', {@ft_select_range, 'event', 'WindowButtonUpFcn', 'multiple', false, 'xrange', false, 'yrange', false, 'callback', @disp}); + + See also FT_SELECT_BOX, FT_SELECT_CHANNEL, FT_SELECT_POINT, FT_SELECT_POINT3D, FT_SELECT_VOXEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_select_range.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_select_range", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__plotting/ft_select_voxel.py b/fieldtrip/__plotting/ft_select_voxel.py new file mode 100644 index 0000000..f69fe39 --- /dev/null +++ b/fieldtrip/__plotting/ft_select_voxel.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def ft_select_voxel(*args, **kwargs): + """ + FT_SELECT_VOXEL is a helper function that can be used as callback function + in a figure. It allows the user to select a voxel from a (resliced) 3-D volume. + + Use as + voxel = ft_select_voxel(h, eventdata, ...) + The first two arguments are automatically passed by MATLAB to any + callback function. + + Additional options should be specified in key-value pairs and can be + 'callback' = function handle to be executed after channels have been selected + + You can pass additional arguments to the callback function in a cell-array + like {@function_handle,arg1,arg2} + + Example + % create a figure with a random 3-D volume + mri = rand(128,128,128); + ft_plot_slice(mri, 'location', [64 64 64], 'orientation', [1 1 1]); + view(120,30) + xlabel('x'); ylabel('y'); zlabel('z'); grid on + axis([0 128 0 128 0 128]) + axis equal; axis vis3d + axis([0 128 0 128 0 128]) + + % add this function as the callback to make a single selection + set(gcf, 'WindowButtonDownFcn', {@ft_select_voxel, 'callback', @disp}) + + Subsequently you can click in the figure and you'll see that the disp + function is executed as callback and that it displays the selected + voxel. + + See also FT_SELECT_BOX, FT_SELECT_CHANNEL, FT_SELECT_POINT, FT_SELECT_POINT3D, FT_SELECT_RANGE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_select_voxel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_select_voxel", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__plotting/ft_uilayout.py b/fieldtrip/__plotting/ft_uilayout.py new file mode 100644 index 0000000..5972f53 --- /dev/null +++ b/fieldtrip/__plotting/ft_uilayout.py @@ -0,0 +1,90 @@ +from fieldtrip._runtime import Runtime + + +def ft_uilayout(*args, **kwargs): + """ + FT_UILAYOUT is a helper function to make a consistent graphical user interface with + multiple control elements. This function will find all elements with a specific tag + and style, and update or position them consistently. + + Use as + ft_uilayout(h, 'tag', '...', 'style', '...', ...) + where h is the figure handle and 'tag' and 'style' are used to specifying which + user control elements in the figure should be selected. + + You can pass most options from UICONTROL as key-value pair, such as + 'BackgroundColor', 'CallBack', 'Clipping', 'Enable', 'FontAngle', 'FontName', + 'FontSize', 'FontUnits', 'FontWeight', 'ForegroundColor', 'HorizontalAlignment', + 'Max', 'Min', 'Position', 'Selected', 'String', 'Units', 'Value', 'Visible'. + + In addition to the options from UICONTROL, you can use the following key-value + pairs for a consistent placement of multiple GUI elements relative to each other: + 'hpos' = 'auto' puts elements in horizontal adjacent order with a fixed distance of 0.01 + 'align' adjusts the horizontal position of all elements to the first element + 'distribute' puts elements in horizontal adjacent order such that they distribute evenly + scalar sets the horizontal position of elements to the specified scalar + 'vpos' = 'auto' puts elements in vertical adjacent order with a fixed distance of 0.01 + 'align' adjusts the vertical position of all elements to the first element + 'distribute' puts elements in vertical adjacent order such that they distribute evenly + scalar sets the vertical position of elements to the specified scalar + 'width' = scalar sets the width of elements to the specified scalar + 'height' = scalar sets the height of elements to the specified scalar + 'halign' = 'left' aligns the horizontal position of elements to the left + 'right' aligns the horizontal position of elements to the right + 'valign' = 'top' aligns the vertical position of elements to the top + 'bottom' aligns the vertical position of elements to the bottom + 'halign' = 'left' aligns the horizontal position of elements to the left + 'right' aligns the horizontal position of elements to the right + 'hshift' = scalar shift the elements in horizontal direction + 'vshift' = scalar shift the elements in vertical direction + + Here is an example that positions a number of buttons in a 2x3 grid. It makes use + of regular expressions to match the tags to the rows and columns. + + h = figure; + uicontrol('style', 'pushbutton', 'string', '11', 'tag', 'row1_column1'); + uicontrol('style', 'pushbutton', 'string', '12', 'tag', 'row1_column2'); + uicontrol('style', 'pushbutton', 'string', '13', 'tag', 'row1_column3'); + uicontrol('style', 'pushbutton', 'string', '21', 'tag', 'row2_column1'); + uicontrol('style', 'pushbutton', 'string', '22', 'tag', 'row2_column2'); + uicontrol('style', 'pushbutton', 'string', '23', 'tag', 'row2_column3'); + + ft_uilayout(h, 'tag', '^row1', 'vpos', 100); + ft_uilayout(h, 'tag', '^row2', 'vpos', 200); + + ft_uilayout(h, 'tag', 'column1$', 'hpos', 100); + ft_uilayout(h, 'tag', 'column2$', 'hpos', 200); + ft_uilayout(h, 'tag', 'column3$', 'hpos', 300); + + ft_uilayout(h, 'tag', '.*', 'BackGroundColor', [1 0 0]); + + See also UICONTROL, ALIGN, UISTACK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/plotting/ft_uilayout.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_uilayout", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__preproc/__init__.py b/fieldtrip/__preproc/__init__.py new file mode 100644 index 0000000..65863bb --- /dev/null +++ b/fieldtrip/__preproc/__init__.py @@ -0,0 +1,50 @@ +from .ft_preproc_bandpassfilter import ft_preproc_bandpassfilter +from .ft_preproc_bandstopfilter import ft_preproc_bandstopfilter +from .ft_preproc_baselinecorrect import ft_preproc_baselinecorrect +from .ft_preproc_denoise import ft_preproc_denoise +from .ft_preproc_derivative import ft_preproc_derivative +from .ft_preproc_detrend import ft_preproc_detrend +from .ft_preproc_dftfilter import ft_preproc_dftfilter +from .ft_preproc_highpassfilter import ft_preproc_highpassfilter +from .ft_preproc_hilbert import ft_preproc_hilbert +from .ft_preproc_lowpassfilter import ft_preproc_lowpassfilter +from .ft_preproc_medianfilter import ft_preproc_medianfilter +from .ft_preproc_online_downsample_apply import ft_preproc_online_downsample_apply +from .ft_preproc_online_downsample_init import ft_preproc_online_downsample_init +from .ft_preproc_online_filter_apply import ft_preproc_online_filter_apply +from .ft_preproc_online_filter_init import ft_preproc_online_filter_init +from .ft_preproc_padding import ft_preproc_padding +from .ft_preproc_polyremoval import ft_preproc_polyremoval +from .ft_preproc_rectify import ft_preproc_rectify +from .ft_preproc_rereference import ft_preproc_rereference +from .ft_preproc_resample import ft_preproc_resample +from .ft_preproc_slidingrange import ft_preproc_slidingrange +from .ft_preproc_smooth import ft_preproc_smooth +from .ft_preproc_standardize import ft_preproc_standardize + + +__all__ = [ + "ft_preproc_bandpassfilter", + "ft_preproc_bandstopfilter", + "ft_preproc_baselinecorrect", + "ft_preproc_denoise", + "ft_preproc_derivative", + "ft_preproc_detrend", + "ft_preproc_dftfilter", + "ft_preproc_highpassfilter", + "ft_preproc_hilbert", + "ft_preproc_lowpassfilter", + "ft_preproc_medianfilter", + "ft_preproc_online_downsample_apply", + "ft_preproc_online_downsample_init", + "ft_preproc_online_filter_apply", + "ft_preproc_online_filter_init", + "ft_preproc_padding", + "ft_preproc_polyremoval", + "ft_preproc_rectify", + "ft_preproc_rereference", + "ft_preproc_resample", + "ft_preproc_slidingrange", + "ft_preproc_smooth", + "ft_preproc_standardize", +] diff --git a/fieldtrip/__preproc/_defaultId.py b/fieldtrip/__preproc/_defaultId.py new file mode 100644 index 0000000..fd671d3 --- /dev/null +++ b/fieldtrip/__preproc/_defaultId.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _defaultId(*args, **kwargs): + """ + DEFAULTID returns a string that can serve as warning or error identifier, + for example 'FieldTip:ft_read_header:line345'. + + See also WARNING, ERROR, FT_NOTICE, FT_INFO, FT_DEBUG + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/private/defaultId.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("defaultId", *args, **kwargs) diff --git a/fieldtrip/__preproc/_filter_with_correction.py b/fieldtrip/__preproc/_filter_with_correction.py new file mode 100644 index 0000000..c4c6b29 --- /dev/null +++ b/fieldtrip/__preproc/_filter_with_correction.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def _filter_with_correction(*args, **kwargs): + """ + FILTER_WITH_CORRECTION applies the filter to the data and corrects + edge-artifacts for one-pass filtering. + + Use as + [filt] = filter_with_correction(B,A,dat,dir); + where + B,A filter coefficients + dat data matrix (Nchans X Ntime) + dir optional filter direction, can be + 'onepass' forward filter only + 'onepass-reverse' reverse filter only, i.e. backward in time + 'twopass' zero-phase forward and reverse filter (default) + 'twopass-reverse' zero-phase reverse and forward filter + 'twopass-average' average of the twopass and the twopass-reverse + 'onepass-zerophase' zero-phase forward filter with delay compensation (default for firws, linear-phase symmetric FIR only) + 'onepass-reverse-zerophase' zero-phase reverse filter with delay compensation + 'onepass-minphase' minimum-phase converted forward filter (non-linear!, firws only) + + Note that a one- or two-pass filter has consequences for the + strength of the filter, i.e. a two-pass filter with the same filter + order will attenuate the signal twice as strong. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/private/filter_with_correction.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("filter_with_correction", *args, **kwargs) diff --git a/fieldtrip/__preproc/_fir_df.py b/fieldtrip/__preproc/_fir_df.py new file mode 100644 index 0000000..faeb62b --- /dev/null +++ b/fieldtrip/__preproc/_fir_df.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _fir_df(*args, **kwargs): + """ + FIR_DF computes default and maximum possible transition band width from + FIR filter cutoff frequency(ies) + + Use as + [df, maxDf] = fir_df(cutoffArray, Fs) + where + cutoffArray filter cutoff frequency(ies) + Fs sampling frequency in Hz + + Required filter order/transition band width is estimated with the + following heuristic: transition band width is 25% of the lower cutoff + frequency, but not lower than 2 Hz, where possible (for bandpass, + highpass, and bandstop) and distance from passband edge to critical + frequency (DC, Nyquist) otherwise. + + See also FIRWS, FIRWSORD, INVFIRWSORD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/private/fir_df.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fir_df", *args, **kwargs) diff --git a/fieldtrip/__preproc/_fixname.py b/fieldtrip/__preproc/_fixname.py new file mode 100644 index 0000000..f745bba --- /dev/null +++ b/fieldtrip/__preproc/_fixname.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _fixname(*args, **kwargs): + """ + FIXNAME changes all inappropriate characters in a string into '_' + so that it can be used as a filename or as a field name in a structure. + If the string begins with a digit, an 'x' is prepended. + + Use as + str = fixname(str) + + MATLAB 2014a introduces the matlab.lang.makeValidName and + matlab.lang.makeUniqueStrings functions for constructing unique + identifiers, but this particular implementation also works with + older MATLAB versions. + + See also DEBLANK, STRIP, PAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/private/fixname.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixname", *args, **kwargs) diff --git a/fieldtrip/__preproc/_ft_debug.py b/fieldtrip/__preproc/_ft_debug.py new file mode 100644 index 0000000..6aeeb8d --- /dev/null +++ b/fieldtrip/__preproc/_ft_debug.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_debug(*args, **kwargs): + """ + FT_DEBUG prints a debug message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_debug(...) + with arguments similar to fprintf, or + ft_debug(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_debug off + or for specific ones using + ft_debug off msgId + + To switch them back on, you would use + ft_debug on + or for specific ones using + ft_debug on msgId + + Messages are only printed once per timeout period using + ft_debug timeout 60 + ft_debug once + or for specific ones using + ft_debug once msgId + + You can see the most recent messages and identifier using + ft_debug last + + You can query the current on/off/once state for all messages using + ft_debug query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/private/ft_debug.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_debug", *args, **kwargs) diff --git a/fieldtrip/__preproc/_ft_error.py b/fieldtrip/__preproc/_ft_error.py new file mode 100644 index 0000000..3db3aa2 --- /dev/null +++ b/fieldtrip/__preproc/_ft_error.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _ft_error(*args, **kwargs): + """ + FT_ERROR prints an error message on screen, just like the standard ERROR function. + + Use as + ft_error(...) + with arguments similar to fprintf, or + ft_error(msgId, ...) + with arguments similar to error. + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/private/ft_error.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_error", *args, **kwargs) diff --git a/fieldtrip/__preproc/_ft_info.py b/fieldtrip/__preproc/_ft_info.py new file mode 100644 index 0000000..39e834d --- /dev/null +++ b/fieldtrip/__preproc/_ft_info.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_info(*args, **kwargs): + """ + FT_INFO prints an info message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_info(...) + with arguments similar to fprintf, or + ft_info(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_info off + or for specific ones using + ft_info off msgId + + To switch them back on, you would use + ft_info on + or for specific ones using + ft_info on msgId + + Messages are only printed once per timeout period using + ft_info timeout 60 + ft_info once + or for specific ones using + ft_info once msgId + + You can see the most recent messages and identifier using + ft_info last + + You can query the current on/off/once state for all messages using + ft_info query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/private/ft_info.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_info", *args, **kwargs) diff --git a/fieldtrip/__preproc/_ft_notice.py b/fieldtrip/__preproc/_ft_notice.py new file mode 100644 index 0000000..744e61f --- /dev/null +++ b/fieldtrip/__preproc/_ft_notice.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_notice(*args, **kwargs): + """ + FT_NOTICE prints a notice message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_notice(...) + with arguments similar to fprintf, or + ft_notice(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_notice off + or for specific ones using + ft_notice off msgId + + To switch them back on, you would use + ft_notice on + or for specific ones using + ft_notice on msgId + + Messages are only printed once per timeout period using + ft_notice timeout 60 + ft_notice once + or for specific ones using + ft_notice once msgId + + You can see the most recent messages and identifier using + ft_notice last + + You can query the current on/off/once state for all messages using + ft_notice query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/private/ft_notice.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_notice", *args, **kwargs) diff --git a/fieldtrip/__preproc/_ft_notification.py b/fieldtrip/__preproc/_ft_notification.py new file mode 100644 index 0000000..29b9031 --- /dev/null +++ b/fieldtrip/__preproc/_ft_notification.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _ft_notification(*args, **kwargs): + """ + FT_NOTIFICATION works mostly like the WARNING and ERROR commands in MATLAB and + is called by FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO and FT_DEBUG. Please note + that you should not call this function directly. + + Some examples: + ft_info on + ft_info on msgId + ft_info off + ft_info off msgId + ft_info once + ft_info once msgId + ft_info on backtrace + ft_info off backtrace + ft_info on verbose + ft_info off verbose + + ft_info query % shows the status of all notifications + ft_info last % shows the last notification + ft_info clear % clears the status of all notifications + ft_info timeout 10 % sets the timeout (for 'once') to 10 seconds + + See also DEFAULTID, FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/private/ft_notification.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_notification", *args, **kwargs) diff --git a/fieldtrip/__preproc/_ft_platform_supports.py b/fieldtrip/__preproc/_ft_platform_supports.py new file mode 100644 index 0000000..38b12e7 --- /dev/null +++ b/fieldtrip/__preproc/_ft_platform_supports.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def _ft_platform_supports(*args, **kwargs): + """ + FT_PLATFORM_SUPPORTS returns a boolean indicating whether the current platform + supports a specific capability + + Use as + status = ft_platform_supports(what) + or + status = ft_platform_supports('matlabversion', min_version, max_version) + + The following values are allowed for the 'what' parameter, which means means that + the specific feature explained on the right is supported: + + 'which-all' which(...,'all') + 'exists-in-private-directory' exists(...) will look in the /private subdirectory to see if a file exists + 'onCleanup' onCleanup(...) + 'alim' alim(...) + 'int32_logical_operations' bitand(a,b) with a, b of type int32 + 'graphics_objects' graphics system is object-oriented + 'libmx_c_interface' libmx is supported through mex in the C-language (recent MATLAB versions only support C++) + 'images' all image processing functions in FieldTrip's external/images directory + 'signal' all signal processing functions in FieldTrip's external/signal directory + 'stats' all statistical functions in FieldTrip's external/stats directory + 'program_invocation_name' program_invocation_name() (GNU Octave) + 'singleCompThread' start MATLAB with -singleCompThread + 'nosplash' start MATLAB with -nosplash + 'nodisplay' start MATLAB with -nodisplay + 'nojvm' start MATLAB with -nojvm + 'no-gui' start GNU Octave with --no-gui + 'RandStream.setGlobalStream' RandStream.setGlobalStream(...) + 'RandStream.setDefaultStream' RandStream.setDefaultStream(...) + 'rng' rng(...) + 'rand-state' rand('state') + 'urlread-timeout' urlread(..., 'Timeout', t) + 'griddata-vector-input' griddata(...,...,...,a,b) with a and b vectors + 'griddata-v4' griddata(...,...,...,...,...,'v4') with v4 interpolation support + 'uimenu' uimenu(...) + 'weboptions' weboptions(...) + 'parula' parula(...) + 'datetime' datetime structure + 'html' html rendering in desktop + + See also FT_VERSION, VERSION, VER, VERLESSTHAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/private/ft_platform_supports.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_platform_supports", *args, **kwargs) diff --git a/fieldtrip/__preproc/_ft_version.py b/fieldtrip/__preproc/_ft_version.py new file mode 100644 index 0000000..2476257 --- /dev/null +++ b/fieldtrip/__preproc/_ft_version.py @@ -0,0 +1,69 @@ +from fieldtrip._runtime import Runtime + + +def _ft_version(*args, **kwargs): + """ + FT_VERSION returns the version of FieldTrip and the path where it is installed + + FieldTrip is not released with version numbers as "2.0", "2.1", etc. Instead, we + share our development version on http://github.com/fieldtrip/fieldtrip. You can use + git to make a local clone of the development version. Furthermore, we make + more-or-less daily releases of the code available on + https://github.com/fieldtrip/fieldtrip/releases and as zip file on our FTP server. + + If you use git with the development version, the version is labeled with the hash + of the latest commit like "128c693". You can access the specific version "XXXXXX" + at https://github.com/fieldtrip/fieldtrip/commit/XXXXXX. + + If you download the daily released version from our FTP server, the version is part + of the file name "fieldtrip-YYYYMMDD.zip", where YYY, MM and DD correspond to year, + month and day. + + Use as + ft_version + to display the latest revision number on screen, or + [ftver, ftpath] = ft_version + to get the version and the installation root directory. + + When using git with the development version, you can also get additional information with + ft_version revision + ft_version branch + ft_version clean + + On macOS you might have installed git along with Xcode instead of with homebrew, + which then requires that you agree to the Apple license. In that case it can + happen that this function stops, as in the background (invisible to you) it is + asking whether you agree. You can check this by typing "/usr/bin/git", which will + show the normal help message, or which will mention the license agreement. To + resolve this please open a terminal and type "sudo xcodebuild -license" + + See also FT_PLATFORM_SUPPORTS, VERSION, VER, VERLESSTHAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/private/ft_version.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_version", *args, **kwargs) diff --git a/fieldtrip/__preproc/_ft_warning.py b/fieldtrip/__preproc/_ft_warning.py new file mode 100644 index 0000000..f2eab50 --- /dev/null +++ b/fieldtrip/__preproc/_ft_warning.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def _ft_warning(*args, **kwargs): + """ + FT_WARNING prints a warning message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. This function works + similar to the standard WARNING function, but also features the "once" mode. + + Use as + ft_warning(...) + with arguments similar to fprintf, or + ft_warning(msgId, ...) + with arguments similar to warning. + + You can switch of all warning messages using + ft_warning off + or for specific ones using + ft_warning off msgId + + To switch them back on, you would use + ft_warning on + or for specific ones using + ft_warning on msgId + + Warning messages are only printed once per timeout period using + ft_warning timeout 60 + ft_warning once + or for specific ones using + ft_warning once msgId + + You can see the most recent messages and identifier using + ft_warning last + + You can query the current on/off/once state for all messages using + ft_warning query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/private/ft_warning.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_warning", *args, **kwargs) diff --git a/fieldtrip/__preproc/_isalmostequal.py b/fieldtrip/__preproc/_isalmostequal.py new file mode 100644 index 0000000..332f4dc --- /dev/null +++ b/fieldtrip/__preproc/_isalmostequal.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _isalmostequal(*args, **kwargs): + """ + ISALMOSTEQUAL compares two input variables and returns true/false + and a message containing the details on the observed difference. + + Use as + [ok, message] = isalmostequal(a, b) + [ok, message] = isalmostequal(a, b, ...) + + This works for all possible input variables a and b, like + numerical arrays, string arrays, cell arrays, structures + and nested data types. + + Optional input arguments come in key-value pairs, supported are + 'depth' number, for nested structures + 'abstol' number, absolute tolerance for numerical comparison + 'reltol' number, relative tolerance for numerical comparison + 'diffabs' boolean, check difference between absolute values for numericals (useful for e.g. mixing matrices which have arbitrary signs) + + See also ISEQUAL, ISEQUALNAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/private/isalmostequal.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("isalmostequal", *args, **kwargs) diff --git a/fieldtrip/__preproc/_istrue.py b/fieldtrip/__preproc/_istrue.py new file mode 100644 index 0000000..07ebc15 --- /dev/null +++ b/fieldtrip/__preproc/_istrue.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _istrue(*args, **kwargs): + """ + ISTRUE converts an input argument like "yes/no", "true/false" or "on/off" into a + boolean. If the input is boolean, then it will remain like that. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/private/istrue.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("istrue", *args, **kwargs) diff --git a/fieldtrip/__preproc/_keyval.py b/fieldtrip/__preproc/_keyval.py new file mode 100644 index 0000000..7e4a3bc --- /dev/null +++ b/fieldtrip/__preproc/_keyval.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _keyval(*args, **kwargs): + """ + KEYVAL returns the value that corresponds to the requested key in a + key-value pair list of variable input arguments + + Use as + [val] = keyval(key, varargin) + + See also VARARGIN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/private/keyval.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("keyval", *args, **kwargs) diff --git a/fieldtrip/__preproc/_nearest.py b/fieldtrip/__preproc/_nearest.py new file mode 100644 index 0000000..3c93490 --- /dev/null +++ b/fieldtrip/__preproc/_nearest.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def _nearest(*args, **kwargs): + """ + NEAREST return the index of an array nearest to a scalar + + Use as + [indx] = nearest(array, val, insideflag, toleranceflag) + + The second input val can be a scalar, or a [minval maxval] vector for + limits selection. + + If not specified or if left empty, the insideflag and the toleranceflag + will default to false. + + The boolean insideflag can be used to specify whether the value should be + within the array or not. For example nearest(1:10, -inf) will return 1, + but nearest(1:10, -inf, true) will return an error because -inf is not + within the array. + + The boolean toleranceflag is used when insideflag is true. It can be used + to specify whether some tolerance should be allowed for values that are + just outside the array. For example nearest(1:10, 0.99, true, false) will + return an error, but nearest(1:10, 0.99, true, true) will return 1. The + tolerance that is allowed is half the distance between the subsequent + values in the array. + + See also FIND + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/private/nearest.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nearest", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_bandpassfilter.py b/fieldtrip/__preproc/ft_preproc_bandpassfilter.py new file mode 100644 index 0000000..0b58fef --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_bandpassfilter.py @@ -0,0 +1,89 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_bandpassfilter(*args, **kwargs): + """ + FT_PREPROC_BANDPASSFILTER applies a band-pass filter to the data and thereby + removes the spectral components in the data except for the ones in the + specified frequency band. + + Use as + [filt] = ft_preproc_bandpassfilter(dat, Fs, Fbp, order, type, dir, instabilityfix, df, wintype, dev, plotfiltresp, usefftfilt) + where + dat data matrix (Nchans X Ntime) + Fs sampling frequency in Hz + Fbp frequency band, specified as [Fhp Flp] in Hz + order optional filter order, default is 4 (but) or dependent on frequency band and data length (fir/firls) + type optional filter type, can be + 'but' Butterworth IIR filter (default) + 'firws' FIR filter with windowed sinc + 'fir' FIR filter using MATLAB fir1 function + 'firls' FIR filter using MATLAB firls function (requires MATLAB Signal Processing Toolbox) + 'brickwall' frequency-domain filter using forward and inverse FFT + dir optional filter direction, can be + 'onepass' forward filter only + 'onepass-reverse' reverse filter only, i.e. backward in time + 'onepass-zerophase' zero-phase forward filter with delay compensation (default for firws, linear-phase symmetric FIR only) + 'onepass-reverse-zerophase' zero-phase reverse filter with delay compensation + 'onepass-minphase' minimum-phase converted forward filter (non-linear, only for firws) + 'twopass' zero-phase forward and reverse filter (default, except for firws) + 'twopass-reverse' zero-phase reverse and forward filter + 'twopass-average' average of the twopass and the twopass-reverse + instabilityfix optional method to deal with filter instabilities + 'no' only detect and give error (default) + 'reduce' reduce the filter order + 'split' split the filter in two lower-order filters, apply sequentially + df optional transition width (only for firws) + wintype optional window type (only for firws), can be + 'hamming' (default) maximum passband deviation 0.0022 [0.22%], stopband attenuation -53dB + 'hann' maximum passband deviation 0.0063 [0.63%], stopband attenuation -44dB + 'blackman' maximum passband deviation 0.0002 [0.02%], stopband attenuation -74dB + 'kaiser' + dev optional max passband deviation/stopband attenuation (only for firws with kaiser window, default = 0.001 [0.1%, -60 dB]) + plotfiltresp optional, 'yes' or 'no', plot filter responses (only for firws, default = 'no') + usefftfilt optional, 'yes' or 'no', use fftfilt instead of filter (only for firws, default = 'no') + + Note that a one- or two-pass filter has consequences for the strength of the + filter, i.e. a two-pass filter with the same filter order will attenuate the signal + twice as strong. + + Further note that the filter type 'brickwall' filters in the frequency domain, + but may have severe issues. For instance, it has the implication that the time + domain signal is periodic. Another issue pertains to that frequencies are + not well defined over short time intervals; particularly for low frequencies. + + If the data contains NaNs, these will affect the output. With an IIR + filter, and/or with FFT-filtering, local NaNs will spread to the whole + time series. With a FIR filter, local NaNs will spread locally, depending + on the filter order. + + See also PREPROC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_bandpassfilter.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_bandpassfilter", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_bandstopfilter.py b/fieldtrip/__preproc/ft_preproc_bandstopfilter.py new file mode 100644 index 0000000..ed1c220 --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_bandstopfilter.py @@ -0,0 +1,88 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_bandstopfilter(*args, **kwargs): + """ + FT_PREPROC_BANDSTOPFILTER applies a band-stop filter to the data and thereby + removes the spectral components in the specified frequency band + + Use as + [filt] = ft_preproc_bandstopfilter(dat, Fs, Fbp, order, type, dir, instabilityfix, df, wintype, dev, plotfiltresp, usefftfilt) + where + dat data matrix (Nchans X Ntime) + Fs sampling frequency in Hz + Fbp frequency band, specified as [Fhp Flp] in Hz + N optional filter order, default is 4 (but) or dependent on frequency band and data length (fir/firls) + type optional filter type, can be + 'but' Butterworth IIR filter (default) + 'firws' FIR filter with windowed sinc + 'fir' FIR filter using MATLAB fir1 function + 'firls' FIR filter using MATLAB firls function (requires MATLAB Signal Processing Toolbox) + 'brickwall' frequency-domain filter using forward and inverse FFT + dir optional filter direction, can be + 'onepass' forward filter only + 'onepass-reverse' reverse filter only, i.e. backward in time + 'onepass-zerophase' zero-phase forward filter with delay compensation (default for firws, linear-phase symmetric FIR only) + 'onepass-reverse-zerophase' zero-phase reverse filter with delay compensation + 'onepass-minphase' minimum-phase converted forward filter (non-linear, only for firws) + 'twopass' zero-phase forward and reverse filter (default, except for firws) + 'twopass-reverse' zero-phase reverse and forward filter + 'twopass-average' average of the twopass and the twopass-reverse + instabilityfix optional method to deal with filter instabilities + 'no' only detect and give error (default) + 'reduce' reduce the filter order + 'split' split the filter in two lower-order filters, apply sequentially + df optional transition width (only for firws) + wintype optional window type (only for firws), can be + 'hamming' (default) maximum passband deviation 0.0022 [0.22%], stopband attenuation -53dB + 'hann' maximum passband deviation 0.0063 [0.63%], stopband attenuation -44dB + 'blackman' maximum passband deviation 0.0002 [0.02%], stopband attenuation -74dB + 'kaiser' + dev optional max passband deviation/stopband attenuation (only for firws with kaiser window, default = 0.001 [0.1%, -60 dB]) + plotfiltresp optional, 'yes' or 'no', plot filter responses (only for firws, default = 'no') + usefftfilt optional, 'yes' or 'no', use fftfilt instead of filter (only for firws, default = 'no') + + Note that a one- or two-pass filter has consequences for the strength of the + filter, i.e. a two-pass filter with the same filter order will attenuate the signal + twice as strong. + + Further note that the filter type 'brickwall' filters in the frequency domain, + but may have severe issues. For instance, it has the implication that the time + domain signal is periodic. Another issue pertains to that frequencies are + not well defined over short time intervals; particularly for low frequencies. + + If the data contains NaNs, these will affect the output. With an IIR + filter, and/or with FFT-filtering, local NaNs will spread to the whole + time series. With a FIR filter, local NaNs will spread locally, depending + on the filter order. + + See also PREPROC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_bandstopfilter.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_bandstopfilter", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_baselinecorrect.py b/fieldtrip/__preproc/ft_preproc_baselinecorrect.py new file mode 100644 index 0000000..8bb1fe3 --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_baselinecorrect.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_baselinecorrect(*args, **kwargs): + """ + FT_PREPROC_BASELINECORRECT performs a baseline correction, e.g. using the + prestimulus interval of the data or using the complete data + + Use as + [dat] = ft_preproc_baselinecorrect(dat, begin, end) + where + dat data matrix (Nchans X Ntime) + begsample index of the begin sample for the baseline estimate + endsample index of the end sample for the baseline estimate + + If no begin and end sample are specified for the baseline estimate, it + will be estimated on the complete data. + + If the data contains NaNs, these are ignored for the computation, but + retained in the output. + + See also FT_PREPROC_DETREND, FT_PREPROC_POLYREMOVAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_baselinecorrect.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_baselinecorrect", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_denoise.py b/fieldtrip/__preproc/ft_preproc_denoise.py new file mode 100644 index 0000000..20e101a --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_denoise.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_denoise(*args, **kwargs): + """ + FT_PREPROC_DENOISE performs a regression of the matrix dat onto refdat, and + subtracts the projected data. This is for the purpose of removing signals generated + by coils during continuous head motion tracking, for example. + + Use as + [dat] = ft_preproc_denoise(dat, refdat, hilbertflag) + where + dat data matrix (Nchan1 X Ntime) + refdat data matrix (Nchan2 X Ntime) + hilbertflag boolean, regress out the real and imaginary parts of the Hilbert + transformed signal, this is only meaningful for narrow band + reference data (default = false) + + The number of channels of the data and reference data does not have to be the same. + + If the data contains NaNs, the output of the affected channel(s) will be all NaN. + + See also PREPROC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_denoise.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_denoise", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_derivative.py b/fieldtrip/__preproc/ft_preproc_derivative.py new file mode 100644 index 0000000..3f7638f --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_derivative.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_derivative(*args, **kwargs): + """ + FT_PREPROC_DERIVATIVE computes the temporal Nth order derivative of the + data + + Use as + [dat] = ft_preproc_derivative(dat, order, deltat) + where + dat data matrix (Nchans X Ntime) + order number representing the Nth derivative (default = 1) + deltat number representing the duration of 1 time step in the data + (default = 1) + + If the data contains NaNs, these are ignored for the computation, but + retained in the output. + + See also PREPROC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_derivative.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_derivative", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_detrend.py b/fieldtrip/__preproc/ft_preproc_detrend.py new file mode 100644 index 0000000..60e9c90 --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_detrend.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_detrend(*args, **kwargs): + """ + FT_PREPROC_DETREND removes mean and linear trend from the + data using using a General Linear Modeling approach. + + Use as + [dat] = ft_preproc_detrend(dat, begin, end) + where + dat = data matrix (Nchans X Ntime) + begsample = index of the begin sample for the trend estimate + endsample = index of the end sample for the trend estimate + + If no begin and end sample are specified for the trend estimate, it + will be estimated on the complete data. + + See also FT_PREPROC_BASELINECORRECT, FT_PREPROC_POLYREMOVAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_detrend.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_detrend", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_dftfilter.py b/fieldtrip/__preproc/ft_preproc_dftfilter.py new file mode 100644 index 0000000..a08acb1 --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_dftfilter.py @@ -0,0 +1,111 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_dftfilter(*args, **kwargs): + """ + FT_PREPROC_DFTFILTER reduces power line noise (50 or 60Hz) using a + discrete Fourier transform (DFT) filter, or spectrum interpolation. + + Use as + [filt] = ft_preproc_dftfilter(dat, Fsample) + or + [filt] = ft_preproc_dftfilter(dat, Fsample, Fline) + or + [filt] = ft_preproc_dftfilter(dat, Fsample, Fline, 'dftreplace', 'zero') + or + [filt] = ft_preproc_dftfilter(dat, Fsample, Fline, 'dftreplace', 'neighbour') + where + dat data matrix (Nchans X Ntime) + Fsample sampling frequency in Hz + Fline frequency of the power line interference (if omitted from the input + the default European value of 50 Hz is assumed) + + Additional optional arguments are to be provided as key-value pairs: + dftreplace = 'zero' (default), 'neighbour' or 'neighbour_fft'. + + If dftreplace = 'zero', the powerline component's amplitude is estimated by + fitting a sine and cosine at the specified frequency, and subsequently + this fitted signal is subtracted from the data. The longer the sharper + the spectral notch will be that is removed from the data. + Preferably the data should have a length that is an integer multiple of the + oscillation period of the line noise (i.e. 20ms for 50Hz noise). If the + data is of different length, then only the first N complete periods are + used to estimate the line noise. The estimate is subtracted from the + complete data. + + If dftreplace = 'neighbour' the powerline component is reduced via + spectrum interpolation (Leske & Dalal, 2019, NeuroImage 189, + doi: 10.1016/j.neuroimage.2019.01.026), estimating the required signal + components by fitting sines and cosines. The algorithmic steps are + described in more detail below. % Preferably the data should have a length + that is an integer multiple of the oscillation period of the line noise + (i.e. 20ms for 50Hz noise). If the data is of different length, then only + the first N complete periods are used to estimate the line noise. The + estimate is subtracted from the complete data. Due to the possibility of + using slightly truncated data for the estimation of the necessary signal + components, this method is more forgiving with respect to numerical + issues with respect to the sampling frequency, and suboptimal epoch + lengths, in comparison to the method below. + + If dftreplace = 'neighbour_fft' the powerline component is reduced via spectrum + interpolation, in its original implementation, based on an algorithm that + uses an FFT and iFFT for the estimation of the spectral components. The signal is: + I) transformed into the frequency domain via a fast Fourier + transform (FFT), + II) the line noise component (e.g. 50Hz, dftbandwidth = 1 (±1Hz): 49-51Hz) is + interpolated in the amplitude spectrum by replacing the amplitude + of this frequency bin by the mean of the adjacent frequency bins + ('neighbours', e.g. 49Hz and 51Hz). + dftneighbourwidth defines frequencies considered for the mean (e.g. + dftneighbourwidth = 2 (±2Hz) implies 47-49 Hz and 51-53 Hz). + The original phase information of the noise frequency bin is + retained. + III) the signal is transformed back into the time domain via inverse FFT + (iFFT). + If Fline is a vector (e.g. [50 100 150]), harmonics are also considered. + Preferably the data should be continuous or consist of long data segments + (several seconds) to avoid edge effects. If the sampling rate and the + data length are such, that a full cycle of the line noise and the harmonics + fit in the data and if the line noise is stationary (e.g. no variations + in amplitude or frequency), then spectrum interpolation can also be + applied to short trials. But it should be used with caution and checked + for edge effects. + + When using spectral interpolation, additional arguments are: + + dftbandwidth half bandwidth of line noise frequency bands, applies to spectrum interpolation, in Hz + dftneighbourwidth width of frequencies neighbouring line noise frequencies, applies to spectrum interpolation (dftreplace = 'neighbour'), in Hz + + If the data contains NaNs, the output of the affected channel(s) will be + all(NaN). + + See also PREPROC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_dftfilter.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_dftfilter", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_highpassfilter.py b/fieldtrip/__preproc/ft_preproc_highpassfilter.py new file mode 100644 index 0000000..ec144ce --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_highpassfilter.py @@ -0,0 +1,83 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_highpassfilter(*args, **kwargs): + """ + FT_PREPROC_HIGHPASSFILTER applies a high-pass filter to the data and thereby removes + the low frequency components in the data + + Use as + [filt] = ft_preproc_highpassfilter(dat, Fsample, Fhp, N, type, dir, instabilityfix) + where + dat data matrix (Nchans X Ntime) + Fs sampling frequency in Hz + Fhp filter frequency in Hz + order optional filter order, default is 6 (but) or dependent on frequency band and data length (fir/firls) + type optional filter type, can be + 'but' Butterworth IIR filter (default) + 'firws' FIR filter with windowed sinc + 'fir' FIR filter using MATLAB fir1 function + 'firls' FIR filter using MATLAB firls function (requires MATLAB Signal Processing Toolbox) + 'brickwall' frequency-domain filter using forward and inverse FFT + dir optional filter direction, can be + 'onepass' forward filter only + 'onepass-reverse' reverse filter only, i.e. backward in time + 'onepass-zerophase' zero-phase forward filter with delay compensation (default for firws, linear-phase symmetric FIR only) + 'onepass-reverse-zerophase' zero-phase reverse filter with delay compensation + 'onepass-minphase' minimum-phase converted forward filter (non-linear, only for firws) + 'twopass' zero-phase forward and reverse filter (default, except for firws) + 'twopass-reverse' zero-phase reverse and forward filter + 'twopass-average' average of the twopass and the twopass-reverse + instabilityfix optional method to deal with filter instabilities + 'no' only detect and give error (default) + 'reduce' reduce the filter order + 'split' split the filter in two lower-order filters, apply sequentially + df optional transition width (firws) + wintype optional window type (firws), can be + 'hamming' (default) maximum passband deviation 0.0022 [0.22%], stopband attenuation -53dB + 'hann' maximum passband deviation 0.0063 [0.63%], stopband attenuation -44dB + 'blackman' maximum passband deviation 0.0002 [0.02%], stopband attenuation -74dB + 'kaiser' + dev optional max passband deviation/stopband attenuation (only for firws with kaiser window, default = 0.001 [0.1%, -60 dB]) + plotfiltresp optional, 'yes' or 'no', plot filter responses (only for firws, default = 'no') + usefftfilt optional, 'yes' or 'no', use fftfilt instead of filter (only for firws, default = 'no') + + Note that a one- or two-pass filter has consequences for the strength of the filter, + i.e. a two-pass filter with the same filter order will attenuate the signal twice as + strong. + + Further note that the filter type 'brickwall' filters in the frequency domain, + but may have severe issues. For instance, it has the implication that the time + domain signal is periodic. Another issue pertains to that frequencies are + not well defined over short time intervals; particularly for low frequencies. + + See also PREPROC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_highpassfilter.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_highpassfilter", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_hilbert.py b/fieldtrip/__preproc/ft_preproc_hilbert.py new file mode 100644 index 0000000..cbb3416 --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_hilbert.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_hilbert(*args, **kwargs): + """ + FT_PREPROC_HILBERT computes the Hilbert transform of the data and optionally + performs post-processing on the complex representation, e.g. the absolute + value of the Hilbert transform of a band-pass filtered signal corresponds + to the amplitude envelope. + + Use as + [dat] = ft_preproc_hilbert(dat, option) + where + dat data matrix (Nchans X Ntime) + option string that determines whether and how the Hilbert transform should be post-processed, can be + 'abs' (default) + 'complex' + 'real' + 'imag' + 'absreal' + 'absimag' + 'angle' + + If the data contains NaNs, the output of the affected channel(s) will be + all(NaN). + + See also PREPROC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_hilbert.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_hilbert", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_lowpassfilter.py b/fieldtrip/__preproc/ft_preproc_lowpassfilter.py new file mode 100644 index 0000000..5b44d9a --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_lowpassfilter.py @@ -0,0 +1,88 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_lowpassfilter(*args, **kwargs): + """ + FT_PREPROC_LOWPASSFILTER applies a low-pass filter to the data and thereby removes + all high frequency components in the data + + Use as + [filt] = ft_preproc_lowpassfilter(dat, Fs, Flp, N, type, dir, instabilityfix, df, wintype, dev, plotfiltresp, usefftfilt) + where + dat data matrix (Nchans X Ntime) + Fs sampling frequency in Hz + Flp filter frequency in Hz + order optional filter order, default is 6 (but) or dependent on frequency band and data length (fir/firls) + type optional filter type, can be + 'but' Butterworth IIR filter (default) + 'firws' FIR filter with windowed sinc + 'fir' FIR filter using MATLAB fir1 function + 'firls' FIR filter using MATLAB firls function (requires MATLAB Signal Processing Toolbox) + 'brickwall' frequency-domain filter using forward and inverse FFT + dir optional filter direction, can be + 'onepass' forward filter only + 'onepass-reverse' reverse filter only, i.e. backward in time + 'onepass-zerophase' zero-phase forward filter with delay compensation (default for firws, linear-phase symmetric FIR only) + 'onepass-reverse-zerophase' zero-phase reverse filter with delay compensation + 'onepass-minphase' minimum-phase converted forward filter (non-linear, only for firws) + 'twopass' zero-phase forward and reverse filter (default, except for firws) + 'twopass-reverse' zero-phase reverse and forward filter + 'twopass-average' average of the twopass and the twopass-reverse + instabilityfix optional method to deal with filter instabilities + 'no' only detect and give error (default) + 'reduce' reduce the filter order + 'split' split the filter in two lower-order filters, apply sequentially + df optional transition width (firws) + wintype optional window type (firws), can be + 'hamming' (default) maximum passband deviation 0.0022 [0.22%], stopband attenuation -53dB + 'hann' maximum passband deviation 0.0063 [0.63%], stopband attenuation -44dB + 'blackman' maximum passband deviation 0.0002 [0.02%], stopband attenuation -74dB + 'kaiser' + dev optional max passband deviation/stopband attenuation (only for firws with kaiser window, default = 0.001 [0.1%, -60 dB]) + plotfiltresp optional, 'yes' or 'no', plot filter responses (only for firws, default = 'no') + usefftfilt optional, 'yes' or 'no', use fftfilt instead of filter (only for firws, default = 'no') + + Note that a one- or two-pass filter has consequences for the strength of the + filter, i.e. a two-pass filter with the same filter order will attenuate the signal + twice as strong. + + Further note that the filter type 'brickwall' filters in the frequency domain, + but may have severe issues. For instance, it has the implication that the time + domain signal is periodic. Another issue pertains to that frequencies are + not well defined over short time intervals; particularly for low frequencies. + + If the data contains NaNs, these will affect the output. With an IIR + filter, and/or with FFT-filtering, local NaNs will spread to the whole + time series. With a FIR filter, local NaNs will spread locally, depending + on the filter order. + + See also PREPROC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_lowpassfilter.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_lowpassfilter", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_medianfilter.py b/fieldtrip/__preproc/ft_preproc_medianfilter.py new file mode 100644 index 0000000..d103530 --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_medianfilter.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_medianfilter(*args, **kwargs): + """ + FT_PREPROC_MEDIANFILTER applies a median filter, which smooths the data with a + boxcar-like kernel, except that it keeps steps in the data. This function requires + the MATLAB Signal Processing toolbox. + + Use as + [dat] = ft_preproc_medianfilter(dat, order) + where + dat data matrix (Nchans X Ntime) + order number, the length of the median filter kernel (default = 25) + + If the data contains NaNs, these are ignored for the computation, but + retained in the output. + + See also PREPROC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_medianfilter.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_medianfilter", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_online_downsample_apply.py b/fieldtrip/__preproc/ft_preproc_online_downsample_apply.py new file mode 100644 index 0000000..313d2dc --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_online_downsample_apply.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_online_downsample_apply(*args, **kwargs): + """ + FT_PREPROC_ONLINE_DOWNSAMPLE_APPLY passes a signal through the online downsampler + and returns the downsampler state and the downsampled signal. The state keeps track + of the number of samples to be skipped in the next call. + + Use as + [state, dat] = ft_preproc_online_downsample_apply(state, x) + where + dat = Nchan x Ntime + state = downsampler state, see FT_PREPROC_ONLINE_DOWNSAMPLE_INIT + + See also PREPROC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_online_downsample_apply.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_online_downsample_apply", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_online_downsample_init.py b/fieldtrip/__preproc/ft_preproc_online_downsample_init.py new file mode 100644 index 0000000..9d65f75 --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_online_downsample_init.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_online_downsample_init(*args, **kwargs): + """ + FT_PREPROC_ONLINE_DOWNSAMPLE_INIT initializes an downsampling model with the given factor. + + Use as + state = ft_preproc_online_downsample_init(factor) + + See also PREPROC, FT_PREPROC_ONLINE_DOWNSAMPLE_APPLY + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_online_downsample_init.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_online_downsample_init", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_online_filter_apply.py b/fieldtrip/__preproc/ft_preproc_online_filter_apply.py new file mode 100644 index 0000000..0122d15 --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_online_filter_apply.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_online_filter_apply(*args, **kwargs): + """ + FT_PREPROC_ONLINE_FILTER_APPLY passes a signal through the online filter and + returns the updated filter model (delay states) and the filtered signal. + + Use as + [state, dat] = ft_preproc_online_filter_apply(state, dat) + where + dat = Nchan x Ntime + state = filter state, see FT_PREPROC_ONLINE_FILTER_INIT + + See also PREPROC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_online_filter_apply.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_online_filter_apply", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_online_filter_init.py b/fieldtrip/__preproc/ft_preproc_online_filter_init.py new file mode 100644 index 0000000..62048d3 --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_online_filter_init.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_online_filter_init(*args, **kwargs): + """ + FT_PREPROC_ONLINE_FILTER_INIT initialize an IIR filter model with coefficients B + and A, as used in filter and butter etc. The most recent sample of the signal must + be given as a column vector. + + Use as + state = ft_preproc_online_filter_init(B, A, dat) + + This function will calculate the filter delay states such that the initial response + will be as if the filter already have been applied forever. + + See also PREPROC, FT_PREPROC_ONLINE_FILTER_APPLY + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_online_filter_init.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_online_filter_init", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_padding.py b/fieldtrip/__preproc/ft_preproc_padding.py new file mode 100644 index 0000000..c72d42c --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_padding.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_padding(*args, **kwargs): + """ + FT_PREPROC_PADDING performs padding on the data, i.e. adds or removes samples + to or from the data matrix. + + Use as + [dat] = ft_preproc_padding(dat, padtype, padlength) + or as + [dat] = ft_preproc_padding(dat, padtype, prepadlength, postpadlength) + where + dat data matrix (Nchan x Ntime) + padtype 'zero', 'mean', 'localmean', 'edge', 'mirror', 'nan' or 'remove' + padlength scalar, number of samples that will be padded + prepadlength scalar, number of samples that will be padded before the data + postpadlength scalar, number of samples that will be padded after the data + + If padlength is used instead of prepadlength and postpadlength, padding + will be symmetrical (i.e. padlength = prepadlength = postpadlength) + + If the data contains NaNs, these are ignored for the computation, but + retained in the output. Depending on the type of padding, NaNs may spread + to the pads. + + See also FT_PREPROCESSING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_padding.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_padding", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_polyremoval.py b/fieldtrip/__preproc/ft_preproc_polyremoval.py new file mode 100644 index 0000000..7a1c489 --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_polyremoval.py @@ -0,0 +1,63 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_polyremoval(*args, **kwargs): + """ + FT_PREPROC_POLYREMOVAL removed an Nth order polynomal from the data + + Use as + dat = ft_preproc_polyremoval(dat, order, begsample, endsample, flag) + where + dat data matrix (Nchans X Ntime) + order the order of the polynomial + begsample index of the begin sample for the estimate of the polynomial + endsample index of the end sample for the estimate of the polynomial + flag optional boolean to specify whether the first order basis + vector will zscored prior to computing higher order basis + vectors from the first-order basis vector (and the beta + weights). This is to avoid numerical problems with the + inversion of the covariance when the polynomial is of high + order/number of samples is large. + + If begsample and endsample are not specified, it will use the whole + window to estimate the polynomial. + + For example + ft_preproc_polyremoval(dat, 0) + removes the mean value from each channel and + ft_preproc_polyremoval(dat, 1) + removes the mean and the linear trend. + + If the data contains NaNs, these are ignored for the computation, but + retained in the output. + + See also FT_PREPROC_BASELINECORRECT, FT_PREPROC_DETREND + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_polyremoval.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_polyremoval", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_rectify.py b/fieldtrip/__preproc/ft_preproc_rectify.py new file mode 100644 index 0000000..3044b9f --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_rectify.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_rectify(*args, **kwargs): + """ + FT_PREPROC_RECTIFY rectifies the data, i.e. converts all samples with a + negative value into the similar magnitude positive value + + Use as + [dat] = ft_preproc_rectify(dat) + where + dat data matrix (Nchans X Ntime) + + If the data contains NaNs, these are ignored for the computation, but + retained in the output. + + See also PREPROC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_rectify.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_rectify", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_rereference.py b/fieldtrip/__preproc/ft_preproc_rereference.py new file mode 100644 index 0000000..6ee6c88 --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_rereference.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_rereference(*args, **kwargs): + """ + FT_PREPROC_REREFERENCE computes the average reference over all EEG channels + or rereferences the data to the selected channels + + Use as + [dat] = ft_preproc_rereference(dat, refchan, method, handlenan, leadfield) + where + dat data matrix (Nchans X Ntime) + refchan vector with indices of the new reference channels, or 'all' + method string, can be 'avg', 'median', or 'rest' + handlenan boolean, can be false (default) or true + leadfield leadfield matrix (required for REST, otherwise empty) + + If the new reference channel(s) are not specified, the data will be + rereferenced to the average of all channels. + + If the data that is used to compute the new reference contains NaNs, + these will spread to all output channels, unless the handlenan flag has + been set to true. + + For REST the leadfield should be a matrix (channels X sources) + which is calculated by using the forward theory, based on + the electrode montage, head model and equivalent source + model. + + See also PREPROC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_rereference.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_rereference", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_resample.py b/fieldtrip/__preproc/ft_preproc_resample.py new file mode 100644 index 0000000..6a5c248 --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_resample.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_resample(*args, **kwargs): + """ + FT_PREPROC_RESAMPLE resamples all channels in the data matrix + + Use as + dat = ft_preproc_resample(dat, Fold, Fnew, method) + where + dat = matrix with the input data (Nchans X Nsamples) + Fold = scalar, original sampling frequency in Hz + Fnew = scalar, desired sampling frequency in Hz + method = string, can be 'resample', 'decimate', 'downsample', 'fft' + + The resample method applies an anti-aliasing (lowpass) FIR filter to + the data during the resampling process, and compensates for the filter's + delay. For the other two methods you should apply an anti-aliassing + filter prior to calling this function. + + If the data contains NaNs, these are ignored for the computation, but + retained in the output. + + See also PREPROC, FT_PREPROC_LOWPASSFILTER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_resample.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_resample", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_slidingrange.py b/fieldtrip/__preproc/ft_preproc_slidingrange.py new file mode 100644 index 0000000..9d1bbb8 --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_slidingrange.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_slidingrange(*args, **kwargs): + """ + FT_PREPROC_SLIDINGRANGE computes the range of the data in a sliding time + window of the width specified. + + Use as + [dat] = ft_preproc_slidingrange(dat, width, normalize) + where + dat data matrix (Nchans x Ntime) + width width of the smoothing kernel, this should be an odd number since the window needs to be centered on an individual sample + normalize boolean, whether to normalize the range of the data with the square root of the window size (default = false) + + If the data contains NaNs, these are ignored for the computation, but retained in + the output. + + See also PREPROC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_slidingrange.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_slidingrange", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_smooth.py b/fieldtrip/__preproc/ft_preproc_smooth.py new file mode 100644 index 0000000..ef37585 --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_smooth.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_smooth(*args, **kwargs): + """ + FT_PREPROC_SMOOTH performs boxcar smoothing with specified length. + Edge behavior is improved by implicit padding with the mean over + half the boxcar length at the edges of the data segment. + + Use as + [dat] = ft_preproc_smooth(dat, n) + + Where dat is an Nchan x Ntime data matrix, and n is the length + of the boxcar smoothing kernel + + If the data contains NaNs, these are ignored for the computation, but + retained in the output. + + See also PREPROC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_smooth.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_smooth", *args, **kwargs) diff --git a/fieldtrip/__preproc/ft_preproc_standardize.py b/fieldtrip/__preproc/ft_preproc_standardize.py new file mode 100644 index 0000000..a497699 --- /dev/null +++ b/fieldtrip/__preproc/ft_preproc_standardize.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def ft_preproc_standardize(*args, **kwargs): + """ + FT_PREPROC_STANDARDIZE performs a z-transformation or standardization + of the data. The standardized data will have a zero-mean and a unit + standard deviation. + + Use as + [dat] = ft_preproc_standardize(dat, begsample, endsample) + where + dat data matrix (Nchans x Ntime) + begsample index of the begin sample for the mean and stdev estimate + endsample index of the end sample for the mean and stdev estimate + + If no begin and end sample are specified, it will be estimated on the + complete data. + + If the data contains NaNs, these are ignored for the computation, but + retained in the output. + + See also PREPROC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/preproc/ft_preproc_standardize.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_standardize", *args, **kwargs) diff --git a/fieldtrip/__qsub/__init__.py b/fieldtrip/__qsub/__init__.py new file mode 100644 index 0000000..1822f66 --- /dev/null +++ b/fieldtrip/__qsub/__init__.py @@ -0,0 +1,9 @@ +from .qsubcellfun import qsubcellfun +from .qsubcompile import qsubcompile +from .qsubexec import qsubexec +from .qsubfeval import qsubfeval +from .qsubget import qsubget +from .qsublist import qsublist + + +__all__ = ["qsubcellfun", "qsubcompile", "qsubexec", "qsubfeval", "qsubget", "qsublist"] diff --git a/fieldtrip/__qsub/_defaultbackend.py b/fieldtrip/__qsub/_defaultbackend.py new file mode 100644 index 0000000..48c7083 --- /dev/null +++ b/fieldtrip/__qsub/_defaultbackend.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _defaultbackend(*args, **kwargs): + """ + DEFAULTBACKEND returns a string with the computational backend + to be used by default. It is determined by looking at various + environment variables or can be specified by the user. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/defaultbackend.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("defaultbackend", *args, **kwargs) diff --git a/fieldtrip/__qsub/_fexec.py b/fieldtrip/__qsub/_fexec.py new file mode 100644 index 0000000..f949f92 --- /dev/null +++ b/fieldtrip/__qsub/_fexec.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _fexec(*args, **kwargs): + """ + FEXEC is the low-level function that executes the job on the engine or + worker. It also tries to change the path and pwd to those on the controller + and it catches and deals with any errors in the code that is executed. + + This function should not be called directly. + + See also PEEREXEC, QSUBEXEC, ENGEXEC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/fexec.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fexec", *args, **kwargs) diff --git a/fieldtrip/__qsub/_fixname.py b/fieldtrip/__qsub/_fixname.py new file mode 100644 index 0000000..cfca7ba --- /dev/null +++ b/fieldtrip/__qsub/_fixname.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _fixname(*args, **kwargs): + """ + FIXNAME changes all inappropriate characters in a string into '_' + so that it can be used as a filename or as a field name in a structure. + If the string begins with a digit, an 'x' is prepended. + + Use as + str = fixname(str) + + MATLAB 2014a introduces the matlab.lang.makeValidName and + matlab.lang.makeUniqueStrings functions for constructing unique + identifiers, but this particular implementation also works with + older MATLAB versions. + + See also DEBLANK, STRIP, PAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/fixname.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixname", *args, **kwargs) diff --git a/fieldtrip/__qsub/_ft_checkopt.py b/fieldtrip/__qsub/_ft_checkopt.py new file mode 100644 index 0000000..b21999c --- /dev/null +++ b/fieldtrip/__qsub/_ft_checkopt.py @@ -0,0 +1,76 @@ +from fieldtrip._runtime import Runtime + + +def _ft_checkopt(*args, **kwargs): + """ + FT_CHECKOPT does a validity test on the types and values of a configuration + structure or cell-array with key-value pairs. + + Use as + opt = ft_checkopt(opt, key) + opt = ft_checkopt(opt, key, allowedtype) + opt = ft_checkopt(opt, key, allowedtype, allowedval) + + For allowedtype you can specify a string or a cell-array with multiple + strings. All the default MATLAB types can be specified, such as + 'double' + 'logical' + 'char' + 'single' + 'float' + 'int16' + 'cell' + 'struct' + 'function_handle' + + Furthermore, the following custom types can be specified + 'empty' + 'doublescalar' + 'doublevector' + 'doublebivector' i.e. [1 1] or [1 2] + 'ascendingdoublevector' i.e. [1 2 3 4 5], but not [1 3 2 4 5] + 'ascendingdoublebivector' i.e. [1 2], but not [2 1] + 'doublematrix' + 'numericscalar' + 'numericvector' + 'numericmatrix' + 'charcell' + + For allowedval you can specify a single value or a cell-array + with multiple values. + + This function will give an error or it returns the input configuration + structure or cell-array without modifications. A match on any of the + allowed types and any of the allowed values is sufficient to let this + function pass. + + See also FT_GETOPT, FT_SETOPT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/ft_checkopt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_checkopt", *args, **kwargs) diff --git a/fieldtrip/__qsub/_ft_getopt.py b/fieldtrip/__qsub/_ft_getopt.py new file mode 100644 index 0000000..1510b74 --- /dev/null +++ b/fieldtrip/__qsub/_ft_getopt.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def _ft_getopt(*args, **kwargs): + """ + FT_GETOPT gets the value of a specified option from a configuration structure + or from a cell-array with key-value pairs. + + Use as + val = ft_getopt(s, key, default, emptymeaningful) + where the input values are + s = structure or cell-array + key = string + default = any valid MATLAB data type (optional, default = []) + emptymeaningful = boolean value (optional, default = false) + + If the key is present as field in the structure, or as key-value pair in the + cell-array, the corresponding value will be returned. + + If the key is not present, ft_getopt will return the default, or an empty array + when no default was specified. + + If the key is present but has an empty value, then the emptymeaningful flag + specifies whether the empty value or the default value should be returned. + If emptymeaningful==true, then the empty array will be returned. + If emptymeaningful==false, then the specified default will be returned. + + See also FT_SETOPT, FT_CHECKOPT, INPUTPARSER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/ft_getopt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_getopt", *args, **kwargs) diff --git a/fieldtrip/__qsub/_ft_platform_supports.py b/fieldtrip/__qsub/_ft_platform_supports.py new file mode 100644 index 0000000..b4590d1 --- /dev/null +++ b/fieldtrip/__qsub/_ft_platform_supports.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def _ft_platform_supports(*args, **kwargs): + """ + FT_PLATFORM_SUPPORTS returns a boolean indicating whether the current platform + supports a specific capability + + Use as + status = ft_platform_supports(what) + or + status = ft_platform_supports('matlabversion', min_version, max_version) + + The following values are allowed for the 'what' parameter, which means means that + the specific feature explained on the right is supported: + + 'which-all' which(...,'all') + 'exists-in-private-directory' exists(...) will look in the /private subdirectory to see if a file exists + 'onCleanup' onCleanup(...) + 'alim' alim(...) + 'int32_logical_operations' bitand(a,b) with a, b of type int32 + 'graphics_objects' graphics system is object-oriented + 'libmx_c_interface' libmx is supported through mex in the C-language (recent MATLAB versions only support C++) + 'images' all image processing functions in FieldTrip's external/images directory + 'signal' all signal processing functions in FieldTrip's external/signal directory + 'stats' all statistical functions in FieldTrip's external/stats directory + 'program_invocation_name' program_invocation_name() (GNU Octave) + 'singleCompThread' start MATLAB with -singleCompThread + 'nosplash' start MATLAB with -nosplash + 'nodisplay' start MATLAB with -nodisplay + 'nojvm' start MATLAB with -nojvm + 'no-gui' start GNU Octave with --no-gui + 'RandStream.setGlobalStream' RandStream.setGlobalStream(...) + 'RandStream.setDefaultStream' RandStream.setDefaultStream(...) + 'rng' rng(...) + 'rand-state' rand('state') + 'urlread-timeout' urlread(..., 'Timeout', t) + 'griddata-vector-input' griddata(...,...,...,a,b) with a and b vectors + 'griddata-v4' griddata(...,...,...,...,...,'v4') with v4 interpolation support + 'uimenu' uimenu(...) + 'weboptions' weboptions(...) + 'parula' parula(...) + 'datetime' datetime structure + 'html' html rendering in desktop + + See also FT_VERSION, VERSION, VER, VERLESSTHAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/ft_platform_supports.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_platform_supports", *args, **kwargs) diff --git a/fieldtrip/__qsub/_generatebatchid.py b/fieldtrip/__qsub/_generatebatchid.py new file mode 100644 index 0000000..664ba69 --- /dev/null +++ b/fieldtrip/__qsub/_generatebatchid.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _generatebatchid(*args, **kwargs): + """ + GENERATEBATCHID generates a unique string that can be used as batch identifier. + + See also GENERATEJOBID, GENERATESESSIONID + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/generatebatchid.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("generatebatchid", *args, **kwargs) diff --git a/fieldtrip/__qsub/_generatejobid.py b/fieldtrip/__qsub/_generatejobid.py new file mode 100644 index 0000000..0827baa --- /dev/null +++ b/fieldtrip/__qsub/_generatejobid.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def _generatejobid(*args, **kwargs): + """ + GENERATEJOBID generates a unique identifier for a job to be submitted to the + batch queueing system. It maintains an internal counter to allow it to be + called from multiple qsubfeval instances without the user having to keep + track of the numbers. + + Use as + jobid = generatejobid(batch) + batchid = generatebatchid(batch) + sessionid = generatesessionid() + + The result is a string like + user_host_pid_bM_jN % as jobid + user_host_pid_bM % as batchid + user_host_pid % as sessionid + where M is the batch number and N the sequential job number (per batch). + + Besides specifying a batch number, it is also possible to specify the full + batch name as string. This allows the user to override the default + user_host_pid_bM part of the jobid. This works like + jobid = generatejobid(batch, batchid) + where for example generatejobid(1, 'freqanalysis') returns the sequence + of strings 'freqanalysis_j001', 'freqanalysis_j002', ... + + See also GENERATEBATCHID, GENERATESESSIONID + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/generatejobid.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("generatejobid", *args, **kwargs) diff --git a/fieldtrip/__qsub/_generatesessionid.py b/fieldtrip/__qsub/_generatesessionid.py new file mode 100644 index 0000000..819cde3 --- /dev/null +++ b/fieldtrip/__qsub/_generatesessionid.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _generatesessionid(*args, **kwargs): + """ + GENERATESESSIONID + + See also GENERATEJOBID, GENERATEBATCHID + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/generatesessionid.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("generatesessionid", *args, **kwargs) diff --git a/fieldtrip/__qsub/_getbatch.py b/fieldtrip/__qsub/_getbatch.py new file mode 100644 index 0000000..e296cd6 --- /dev/null +++ b/fieldtrip/__qsub/_getbatch.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _getbatch(*args, **kwargs): + """ + GETBATCH returns a number that can be used to distinguish the subsequent + batches. The number automatically increases over subsequent calls. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/getbatch.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getbatch", *args, **kwargs) diff --git a/fieldtrip/__qsub/_getcustompath.py b/fieldtrip/__qsub/_getcustompath.py new file mode 100644 index 0000000..b72dec6 --- /dev/null +++ b/fieldtrip/__qsub/_getcustompath.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _getcustompath(*args, **kwargs): + """ + GETCUSTOMPATH returns the directories on the MATLAB path besides those of + the standard MATLAB toolboxes. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/getcustompath.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getcustompath", *args, **kwargs) diff --git a/fieldtrip/__qsub/_getcustompwd.py b/fieldtrip/__qsub/_getcustompwd.py new file mode 100644 index 0000000..a4cb67a --- /dev/null +++ b/fieldtrip/__qsub/_getcustompwd.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _getcustompwd(*args, **kwargs): + """ + GETCUSTOMPWD determines the present working directory, ensuring that + it is not the private directory of the distributed computing toolbox. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/getcustompwd.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getcustompwd", *args, **kwargs) diff --git a/fieldtrip/__qsub/_getglobal.py b/fieldtrip/__qsub/_getglobal.py new file mode 100644 index 0000000..a73d169 --- /dev/null +++ b/fieldtrip/__qsub/_getglobal.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _getglobal(*args, **kwargs): + """ + GETGLOBAL gets all global variables and puts them in a structure + + Use as + var = getglobal; + setglobal(var); + + See also SETGLOBAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/getglobal.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getglobal", *args, **kwargs) diff --git a/fieldtrip/__qsub/_gethostname.py b/fieldtrip/__qsub/_gethostname.py new file mode 100644 index 0000000..cfe876b --- /dev/null +++ b/fieldtrip/__qsub/_gethostname.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _gethostname(*args, **kwargs): + """ + HOSTNAME returns the hostname of this computer + + Use as + str = hostname; + + See also GETUSERNAME, GETADDRESS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/gethostname.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("gethostname", *args, **kwargs) diff --git a/fieldtrip/__qsub/_getpid.py b/fieldtrip/__qsub/_getpid.py new file mode 100644 index 0000000..1dd86b1 --- /dev/null +++ b/fieldtrip/__qsub/_getpid.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _getpid(*args, **kwargs): + """ + GETPID returns the process identifier (PID) of the current Matlab + process. + + Use as + num = getpid; + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/getpid.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getpid", *args, **kwargs) diff --git a/fieldtrip/__qsub/_getsubfield.py b/fieldtrip/__qsub/_getsubfield.py new file mode 100644 index 0000000..69b37b5 --- /dev/null +++ b/fieldtrip/__qsub/_getsubfield.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _getsubfield(*args, **kwargs): + """ + GETSUBFIELD returns a field from a structure just like the standard + GETFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = getsubfield(s, 'fieldname') + or as + f = getsubfield(s, 'fieldname.subfieldname') + + See also GETFIELD, ISSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/getsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getsubfield", *args, **kwargs) diff --git a/fieldtrip/__qsub/_getusername.py b/fieldtrip/__qsub/_getusername.py new file mode 100644 index 0000000..965d1f7 --- /dev/null +++ b/fieldtrip/__qsub/_getusername.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _getusername(*args, **kwargs): + """ + GETUSERNAME + + Use as + str = getusername(); + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/getusername.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getusername", *args, **kwargs) diff --git a/fieldtrip/__qsub/_issubfield.py b/fieldtrip/__qsub/_issubfield.py new file mode 100644 index 0000000..a9420b2 --- /dev/null +++ b/fieldtrip/__qsub/_issubfield.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _issubfield(*args, **kwargs): + """ + ISSUBFIELD tests for the presence of a field in a structure just like the standard + Matlab ISFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = issubfield(s, 'fieldname') + or as + f = issubfield(s, 'fieldname.subfieldname') + + This function returns true if the field is present and false if the field + is not present. + + See also ISFIELD, GETSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/issubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("issubfield", *args, **kwargs) diff --git a/fieldtrip/__qsub/_istrue.py b/fieldtrip/__qsub/_istrue.py new file mode 100644 index 0000000..51ef264 --- /dev/null +++ b/fieldtrip/__qsub/_istrue.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _istrue(*args, **kwargs): + """ + ISTRUE converts an input argument like "yes/no", "true/false" or "on/off" into a + boolean. If the input is boolean, then it will remain like that. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/istrue.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("istrue", *args, **kwargs) diff --git a/fieldtrip/__qsub/_memprofile.py b/fieldtrip/__qsub/_memprofile.py new file mode 100644 index 0000000..856dcf2 --- /dev/null +++ b/fieldtrip/__qsub/_memprofile.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _memprofile(*args, **kwargs): + """ + MEMPROFILE this is a dummy placeholder + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/memprofile.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("memprofile", *args, **kwargs) diff --git a/fieldtrip/__qsub/_pausejava.py b/fieldtrip/__qsub/_pausejava.py new file mode 100644 index 0000000..4f2c652 --- /dev/null +++ b/fieldtrip/__qsub/_pausejava.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _pausejava(*args, **kwargs): + """ + PAUSEJAVA uses the Java Virtual Machine to pause for a specified amount of time. + If the JVM is not running, it defaults to the builtin MATLAB pause. + + Use as + pause(seconds) + + The builtin MATLAB pause function has a known memory leak in R2011b and R2012a. + Whenever pause is called, the graphics event queue (EDT) is flushed, thereby + updating all Matlab figure windows. + + http://undocumentedmatlab.com/blog/pause-for-the-better/ + http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=1997 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/pausejava.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("pausejava", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__qsub/_print_mem.py b/fieldtrip/__qsub/_print_mem.py new file mode 100644 index 0000000..f2af838 --- /dev/null +++ b/fieldtrip/__qsub/_print_mem.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _print_mem(*args, **kwargs): + """ + PRINT_MEM helper function for pretty-printing memory in GB, MB, ... + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/print_mem.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("print_mem", *args, **kwargs) diff --git a/fieldtrip/__qsub/_print_tim.py b/fieldtrip/__qsub/_print_tim.py new file mode 100644 index 0000000..ae6d7ea --- /dev/null +++ b/fieldtrip/__qsub/_print_tim.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _print_tim(*args, **kwargs): + """ + SUBFUNCTION for pretty-printing time in hours, minutes, ... + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/print_tim.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("print_tim", *args, **kwargs) diff --git a/fieldtrip/__qsub/_rename.py b/fieldtrip/__qsub/_rename.py new file mode 100644 index 0000000..b93d224 --- /dev/null +++ b/fieldtrip/__qsub/_rename.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _rename(*args, **kwargs): + """ + RENAME is an overloaded version of the MATLAB rename function. + This version is faster than the original. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/rename.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rename", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__qsub/_rmsubfield.py b/fieldtrip/__qsub/_rmsubfield.py new file mode 100644 index 0000000..e0e4f62 --- /dev/null +++ b/fieldtrip/__qsub/_rmsubfield.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _rmsubfield(*args, **kwargs): + """ + RMSUBFIELD removes the contents of the specified field from a structure + just like the standard Matlab RMFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = rmsubfield(s, 'fieldname') + or as + s = rmsubfield(s, 'fieldname.subfieldname') + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/rmsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rmsubfield", *args, **kwargs) diff --git a/fieldtrip/__qsub/_setcustompath.py b/fieldtrip/__qsub/_setcustompath.py new file mode 100644 index 0000000..af2caa9 --- /dev/null +++ b/fieldtrip/__qsub/_setcustompath.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _setcustompath(*args, **kwargs): + """ + SETCUSTOMPATH is a helper function that updates the path to contain all the + custom directories, while keeping the peer or qsub path untouched. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/setcustompath.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("setcustompath", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__qsub/_setcustompwd.py b/fieldtrip/__qsub/_setcustompwd.py new file mode 100644 index 0000000..5da2614 --- /dev/null +++ b/fieldtrip/__qsub/_setcustompwd.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _setcustompwd(*args, **kwargs): + """ + SETCUSTOMPWD is a helper function that updates the present working directory. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/setcustompwd.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("setcustompwd", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__qsub/_setglobal.py b/fieldtrip/__qsub/_setglobal.py new file mode 100644 index 0000000..23df0a8 --- /dev/null +++ b/fieldtrip/__qsub/_setglobal.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _setglobal(*args, **kwargs): + """ + SETGLOBAL assigns global variables from a structure + + Use as + var = getglobal; + setglobal(var); + + See also GETGLOBAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/setglobal.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("setglobal", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__qsub/_setsubfield.py b/fieldtrip/__qsub/_setsubfield.py new file mode 100644 index 0000000..ffe2841 --- /dev/null +++ b/fieldtrip/__qsub/_setsubfield.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _setsubfield(*args, **kwargs): + """ + SETSUBFIELD sets the contents of the specified field to a specified value + just like the standard Matlab SETFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = setsubfield(s, 'fieldname', value) + or as + s = setsubfield(s, 'fieldname.subfieldname', value) + + where nested is a logical, false denoting that setsubfield will create + s.subfieldname instead of s.fieldname.subfieldname + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/setsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("setsubfield", *args, **kwargs) diff --git a/fieldtrip/__qsub/_tokenize.py b/fieldtrip/__qsub/_tokenize.py new file mode 100644 index 0000000..5ae286c --- /dev/null +++ b/fieldtrip/__qsub/_tokenize.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _tokenize(*args, **kwargs): + """ + TOKENIZE cuts a string into pieces, returning the pieces in a cell-array + + Use as + t = tokenize(str) + t = tokenize(str, sep) + t = tokenize(str, sep, rep) + where + str = the string that you want to cut into pieces + sep = the separator at which to cut (default is whitespace) + rep = whether to treat repeating separator characters as one (default is false) + + With the optional boolean flag "rep" you can specify whether repeated + separator characters should be squeezed together (e.g. multiple + spaces between two words). The default is rep=1, i.e. repeated + separators are treated as one. + + See also STRSPLIT, SPLIT, STRTOK, TEXTSCAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/tokenize.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("tokenize", *args, **kwargs) diff --git a/fieldtrip/__qsub/_watchdog.py b/fieldtrip/__qsub/_watchdog.py new file mode 100644 index 0000000..21a8f93 --- /dev/null +++ b/fieldtrip/__qsub/_watchdog.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _watchdog(*args, **kwargs): + """ + WATCHDOG will trigger an exit() if the controller disappears or if the allowed time elapsed + + To enable the watchdog you should do + watchdog(controllerid, time) + and to disable it again + clear watchdog + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/private/watchdog.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("watchdog", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__qsub/qsubcellfun.py b/fieldtrip/__qsub/qsubcellfun.py new file mode 100644 index 0000000..a3441cd --- /dev/null +++ b/fieldtrip/__qsub/qsubcellfun.py @@ -0,0 +1,105 @@ +from fieldtrip._runtime import Runtime + + +def qsubcellfun(*args, **kwargs): + """ + QSUBCELLFUN applies a function to each element of a cell-array. The + function execution is done in parallel using the Torque, SGE, PBS or + SLURM batch queue system. + + Use as + argout = qsubcellfun(fname, x1, x2, ...) + + This function has a number of optional arguments that have to passed + as key-value pairs at the end of the list of input arguments. All other + input arguments (including other key-value pairs) will be passed to the + function to be evaluated. + UniformOutput = boolean (default = false) + StopOnError = boolean (default = true) + diary = string, can be 'always', 'never', 'warning', 'error' (default = 'error') + timreq = number, the time in seconds required to run a single job + timoverhead = number in seconds, how much time to allow MATLAB to start (default = 180 seconds) + memreq = number, the memory in bytes required to run a single job + memoverhead = number in bytes, how much memory to account for MATLAB itself (default depends on the MATLAB version) + stack = number, stack multiple jobs in a single qsub job (default = 'auto') + backend = string, can be 'torque', 'sge', 'slurm', 'lsf', 'system', 'local' (default is automatic) + batchid = string, to identify the jobs in the queue (default is user_host_pid_batch) + compile = string, can be 'auto', 'yes', 'no' (default = 'no') + queue = string, which queue to submit the job in (default is empty) + options = string, additional options that will be passed to qsub/srun (default is empty) + matlabcmd = string, the Linux command line to start MATLAB on the compute nodes (default is automatic + display = 'yes' or 'no', whether the nodisplay option should be passed to MATLAB (default = 'no', meaning nodisplay) + jvm = 'yes' or 'no', whether the nojvm option should be passed to MATLAB (default = 'yes', meaning with jvm) + rerunable = 'yes' or 'no', whether the job can be restarted on a torque/maui/moab cluster (default = 'no') + sleep = number, time in seconds to wait between checks for job completion (default = 0.5 s) + + It is required to give an estimate of the time and memory requirements of + the individual jobs. The memory requirement of the MATLAB executable + itself will automatically be added, just as the time required to start + up a new MATLAB process. If you don't know what the memory and time + requirements of your job are, you can get an estimate for them using + TIC/TOC and MEMTIC/MEMTOC around a single execution of one of the jobs in + your interactive MATLAB session. You can also start with very large + estimates, e.g. 4*1024^3 bytes for the memory (which is 4GB) and 28800 + seconds for the time (which is 8 hours) and then run a single job through + qsubcellfun. When the job returns, it will print the memory and time it + required. + + Example + fname = 'power'; + x1 = {1, 2, 3, 4, 5}; + x2 = {2, 2, 2, 2, 2}; + y = qsubcellfun(fname, x1, x2, 'memreq', 1024^3, 'timreq', 300); + + Using the compile=yes or compile=auto option, you can compile your + function into a stand-alone executable that can be executed on the cluster + without requiring additional MATLAB licenses. You can also call the + QSUBCOMPILE function prior to calling QSUBCELLFUN. If you plan multiple + batches of the same function, compiling it prior to QSUBCELLFUN is more + efficient. In that case you will have to delete the compiled executable + yourself once you are done. + + In case you abort your call to qsubcellfun by pressing ctrl-c, + the already submitted jobs will be canceled. Some small temporary + files might remain in your working directory. + + To check the the status and healthy execution of the jobs on the Torque + batch queuing system, you can use + qstat + qstat -an1 + qstat -Q + comands on the linux command line. To delete jobs from the Torque batch + queue and to abort already running jobs, you can use + qdel + qdel all + + See also QSUBCOMPILE, QSUBFEVAL, CELLFUN, PEERCELLFUN, FEVAL, BATCH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/qsubcellfun.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("qsubcellfun", *args, **kwargs) diff --git a/fieldtrip/__qsub/qsubcompile.py b/fieldtrip/__qsub/qsubcompile.py new file mode 100644 index 0000000..6560827 --- /dev/null +++ b/fieldtrip/__qsub/qsubcompile.py @@ -0,0 +1,91 @@ +from fieldtrip._runtime import Runtime + + +def qsubcompile(*args, **kwargs): + """ + QSUBCOMPILE compiles your function into an standalone executable that can easily + be distributed on a cluster by QSUBCELLFUN. Running a compiled version of your + function does not take any additional MATLAB licenses. Note that it does require + that the corresponding MATLAB run-time environment (MCR) is installed on your + cluster. + + Use as + compiledfun = qsubcompile(fname) + argout = qsubcellfun(compiledfun, argin, ...) + or + compiledfun = qsubcompile(fname) + jobid = qsubfeval(compiledfun, argin, ...) + argout = qsubget(jobid) + + Optional input arguments should be specified in key-value pairs + and can include + batchid = string that is used for the compiled application filename + and to identify the jobs in the queue, the default is + automatically determined and looks like user_host_pid_batch. + toolbox = string or cell-array with strings, additional Mathworks + toolboxes to include (see below). + executable = string with the name of a previous compiled executable + to start, which usually takes the form "run_xxx.sh". This + implies that compilation does not have to be done. + numthreads = number of threads, can be 1 or inf (default = 1) + + When executing a single batch of jobs using QSUBCELLFUN, you can also + compile your function on the fly with the compile flag like this + argout = qsubcellfun(fname, argin, ..., 'compile', 'yes') + Using this syntax, the compiled function will be automatically cleaned + up immediately after execution. + + If you need to include additional functions that are not automatically + detected as dependencies by the MATLAB compiler, e.g. because using + constructs like feval(sprintf(...)), you can specify fname as a + cell-array. For example + compiledfun = qsubcompile({@ft_definetrial, @trialfun_custom}) + + If you need to include Mathworks toolboxes that are not automatically + detected as dependencies by the MATLAB compiler, you can specify them + like this + compiledfun = qsubcompile(fname, 'toolbox', {'signal', 'image', 'stats'}) + + A common problem for compilation is caused by the use of addpath in + your startup.m file. Please change your startup.m file into + if ~isdeployed + % here goes the original content of your startup file + % ... + end + + If you want to execute the same function multiple times with different input + arguments, you only have to compile it once. The name of the executable can be + specified as input parameter, and the specified function within the executable + can be re-execured. An example is specyfying the executable as run_fieldtrip.sh, + which is a compiled version of the complete FieldTrip toolbox. + + See also QSUBCELLFUN, QSUBFEVAL, MCC, ISDEPLOYED + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/qsubcompile.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("qsubcompile", *args, **kwargs) diff --git a/fieldtrip/__qsub/qsubexec.py b/fieldtrip/__qsub/qsubexec.py new file mode 100644 index 0000000..704a6c8 --- /dev/null +++ b/fieldtrip/__qsub/qsubexec.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def qsubexec(*args, **kwargs): + """ + QSUBEXEC is a helper function to execute a job on the Torque, SGE, PBS + or SLURM batch queue system. Normally you should not start this function + yourself, but rather use QSUBCELLFUN or QSUBFEVAL. + + This function performs the following tasks + - load the function name, input arguments and further options from the input file + - evaluate the desired function on the input arguments using PEEREXEC + - save the output arguments to an output file + + This function should be started from the linux command line as follows + qsub /opt/bin/matlab -r "qsubexec(jobid); exit" + which starts the MATLAB executable, executes this function and exits + MATLAB to leave your batch job in a clean state. The jobid is + automatically translated into the input and output file names, which + have to reside on a shared network file system. + + See also QSUBCELLFUN, QSUBFEVAL, QSUBGET + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/qsubexec.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("qsubexec", *args, **kwargs) diff --git a/fieldtrip/__qsub/qsubfeval.py b/fieldtrip/__qsub/qsubfeval.py new file mode 100644 index 0000000..779180d --- /dev/null +++ b/fieldtrip/__qsub/qsubfeval.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def qsubfeval(*args, **kwargs): + """ + QSUBFEVAL evaluates the specified MATLAB function on the input arguments + using the Torque, SGE, PBS or SLURM batch queue system. + + Use as + jobid = qsubfeval(fname, arg1, arg2, ...) + argout = qsubget(jobid, ...) + + This function has a number of optional arguments that have to passed + as key-value pairs at the end of the list of input arguments. All other + input arguments (including other key-value pairs) will be passed to the + function to be evaluated. + memreq = number in bytes, how much memory does the job require (no default) + memoverhead = number in bytes, how much memory to account for MATLAB itself (default depends on the MATLAB version) + timreq = number in seconds, how much time does the job require (no default) + timoverhead = number in seconds, how much time to allow MATLAB to start (default = 180 seconds) + backend = string, can be 'torque', 'sge', 'slurm', 'lsf', 'system', 'local' (default is automatic) + diary = string, can be 'always', 'never', 'warning', 'error' (default = 'error') + queue = string, which queue to submit the job in (default is empty) + waitfor = string or cell-array of strings, jobids of jobs to wait on finishing + before executing the current job (default is empty) + options = string, additional options that will be passed to qsub/srun (default is empty) + batch = number, of the bach to which the job belongs. When called by QSUBCELLFUN + it will be a number that is automatically incremented over subsequent calls. + batchid = string that is used for the compiled application filename and to identify + the jobs in the queue, the default is automatically determined and looks + like user_host_pid_batch. + matlabcmd = string, the Linux command line to start MATLAB on the compute nodes (default is automatic + display = 'yes' or 'no', whether the nodisplay option should be passed to MATLAB (default = 'no', meaning nodisplay) + jvm = 'yes' or 'no', whether the nojvm option should be passed to MATLAB (default = 'yes', meaning with jvm) + rerunable = 'yes' or 'no', whether the job can be restarted on a torque/maui/moab cluster (default = 'no') + + See also QSUBCELLFUN, QSUBGET, FEVAL, BATCH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/qsubfeval.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("qsubfeval", *args, **kwargs) diff --git a/fieldtrip/__qsub/qsubget.py b/fieldtrip/__qsub/qsubget.py new file mode 100644 index 0000000..64d8a4d --- /dev/null +++ b/fieldtrip/__qsub/qsubget.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def qsubget(*args, **kwargs): + """ + QSUBGET get the output arguments after the remote job has been executed + on the Torque, SGE, PBS or SLURM batch queue system. + + Use as + jobid = qsubfeval(fname, arg1, arg2, ...) + argout = qsubget(jobid, ...) + + Optional arguments can be specified in key-value pairs and can include + StopOnError = boolean (default = true) + timeout = number, in seconds (default = 0; return immediately if output cannot be gotten) + sleep = number, in seconds (default = 0.01) + output = string, 'varargout' or 'cell' (default = 'varargout') + diary = string, can be 'always', 'warning', 'error' (default = 'error') + + See also QSUBFEVAL, QSUBCELLFUN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/qsubget.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("qsubget", *args, **kwargs) diff --git a/fieldtrip/__qsub/qsublist.py b/fieldtrip/__qsub/qsublist.py new file mode 100644 index 0000000..809acef --- /dev/null +++ b/fieldtrip/__qsub/qsublist.py @@ -0,0 +1,65 @@ +from fieldtrip._runtime import Runtime + + +def qsublist(*args, **kwargs): + """ + QSUBLIST is a helper function that is used to keep track of all the jobs in a + submitted batch. specifically, it is used to maintain the mapping between the + job identifier in the batch queueing system and MATLAB. + + Use as + qsublist('list') + qsublist('killall') + qsublist('kill', jobid) + qsublist('getjobid', pbsid) + qsublist('getpbsid', jobid) + + The jobid is the identifier that is used within MATLAB for the file names, + for example 'roboos_mentat242_p4376_b2_j453'. + + The pbsid is the identifier that is used within the batch queueing system, + for example '15260.torque'. + + The following commands can be used by the end-user. + 'list' display all jobs + 'kill' kill a specific job, based on the jobid + 'killall' kill all jobs + 'getjobid' return the mathing jobid, given the pbsid + 'getpbsid' return the mathing pbsid, given the jobid + + The following low-level commands are used by QSUBFEVAL and QSUBGET for job + maintenance and monitoring. + 'add' + 'del' + 'completed' + + See also QSUBCELLFUN, QSUBFEVAL, QSUBGET + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/qsub/qsublist.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("qsublist", *args, **kwargs) diff --git a/fieldtrip/__realtime/__example/__init__.py b/fieldtrip/__realtime/__example/__init__.py new file mode 100644 index 0000000..21d4f9d --- /dev/null +++ b/fieldtrip/__realtime/__example/__init__.py @@ -0,0 +1,60 @@ +from .bcifun_latidx import bcifun_latidx +from .ft_realtime_asaproxy import ft_realtime_asaproxy +from .ft_realtime_asynchronous import ft_realtime_asynchronous +from .ft_realtime_average import ft_realtime_average +from .ft_realtime_benchmark import ft_realtime_benchmark +from .ft_realtime_brainampproxy import ft_realtime_brainampproxy +from .ft_realtime_classification import ft_realtime_classification +from .ft_realtime_ctfproxy import ft_realtime_ctfproxy +from .ft_realtime_dicomproxy import ft_realtime_dicomproxy +from .ft_realtime_downsample import ft_realtime_downsample +from .ft_realtime_fileproxy import ft_realtime_fileproxy +from .ft_realtime_fmriproxy import ft_realtime_fmriproxy +from .ft_realtime_fmriviewer import ft_realtime_fmriviewer +from .ft_realtime_heartbeatdetect import ft_realtime_heartbeatdetect +from .ft_realtime_jaga16proxy import ft_realtime_jaga16proxy +from .ft_realtime_modeegproxy import ft_realtime_modeegproxy +from .ft_realtime_neuralynxproxy import ft_realtime_neuralynxproxy +from .ft_realtime_packettimer import ft_realtime_packettimer +from .ft_realtime_pooraudioproxy import ft_realtime_pooraudioproxy +from .ft_realtime_powerestimate import ft_realtime_powerestimate +from .ft_realtime_selectiveaverage import ft_realtime_selectiveaverage +from .ft_realtime_sensysproxy import ft_realtime_sensysproxy +from .ft_realtime_signalproxy import ft_realtime_signalproxy +from .ft_realtime_signalrecorder import ft_realtime_signalrecorder +from .ft_realtime_signalviewer import ft_realtime_signalviewer +from .ft_realtime_synchronous import ft_realtime_synchronous +from .ft_realtime_topography import ft_realtime_topography +from .ft_realtime_unicornproxy import ft_realtime_unicornproxy + + +__all__ = [ + "bcifun_latidx", + "ft_realtime_asaproxy", + "ft_realtime_asynchronous", + "ft_realtime_average", + "ft_realtime_benchmark", + "ft_realtime_brainampproxy", + "ft_realtime_classification", + "ft_realtime_ctfproxy", + "ft_realtime_dicomproxy", + "ft_realtime_downsample", + "ft_realtime_fileproxy", + "ft_realtime_fmriproxy", + "ft_realtime_fmriviewer", + "ft_realtime_heartbeatdetect", + "ft_realtime_jaga16proxy", + "ft_realtime_modeegproxy", + "ft_realtime_neuralynxproxy", + "ft_realtime_packettimer", + "ft_realtime_pooraudioproxy", + "ft_realtime_powerestimate", + "ft_realtime_selectiveaverage", + "ft_realtime_sensysproxy", + "ft_realtime_signalproxy", + "ft_realtime_signalrecorder", + "ft_realtime_signalviewer", + "ft_realtime_synchronous", + "ft_realtime_topography", + "ft_realtime_unicornproxy", +] diff --git a/fieldtrip/__realtime/__example/_decode_modeeg.py b/fieldtrip/__realtime/__example/_decode_modeeg.py new file mode 100644 index 0000000..9b84e0b --- /dev/null +++ b/fieldtrip/__realtime/__example/_decode_modeeg.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _decode_modeeg(*args, **kwargs): + """ + DECODE_MODEEG takes a piece of the Modular EEG (OpenEEG) data + stream from the serial port or bluetooth and decodes it. + + Use as + [dat, rem] = decode_modeeg(raw) + where + raw = vector with bytes that was read from the serial port + dat = 6xN matrix with EEG values + rem = vector with remaining bytes that were not decoded + + The remaining bytes should be added to the raw data upon the next + call. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/private/decode_modeeg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("decode_modeeg", *args, **kwargs) diff --git a/fieldtrip/__realtime/__example/_encode_nifti1.py b/fieldtrip/__realtime/__example/_encode_nifti1.py new file mode 100644 index 0000000..d52e05b --- /dev/null +++ b/fieldtrip/__realtime/__example/_encode_nifti1.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _encode_nifti1(*args, **kwargs): + """ + function blob = encode_nifti1(H) + + Encodes a NIFTI-1 header (=> raw 348 bytes (uint8)) from a Matlab structure + that matches the C struct defined in nifti1.h. + + WARNING: This function currently ignores endianness !!! + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/private/encode_nifti1.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("encode_nifti1", *args, **kwargs) diff --git a/fieldtrip/__realtime/__example/_jaga16_packet.py b/fieldtrip/__realtime/__example/_jaga16_packet.py new file mode 100644 index 0000000..b2ae019 --- /dev/null +++ b/fieldtrip/__realtime/__example/_jaga16_packet.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _jaga16_packet(*args, **kwargs): + """ + JAGA16_PACKET converts the JAGA16 byte stream into packets + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/private/jaga16_packet.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("jaga16_packet", *args, **kwargs) diff --git a/fieldtrip/__realtime/__example/_tcpread.py b/fieldtrip/__realtime/__example/_tcpread.py new file mode 100644 index 0000000..3651c20 --- /dev/null +++ b/fieldtrip/__realtime/__example/_tcpread.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def _tcpread(*args, **kwargs): + """ + TCPREAD reads the available data from an open TCP socket, + concatenates it to an existing local buffer and subsequently formats + a small section of that buffer into a 'int16' or whatever data type. + This allows you to read-access a TCP port in small chuncks similar + as "fread" without loosing any bytes due to the TCP buffer itself + overrunning. + + Use as + dat = tcpread(sock, size, format) + where the socket is previously opened using pnet and format is + something like 'uint8', 'char', or 'double'. + + To read null-terminated strings of unknown length, you can use + dat = tcpread(sock, char(0), 'char') + + To clear the persistent buffer that is maintained inside this + function for subsequent calls, you should "clear tcpread". + + See also PNET + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/private/tcpread.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("tcpread", *args, **kwargs) diff --git a/fieldtrip/__realtime/__example/bcifun_latidx.py b/fieldtrip/__realtime/__example/bcifun_latidx.py new file mode 100644 index 0000000..7410df6 --- /dev/null +++ b/fieldtrip/__realtime/__example/bcifun_latidx.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def bcifun_latidx(*args, **kwargs): + """ + BCIFUN_LATIDX extracts alpha power, computes the alpha lateralization index + and sends a command to an external device + + This function computes the lateralization index log(A/B) for the + average alpha power in right channels A and the average alpha power + in left channels B. In a covert attention experiment we expect + higher values for attention to the right visual hemifield and lower + values for attention to the left visual hemifield. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/bcifun_latidx.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("bcifun_latidx", *args, **kwargs) diff --git a/fieldtrip/__realtime/__example/ft_realtime_asaproxy.py b/fieldtrip/__realtime/__example/ft_realtime_asaproxy.py new file mode 100644 index 0000000..36e37e7 --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_asaproxy.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_asaproxy(*args, **kwargs): + """ + FT_REALTIME_ASAPROXY reads continuous data from the ASA acquisition system and + writes it to a FieldTrip buffer. This function uses the NeuroSDK software, which + can be obtained from ANT. + + The FieldTrip buffer is a network transparent server that allows the acquisition + client to stream data to it. An analysis client can connect to read the data upon + request. Multiple clients can connect simultaneously, each analyzing a specific + aspect of the data concurrently. + + Use as + ft_realtime_asaproxy(cfg) + + The configuration should contain + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = 'all') + + The target to write the data to is configured as + cfg.target.datafile = string, target destination for the data (default = 'buffer://localhost:1972') + cfg.target.dataformat = string, default is determined automatic + + To stop this realtime function, you have to press Ctrl-C + + See also FT_REALTIME_SIGNALPROXY, FT_REALTIME_SIGNALVIEWER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_asaproxy.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_asaproxy", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_asynchronous.py b/fieldtrip/__realtime/__example/ft_realtime_asynchronous.py new file mode 100644 index 0000000..5b8b1b1 --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_asynchronous.py @@ -0,0 +1,90 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_asynchronous(*args, **kwargs): + """ + FT_REALTIME_ASYNCHRONOUS is an example realtime application for + asynchronous brain-computer interfaces + + Use as + + cmd = ft_realtime_asynchronous(cfg) + + where cmd is the last processed command and cfg has the following configuration options + cfg.bcifun = the BCI function that is called + cfg.blocksize = number, size of the blocks/chuncks that are processed in seconds (default = 1) + cfg.overlap = overlap between blocks in seconds (default = 0) + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = 'all') + cfg.bufferdata = whether to start on the 'first or 'last' data that is + available when the function _starts_ (default = 'last') + cfg.jumptoeof = whether to start on the 'first or 'last' data that is + available when the function _starts_ (default = 'last') + + The source of the data is configured as + cfg.dataset = string + or alternatively to obtain more low-level control as + cfg.datafile = string + cfg.headerfile = string + cfg.eventfile = string + cfg.dataformat = string, default is determined automatic + cfg.headerformat = string, default is determined automatic + cfg.eventformat = string, default is determined automatic + + cfg.ostream = the output stream that is used to send a command via + write_event (default = [] + + The bcifun must be of the form + + cmd = bcifun(cfg,data) + + where cfg is the configuration passed by this function and data is the + new data segment. Cmd is the command which is generated by the bcifun. + This command will be send to an external device via cfg.ostream. Check + bcifun_latidx for an example. + + Some notes about skipping data and catching up with the data stream: + + cfg.jumptoeof='yes' causes the realtime function to jump to the end + when the function _starts_. It causes all data acquired prior to + starting the RT function to be skipped. + + cfg.bufferdata=last causes the realtime function to jump to the last + available data while _running_. If the RT loop is not fast enough, + it causes some data to be dropped. + + If you want to skip all data that was acquired before you start the + RT function, but don't want to miss any data that was acquired while + the realtime function is started, then you should use jumptoeof=yes and + bufferdata=first. If you want to analyze data from a file, then you + should use jumptoeof=no and bufferdata=first. + + To stop the realtime function, you have to press Ctrl-C + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_asynchronous.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_asynchronous", *args, **kwargs) diff --git a/fieldtrip/__realtime/__example/ft_realtime_average.py b/fieldtrip/__realtime/__example/ft_realtime_average.py new file mode 100644 index 0000000..4e2508a --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_average.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_average(*args, **kwargs): + """ + FT_REALTIME_AVERAGE is an example realtime application for online + averaging of the data. It should work both for EEG and MEG. + + Use as + ft_realtime_average(cfg) + with the following configuration options + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = 'all') + cfg.trialfun = string with the trial function + + The source of the data is configured as + cfg.dataset = string + or alternatively to obtain more low-level control as + cfg.datafile = string + cfg.headerfile = string + cfg.eventfile = string + cfg.dataformat = string, default is determined automatic + cfg.headerformat = string, default is determined automatic + cfg.eventformat = string, default is determined automatic + + To stop the realtime function, you have to press Ctrl-C + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_average.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_average", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_benchmark.py b/fieldtrip/__realtime/__example/ft_realtime_benchmark.py new file mode 100644 index 0000000..aea6bdc --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_benchmark.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_benchmark(*args, **kwargs): + """ + FT_REALTIME_BENCHMARK times the reading and writing of data + + Use as + ft_realtime_benchmark(target) + where target is the location of the buffer or the file, for + example 'buffer://localhost:1972' + + Please note that any data in the target will be overwritten. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_benchmark.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_benchmark", *args, **kwargs) diff --git a/fieldtrip/__realtime/__example/ft_realtime_brainampproxy.py b/fieldtrip/__realtime/__example/ft_realtime_brainampproxy.py new file mode 100644 index 0000000..d8f34e2 --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_brainampproxy.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_brainampproxy(*args, **kwargs): + """ + FT_REALTIME_BRAINAMPPROXY reads continuous data from a BrainAmp EEG acquisition + system through the RDA network interface and writes it to a FieldTrip buffer. + + The FieldTrip buffer is a network transparent server that allows the acquisition + client to stream data to it. An analysis client can connect to read the data upon + request. Multiple clients can connect simultaneously, each analyzing a specific + aspect of the data concurrently. + + Use as + ft_realtime_brainampproxy(cfg) + + The configuration should contain + cfg.host = string, name of computer running the recorder software (default = 'eeg002') + cfg.port = number, TCP port to connect to (default = 51244) + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = 'all') + cfg.feedback = 'yes' or 'no' (default = 'no') + + The target to write the data to is configured as + cfg.target.datafile = string, target destination for the data (default = 'buffer://localhost:1972') + cfg.target.dataformat = string, default is determined automatic + cfg.target.eventfile = string, target destination for the events (default = 'buffer://localhost:1972') + cfg.target.eventformat = string, default is determined automatic + + To stop this realtime function, you have to press Ctrl-C + + See also FT_REALTIME_SIGNALPROXY, FT_REALTIME_SIGNALVIEWER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_brainampproxy.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_brainampproxy", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_classification.py b/fieldtrip/__realtime/__example/ft_realtime_classification.py new file mode 100644 index 0000000..ddb02ed --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_classification.py @@ -0,0 +1,70 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_classification(*args, **kwargs): + """ + FT_REALTIME_CLASSIFICATION is an example realtime application for online + classification of the data. It should work both for EEG and MEG. + + Use as + ft_realtime_classification(cfg) + with the following configuration options + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = 'all') + cfg.trialfun = string with the trial function + + The source of the data is configured as + cfg.dataset = string + or alternatively to obtain more low-level control as + cfg.datafile = string + cfg.headerfile = string + cfg.eventfile = string + cfg.dataformat = string, default is determined automatic + cfg.headerformat = string, default is determined automatic + cfg.eventformat = string, default is determined automatic + + This function works with two-class data that is timelocked to a trigger. + Data selection is based on events that should be present in the + datastream or datafile. The user should specify a trial function that + selects pieces of data to be classified, or pieces of data on which the + classifier has to be trained.The trialfun should return segments in a + trial definition (see FT_DEFINETRIAL). The 4th column of the trl matrix + should contain the class label (number 1 or 2). The 5th colum of the trl + matrix should contain a flag indicating whether it belongs to the test or + to the training set (0 or 1 respectively). + + Example usage: + cfg = []; + cfg.dataset = 'Subject01.ds'; + cfg.trialfun = 'trialfun_Subject01'; + ft_realtime_classification(cfg); + + To stop the realtime function, you have to press Ctrl-C + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_classification.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_classification", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_ctfproxy.py b/fieldtrip/__realtime/__example/ft_realtime_ctfproxy.py new file mode 100644 index 0000000..7f58719 --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_ctfproxy.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_ctfproxy(*args, **kwargs): + """ + FT_REALTIME_CTFPROXY provides a real-time interface to the MEG data stream. + This application requires Acq to stream the data to shared memory, and ctf2ft_v1 + (formerly known as AcqBuffer) to be maintaining the shared memory and to prevent + overruns. This MATLAB function will subsequently copy the data from shared + memory to a FieldTrip buffer. + + The FieldTrip buffer is a network transparent server that allows the acquisition + client to stream data to it. An analysis client can connect to read the data upon + request. Multiple clients can connect simultaneously, each analyzing a specific + aspect of the data concurrently. + + Since the CTF shared memory interface is only available on the acquisition machine + itself, this function must run on the acquisition machine. The buffer to which the + data is streamed is available through the network, so the actual analysis can be + done elsewhere. + + Use as + ft_realtime_ctfproxy(cfg) + + The target to write the data to is configured as + cfg.target.datafile = string, target destination for the data (default = 'buffer://localhost:1972') + cfg.target.dataformat = string, default is determined automatic + + To stop this realtime function, you have to press Ctrl-C + + See also FT_REALTIME_SIGNALPROXY, FT_REALTIME_SIGNALVIEWER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_ctfproxy.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_ctfproxy", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_dicomproxy.py b/fieldtrip/__realtime/__example/ft_realtime_dicomproxy.py new file mode 100644 index 0000000..a428f40 --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_dicomproxy.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_dicomproxy(*args, **kwargs): + """ + FT_REALTIME_DICOMPROXY simulates an fMRI acquisition system by reading a series of + DICOM files from disk, and streaming them to a FieldTrip buffer. + + Use as + ft_realtime_dicomproxy(cfg) + + The target to write the data to is configured as + cfg.target.datafile = string, target destination for the data (default = 'buffer://localhost:1972') + cfg.input = string or cell-array of strings (see below) + cfg.speedup = optional speedup parameter + + The input files can be specified as a cell-array of filenames, or as a single + string with a wildcard, e.g., '/myhome/scan*.ima' + + This function requires functions from SPM, so make sure you have set up your path correctly. + + See also FT_REALTIME_SIGNALPROXY, FT_REALTIME_SIGNALVIEWER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_dicomproxy.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_dicomproxy", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_downsample.py b/fieldtrip/__realtime/__example/ft_realtime_downsample.py new file mode 100644 index 0000000..aa0fdfe --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_downsample.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_downsample(*args, **kwargs): + """ + FT_REALTIME_DOWNSAMPLE reads realtime data from one buffer and writes it after downsampling + to another buffer. + + Use as + ft_realtime_downsample(cfg) + with the following configuration options + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = 'all') + cfg.decimation = integer, downsampling factor (default = 1, no downsampling) + cfg.order = interger, order of butterworth lowpass filter (default = 4) + cfg.cutoff = double, cutoff frequency of lowpass filter (default = 0.8*Nyquist-freq.) + + The source of the data is configured as + cfg.source.dataset = string + or alternatively to obtain more low-level control as + cfg.source.datafile = string + cfg.source.headerfile = string + cfg.source.eventfile = string + cfg.source.dataformat = string, default is determined automatic + cfg.source.headerformat = string, default is determined automatic + cfg.source.eventformat = string, default is determined automatic + + The target to write the data to is configured as + cfg.target.datafile = string, target destination for the data (default = 'buffer://localhost:1972') + cfg.target.dataformat = string, default is determined automatic + + To stop this realtime function, you have to press Ctrl-C + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_downsample.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_downsample", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_fileproxy.py b/fieldtrip/__realtime/__example/ft_realtime_fileproxy.py new file mode 100644 index 0000000..d091748 --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_fileproxy.py @@ -0,0 +1,69 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_fileproxy(*args, **kwargs): + """ + FT_REALTIME_FILEPROXY reads continuous data from an EEG/MEG file and writes it to a + FieldTrip buffer. This works for any file format that is supported by FieldTrip. + + The FieldTrip buffer is a network transparent server that allows the acquisition + client to stream data to it. An analysis client can connect to read the data upon + request. Multiple clients can connect simultaneously, each analyzing a specific + aspect of the data concurrently. + + Use as + ft_realtime_fileproxy(cfg) + with the following configuration options + cfg.minblocksize = number, in seconds (default = 0) + cfg.maxblocksize = number, in seconds (default = 1) + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = 'all') + cfg.jumptoeof = jump to end of file at initialization (default = 'no') + cfg.readevent = whether or not to copy events (default = 'no'; event type can also be specified; e.g., 'UPPT002') + cfg.speed = relative speed at which data is written (default = inf) + + The source of the data is configured as + cfg.source.dataset = string + or alternatively to obtain more low-level control as + cfg.source.datafile = string + cfg.source.headerfile = string + cfg.source.eventfile = string + cfg.source.dataformat = string, default is determined automatic + cfg.source.headerformat = string, default is determined automatic + cfg.source.eventformat = string, default is determined automatic + + The target to write the data to is configured as + cfg.target.datafile = string, target destination for the data (default = 'buffer://localhost:1972') + cfg.target.dataformat = string, default is determined automatic + + To stop this realtime function, you have to press Ctrl-C + + See also FT_REALTIME_SIGNALPROXY, FT_REALTIME_SIGNALVIEWER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_fileproxy.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_fileproxy", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_fmriproxy.py b/fieldtrip/__realtime/__example/ft_realtime_fmriproxy.py new file mode 100644 index 0000000..7faa7cb --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_fmriproxy.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_fmriproxy(*args, **kwargs): + """ + FT_REALTIME_FMRIPROXY simulates an fMRI acquisition system by writing volumes in a + cycle of about 2 seconds. The voxel data is written as a column vector with X*Y*Z + channels, where X and Y are the readout and phase-encoding resolution, and Z is the + number of slices. The voxel data consists of a ellipsoid (a bit like a head) with + added lateralized activation (20 scan cycle) and noise. + + This function also writes out events of type='scan' and value='pulse' when the + simulated scanner initiates a scan, and value='ready' when a hypothetical + processing pipeline is finished with that scan, just after writing out the volume + data itself. There is an artificial delay of 1.3*TR between the two events. + + Use as + ft_realtime_fmriproxy(cfg) + + The target to write the data to is configured as + cfg.target.datafile = string, target destination for the data (default = 'buffer://localhost:1972') + + You can also select a resolution of the simulated volumes (default = [64,64,20]) like + cfg.voxels = [64 64 32] + and the repetition time (TR, default = 0.08*number of slices) in seconds using + cfg.TR = 2.0 + + To stop this realtime function, you have to press Ctrl-C + + See also FT_REALTIME_SIGNALPROXY, FT_REALTIME_SIGNALVIEWER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_fmriproxy.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_fmriproxy", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_fmriviewer.py b/fieldtrip/__realtime/__example/ft_realtime_fmriviewer.py new file mode 100644 index 0000000..bfcd4f6 --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_fmriviewer.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_fmriviewer(*args, **kwargs): + """ + FT_REALTIME_FMRIVIEWER allows for realtime visualization of the fMRI data stream + + Use as + ft_realtime_fmriviewer(cfg) + with the following configuration options + cfg.bufferdata = whether to start on the 'first or 'last' data that is available (default = 'last') + + The source of the data is configured as + cfg.dataset = string + or alternatively to obtain more low-level control as + cfg.datafile = string + cfg.headerfile = string + cfg.eventfile = string + cfg.dataformat = string, default is determined automatic + cfg.headerformat = string, default is determined automatic + cfg.eventformat = string, default is determined automatic + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_fmriviewer.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_fmriviewer", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_heartbeatdetect.py b/fieldtrip/__realtime/__example/ft_realtime_heartbeatdetect.py new file mode 100644 index 0000000..3f81c2e --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_heartbeatdetect.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_heartbeatdetect(*args, **kwargs): + """ + FT_REALTIME_HEARTBEATDETECT is an example realtime application for online + detection of heart beats. It should work both for EEG and MEG. + + Use as + ft_realtime_heartbeatdetect(cfg) + with the following configuration options + cfg.blocksize = number, size of the blocks/chuncks that are processed (default = 1 second) + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = 'all') + cfg.jumptoeof = whether to skip to the end of the stream/file at startup (default = 'yes') + cfg.bufferdata = whether to start on the 'first or 'last' data that is available (default = 'first') + cfg.threshold = value, after normalization (default = 3) + + The source of the data is configured as + cfg.dataset = string + or alternatively to obtain more low-level control as + cfg.datafile = string + cfg.headerfile = string + cfg.eventfile = string + cfg.dataformat = string, default is determined automatic + cfg.headerformat = string, default is determined automatic + cfg.eventformat = string, default is determined automatic + + To stop the realtime function, you have to press Ctrl-C + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_heartbeatdetect.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_heartbeatdetect", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_jaga16proxy.py b/fieldtrip/__realtime/__example/ft_realtime_jaga16proxy.py new file mode 100644 index 0000000..fe858b0 --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_jaga16proxy.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_jaga16proxy(*args, **kwargs): + """ + FT_REALTIME_JAGA16PROXY reads continuous EEG data from a Jinga-Hi JAGA16 system + through the UDP network interface and writes it to a FieldTrip buffer. + + The FieldTrip buffer is a network transparent server that allows the acquisition + client to stream data to it. An analysis client can connect to read the data upon + request. Multiple clients can connect simultaneously, each analyzing a specific + aspect of the data concurrently. + + Use as + ft_realtime_jaga16proxy(cfg) + + The configuration should contain + cfg.port = number, UDP port to listen on (default = 55000) + cfg.channel = cell-array with channel names, see FT_CHANNELSELECTION + cfg.blocksize = number, in seconds (default = 0.5) + cfg.decimate = integer number (default = 1) + cfg.calibration = number, in uV per bit (default = 1) + cfg.feedback = 'yes' or 'no' (default = 'no') + + The target to write the data to is configured as + cfg.target.datafile = string, target destination for the data (default = 'buffer://localhost:1972') + cfg.target.dataformat = string, default is determined automatic + + To stop this realtime function, you have to press Ctrl-C + + See also FT_REALTIME_SIGNALPROXY, FT_REALTIME_SIGNALVIEWER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_jaga16proxy.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_jaga16proxy", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_modeegproxy.py b/fieldtrip/__realtime/__example/ft_realtime_modeegproxy.py new file mode 100644 index 0000000..1d62502 --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_modeegproxy.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_modeegproxy(*args, **kwargs): + """ + FT_REALTIME_MODEEGPROXY reads continuous data from a modeeg EEG acquisition system + through the serial port or through BlueTooth and writes it to a FieldTrip buffer. + + The FieldTrip buffer is a network transparent server that allows the acquisition + client to stream data to it. An analysis client can connect to read the data upon + request. Multiple clients can connect simultaneously, each analyzing a specific + aspect of the data concurrently. + + Use as + ft_realtime_modeegproxy(cfg) + + The configuration should contain + cfg.filename = string, name of the serial port (default = '/dev/tty.FireFly-B106-SPP') + cfg.feedback = 'yes' or 'no' (default = 'no') + cfg.blocksize = number, in seconds (default = 0.125) + + The target to write the data to is configured as + cfg.target.datafile = string, target destination for the data (default = 'buffer://localhost:1972') + cfg.target.dataformat = string, default is determined automatic + + To stop this realtime function, you have to press Ctrl-C + + See also FT_REALTIME_SIGNALPROXY, FT_REALTIME_SIGNALVIEWER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_modeegproxy.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_modeegproxy", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_neuralynxproxy.py b/fieldtrip/__realtime/__example/ft_realtime_neuralynxproxy.py new file mode 100644 index 0000000..ffaae5c --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_neuralynxproxy.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_neuralynxproxy(*args, **kwargs): + """ + FT_REALTIME_NEURALYNXPROXY reads continuous data from a Neuralynx Cheetah + acquisition system and writes it to a FieldTrip buffer. + + The FieldTrip buffer is a network transparent server that allows the acquisition + client to stream data to it. An analysis client can connect to read the data upon + request. Multiple clients can connect simultaneously, each analyzing a specific + aspect of the data concurrently. + + Use as + ft_realtime_neuralynxproxy(cfg) + + The configuration should contain + cfg.acquisition = string, name of computer running the Cheetah software (default = 'fcdc284') + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = 'all') + + The target to write the data to is configured as + cfg.target.datafile = string, target destination for the data (default = 'buffer://localhost:1972') + cfg.target.dataformat = string, default is determined automatic + + To stop this realtime function, you have to press Ctrl-C + + See also FT_REALTIME_SIGNALPROXY, FT_REALTIME_SIGNALVIEWER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_neuralynxproxy.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_neuralynxproxy", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_packettimer.py b/fieldtrip/__realtime/__example/ft_realtime_packettimer.py new file mode 100644 index 0000000..81853c2 --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_packettimer.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_packettimer(*args, **kwargs): + """ + FT_REALTIME_PACKETTIMER can be used to time the rate at which data can be processed + + Use as + ft_realtime_packettimer(cfg) + with the following configuration options + cfg.bcifun = processing of the data (default = @bcifun_timer) + cfg.npackets = the number of packets shown in one plot (default=1000) + after reaching the end + cfg.saveplot = if path is specified, first plot is saved (default=[]); + cfg.rellim = y limits of subplot 1 (default = [-100 100]) + + SEE ALSO: + FT_REALTIME_PROCESS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_packettimer.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_packettimer", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_pooraudioproxy.py b/fieldtrip/__realtime/__example/ft_realtime_pooraudioproxy.py new file mode 100644 index 0000000..02a8554 --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_pooraudioproxy.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_pooraudioproxy(*args, **kwargs): + """ + FT_REALTIME_POORAUDIOPROXY reads continuous data from the sound card using the + standard Matlab API and writes it to a FieldTrip buffer. This proxy has poor timing + and will produce dropped audio frames between blocks. Also the Matlab documentation + warns about using this API for long recordings because this will fill up memory and + degrade performance. + + The FieldTrip buffer is a network transparent server that allows the acquisition + client to stream data to it. An analysis client can connect to read the data upon + request. Multiple clients can connect simultaneously, each analyzing a specific + aspect of the data concurrently. + + Use as + ft_realtime_pooraudioproxy(cfg) + + The audio-specific configuration structure can contain + cfg.channel = number of channels (1 or 2, default=2) + cfg.blocksize = size of recorded audio blocks in seconds (default=1) + cfg.fsample = audio sampling frequency in Hz (default = 44100) + cfg.nbits = recording depth in bits (default = 16) + + Note that currently, the sound will be buffered in double precision irrespective of the sampling bit depth. + + The target to write the data to is configured as + cfg.target.datafile = string, target destination for the data (default = 'buffer://localhost:1972') + cfg.target.dataformat = string, default is determined automatic + + Finally, there is an option for showing debug output + cfg.debug = show sample time and clock time (default = 'yes') + + To stop this realtime function, you have to press Ctrl-C + + See also FT_REALTIME_SIGNALPROXY, FT_REALTIME_SIGNALVIEWER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_pooraudioproxy.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_pooraudioproxy", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_powerestimate.py b/fieldtrip/__realtime/__example/ft_realtime_powerestimate.py new file mode 100644 index 0000000..b63c96f --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_powerestimate.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_powerestimate(*args, **kwargs): + """ + FT_REALTIME_POWERESTIMATE is an example realtime application for online + power estimation. It should work both for EEG and MEG. + + Use as + ft_realtime_powerestimate(cfg) + with the following configuration options + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = 'all') + cfg.foilim = [Flow Fhigh] (default = [0 120]) + cfg.blocksize = number, size of the blocks/chuncks that are processed (default = 1 second) + cfg.bufferdata = whether to start on the 'first or 'last' data that is available (default = 'last') + + The source of the data is configured as + cfg.dataset = string + or alternatively to obtain more low-level control as + cfg.datafile = string + cfg.headerfile = string + cfg.eventfile = string + cfg.dataformat = string, default is determined automatic + cfg.headerformat = string, default is determined automatic + cfg.eventformat = string, default is determined automatic + + To stop the realtime function, you have to press Ctrl-C + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_powerestimate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_powerestimate", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_selectiveaverage.py b/fieldtrip/__realtime/__example/ft_realtime_selectiveaverage.py new file mode 100644 index 0000000..33b2cd0 --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_selectiveaverage.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_selectiveaverage(*args, **kwargs): + """ + FT_REALTIME_SELECTIVEAVERAGE is an example realtime application for online + averaging of the data. It should work both for EEG and MEG. + + Use as + ft_realtime_selectiveaverage(cfg) + with the following configuration options + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = 'all') + cfg.trialfun = string with the trial function + + The source of the data is configured as + cfg.dataset = string + or alternatively to obtain more low-level control as + cfg.datafile = string + cfg.headerfile = string + cfg.eventfile = string + cfg.dataformat = string, default is determined automatic + cfg.headerformat = string, default is determined automatic + cfg.eventformat = string, default is determined automatic + + To stop the realtime function, you have to press Ctrl-C + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_selectiveaverage.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_selectiveaverage", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_sensysproxy.py b/fieldtrip/__realtime/__example/ft_realtime_sensysproxy.py new file mode 100644 index 0000000..21172e8 --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_sensysproxy.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_sensysproxy(*args, **kwargs): + """ + FT_REALTIME_SENSYSPROXY reads real-time continuous fluxgate magnetometer + data from the serial interface provided by the Sensis FGM3D TD + application and writes the data to the FieldTrip buffer. + + Use as + ft_realtime_sensysproxy(cfg) + + The configuration should contain + cfg.serialport = string, name of the serial port (default = 'COM2') + cfg.blocksize = number, in seconds (default = 0.1) + cfg.fsample = sampling frequency (default = 1000) + + The target to write the data to is configured as + cfg.target.datafile = string, target destination for the data (default = 'buffer://localhost:1972') + cfg.target.dataformat = string, default is determined automatic + + To stop this realtime function, you have to press Ctrl-C + + See also FT_REALTIME_SIGNALPROXY, FT_REALTIME_SIGNALVIEWER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_sensysproxy.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_sensysproxy", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_signalproxy.py b/fieldtrip/__realtime/__example/ft_realtime_signalproxy.py new file mode 100644 index 0000000..9291ba3 --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_signalproxy.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_signalproxy(*args, **kwargs): + """ + FT_REALTIME_SIGNALPROXY creates some random data and writes it to a FieldTrip buffer. + + The FieldTrip buffer is a network transparent server that allows the acquisition + client to stream data to it. An analysis client can connect to read the data upon + request. Multiple clients can connect simultaneously, each analyzing a specific + aspect of the data concurrently. + + Use as + ft_realtime_signalproxy(cfg) + with the following configuration options + cfg.blocksize = number, in seconds (default = 0.5) + cfg.channel = cell-array with channel names + cfg.fsample = sampling frequency + cfg.speed = relative speed at which data is written (default = 1) + cfg.precision = numeric representation, can be double, single, int32, int16 (default = 'double') + + The target to write the data to is configured as + cfg.target.datafile = string, target destination for the data (default = 'buffer://localhost:1972') + cfg.target.dataformat = string, default is determined automatic + + You can apply some filtering to the random number data to make it + appear slightly more realistic with + cfg.lpfilter = 'no' or 'yes' lowpass filter (default = 'no') + cfg.hpfilter = 'no' or 'yes' highpass filter (default = 'no') + cfg.bpfilter = 'no' or 'yes' bandpass filter (default = 'no') + cfg.lpfreq = lowpass frequency in Hz + cfg.hpfreq = highpass frequency in Hz + cfg.bpfreq = bandpass frequency range, specified as [low high] in Hz + + To stop this realtime function, you have to press Ctrl-C + + See also FT_REALTIME_SIGNALPROXY, FT_REALTIME_SIGNALVIEWER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_signalproxy.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_signalproxy", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_signalrecorder.py b/fieldtrip/__realtime/__example/ft_realtime_signalrecorder.py new file mode 100644 index 0000000..64c3051 --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_signalrecorder.py @@ -0,0 +1,76 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_signalrecorder(*args, **kwargs): + """ + FT_REALTIME_SIGNALRECORDER is an example realtime application for recording of data + that is streaming to the buffer in real-time. It should work both for EEG and MEG. + + Use as + ft_realtime_signalrecorder(cfg) + with the following configuration options + cfg.blocksize = number, size of the blocks/chuncks that are processed (default = 1 second) + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = 'all') + cfg.bufferdata = whether to start on the 'first or 'last' data that is available (default = 'last') + cfg.jumptoeof = whether to skip to the end of the stream/file at startup (default = 'yes') + + The source of the data, i.e. where it comes from, is configured as + cfg.dataset = string + or alternatively to obtain more low-level control as + cfg.datafile = string + cfg.headerfile = string + cfg.eventfile = string + cfg.dataformat = string, default is determined automatic + cfg.headerformat = string, default is determined automatic + cfg.eventformat = string, default is determined automatic + + The target for the data, i.e. where it goes to, is configured as + cfg.export.dataset = string with the output file name + cfg.export.dataformat = string describing the output file format, see FT_WRITE_DATA + + Some notes about skipping data and catching up with the data stream: + + cfg.jumptoeof='yes' causes the realtime function to jump to the end + when the function _starts_. It causes all data acquired prior to + starting the realtime function to be skipped. + + cfg.bufferdata='last' causes the realtime function to jump to the last + available data while _running_. If the realtime loop is not fast enough, + it causes some data to be dropped. + + If you want to skip all data that was acquired before you start the + RT function, but don't want to miss any data that was acquired while + the realtime function is started, then you should use jumptoeof=yes and + bufferdata='first'. If you want to analyze data from a file, then you + should use cfg.jumptoeof='no' and cfg.bufferdata='first'. + + To stop this realtime function, you will have have to press Ctrl-C. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_signalrecorder.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_signalrecorder", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_signalviewer.py b/fieldtrip/__realtime/__example/ft_realtime_signalviewer.py new file mode 100644 index 0000000..adb88ec --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_signalviewer.py @@ -0,0 +1,73 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_signalviewer(*args, **kwargs): + """ + FT_REALTIME_SIGNALVIEWER is an example realtime application for online viewing of + the data. It should work both for EEG and MEG. + + Use as + ft_realtime_signalviewer(cfg) + with the following configuration options + cfg.blocksize = number, size of the blocks/chuncks that are processed (default = 1 second) + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = 'all') + cfg.jumptoeof = whether to skip to the end of the stream/file at startup (default = 'yes') + cfg.bufferdata = whether to start on the 'first or 'last' data that is available (default = 'first') + cfg.readevent = whether or not to copy events (default = 'no') + cfg.demean = 'no' or 'yes', whether to apply baseline correction (default = 'yes') + + The source of the data is configured as + cfg.dataset = string + or alternatively to obtain more low-level control as + cfg.datafile = string + cfg.headerfile = string + cfg.eventfile = string + cfg.dataformat = string, default is determined automatic + cfg.headerformat = string, default is determined automatic + cfg.eventformat = string, default is determined automatic + + Some notes about skipping data and catching up with the data stream: + + cfg.jumptoeof='yes' causes the realtime function to jump to the end when the + function _starts_. It causes all data acquired prior to starting the realtime + function to be skipped. + + cfg.bufferdata='last' causes the realtime function to jump to the last available data + while _running_. If the realtime loop is not fast enough, it causes some data to be + dropped. + + If you want to skip all data that was acquired before you start the RT function, + but don't want to miss any data that was acquired while the realtime function is + started, then you should use jumptoeof=yes and bufferdata=first. If you want to + analyze data from a file, then you should use jumptoeof=no and bufferdata=first. + + To stop this realtime function, you have to press Ctrl-C + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_signalviewer.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_signalviewer", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_synchronous.py b/fieldtrip/__realtime/__example/ft_realtime_synchronous.py new file mode 100644 index 0000000..6213e1d --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_synchronous.py @@ -0,0 +1,95 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_synchronous(*args, **kwargs): + """ + FT_REALTIME_SYNCHRONOUS is an example realtime application for + synchronous (trigger-based) brain-computer interfaces + + Use as + cmd = ft_realtime_synchronous(cfg) + + where cmd is the last processed command and cfg has the following configuration options + cfg.bcifun = the BCI function that is called + cfg.trigger = the trigger values that should be processed (default = 'all') + cfg.blocksize = number, size of the blocks/chuncks that are processed in seconds (default = 1) + cfg.offset = offset relative to the trigger (default = 0) + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = 'all') + cfg.bufferdata = whether to start on the 'first or 'last' data that is + available when the function _starts_ (default = 'last') + cfg.jumptoeof = whether to start on the 'first or 'last' data that is + available when the function _starts_ (default = 'last') + + cfg.ostream = the output stream that is used to send a command via + write_event (default = [] + + The source of the data is configured as + cfg.dataset = string + or alternatively to obtain more low-level control as + cfg.datafile = string + cfg.headerfile = string + cfg.eventfile = string + cfg.dataformat = string, default is determined automatic + cfg.headerformat = string, default is determined automatic + cfg.eventformat = string, default is determined automatic + + trials that correspond to any of the triggers in the vector cfg.trigger will be + processed. By default all trigger values will be processed (cfg.trigger = + 'all') and may be of any type (cfg.type = 'all'). The condition to which a + data segment belongs is passed to bcifun using cfg.condition. + + The bcifun must be of the form + + cmd = bcifun(cfg,data) + + where cfg is the configuration passed by this function and data is the + new data segment. Cmd is the command which is generated by the bcifun. + This command will be send to an external device via cfg.ostream. Check + bcifun_latidx for an example. + + Some notes about skipping data and catching up with the data stream: + + cfg.jumptoeof='yes' causes the realtime function to jump to the end + when the function _starts_. It causes all data acquired prior to + starting the RT function to be skipped. + + cfg.bufferdata=last causes the realtime function to jump to the last + available data while _running_. If the RT loop is not fast enough, + it causes some data to be dropped. + + If you want to skip all data that was acquired before you start the + RT function, but don't want to miss any data that was acquired while + the realtime function is started, then you should use jumptoeof=yes and + bufferdata=first. If you want to analyze data from a file, then you + should use jumptoeof=no and bufferdata=first. + + To stop the realtime function, you have to press Ctrl-C + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_synchronous.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_synchronous", *args, **kwargs) diff --git a/fieldtrip/__realtime/__example/ft_realtime_topography.py b/fieldtrip/__realtime/__example/ft_realtime_topography.py new file mode 100644 index 0000000..99add1a --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_topography.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_topography(*args, **kwargs): + """ + FT_REALTIME_TOPOGRAPHY reads continuous data from a file or from a data stream, + estimates the power and plots the scalp topography in real time. + + Use as + ft_realtime_topography(cfg) + with the following configuration options + cfg.blocksize = number, size of the blocks/chuncks that are processed (default = 1 second) + cfg.overlap = number, amojunt of overlap between chunks (default = 0 seconds) + cfg.layout = specification of the layout, see FT_PREPARE_LAYOUT + + The source of the data is configured as + cfg.dataset = string + or alternatively to obtain more low-level control as + cfg.datafile = string + cfg.headerfile = string + cfg.eventfile = string + cfg.dataformat = string, default is determined automatic + cfg.headerformat = string, default is determined automatic + cfg.eventformat = string, default is determined automatic + + To stop this realtime function, you have to press Ctrl-C + + Example use + cfg = []; + cfg.dataset = 'PW02_ingnie_20061212_01.ds'; + cfg.layout = 'CTF151.lay'; + cfg.channel = 'MEG'; + cfg.blocksize = 0.5; + cfg.overlap = 0.25; + cfg.demean = 'yes'; + cfg.bpfilter = [15 25]; + cfg.bpfreq = 'yes'; + ft_realtime_topography(cfg); + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_topography.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_topography", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__example/ft_realtime_unicornproxy.py b/fieldtrip/__realtime/__example/ft_realtime_unicornproxy.py new file mode 100644 index 0000000..3a83daa --- /dev/null +++ b/fieldtrip/__realtime/__example/ft_realtime_unicornproxy.py @@ -0,0 +1,70 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_unicornproxy(*args, **kwargs): + """ + FT_REALTIME_UNICORNPROXY reads continuous data from a Unicorn Hybrid Black + wireless EEG system through Bluetooth and writes it to a FieldTrip buffer. + + The FieldTrip buffer is a network transparent server that allows the acquisition + client to stream data to it. An analysis client can connect to read the data upon + request. Multiple clients can connect simultaneously, each analyzing a specific + aspect of the data concurrently. + + Use as + ft_realtime_unicornproxy(cfg) + + The configuration should contain + cfg.filename = string, name of the serial port (default = '/dev/tty.FireFly-B106-SPP') + cfg.blocksize = number, in seconds (default = 0.2) + cfg.writeeeg = 'yes' or 'no' (default = 'yes') + cfg.writeaccel = 'yes' or 'no' (default = 'no') + cfg.writegyro = 'yes' or 'no' (default = 'no') + cfg.writebattery = 'yes' or 'no' (default = 'no') + cfg.writecounter = 'yes' or 'no' (default = 'no') + + The target to write the data to is configured as + cfg.target.datafile = string, target destination for the data (default = 'buffer://localhost:1972') + cfg.target.dataformat = string, default is determined automatic + + To stop this realtime function, you have to press Ctrl-C + + Prior to connecting the LED gives short flashes every second. After connecting it + blinks on and off in a regular pace. When streaming the LED is constantly on. + + The Bluetooth protocol is documented in a PDF that is hosted on + https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black + + If you encounter Bluetooth connection problems on macOS, open a terminal and type + sudo pkill bluetoothd + + See also FT_REALTIME_SIGNALPROXY, FT_REALTIME_SIGNALVIEWER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/example/ft_realtime_unicornproxy.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_unicornproxy", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__init__.py b/fieldtrip/__realtime/__init__.py new file mode 100644 index 0000000..a1b7d06 --- /dev/null +++ b/fieldtrip/__realtime/__init__.py @@ -0,0 +1,96 @@ +from .__example import ( + bcifun_latidx, + ft_realtime_asaproxy, + ft_realtime_asynchronous, + ft_realtime_average, + ft_realtime_benchmark, + ft_realtime_brainampproxy, + ft_realtime_classification, + ft_realtime_ctfproxy, + ft_realtime_dicomproxy, + ft_realtime_downsample, + ft_realtime_fileproxy, + ft_realtime_fmriproxy, + ft_realtime_fmriviewer, + ft_realtime_heartbeatdetect, + ft_realtime_jaga16proxy, + ft_realtime_modeegproxy, + ft_realtime_neuralynxproxy, + ft_realtime_packettimer, + ft_realtime_pooraudioproxy, + ft_realtime_powerestimate, + ft_realtime_selectiveaverage, + ft_realtime_sensysproxy, + ft_realtime_signalproxy, + ft_realtime_signalrecorder, + ft_realtime_signalviewer, + ft_realtime_synchronous, + ft_realtime_topography, + ft_realtime_unicornproxy, +) +from .__online_eeg import ft_realtime_oddball, ft_realtime_ouunpod +from .__online_meg import ft_realtime_coillocalizer, ft_realtime_headlocalizer +from .__online_mri import ( + ft_omri_align_init, + ft_omri_align_scan, + ft_omri_info_from_header, + ft_omri_pipeline, + ft_omri_pipeline_nuisance, + ft_omri_quality, + ft_omri_quality_plot, + ft_omri_slice_time_apply, + ft_omri_slice_time_init, + ft_omri_smoothing_kernel, + ft_omri_volume_to_mosaic, +) +from .__src import replay_dicoms, buffer, compile_buffer + + +__all__ = [ + "bcifun_latidx", + "ft_realtime_asaproxy", + "ft_realtime_asynchronous", + "ft_realtime_average", + "ft_realtime_benchmark", + "ft_realtime_brainampproxy", + "ft_realtime_classification", + "ft_realtime_ctfproxy", + "ft_realtime_dicomproxy", + "ft_realtime_downsample", + "ft_realtime_fileproxy", + "ft_realtime_fmriproxy", + "ft_realtime_fmriviewer", + "ft_realtime_heartbeatdetect", + "ft_realtime_jaga16proxy", + "ft_realtime_modeegproxy", + "ft_realtime_neuralynxproxy", + "ft_realtime_packettimer", + "ft_realtime_pooraudioproxy", + "ft_realtime_powerestimate", + "ft_realtime_selectiveaverage", + "ft_realtime_sensysproxy", + "ft_realtime_signalproxy", + "ft_realtime_signalrecorder", + "ft_realtime_signalviewer", + "ft_realtime_synchronous", + "ft_realtime_topography", + "ft_realtime_unicornproxy", + "ft_realtime_oddball", + "ft_realtime_ouunpod", + "ft_realtime_coillocalizer", + "ft_realtime_headlocalizer", + "ft_omri_align_init", + "ft_omri_align_scan", + "ft_omri_info_from_header", + "ft_omri_pipeline", + "ft_omri_pipeline_nuisance", + "ft_omri_quality", + "ft_omri_quality_plot", + "ft_omri_slice_time_apply", + "ft_omri_slice_time_init", + "ft_omri_smoothing_kernel", + "ft_omri_volume_to_mosaic", + "replay_dicoms", + "buffer", + "compile_buffer", +] diff --git a/fieldtrip/__realtime/__online_eeg/__init__.py b/fieldtrip/__realtime/__online_eeg/__init__.py new file mode 100644 index 0000000..39691b0 --- /dev/null +++ b/fieldtrip/__realtime/__online_eeg/__init__.py @@ -0,0 +1,5 @@ +from .ft_realtime_oddball import ft_realtime_oddball +from .ft_realtime_ouunpod import ft_realtime_ouunpod + + +__all__ = ["ft_realtime_oddball", "ft_realtime_ouunpod"] diff --git a/fieldtrip/__realtime/__online_eeg/_midiIn.py b/fieldtrip/__realtime/__online_eeg/_midiIn.py new file mode 100644 index 0000000..18e5bc1 --- /dev/null +++ b/fieldtrip/__realtime/__online_eeg/_midiIn.py @@ -0,0 +1,73 @@ +from fieldtrip._runtime import Runtime + + +def _midiIn(*args, **kwargs): + """ + midiIn -- connect to a MIDI input device and record notes or other events + + >> S = midiIn('L') + Returns a list of MIDI devices as a structure array. Fields are 'index', + 'name', 'input' and 'output'. The last two are flags (1 or 0) that determine + whether the device can be used as an input, or output, or both. + + >> midiIn('O', index) + Opens a MIDI device by its index (as returned by aforementioned 'L' call). + If the device is already opened, nothing will happen. If another device is + opened, that one will be closed first. + + >> midiIn('C') + Closes the current connection. + + >> A = midiIn('G') + Get all notes that were recorded since starting or since the previous call. This + returns a matrix with 4 columns representing the channel, note, velocity and + timestamp (in miliseconds). + + >> midiIn('F') + Flush all recorded notes. + + >> midiIn('V', value) + Toggle verbose mode, can be 0 or 1. + + For example, receive notes from the piano + >> midiIn('O', 1) + % play some melody + >> a = midiIn('G') + + Subsequently play the sequence of notes on the piano + >> midiOut('O', 2) + >> note = a(:,2); + >> velocity = a(:,3); + >> delay = diff([a(1,4); a(:,4)])/1000; + >> for i=1:length(note); pause(delay(i)); midiOut('+', 1, note(i), velocity(i)); end + + See also MIDIOUT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_eeg/private/midiIn.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("midiIn", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_eeg/_midiOut.py b/fieldtrip/__realtime/__online_eeg/_midiOut.py new file mode 100644 index 0000000..9e85070 --- /dev/null +++ b/fieldtrip/__realtime/__online_eeg/_midiOut.py @@ -0,0 +1,71 @@ +from fieldtrip._runtime import Runtime + + +def _midiOut(*args, **kwargs): + """ + midiOut -- connect to a MIDI output device and send notes + + >> S = midiOut('L') + Returns a list of MIDI devices as a structure array. Fields are 'index', + 'name', 'input' and 'output'. The last two are flags (1 or 0) that determine + whether the device can be used as an input, or output, or both. + + >> midiOut('O', index) + Opens a MIDI device by its index (as returned by aforementioned 'L' call). + If the device is already opened, nothing will happen. If another device is + opened, that one will be closed first. + + >> midiOut('C') + Closes the current connection. + + >> midiOut('+', channel, notes, velocities) + Send one or more 'note on' messages at the given channel (1..16). + 'notes' and 'velocities' must be given as double-precision arrays with + equal number of elements. Messages will be transmitted in order. + + >> midiOut('-', channel, notes, velocities) + Send one or more 'note off' messages, same parameters as for 'note on'. + + >> midiOut('.', channel) + Send an 'all notes off' message at the given channel. + + >> midiOut('P', channel, program) + Send a 'program change' to the given channel. + + >> midiOut(msg) + Send raw data. 'msg' must be of type 'uint8' and have a multiple of 3 elements. + + For example, play the note C4 (261.63 Hz) on the piano + >> midiOut('O', 2) + >> midiOut('+', 1, 60, 127) + + See also MIDIIN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_eeg/private/midiOut.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("midiOut", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_eeg/ft_realtime_oddball.py b/fieldtrip/__realtime/__online_eeg/ft_realtime_oddball.py new file mode 100644 index 0000000..2ed91d4 --- /dev/null +++ b/fieldtrip/__realtime/__online_eeg/ft_realtime_oddball.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_oddball(*args, **kwargs): + """ + FT_REALTIME_ODDBALL is an realtime application that computes an online + average for a standard and deviant condition. The ERPs/ERFs are plotted, + together with the difference as t-values. It should work both for EEG and + MEG, as long as there are two triggers present + + Use as + ft_realtime_oddball(cfg) + with the following configuration options + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = 'all') + cfg.trialfun = string with the trial function + + The source of the data is configured as + cfg.dataset = string + or alternatively to obtain more low-level control as + cfg.datafile = string + cfg.headerfile = string + cfg.eventfile = string + cfg.dataformat = string, default is determined automatic + cfg.headerformat = string, default is determined automatic + cfg.eventformat = string, default is determined automatic + + To stop the realtime function, you have to press Ctrl-C + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_eeg/ft_realtime_oddball.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_oddball", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__online_eeg/ft_realtime_ouunpod.py b/fieldtrip/__realtime/__online_eeg/ft_realtime_ouunpod.py new file mode 100644 index 0000000..08419d0 --- /dev/null +++ b/fieldtrip/__realtime/__online_eeg/ft_realtime_ouunpod.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_ouunpod(*args, **kwargs): + """ + FT_REALTIME_OUUNPOD is an example realtime application for online power + estimation and visualisation. It is designed for use with the OuUnPod, an + OpenEEG based low cost EEG system with two channels, but in principle + should work for any EEG or MEG system. + + Use as + ft_realtime_ouunpod(cfg) + with the following configuration options + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = 'all') + cfg.foilim = [Flow Fhigh] (default = [1 45]) + cfg.blocksize = number, size of the blocks/chuncks that are processed (default = 1 second) + cfg.bufferdata = whether to start on the 'first or 'last' data that is available (default = 'last') + + The source of the data is configured as + cfg.dataset = string + or alternatively to obtain more low-level control as + cfg.datafile = string + cfg.headerfile = string + cfg.eventfile = string + cfg.dataformat = string, default is determined automatic + cfg.headerformat = string, default is determined automatic + cfg.eventformat = string, default is determined automatic + + To stop the realtime function, you have to press Ctrl-C + + See also http://ouunpod.blogspot.com + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_eeg/ft_realtime_ouunpod.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_ouunpod", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__online_meg/__init__.py b/fieldtrip/__realtime/__online_meg/__init__.py new file mode 100644 index 0000000..b10667e --- /dev/null +++ b/fieldtrip/__realtime/__online_meg/__init__.py @@ -0,0 +1,5 @@ +from .ft_realtime_coillocalizer import ft_realtime_coillocalizer +from .ft_realtime_headlocalizer import ft_realtime_headlocalizer + + +__all__ = ["ft_realtime_coillocalizer", "ft_realtime_headlocalizer"] diff --git a/fieldtrip/__realtime/__online_meg/_open_figure.py b/fieldtrip/__realtime/__online_meg/_open_figure.py new file mode 100644 index 0000000..11da8b0 --- /dev/null +++ b/fieldtrip/__realtime/__online_meg/_open_figure.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _open_figure(*args, **kwargs): + """ + OPEN_FIGURE is a helper function to open a figure with some specific settings + consistent over all FieldTrip functions that do plotting and/or that show a + graphical user interface. + + See also GCA, GCF, GROOT, + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_meg/private/open_figure.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("open_figure", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_meg/_parsekeyboardevent.py b/fieldtrip/__realtime/__online_meg/_parsekeyboardevent.py new file mode 100644 index 0000000..9432198 --- /dev/null +++ b/fieldtrip/__realtime/__online_meg/_parsekeyboardevent.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _parsekeyboardevent(*args, **kwargs): + """ + PARSEKEYBOARDEVENT handles keyboard events for Windows, Mac OSX and Linux systems. + + shift+numpad number does not work on UNIX, since the shift modifier is always sent for numpad events + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_meg/private/parsekeyboardevent.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("parsekeyboardevent", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_meg/ft_realtime_coillocalizer.py b/fieldtrip/__realtime/__online_meg/ft_realtime_coillocalizer.py new file mode 100644 index 0000000..96a1943 --- /dev/null +++ b/fieldtrip/__realtime/__online_meg/ft_realtime_coillocalizer.py @@ -0,0 +1,76 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_coillocalizer(*args, **kwargs): + """ + FT_REALTIME_COILLOCALIZER is a realtime application for online tracking + of MEG localizer coils. + + Use as + ft_realtime_coillocalizer(cfg) + with the following configuration options + cfg.blocksize = number, size of the blocks/chuncks that are processed (default = 1 second) + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = {'MEG', 'MEGREF'}) + cfg.bufferdata = whether to process the 'first or 'last' data that is available (default = 'last') + cfg.jumptoeof = whether to skip to the end of the stream/file at startup (default = 'yes') + + The settings for extracting the spatial topgraphy of each coil are configured as + cfg.coilfreq = single number in Hz or list of numbers + cfg.refchan = single string or cell-array with strings + + The source of the data is configured as + cfg.dataset = string + or alternatively to obtain more low-level control as + cfg.datafile = string + cfg.headerfile = string + cfg.eventfile = string + cfg.dataformat = string, default is determined automatic + cfg.headerformat = string, default is determined automatic + cfg.eventformat = string, default is determined automatic + + Some notes about skipping data and catching up with the data stream: + + cfg.jumptoeof='yes' causes the realtime function to jump to the end + when the function _starts_. It causes all data acquired prior to + starting the RT function to be skipped. + + cfg.bufferdata=last causes the realtime function to jump to the last + available data while _running_. If the realtime loop is not fast enough, + it causes some data to be dropped. + + If you want to skip all data that was acquired before you start the + realtime function, but don't want to miss any data that was acquired while + the realtime function is started, then you should use jumptoeof=yes and + bufferdata=first. If you want to analyze data from a file, then you + should use jumptoeof=no and bufferdata=first. + + To stop this realtime function, you have to press Ctrl-C + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_meg/ft_realtime_coillocalizer.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_coillocalizer", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__online_meg/ft_realtime_headlocalizer.py b/fieldtrip/__realtime/__online_meg/ft_realtime_headlocalizer.py new file mode 100644 index 0000000..604b084 --- /dev/null +++ b/fieldtrip/__realtime/__online_meg/ft_realtime_headlocalizer.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def ft_realtime_headlocalizer(*args, **kwargs): + """ + FT_REALTIME_HEADLOCALIZER is a real-time application for online visualization of + the head position for the CTF275 and the Neuromag/Elekta/Megin systems. This uses the + continuous head localization (in CTF terminology, i.e. CHL) or position indicator + (in Neuromag/Elekta/Megin terminology, i.e. cHPI) information. + + Repositioning the subject to a previous recording session can be done by specifying + the previous dataset as cfg.template = 'subject01xxx.ds', or by pointing to a text + file created during a previous recording; e.g. cfg.template = '29-Apr-2013-xxx.txt'. + The latter textfile is written automatically to disk with each 'Update' buttonpress. + + The online visualization shows the displacement of the head relative to the start + of the recording. The timepoint (i.e. position) relative to which the displacement + is shown can be updated can be achieved by marking the HPI at an arbitrary moment + by clicking the 'Update' button. This allows for repositioning within a recording + session. Black unfilled markers should appear which indicate the positions of the + coils at the moment of buttonpress. Distance to these marked positions then become + colorcoded, i.e. green, orange, or red. + + Use as + ft_realtime_headlocalizer(cfg) + with the following configuration options + cfg.dataset = string, name or location of a dataset/buffer (default = 'buffer://odin:1972') + cfg.template = string, name of a template dataset for between-session repositioning (default = []) + cfg.bufferdata = whether to start on the 'first or 'last' data that is available (default = 'last') + cfg.xlim = [min max], range in cm to plot (default = [-15 15]) + cfg.ylim = [min max], range in cm to plot (default = [-15 15]) + cfg.zlim = [min max], range in cm to plot (default is automatic) + cfg.blocksize = number, size of the blocks/chuncks that are processed (default = 1 second) + cfg.accuracy_green = distance from fiducial coordinate; green when within limits (default = 0.15 cm) + cfg.accuracy_orange = orange when within limits, red when out (default = 0.3 cm) + cfg.dewar = filename or mesh, description of the dewar shape (default is automatic) + cfg.polhemus = filename or mesh, description of the head shape recorded with the Polhemus (default is automatic) + cfg.headshape = filename or mesh, description of the head shape recorded with the Structure Sensor + + The following options only apply to data from the Neuromag/Elekta/Megin system + cfg.headmovement = string, name or location of the .pos file created by MaxFilter which describes the location of the head relative to the dewar + cfg.coilfreq = single number in Hz or list of numbers (default = [293, 307, 314, 321, 328]) + + This method is described in Stolk A, Todorovic A, Schoffelen JM, Oostenveld R. + "Online and offline tools for head movement compensation in MEG." + Neuroimage. 2013 Mar;68:39-48. doi: 10.1016/j.neuroimage.2012.11.047. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_meg/ft_realtime_headlocalizer.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_realtime_headlocalizer", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__online_mri/__init__.py b/fieldtrip/__realtime/__online_mri/__init__.py new file mode 100644 index 0000000..a0f6ba0 --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/__init__.py @@ -0,0 +1,26 @@ +from .ft_omri_align_init import ft_omri_align_init +from .ft_omri_align_scan import ft_omri_align_scan +from .ft_omri_info_from_header import ft_omri_info_from_header +from .ft_omri_pipeline import ft_omri_pipeline +from .ft_omri_pipeline_nuisance import ft_omri_pipeline_nuisance +from .ft_omri_quality import ft_omri_quality +from .ft_omri_quality_plot import ft_omri_quality_plot +from .ft_omri_slice_time_apply import ft_omri_slice_time_apply +from .ft_omri_slice_time_init import ft_omri_slice_time_init +from .ft_omri_smoothing_kernel import ft_omri_smoothing_kernel +from .ft_omri_volume_to_mosaic import ft_omri_volume_to_mosaic + + +__all__ = [ + "ft_omri_align_init", + "ft_omri_align_scan", + "ft_omri_info_from_header", + "ft_omri_pipeline", + "ft_omri_pipeline_nuisance", + "ft_omri_quality", + "ft_omri_quality_plot", + "ft_omri_slice_time_apply", + "ft_omri_slice_time_init", + "ft_omri_smoothing_kernel", + "ft_omri_volume_to_mosaic", +] diff --git a/fieldtrip/__realtime/__online_mri/_coords.py b/fieldtrip/__realtime/__online_mri/_coords.py new file mode 100644 index 0000000..c3a334e --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/_coords.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _coords(*args, **kwargs): + """ + Rigid body transformation of a set of coordinates. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/private/coords.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("coords", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_mri/_encode_nifti1.py b/fieldtrip/__realtime/__online_mri/_encode_nifti1.py new file mode 100644 index 0000000..5392b41 --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/_encode_nifti1.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _encode_nifti1(*args, **kwargs): + """ + function blob = encode_nifti1(H) + + Encodes a NIFTI-1 header (=> raw 348 bytes (uint8)) from a Matlab structure + that matches the C struct defined in nifti1.h. + + WARNING: This function currently ignores endianness !!! + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/private/encode_nifti1.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("encode_nifti1", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_mri/_hom2six.py b/fieldtrip/__realtime/__online_mri/_hom2six.py new file mode 100644 index 0000000..6076f4f --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/_hom2six.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _hom2six(*args, **kwargs): + """ + function sixdof = hom2six(M) + + Convert homogenous transformation (4x4 matrix) to 6-dof representation + as used in SPM8. That is, this function assumes that + M = Trans([x;y;z]) * RotX(a) * RotY(b) * RotZ(c) + and returns the 6 parameters [x,y,z,a,b,c] that generate M. + + Note that this representation is not unique in case b = +/- pi/2. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/private/hom2six.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("hom2six", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_mri/_kspace3d.py b/fieldtrip/__realtime/__online_mri/_kspace3d.py new file mode 100644 index 0000000..2d19ad1 --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/_kspace3d.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _kspace3d(*args, **kwargs): + """ + 3D rigid body transformation performed as shears in 1D Fourier space. + FORMAT v1 = kspace3d(v,M) + Inputs: + v - the image stored as a 3D array. + M - the rigid body transformation matrix. + Output: + v - the transformed image. + + The routine is based on the excellent papers: + R. W. Cox and A. Jesmanowicz (1999) + Real-Time 3D Image Registration for Functional MRI + Submitted to MRM (April 1999) and avaliable from: + http://varda.biophysics.mcw.edu/~cox/index.html. + and: + W. F. Eddy, M. Fitzgerald and D. C. Noll (1996) + Improved Image Registration by Using Fourier Interpolation + Magnetic Resonance in Medicine 36(6):923-931 + _______________________________________________________________________ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/private/kspace3d.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("kspace3d", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_mri/_make_A.py b/fieldtrip/__realtime/__online_mri/_make_A.py new file mode 100644 index 0000000..794263d --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/_make_A.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _make_A(*args, **kwargs): + """ + Matrix of rate of change of weighted difference w.r.t. parameter changes + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/private/make_A.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("make_A", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_mri/_reslice_vol.py b/fieldtrip/__realtime/__online_mri/_reslice_vol.py new file mode 100644 index 0000000..7ab4d3c --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/_reslice_vol.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _reslice_vol(*args, **kwargs): + """ + function [Va, Mask] = reslice_vol(Vo, M, interp) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/private/reslice_vol.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("reslice_vol", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_mri/_rls_init.py b/fieldtrip/__realtime/__online_mri/_rls_init.py new file mode 100644 index 0000000..14f521a --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/_rls_init.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _rls_init(*args, **kwargs): + """ + function model = rls_init(dimX, dimY [, gamma = 1e-6 [, lambda = 1]]) + + Initialise a recursive least squares model with input dimension dimX and output dimension dimY. + The optional third parameter sets the regularisation coefficient (as in ridge regression). + The optional fourth argument sets the forgetting factor (1 = no forgetting). + + See also RLS_UPDATE, RLS_PREDICT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/private/rls_init.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rls_init", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_mri/_rls_predict.py b/fieldtrip/__realtime/__online_mri/_rls_predict.py new file mode 100644 index 0000000..ba76d39 --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/_rls_predict.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _rls_predict(*args, **kwargs): + """ + function yp = rls_predict(model, x) + + Predict response from given RLS model and input vector x + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/private/rls_predict.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rls_predict", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_mri/_rls_update.py b/fieldtrip/__realtime/__online_mri/_rls_update.py new file mode 100644 index 0000000..cc0e2d6 --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/_rls_update.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _rls_update(*args, **kwargs): + """ + function model = rls_update(model, x, y) + + Update a recursive least squares model with a new training tuple (x,y) + which must both be column vectors. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/private/rls_update.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rls_update", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_mri/_shear_decomp.py b/fieldtrip/__realtime/__online_mri/_shear_decomp.py new file mode 100644 index 0000000..dc60732 --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/_shear_decomp.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _shear_decomp(*args, **kwargs): + """ + Decompose rotation and translation matrix A into shears S0, S1, S2 and + S3, such that A = S0*S1*S2*S3. The original procedure is documented + in: + R. W. Cox and A. Jesmanowicz (1999) + Real-Time 3D Image Registration for Functional MRI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/private/shear_decomp.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("shear_decomp", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_mri/_smooth_vol.py b/fieldtrip/__realtime/__online_mri/_smooth_vol.py new file mode 100644 index 0000000..20b3bc1 --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/_smooth_vol.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _smooth_vol(*args, **kwargs): + """ + Convolve the volume in memory. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/private/smooth_vol.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("smooth_vol", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_mri/ft_omri_align_init.py b/fieldtrip/__realtime/__online_mri/ft_omri_align_init.py new file mode 100644 index 0000000..17fd855 --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/ft_omri_align_init.py @@ -0,0 +1,112 @@ +from fieldtrip._runtime import Runtime + + +def ft_omri_align_init(*args, **kwargs): + """ + function model = ft_omri_align_init(Vr,flags) + + Ripped out of SPM 8 and modified (2010, S.Klanke) + + Estimation of within modality rigid body movement parameters + FORMAT P = spm_realign(P,flags) + + P - matrix of filenames {one string per row} + All operations are performed relative to the first image. + ie. Coregistration is to the first image, and resampling + of images is into the space of the first image. + For multiple sessions, P should be a cell-array, where each + cell should be a matrix of filenames. + + flags - a structure containing various options. The fields are: + quality - Quality versus speed trade-off. Highest quality + (1) gives most precise results, whereas lower + qualities gives faster realignment. + The idea is that some voxels contribute little to + the estimation of the realignment parameters. + This parameter is involved in selecting the number + of voxels that are used. + + fwhm - The FWHM of the Gaussian smoothing kernel (mm) + applied to the images before estimating the + realignment parameters. + + sep - the default separation (mm) to sample the images. + + PW - a filename of a weighting image (reciprocal of + standard deviation). If field does not exist, then + no weighting is done. + + interp - B-spline degree used for interpolation + + __________________________________________________________________________ + + Inputs + A series of *.img conforming to SPM data format (see 'Data Format'). + + Outputs + If no output argument, then an updated voxel to world matrix is written + to the headers of the images (a .mat file is created for 4D images). + The details of the transformation are displayed in the + results window as plots of translation and rotation. + A set of realignment parameters are saved for each session, named: + rp_*.txt. + __________________________________________________________________________ + + The voxel to world mappings. + + These are simply 4x4 affine transformation matrices represented in the + NIFTI headers (see http://nifti.nimh.nih.gov/nifti-1 ). + These are normally modified by the `realignment' and `coregistration' + modules. What these matrixes represent is a mapping from + the voxel coordinates (x0,y0,z0) (where the first voxel is at coordinate + (1,1,1)), to coordinates in millimeters (x1,y1,z1). + + x1 = M(1,1)*x0 + M(1,2)*y0 + M(1,3)*z0 + M(1,4) + y1 = M(2,1)*x0 + M(2,2)*y0 + M(2,3)*z0 + M(2,4) + z1 = M(3,1)*x0 + M(3,2)*y0 + M(3,3)*z0 + M(3,4) + + Assuming that image1 has a transformation matrix M1, and image2 has a + transformation matrix M2, the mapping from image1 to image2 is: M2\M1 + (ie. from the coordinate system of image1 into millimeters, followed + by a mapping from millimeters into the space of image2). + + These matrices allow several realignment or coregistration steps to be + combined into a single operation (without the necessity of resampling the + images several times). The `.mat' files are also used by the spatial + normalisation module. + __________________________________________________________________________ + Ref: + Friston KJ, Ashburner J, Frith CD, Poline J-B, Heather JD & Frackowiak + RSJ (1995) Spatial registration and normalization of images Hum. Brain + Map. 2:165-189 + __________________________________________________________________________ + Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/ft_omri_align_init.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_omri_align_init", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_mri/ft_omri_align_scan.py b/fieldtrip/__realtime/__online_mri/ft_omri_align_scan.py new file mode 100644 index 0000000..6938017 --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/ft_omri_align_scan.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def ft_omri_align_scan(*args, **kwargs): + """ + function [model, mat_r, mat_a, Va] = ft_omri_align_scan(model, Vo) + + Estimate 6-DOF motion parameters and align volume Vo with reference model. + + INPUTS + model - data structure containing reference image and flags + Vo - original image (to be registered to the reference model + + OUTPUTS + model - same as input, but with modified voxel mask (for keeping track of "missing voxels") + Va - aligned image (possibly rotated + translated version of Vo) + mat_r - parameters of 6-dof transformation in homogenous matrix form + transformation from world coordinates of Vo to world coordinates of reference + mat_a - pixel to world coordinate matrix of Vo (absolute "position" of Vo) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/ft_omri_align_scan.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_omri_align_scan", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_mri/ft_omri_info_from_header.py b/fieldtrip/__realtime/__online_mri/ft_omri_info_from_header.py new file mode 100644 index 0000000..af86b4c --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/ft_omri_info_from_header.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def ft_omri_info_from_header(*args, **kwargs): + """ + function S = ft_omri_info_from_header(hdr) + + Convenience function to retrieve most important MR information + from a given header (H) as retrieved from a FieldTrip buffer. + Will look at both NIFTI-1 and SiemensAP fields, if present, and + give preference to SiemensAP info. + + Returns empty array if no information could be found. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/ft_omri_info_from_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_omri_info_from_header", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_mri/ft_omri_pipeline.py b/fieldtrip/__realtime/__online_mri/ft_omri_pipeline.py new file mode 100644 index 0000000..e7d048f --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/ft_omri_pipeline.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def ft_omri_pipeline(*args, **kwargs): + """ + FT_OMRI_PIPELINE implements an online fMRI pre-processing pipeline + + Use as + ft_omri_pipeline(cfg) + where cfg is a structure with configuration settings. + + Configuration options are + cfg.input = FieldTrip buffer containing raw scans (default 'buffer://localhost:1972') + cfg.output = where to write processed scans to (default 'buffer://localhost:1973') + cfg.numDummy = how many scans to ignore initially (default 0) + cfg.smoothFWHM = kernel width in mm (Full Width Half Maximum) for smoothing (default = 0 => no smoothing) + cfg.correctMotion = flag indicating whether to correct motion artifacts (default = 1 = yes) + cfg.correctSliceTime = flag indicating whether to correct slice timing (default = 1 = yes) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/ft_omri_pipeline.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_omri_pipeline", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__online_mri/ft_omri_pipeline_nuisance.py b/fieldtrip/__realtime/__online_mri/ft_omri_pipeline_nuisance.py new file mode 100644 index 0000000..8e8e92f --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/ft_omri_pipeline_nuisance.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def ft_omri_pipeline_nuisance(*args, **kwargs): + """ + FT_OMRI_PIPELINE_NUISANCE implements an online fMRI pre-processing pipeline, including + motion correction, slice time correction, smoothing, and regressing out nuisance + regressors (constant, linear trend, motion estimates). + + Use as + ft_omri_pipeline_nuisance(cfg) + where cfg is a structure with configuration settings. + + Configuration options are + cfg.input = FieldTrip buffer containing raw scans (default 'buffer://localhost:1972') + cfg.output = where to write processed scans to (default 'buffer://localhost:1973') + cfg.numDummy = how many scans to ignore initially (default 4) + cfg.smoothFWHM = kernel width in mm (Full Width Half Maximum) for smoothing (default = 8) + cfg.whichEcho = which echo to process for multi-echo sequences (default = 1) + cfg.correctMotion = flag indicating whether to correct motion artifacts (default = 1 = yes) + cfg.correctSliceTime = flag indicating whether to correct slice timing (default = 1 = yes) + cfg.numRegr = number of nuisance regressors (1=constant term, 2=const+linear,5=const,linear+translation) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/ft_omri_pipeline_nuisance.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_omri_pipeline_nuisance", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__online_mri/ft_omri_quality.py b/fieldtrip/__realtime/__online_mri/ft_omri_quality.py new file mode 100644 index 0000000..16f0bee --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/ft_omri_quality.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def ft_omri_quality(*args, **kwargs): + """ + FT_OMRI_QUALITY implements an online fMRI quality assurance stack + + Use as + ft_omri_quality(cfg) + where cfg is a structure with configuration settings. + + Configuration options are + cfg.input = FieldTrip buffer containing raw scans (default='buffer://localhost:1972') + cfg.numDummy = how many scans to ignore initially (default=0) + cfg.showRawVariation = 1 to show variation in raw scans (default), 0 to show var. in processed scans + cfg.clipVar = threshold to clip variation plot with as a fraction of signal magnitude (default=0.2) + cfg.lambda = forgetting factor for the variaton plot (default=0.9) + cfg.serial = serial port (default = /dev/ttyS0), set [] to disable motion reporting + cfg.baudrate = serial port baudrate (default = 19200) + cfg.maxAbs = threshold (mm) for absolute motion before 'A' is sent to serial port, default = Inf + cfg.maxRel = threshold (mm) for relative motion before 'B' is sent to serial port, default = Inf + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/ft_omri_quality.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_omri_quality", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__online_mri/ft_omri_quality_plot.py b/fieldtrip/__realtime/__online_mri/ft_omri_quality_plot.py new file mode 100644 index 0000000..8154c7b --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/ft_omri_quality_plot.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def ft_omri_quality_plot(*args, **kwargs): + """ + function ft_omri_quality_plot(motEst, curScan, varScan, [maxVal, maxVar]) + + motEst should be Nx6 matrix of estimated motion parameters + curScan should be [MxNxS] volume + varScan should be [MxNxS] representation of the variation of the scans + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/ft_omri_quality_plot.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_omri_quality_plot", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__online_mri/ft_omri_slice_time_apply.py b/fieldtrip/__realtime/__online_mri/ft_omri_slice_time_apply.py new file mode 100644 index 0000000..e41b068 --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/ft_omri_slice_time_apply.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def ft_omri_slice_time_apply(*args, **kwargs): + """ + function [STM, Xs] = ft_omri_slice_time_apply(STM, X) + + Put new scan X through slice time correction, by linear interpolation + with last scan. The return value Xs is the signal sampled at deltaT = 0 + relative to the most recent scan. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/ft_omri_slice_time_apply.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_omri_slice_time_apply", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_mri/ft_omri_slice_time_init.py b/fieldtrip/__realtime/__online_mri/ft_omri_slice_time_init.py new file mode 100644 index 0000000..9048f9d --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/ft_omri_slice_time_init.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def ft_omri_slice_time_init(*args, **kwargs): + """ + function STM = ft_omri_slice_time_init(X0, TR, deltaT); + + Initialize simple slice time correction structure. + The algorithm will use plain linear interpolation. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/ft_omri_slice_time_init.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_omri_slice_time_init", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_mri/ft_omri_smoothing_kernel.py b/fieldtrip/__realtime/__online_mri/ft_omri_smoothing_kernel.py new file mode 100644 index 0000000..7020ebe --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/ft_omri_smoothing_kernel.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def ft_omri_smoothing_kernel(*args, **kwargs): + """ + function [kernX, kernY, kernZ, offsets] = ft_omri_smoothing_kernel(FWHM, voxdims) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/ft_omri_smoothing_kernel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_omri_smoothing_kernel", *args, **kwargs) diff --git a/fieldtrip/__realtime/__online_mri/ft_omri_volume_to_mosaic.py b/fieldtrip/__realtime/__online_mri/ft_omri_volume_to_mosaic.py new file mode 100644 index 0000000..c0f80e5 --- /dev/null +++ b/fieldtrip/__realtime/__online_mri/ft_omri_volume_to_mosaic.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def ft_omri_volume_to_mosaic(*args, **kwargs): + """ + function M = ft_omri_volume_to_mosaic(V) + + Reshuffle [MxNxS] volume to [XxY] mosaic + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/online_mri/ft_omri_volume_to_mosaic.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_omri_volume_to_mosaic", *args, **kwargs) diff --git a/fieldtrip/__realtime/__src/__acquisition/__init__.py b/fieldtrip/__realtime/__src/__acquisition/__init__.py new file mode 100644 index 0000000..3bc3664 --- /dev/null +++ b/fieldtrip/__realtime/__src/__acquisition/__init__.py @@ -0,0 +1,4 @@ +from .__siemens import replay_dicoms + + +__all__ = ["replay_dicoms"] diff --git a/fieldtrip/__realtime/__src/__acquisition/__siemens/__init__.py b/fieldtrip/__realtime/__src/__acquisition/__siemens/__init__.py new file mode 100644 index 0000000..10f176d --- /dev/null +++ b/fieldtrip/__realtime/__src/__acquisition/__siemens/__init__.py @@ -0,0 +1,4 @@ +from .__matlab import replay_dicoms + + +__all__ = ["replay_dicoms"] diff --git a/fieldtrip/__realtime/__src/__acquisition/__siemens/__matlab/__init__.py b/fieldtrip/__realtime/__src/__acquisition/__siemens/__matlab/__init__.py new file mode 100644 index 0000000..b2dd716 --- /dev/null +++ b/fieldtrip/__realtime/__src/__acquisition/__siemens/__matlab/__init__.py @@ -0,0 +1,4 @@ +from .replay_dicoms import replay_dicoms + + +__all__ = ["replay_dicoms"] diff --git a/fieldtrip/__realtime/__src/__acquisition/__siemens/__matlab/replay_dicoms.py b/fieldtrip/__realtime/__src/__acquisition/__siemens/__matlab/replay_dicoms.py new file mode 100644 index 0000000..cee61b8 --- /dev/null +++ b/fieldtrip/__realtime/__src/__acquisition/__siemens/__matlab/replay_dicoms.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def replay_dicoms(*args, **kwargs): + """ + function replay_dicoms(src, dest) + + src = source directory (where the dicom files are) + dest = destination directory (mrprot.txt + pixeldata) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/src/acquisition/siemens/matlab/replay_dicoms.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("replay_dicoms", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__src/__buffer/__init__.py b/fieldtrip/__realtime/__src/__buffer/__init__.py new file mode 100644 index 0000000..a54bb5c --- /dev/null +++ b/fieldtrip/__realtime/__src/__buffer/__init__.py @@ -0,0 +1,4 @@ +from .__matlab import buffer, compile_buffer + + +__all__ = ["buffer", "compile_buffer"] diff --git a/fieldtrip/__realtime/__src/__buffer/__matlab/__init__.py b/fieldtrip/__realtime/__src/__buffer/__matlab/__init__.py new file mode 100644 index 0000000..ff25a5e --- /dev/null +++ b/fieldtrip/__realtime/__src/__buffer/__matlab/__init__.py @@ -0,0 +1,5 @@ +from .buffer import buffer +from .compile_buffer import compile_buffer + + +__all__ = ["buffer", "compile_buffer"] diff --git a/fieldtrip/__realtime/__src/__buffer/__matlab/buffer.py b/fieldtrip/__realtime/__src/__buffer/__matlab/buffer.py new file mode 100644 index 0000000..a470b09 --- /dev/null +++ b/fieldtrip/__realtime/__src/__buffer/__matlab/buffer.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def buffer(*args, **kwargs): + """ + BUFFER manages and accesses the realtime data acquisition buffer + This function is implented as a mex file. + + Use as + retval = buffer(cmd, detail, host, port) + + To read data from a buffer server over the network + hdr = buffer('get_hdr', [], host, port) + dat = buffer('get_dat', datsel, host, port) + evt = buffer('get_evt', evtsel, host, port) + + The selection for data and events should be zero-offset and contain + datsel = [begsample endsample] + evtsel = [begevent endevent ] + + To write data to a buffer server over the network + buffer('put_hdr', hdr, host, port) + buffer('put_dat', dat, host, port) + buffer('put_evt', evt, host, port) + + To implement a local buffer server and have other clients + connect to it at a specified network port + buffer('tcpserver', 'init', [], port) + buffer('tcpserver', 'exit', [], port) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/src/buffer/matlab/buffer.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("buffer", *args, **kwargs) diff --git a/fieldtrip/__realtime/__src/__buffer/__matlab/compile_buffer.py b/fieldtrip/__realtime/__src/__buffer/__matlab/compile_buffer.py new file mode 100644 index 0000000..181e5e7 --- /dev/null +++ b/fieldtrip/__realtime/__src/__buffer/__matlab/compile_buffer.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def compile_buffer(*args, **kwargs): + """ + COMPILE is used for compiling and linking the 'buffer' MEX file. + + On Linux and MacOS X, you should just be able to call this function without arguments. + + On Windows, you can select a compiler using one of the following options: + compile('lcc') - LCC compiler (shipped with Matlab on 32bit platforms) + compile('bcb') - Borland C++ Builder + compile('bcc55') - Borland C++ 5.5 (free command line tools) + compile('mingw') - MinGW (GCC port without cygwin dependency) + compile('vc') - Visual Studio C++ 2005 or 2008 + + Please note that this script does NOT set up your MEX environment for you, so in case + you haven't selected the C compiler on Windows yet, you need to type 'mex -setup' first + to choose either the Borland or Microsoft compiler. If you want to use MinGW, you also + need to install Gnumex (http://gnumex.sourceforget.net), which comes with its own + procedure for setting up the MEX environment. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/realtime/src/buffer/matlab/compile_buffer.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("compile_buffer", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__realtime/__src/__init__.py b/fieldtrip/__realtime/__src/__init__.py new file mode 100644 index 0000000..869e8e3 --- /dev/null +++ b/fieldtrip/__realtime/__src/__init__.py @@ -0,0 +1,5 @@ +from .__acquisition import replay_dicoms +from .__buffer import buffer, compile_buffer + + +__all__ = ["replay_dicoms", "buffer", "compile_buffer"] diff --git a/fieldtrip/__specest/__init__.py b/fieldtrip/__specest/__init__.py new file mode 100644 index 0000000..d4d007d --- /dev/null +++ b/fieldtrip/__specest/__init__.py @@ -0,0 +1,18 @@ +from .ft_specest_hilbert import ft_specest_hilbert +from .ft_specest_irasa import ft_specest_irasa +from .ft_specest_mtmconvol import ft_specest_mtmconvol +from .ft_specest_mtmfft import ft_specest_mtmfft +from .ft_specest_neuvar import ft_specest_neuvar +from .ft_specest_tfr import ft_specest_tfr +from .ft_specest_wavelet import ft_specest_wavelet + + +__all__ = [ + "ft_specest_hilbert", + "ft_specest_irasa", + "ft_specest_mtmconvol", + "ft_specest_mtmfft", + "ft_specest_neuvar", + "ft_specest_tfr", + "ft_specest_wavelet", +] diff --git a/fieldtrip/__specest/_alpha_taper.py b/fieldtrip/__specest/_alpha_taper.py new file mode 100644 index 0000000..9622b52 --- /dev/null +++ b/fieldtrip/__specest/_alpha_taper.py @@ -0,0 +1,64 @@ +from fieldtrip._runtime import Runtime + + +def _alpha_taper(*args, **kwargs): + """ + ALPHA_TAPER returns an asymmetric taper that can be used to construct a + complex wavelet with the peak at a distance of 0.8 times the cycle length + from the end. + + Use as + tap = alpha_taper(n, f) + where + n = number of samples + f = frequency of desired wavelet, relative to the sampling frequency + + The taper will be sufficiently long for a wavelet when n>=5/f. + + Example: + f = 0.01; % 10 Hz wavelet at 1000 Hz sampling rate + plot(alpha_taper(5/f, f)); hold on + plot(alpha_taper(5/f, f) .* cos(2*pi*10*(-499:0)/1000), 'r'); + plot(alpha_taper(5/f, f) .* sin(2*pi*10*(-499:0)/1000), 'g'); + + This function implements equation 3 from Mitchell, Baker and Baker (2007); + Muscle Responses to Transcranial Stimulation Depend on Background Oscillatory + Activity. http://jp.physoc.org/cgi/content/abstract/jphysiol.2007.134031v1 + + The original paper contains a typo. The equation 3 in the paper reads + W(F,t) = -(5/4)*F*t * exp( (1+(5/4)*F*t) * i*2*pi*F*t ) + but should read + W(F,t) = -(5/4)*F*t * exp( (1+(5/4)*F*t) + i*2*pi*F*t ) + since then it is equal to + W(F,t) = -(5/4)*F*t * exp(1+(5/4)*F*t) * exp(i*2*pi*F*t) + which is simply + W(F,t) = taper(F,t) * exp(i*2*pi*F*t) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/alpha_taper.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("alpha_taper", *args, **kwargs) diff --git a/fieldtrip/__specest/_defaultId.py b/fieldtrip/__specest/_defaultId.py new file mode 100644 index 0000000..953ceff --- /dev/null +++ b/fieldtrip/__specest/_defaultId.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _defaultId(*args, **kwargs): + """ + DEFAULTID returns a string that can serve as warning or error identifier, + for example 'FieldTip:ft_read_header:line345'. + + See also WARNING, ERROR, FT_NOTICE, FT_INFO, FT_DEBUG + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/defaultId.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("defaultId", *args, **kwargs) diff --git a/fieldtrip/__specest/_filter_with_correction.py b/fieldtrip/__specest/_filter_with_correction.py new file mode 100644 index 0000000..65a1d0d --- /dev/null +++ b/fieldtrip/__specest/_filter_with_correction.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def _filter_with_correction(*args, **kwargs): + """ + FILTER_WITH_CORRECTION applies the filter to the data and corrects + edge-artifacts for one-pass filtering. + + Use as + [filt] = filter_with_correction(B,A,dat,dir); + where + B,A filter coefficients + dat data matrix (Nchans X Ntime) + dir optional filter direction, can be + 'onepass' forward filter only + 'onepass-reverse' reverse filter only, i.e. backward in time + 'twopass' zero-phase forward and reverse filter (default) + 'twopass-reverse' zero-phase reverse and forward filter + 'twopass-average' average of the twopass and the twopass-reverse + 'onepass-zerophase' zero-phase forward filter with delay compensation (default for firws, linear-phase symmetric FIR only) + 'onepass-reverse-zerophase' zero-phase reverse filter with delay compensation + 'onepass-minphase' minimum-phase converted forward filter (non-linear!, firws only) + + Note that a one- or two-pass filter has consequences for the + strength of the filter, i.e. a two-pass filter with the same filter + order will attenuate the signal twice as strong. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/filter_with_correction.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("filter_with_correction", *args, **kwargs) diff --git a/fieldtrip/__specest/_fir_df.py b/fieldtrip/__specest/_fir_df.py new file mode 100644 index 0000000..e518f11 --- /dev/null +++ b/fieldtrip/__specest/_fir_df.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _fir_df(*args, **kwargs): + """ + FIR_DF computes default and maximum possible transition band width from + FIR filter cutoff frequency(ies) + + Use as + [df, maxDf] = fir_df(cutoffArray, Fs) + where + cutoffArray filter cutoff frequency(ies) + Fs sampling frequency in Hz + + Required filter order/transition band width is estimated with the + following heuristic: transition band width is 25% of the lower cutoff + frequency, but not lower than 2 Hz, where possible (for bandpass, + highpass, and bandstop) and distance from passband edge to critical + frequency (DC, Nyquist) otherwise. + + See also FIRWS, FIRWSORD, INVFIRWSORD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/fir_df.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fir_df", *args, **kwargs) diff --git a/fieldtrip/__specest/_fixname.py b/fieldtrip/__specest/_fixname.py new file mode 100644 index 0000000..1d5b18c --- /dev/null +++ b/fieldtrip/__specest/_fixname.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _fixname(*args, **kwargs): + """ + FIXNAME changes all inappropriate characters in a string into '_' + so that it can be used as a filename or as a field name in a structure. + If the string begins with a digit, an 'x' is prepended. + + Use as + str = fixname(str) + + MATLAB 2014a introduces the matlab.lang.makeValidName and + matlab.lang.makeUniqueStrings functions for constructing unique + identifiers, but this particular implementation also works with + older MATLAB versions. + + See also DEBLANK, STRIP, PAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/fixname.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixname", *args, **kwargs) diff --git a/fieldtrip/__specest/_ft_debug.py b/fieldtrip/__specest/_ft_debug.py new file mode 100644 index 0000000..02da1b6 --- /dev/null +++ b/fieldtrip/__specest/_ft_debug.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_debug(*args, **kwargs): + """ + FT_DEBUG prints a debug message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_debug(...) + with arguments similar to fprintf, or + ft_debug(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_debug off + or for specific ones using + ft_debug off msgId + + To switch them back on, you would use + ft_debug on + or for specific ones using + ft_debug on msgId + + Messages are only printed once per timeout period using + ft_debug timeout 60 + ft_debug once + or for specific ones using + ft_debug once msgId + + You can see the most recent messages and identifier using + ft_debug last + + You can query the current on/off/once state for all messages using + ft_debug query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/ft_debug.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_debug", *args, **kwargs) diff --git a/fieldtrip/__specest/_ft_error.py b/fieldtrip/__specest/_ft_error.py new file mode 100644 index 0000000..aa3447b --- /dev/null +++ b/fieldtrip/__specest/_ft_error.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _ft_error(*args, **kwargs): + """ + FT_ERROR prints an error message on screen, just like the standard ERROR function. + + Use as + ft_error(...) + with arguments similar to fprintf, or + ft_error(msgId, ...) + with arguments similar to error. + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/ft_error.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_error", *args, **kwargs) diff --git a/fieldtrip/__specest/_ft_getopt.py b/fieldtrip/__specest/_ft_getopt.py new file mode 100644 index 0000000..018e445 --- /dev/null +++ b/fieldtrip/__specest/_ft_getopt.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def _ft_getopt(*args, **kwargs): + """ + FT_GETOPT gets the value of a specified option from a configuration structure + or from a cell-array with key-value pairs. + + Use as + val = ft_getopt(s, key, default, emptymeaningful) + where the input values are + s = structure or cell-array + key = string + default = any valid MATLAB data type (optional, default = []) + emptymeaningful = boolean value (optional, default = false) + + If the key is present as field in the structure, or as key-value pair in the + cell-array, the corresponding value will be returned. + + If the key is not present, ft_getopt will return the default, or an empty array + when no default was specified. + + If the key is present but has an empty value, then the emptymeaningful flag + specifies whether the empty value or the default value should be returned. + If emptymeaningful==true, then the empty array will be returned. + If emptymeaningful==false, then the specified default will be returned. + + See also FT_SETOPT, FT_CHECKOPT, INPUTPARSER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/ft_getopt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_getopt", *args, **kwargs) diff --git a/fieldtrip/__specest/_ft_info.py b/fieldtrip/__specest/_ft_info.py new file mode 100644 index 0000000..4ae4f98 --- /dev/null +++ b/fieldtrip/__specest/_ft_info.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_info(*args, **kwargs): + """ + FT_INFO prints an info message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_info(...) + with arguments similar to fprintf, or + ft_info(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_info off + or for specific ones using + ft_info off msgId + + To switch them back on, you would use + ft_info on + or for specific ones using + ft_info on msgId + + Messages are only printed once per timeout period using + ft_info timeout 60 + ft_info once + or for specific ones using + ft_info once msgId + + You can see the most recent messages and identifier using + ft_info last + + You can query the current on/off/once state for all messages using + ft_info query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/ft_info.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_info", *args, **kwargs) diff --git a/fieldtrip/__specest/_ft_notice.py b/fieldtrip/__specest/_ft_notice.py new file mode 100644 index 0000000..c08f850 --- /dev/null +++ b/fieldtrip/__specest/_ft_notice.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _ft_notice(*args, **kwargs): + """ + FT_NOTICE prints a notice message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_notice(...) + with arguments similar to fprintf, or + ft_notice(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_notice off + or for specific ones using + ft_notice off msgId + + To switch them back on, you would use + ft_notice on + or for specific ones using + ft_notice on msgId + + Messages are only printed once per timeout period using + ft_notice timeout 60 + ft_notice once + or for specific ones using + ft_notice once msgId + + You can see the most recent messages and identifier using + ft_notice last + + You can query the current on/off/once state for all messages using + ft_notice query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/ft_notice.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_notice", *args, **kwargs) diff --git a/fieldtrip/__specest/_ft_notification.py b/fieldtrip/__specest/_ft_notification.py new file mode 100644 index 0000000..4b4e0e7 --- /dev/null +++ b/fieldtrip/__specest/_ft_notification.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _ft_notification(*args, **kwargs): + """ + FT_NOTIFICATION works mostly like the WARNING and ERROR commands in MATLAB and + is called by FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO and FT_DEBUG. Please note + that you should not call this function directly. + + Some examples: + ft_info on + ft_info on msgId + ft_info off + ft_info off msgId + ft_info once + ft_info once msgId + ft_info on backtrace + ft_info off backtrace + ft_info on verbose + ft_info off verbose + + ft_info query % shows the status of all notifications + ft_info last % shows the last notification + ft_info clear % clears the status of all notifications + ft_info timeout 10 % sets the timeout (for 'once') to 10 seconds + + See also DEFAULTID, FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/ft_notification.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_notification", *args, **kwargs) diff --git a/fieldtrip/__specest/_ft_platform_supports.py b/fieldtrip/__specest/_ft_platform_supports.py new file mode 100644 index 0000000..805ed70 --- /dev/null +++ b/fieldtrip/__specest/_ft_platform_supports.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def _ft_platform_supports(*args, **kwargs): + """ + FT_PLATFORM_SUPPORTS returns a boolean indicating whether the current platform + supports a specific capability + + Use as + status = ft_platform_supports(what) + or + status = ft_platform_supports('matlabversion', min_version, max_version) + + The following values are allowed for the 'what' parameter, which means means that + the specific feature explained on the right is supported: + + 'which-all' which(...,'all') + 'exists-in-private-directory' exists(...) will look in the /private subdirectory to see if a file exists + 'onCleanup' onCleanup(...) + 'alim' alim(...) + 'int32_logical_operations' bitand(a,b) with a, b of type int32 + 'graphics_objects' graphics system is object-oriented + 'libmx_c_interface' libmx is supported through mex in the C-language (recent MATLAB versions only support C++) + 'images' all image processing functions in FieldTrip's external/images directory + 'signal' all signal processing functions in FieldTrip's external/signal directory + 'stats' all statistical functions in FieldTrip's external/stats directory + 'program_invocation_name' program_invocation_name() (GNU Octave) + 'singleCompThread' start MATLAB with -singleCompThread + 'nosplash' start MATLAB with -nosplash + 'nodisplay' start MATLAB with -nodisplay + 'nojvm' start MATLAB with -nojvm + 'no-gui' start GNU Octave with --no-gui + 'RandStream.setGlobalStream' RandStream.setGlobalStream(...) + 'RandStream.setDefaultStream' RandStream.setDefaultStream(...) + 'rng' rng(...) + 'rand-state' rand('state') + 'urlread-timeout' urlread(..., 'Timeout', t) + 'griddata-vector-input' griddata(...,...,...,a,b) with a and b vectors + 'griddata-v4' griddata(...,...,...,...,...,'v4') with v4 interpolation support + 'uimenu' uimenu(...) + 'weboptions' weboptions(...) + 'parula' parula(...) + 'datetime' datetime structure + 'html' html rendering in desktop + + See also FT_VERSION, VERSION, VER, VERLESSTHAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/ft_platform_supports.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_platform_supports", *args, **kwargs) diff --git a/fieldtrip/__specest/_ft_preproc_bandpassfilter.py b/fieldtrip/__specest/_ft_preproc_bandpassfilter.py new file mode 100644 index 0000000..a02726f --- /dev/null +++ b/fieldtrip/__specest/_ft_preproc_bandpassfilter.py @@ -0,0 +1,89 @@ +from fieldtrip._runtime import Runtime + + +def _ft_preproc_bandpassfilter(*args, **kwargs): + """ + FT_PREPROC_BANDPASSFILTER applies a band-pass filter to the data and thereby + removes the spectral components in the data except for the ones in the + specified frequency band. + + Use as + [filt] = ft_preproc_bandpassfilter(dat, Fs, Fbp, order, type, dir, instabilityfix, df, wintype, dev, plotfiltresp, usefftfilt) + where + dat data matrix (Nchans X Ntime) + Fs sampling frequency in Hz + Fbp frequency band, specified as [Fhp Flp] in Hz + order optional filter order, default is 4 (but) or dependent on frequency band and data length (fir/firls) + type optional filter type, can be + 'but' Butterworth IIR filter (default) + 'firws' FIR filter with windowed sinc + 'fir' FIR filter using MATLAB fir1 function + 'firls' FIR filter using MATLAB firls function (requires MATLAB Signal Processing Toolbox) + 'brickwall' frequency-domain filter using forward and inverse FFT + dir optional filter direction, can be + 'onepass' forward filter only + 'onepass-reverse' reverse filter only, i.e. backward in time + 'onepass-zerophase' zero-phase forward filter with delay compensation (default for firws, linear-phase symmetric FIR only) + 'onepass-reverse-zerophase' zero-phase reverse filter with delay compensation + 'onepass-minphase' minimum-phase converted forward filter (non-linear, only for firws) + 'twopass' zero-phase forward and reverse filter (default, except for firws) + 'twopass-reverse' zero-phase reverse and forward filter + 'twopass-average' average of the twopass and the twopass-reverse + instabilityfix optional method to deal with filter instabilities + 'no' only detect and give error (default) + 'reduce' reduce the filter order + 'split' split the filter in two lower-order filters, apply sequentially + df optional transition width (only for firws) + wintype optional window type (only for firws), can be + 'hamming' (default) maximum passband deviation 0.0022 [0.22%], stopband attenuation -53dB + 'hann' maximum passband deviation 0.0063 [0.63%], stopband attenuation -44dB + 'blackman' maximum passband deviation 0.0002 [0.02%], stopband attenuation -74dB + 'kaiser' + dev optional max passband deviation/stopband attenuation (only for firws with kaiser window, default = 0.001 [0.1%, -60 dB]) + plotfiltresp optional, 'yes' or 'no', plot filter responses (only for firws, default = 'no') + usefftfilt optional, 'yes' or 'no', use fftfilt instead of filter (only for firws, default = 'no') + + Note that a one- or two-pass filter has consequences for the strength of the + filter, i.e. a two-pass filter with the same filter order will attenuate the signal + twice as strong. + + Further note that the filter type 'brickwall' filters in the frequency domain, + but may have severe issues. For instance, it has the implication that the time + domain signal is periodic. Another issue pertains to that frequencies are + not well defined over short time intervals; particularly for low frequencies. + + If the data contains NaNs, these will affect the output. With an IIR + filter, and/or with FFT-filtering, local NaNs will spread to the whole + time series. With a FIR filter, local NaNs will spread locally, depending + on the filter order. + + See also PREPROC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/ft_preproc_bandpassfilter.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_bandpassfilter", *args, **kwargs) diff --git a/fieldtrip/__specest/_ft_preproc_polyremoval.py b/fieldtrip/__specest/_ft_preproc_polyremoval.py new file mode 100644 index 0000000..61fd9b3 --- /dev/null +++ b/fieldtrip/__specest/_ft_preproc_polyremoval.py @@ -0,0 +1,63 @@ +from fieldtrip._runtime import Runtime + + +def _ft_preproc_polyremoval(*args, **kwargs): + """ + FT_PREPROC_POLYREMOVAL removed an Nth order polynomal from the data + + Use as + dat = ft_preproc_polyremoval(dat, order, begsample, endsample, flag) + where + dat data matrix (Nchans X Ntime) + order the order of the polynomial + begsample index of the begin sample for the estimate of the polynomial + endsample index of the end sample for the estimate of the polynomial + flag optional boolean to specify whether the first order basis + vector will zscored prior to computing higher order basis + vectors from the first-order basis vector (and the beta + weights). This is to avoid numerical problems with the + inversion of the covariance when the polynomial is of high + order/number of samples is large. + + If begsample and endsample are not specified, it will use the whole + window to estimate the polynomial. + + For example + ft_preproc_polyremoval(dat, 0) + removes the mean value from each channel and + ft_preproc_polyremoval(dat, 1) + removes the mean and the linear trend. + + If the data contains NaNs, these are ignored for the computation, but + retained in the output. + + See also FT_PREPROC_BASELINECORRECT, FT_PREPROC_DETREND + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/ft_preproc_polyremoval.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preproc_polyremoval", *args, **kwargs) diff --git a/fieldtrip/__specest/_ft_version.py b/fieldtrip/__specest/_ft_version.py new file mode 100644 index 0000000..8830c9b --- /dev/null +++ b/fieldtrip/__specest/_ft_version.py @@ -0,0 +1,69 @@ +from fieldtrip._runtime import Runtime + + +def _ft_version(*args, **kwargs): + """ + FT_VERSION returns the version of FieldTrip and the path where it is installed + + FieldTrip is not released with version numbers as "2.0", "2.1", etc. Instead, we + share our development version on http://github.com/fieldtrip/fieldtrip. You can use + git to make a local clone of the development version. Furthermore, we make + more-or-less daily releases of the code available on + https://github.com/fieldtrip/fieldtrip/releases and as zip file on our FTP server. + + If you use git with the development version, the version is labeled with the hash + of the latest commit like "128c693". You can access the specific version "XXXXXX" + at https://github.com/fieldtrip/fieldtrip/commit/XXXXXX. + + If you download the daily released version from our FTP server, the version is part + of the file name "fieldtrip-YYYYMMDD.zip", where YYY, MM and DD correspond to year, + month and day. + + Use as + ft_version + to display the latest revision number on screen, or + [ftver, ftpath] = ft_version + to get the version and the installation root directory. + + When using git with the development version, you can also get additional information with + ft_version revision + ft_version branch + ft_version clean + + On macOS you might have installed git along with Xcode instead of with homebrew, + which then requires that you agree to the Apple license. In that case it can + happen that this function stops, as in the background (invisible to you) it is + asking whether you agree. You can check this by typing "/usr/bin/git", which will + show the normal help message, or which will mention the license agreement. To + resolve this please open a terminal and type "sudo xcodebuild -license" + + See also FT_PLATFORM_SUPPORTS, VERSION, VER, VERLESSTHAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/ft_version.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_version", *args, **kwargs) diff --git a/fieldtrip/__specest/_ft_warning.py b/fieldtrip/__specest/_ft_warning.py new file mode 100644 index 0000000..1d8fbd9 --- /dev/null +++ b/fieldtrip/__specest/_ft_warning.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def _ft_warning(*args, **kwargs): + """ + FT_WARNING prints a warning message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. This function works + similar to the standard WARNING function, but also features the "once" mode. + + Use as + ft_warning(...) + with arguments similar to fprintf, or + ft_warning(msgId, ...) + with arguments similar to warning. + + You can switch of all warning messages using + ft_warning off + or for specific ones using + ft_warning off msgId + + To switch them back on, you would use + ft_warning on + or for specific ones using + ft_warning on msgId + + Warning messages are only printed once per timeout period using + ft_warning timeout 60 + ft_warning once + or for specific ones using + ft_warning once msgId + + You can see the most recent messages and identifier using + ft_warning last + + You can query the current on/off/once state for all messages using + ft_warning query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/ft_warning.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_warning", *args, **kwargs) diff --git a/fieldtrip/__specest/_getsubfield.py b/fieldtrip/__specest/_getsubfield.py new file mode 100644 index 0000000..55c8c3a --- /dev/null +++ b/fieldtrip/__specest/_getsubfield.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _getsubfield(*args, **kwargs): + """ + GETSUBFIELD returns a field from a structure just like the standard + GETFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = getsubfield(s, 'fieldname') + or as + f = getsubfield(s, 'fieldname.subfieldname') + + See also GETFIELD, ISSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/getsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getsubfield", *args, **kwargs) diff --git a/fieldtrip/__specest/_isalmostequal.py b/fieldtrip/__specest/_isalmostequal.py new file mode 100644 index 0000000..dc65f6b --- /dev/null +++ b/fieldtrip/__specest/_isalmostequal.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _isalmostequal(*args, **kwargs): + """ + ISALMOSTEQUAL compares two input variables and returns true/false + and a message containing the details on the observed difference. + + Use as + [ok, message] = isalmostequal(a, b) + [ok, message] = isalmostequal(a, b, ...) + + This works for all possible input variables a and b, like + numerical arrays, string arrays, cell arrays, structures + and nested data types. + + Optional input arguments come in key-value pairs, supported are + 'depth' number, for nested structures + 'abstol' number, absolute tolerance for numerical comparison + 'reltol' number, relative tolerance for numerical comparison + 'diffabs' boolean, check difference between absolute values for numericals (useful for e.g. mixing matrices which have arbitrary signs) + + See also ISEQUAL, ISEQUALNAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/isalmostequal.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("isalmostequal", *args, **kwargs) diff --git a/fieldtrip/__specest/_issubfield.py b/fieldtrip/__specest/_issubfield.py new file mode 100644 index 0000000..46add60 --- /dev/null +++ b/fieldtrip/__specest/_issubfield.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _issubfield(*args, **kwargs): + """ + ISSUBFIELD tests for the presence of a field in a structure just like the standard + Matlab ISFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = issubfield(s, 'fieldname') + or as + f = issubfield(s, 'fieldname.subfieldname') + + This function returns true if the field is present and false if the field + is not present. + + See also ISFIELD, GETSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/issubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("issubfield", *args, **kwargs) diff --git a/fieldtrip/__specest/_istrue.py b/fieldtrip/__specest/_istrue.py new file mode 100644 index 0000000..44827b6 --- /dev/null +++ b/fieldtrip/__specest/_istrue.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _istrue(*args, **kwargs): + """ + ISTRUE converts an input argument like "yes/no", "true/false" or "on/off" into a + boolean. If the input is boolean, then it will remain like that. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/istrue.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("istrue", *args, **kwargs) diff --git a/fieldtrip/__specest/_keyval.py b/fieldtrip/__specest/_keyval.py new file mode 100644 index 0000000..e9d169f --- /dev/null +++ b/fieldtrip/__specest/_keyval.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _keyval(*args, **kwargs): + """ + KEYVAL returns the value that corresponds to the requested key in a + key-value pair list of variable input arguments + + Use as + [val] = keyval(key, varargin) + + See also VARARGIN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/keyval.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("keyval", *args, **kwargs) diff --git a/fieldtrip/__specest/_keyvalcheck.py b/fieldtrip/__specest/_keyvalcheck.py new file mode 100644 index 0000000..090c213 --- /dev/null +++ b/fieldtrip/__specest/_keyvalcheck.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _keyvalcheck(*args, **kwargs): + """ + KEYVALCHECK is a helper function for parsing optional key-value input pairs. + + Use as + keyvalcheck(argin, 'required', {'key1', 'key2', ...}) + keyvalcheck(argin, 'forbidden', {'key1', 'key2', ...}) + keyvalcheck(argin, 'optional', {'key1', 'key2', ...}) + + See also KEYVAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/keyvalcheck.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("keyvalcheck", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__specest/_rmsubfield.py b/fieldtrip/__specest/_rmsubfield.py new file mode 100644 index 0000000..b8fa7f4 --- /dev/null +++ b/fieldtrip/__specest/_rmsubfield.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _rmsubfield(*args, **kwargs): + """ + RMSUBFIELD removes the contents of the specified field from a structure + just like the standard Matlab RMFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = rmsubfield(s, 'fieldname') + or as + s = rmsubfield(s, 'fieldname.subfieldname') + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/rmsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rmsubfield", *args, **kwargs) diff --git a/fieldtrip/__specest/_setsubfield.py b/fieldtrip/__specest/_setsubfield.py new file mode 100644 index 0000000..43d77c4 --- /dev/null +++ b/fieldtrip/__specest/_setsubfield.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _setsubfield(*args, **kwargs): + """ + SETSUBFIELD sets the contents of the specified field to a specified value + just like the standard Matlab SETFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = setsubfield(s, 'fieldname', value) + or as + s = setsubfield(s, 'fieldname.subfieldname', value) + + where nested is a logical, false denoting that setsubfield will create + s.subfieldname instead of s.fieldname.subfieldname + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/setsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("setsubfield", *args, **kwargs) diff --git a/fieldtrip/__specest/_sine_taper.py b/fieldtrip/__specest/_sine_taper.py new file mode 100644 index 0000000..568fa14 --- /dev/null +++ b/fieldtrip/__specest/_sine_taper.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _sine_taper(*args, **kwargs): + """ + Compute Riedel & Sidorenko sine tapers. + sine_taper(n, k) produces the first 2*k tapers of length n, + returned as the columns of d. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/sine_taper.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sine_taper", *args, **kwargs) diff --git a/fieldtrip/__specest/_sine_taper_scaled.py b/fieldtrip/__specest/_sine_taper_scaled.py new file mode 100644 index 0000000..c44517e --- /dev/null +++ b/fieldtrip/__specest/_sine_taper_scaled.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _sine_taper_scaled(*args, **kwargs): + """ + Compute Riedel & Sidorenko sine tapers. + sine_taper_scaled(n, k) produces the first 2*k tapers of length n, + returned as the columns of d. The norm of the tapers will not be 1. The + norm is a function of the number of the taper in the sequence. This is to + mimick behavior of the scaling of the resulting powerspectra prior to + april 29, 2011. Before april 29, 2011, equivalent scaling was applied to + the powerspectra of the tapered data segments, prior to averaging. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/private/sine_taper_scaled.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sine_taper_scaled", *args, **kwargs) diff --git a/fieldtrip/__specest/ft_specest_hilbert.py b/fieldtrip/__specest/ft_specest_hilbert.py new file mode 100644 index 0000000..a008623 --- /dev/null +++ b/fieldtrip/__specest/ft_specest_hilbert.py @@ -0,0 +1,61 @@ +from fieldtrip._runtime import Runtime + + +def ft_specest_hilbert(*args, **kwargs): + """ + FT_SPECEST_HILBERT performs a spectral estimation of data by repeatedly applying a + bandpass filter and then doing a Hilbert transform. + + Use as + [spectrum, freqoi, timeoi] = ft_specest_hilbert(dat, time, ...) + where the input arguments are + dat = matrix of chan*sample + time = vector, containing time in seconds for each sample + and the output arguments are + spectrum = matrix of nchan*nfreq*ntime of fourier coefficients + freqoi = vector of frequencies in spectrum + timeoi = vector of timebins in spectrum + + Optional arguments should be specified in key-value pairs and can include + timeoi = vector, containing time points of interest (in seconds) + freqoi = vector, containing frequencies (in Hz) + pad = number, indicating time-length of data to be padded out to in seconds (split over pre/post; used for spectral interpolation, NOT filtering) + padtype = string, indicating type of padding to be used, can be 'zero', 'mean', 'localmean', 'edge', or 'mirror' (default = 'zero') + width = number or vector, width of band-pass surrounding each element of freqoi + bpfilttype = string, filter type, 'but', 'firws', 'fir', 'firls' + bpfiltord = number or vector, filter order + bpfiltdir = string, filter direction, 'onepass', 'onepass-reverse', 'onepass-zerophase', 'onepass-reverse-zerophase', 'onepass-minphase', 'twopass', 'twopass-reverse', 'twopass-average' + edgeartnan = 0 (default) or 1, replace edge artifacts due to filtering with NaNs (only applicable for bpfilttype = 'fir'/'firls'/'firws') + polyorder = number, the order of the polynomial to fitted to and removed from the data prior to the fourier transform (default = 0 -> remove DC-component) + verbose = output progress to console (0 or 1, default 1) + + See also FT_FREQANALYSIS, FT_SPECEST_MTMFFT, FT_SPECEST_TFR, FT_SPECEST_MTMCONVOL, FT_SPECEST_WAVELET + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/ft_specest_hilbert.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_specest_hilbert", *args, **kwargs) diff --git a/fieldtrip/__specest/ft_specest_irasa.py b/fieldtrip/__specest/ft_specest_irasa.py new file mode 100644 index 0000000..16b3a4c --- /dev/null +++ b/fieldtrip/__specest/ft_specest_irasa.py @@ -0,0 +1,63 @@ +from fieldtrip._runtime import Runtime + + +def ft_specest_irasa(*args, **kwargs): + """ + FT_SPECEST_IRASA separates the fractal components from the orginal power spectrum + using Irregular-Resampling Auto-Spectral Analysis (IRASA) + + Use as + [spectrum, ntaper, freqoi] = ft_specest_irasa(dat, time, ...) + where the input arguments are + dat = matrix of chan*sample + time = vector, containing time in seconds for each sample + and the output arguments are + spectrum = matrix of taper*chan*freqoi of fourier coefficients + ntaper = vector containing number of tapers per element of freqoi + freqoi = vector of frequencies in spectrum + + Optional arguments should be specified in key-value pairs and can include + freqoi = vector, containing frequencies of interest + output = string, indicating type of output ('fractal' or 'original', default 'fractal') + pad = number, total length of data after zero padding (in seconds) + padtype = string, indicating type of padding to be used, can be 'zero', 'mean', 'localmean', 'edge', or 'mirror' (default = 'zero') + polyorder = number, the order of the polynomial to fitted to and removed from the data prior to the Fourier transform (default = 0, which removes the DC-component) + verbose = boolean, output progress to console (0 or 1, default 1) + + This implements: Wen.H. & Liu.Z.(2016), Separating fractal and oscillatory components in the power + spectrum of neurophysiological signal. Brain Topogr. 29(1):13-26. The source code accompanying the + original paper is avaible from https://purr.purdue.edu/publications/1987/1 + + For more information about the difference between the current and previous version and how to use this + function, please see https://www.fieldtriptoolbox.org/example/irasa/ + + See also FT_FREQANALYSIS, FT_SPECEST_MTMFFT, FT_SPECEST_MTMCONVOL, FT_SPECEST_TFR, FT_SPECEST_HILBERT, FT_SPECEST_WAVELET + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/ft_specest_irasa.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_specest_irasa", *args, **kwargs) diff --git a/fieldtrip/__specest/ft_specest_mtmconvol.py b/fieldtrip/__specest/ft_specest_mtmconvol.py new file mode 100644 index 0000000..ec4ce2a --- /dev/null +++ b/fieldtrip/__specest/ft_specest_mtmconvol.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def ft_specest_mtmconvol(*args, **kwargs): + """ + FT_SPECEST_MTMCONVOL performs wavelet convolution in the time domain by + multiplication in the frequency domain. + + Use as + [spectrum, ntaper, freqoi, timeoi] = ft_specest_mtmconvol(dat, time, ...) + where the input arguments are + dat = matrix of chan*sample + time = vector, containing time in seconds for each sample + and the ouitput arguments are + spectrum = matrix of ntaper*chan*freqoi*timeoi of fourier coefficients + ntaper = vector containing the number of tapers per freqoi + freqoi = vector of frequencies in spectrum + timeoi = vector of timebins in spectrum + + Optional arguments should be specified in key-value pairs and can include + freqoi = vector, containing frequencies (in Hz) + timeoi = vector, containing time points of interest (in seconds) + timwin = vector, containing length of time windows (in seconds) + taper = 'dpss', 'hanning' or many others, see WINDOW (default = 'dpss') + taperopt = additional taper options to be used in the WINDOW function, see WINDOW + tapsmofrq = number, the amount of spectral smoothing through multi-tapering. Note: 4 Hz smoothing means plus-minus 4 Hz, i.e. a 8 Hz smoothing box + pad = number, indicating time-length of data to be padded out to in seconds + padtype = string, indicating type of padding to be used (see ft_preproc_padding, default: zero) + dimord = 'tap_chan_freq_time' (default) or 'chan_time_freqtap' for memory efficiency + polyorder = number, the order of the polynomial to fitted to and removed from the data prior to the fourier transform (default = 0 -> remove DC-component) + verbose = output progress to console (0 or 1, default 1) + + See also FT_FREQANALYSIS, FT_SPECEST_MTMFFT, FT_SPECEST_TFR, FT_SPECEST_HILBERT, FT_SPECEST_WAVELET + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/ft_specest_mtmconvol.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_specest_mtmconvol", *args, **kwargs) diff --git a/fieldtrip/__specest/ft_specest_mtmfft.py b/fieldtrip/__specest/ft_specest_mtmfft.py new file mode 100644 index 0000000..4e6cd1c --- /dev/null +++ b/fieldtrip/__specest/ft_specest_mtmfft.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def ft_specest_mtmfft(*args, **kwargs): + """ + FT_SPECEST_MTMFFT computes a fast Fourier transform using multitapering with + multiple tapers from the DPSS sequence or using a variety of single tapers. + + Use as + [spectrum, ntaper, freqoi] = ft_specest_mtmfft(dat, time, ...) + where the input arguments are + dat = matrix of chan*sample + time = vector, containing time in seconds for each sample + and the output arguments are + spectrum = matrix of ntaper*nchan*nfreq of fourier coefficients + ntaper = vector containing number of tapers per element of freqoi + freqoi = vector of frequencies in spectrum + + Optional arguments should be specified in key-value pairs and can include + freqoi = vector, containing frequencies of interest + taper = 'dpss', 'hanning' or many others, see WINDOW (default = 'dpss') + taperopt = additional taper options to be used in the WINDOW function, see WINDOW + tapsmofrq = the amount of spectral smoothing through multi-tapering. Note: 4 Hz smoothing means plus-minus 4 Hz, i.e. a 8 Hz smoothing box + pad = number, total length of data after zero padding (in seconds) + padtype = string, indicating type of padding to be used, can be 'zero', 'mean', 'localmean', 'edge', or 'mirror' (default = 'zero') + dimord = 'tap_chan_freq' (default) or 'chan_time_freqtap' for memory efficiency (only when using variable number of slepian tapers) + polyorder = number, the order of the polynomial to fitted to and removed from the data prior to the fourier transform (default = 0 -> remove DC-component) + verbose = output progress to console (0 or 1, default 1) + + See also FT_FREQANALYSIS, FT_SPECEST_MTMCONVOL, FT_SPECEST_TFR, FT_SPECEST_HILBERT, FT_SPECEST_WAVELET + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/ft_specest_mtmfft.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_specest_mtmfft", *args, **kwargs) diff --git a/fieldtrip/__specest/ft_specest_neuvar.py b/fieldtrip/__specest/ft_specest_neuvar.py new file mode 100644 index 0000000..22d7c5e --- /dev/null +++ b/fieldtrip/__specest/ft_specest_neuvar.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def ft_specest_neuvar(*args, **kwargs): + """ + FT_SPECEST_NEUVAR computes a time-domain estimation of overall signal power, having + compensated for the 1/f distribution of spectral content. + + Use as + [spectrum, freqoi] = ft_specest_neuvar(dat, time...) + where the input arguments are + dat = matrix of chan*sample + time = vector, containing time in seconds for each sample + and the output arguments are + spectrum = matrix of chan*neuvar + freqoi = vector of frequencies in spectrum + + Optional arguments should be specified in key-value pairs and can include + order = number, the order of differentation for compensating for the 1/f (default = 1) + pad = number, total length of data after zero padding (in seconds) + padtype = string, indicating type of padding to be used, can be 'zero', 'mean', 'localmean', 'edge', or 'mirror' (default = 'zero') + polyorder = number, the order of the polynomial to fitted to and removed from the data prior to the Fourier transform (default = 0, which removes the DC-component) + verbose = output progress to console (0 or 1, default 1) + + See also FT_FREQANALYSIS, FT_SPECEST_MTMFFT, FT_SPECEST_MTMCONVOL, FT_SPECEST_TFR, FT_SPECEST_HILBERT, FT_SPECEST_WAVELET + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/ft_specest_neuvar.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_specest_neuvar", *args, **kwargs) diff --git a/fieldtrip/__specest/ft_specest_tfr.py b/fieldtrip/__specest/ft_specest_tfr.py new file mode 100644 index 0000000..2338c63 --- /dev/null +++ b/fieldtrip/__specest/ft_specest_tfr.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def ft_specest_tfr(*args, **kwargs): + """ + FT_SPECEST_TFR performs time-frequency analysis on any time series trial data using + the 'wavelet method' based on Morlet wavelets, doing convolution in the time + domain. + + Use as + [spectrum, freqoi, timeoi] = ft_specest_convol(dat, time, ...) + where the input arguments are + dat = matrix of nchan*nsample + time = vector, containing time in seconds for each sample + and the output arguments are + spectrum = array of nchan*nfreq*ntime of fourier coefficients + freqoi = vector of frequencies in spectrum + timeoi = vector of timebins in spectrum + + Optional arguments should be specified in key-value pairs and can include + timeoi = vector, containing time points of interest (in seconds, analysis window will be centered around these time points) + freqoi = vector, containing frequencies (in Hz) + width = number or vector, width of the wavelet, determines the temporal and spectral resolution (default = 7) + gwidth = number, determines the length of the used wavelets in standard deviations of the implicit Gaussian kernel + polyorder = number, the order of the polynomial to fitted to and removed from the data prior to the fourier transform (default = 0 -> remove DC-component) + verbose = output progress to console (0 or 1, default 1) + + See also FT_FREQANALYSIS, FT_SPECEST_MTMFFT, FT_SPECEST_MTMCONVOL, FT_SPECEST_HILBERT, FT_SPECEST_NANFFT, FT_SPECEST_WAVELET + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/ft_specest_tfr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_specest_tfr", *args, **kwargs) diff --git a/fieldtrip/__specest/ft_specest_wavelet.py b/fieldtrip/__specest/ft_specest_wavelet.py new file mode 100644 index 0000000..141d11f --- /dev/null +++ b/fieldtrip/__specest/ft_specest_wavelet.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def ft_specest_wavelet(*args, **kwargs): + """ + FT_SPECEST_WAVELET performs time-frequency analysis on any time series trial data + using the 'wavelet method' based on Morlet wavelets, doing convolution in the time + domain by multiplication in the frequency domain. + + Use as + [spectrum, freqoi, timeoi] = ft_specest_wavelet(dat, time, ...) + where the input arguments are + dat = matrix of chan*sample + time = vector, containing time in seconds for each sample + and the output arguments are + spectrum = array of chan*freqoi*timeoi of fourier coefficients + freqoi = vector of frequencies in spectrum + timeoi = vector of timebins in spectrum + + Optional arguments should be specified in key-value pairs and can include + timeoi = vector, containing time points of interest (in seconds) + freqoi = vector, containing frequencies of interest + width = number or vector, width of the wavelet, determines the temporal and spectral resolution + gwidth = number, determines the length of the used wavelets in standard deviations of the implicit Gaussian kernel + pad = number, total length of data after zero padding (in seconds) + padtype = string, indicating type of padding to be used, can be 'zero', 'mean', 'localmean', 'edge', or 'mirror' (default = 'zero') + polyorder = number, the order of the polynomial to fitted to and removed from the data prior to the fourier transform (default = 0 -> remove DC-component) + verbose = output progress to console (0 or 1, default 1) + + See also FT_FREQANALYSIS, FT_SPECEST_MTMCONVOL, FT_SPECEST_TFR, FT_SPECEST_HILBERT, FT_SPECEST_MTMFFT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/specest/ft_specest_wavelet.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_specest_wavelet", *args, **kwargs) diff --git a/fieldtrip/__src/__init__.py b/fieldtrip/__src/__init__.py new file mode 100644 index 0000000..7b01547 --- /dev/null +++ b/fieldtrip/__src/__init__.py @@ -0,0 +1,56 @@ +from .det2x2 import det2x2 +from .det3x3 import det3x3 +from .getpid import getpid +from .inv2x2 import inv2x2 +from .inv3x3 import inv3x3 +from .lmoutr import lmoutr +from .ltrisect import ltrisect +from .meg_leadfield1 import meg_leadfield1 +from .mtimes2x2 import mtimes2x2 +from .mtimes3x3 import mtimes3x3 +from .mxDeserialize import mxDeserialize +from .mxSerialize import mxSerialize +from .nanvar import nanvar +from .plgndr import plgndr +from .plinproj import plinproj +from .ptriproj import ptriproj +from .read_16bit import read_16bit +from .read_24bit import read_24bit +from .read_ctf_shm import read_ctf_shm +from .rfbevent import rfbevent +from .routlm import routlm +from .sandwich2x2 import sandwich2x2 +from .sandwich3x3 import sandwich3x3 +from .solid_angle import solid_angle +from .splint_gh import splint_gh +from .write_ctf_shm import write_ctf_shm + + +__all__ = [ + "det2x2", + "det3x3", + "getpid", + "inv2x2", + "inv3x3", + "lmoutr", + "ltrisect", + "meg_leadfield1", + "mtimes2x2", + "mtimes3x3", + "mxDeserialize", + "mxSerialize", + "nanvar", + "plgndr", + "plinproj", + "ptriproj", + "read_16bit", + "read_24bit", + "read_ctf_shm", + "rfbevent", + "routlm", + "sandwich2x2", + "sandwich3x3", + "solid_angle", + "splint_gh", + "write_ctf_shm", +] diff --git a/fieldtrip/__src/det2x2.py b/fieldtrip/__src/det2x2.py new file mode 100644 index 0000000..5fc11bb --- /dev/null +++ b/fieldtrip/__src/det2x2.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def det2x2(*args, **kwargs): + """ + DET2X2 computes determinant of matrix x, using explicit analytic definition + if size(x,1) < 4, otherwise use MATLAB det-function + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/det2x2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("det2x2", *args, **kwargs) diff --git a/fieldtrip/__src/det3x3.py b/fieldtrip/__src/det3x3.py new file mode 100644 index 0000000..027d2c9 --- /dev/null +++ b/fieldtrip/__src/det3x3.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def det3x3(*args, **kwargs): + """ + DET3X3 computes determinant of matrix x, using explicit analytic definition + if size(x) = [3 3 K M] + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/det3x3.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("det3x3", *args, **kwargs) diff --git a/fieldtrip/__src/getpid.py b/fieldtrip/__src/getpid.py new file mode 100644 index 0000000..668cd4d --- /dev/null +++ b/fieldtrip/__src/getpid.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def getpid(*args, **kwargs): + """ + GETPID returns the process identifier (PID) of the current Matlab + process. + + Use as + num = getpid; + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/getpid.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getpid", *args, **kwargs) diff --git a/fieldtrip/__src/inv2x2.py b/fieldtrip/__src/inv2x2.py new file mode 100644 index 0000000..ac6b0ab --- /dev/null +++ b/fieldtrip/__src/inv2x2.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def inv2x2(*args, **kwargs): + """ + INV2X2 computes inverse of matrix x, using explicit analytic definition + if size(x,1) < 4, otherwise use MATLAB inv-function + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/inv2x2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("inv2x2", *args, **kwargs) diff --git a/fieldtrip/__src/inv3x3.py b/fieldtrip/__src/inv3x3.py new file mode 100644 index 0000000..fce3af4 --- /dev/null +++ b/fieldtrip/__src/inv3x3.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def inv3x3(*args, **kwargs): + """ + INV3X3 computes inverse of matrix x, using explicit analytic definition + if size(x) = [3 3 K M] + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/inv3x3.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("inv3x3", *args, **kwargs) diff --git a/fieldtrip/__src/lmoutr.py b/fieldtrip/__src/lmoutr.py new file mode 100644 index 0000000..e62b690 --- /dev/null +++ b/fieldtrip/__src/lmoutr.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def lmoutr(*args, **kwargs): + """ + LMOUTR computes the la/mu parameters of a point projected to a triangle + + Use as + [la, mu, dist] = lmoutr(v1, v2, v3, r) + where v1, v2 and v3 are three vertices of the triangle, and r is + the point that is projected onto the plane spanned by the vertices + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/lmoutr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("lmoutr", *args, **kwargs) diff --git a/fieldtrip/__src/ltrisect.py b/fieldtrip/__src/ltrisect.py new file mode 100644 index 0000000..181f845 --- /dev/null +++ b/fieldtrip/__src/ltrisect.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def ltrisect(*args, **kwargs): + """ + LTRISECT intersects a line with a plane spanned by three vertices + + Use as + [sect] = ltrisect(v1, v2, v3, l1, l2) + where v1, v2 and v3 are three vertices spanning the plane, and l1 and l2 + are two points on the line + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/ltrisect.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ltrisect", *args, **kwargs) diff --git a/fieldtrip/__src/meg_leadfield1.py b/fieldtrip/__src/meg_leadfield1.py new file mode 100644 index 0000000..8a6361c --- /dev/null +++ b/fieldtrip/__src/meg_leadfield1.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def meg_leadfield1(*args, **kwargs): + """ + MEG_LEADFIELD1 magnetic leadfield for a dipole in a homogenous sphere + + [lf] = meg_leadfield1(R, pos, ori) + + with input arguments + R position dipole + pos position magnetometers + ori orientation magnetometers + + The center of the homogenous sphere is in the origin, the field + of the dipole is not dependent on the sphere radius. + + This function is also implemented as MEX file. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/meg_leadfield1.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("meg_leadfield1", *args, **kwargs) diff --git a/fieldtrip/__src/mtimes2x2.py b/fieldtrip/__src/mtimes2x2.py new file mode 100644 index 0000000..7a4b686 --- /dev/null +++ b/fieldtrip/__src/mtimes2x2.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def mtimes2x2(*args, **kwargs): + """ + MTIMES2X2 compute x*y where the dimensionatity is 2x2xN or 2x2xNxM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/mtimes2x2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mtimes2x2", *args, **kwargs) diff --git a/fieldtrip/__src/mtimes3x3.py b/fieldtrip/__src/mtimes3x3.py new file mode 100644 index 0000000..f637a75 --- /dev/null +++ b/fieldtrip/__src/mtimes3x3.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def mtimes3x3(*args, **kwargs): + """ + MTIMES3X3 compute x*y where the dimensionatity is 3x3xN or 3x3xNxM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/mtimes3x3.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mtimes3x3", *args, **kwargs) diff --git a/fieldtrip/__src/mxDeserialize.py b/fieldtrip/__src/mxDeserialize.py new file mode 100644 index 0000000..d146454 --- /dev/null +++ b/fieldtrip/__src/mxDeserialize.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def mxDeserialize(*args, **kwargs): + """ + MXDESERIALIZE reconstructs a MATLAB object from a uint8 array suitable + for passing down a comms channel to be reconstructed at the other end. + + See also MXSERIALIZE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/mxDeserialize.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mxDeserialize", *args, **kwargs) diff --git a/fieldtrip/__src/mxSerialize.py b/fieldtrip/__src/mxSerialize.py new file mode 100644 index 0000000..2f3e734 --- /dev/null +++ b/fieldtrip/__src/mxSerialize.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def mxSerialize(*args, **kwargs): + """ + MXSERIALIZE converts any MATLAB object into a uint8 array suitable + for passing down a comms channel to be reconstructed at the other end. + + See also MXDESERIALIZE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/mxSerialize.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mxSerialize", *args, **kwargs) diff --git a/fieldtrip/__src/nanvar.py b/fieldtrip/__src/nanvar.py new file mode 100644 index 0000000..48f71ec --- /dev/null +++ b/fieldtrip/__src/nanvar.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def nanvar(*args, **kwargs): + """ + FORMAT: Y = NANVAR(X,FLAG,DIM) + + This file is intended as a drop-in replacement for Matlab's nanvar. It + originally forms part of the NaN suite: + http://www.mathworks.com/matlabcentral/fileexchange/6837-nan-suite/ + and was modified to be compatible. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/nanvar.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nanvar", *args, **kwargs) diff --git a/fieldtrip/__src/plgndr.py b/fieldtrip/__src/plgndr.py new file mode 100644 index 0000000..b55a5d7 --- /dev/null +++ b/fieldtrip/__src/plgndr.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def plgndr(*args, **kwargs): + """ + PLGNDR associated Legendre function + + y = plgndr(n,k,x) computes the values of the associated Legendre functions + of degree N and order K + + implemented as MEX file + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/plgndr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("plgndr", *args, **kwargs) diff --git a/fieldtrip/__src/plinproj.py b/fieldtrip/__src/plinproj.py new file mode 100644 index 0000000..07f398e --- /dev/null +++ b/fieldtrip/__src/plinproj.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def plinproj(*args, **kwargs): + """ + PLINPROJ projects a point onto a line or linepiece + + Use as + [proj, dist] = plinproj(l1, l2, r, flag) + where l1 and l2 are the begin and endpoint of the linepiece, and r is + the point that is projected onto the line + + the optional flag can be: + 0 (default) project the point anywhere on the complete line + 1 project the point within or on the edge of the linepiece + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/plinproj.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("plinproj", *args, **kwargs) diff --git a/fieldtrip/__src/ptriproj.py b/fieldtrip/__src/ptriproj.py new file mode 100644 index 0000000..d2cb5b2 --- /dev/null +++ b/fieldtrip/__src/ptriproj.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def ptriproj(*args, **kwargs): + """ + PTRIPROJ projects a point onto the plane going through a triangle + + Use as + [proj, dist] = ptriproj(v1, v2, v3, r, flag) + where v1, v2 and v3 are three vertices of the triangle, and r is + the point that is projected onto the plane spanned by the vertices + + the optional flag can be: + 0 (default) project the point anywhere on the complete plane + 1 project the point within or on the edge of the triangle + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/ptriproj.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ptriproj", *args, **kwargs) diff --git a/fieldtrip/__src/read_16bit.py b/fieldtrip/__src/read_16bit.py new file mode 100644 index 0000000..d583ff5 --- /dev/null +++ b/fieldtrip/__src/read_16bit.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def read_16bit(*args, **kwargs): + """ + READ_16BIT read a stream of 16 bit values and converts them to doubles + This function is designed for EDF files and is implemented as mex + file for efficiency. + + Use as + [dat] = read_16bit(filename, offset, numwords); + + See also READ_24BIT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/read_16bit.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_16bit", *args, **kwargs) diff --git a/fieldtrip/__src/read_24bit.py b/fieldtrip/__src/read_24bit.py new file mode 100644 index 0000000..2b5bdb3 --- /dev/null +++ b/fieldtrip/__src/read_24bit.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def read_24bit(*args, **kwargs): + """ + READ_24BIT read a stream of 24 bit values and converts them to doubles + This function is designed for Biosemi BDF files and is implemented as mex + file for efficiency. + + Use as + [dat] = read_24bit(filename, offset, numwords); + + See also READ_16BIT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/read_24bit.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_24bit", *args, **kwargs) diff --git a/fieldtrip/__src/read_ctf_shm.py b/fieldtrip/__src/read_ctf_shm.py new file mode 100644 index 0000000..a46e692 --- /dev/null +++ b/fieldtrip/__src/read_ctf_shm.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def read_ctf_shm(*args, **kwargs): + """ + READ_CTF_SHM reads metainformation or selected blocks of data from + shared memory. This function can be used for real-time processing of + data while it is being acquired. + + Use as + [msgType msgId sampleNumber numSamples numChannels] = read_ctf_shm; + or + [data] = read_ctf_shm(msgNumber); + [data] = read_ctf_shm(msgNumber, numValues); + + See also WRITE_CTF_SHM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/read_ctf_shm.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_shm", *args, **kwargs) diff --git a/fieldtrip/__src/rfbevent.py b/fieldtrip/__src/rfbevent.py new file mode 100644 index 0000000..dd8a74b --- /dev/null +++ b/fieldtrip/__src/rfbevent.py @@ -0,0 +1,71 @@ +from fieldtrip._runtime import Runtime + + +def rfbevent(*args, **kwargs): + """ + RFBEVENT sends a keyboard or mouse event to a VNC server + + RFB ("remote frame buffer") is a simple protocol for remote access to + graphical user interfaces. Because it works at the framebuffer level it + is applicable to all windowing systems and applications, including X11, + Windows and Macintosh. RFB is the protocol used in VNC (Virtual Network + Computing). + + The remote endpoint where the user sits (i.e. the display plus keyboard + and/or pointer) is called the RFB client or viewer. The endpoint where + changes to the framebuffer originate (i.e. the windowing system and + applications) is known as the RFB server. + + Use as + rfbevent(display, passwd, eventtype, eventvalue, ...) + + Some examples + rfbevent('vncserver:5901', 'yourpasswd', 'Text', 'xclock') % type multiple characters + rfbevent('vncserver:5901', 'yourpasswd', 'Button', 'Return') % single key event, press and release + rfbevent('vncserver:5901', 'yourpasswd', 'Button', 'Return', 0) % single key event, press and release + rfbevent('vncserver:5901', 'yourpasswd', 'Button', 'Return', 1) % single key event, press only + rfbevent('vncserver:5901', 'yourpasswd', 'Button', 'Return', -1) % single key event, release only + rfbevent('vncserver:5901', 'yourpasswd', 'Pointer', [20 100]) % only mouse position + rfbevent('vncserver:5901', 'yourpasswd', 'Pointer', [20 100 1]) % mouse position and button 1, press and release + rfbevent('vncserver:5901', 'yourpasswd', 'Pointer', [20 100 1], 0) % mouse position and button 1, press and release + rfbevent('vncserver:5901', 'yourpasswd', 'Pointer', [20 100 1], 1) % mouse position and button 1, press only + rfbevent('vncserver:5901', 'yourpasswd', 'Pointer', [20 100 1], -1) % mouse position and button 1, release only + + Note that the password has to be represented as plain text in the matlab + script/function that is using RFBEVENT, which poses a potential security + problem. The password is sent over the network to the VNC server after + being encrypted. + + This implements the KeyEvent and PointerEvent messages according to + "The RFB Protocol" by Tristan Richardson (RealVNC Ltd, formerly of + Olivetti Research Ltd / AT&T Labs Cambridge) Version 3.8 (Last updated 8 + June 2007), http://www.realvnc.com/docs/rfbproto.pdf + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/rfbevent.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rfbevent", *args, **kwargs) diff --git a/fieldtrip/__src/routlm.py b/fieldtrip/__src/routlm.py new file mode 100644 index 0000000..1d043f5 --- /dev/null +++ b/fieldtrip/__src/routlm.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def routlm(*args, **kwargs): + """ + ROUTLM computes the projection of a point from its la/mu parameters + these equal the "Barycentric" coordinates + + Use as + [proj] = routlm(v1, v2, v3, la, mu) + where v1, v2 and v3 are three vertices of the triangle + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/routlm.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("routlm", *args, **kwargs) diff --git a/fieldtrip/__src/sandwich2x2.py b/fieldtrip/__src/sandwich2x2.py new file mode 100644 index 0000000..f94c819 --- /dev/null +++ b/fieldtrip/__src/sandwich2x2.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def sandwich2x2(*args, **kwargs): + """ + SANDWICH2X2 compute x*y*x' provided y is Hermitian and dimensionality is 2x2xN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/sandwich2x2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sandwich2x2", *args, **kwargs) diff --git a/fieldtrip/__src/sandwich3x3.py b/fieldtrip/__src/sandwich3x3.py new file mode 100644 index 0000000..36123ba --- /dev/null +++ b/fieldtrip/__src/sandwich3x3.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def sandwich3x3(*args, **kwargs): + """ + SANDWICH3X3 compute x*y*x' provided y is Hermitian and dimensionality is 3x3xN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/sandwich3x3.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sandwich3x3", *args, **kwargs) diff --git a/fieldtrip/__src/solid_angle.py b/fieldtrip/__src/solid_angle.py new file mode 100644 index 0000000..f258593 --- /dev/null +++ b/fieldtrip/__src/solid_angle.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def solid_angle(*args, **kwargs): + """ + SOLID_ANGLE of a planar triangle as seen from the origin + + The solid angle W subtended by a surface S is defined as the surface + area W of a unit sphere covered by the surface's projection onto the + sphere. Solid angle is measured in steradians, and the solid angle + corresponding to all of space being subtended is 4*pi sterradians. + + Use: + [w] = solid_angle(v1, v2, v3) + or + [w] = solid_angle(pnt, tri) + where v1, v2 and v3 are the vertices of a single triangle in 3D or + pnt and tri contain a description of a triangular mesh (this will + compute the solid angle for each triangle) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/solid_angle.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("solid_angle", *args, **kwargs) diff --git a/fieldtrip/__src/splint_gh.py b/fieldtrip/__src/splint_gh.py new file mode 100644 index 0000000..6a08fba --- /dev/null +++ b/fieldtrip/__src/splint_gh.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def splint_gh(*args, **kwargs): + """ + SPLINT_GH implements equations (3) and (5b) of Perrin 1989 + for simultaneous computation of multiple values + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/splint_gh.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("splint_gh", *args, **kwargs) diff --git a/fieldtrip/__src/write_ctf_shm.py b/fieldtrip/__src/write_ctf_shm.py new file mode 100644 index 0000000..bf7e00d --- /dev/null +++ b/fieldtrip/__src/write_ctf_shm.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def write_ctf_shm(*args, **kwargs): + """ + WRITE_CTF_SHM writes metainformation and data as a packet to shared memory. + This function can be used for real-time processing of data while it is + being acquired. + + Use as + write_ctf_shm(msgType, msgId, sampleNumber, numSamples, numChannels, data); + + See also READ_CTF_SHM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/src/write_ctf_shm.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_ctf_shm", *args, **kwargs) diff --git a/fieldtrip/__statfun/__init__.py b/fieldtrip/__statfun/__init__.py new file mode 100644 index 0000000..3ac2158 --- /dev/null +++ b/fieldtrip/__statfun/__init__.py @@ -0,0 +1,40 @@ +from .ft_statfun_actvsblT import ft_statfun_actvsblT +from .ft_statfun_bayesfactor import ft_statfun_bayesfactor +from .ft_statfun_cohensd import ft_statfun_cohensd +from .ft_statfun_correlationT import ft_statfun_correlationT +from .ft_statfun_depsamplesFmultivariate import ft_statfun_depsamplesFmultivariate +from .ft_statfun_depsamplesFunivariate import ft_statfun_depsamplesFunivariate +from .ft_statfun_depsamplesT import ft_statfun_depsamplesT +from .ft_statfun_depsamplesregrT import ft_statfun_depsamplesregrT +from .ft_statfun_diff import ft_statfun_diff +from .ft_statfun_diff_itc import ft_statfun_diff_itc +from .ft_statfun_gcmi import ft_statfun_gcmi +from .ft_statfun_indepsamplesF import ft_statfun_indepsamplesF +from .ft_statfun_indepsamplesT import ft_statfun_indepsamplesT +from .ft_statfun_indepsamplesZcoh import ft_statfun_indepsamplesZcoh +from .ft_statfun_indepsamplesregrT import ft_statfun_indepsamplesregrT +from .ft_statfun_mean import ft_statfun_mean +from .ft_statfun_pooledT import ft_statfun_pooledT +from .ft_statfun_roc import ft_statfun_roc + + +__all__ = [ + "ft_statfun_actvsblT", + "ft_statfun_bayesfactor", + "ft_statfun_cohensd", + "ft_statfun_correlationT", + "ft_statfun_depsamplesFmultivariate", + "ft_statfun_depsamplesFunivariate", + "ft_statfun_depsamplesT", + "ft_statfun_depsamplesregrT", + "ft_statfun_diff", + "ft_statfun_diff_itc", + "ft_statfun_gcmi", + "ft_statfun_indepsamplesF", + "ft_statfun_indepsamplesT", + "ft_statfun_indepsamplesZcoh", + "ft_statfun_indepsamplesregrT", + "ft_statfun_mean", + "ft_statfun_pooledT", + "ft_statfun_roc", +] diff --git a/fieldtrip/__statfun/_defaultId.py b/fieldtrip/__statfun/_defaultId.py new file mode 100644 index 0000000..8c571f6 --- /dev/null +++ b/fieldtrip/__statfun/_defaultId.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _defaultId(*args, **kwargs): + """ + DEFAULTID returns a string that can serve as warning or error identifier, + for example 'FieldTip:ft_read_header:line345'. + + See also WARNING, ERROR, FT_NOTICE, FT_INFO, FT_DEBUG + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/private/defaultId.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("defaultId", *args, **kwargs) diff --git a/fieldtrip/__statfun/_fixname.py b/fieldtrip/__statfun/_fixname.py new file mode 100644 index 0000000..972ab3f --- /dev/null +++ b/fieldtrip/__statfun/_fixname.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _fixname(*args, **kwargs): + """ + FIXNAME changes all inappropriate characters in a string into '_' + so that it can be used as a filename or as a field name in a structure. + If the string begins with a digit, an 'x' is prepended. + + Use as + str = fixname(str) + + MATLAB 2014a introduces the matlab.lang.makeValidName and + matlab.lang.makeUniqueStrings functions for constructing unique + identifiers, but this particular implementation also works with + older MATLAB versions. + + See also DEBLANK, STRIP, PAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/private/fixname.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixname", *args, **kwargs) diff --git a/fieldtrip/__statfun/_getsubfield.py b/fieldtrip/__statfun/_getsubfield.py new file mode 100644 index 0000000..e52cdbd --- /dev/null +++ b/fieldtrip/__statfun/_getsubfield.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _getsubfield(*args, **kwargs): + """ + GETSUBFIELD returns a field from a structure just like the standard + GETFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = getsubfield(s, 'fieldname') + or as + f = getsubfield(s, 'fieldname.subfieldname') + + See also GETFIELD, ISSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/private/getsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getsubfield", *args, **kwargs) diff --git a/fieldtrip/__statfun/_issubfield.py b/fieldtrip/__statfun/_issubfield.py new file mode 100644 index 0000000..ee6285b --- /dev/null +++ b/fieldtrip/__statfun/_issubfield.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _issubfield(*args, **kwargs): + """ + ISSUBFIELD tests for the presence of a field in a structure just like the standard + Matlab ISFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = issubfield(s, 'fieldname') + or as + f = issubfield(s, 'fieldname.subfieldname') + + This function returns true if the field is present and false if the field + is not present. + + See also ISFIELD, GETSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/private/issubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("issubfield", *args, **kwargs) diff --git a/fieldtrip/__statfun/_istrue.py b/fieldtrip/__statfun/_istrue.py new file mode 100644 index 0000000..cbbdf2d --- /dev/null +++ b/fieldtrip/__statfun/_istrue.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _istrue(*args, **kwargs): + """ + ISTRUE converts an input argument like "yes/no", "true/false" or "on/off" into a + boolean. If the input is boolean, then it will remain like that. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/private/istrue.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("istrue", *args, **kwargs) diff --git a/fieldtrip/__statfun/_rmsubfield.py b/fieldtrip/__statfun/_rmsubfield.py new file mode 100644 index 0000000..a832d71 --- /dev/null +++ b/fieldtrip/__statfun/_rmsubfield.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _rmsubfield(*args, **kwargs): + """ + RMSUBFIELD removes the contents of the specified field from a structure + just like the standard Matlab RMFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = rmsubfield(s, 'fieldname') + or as + s = rmsubfield(s, 'fieldname.subfieldname') + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/private/rmsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rmsubfield", *args, **kwargs) diff --git a/fieldtrip/__statfun/_setsubfield.py b/fieldtrip/__statfun/_setsubfield.py new file mode 100644 index 0000000..c671b2d --- /dev/null +++ b/fieldtrip/__statfun/_setsubfield.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _setsubfield(*args, **kwargs): + """ + SETSUBFIELD sets the contents of the specified field to a specified value + just like the standard Matlab SETFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = setsubfield(s, 'fieldname', value) + or as + s = setsubfield(s, 'fieldname.subfieldname', value) + + where nested is a logical, false denoting that setsubfield will create + s.subfieldname instead of s.fieldname.subfieldname + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/private/setsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("setsubfield", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_actvsblT.py b/fieldtrip/__statfun/ft_statfun_actvsblT.py new file mode 100644 index 0000000..65e14e4 --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_actvsblT.py @@ -0,0 +1,73 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_actvsblT(*args, **kwargs): + """ + FT_STATFUN_ACTVSBLT calculates the activation-versus-baseline T-statistic on the + biological data (the dependent variable), using the information on the independent + variable (ivar) in design. + + Note that it does not make sense to use this test statistic when baseline + correction was performed by subtracting the mean of the baseline period from the + whole data (for ERP data) or by dividing by the mean (for TFR data). If baseline + correction is desired, you should subtract the full baseline and activation period. + + Use this function by calling one of the high-level statistics functions as + [stat] = ft_timelockstatistics(cfg, timelock1, timelock2, ...) + [stat] = ft_freqstatistics(cfg, freq1, freq2, ...) + [stat] = ft_sourcestatistics(cfg, source1, source2, ...) + with the following configuration option: + cfg.statistic = 'ft_statfun_actvsblT' + + You can specify the following configuration options: + cfg.computestat = 'yes' or 'no', calculate the statistic (default='yes') + cfg.computecritval = 'yes' or 'no', calculate the critical values of the test statistics (default='no') + cfg.computeprob = 'yes' or 'no', calculate the p-values (default='no') + + The following options are relevant if cfg.computecritval='yes' and/or cfg.computeprob='yes': + cfg.alpha = critical alpha-level of the statistical test (default=0.05) + cfg.tail = -1, 0, or 1, left, two-sided, or right (default=1) + cfg.tail in combination with cfg.computecritval='yes' + determines whether the critical value is computed at + quantile cfg.alpha (with cfg.tail=-1), at quantiles + cfg.alpha/2 and (1-cfg.alpha/2) (with cfg.tail=0), or at + quantile (1-cfg.alpha) (with cfg.tail=1) + + The experimental design is specified as: + cfg.ivar = independent variable, row number of the design that contains the labels of the conditions to be compared (default=1) + cfg.uvar = unit variable, row number of design that contains the labels of the units-of-observation, i.e. subjects or trials (default=2) + + The first condition, indicated by 1, corresponds to the activation period and the second, + indicated by 2, corresponds to the baseline period. The labels for the unit of observation + should be integers ranging from 1 to the number of observations (subjects or trials). + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS or FT_SOURCESTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_actvsblT.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_actvsblT", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_bayesfactor.py b/fieldtrip/__statfun/ft_statfun_bayesfactor.py new file mode 100644 index 0000000..1cff2a0 --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_bayesfactor.py @@ -0,0 +1,73 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_bayesfactor(*args, **kwargs): + """ + FT_STATFUN_BAYESFACTOR computes the Bayes factor for a H0 of the data in two + conditions having the same mean, versus H1 of the data having different means. This + function supports both unpaired and paired designs and assumes flat priors. + + Lee and Wagenmakers (2013) provide these guidelines for its interpretation + IF B10 IS... THEN YOU HAVE... + > 100 Extreme evidence for H1 + 30 – 100 Very strong evidence for H1 + 10 – 30 Strong evidence for H1 + 3 – 10 Moderate evidence for H1 + 1 – 3 Anecdotal evidence for H1 + 1 No evidence + 1/3 – 1 Anecdotal evidence for H0 + 1/3 – 1/10 Moderate evidence for H0 + 1/10 – 1/30 Strong evidence for H0 + 1/30 – 1/100 Very strong evidence for H0 + < 1/100 Extreme evidence for H0 + + Use this function by calling one of the high-level statistics functions as + [stat] = ft_timelockstatistics(cfg, timelock1, timelock2, ...) + [stat] = ft_freqstatistics(cfg, freq1, freq2, ...) + [stat] = ft_sourcestatistics(cfg, source1, source2, ...) + with the following configuration option: + cfg.statistic = 'ft_statfun_bayesfactor' + + The experimental design is specified as: + cfg.ivar = independent variable, row number of the design that contains the labels of the conditions to be compared (default=1) + cfg.uvar = optional, row number of design that contains the labels of the units-of-observation, i.e. subjects or trials (default=2) + + The labels for the independent variable should be specified as the number 1 and 2. + The labels for the unit of observation should be integers ranging from 1 to the + total number of observations (subjects or trials). + + The cfg.uvar option is only needed for paired data, you should leave it empty + for non-paired data. + + See https://www.statisticshowto.datasciencecentral.com/bayes-factor-definition/ for some background. + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS or FT_SOURCESTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_bayesfactor.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_bayesfactor", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_cohensd.py b/fieldtrip/__statfun/ft_statfun_cohensd.py new file mode 100644 index 0000000..0b5f363 --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_cohensd.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_cohensd(*args, **kwargs): + """ + FT_STATFUN_COHENSD computes the effect size according to Cohen's d. This function + supports both unpaired and paired designs. + + The table below contains descriptors for magnitudes of Cohen's d. + Very small 0.01 + Small 0.20 + Medium 0.50 + Large 0.80 + Very large 1.20 + Huge 2.00 + + Use this function by calling one of the high-level statistics functions as + [stat] = ft_timelockstatistics(cfg, timelock1, timelock2, ...) + [stat] = ft_freqstatistics(cfg, freq1, freq2, ...) + [stat] = ft_sourcestatistics(cfg, source1, source2, ...) + with the following configuration option: + cfg.statistic = 'ft_statfun_cohensd' + + The experimental design is specified as: + cfg.ivar = independent variable, row number of the design that contains the labels of the conditions to be compared (default=1) + cfg.uvar = optional, row number of design that contains the labels of the units-of-observation, i.e. subjects or trials (default=2) + + The labels for the independent variable should be specified as the number 1 and 2. + The labels for the unit of observation should be integers ranging from 1 to the + total number of observations (subjects or trials). + + The cfg.uvar option is only needed for paired data, you should leave it empty + for non-paired data. + + See https://en.wikipedia.org/wiki/Effect_size#Cohen.27s_d for a description + and https://www.psychometrica.de/effect_size.html for an online computation tool. + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS or FT_SOURCESTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_cohensd.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_cohensd", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_correlationT.py b/fieldtrip/__statfun/ft_statfun_correlationT.py new file mode 100644 index 0000000..9b39beb --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_correlationT.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_correlationT(*args, **kwargs): + """ + FT_STATFUN_CORRELATIONT calculates correlation coefficient T-statistics on the + biological data in dat (the dependent variable), using the information on the + independent variable (predictor) in design. The correlation coefficients themselves + are stored in the output structure as rho. + + Use this function by calling one of the high-level statistics functions as + [stat] = ft_timelockstatistics(cfg, timelock1, timelock2, ...) + [stat] = ft_freqstatistics(cfg, freq1, freq2, ...) + [stat] = ft_sourcestatistics(cfg, source1, source2, ...) + with the following configuration option: + cfg.statistic = 'ft_statfun_correlationT' + + You can specify the following configuration options: + cfg.computestat = 'yes' or 'no', calculate the statistic (default='yes') + cfg.computecritval = 'yes' or 'no', calculate the critical values of the test statistics (default='no') + cfg.computeprob = 'yes' or 'no', calculate the p-values (default='no') + + The following options are relevant if cfg.computecritval='yes' and/or cfg.computeprob='yes': + cfg.alpha = critical alpha-level of the statistical test (default=0.05) + cfg.tail = -1, 0, or 1, left, two-sided, or right (default=1) + cfg.tail in combination with cfg.computecritval='yes' + determines whether the critical value is computed at + quantile cfg.alpha (with cfg.tail=-1), at quantiles + cfg.alpha/2 and (1-cfg.alpha/2) (with cfg.tail=0), or at + quantile (1-cfg.alpha) (with cfg.tail=1) + cfg.type = 'Pearson' to compute Pearson's correlation (default), + see 'help corr' for other options. + + The experimental design is specified as: + cfg.ivar = row number of the design that contains the independent variable, i.e. the predictor (default=1) + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS or FT_SOURCESTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_correlationT.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_correlationT", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_depsamplesFmultivariate.py b/fieldtrip/__statfun/ft_statfun_depsamplesFmultivariate.py new file mode 100644 index 0000000..07cfe9d --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_depsamplesFmultivariate.py @@ -0,0 +1,74 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_depsamplesFmultivariate(*args, **kwargs): + """ + FT_STATFUN_DEPSAMPLESFMULTIVARIATE calculates the MANOVA dependent samples + F-statistic on the biological data in dat (the dependent variable), using the + information on the independent variable (ivar) in design. + + Use this function by calling one of the high-level statistics functions as + [stat] = ft_timelockstatistics(cfg, timelock1, timelock2, ...) + [stat] = ft_freqstatistics(cfg, freq1, freq2, ...) + [stat] = ft_sourcestatistics(cfg, source1, source2, ...) + with the following configuration option: + cfg.statistic = 'ft_statfun_depsamplesFmultivariate' + + You can specify the following configuration options: + cfg.contrastcoefs = matrix of contrast coefficients determining the + effect being tested. The number of columns of this + matrix has to be equal to the number of conditions. + The default is a matrix that specifies the + main effect of the independent variable. This matrix + has size [(ncond-1),ncond]. + cfg.computestat = 'yes' or 'no', calculate the statistic (default='yes') + cfg.computecritval = 'yes' or 'no', calculate the critical values of the test statistics (default='no') + cfg.computeprob = 'yes' or 'no', calculate the p-values (default='no') + + The following options are relevant if cfg.computecritval='yes' and/or cfg.computeprob='yes': + cfg.alpha = critical alpha-level of the statistical test (default=0.05) + cfg.tail = -1, 0, or 1, left, two-sided, or right (default=1) + cfg.tail in combination with cfg.computecritval='yes' + determines whether the critical value is computed at + quantile cfg.alpha (with cfg.tail=-1), at quantiles + cfg.alpha/2 and (1-cfg.alpha/2) (with cfg.tail=0), or at + quantile (1-cfg.alpha) (with cfg.tail=1) + + The experimental design is specified as: + cfg.ivar = independent variable, row number of the design that contains the labels of the conditions to be compared (default=1) + cfg.uvar = unit variable, row number of design that contains the labels of the units-of-observation, i.e. subjects or trials (default=2) + + The labels for the independent variable should be specified as numbers ranging + from 1 to the number of conditions. The labels for the unit of observation should + be integers ranging from 1 to the total number of observations (subjects or trials). + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS or FT_SOURCESTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_depsamplesFmultivariate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_depsamplesFmultivariate", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_depsamplesFunivariate.py b/fieldtrip/__statfun/ft_statfun_depsamplesFunivariate.py new file mode 100644 index 0000000..be80eb0 --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_depsamplesFunivariate.py @@ -0,0 +1,69 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_depsamplesFunivariate(*args, **kwargs): + """ + FT_STATFUN_DEPSAMPLESFUNIIVARIATE calculates the univariate repeated-mesures ANOVA + on the biological data (the dependent variable), using the information on the + independent variable (ivar) in design. + + Use this function by calling one of the high-level statistics functions as + [stat] = ft_timelockstatistics(cfg, timelock1, timelock2, ...) + [stat] = ft_freqstatistics(cfg, freq1, freq2, ...) + [stat] = ft_sourcestatistics(cfg, source1, source2, ...) + with the following configuration option: + cfg.statistic = 'ft_statfun_depsamplesFunivariate' + + You can specify the following configuration options: + cfg.computestat = 'yes' or 'no', calculate the statistic (default='yes') + cfg.computecritval = 'yes' or 'no', calculate the critical values of the test statistics (default='no') + cfg.computeprob = 'yes' or 'no', calculate the p-values (default='no') + + The following options are relevant if cfg.computecritval='yes' and/or cfg.computeprob='yes': + cfg.alpha = critical alpha-level of the statistical test (default=0.05) + cfg.tail = -1, 0, or 1, left, two-sided, or right (default=1) + cfg.tail in combination with cfg.computecritval='yes' + determines whether the critical value is computed at + quantile cfg.alpha (with cfg.tail=-1), at quantiles + cfg.alpha/2 and (1-cfg.alpha/2) (with cfg.tail=0), or at + quantile (1-cfg.alpha) (with cfg.tail=1). For the + Fstatistic only cfg.tail = 1 makes sense. + + The experimental design is specified as: + cfg.ivar = independent variable, row number of the design that contains the labels of the conditions to be compared (default=1) + cfg.uvar = unit variable, row number of design that contains the labels of the units-of-observation, i.e. subjects or trials (default=2) + + The labels for the independent variable should be specified as numbers ranging + from 1 to the number of conditions. The labels for the unit of observation should + be integers ranging from 1 to the total number of observations (subjects or trials). + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS or FT_SOURCESTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_depsamplesFunivariate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_depsamplesFunivariate", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_depsamplesT.py b/fieldtrip/__statfun/ft_statfun_depsamplesT.py new file mode 100644 index 0000000..c35c93d --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_depsamplesT.py @@ -0,0 +1,68 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_depsamplesT(*args, **kwargs): + """ + FT_STATFUN_DEPSAMPLEST calculates the dependent samples t-statistic on the + biological data (the dependent variable), using the information on the independent + variable (ivar) in the design. + + Use this function by calling one of the high-level statistics functions as + [stat] = ft_timelockstatistics(cfg, timelock1, timelock2, ...) + [stat] = ft_freqstatistics(cfg, freq1, freq2, ...) + [stat] = ft_sourcestatistics(cfg, source1, source2, ...) + with the following configuration option: + cfg.statistic = 'ft_statfun_depsamplesT' + + You can specify the following configuration options: + cfg.computestat = 'yes' or 'no', calculate the statistic (default='yes') + cfg.computecritval = 'yes' or 'no', calculate the critical values of the test statistics (default='no') + cfg.computeprob = 'yes' or 'no', calculate the p-values (default='no') + + The following options are relevant if cfg.computecritval='yes' and/or cfg.computeprob='yes': + cfg.alpha = critical alpha-level of the statistical test (default=0.05) + cfg.tail = -1, 0, or 1, left, two-sided, or right (default=1) + cfg.tail in combination with cfg.computecritval='yes' + determines whether the critical value is computed at + quantile cfg.alpha (with cfg.tail=-1), at quantiles + cfg.alpha/2 and (1-cfg.alpha/2) (with cfg.tail=0), or at + quantile (1-cfg.alpha) (with cfg.tail=1) + + The experimental design is specified as: + cfg.ivar = independent variable, row number of the design that contains the labels of the conditions to be compared (default=1) + cfg.uvar = unit variable, row number of design that contains the labels of the units-of-observation, i.e. subjects or trials (default=2) + + The labels for the independent variable should be specified as the number 1 and 2. + The labels for the unit of observation should be integers ranging from 1 to the + total number of observations (subjects or trials). + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS or FT_SOURCESTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_depsamplesT.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_depsamplesT", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_depsamplesregrT.py b/fieldtrip/__statfun/ft_statfun_depsamplesregrT.py new file mode 100644 index 0000000..3192bcf --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_depsamplesregrT.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_depsamplesregrT(*args, **kwargs): + """ + FT_STATFUN_DEPSAMPLESREGRT calculates independent samples regression coefficient + t-statistics on the biological data (the dependent variable), using the information + on the independent variable (predictor) in the design. + + Use this function by calling one of the high-level statistics functions as + [stat] = ft_timelockstatistics(cfg, timelock1, timelock2, ...) + [stat] = ft_freqstatistics(cfg, freq1, freq2, ...) + [stat] = ft_sourcestatistics(cfg, source1, source2, ...) + with the following configuration option: + cfg.statistic = 'ft_statfun_depsamplesregrT' + + You can specify the following configuration options: + cfg.computestat = 'yes' or 'no', calculate the statistic (default='yes') + cfg.computecritval = 'yes' or 'no', calculate the critical values of the test statistics (default='no') + cfg.computeprob = 'yes' or 'no', calculate the p-values (default='no') + + The following options are relevant if cfg.computecritval='yes' and/or cfg.computeprob='yes': + cfg.alpha = critical alpha-level of the statistical test (default=0.05) + cfg.tail = -1, 0, or 1, left, two-sided, or right (default=1) + cfg.tail in combination with cfg.computecritval='yes' + determines whether the critical value is computed at + quantile cfg.alpha (with cfg.tail=-1), at quantiles + cfg.alpha/2 and (1-cfg.alpha/2) (with cfg.tail=0), or at + quantile (1-cfg.alpha) (with cfg.tail=1) + + The experimental design is specified as: + cfg.ivar = row number of the design that contains the independent variable, i.e. the predictor (default=1) + cfg.uvar = unit variable, row number of design that contains the labels of the units-of-observation, i.e. subjects or trials (default=2) + + The labels for the unit of observation should be integers ranging from 1 to the + total number of observations (subjects or trials). + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS or FT_SOURCESTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_depsamplesregrT.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_depsamplesregrT", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_diff.py b/fieldtrip/__statfun/ft_statfun_diff.py new file mode 100644 index 0000000..b492cd8 --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_diff.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_diff(*args, **kwargs): + """ + FT_STATFUN_DIFF demonstrates how to compute the difference of the mean in two + conditions. Although it can be used for statistical testing, it will have rather + limited sensitivity and is not really suited for inferential testing. + + This function serves as an example for a statfun. You can use such a function with + the statistical framework in FieldTrip using FT_TIMELOCKSTATISTICS, + FT_FREQSTATISTICS or FT_SOURCESTATISTICS to perform a statistical test, without + having to worry about the representation of the data. + + Use this function by calling the high-level statistic functions as + [stat] = ft_freqstatistics(cfg, freq1, freq2, ...) + with the following configuration option: + cfg.statistic = 'ft_statfun_diff_itc' + + The experimental design is specified as: + cfg.ivar = independent variable, row number of the design that contains the labels of the conditions to be compared (default=1) + + The labels for the independent variable should be specified as the number 1 and 2. + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS or FT_SOURCESTATISTICS, and see FT_STATFUN_MEAN for a similar example + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_diff.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_diff", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_diff_itc.py b/fieldtrip/__statfun/ft_statfun_diff_itc.py new file mode 100644 index 0000000..7119800 --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_diff_itc.py @@ -0,0 +1,68 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_diff_itc(*args, **kwargs): + """ + FT_STATFUN_DIFF_ITC computes the difference in the inter-trial coherence between + two conditions. The input data for this test should consist of complex-values + spectral estimates, e.g. computed using FT_FREQANALYSIS with cfg.method='mtmfft', + 'wavelet' or 'mtmconvcol'. + + The ITC is a measure of phase consistency over trials. By randomlly shuffling the + trials between the two consitions and repeatedly computing the ITC difference, you + can test the significance of the two conditions having a different ITC. + + A difference in the number of trials poer condition will affect the ITC, however + since the number of trials remains the same for each random permutation, this bias + is reflected in the randomization distribution. + + Use this function by calling the high-level statistic functions as + [stat] = ft_freqstatistics(cfg, freq1, freq2, ...) + with the following configuration option: + cfg.statistic = 'ft_statfun_diff_itc' + + For this specific statistic there is no known parametric distribution, hence the + probability and critical value cannot be computed analytically. This specific + statistic can therefore only be used with cfg.method='montecarlo'. If you want to + do this in combination with cfg.correctm='cluster', you also need to specify + cfg.clusterthreshold='nonparametric_common' or 'nonparametric_individual'. + + You can specify the following configuration options: + cfg.complex = string, 'diffabs' (default) to compute the difference of the absolute ITC values, + or 'absdiff' to compute the absolute value of the difference in the complex ITC values. + + The experimental design is specified as: + cfg.ivar = independent variable, row number of the design that contains the labels of the conditions to be compared (default=1) + + The labels for the independent variable should be specified as the number 1 and 2. + + See also FT_FREQSTATISTICS and FT_STATISTICS_MONTECARLO + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_diff_itc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_diff_itc", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_gcmi.py b/fieldtrip/__statfun/ft_statfun_gcmi.py new file mode 100644 index 0000000..e9caa02 --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_gcmi.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_gcmi(*args, **kwargs): + """ + FT_STATFUN_GCMI computes mutual information between the dependent variable + and a discrete-valued design vector. + + You can specify the following configuration options: + cfg.preconditionflag = 0 (default), or 1, performs Gaussian copula transform + Preconditioning is computationally efficient, because for given data it needs to be done only once. + cfg.gcmi.method = ['cc', 'cd_model' 'cd_mixture'], type of calculation + cfg.gcmi.complex = ['abs' 'real' 'imag' 'complex' 'angle' ], how to treat complex data + cfg.gcmi.tra = matrix which specifies multivariate structure + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_gcmi.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_gcmi", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_indepsamplesF.py b/fieldtrip/__statfun/ft_statfun_indepsamplesF.py new file mode 100644 index 0000000..60f41ea --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_indepsamplesF.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_indepsamplesF(*args, **kwargs): + """ + FT_STATFUN_INDEPSAMPLESF calculates the independent samples F-statistic on the + biological data in dat (the dependent variable), using the information on the + independent variable (ivar) in design. + + Use this function by calling one of the high-level statistics functions as + [stat] = ft_timelockstatistics(cfg, timelock1, timelock2, ...) + [stat] = ft_freqstatistics(cfg, freq1, freq2, ...) + [stat] = ft_sourcestatistics(cfg, source1, source2, ...) + with the following configuration option: + cfg.statistic = 'ft_statfun_indepsamplesF' + + You can specify the following configuration options: + cfg.computestat = 'yes' or 'no', calculate the statistic (default= 'yes') + cfg.computecritval = 'yes' or 'no', calculate the critical values of the test statistics (default='no') + cfg.computeprob = 'yes' or 'no', calculate the p-values (default='no') + + The following options are relevant if cfg.computecritval='yes' and/or cfg.computeprob='yes': + cfg.alpha = critical alpha-level of the statistical test (default=0.05) + cfg.tail = -1, 0, or 1, left, two-sided, or right (default=1) + cfg.tail in combination with cfg.computecritval='yes' + determines whether the critical value is computed at + quantile cfg.alpha (with cfg.tail=-1), at quantiles + cfg.alpha/2 and (1-cfg.alpha/2) (with cfg.tail=0), or at + quantile (1-cfg.alpha) (with cfg.tail=1) + + The experimental design is specified as: + cfg.ivar = independent variable, row number of the design that contains the labels of the conditions to be compared (default=1) + + The labels for the independent variable should be specified as numbers ranging + from 1 to the number of conditions. + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS or FT_SOURCESTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_indepsamplesF.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_indepsamplesF", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_indepsamplesT.py b/fieldtrip/__statfun/ft_statfun_indepsamplesT.py new file mode 100644 index 0000000..00aaf16 --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_indepsamplesT.py @@ -0,0 +1,65 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_indepsamplesT(*args, **kwargs): + """ + FT_STATFUN_INDEPSAMPLEST calculates the independent samples T-statistic on the + biological data in dat (the dependent variable), using the information on the + independent variable (ivar) in design. + + Use this function by calling one of the high-level statistics functions as + [stat] = ft_timelockstatistics(cfg, timelock1, timelock2, ...) + [stat] = ft_freqstatistics(cfg, freq1, freq2, ...) + [stat] = ft_sourcestatistics(cfg, source1, source2, ...) + with the following configuration option: + cfg.statistic = 'ft_statfun_indepsamplesT' + + You can specify the following configuration options: + cfg.computestat = 'yes' or 'no', calculate the statistic (default='yes') + cfg.computecritval = 'yes' or 'no', calculate the critical values of the test statistics (default='no') + cfg.computeprob = 'yes' or 'no', calculate the p-values (default='no') + + The following options are relevant if cfg.computecritval='yes' and/or cfg.computeprob='yes': + cfg.alpha = critical alpha-level of the statistical test (default=0.05) + cfg.tail = -1, 0, or 1, left, two-sided, or right (default=1) + cfg.tail in combination with cfg.computecritval='yes' + determines whether the critical value is computed at + quantile cfg.alpha (with cfg.tail=-1), at quantiles + cfg.alpha/2 and (1-cfg.alpha/2) (with cfg.tail=0), or at + quantile (1-cfg.alpha) (with cfg.tail=1). + + The experimental design is specified as: + cfg.ivar = independent variable, row number of the design that contains the labels of the conditions to be compared (default=1) + + The labels for the independent variable should be specified as the number 1 and 2. + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS or FT_SOURCESTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_indepsamplesT.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_indepsamplesT", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_indepsamplesZcoh.py b/fieldtrip/__statfun/ft_statfun_indepsamplesZcoh.py new file mode 100644 index 0000000..f2c7e71 --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_indepsamplesZcoh.py @@ -0,0 +1,73 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_indepsamplesZcoh(*args, **kwargs): + """ + FT_STATFUN_INDEPSAMPLESCOHZ calculates the independent samples coherence + Z-statistic on the biological data in dat (the dependent variable), using the + information on the independent variable (ivar) in design. + + Use this function by calling one of the high-level statistics functions as + [stat] = ft_timelockstatistics(cfg, timelock1, timelock2, ...) + [stat] = ft_freqstatistics(cfg, freq1, freq2, ...) + [stat] = ft_sourcestatistics(cfg, source1, source2, ...) + with the following configuration option + cfg.statistic = 'ft_statfun_indepsamplesZcoh' + + The samples-dimension of the dat-variable must be the result of a reshaping + operation applied to a data structure with dimord chan_(freq_time) or + pos_(freq_time). The configuration must contain channel labels in cfg.label or + position information in cfg.pos. This information is used to determine the number + of channels. The dimord of the output fields is [prod(nchancmb,nfreq,ntime),1]. The + channel combinations are the elements of the lower diagonal of the cross-spectral + density matrix. + + You can specify the following configuration options: + cfg.computestat = 'yes' or 'no', calculate the statistic (default='yes') + cfg.computecritval = 'yes' or 'no', calculate the critical values of the test statistics (default='no') + cfg.computeprob = 'yes' or 'no', calculate the p-values (default='no') + + The following options are relevant if cfg.computecritval='yes' and/or cfg.computeprob='yes': + cfg.alpha = critical alpha-level of the statistical test (default=0.05) + cfg.tail = -1, 0, or 1, left, two-sided, or right (default=1) + cfg.tail in combination with cfg.computecritval='yes' + determines whether the critical value is computed at + quantile cfg.alpha (with cfg.tail=-1), at quantiles + cfg.alpha/2 and (1-cfg.alpha/2) (with cfg.tail=0), or at + quantile (1-cfg.alpha) (with cfg.tail=1) + + The experimental design is specified as: + cfg.ivar = independent variable, row number of the design that contains the labels of the conditions to be compared (default=1) + + The labels for the independent variable should be specified as the number 1 and 2. + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS or FT_SOURCESTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_indepsamplesZcoh.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_indepsamplesZcoh", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_indepsamplesregrT.py b/fieldtrip/__statfun/ft_statfun_indepsamplesregrT.py new file mode 100644 index 0000000..f9ead75 --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_indepsamplesregrT.py @@ -0,0 +1,63 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_indepsamplesregrT(*args, **kwargs): + """ + FT_STATFUN_INDEPSAMPLESREGRT calculates independent samples regression coefficient + t-statistics on the biological data (the dependent variable), using the information + on the independent variable (predictor) in the design. + + Use this function by calling one of the high-level statistics functions as + [stat] = ft_timelockstatistics(cfg, timelock1, timelock2, ...) + [stat] = ft_freqstatistics(cfg, freq1, freq2, ...) + [stat] = ft_sourcestatistics(cfg, source1, source2, ...) + with the following configuration option + cfg.statistic = 'ft_statfun_indepsamplesregrT' + + You can specify the following configuration options: + cfg.computestat = 'yes' or 'no', calculate the statistic (default = 'yes') + cfg.computecritval = 'yes' or 'no', calculate the critical values of the test statistics (default = 'no') + cfg.computeprob = 'yes' or 'no', calculate the p-values (default = 'no') + + The following options are relevant if cfg.computecritval='yes' and/or cfg.computeprob='yes': + cfg.alpha = critical alpha-level of the statistical test (default=0.05) + cfg.tail = -1, 0, or 1, left, two-sided, or right (default=1) + cfg.tail in combination with cfg.computecritval='yes' + determines whether the critical value is computed at + quantile cfg.alpha (with cfg.tail=-1), at quantiles + cfg.alpha/2 and (1-cfg.alpha/2) (with cfg.tail=0), or at + quantile (1-cfg.alpha) (with cfg.tail=1) + + The experimental design is specified as: + cfg.ivar = row number of the design that contains the independent variable, i.e. the predictor (default=1) + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS or FT_SOURCESTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_indepsamplesregrT.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_indepsamplesregrT", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_mean.py b/fieldtrip/__statfun/ft_statfun_mean.py new file mode 100644 index 0000000..411ae99 --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_mean.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_mean(*args, **kwargs): + """ + FT_STATFUN_MEAN demonstrates how to compute the mean over all conditions in the + data. Since this does NOT depend on the experimental design, it cannot be used for + testing for differences between conditions. + + This function serves as an example for a statfun. You can use such a function with + the statistical framework in FieldTrip using FT_TIMELOCKSTATISTICS, + FT_FREQSTATISTICS or FT_SOURCESTATISTICS to perform a statistical test, without + having to worry about the representation of the data. + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS or FT_SOURCESTATISTICS, and see FT_STATFUN_DIFF for a similar example + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_mean.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_mean", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_pooledT.py b/fieldtrip/__statfun/ft_statfun_pooledT.py new file mode 100644 index 0000000..1240878 --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_pooledT.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_pooledT(*args, **kwargs): + """ + FT_STATFUN_POOLEDT computes the pooled t-value over a number of replications. The + idea behind this function is that you first (prior to calling this function) + compute a contrast between two conditions per subject, and that subsequently you + test this over subjects using random sign-flipping. + + Use this function by calling one of the high-level statistics functions as + [stat] = ft_timelockstatistics(cfg, timelock1, timelock2, ...) + [stat] = ft_freqstatistics(cfg, freq1, freq2, ...) + [stat] = ft_sourcestatistics(cfg, source1, source2, ...) + with the following configuration option + cfg.statistic = 'ft_statfun_pooledT' + + The expected values for the pooled-t, which is zero according to H0, have to be + passed as pseudo-values. The subject-specific t-values will be randomly swapped with + the pseudo-values and the difference is computed; in effect this implements random + sign-flipping. + + The randimization distribution (with optional clustering) of the randomly + sign-flipped pooled-t values is computed and used for statistical inference. + + Note that, although the output of this function is to be interpreted as a + fixed-effects statistic, the statistical inference based on the comparison of the + observed pooled t-values with the randomization distribution is not a fixed-effect + statistic, one or a few outlier will cause the randomization distribution to + broaden and result in the conclusion of "not significant". + + The experimental design is specified as: + cfg.ivar = independent variable, row number of the design that contains the labels of the conditions to be sign-flipped (default=1) + + The labels independent variable should be specified as the number 1 for the + observed t-values and 2 for the pseudo-values. + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS or FT_SOURCESTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_pooledT.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_pooledT", *args, **kwargs) diff --git a/fieldtrip/__statfun/ft_statfun_roc.py b/fieldtrip/__statfun/ft_statfun_roc.py new file mode 100644 index 0000000..f3067a3 --- /dev/null +++ b/fieldtrip/__statfun/ft_statfun_roc.py @@ -0,0 +1,64 @@ +from fieldtrip._runtime import Runtime + + +def ft_statfun_roc(*args, **kwargs): + """ + FT_STATFUN_ROC computes the area under the curve (AUC) of the Receiver Operator + Characteristic (ROC). This is a measure of the separability of the data observed in + two conditions. The AUC can be used for statistical testing whether the two + conditions can be distinguished on the basis of the data. + + Use this function by calling one of the high-level statistics functions as + [stat] = ft_timelockstatistics(cfg, timelock1, timelock2, ...) + [stat] = ft_freqstatistics(cfg, freq1, freq2, ...) + [stat] = ft_sourcestatistics(cfg, source1, source2, ...) + with the following configuration option + cfg.statistic = 'ft_statfun_roc' + + The experimental design is specified as: + cfg.ivar = independent variable, row number of the design that contains the labels of the conditions to be compared (default=1) + + The labels for the independent variable should be specified as the number 1 and 2. + + Note that this statfun performs a one sided test in which condition "1" is assumed + to be larger than condition "2". This function does not compute an analytic + probability of condition "1" being larger than condition "2", but can be used in a + randomization test, including clustering. + + A low-level example with 10 channel-time-frequency points and 1000 observations per + condition goes like this: + dat1 = randn(10,1000) + 1; + dat2 = randn(10,1000); + design = [1*ones(1,1000) 2*ones(1,1000)]; + stat = ft_statfun_roc([], [dat1 dat2], design); + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS or FT_SOURCESTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/statfun/ft_statfun_roc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statfun_roc", *args, **kwargs) diff --git a/fieldtrip/__trialfun/__init__.py b/fieldtrip/__trialfun/__init__.py new file mode 100644 index 0000000..341dd77 --- /dev/null +++ b/fieldtrip/__trialfun/__init__.py @@ -0,0 +1,36 @@ +from .ft_trialfun_balert import ft_trialfun_balert +from .ft_trialfun_bids import ft_trialfun_bids +from .ft_trialfun_brainvision_segmented import ft_trialfun_brainvision_segmented +from .ft_trialfun_edf import ft_trialfun_edf +from .ft_trialfun_emgdetect import ft_trialfun_emgdetect +from .ft_trialfun_example1 import ft_trialfun_example1 +from .ft_trialfun_example2 import ft_trialfun_example2 +from .ft_trialfun_general import ft_trialfun_general +from .ft_trialfun_gui import ft_trialfun_gui +from .ft_trialfun_hed import ft_trialfun_hed +from .ft_trialfun_imotions import ft_trialfun_imotions +from .ft_trialfun_neuromagSTI016fix import ft_trialfun_neuromagSTI016fix +from .ft_trialfun_realtime import ft_trialfun_realtime +from .ft_trialfun_show import ft_trialfun_show +from .ft_trialfun_trial import ft_trialfun_trial +from .ft_trialfun_twoclass_classification import ft_trialfun_twoclass_classification + + +__all__ = [ + "ft_trialfun_balert", + "ft_trialfun_bids", + "ft_trialfun_brainvision_segmented", + "ft_trialfun_edf", + "ft_trialfun_emgdetect", + "ft_trialfun_example1", + "ft_trialfun_example2", + "ft_trialfun_general", + "ft_trialfun_gui", + "ft_trialfun_hed", + "ft_trialfun_imotions", + "ft_trialfun_neuromagSTI016fix", + "ft_trialfun_realtime", + "ft_trialfun_show", + "ft_trialfun_trial", + "ft_trialfun_twoclass_classification", +] diff --git a/fieldtrip/__trialfun/_bids_sidecar.py b/fieldtrip/__trialfun/_bids_sidecar.py new file mode 100644 index 0000000..ff8561f --- /dev/null +++ b/fieldtrip/__trialfun/_bids_sidecar.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _bids_sidecar(*args, **kwargs): + """ + BIDS_SIDECAR will search for corresponding BIDS sidecar files that go together with + a specific data file. This function respects the inheritance rules and will also + search higher up in the directory structure. + + Use as + sidecar = bids_sidecar(filename, sidecar, extension) + where filename refers to a BIDS data file and suffix is a string that refers to the + specific sidecar file. To read the json sidecar corresponding to the data itself, + you can keep the suffix empty. In that case the suffix (e.g., meg or eeg) will + be determined from the filename. + + This supports, but is not restricted to the following json sidecar files + 'meg' + 'eeg' + 'ieeg' + 'nirs' + 'coordsystem' + + This supports, but is not restricted to the following tsv sidecar files + 'channels' + 'electrodes' + 'optodes' + 'events' + + You can specify the file extension (tsv or json) to be returned. When not specified + and in case both a tsv and a json sidecar file are present that match the suffix, + the tsv file will be returned. + + See https://bids-specification.readthedocs.io/ for the specification and + http://bids.neuroimaging.io/ for background information. + + See also BIDS_DATAFILE, BIDS_TSV, EVENTS_TSV, FT_READ_HEADER, FT_READ_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/private/bids_sidecar.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("bids_sidecar", *args, **kwargs) diff --git a/fieldtrip/__trialfun/_defaultId.py b/fieldtrip/__trialfun/_defaultId.py new file mode 100644 index 0000000..dd30b92 --- /dev/null +++ b/fieldtrip/__trialfun/_defaultId.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _defaultId(*args, **kwargs): + """ + DEFAULTID returns a string that can serve as warning or error identifier, + for example 'FieldTip:ft_read_header:line345'. + + See also WARNING, ERROR, FT_NOTICE, FT_INFO, FT_DEBUG + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/private/defaultId.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("defaultId", *args, **kwargs) diff --git a/fieldtrip/__trialfun/_ismatch.py b/fieldtrip/__trialfun/_ismatch.py new file mode 100644 index 0000000..c306add --- /dev/null +++ b/fieldtrip/__trialfun/_ismatch.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _ismatch(*args, **kwargs): + """ + ISMATCH returns true if x is a member of array y, regardless of the class + of x and y, if y is a string, or a cell-array of strings, it can contain + the wildcard '*' + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/private/ismatch.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ismatch", *args, **kwargs) diff --git a/fieldtrip/__trialfun/_select_channel_list.py b/fieldtrip/__trialfun/_select_channel_list.py new file mode 100644 index 0000000..34f440b --- /dev/null +++ b/fieldtrip/__trialfun/_select_channel_list.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _select_channel_list(*args, **kwargs): + """ + SELECT_CHANNEL_LIST presents a dialog for selecting multiple elements + from a cell-array with strings, such as the labels of EEG channels. + The dialog presents two columns with an add and remove mechanism. + + select = select_channel_list(label, initial, titlestr) + + with + initial indices of channels that are initially selected + label cell-array with channel labels (strings) + titlestr title for dialog (optional) + and + select indices of selected channels + + If the user presses cancel, the initial selection will be returned. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/private/select_channel_list.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("select_channel_list", *args, **kwargs) diff --git a/fieldtrip/__trialfun/ft_trialfun_balert.py b/fieldtrip/__trialfun/ft_trialfun_balert.py new file mode 100644 index 0000000..6a0a49e --- /dev/null +++ b/fieldtrip/__trialfun/ft_trialfun_balert.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def ft_trialfun_balert(*args, **kwargs): + """ + FT_TRIALFUN_BALERT extract trials from B-Alert data using an intermediate CSV file. + FieldTrip cannot yet directly interpret the event markers from B-Alert data. + Therefore, it is necessary to have B-Alert LAB. This is (paid) software from + Advanced Brain Monitoring, in which you extract the eventmakers using the function: + readevents(*.Events.edf, *.Signals.Raw.edf) to write a *.csv file. + + Use this function by calling + [cfg] = ft_definetrial(cfg) + where the configuration structure should contain + cfg.dataset = string with the *.csv filename + cfg.trialfun = 'ft_trialfun_balert' + + See also FT_DEFINETRIAL, FT_PREPROCESSING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/ft_trialfun_balert.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_trialfun_balert", *args, **kwargs) diff --git a/fieldtrip/__trialfun/ft_trialfun_bids.py b/fieldtrip/__trialfun/ft_trialfun_bids.py new file mode 100644 index 0000000..9180325 --- /dev/null +++ b/fieldtrip/__trialfun/ft_trialfun_bids.py @@ -0,0 +1,64 @@ +from fieldtrip._runtime import Runtime + + +def ft_trialfun_bids(*args, **kwargs): + """ + FT_TRIALFUN_BIDS determines trials/segments to be used for subsequent analysis, on + the basis of the BIDS "events.tsv" file. This function should in general not be + called directly, it will be called by FT_DEFINETRIAL. + + Use this function by calling + [cfg] = ft_definetrial(cfg) + where the configuration structure should contain + cfg.dataset = string with the filename + cfg.trialdef = structure with the details of trial definition, see below + cfg.trialfun = 'ft_trialfun_bids' + + The trialdef structure should either contain the following + cfg.trialdef.prestim = latency in seconds + cfg.trialdef.poststim = latency in seconds + or the duration and offset relative to the event of interest + cfg.trialdef.duration = latency in seconds + cfg.trialdef.offset = latency in seconds + + You can specify your selection of events as + cfg.trialdef.columnname = columnvalue + where the column name and value have to match those present in the events.tsv file. + + For example + cfg.trialdef.prestim = 0.2; + cfg.trialdef.poststim = 0.8; + cfg.trialdef.task = 'notarget'; + cfg.trialdef.category = 'tools'; + cfg.trialdef.modality = {'written', 'spoken'}; + + See also FT_DEFINETRIAL, FT_TRIALFUN_GENERAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/ft_trialfun_bids.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_trialfun_bids", *args, **kwargs) diff --git a/fieldtrip/__trialfun/ft_trialfun_brainvision_segmented.py b/fieldtrip/__trialfun/ft_trialfun_brainvision_segmented.py new file mode 100644 index 0000000..00204df --- /dev/null +++ b/fieldtrip/__trialfun/ft_trialfun_brainvision_segmented.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def ft_trialfun_brainvision_segmented(*args, **kwargs): + """ + FT_TRIALFUN_BRAINVISION_SEGMENTED creates trials for a Brain Vision Analyzer + dataset that was segmented in the BVA software. + + Use this function by calling + [cfg] = ft_definetrial(cfg) + where the configuration structure should contain + cfg.dataset = string with the filename + cfg.trialfun = 'ft_trialfun_brainvision_segmented' + + Optionally, you can specify: + cfg.stimformat = 'S %d' + + The stimformat instruct this function to parse stimulus triggers according to + the specific format. The default is 'S %d'. The cfg.stimformat always + needs to contain exactly one %d code. The trigger values parsed in this way + will be stored in columns 4 and upwards of the output 'trl' matrix, and + after FT_PREPROCESSING will end up in data.trialinfo. + + A BrainVision dataset consists of three files: an .eeg, .vhdr, and a .vmrk + file. The option cfg.dataset should refer to the .vhdr file. + + See also FT_DEFINETRIAL, FT_PREPROCESSING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/ft_trialfun_brainvision_segmented.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_trialfun_brainvision_segmented", *args, **kwargs) diff --git a/fieldtrip/__trialfun/ft_trialfun_edf.py b/fieldtrip/__trialfun/ft_trialfun_edf.py new file mode 100644 index 0000000..3bdb8c8 --- /dev/null +++ b/fieldtrip/__trialfun/ft_trialfun_edf.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def ft_trialfun_edf(*args, **kwargs): + """ + FT_TRIALFUN_EDF is an example trial function for EDF data. It searches for events + of type "up" in an analog data channel, as indentified by thresholding. This + threshold can be a hard threshold, i.e. a numeric, or can flexibly be defined + depending on the data, for example calculating the 'median' of an analog signal. + + You can use this as a template for your own conditial trial definitions. + + Use this function by calling + [cfg] = ft_definetrial(cfg) + where the configuration structure should contain + cfg.dataset = string with the filename + cfg.trialfun = 'ft_trialfun_edf' + + See also FT_DEFINETRIAL, FT_TRIALFUN_GENERAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/ft_trialfun_edf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_trialfun_edf", *args, **kwargs) diff --git a/fieldtrip/__trialfun/ft_trialfun_emgdetect.py b/fieldtrip/__trialfun/ft_trialfun_emgdetect.py new file mode 100644 index 0000000..e37ef91 --- /dev/null +++ b/fieldtrip/__trialfun/ft_trialfun_emgdetect.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def ft_trialfun_emgdetect(*args, **kwargs): + """ + Note that there are some parameters, like the EMG channel name and the + processing that is done on the EMG channel data, which are hardcoded in + this trial function. You should change these parameters if necessary. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/ft_trialfun_emgdetect.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_trialfun_emgdetect", *args, **kwargs) diff --git a/fieldtrip/__trialfun/ft_trialfun_example1.py b/fieldtrip/__trialfun/ft_trialfun_example1.py new file mode 100644 index 0000000..3b2aee9 --- /dev/null +++ b/fieldtrip/__trialfun/ft_trialfun_example1.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def ft_trialfun_example1(*args, **kwargs): + """ + FT_TRIALFUN_EXAMPLE1 is an example trial function. It searches for events + of type "trigger" and specifically for a trigger with value 7, followed + by a trigger with value 64. + + You can use this as a template for your own conditial trial definitions. + + Use this function by calling + [cfg] = ft_definetrial(cfg) + where the configuration structure should contain + cfg.dataset = string with the filename + cfg.trialfun = 'ft_trialfun_example1' + cfg.trialdef.prestim = number, in seconds + cfg.trialdef.poststim = number, in seconds + + See also FT_DEFINETRIAL, FT_TRIALFUN_GENERAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/ft_trialfun_example1.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_trialfun_example1", *args, **kwargs) diff --git a/fieldtrip/__trialfun/ft_trialfun_example2.py b/fieldtrip/__trialfun/ft_trialfun_example2.py new file mode 100644 index 0000000..60ba842 --- /dev/null +++ b/fieldtrip/__trialfun/ft_trialfun_example2.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def ft_trialfun_example2(*args, **kwargs): + """ + FT_TRIALFUN_EXAMPLE2 is an example trial function that detects muscle activity in + an EMG channel and defines variable length trials from the EMG onset up to the EMG + offset. + + Use this function by calling + [cfg] = ft_definetrial(cfg) + where the configuration structure should contain + cfg.dataset = string with the filename + cfg.trialfun = 'ft_trialfun_example2' + + Note that there are some parameters, like the EMG channel name and the processing + that is done on the EMG channel data, which are hardcoded in this trial function. + You should change these parameters according to your data. + + See also FT_DEFINETRIAL, FT_TRIALFUN_GENERAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/ft_trialfun_example2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_trialfun_example2", *args, **kwargs) diff --git a/fieldtrip/__trialfun/ft_trialfun_general.py b/fieldtrip/__trialfun/ft_trialfun_general.py new file mode 100644 index 0000000..63e17fd --- /dev/null +++ b/fieldtrip/__trialfun/ft_trialfun_general.py @@ -0,0 +1,64 @@ +from fieldtrip._runtime import Runtime + + +def ft_trialfun_general(*args, **kwargs): + """ + FT_TRIALFUN_GENERAL reads events from the dataset using FT_READ_EVENT and + constructs a trial definition. This function should in general not be called + directly, it will be called by FT_DEFINETRIAL. + + Use this function by calling + [cfg] = ft_definetrial(cfg) + where the configuration structure should contain + cfg.dataset = string with the filename + cfg.trialdef = structure with the details of trial definition, see below + cfg.trialfun = 'ft_trialfun_general' + + The cfg.trialdef structure can contain the following specifications + cfg.trialdef.eventtype = string, or cell-array with strings + cfg.trialdef.eventvalue = number, string, or list with numbers or strings + cfg.trialdef.prestim = number, latency in seconds (optional) + cfg.trialdef.poststim = number, latency in seconds (optional) + + You can specify these options that are passed to FT_READ_EVENT for trigger detection + cfg.trialdef.detectflank = string, can be 'up', 'updiff', 'down', 'downdiff', 'both', 'any', 'biton', 'bitoff' + cfg.trialdef.trigshift = integer, number of samples to shift from flank to detect trigger value + cfg.trialdef.chanindx = list with channel numbers for the trigger detection, specify -1 in case you don't want to detect triggers + cfg.trialdef.threshold = threshold for analog trigger channels + cfg.trialdef.tolerance = tolerance in samples when merging analogue trigger channels, only for Neuromag + + If you want to read all data from a continuous file in segments, you can specify + cfg.trialdef.length = duration of the segments in seconds (can be Inf) + cfg.trialdef.ntrials = number of trials (optional, can be 1) + cfg.trialdef.overlap = single number (between 0 and 1 (exclusive)) specifying the fraction of overlap between snippets (0 = no overlap) + + See also FT_DEFINETRIAL, FT_TRIALFUN_GUI, FT_TRIALFUN_SHOW + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/ft_trialfun_general.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_trialfun_general", *args, **kwargs) diff --git a/fieldtrip/__trialfun/ft_trialfun_gui.py b/fieldtrip/__trialfun/ft_trialfun_gui.py new file mode 100644 index 0000000..ed948a7 --- /dev/null +++ b/fieldtrip/__trialfun/ft_trialfun_gui.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def ft_trialfun_gui(*args, **kwargs): + """ + FT_TRIALFUN_GUI reads events from the dataset, displays a graphical user interface + dialog to select the event types and values of interest, and constructs a trial + definition. This function should in general not be called directly, it will be + called by FT_DEFINETRIAL. + + Use this function by calling + [cfg] = ft_definetrial(cfg) + where the configuration structure should contain + cfg.dataset = string with the filename + cfg.trialfun = 'ft_trialfun_gui' + + See also FT_DEFINETRIAL, FT_TRIALFUN_GENERAL, FT_TRIALFUN_SHOW + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/ft_trialfun_gui.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_trialfun_gui", *args, **kwargs) diff --git a/fieldtrip/__trialfun/ft_trialfun_hed.py b/fieldtrip/__trialfun/ft_trialfun_hed.py new file mode 100644 index 0000000..9e3a171 --- /dev/null +++ b/fieldtrip/__trialfun/ft_trialfun_hed.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def ft_trialfun_hed(*args, **kwargs): + """ + FT_TRIALFUN_HED is a trial function that can be used with HED tags. It demonstrates + some basic functionality for selecting specific events, but mainly serves as an + example or template for your own conditial trial definitions. For that you would + copy this function and giuve it your own name, e.g. FT_TRIALFUN_MYEXPERIMENT. + + Use this function by calling + [cfg] = ft_definetrial(cfg) + where the configuration structure should contain + cfg.dataset = string with the filename + cfg.trialfun = 'ft_trialfun_hed' % or your own copy + + The selection of events and timing of the epochs is specified with + cfg.trialdef.regexp = regular expression that is applied to the HED tags + cfg.trialdef.prestim = number, in seconds + cfg.trialdef.poststim = number, in seconds + + See also FT_DEFINETRIAL, FT_TRIALFUN_GENERAL, FT_TRIALFUN_EXAMPLE1, + FT_TRIALFUN_EXAMPLE2 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/ft_trialfun_hed.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_trialfun_hed", *args, **kwargs) diff --git a/fieldtrip/__trialfun/ft_trialfun_imotions.py b/fieldtrip/__trialfun/ft_trialfun_imotions.py new file mode 100644 index 0000000..1396e24 --- /dev/null +++ b/fieldtrip/__trialfun/ft_trialfun_imotions.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def ft_trialfun_imotions(*args, **kwargs): + """ + FT_TRIALFUN_IMOTIONS makes a trial definition for an iMotions event structure. + Note that this returns the trial definition as a table rather than as a numeric array. + + Use this function by calling + [cfg] = ft_definetrial(cfg) + where the configuration structure should contain + cfg.event = event structure + cfg.fsample = number, samplijng rate in Hz + cfg.trialfun = 'ft_trialfun_imotions' + cfg.trialdef.eventtype = string or cell-array of strings (default = 'StimulusName') + cfg.trialdef.eventvalue = string or cell-array of strings (default = []) + cfg.trialdef.offset = string, 'absolute' or 'relative' (default = 'absolute') + + See also FT_DEFINETRIAL, FT_TRIALFUN_GENERAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/ft_trialfun_imotions.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_trialfun_imotions", *args, **kwargs) diff --git a/fieldtrip/__trialfun/ft_trialfun_neuromagSTI016fix.py b/fieldtrip/__trialfun/ft_trialfun_neuromagSTI016fix.py new file mode 100644 index 0000000..61c62fd --- /dev/null +++ b/fieldtrip/__trialfun/ft_trialfun_neuromagSTI016fix.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def ft_trialfun_neuromagSTI016fix(*args, **kwargs): + """ + FT_TRIALFUN_NEUROMAGSTI106FIX is supposed to fix the error with STI016 in + Neuromag/Elekta/MEGIN data. It reads the channels STI001 up to STI016, combines the + values into a new "STI101" channel and then uses the new channel to define trials. + + Use this function by calling + [cfg] = ft_definetrial(cfg) + where the configuration structure should contain + cfg.dataset = string, containing filename or directory + cfg.trialdef.prestim = pre stimulus time in s + cfg.trialdef.poststim = post stimulus time in seconds + cfg.trialdef.eventvalue = list with trigger values + cfg.trialfun = 'ft_trialfun_neuromagSTI016fix'; + + See also FT_DEFINETRIAL, FT_TRIALFUN_GENERAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/ft_trialfun_neuromagSTI016fix.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_trialfun_neuromagSTI016fix", *args, **kwargs) diff --git a/fieldtrip/__trialfun/ft_trialfun_realtime.py b/fieldtrip/__trialfun/ft_trialfun_realtime.py new file mode 100644 index 0000000..985b5a0 --- /dev/null +++ b/fieldtrip/__trialfun/ft_trialfun_realtime.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def ft_trialfun_realtime(*args, **kwargs): + """ + FT_TRIALFUN_REALTIME can be used to segment a continuous stream of + data in real-time. Trials are defined as [begsample endsample offset + condition] + + The configuration structure can contain the following specifications + cfg.minsample = the last sample number that was already considered (passed from rt_process) + cfg.blocksize = in seconds. In case of events, offset is with respect to the trigger. + cfg.offset = the offset wrt the 0 point. In case of no events, offset is wrt + prevSample. E.g., [-0.9 1] will read 1 second blocks with + 0.9 second overlap + cfg.bufferdata = {'first' 'last'}. If 'last' then only the last block of + interest is read. Otherwise, all well-defined blocks are read (default = 'first') + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/ft_trialfun_realtime.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_trialfun_realtime", *args, **kwargs) diff --git a/fieldtrip/__trialfun/ft_trialfun_show.py b/fieldtrip/__trialfun/ft_trialfun_show.py new file mode 100644 index 0000000..82a3579 --- /dev/null +++ b/fieldtrip/__trialfun/ft_trialfun_show.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def ft_trialfun_show(*args, **kwargs): + """ + FT_TRIALFUN_SHOW will show a summary of the event information on screen. It will + not return an actual trial definition. This function should in general not be + called directly, it will be called by FT_DEFINETRIAL. + + Use this function by calling + [cfg] = ft_definetrial(cfg) + where the configuration structure should contain + cfg.dataset = string with the filename + cfg.trialfun = 'ft_trialfun_show' + + See also FT_DEFINETRIAL, FT_TRIALFUN_GENERAL, FT_TRIALFUN_GUI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/ft_trialfun_show.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_trialfun_show", *args, **kwargs) diff --git a/fieldtrip/__trialfun/ft_trialfun_trial.py b/fieldtrip/__trialfun/ft_trialfun_trial.py new file mode 100644 index 0000000..3f55c8d --- /dev/null +++ b/fieldtrip/__trialfun/ft_trialfun_trial.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def ft_trialfun_trial(*args, **kwargs): + """ + FT_TRIALFUN_TRIAL creates a trial definition that corresponds to the events that + are returned by FT_READ_EVENT with type='trial' + + Use this function by calling + [cfg] = ft_definetrial(cfg) + where the configuration structure should contain + cfg.dataset = string with the filename + cfg.trialfun = 'ft_trialfun_trial' + + See also FT_DEFINETRIAL, FT_TRIALFUN_GENERAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/ft_trialfun_trial.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_trialfun_trial", *args, **kwargs) diff --git a/fieldtrip/__trialfun/ft_trialfun_twoclass_classification.py b/fieldtrip/__trialfun/ft_trialfun_twoclass_classification.py new file mode 100644 index 0000000..0faf5f1 --- /dev/null +++ b/fieldtrip/__trialfun/ft_trialfun_twoclass_classification.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def ft_trialfun_twoclass_classification(*args, **kwargs): + """ + FT_TRIALFUN_TWOCLASS_CLASSIFICATION can be used to train and test a real-time + classifier in offline and online mode. It selects pieces of data in the two classes + based on two trigger values. The first N occurrences in each class are marked as + training items. All subsequent occurrences are marked as test items. + + This function can be used in conjunction with FT_REALTIME_CLASSIFICATION. The + configuration structure should contain + cfg.dataset = string with the filename + cfg.trialfun = 'ft_trialfun_twoclass_classification' + cfg.trialdef.numtrain = number of training items, e.g. 20 + cfg.trialdef.eventvalue1 = trigger value for the 1st class + cfg.trialdef.eventvalue2 = trigger value for the 2nd class + cfg.trialdef.eventtype = string, e.g. 'trigger' + cfg.trialdef.prestim = latency in seconds, e.g. 0.3 + cfg.trialdef.poststim = latency in seconds, e.g. 0.7 + + See also FT_DEFINETRIAL, FT_TRIALFUN_GENERAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/trialfun/ft_trialfun_twoclass_classification.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_trialfun_twoclass_classification", *args, **kwargs) diff --git a/fieldtrip/__utilities/__init__.py b/fieldtrip/__utilities/__init__.py new file mode 100644 index 0000000..b1e3f11 --- /dev/null +++ b/fieldtrip/__utilities/__init__.py @@ -0,0 +1,194 @@ +from .appendstruct import appendstruct +from .copyfields import copyfields +from .dccnpath import dccnpath +from .ft_affinecoordinates import ft_affinecoordinates +from .ft_apply_montage import ft_apply_montage +from .ft_average_sens import ft_average_sens +from .ft_cfg2keyval import ft_cfg2keyval +from .ft_channelcombination import ft_channelcombination +from .ft_channelselection import ft_channelselection +from .ft_checkconfig import ft_checkconfig +from .ft_checkdata import ft_checkdata +from .ft_checkopt import ft_checkopt +from .ft_compile_mex import ft_compile_mex +from .ft_compile_standalone import ft_compile_standalone +from .ft_convert_coordsys import ft_convert_coordsys +from .ft_datatype import ft_datatype +from .ft_datatype_comp import ft_datatype_comp +from .ft_datatype_dip import ft_datatype_dip +from .ft_datatype_freq import ft_datatype_freq +from .ft_datatype_headmodel import ft_datatype_headmodel +from .ft_datatype_mvar import ft_datatype_mvar +from .ft_datatype_parcellation import ft_datatype_parcellation +from .ft_datatype_raw import ft_datatype_raw +from .ft_datatype_segmentation import ft_datatype_segmentation +from .ft_datatype_sens import ft_datatype_sens +from .ft_datatype_source import ft_datatype_source +from .ft_datatype_spike import ft_datatype_spike +from .ft_datatype_timelock import ft_datatype_timelock +from .ft_datatype_volume import ft_datatype_volume +from .ft_debug import ft_debug +from .ft_determine_coordsys import ft_determine_coordsys +from .ft_documentationconfiguration import ft_documentationconfiguration +from .ft_documentationreference import ft_documentationreference +from .ft_error import ft_error +from .ft_fetch_data import ft_fetch_data +from .ft_fetch_event import ft_fetch_event +from .ft_fetch_header import ft_fetch_header +from .ft_findcfg import ft_findcfg +from .ft_getopt import ft_getopt +from .ft_hash import ft_hash +from .ft_hastoolbox import ft_hastoolbox +from .ft_headcoordinates import ft_headcoordinates +from .ft_info import ft_info +from .ft_inverse_montage import ft_inverse_montage +from .ft_keyval2cfg import ft_keyval2cfg +from .ft_notice import ft_notice +from .ft_platform_supports import ft_platform_supports +from .ft_postamble import ft_postamble +from .ft_preamble import ft_preamble +from .ft_progress import ft_progress +from .ft_save_workspace import ft_save_workspace +from .ft_scalingfactor import ft_scalingfactor +from .ft_selectdata import ft_selectdata +from .ft_setopt import ft_setopt +from .ft_source2full import ft_source2full +from .ft_source2grid import ft_source2grid +from .ft_source2sparse import ft_source2sparse +from .ft_standalone import ft_standalone +from .ft_struct2char import ft_struct2char +from .ft_struct2double import ft_struct2double +from .ft_struct2single import ft_struct2single +from .ft_struct2string import ft_struct2string +from .ft_test import ft_test +from .ft_trackusage import ft_trackusage +from .ft_transform_geometry import ft_transform_geometry +from .ft_transform_headmodel import ft_transform_headmodel +from .ft_transform_headshape import ft_transform_headshape +from .ft_transform_sens import ft_transform_sens +from .ft_transform_vol import ft_transform_vol +from .ft_version import ft_version +from .ft_warning import ft_warning +from .ft_warp_apply import ft_warp_apply +from .ft_warp_error import ft_warp_error +from .ft_warp_optim import ft_warp_optim +from .getsubfield import getsubfield +from .hasyokogawa import hasyokogawa +from .issubfield import issubfield +from .istrue import istrue +from .keepfields import keepfields +from .keyval import keyval +from .keyvalcheck import keyvalcheck +from .markdown2matlab import markdown2matlab +from .match_str import match_str +from .match_val import match_val +from .matlab2markdown import matlab2markdown +from .memtic import memtic +from .memtoc import memtoc +from .nearest import nearest +from .printstruct import printstruct +from .removefields import removefields +from .renamefields import renamefields +from .rmsubfield import rmsubfield +from .setsubfield import setsubfield +from .strel_bol import strel_bol +from .tokenize import tokenize + + +__all__ = [ + "appendstruct", + "copyfields", + "dccnpath", + "ft_affinecoordinates", + "ft_apply_montage", + "ft_average_sens", + "ft_cfg2keyval", + "ft_channelcombination", + "ft_channelselection", + "ft_checkconfig", + "ft_checkdata", + "ft_checkopt", + "ft_compile_mex", + "ft_compile_standalone", + "ft_convert_coordsys", + "ft_datatype", + "ft_datatype_comp", + "ft_datatype_dip", + "ft_datatype_freq", + "ft_datatype_headmodel", + "ft_datatype_mvar", + "ft_datatype_parcellation", + "ft_datatype_raw", + "ft_datatype_segmentation", + "ft_datatype_sens", + "ft_datatype_source", + "ft_datatype_spike", + "ft_datatype_timelock", + "ft_datatype_volume", + "ft_debug", + "ft_determine_coordsys", + "ft_documentationconfiguration", + "ft_documentationreference", + "ft_error", + "ft_fetch_data", + "ft_fetch_event", + "ft_fetch_header", + "ft_findcfg", + "ft_getopt", + "ft_hash", + "ft_hastoolbox", + "ft_headcoordinates", + "ft_info", + "ft_inverse_montage", + "ft_keyval2cfg", + "ft_notice", + "ft_platform_supports", + "ft_postamble", + "ft_preamble", + "ft_progress", + "ft_save_workspace", + "ft_scalingfactor", + "ft_selectdata", + "ft_setopt", + "ft_source2full", + "ft_source2grid", + "ft_source2sparse", + "ft_standalone", + "ft_struct2char", + "ft_struct2double", + "ft_struct2single", + "ft_struct2string", + "ft_test", + "ft_trackusage", + "ft_transform_geometry", + "ft_transform_headmodel", + "ft_transform_headshape", + "ft_transform_sens", + "ft_transform_vol", + "ft_version", + "ft_warning", + "ft_warp_apply", + "ft_warp_error", + "ft_warp_optim", + "getsubfield", + "hasyokogawa", + "issubfield", + "istrue", + "keepfields", + "keyval", + "keyvalcheck", + "markdown2matlab", + "match_str", + "match_val", + "matlab2markdown", + "memtic", + "memtoc", + "nearest", + "printstruct", + "removefields", + "renamefields", + "rmsubfield", + "setsubfield", + "strel_bol", + "tokenize", +] diff --git a/fieldtrip/__utilities/_align_ctf2acpc.py b/fieldtrip/__utilities/_align_ctf2acpc.py new file mode 100644 index 0000000..aa5da6d --- /dev/null +++ b/fieldtrip/__utilities/_align_ctf2acpc.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def _align_ctf2acpc(*args, **kwargs): + """ + ALIGN_CTF2ACPC performs an approximate rigid body alignment of the anatomical + volume from CTF towards ACPC coordinates. Only the homogeneous transformation + matrix is modified and the coordsys-field is updated. + + Use as + mri = align_ctf2acpc(mri) + mri = align_ctf2acpc(mri, method) + mri = align_ctf2acpc(mri, method, template) + + The first input argument is a FieldTrip MRI-structure, and the second optional + argument specifies how the registration is to be done: + method = 0: only an approximate coregistration + method = 1: an approximate coregistration, followed by spm_affreg + method = 2: an approximate coregistration, followed by spm_normalise (default) + + When method = 1 or 2, an optional template filename can be specified, which denotes + the filename of the target volume. This is required when running in deployed + mode. + + See also ALIGN_NEUROMAG2ACPC, ALIGN_FSAVERAGE2MNI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/align_ctf2acpc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("align_ctf2acpc", *args, **kwargs) diff --git a/fieldtrip/__utilities/_align_fsaverage2mni.py b/fieldtrip/__utilities/_align_fsaverage2mni.py new file mode 100644 index 0000000..5200bad --- /dev/null +++ b/fieldtrip/__utilities/_align_fsaverage2mni.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _align_fsaverage2mni(*args, **kwargs): + """ + ALIGN_FSAVERAGE2MNI performs an affine alignment of the anatomical volume from + FSAVERAGE towards MNI coordinates. Only the homogeneous transformation matrix is + modified and the coordsys-field is updated. + + Use as + mri = align_fsaverage2mni(mri) + where the first input argument is a FieldTrip MRI-structure. + + with fsaverage we mean MNI305 + with mni we mean MNI152, i.e. the template used in SPM + + See http://freesurfer.net/fswiki/CoordinateSystems + + See also ALIGN_CTF2ACPC, ALIGN_NEUROMAG2ACPC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/align_fsaverage2mni.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("align_fsaverage2mni", *args, **kwargs) diff --git a/fieldtrip/__utilities/_align_neuromag2acpc.py b/fieldtrip/__utilities/_align_neuromag2acpc.py new file mode 100644 index 0000000..95b4863 --- /dev/null +++ b/fieldtrip/__utilities/_align_neuromag2acpc.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def _align_neuromag2acpc(*args, **kwargs): + """ + ALIGN_NEUROMAG2ACPC performs an approximate alignment of the anatomical + volume from NEUROMAG towards ACPC coordinates. Only the homogenous transformation + matrix is modified and the coordsys-field is updated. + + Use as + mri = align_neuromag2acpc(mri) + mri = align_neuromag2acpc(mri, method) + mri = align_neuromag2acpc(mri, method, template) + + The first input argument is a FieldTrip MRI-structure, and the second optional + argument specifies how the registration is to be done: + method = 0: only an approximate coregistration + method = 1: an approximate coregistration, followed by spm_affreg + method = 2: an approximate coregistration, followed by spm_normalise (default) + + When method = 1 or 2, an optional template filename can be specified, which denotes + the filename of the target volume. This is required when running in deployed + mode. + + See also ALIGN_CTF2ACPC, ALIGN_FSAVERAGE2MNI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/align_neuromag2acpc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("align_neuromag2acpc", *args, **kwargs) diff --git a/fieldtrip/__utilities/_avgoverdim.py b/fieldtrip/__utilities/_avgoverdim.py new file mode 100644 index 0000000..8fcbc52 --- /dev/null +++ b/fieldtrip/__utilities/_avgoverdim.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _avgoverdim(*args, **kwargs): + """ + avgoverdim is a function. + data = avgoverdim(data, avgdim, fb) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/avgoverdim.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("avgoverdim", *args, **kwargs) diff --git a/fieldtrip/__utilities/_avgoverlabel.py b/fieldtrip/__utilities/_avgoverlabel.py new file mode 100644 index 0000000..b5a7889 --- /dev/null +++ b/fieldtrip/__utilities/_avgoverlabel.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _avgoverlabel(*args, **kwargs): + """ + avgoverlabel is a function. + str = avgoverlabel(label) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/avgoverlabel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("avgoverlabel", *args, **kwargs) diff --git a/fieldtrip/__utilities/_base64encode.py b/fieldtrip/__utilities/_base64encode.py new file mode 100644 index 0000000..ffcf517 --- /dev/null +++ b/fieldtrip/__utilities/_base64encode.py @@ -0,0 +1,72 @@ +from fieldtrip._runtime import Runtime + + +def _base64encode(*args, **kwargs): + """ + BASE64ENCODE Perform base64 encoding on a string. + + BASE64ENCODE(STR, EOL) encode the given string STR. EOL is the line ending + sequence to use; it is optional and defaults to '\n' (ASCII decimal 10). + The returned encoded string is broken into lines of no more than 76 + characters each, and each line will end with EOL unless it is empty. Let + EOL be empty if you do not want the encoded string broken into lines. + + STR and EOL don't have to be strings (i.e., char arrays). The only + requirement is that they are vectors containing values in the range 0-255. + + This function may be used to encode strings into the Base64 encoding + specified in RFC 2045 - MIME (Multipurpose Internet Mail Extensions). The + Base64 encoding is designed to represent arbitrary sequences of octets in a + form that need not be humanly readable. A 65-character subset + ([A-Za-z0-9+/=]) of US-ASCII is used, enabling 6 bits to be represented per + printable character. + + Examples + -------- + + If you want to encode a large file, you should encode it in chunks that are + a multiple of 57 bytes. This ensures that the base64 lines line up and + that you do not end up with padding in the middle. 57 bytes of data fills + one complete base64 line (76 == 57*4/3): + + If ifid and ofid are two file identifiers opened for reading and writing, + respectively, then you can base64 encode the data with + + while ~feof(ifid) + fwrite(ofid, base64encode(fread(ifid, 60*57))); + end + + or, if you have enough memory, + + fwrite(ofid, base64encode(fread(ifid))); + + See also BASE64DECODE. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/base64encode.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("base64encode", *args, **kwargs) diff --git a/fieldtrip/__utilities/_channelposition.py b/fieldtrip/__utilities/_channelposition.py new file mode 100644 index 0000000..e7a2e89 --- /dev/null +++ b/fieldtrip/__utilities/_channelposition.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _channelposition(*args, **kwargs): + """ + CHANNELPOSITION computes the channel positions and orientations from the + MEG coils, EEG electrodes or NIRS optodes + + Use as + [pos, ori, lab] = channelposition(sens) + where sens is an gradiometer, electrode, or optode array. + + See also FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/channelposition.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("channelposition", *args, **kwargs) diff --git a/fieldtrip/__utilities/_convert_segmentationstyle.py b/fieldtrip/__utilities/_convert_segmentationstyle.py new file mode 100644 index 0000000..55b3754 --- /dev/null +++ b/fieldtrip/__utilities/_convert_segmentationstyle.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _convert_segmentationstyle(*args, **kwargs): + """ + CONVERT_SEGMENTATIONSTYLE is a helper function for converting between probabilistic + and indexed representations. It is used by FT_DATATYPE_SEGMENTATION and + FT_DATATYPE_PARCELLATION. + + See also FIXSEGMENTATION, DETERMINE_SEGMENTATIONSTYLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/convert_segmentationstyle.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("convert_segmentationstyle", *args, **kwargs) diff --git a/fieldtrip/__utilities/_coordsys2label.py b/fieldtrip/__utilities/_coordsys2label.py new file mode 100644 index 0000000..447dda2 --- /dev/null +++ b/fieldtrip/__utilities/_coordsys2label.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _coordsys2label(*args, **kwargs): + """ + COORDSYS2LABEL returns the labels for the three axes, given the symbolic + string representation of the coordinate system. + + Use as + [labelx, labely, labelz] = coordsys2label(coordsys, format, both) + + The scalar argument 'format' results in return values like these + 0) 'R' + 1) 'right' + 2) 'the right' + 3) '+X (right)' + + The boolean argument 'both' results in return values like these + 0) 'right' i.e. only the direction that it is pointing to + 1) {'left' 'right'} i.e. both the directions that it is pointing from and to + + See also FT_DETERMINE_COORDSYS, FT_PLOT_AXES, FT_HEADCOORDINATES, SETVIEWPOINT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/coordsys2label.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("coordsys2label", *args, **kwargs) diff --git a/fieldtrip/__utilities/_cornerpoints.py b/fieldtrip/__utilities/_cornerpoints.py new file mode 100644 index 0000000..e5dce25 --- /dev/null +++ b/fieldtrip/__utilities/_cornerpoints.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _cornerpoints(*args, **kwargs): + """ + CORNERPOINTS returns the eight corner points of an anatomical volume + in voxel and in head coordinates + + Use as + [voxel, head] = cornerpoints(dim, transform) + which will return two 8x3 matrices. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/cornerpoints.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("cornerpoints", *args, **kwargs) diff --git a/fieldtrip/__utilities/_dataset2files.py b/fieldtrip/__utilities/_dataset2files.py new file mode 100644 index 0000000..f75f2fc --- /dev/null +++ b/fieldtrip/__utilities/_dataset2files.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _dataset2files(*args, **kwargs): + """ + DATASET2FILES manages the filenames for the dataset, headerfile, datafile and eventfile + and tries to maintain a consistent mapping between them for each of the known fileformats + + Use as + [filename, headerfile, datafile] = dataset2files(filename, format) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/dataset2files.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("dataset2files", *args, **kwargs) diff --git a/fieldtrip/__utilities/_debugCleanup.py b/fieldtrip/__utilities/_debugCleanup.py new file mode 100644 index 0000000..a5362ce --- /dev/null +++ b/fieldtrip/__utilities/_debugCleanup.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _debugCleanup(*args, **kwargs): + """ + DEBUGCLEANUP is a cleanup function that is being used by FT_PREAMBLE_DEBUG. It is + called when a high-level FieldTrip function exits, either after finishing successfully or after detecting an error. + + See also FT_PREAMBLE_DEBUG, FT_POSTAMBLE_DEBUG + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/debugCleanup.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("debugCleanup", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/_defaultId.py b/fieldtrip/__utilities/_defaultId.py new file mode 100644 index 0000000..8db327b --- /dev/null +++ b/fieldtrip/__utilities/_defaultId.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _defaultId(*args, **kwargs): + """ + DEFAULTID returns a string that can serve as warning or error identifier, + for example 'FieldTip:ft_read_header:line345'. + + See also WARNING, ERROR, FT_NOTICE, FT_INFO, FT_DEBUG + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/defaultId.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("defaultId", *args, **kwargs) diff --git a/fieldtrip/__utilities/_determine_segmentationstyle.py b/fieldtrip/__utilities/_determine_segmentationstyle.py new file mode 100644 index 0000000..4379e17 --- /dev/null +++ b/fieldtrip/__utilities/_determine_segmentationstyle.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _determine_segmentationstyle(*args, **kwargs): + """ + DETERMINE_SEGMENTATIONSTYLE is a helper function that determines the type of segmentation + contained in each of the fields. It is used by FT_DATATYPE_SEGMENTATION and + FT_DATATYPE_PARCELLATION. + + See also FIXSEGMENTATION, CONVERT_SEGMENTATIONSTYLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/determine_segmentationstyle.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("determine_segmentationstyle", *args, **kwargs) diff --git a/fieldtrip/__utilities/_dimindex.py b/fieldtrip/__utilities/_dimindex.py new file mode 100644 index 0000000..492b14b --- /dev/null +++ b/fieldtrip/__utilities/_dimindex.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _dimindex(*args, **kwargs): + """ + DIMINDEX makes a selection from a multi-dimensional array where the dimension is + selected by a scalar, not by the place between the brackets. + + Use as + M = dimindex(A,dim,idx) + + The purpose of the function is shown by the following example: + + A(:,:,:,23,:,:,...) is the same as dimindex(A,4,23) + A(2,4,3) is the same as dimindex(A,[1,2,3],[2,4,3]) + A(4,:,[5:10]) is the same as dimindex(A,[1,3],{4,[5:10]}) + + See also the function DIMASSIGN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/dimindex.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("dimindex", *args, **kwargs) diff --git a/fieldtrip/__utilities/_dimlength.py b/fieldtrip/__utilities/_dimlength.py new file mode 100644 index 0000000..c7032a7 --- /dev/null +++ b/fieldtrip/__utilities/_dimlength.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _dimlength(*args, **kwargs): + """ + DIMLENGTH(DATA, SELDIM, FLD) is a helper function to obtain n, the number + of elements along dimension seldim from the appropriate field from the + input data containing functional data. + + Use als + [n, fn] = dimlength(data, seldim, fld) + + It can be called with one input argument only, in which case it will + output two cell arrays containing the size of the functional fields, + based on the XXXdimord, and the corresponding XXXdimord fields. + + When the data contains a single dimord field (everything except source + data), the cell-arrays in the output only contain one element. + + See also FIXSOURCE, CREATEDIMORD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/dimlength.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("dimlength", *args, **kwargs) diff --git a/fieldtrip/__utilities/_fixbalance.py b/fieldtrip/__utilities/_fixbalance.py new file mode 100644 index 0000000..60117ae --- /dev/null +++ b/fieldtrip/__utilities/_fixbalance.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _fixbalance(*args, **kwargs): + """ + FIXBALANCE ensures that the balancing representation in grad.balance or + elec.balance field is up to date and consistent, specifically with the + list of linear projections (or montages) being applied specified as + cell-array in "current", and not as a string in "current" and cell-array + in "previous". + + See also FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/fixbalance.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixbalance", *args, **kwargs) diff --git a/fieldtrip/__utilities/_fixcoordsys.py b/fieldtrip/__utilities/_fixcoordsys.py new file mode 100644 index 0000000..e834890 --- /dev/null +++ b/fieldtrip/__utilities/_fixcoordsys.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _fixcoordsys(*args, **kwargs): + """ + FIXCOORDSYS ensures that the coordinate system is consistently + described. E.g. SPM and MNI are technically the same coordinate + system, but the strings 'spm' and 'mni' are different. + + See also FT_DETERMINE_COORDSYS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/fixcoordsys.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixcoordsys", *args, **kwargs) diff --git a/fieldtrip/__utilities/_fixdimord.py b/fieldtrip/__utilities/_fixdimord.py new file mode 100644 index 0000000..11f9fd4 --- /dev/null +++ b/fieldtrip/__utilities/_fixdimord.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def _fixdimord(*args, **kwargs): + """ + FIXDIMORD ensures consistency between the dimord string and the axes + that describe the data dimensions. The main purpose of this function + is to ensure backward compatibility of all functions with data that has + been processed by older FieldTrip versions. + + Use as + [data] = fixdimord(data) + This will modify the data.dimord field to ensure consistency. + The name of the axis is the same as the name of the dimord, i.e. if + dimord='freq_time', then data.freq and data.time should be present. + + The default dimensions in the data are described by + 'time' + 'freq' + 'chan' + 'chancmb' + 'refchan' + 'subj' + 'rpt' + 'rpttap' + 'pos' + 'ori' + 'rgb' + 'comp' + 'voxel' + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/fixdimord.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixdimord", *args, **kwargs) diff --git a/fieldtrip/__utilities/_fixdipole.py b/fieldtrip/__utilities/_fixdipole.py new file mode 100644 index 0000000..ed217de --- /dev/null +++ b/fieldtrip/__utilities/_fixdipole.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _fixdipole(*args, **kwargs): + """ + FIXDIPOLE ensures that the dipole position and moment are + consistently represented throughout FieldTrip functions. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/fixdipole.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixdipole", *args, **kwargs) diff --git a/fieldtrip/__utilities/_fixinside.py b/fieldtrip/__utilities/_fixinside.py new file mode 100644 index 0000000..9901f5b --- /dev/null +++ b/fieldtrip/__utilities/_fixinside.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _fixinside(*args, **kwargs): + """ + FIXINSIDE ensures that the region of interest (which is indicated by the + field "inside") is consistently defined for source structures and volume + structures. Furthermore, it solves backward compatibility problems. + + Use as + [source] = fixinside(source, 'logical'); + or + [source] = fixinside(source, 'index'); + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/fixinside.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixinside", *args, **kwargs) diff --git a/fieldtrip/__utilities/_fixname.py b/fieldtrip/__utilities/_fixname.py new file mode 100644 index 0000000..ab51371 --- /dev/null +++ b/fieldtrip/__utilities/_fixname.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _fixname(*args, **kwargs): + """ + FIXNAME changes all inappropriate characters in a string into '_' + so that it can be used as a filename or as a field name in a structure. + If the string begins with a digit, an 'x' is prepended. + + Use as + str = fixname(str) + + MATLAB 2014a introduces the matlab.lang.makeValidName and + matlab.lang.makeUniqueStrings functions for constructing unique + identifiers, but this particular implementation also works with + older MATLAB versions. + + See also DEBLANK, STRIP, PAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/fixname.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixname", *args, **kwargs) diff --git a/fieldtrip/__utilities/_fixoldorg.py b/fieldtrip/__utilities/_fixoldorg.py new file mode 100644 index 0000000..97ddb4b --- /dev/null +++ b/fieldtrip/__utilities/_fixoldorg.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _fixoldorg(*args, **kwargs): + """ + FIXOLDORG use "old/new" instead of "org/new" + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/fixoldorg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixoldorg", *args, **kwargs) diff --git a/fieldtrip/__utilities/_fixpos.py b/fieldtrip/__utilities/_fixpos.py new file mode 100644 index 0000000..27215d1 --- /dev/null +++ b/fieldtrip/__utilities/_fixpos.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _fixpos(*args, **kwargs): + """ + FIXPOS helper function to ensure that meshes are described properly + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/fixpos.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixpos", *args, **kwargs) diff --git a/fieldtrip/__utilities/_fixsampleinfo.py b/fieldtrip/__utilities/_fixsampleinfo.py new file mode 100644 index 0000000..205eab8 --- /dev/null +++ b/fieldtrip/__utilities/_fixsampleinfo.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _fixsampleinfo(*args, **kwargs): + """ + FIXSAMPLEINFO checks for the existence of a sampleinfo and trialinfo field in the + provided raw or timelock data structure. If present, nothing is done; if absent, + this function attempts to reconstruct them based on either an trl-matrix present in + the cfg-tree, or by just assuming the trials are segments of a continuous + recording. + + See also FT_DATATYPE_RAW, FT_DATATYPE_TIMELOCK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/fixsampleinfo.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixsampleinfo", *args, **kwargs) diff --git a/fieldtrip/__utilities/_fixsegmentation.py b/fieldtrip/__utilities/_fixsegmentation.py new file mode 100644 index 0000000..ff43b36 --- /dev/null +++ b/fieldtrip/__utilities/_fixsegmentation.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _fixsegmentation(*args, **kwargs): + """ + FIXSEGMENTATION is a helper function that ensures the segmentation to be internally + consistent. It is used by FT_DATATYPE_SEGMENTATION and FT_DATATYPE_PARCELLATION. + + % See also CONVERT_SEGMENTATIONSTYLE, DETERMINE_SEGMENTATIONSTYLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/fixsegmentation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixsegmentation", *args, **kwargs) diff --git a/fieldtrip/__utilities/_fixsource.py b/fieldtrip/__utilities/_fixsource.py new file mode 100644 index 0000000..2fb4002 --- /dev/null +++ b/fieldtrip/__utilities/_fixsource.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def _fixsource(*args, **kwargs): + """ + FIXSOURCE converts old style source structures into new style source structures + + Use as + output = fixsource(input) + where input is a structure representing source data + + Typically, old style source structures contain source.avg.XXX or source.trial.XXX. + Furthermore. old style source structrures do not contain a dimord field. + + The new style source structure contains: + source.pos Nx3 list with source positions + source.dim optional, if the list of positions describes a 3D volume + source.XXX the old style subfields in avg/trial + source.XXXdimord string how to interpret the respective XXX field: + + For example + source.pow = zeros(Npos,Ntime) + source.powdimord = 'pos_time' + + source.mom = cell(1,Npos) + source.mom{1} = zeros(Nori,Nrpttap) + source.momdimord = '{pos}_ori_rpttap' + + source.leadfield = cell(1,Npos) + source.leadfield{1} = zeros(Nchan,Nori) + source.leadfielddimord = '{pos}_chan_ori' + + See also FT_CHECKDATA, FIXVOLUME + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/fixsource.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixsource", *args, **kwargs) diff --git a/fieldtrip/__utilities/_fixvolume.py b/fieldtrip/__utilities/_fixvolume.py new file mode 100644 index 0000000..3df8651 --- /dev/null +++ b/fieldtrip/__utilities/_fixvolume.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _fixvolume(*args, **kwargs): + """ + FIXVOLUME cleans up the volume data representation, removes old and obsoleted + fields and ensures that it is consistent with the most recent code. + + Use as + output = fixvolume(input) + where input is a structure representing volume data + + See also FT_CHECKDATA, FIXSOURCE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/fixvolume.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixvolume", *args, **kwargs) diff --git a/fieldtrip/__utilities/_ft_findcfg.py b/fieldtrip/__utilities/_ft_findcfg.py new file mode 100644 index 0000000..eaf7cb8 --- /dev/null +++ b/fieldtrip/__utilities/_ft_findcfg.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _ft_findcfg(*args, **kwargs): + """ + FT_FINDCFG searches for an element in the cfg structure + or in the nested previous cfgs + + Use as + val = ft_findcfg(cfg, var) + where the name of the variable should be specified as string. + + e.g. + trl = ft_findcfg(cfg, 'trl') + event = ft_findcfg(cfg, 'event') + + See also FT_GETOPT, FT_CFG2KEYVAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/ft_findcfg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_findcfg", *args, **kwargs) diff --git a/fieldtrip/__utilities/_ft_notification.py b/fieldtrip/__utilities/_ft_notification.py new file mode 100644 index 0000000..49cd143 --- /dev/null +++ b/fieldtrip/__utilities/_ft_notification.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _ft_notification(*args, **kwargs): + """ + FT_NOTIFICATION works mostly like the WARNING and ERROR commands in MATLAB and + is called by FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO and FT_DEBUG. Please note + that you should not call this function directly. + + Some examples: + ft_info on + ft_info on msgId + ft_info off + ft_info off msgId + ft_info once + ft_info once msgId + ft_info on backtrace + ft_info off backtrace + ft_info on verbose + ft_info off verbose + + ft_info query % shows the status of all notifications + ft_info last % shows the last notification + ft_info clear % clears the status of all notifications + ft_info timeout 10 % sets the timeout (for 'once') to 10 seconds + + See also DEFAULTID, FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/ft_notification.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_notification", *args, **kwargs) diff --git a/fieldtrip/__utilities/_ft_struct2json.py b/fieldtrip/__utilities/_ft_struct2json.py new file mode 100644 index 0000000..034bdff --- /dev/null +++ b/fieldtrip/__utilities/_ft_struct2json.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _ft_struct2json(*args, **kwargs): + """ + FT_STRUCT2JSON + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/ft_struct2json.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_struct2json", *args, **kwargs) diff --git a/fieldtrip/__utilities/_ft_test_compare.py b/fieldtrip/__utilities/_ft_test_compare.py new file mode 100644 index 0000000..15db036 --- /dev/null +++ b/fieldtrip/__utilities/_ft_test_compare.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _ft_test_compare(*args, **kwargs): + """ + FT_TEST_COMPARE documentation is included inside ft_test documentation. + + See also FT_TEST + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/ft_test_compare.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_test_compare", *args, **kwargs) diff --git a/fieldtrip/__utilities/_ft_test_find_dependency.py b/fieldtrip/__utilities/_ft_test_find_dependency.py new file mode 100644 index 0000000..0f62e7b --- /dev/null +++ b/fieldtrip/__utilities/_ft_test_find_dependency.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _ft_test_find_dependency(*args, **kwargs): + """ + FT_TEST_FIND_DEPENDENCY documentation is included inside ft_test + documentation. + + See also FT_TEST + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/ft_test_find_dependency.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_test_find_dependency", *args, **kwargs) diff --git a/fieldtrip/__utilities/_ft_test_moxunit_run.py b/fieldtrip/__utilities/_ft_test_moxunit_run.py new file mode 100644 index 0000000..abcbaba --- /dev/null +++ b/fieldtrip/__utilities/_ft_test_moxunit_run.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _ft_test_moxunit_run(*args, **kwargs): + """ + FT_TEST_MOXUNIT_RUN documentation is included inside ft_test + documentation. + + See also FT_TEST + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/ft_test_moxunit_run.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_test_moxunit_run", *args, **kwargs) diff --git a/fieldtrip/__utilities/_ft_test_report.py b/fieldtrip/__utilities/_ft_test_report.py new file mode 100644 index 0000000..95a7e6a --- /dev/null +++ b/fieldtrip/__utilities/_ft_test_report.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _ft_test_report(*args, **kwargs): + """ + FT_TEST_REPORT documentation is included inside ft_test documentation. + + See also FT_TEST + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/ft_test_report.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_test_report", *args, **kwargs) diff --git a/fieldtrip/__utilities/_ft_test_run.py b/fieldtrip/__utilities/_ft_test_run.py new file mode 100644 index 0000000..24f2869 --- /dev/null +++ b/fieldtrip/__utilities/_ft_test_run.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _ft_test_run(*args, **kwargs): + """ + FT_TEST_RUN documentation is included inside ft_test documentation. + + See also FT_TEST + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/ft_test_run.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_test_run", *args, **kwargs) diff --git a/fieldtrip/__utilities/_ft_test_untested_functions.py b/fieldtrip/__utilities/_ft_test_untested_functions.py new file mode 100644 index 0000000..0093fa4 --- /dev/null +++ b/fieldtrip/__utilities/_ft_test_untested_functions.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _ft_test_untested_functions(*args, **kwargs): + """ + FT_TEST_UNTESTED_FUNCTIONS documentation is included inside ft_test + documentation. + + See also FT_TEST + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/ft_test_untested_functions.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_test_untested_functions", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/_ft_test_update_dependency.py b/fieldtrip/__utilities/_ft_test_update_dependency.py new file mode 100644 index 0000000..08a27ce --- /dev/null +++ b/fieldtrip/__utilities/_ft_test_update_dependency.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _ft_test_update_dependency(*args, **kwargs): + """ + FT_TEST_UPDATE_DEPENDENCY documentation is included inside ft_test + documentation. + + See also FT_TEST, READLINES, WRITELINES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/ft_test_update_dependency.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_test_update_dependency", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/_ft_urlread.py b/fieldtrip/__utilities/_ft_urlread.py new file mode 100644 index 0000000..11ad550 --- /dev/null +++ b/fieldtrip/__utilities/_ft_urlread.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _ft_urlread(*args, **kwargs): + """ + FT_URLREAD + + The documentation of R2016b states that urlread is not recommended. + Use webread or webwrite instead. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/ft_urlread.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_urlread", *args, **kwargs) diff --git a/fieldtrip/__utilities/_funargname.py b/fieldtrip/__utilities/_funargname.py new file mode 100644 index 0000000..0574cfd --- /dev/null +++ b/fieldtrip/__utilities/_funargname.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _funargname(*args, **kwargs): + """ + FUNARGNAME returns the input and output arguments of the function + by parsing the m-file + + Use as + [input, output] = funargname(fname) + where the input and output function arguments will be returned + as cell-arrays containing strings. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/funargname.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("funargname", *args, **kwargs) diff --git a/fieldtrip/__utilities/_getaddress.py b/fieldtrip/__utilities/_getaddress.py new file mode 100644 index 0000000..eef9d97 --- /dev/null +++ b/fieldtrip/__utilities/_getaddress.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _getaddress(*args, **kwargs): + """ + GETADDRESS returns the IP address + + Use as + address = getaddress(); + or + address = getaddress(hostname); + + See also GETUSERNAME, GETHOSTNAME + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/getaddress.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getaddress", *args, **kwargs) diff --git a/fieldtrip/__utilities/_getdatfield.py b/fieldtrip/__utilities/_getdatfield.py new file mode 100644 index 0000000..6faaa39 --- /dev/null +++ b/fieldtrip/__utilities/_getdatfield.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _getdatfield(*args, **kwargs): + """ + GETDATFIELD + + Use as + [datfield, dimord] = getdatfield(data) + where the output arguments are cell-arrays. + + See also GETDIMORD, GETDIMSIZ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/getdatfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getdatfield", *args, **kwargs) diff --git a/fieldtrip/__utilities/_getdimord.py b/fieldtrip/__utilities/_getdimord.py new file mode 100644 index 0000000..28fd98e --- /dev/null +++ b/fieldtrip/__utilities/_getdimord.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _getdimord(*args, **kwargs): + """ + GETDIMORD determine the dimensions and order of a data field in a FieldTrip + structure. + + Use as + dimord = getdimord(data, field) + + See also GETDIMSIZ, GETDATFIELD, FIXDIMORD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/getdimord.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getdimord", *args, **kwargs) diff --git a/fieldtrip/__utilities/_getdimsiz.py b/fieldtrip/__utilities/_getdimsiz.py new file mode 100644 index 0000000..fafff37 --- /dev/null +++ b/fieldtrip/__utilities/_getdimsiz.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _getdimsiz(*args, **kwargs): + """ + GETDIMSIZ + + Use as + dimsiz = getdimsiz(data, field) + or + dimsiz = getdimsiz(data, field, numdim) + + MATLAB will not return the size of a field in the data structure that has trailing + singleton dimensions, since those are automatically squeezed out. With the optional + numdim parameter you can specify how many dimensions the data element has. This + will result in the trailing singleton dimensions being added to the output vector. + + Example use + dimord = getdimord(datastructure, fieldname); + dimtok = tokenize(dimord, '_'); + dimsiz = getdimsiz(datastructure, fieldname, numel(dimtok)); + + See also GETDIMORD, GETDATFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/getdimsiz.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getdimsiz", *args, **kwargs) diff --git a/fieldtrip/__utilities/_gethostname.py b/fieldtrip/__utilities/_gethostname.py new file mode 100644 index 0000000..99154c4 --- /dev/null +++ b/fieldtrip/__utilities/_gethostname.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _gethostname(*args, **kwargs): + """ + HOSTNAME returns the hostname of this computer + + Use as + str = hostname; + + See also GETUSERNAME, GETADDRESS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/gethostname.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("gethostname", *args, **kwargs) diff --git a/fieldtrip/__utilities/_getusername.py b/fieldtrip/__utilities/_getusername.py new file mode 100644 index 0000000..c768e8b --- /dev/null +++ b/fieldtrip/__utilities/_getusername.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _getusername(*args, **kwargs): + """ + GETUSERNAME + + Use as + str = getusername(); + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/getusername.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getusername", *args, **kwargs) diff --git a/fieldtrip/__utilities/_globalrescale.py b/fieldtrip/__utilities/_globalrescale.py new file mode 100644 index 0000000..06c94f9 --- /dev/null +++ b/fieldtrip/__utilities/_globalrescale.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _globalrescale(*args, **kwargs): + """ + GLOBALRESCALE creates the homogenous spatial transformation matrix + for a 7 parameter rigid-body transformation with global rescaling + + Use as + [H] = globalrescale(f) + + The transformation vector f should contain the + x-shift + y-shift + z-shift + followed by the + pitch (rotation around x-axis) + roll (rotation around y-axis) + yaw (rotation around z-axis) + followed by the + global rescaling factor + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/globalrescale.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("globalrescale", *args, **kwargs) diff --git a/fieldtrip/__utilities/_hcp_getopt.py b/fieldtrip/__utilities/_hcp_getopt.py new file mode 100644 index 0000000..c5a8c09 --- /dev/null +++ b/fieldtrip/__utilities/_hcp_getopt.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _hcp_getopt(*args, **kwargs): + """ + HCP_GETOPT parses the command line to the megconnectome executable + application, separating the options that start with -- from the file + names of the scripts to be executed. + + Use as + megconnectome.exe --option1 arg1 --option2 arg2 scriptA.m scriptB.m + splits the command line arguments into a cell-array with key-value pairs + and a cell-array with the filenames. + + In this example the hcp_getopt function returns + opts = {'option1', arg1, 'option2', arg2}; + args = {'scriptA.m', 'scriptB.m'} + + See also FT_GETOPT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/hcp_getopt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("hcp_getopt", *args, **kwargs) diff --git a/fieldtrip/__utilities/_hcp_provenance.py b/fieldtrip/__utilities/_hcp_provenance.py new file mode 100644 index 0000000..2976907 --- /dev/null +++ b/fieldtrip/__utilities/_hcp_provenance.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _hcp_provenance(*args, **kwargs): + """ + HCP_PROVENANCE returns a structure with provenance information + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/hcp_provenance.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("hcp_provenance", *args, **kwargs) diff --git a/fieldtrip/__utilities/_ignorefields.py b/fieldtrip/__utilities/_ignorefields.py new file mode 100644 index 0000000..3732d5f --- /dev/null +++ b/fieldtrip/__utilities/_ignorefields.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _ignorefields(*args, **kwargs): + """ + IGNOREFIELDS returns a list of fields that can be present in the cfg structure that + should be ignored at various places in the code, e.g. for provenance, history, + size-checking, etc. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/ignorefields.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ignorefields", *args, **kwargs) diff --git a/fieldtrip/__utilities/_individual2sn.py b/fieldtrip/__utilities/_individual2sn.py new file mode 100644 index 0000000..1068dfb --- /dev/null +++ b/fieldtrip/__utilities/_individual2sn.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _individual2sn(*args, **kwargs): + """ + INDIVIDUAL2SN warps the input coordinates (defined as Nx3 matrix) from + individual headspace coordinates into normalised MNI coordinates, using the + (inverse of the) warp parameters defined in the structure spmparams. + + this is code inspired by nutmeg and spm: nut_mri2mni, nut_spm_sn2def and + nut_spm_invdef which were themselves modified from code originally written + by John Ashburner: + http://www.sph.umich.edu/~nichols/JohnsGems2.html + + Use as + [warped] = individual2sn(P, input) + + Input parameters: + P = structure that contains the contents of an spm generated _sn.mat + file, or the representation of the parameters as of SPM12 + input = Nx3 array containing the input positions + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/individual2sn.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("individual2sn", *args, **kwargs) diff --git a/fieldtrip/__utilities/_isplottingfunction.py b/fieldtrip/__utilities/_isplottingfunction.py new file mode 100644 index 0000000..35016c8 --- /dev/null +++ b/fieldtrip/__utilities/_isplottingfunction.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _isplottingfunction(*args, **kwargs): + """ + ISPLOTTINGFUNCTION is a helper function for reproducescript, and + is used for the cfg.reproducescript functionality. It compares the input + function name with the list of known FieldTrip plotting functions and + returns 1 if it is a plotting function, and 0 otherwise. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/isplottingfunction.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("isplottingfunction", *args, **kwargs) diff --git a/fieldtrip/__utilities/_labelcmb2indx.py b/fieldtrip/__utilities/_labelcmb2indx.py new file mode 100644 index 0000000..2fc4fc8 --- /dev/null +++ b/fieldtrip/__utilities/_labelcmb2indx.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def _labelcmb2indx(*args, **kwargs): + """ + LABELCMB2INDX computes an array with indices, corresponding to the order + in a list of labels, for an Nx2 list of label combinations + + Use as + [indx] = labelcmb2indx(labelcmb, label) + or + [indx] = labelcmb2indx(labelcmb) + + Labelcmb is an Nx2 cell-array with label combinations, label is an Mx1 + cell-array with labels. If only one input is provided, the indices are + with respect to the rows in the labelcmb matrix, where the corresponding + auto combinations are located. As a consequence, the labelcmb matrix + needs to contain rows containing auto-combinations + + Example: + labelcmb = {'a' 'b';'a' 'c';'b' 'c';'a' 'a';'b' 'b';'c' 'c'}; + label = {'a';'b';'c'}; + + indx = labelcmb2indx(labelcmb, label) + returns: [1 2;1 3;2 3;1 1;2 2;3 3] + + indx = labelcmb2indx(labelcmb) + returns: [4 5;4 6;5 6;4 4;5 5;6;6] + + This is a helper function to FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/labelcmb2indx.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("labelcmb2indx", *args, **kwargs) diff --git a/fieldtrip/__utilities/_leaveoneout.py b/fieldtrip/__utilities/_leaveoneout.py new file mode 100644 index 0000000..bf1b889 --- /dev/null +++ b/fieldtrip/__utilities/_leaveoneout.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _leaveoneout(*args, **kwargs): + """ + leaveoneout is a function. + data = leaveoneout(data) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/leaveoneout.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("leaveoneout", *args, **kwargs) diff --git a/fieldtrip/__utilities/_lmoutr.py b/fieldtrip/__utilities/_lmoutr.py new file mode 100644 index 0000000..f411b81 --- /dev/null +++ b/fieldtrip/__utilities/_lmoutr.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _lmoutr(*args, **kwargs): + """ + LMOUTR computes the la/mu parameters of a point projected to a triangle + + Use as + [la, mu, dist] = lmoutr(v1, v2, v3, r) + where v1, v2 and v3 are three vertices of the triangle, and r is + the point that is projected onto the plane spanned by the vertices + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/lmoutr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("lmoutr", *args, **kwargs) diff --git a/fieldtrip/__utilities/_lmoutrn.py b/fieldtrip/__utilities/_lmoutrn.py new file mode 100644 index 0000000..a11cb56 --- /dev/null +++ b/fieldtrip/__utilities/_lmoutrn.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _lmoutrn(*args, **kwargs): + """ + LMOUTRN computes the la/mu parameters of a point projected to triangles + + Use as + [la, mu, dist, proj] = lmoutrn(v1, v2, v3, r) + where v1, v2 and v3 are Nx3 matrices with vertex positions of the triangles, + and r is the point that is projected onto the planes spanned by the vertices + This is a vectorized version of Robert's lmoutrn function and is + generally faster than a for-loop around the mex-file. It also returns the + projection of the point r onto the planes of the triangles, and the signed + distance to the triangles. The sign of the distance is negative if the point + lies closer to the average across all vertices and the triangle under consideration. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/lmoutrn.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("lmoutrn", *args, **kwargs) diff --git a/fieldtrip/__utilities/_loadvar.py b/fieldtrip/__utilities/_loadvar.py new file mode 100644 index 0000000..40112ad --- /dev/null +++ b/fieldtrip/__utilities/_loadvar.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _loadvar(*args, **kwargs): + """ + LOADVAR is a helper function for cfg.inputfile + + See also SAVEVAR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/loadvar.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("loadvar", *args, **kwargs) diff --git a/fieldtrip/__utilities/_make_or_fetch_inputfile.py b/fieldtrip/__utilities/_make_or_fetch_inputfile.py new file mode 100644 index 0000000..84e4d7a --- /dev/null +++ b/fieldtrip/__utilities/_make_or_fetch_inputfile.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _make_or_fetch_inputfile(*args, **kwargs): + """ + MAKE_OR_FETCH_INPUTFILE is a helper function for ft_preamble_loadvar and ft_postamble_savevar, and + is used for the cfg.reproducescript functionality. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/make_or_fetch_inputfile.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("make_or_fetch_inputfile", *args, **kwargs) diff --git a/fieldtrip/__utilities/_makessense.py b/fieldtrip/__utilities/_makessense.py new file mode 100644 index 0000000..ac7b715 --- /dev/null +++ b/fieldtrip/__utilities/_makessense.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _makessense(*args, **kwargs): + """ + MAKESSENSE determines whether a some specific fields in a FieldTrip data structure + make sense. + + Use as + status = makessense(data, field) + + See also GETDIMORD, GETDIMSIZ, GETDATFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/makessense.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("makessense", *args, **kwargs) diff --git a/fieldtrip/__utilities/_memprofile.py b/fieldtrip/__utilities/_memprofile.py new file mode 100644 index 0000000..db759d1 --- /dev/null +++ b/fieldtrip/__utilities/_memprofile.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _memprofile(*args, **kwargs): + """ + MEMPROFILE this is a dummy placeholder + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/memprofile.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("memprofile", *args, **kwargs) diff --git a/fieldtrip/__utilities/_mergecellstruct.py b/fieldtrip/__utilities/_mergecellstruct.py new file mode 100644 index 0000000..3717bdb --- /dev/null +++ b/fieldtrip/__utilities/_mergecellstruct.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _mergecellstruct(*args, **kwargs): + """ + MERGECELLSTRUCT is a helper function for FT_TEST + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/mergecellstruct.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mergecellstruct", *args, **kwargs) diff --git a/fieldtrip/__utilities/_mergestruct.py b/fieldtrip/__utilities/_mergestruct.py new file mode 100644 index 0000000..08420f6 --- /dev/null +++ b/fieldtrip/__utilities/_mergestruct.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _mergestruct(*args, **kwargs): + """ + MERGESTRUCT merges the fields of a structure with another structure. The fields of + the 2nd structure are only copied in case they are absent in the 1st structure. + + Use as + s3 = mergestruct(s1, s2, emptymeaningful) + + See also PRINTSTRUCT, APPENDSTRUCT, COPYFIELDS, KEEPFIELDS, REMOVEFIELDS, MERGETABLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/mergestruct.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mergestruct", *args, **kwargs) diff --git a/fieldtrip/__utilities/_mesh_icosahedron.py b/fieldtrip/__utilities/_mesh_icosahedron.py new file mode 100644 index 0000000..d35e588 --- /dev/null +++ b/fieldtrip/__utilities/_mesh_icosahedron.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_icosahedron(*args, **kwargs): + """ + MESH_ICOSAHEDRON returns the vertices and triangle of a 12-vertex icosahedral + mesh. + + Use as + [pos, tri] = mesh_icosahedron + + See also MESH_TETRAHEDRON, MESH_OCTAHEDRON, MESH_SPHERE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/mesh_icosahedron.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_icosahedron", *args, **kwargs) diff --git a/fieldtrip/__utilities/_mesh_octahedron.py b/fieldtrip/__utilities/_mesh_octahedron.py new file mode 100644 index 0000000..d9f4d0e --- /dev/null +++ b/fieldtrip/__utilities/_mesh_octahedron.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_octahedron(*args, **kwargs): + """ + MESH_OCTAHEDRON returns the vertices and triangles of an octahedron + + Use as + [pos tri] = mesh_octahedron; + + See also MESH_TETRAHEDRON, MESH_OCTAHEDRON, MESH_SPHERE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/mesh_octahedron.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_octahedron", *args, **kwargs) diff --git a/fieldtrip/__utilities/_mesh_sphere.py b/fieldtrip/__utilities/_mesh_sphere.py new file mode 100644 index 0000000..977ccdf --- /dev/null +++ b/fieldtrip/__utilities/_mesh_sphere.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_sphere(*args, **kwargs): + """ + MESH_SPHERE creates spherical mesh, with approximately nvertices vertices + + Use as + [pos, tri] = mesh_sphere(n, method) + + The input parameter 'n' specifies the (approximate) number of vertices. If n is + empty, or undefined, a 12 vertex icosahedron will be returned. If n is specified + but the method is not specified, the most optimal method will be selected based on + n. + - If log4((n-2)/10) is an integer, the mesh will be based on an icosahedron. + - If log4((n-2)/4) is an integer, the mesh will be based on a refined octahedron. + - If log4((n-2)/2) is an integer, the mesh will be based on a refined tetrahedron. + - Otherwise, an msphere will be used. + + The input parameter 'method' defines which algorithm or approach to use. This can + be 'icosahedron', 'octahedron', 'tetrahedron', 'fibonachi', 'msphere', or 'ksphere'. + + See also MESH_TETRAHEDRON, MESH_OCTAHEDRON, MESH_ICOSAHEDRON + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/mesh_sphere.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_sphere", *args, **kwargs) diff --git a/fieldtrip/__utilities/_mesh_tetrahedron.py b/fieldtrip/__utilities/_mesh_tetrahedron.py new file mode 100644 index 0000000..c11ee12 --- /dev/null +++ b/fieldtrip/__utilities/_mesh_tetrahedron.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_tetrahedron(*args, **kwargs): + """ + MESH_TETRAHEDRON returns the vertices and triangles of a tetrahedron. + + Use as + [pos, tri] = mesh_tetrahedron; + + See also MESH_ICOSAHEDRON, MESH_OCTAHEDRON, MESH_SPHERE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/mesh_tetrahedron.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_tetrahedron", *args, **kwargs) diff --git a/fieldtrip/__utilities/_mutexlock.py b/fieldtrip/__utilities/_mutexlock.py new file mode 100644 index 0000000..45031bb --- /dev/null +++ b/fieldtrip/__utilities/_mutexlock.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _mutexlock(*args, **kwargs): + """ + MUTEXLOCK creates a lockfile, or if it already exists, waits until + another process removes the lockfile and then creates it. This function + can be used for "mutual exclusion", i.e. executing multiple processes in + parallel where part of the processing is not allowed to run + simultaneously. + + Use as + mutexlock(lockfile, timeout) + + See also MUTEXUNLOCK and http://en.wikipedia.org/wiki/Mutual_exclusion + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/mutexlock.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mutexlock", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/_mxSerialize.py b/fieldtrip/__utilities/_mxSerialize.py new file mode 100644 index 0000000..b85dd7a --- /dev/null +++ b/fieldtrip/__utilities/_mxSerialize.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _mxSerialize(*args, **kwargs): + """ + MXSERIALIZE converts any MATLAB object into a uint8 array suitable + for passing down a comms channel to be reconstructed at the other end. + + See also MXDESERIALIZE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/mxSerialize.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mxSerialize", *args, **kwargs) diff --git a/fieldtrip/__utilities/_offset2time.py b/fieldtrip/__utilities/_offset2time.py new file mode 100644 index 0000000..e0207f0 --- /dev/null +++ b/fieldtrip/__utilities/_offset2time.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _offset2time(*args, **kwargs): + """ + OFFSET2TIME converts the offset of a trial definition into a time-axis + according to the definition from DEFINETRIAL + + Use as + [time] = offset2time(offset, fsample, nsamples) + + The trialdefinition "trl" is an Nx3 matrix. The first column contains + the sample-indices of the begin of the trial relative to the begin + of the raw data , the second column contains the sample_indices of + the end of the trials, and the third column contains the offset of + the trigger with respect to the trial. An offset of 0 means that + the first sample of the trial corresponds to the trigger. A positive + offset indicates that the first sample is later than the trigger, a + negative offset indicates a trial beginning before the trigger. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/offset2time.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("offset2time", *args, **kwargs) diff --git a/fieldtrip/__utilities/_parameterselection.py b/fieldtrip/__utilities/_parameterselection.py new file mode 100644 index 0000000..432bb05 --- /dev/null +++ b/fieldtrip/__utilities/_parameterselection.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _parameterselection(*args, **kwargs): + """ + PARAMETERSELECTION selects the parameters that are present as a volume in the data + add that have a dimension that is compatible with the specified dimensions of the + volume, i.e. either as a vector or as a 3D volume. + + Use as + [select] = parameterselection(param, data) + where + param cell-array, or single string, can be 'all' + data structure with anatomical or functional data + select returns the selected parameters as a cell-array + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/parameterselection.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("parameterselection", *args, **kwargs) diff --git a/fieldtrip/__utilities/_pinvNx2.py b/fieldtrip/__utilities/_pinvNx2.py new file mode 100644 index 0000000..566b29e --- /dev/null +++ b/fieldtrip/__utilities/_pinvNx2.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _pinvNx2(*args, **kwargs): + """ + PINVNX2 computes a pseudo-inverse of the M slices of an MxNx2 real-valued matrix. + Output has dimensionality Mx2xN. This implementation is generally faster + than calling pinv in a for-loop, once M > 2 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/pinvNx2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("pinvNx2", *args, **kwargs) diff --git a/fieldtrip/__utilities/_plinprojn.py b/fieldtrip/__utilities/_plinprojn.py new file mode 100644 index 0000000..31533a1 --- /dev/null +++ b/fieldtrip/__utilities/_plinprojn.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _plinprojn(*args, **kwargs): + """ + PLINPROJN projects a point onto a line or linepiece + + [proj, dist] = plinprojn(l1, l2, r, flag) + + where l1 and l2 are Nx3 matrices with the begin and endpoints of the linepieces, + and r is the point that is projected onto the lines + This is a vectorized version of Robert's plinproj function and is + generally faster than a for-loop around the mex-file. + + the optional flag can be: + 0 (default) project the point anywhere on the complete line + 1 project the point within or on the edge of the linepiece + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/plinprojn.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("plinprojn", *args, **kwargs) diff --git a/fieldtrip/__utilities/_pos2dim.py b/fieldtrip/__utilities/_pos2dim.py new file mode 100644 index 0000000..2d5e8e6 --- /dev/null +++ b/fieldtrip/__utilities/_pos2dim.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _pos2dim(*args, **kwargs): + """ + POS2DIM reconstructs the volumetric dimensions from an ordered list of + positions. + + Use as + [dim] = pos2dim(pos) + where pos is an ordered list of positions. + + The output dim is a 3-element vector which correspond to the 3D + volumetric dimensions + + See also POS2TRANSFORM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/pos2dim.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("pos2dim", *args, **kwargs) diff --git a/fieldtrip/__utilities/_pos2transform.py b/fieldtrip/__utilities/_pos2transform.py new file mode 100644 index 0000000..5091e1f --- /dev/null +++ b/fieldtrip/__utilities/_pos2transform.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _pos2transform(*args, **kwargs): + """ + POS2TRANSFORM reconstructs a transformation matrix from an ordered list + of positions. + + Use as + [transform] = pos2transform(pos, dim) + where pos is an ordered list of positions that should specify a full 3D volume. + + The output transform is a 4x4 homogenous transformation matrix which transforms + from 'voxelspace' into the positions provided in the input + + See also POS2DIM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/pos2transform.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("pos2transform", *args, **kwargs) diff --git a/fieldtrip/__utilities/_printand.py b/fieldtrip/__utilities/_printand.py new file mode 100644 index 0000000..5f1aba4 --- /dev/null +++ b/fieldtrip/__utilities/_printand.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _printand(*args, **kwargs): + """ + PRINTAND prints a single or multiple strings as "x1, x2, x3 and x4". If there is + only one string, that string is returned without additional formatting. + + See also PRINTOR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/printand.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("printand", *args, **kwargs) diff --git a/fieldtrip/__utilities/_printor.py b/fieldtrip/__utilities/_printor.py new file mode 100644 index 0000000..0644ebb --- /dev/null +++ b/fieldtrip/__utilities/_printor.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _printor(*args, **kwargs): + """ + PRINTOR prints a single or multiple strings as "x1, x2, x3 or x4". If there is + only one string, that string is returned without additional formatting. + + See also PRINTAND + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/printor.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("printor", *args, **kwargs) diff --git a/fieldtrip/__utilities/_printstruct_as_table.py b/fieldtrip/__utilities/_printstruct_as_table.py new file mode 100644 index 0000000..23e31ae --- /dev/null +++ b/fieldtrip/__utilities/_printstruct_as_table.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _printstruct_as_table(*args, **kwargs): + """ + PRINTSTRUCT_AS_TABLE prints a struct-array as a table in Markdown format + + Example + s(1).a = 1 + s(1).b = 2 + s(2).a = 3 + s(2).b = 4 + printstruct_as_table(s) + + See also PRINTSTRUCT, APPENDSTRUCT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/printstruct_as_table.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("printstruct_as_table", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/_project_elec.py b/fieldtrip/__utilities/_project_elec.py new file mode 100644 index 0000000..071be8b --- /dev/null +++ b/fieldtrip/__utilities/_project_elec.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _project_elec(*args, **kwargs): + """ + PROJECT_ELEC projects electrodes on a triangulated surface + and returns triangle index, la/mu parameters and distance + + Use as + [el, prj] = project_elec(elc, pnt, tri) + which returns + el = Nx4 matrix with [tri, la, mu, dist] for each electrode + prj = Nx3 matrix with the projected electrode position + + See also TRANSFER_ELEC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/project_elec.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("project_elec", *args, **kwargs) diff --git a/fieldtrip/__utilities/_ptriproj.py b/fieldtrip/__utilities/_ptriproj.py new file mode 100644 index 0000000..202a119 --- /dev/null +++ b/fieldtrip/__utilities/_ptriproj.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _ptriproj(*args, **kwargs): + """ + PTRIPROJ projects a point onto the plane going through a triangle + + Use as + [proj, dist] = ptriproj(v1, v2, v3, r, flag) + where v1, v2 and v3 are three vertices of the triangle, and r is + the point that is projected onto the plane spanned by the vertices + + the optional flag can be: + 0 (default) project the point anywhere on the complete plane + 1 project the point within or on the edge of the triangle + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/ptriproj.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ptriproj", *args, **kwargs) diff --git a/fieldtrip/__utilities/_ptriprojn.py b/fieldtrip/__utilities/_ptriprojn.py new file mode 100644 index 0000000..569a60a --- /dev/null +++ b/fieldtrip/__utilities/_ptriprojn.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _ptriprojn(*args, **kwargs): + """ + PTRIPROJN projects a point onto the plane going through a set of + triangles + + Use as + [proj, dist] = ptriprojn(v1, v2, v3, r, flag) + where v1, v2 and v3 are Nx3 matrices with vertex positions of the triangles, + and r is the point that is projected onto the planes spanned by the vertices + This is a vectorized version of Robert's ptriproj function and is + generally faster than a for-loop around the mex-file. + + the optional flag can be: + 0 (default) project the point anywhere on the complete plane + 1 project the point within or on the edge of the triangle + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/ptriprojn.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ptriprojn", *args, **kwargs) diff --git a/fieldtrip/__utilities/_quaternion.py b/fieldtrip/__utilities/_quaternion.py new file mode 100644 index 0000000..3fb9a8c --- /dev/null +++ b/fieldtrip/__utilities/_quaternion.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _quaternion(*args, **kwargs): + """ + QUATERNION returns the homogenous coordinate transformation matrix corresponding to + a coordinate transformation described by 7 quaternion parameters. + + Use as + [H] = quaternion(Q) + where + Q [q0, q1, q2, q3, q4, q5, q6] vector with parameters + H corresponding homogenous transformation matrix + + If the input vector has length 6, it is assumed to represent a unit quaternion without scaling. + + See Neuromag/Elekta/Megin MaxFilter manual version 2.2, section "D2 Coordinate Matching", page 77 for more details and + https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#Conversion_to_and_from_the_matrix_representation + + See also TRANSLATE, ROTATE, SCALE, HOMOGENOUS2QUATERNION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/quaternion.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("quaternion", *args, **kwargs) diff --git a/fieldtrip/__utilities/_randomseed.py b/fieldtrip/__utilities/_randomseed.py new file mode 100644 index 0000000..302b5cf --- /dev/null +++ b/fieldtrip/__utilities/_randomseed.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _randomseed(*args, **kwargs): + """ + RANDOMSEED retrieves or sets the random seed, taking into account the different + MATLAB version specific methods + + Use as + state = randomseed(setseed) + + INPUT + setseed [] does not reset the state, but saves out the state for future use + integer seed value to set to specific state + state vector state value (vector) output from previous call to setting the state + + OUTPUT + state vector of current state (or seed only) + + The output can be used as input re-create the same random number sequence + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/randomseed.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("randomseed", *args, **kwargs) diff --git a/fieldtrip/__utilities/_recursive_download.py b/fieldtrip/__utilities/_recursive_download.py new file mode 100644 index 0000000..669b9d1 --- /dev/null +++ b/fieldtrip/__utilities/_recursive_download.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _recursive_download(*args, **kwargs): + """ + RECURSIVE_DOWNLOAD downloads a complete directory from a RESTful web service + + Use as + recursive_download(webLocation, localFolder) + + See also WEBREAD, WEBSAVE, UNTAR, UNZIP, GUNZIP + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/recursive_download.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("recursive_download", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/_refine.py b/fieldtrip/__utilities/_refine.py new file mode 100644 index 0000000..ecd887a --- /dev/null +++ b/fieldtrip/__utilities/_refine.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def _refine(*args, **kwargs): + """ + REFINE a 3D surface that is described by a triangulation + + Use as + [pos, tri] = refine(pos, tri) + [pos, tri] = refine(pos, tri, 'banks') + [pos, tri, texture] = refine(pos, tri, 'banks', texture) + [pos, tri] = refine(pos, tri, 'updown', numtri) + + If no method is specified, the default is to refine the mesh globally by bisecting + each edge according to the algorithm described in Banks, 1983. + + The Banks method allows the specification of a subset of triangles to be refined + according to Banks' algorithm. Adjacent triangles will be gracefully dealt with. + + The alternative 'updown' method refines the mesh a couple of times + using Banks' algorithm, followed by a downsampling using the REDUCEPATCH + function. + + If the textures of the vertices are specified, the textures for the new + vertices are computed + + The Banks method is a memory efficient implementation which remembers the + previously inserted vertices. The refinement algorithm executes in linear + time with the number of triangles. It is mentioned in + http://www.cs.rpi.edu/~flaherje/pdf/fea8.pdf, which also contains the original + reference. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/refine.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("refine", *args, **kwargs) diff --git a/fieldtrip/__utilities/_reproducescript.py b/fieldtrip/__utilities/_reproducescript.py new file mode 100644 index 0000000..0e5f981 --- /dev/null +++ b/fieldtrip/__utilities/_reproducescript.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _reproducescript(*args, **kwargs): + """ + This is a helper function to create a script that reproduces the analysis. It + appends the configuration and the function call to a MATLAB script. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/reproducescript.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("reproducescript", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/_rigidbody.py b/fieldtrip/__utilities/_rigidbody.py new file mode 100644 index 0000000..469a271 --- /dev/null +++ b/fieldtrip/__utilities/_rigidbody.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _rigidbody(*args, **kwargs): + """ + RIGIDBODY creates the homogenous spatial transformation matrix + for a 6 parameter rigid-body transformation + + Use as + [H] = rigidbody(f) + + The transformation vector f should contain the + x-shift + y-shift + z-shift + followed by the + pitch (rotation around x-axis, in degrees) + roll (rotation around y-axis, in degrees) + yaw (rotation around z-axis, in degrees) + + See also ROTATE, TRANSLATE, SCALE, QUATERNION, HOMOGENOUS2TRADITIONAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/rigidbody.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rigidbody", *args, **kwargs) diff --git a/fieldtrip/__utilities/_rotate.py b/fieldtrip/__utilities/_rotate.py new file mode 100644 index 0000000..73abcbf --- /dev/null +++ b/fieldtrip/__utilities/_rotate.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _rotate(*args, **kwargs): + """ + ROTATE returns the homogenous coordinate transformation matrix + corresponding to a rotation around the x, y and z-axis. The direction of + the rotation is according to the right-hand rule. + + Use as + [H] = rotate(R) + where + R [rx, ry, rz] in degrees + H corresponding homogenous transformation matrix + + Note that the order in which the rotations are performs matters. The + rotation is first done around the z-axis, then the y-axis and finally the + x-axis. + + See also TRANSLATE, SCALE, RIGIDBODY, QUATERNION, HOMOGENOUS2TRADITIONAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/rotate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rotate", *args, **kwargs) diff --git a/fieldtrip/__utilities/_save_large_cfg_fields.py b/fieldtrip/__utilities/_save_large_cfg_fields.py new file mode 100644 index 0000000..7396ea1 --- /dev/null +++ b/fieldtrip/__utilities/_save_large_cfg_fields.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _save_large_cfg_fields(*args, **kwargs): + """ + SAVE_LARGE_CFG_FIELDS is a helper function for ft_postamble_savevar and ft_postamble_savefig, and + is used for the cfg.reproducescript functionality. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/save_large_cfg_fields.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("save_large_cfg_fields", *args, **kwargs) diff --git a/fieldtrip/__utilities/_savevar.py b/fieldtrip/__utilities/_savevar.py new file mode 100644 index 0000000..4a88c99 --- /dev/null +++ b/fieldtrip/__utilities/_savevar.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _savevar(*args, **kwargs): + """ + SAVEVAR is a helper function for cfg.outputfile + + See also LOADVAR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/savevar.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("savevar", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/_scale.py b/fieldtrip/__utilities/_scale.py new file mode 100644 index 0000000..21e5400 --- /dev/null +++ b/fieldtrip/__utilities/_scale.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _scale(*args, **kwargs): + """ + SCALE returns the homogenous coordinate transformation matrix + corresponding to a scaling along the x, y and z-axis + + Use as + [H] = translate(S) + where + S [sx, sy, sz] scaling along each of the axes + H corresponding homogenous transformation matrix + + See also TRANSLATE, ROTATE, RIGIDBODY, QUATERNION, HOMOGENOUS2TRADITIONAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/scale.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("scale", *args, **kwargs) diff --git a/fieldtrip/__utilities/_selfromraw.py b/fieldtrip/__utilities/_selfromraw.py new file mode 100644 index 0000000..4f17e38 --- /dev/null +++ b/fieldtrip/__utilities/_selfromraw.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _selfromraw(*args, **kwargs): + """ + FIXME this function is not documented + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/selfromraw.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("selfromraw", *args, **kwargs) diff --git a/fieldtrip/__utilities/_seloverdim.py b/fieldtrip/__utilities/_seloverdim.py new file mode 100644 index 0000000..4fcf70c --- /dev/null +++ b/fieldtrip/__utilities/_seloverdim.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _seloverdim(*args, **kwargs): + """ + seloverdim is a function. + data = seloverdim(data, seldim, sel, fb) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/seloverdim.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("seloverdim", *args, **kwargs) diff --git a/fieldtrip/__utilities/_selparam.py b/fieldtrip/__utilities/_selparam.py new file mode 100644 index 0000000..4defba2 --- /dev/null +++ b/fieldtrip/__utilities/_selparam.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _selparam(*args, **kwargs): + """ + SELPARAM(DATA) extracts the fieldnames param of the structure data containing functional + data, which have a dimensionality consistent with the dimord field in the data. Selparam + is a helper function to selectdata + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/selparam.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("selparam", *args, **kwargs) diff --git a/fieldtrip/__utilities/_smartinput.py b/fieldtrip/__utilities/_smartinput.py new file mode 100644 index 0000000..38607ba --- /dev/null +++ b/fieldtrip/__utilities/_smartinput.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _smartinput(*args, **kwargs): + """ + SMARTINPUT helper function for smart interactive input from the command line + + Use as + [newval, change] = smartinput(question, oldval) + + See also INPUT, PAUSE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/smartinput.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("smartinput", *args, **kwargs) diff --git a/fieldtrip/__utilities/_sn2individual.py b/fieldtrip/__utilities/_sn2individual.py new file mode 100644 index 0000000..7b07539 --- /dev/null +++ b/fieldtrip/__utilities/_sn2individual.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _sn2individual(*args, **kwargs): + """ + SN2INDIVIDUAL warps the input coordinates (defined as Nx3 matrix) from + normalised MNI coordinates to individual headspace coordinates, using the + warp parameters defined in the structure spmparams. + + this is modified from code from nutmeg: nut_mni2mri, which was itself + modified from code originally written by John Ashburner: + http://www.sph.umich.edu/~nichols/JG2/get_orig_coord2.m + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/sn2individual.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sn2individual", *args, **kwargs) diff --git a/fieldtrip/__utilities/_time2offset.py b/fieldtrip/__utilities/_time2offset.py new file mode 100644 index 0000000..314f0c7 --- /dev/null +++ b/fieldtrip/__utilities/_time2offset.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _time2offset(*args, **kwargs): + """ + TIME2OFFSET converts a time-axis of a trial into the offset in samples + according to the definition from DEFINETRIAL + + Use as + [offset] = time2offset(time, fsample) + + The trialdefinition "trl" is an Nx3 matrix. The first column contains + the sample-indices of the begin of the trial relative to the begin + of the raw data , the second column contains the sample_indices of + the end of the trials, and the third column contains the offset of + the trigger with respect to the trial. An offset of 0 means that + the first sample of the trial corresponds to the trigger. A positive + offset indicates that the first sample is later than the trigger, a + negative offset indicates a trial beginning before the trigger. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/time2offset.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("time2offset", *args, **kwargs) diff --git a/fieldtrip/__utilities/_traditional.py b/fieldtrip/__utilities/_traditional.py new file mode 100644 index 0000000..19c0c02 --- /dev/null +++ b/fieldtrip/__utilities/_traditional.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def _traditional(*args, **kwargs): + """ + TRADITIONAL creates the homogenous spatial transformation matrix + for a 9 parameter traditional "Talairach-model" transformation + + Use as + [H] = traditional(f) + + The transformation vector f should contain the + x-shift + y-shift + z-shift + followed by the + pitch (rotation around x-axis) + roll (rotation around y-axis) + yaw (rotation around z-axis) + followed by the + x-rescaling factor + y-rescaling factor + z-rescaling factor + + The order in which the transformations are done is exactly opposite as + the list above, i.e. first z-rescale, ... and finally x-shift. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/traditional.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("traditional", *args, **kwargs) diff --git a/fieldtrip/__utilities/_translate.py b/fieldtrip/__utilities/_translate.py new file mode 100644 index 0000000..936f9bc --- /dev/null +++ b/fieldtrip/__utilities/_translate.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _translate(*args, **kwargs): + """ + TRANSLATE returns the homogenous coordinate transformation matrix + corresponding to a translation along the x, y and z-axis + + Use as + [H] = translate(T) + where + T [tx, ty, tz] translation along each of the axes + H corresponding homogenous transformation matrix + + See also ROTATE, SCALE, RIGIDBODY, QUATERNION, HOMOGENOUS2TRADITIONAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/translate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("translate", *args, **kwargs) diff --git a/fieldtrip/__utilities/_undobalancing.py b/fieldtrip/__utilities/_undobalancing.py new file mode 100644 index 0000000..08c1abf --- /dev/null +++ b/fieldtrip/__utilities/_undobalancing.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _undobalancing(*args, **kwargs): + """ + UNDOBALANCING removes all balancing coefficients from the gradiometer sensor array + + This is used in CHANNELPOSITION, FT_PREPARE_LAYOUT, FT_SENSTYPE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/undobalancing.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("undobalancing", *args, **kwargs) diff --git a/fieldtrip/__utilities/_unparcellate.py b/fieldtrip/__utilities/_unparcellate.py new file mode 100644 index 0000000..f378ae5 --- /dev/null +++ b/fieldtrip/__utilities/_unparcellate.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def _unparcellate(*args, **kwargs): + """ + UNPARCELLATE performs the reverse of a parcellation, by assigigning each + parcel's activation to the vertices that contributed to that parcel. + + Use as + + fun = unparcellate(data, parcellation, parameter, parcelparam, varargin) + + Required inputs: + + data = structure (or matrix) containing the parcellated functional data + parcellation = structure describing the parcellation, i.e. the parcel + membership for each of the vertices + parameter = string (or cell-array with labels) that specifies the + parameter to be used (if data is a structure) or how to + interpret the rows in the data matrix (if data is a matrix) + + Additional inputs are key-value pairs and pertain to bivariate data with + a 'labelcmb' specified in the input argument 'parameter'. + + avgoverref = 'yes' (or 'no') + directionality = 'both' (or 'inflow'/'outflow') + + Outputs: + fun = matrix Nvertices x size(data.(parameter),2) (or Nvertices x + size(data,2), containing the unparcellated data + + If the input was bivariate data with a labelcmb, an optional second + output argument gives a list of the reference parcels. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/unparcellate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("unparcellate", *args, **kwargs) diff --git a/fieldtrip/__utilities/_varsize.py b/fieldtrip/__utilities/_varsize.py new file mode 100644 index 0000000..1c317ef --- /dev/null +++ b/fieldtrip/__utilities/_varsize.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _varsize(*args, **kwargs): + """ + VARSIZE returns the size of a variable in bytes. It can be used on any MATLAB + variable, including structures and cell arrays. + + See also WHOS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/varsize.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("varsize", *args, **kwargs) diff --git a/fieldtrip/__utilities/_volumefillholes.py b/fieldtrip/__utilities/_volumefillholes.py new file mode 100644 index 0000000..7ead88a --- /dev/null +++ b/fieldtrip/__utilities/_volumefillholes.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _volumefillholes(*args, **kwargs): + """ + VOLUMEFILLHOLES is a helper function for segmentations + + See also VOLUMETHRESHOLD, VOLUMESMOOTH, VOLUMEPAD, VOLUMESELECTLARGEST + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/volumefillholes.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("volumefillholes", *args, **kwargs) diff --git a/fieldtrip/__utilities/_volumeflip.py b/fieldtrip/__utilities/_volumeflip.py new file mode 100644 index 0000000..97a44cd --- /dev/null +++ b/fieldtrip/__utilities/_volumeflip.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _volumeflip(*args, **kwargs): + """ + VOLUMEFLIP + + See also VOLUMEPERMUTE, ALIGN_IJK2XYZ, ALIGN_XYZ2IJK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/volumeflip.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("volumeflip", *args, **kwargs) diff --git a/fieldtrip/__utilities/_volumepermute.py b/fieldtrip/__utilities/_volumepermute.py new file mode 100644 index 0000000..11b37a5 --- /dev/null +++ b/fieldtrip/__utilities/_volumepermute.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _volumepermute(*args, **kwargs): + """ + VOLUMEPERMUTE + + See also VOLUMEFLIP, ALIGN_IJK2XYZ, ALIGN_XYZ2IJK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/volumepermute.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("volumepermute", *args, **kwargs) diff --git a/fieldtrip/__utilities/_volumesmooth.py b/fieldtrip/__utilities/_volumesmooth.py new file mode 100644 index 0000000..082e905 --- /dev/null +++ b/fieldtrip/__utilities/_volumesmooth.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _volumesmooth(*args, **kwargs): + """ + VOLUMESMOOTH is a helper function for segmentations + + See also VOLUMETHRESHOLD, VOLUMEFILLHOLES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/volumesmooth.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("volumesmooth", *args, **kwargs) diff --git a/fieldtrip/__utilities/_volumethreshold.py b/fieldtrip/__utilities/_volumethreshold.py new file mode 100644 index 0000000..f75a20a --- /dev/null +++ b/fieldtrip/__utilities/_volumethreshold.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _volumethreshold(*args, **kwargs): + """ + VOLUMETHRESHOLD is a helper function for segmentations. It applies a + relative threshold and subsequently looks for the largest connected part, + thereby removing small blobs such as vitamine E capsules. + + See also VOLUMEFILLHOLES, VOLUMESMOOTH, VOLUMEPAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/private/volumethreshold.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("volumethreshold", *args, **kwargs) diff --git a/fieldtrip/__utilities/appendstruct.py b/fieldtrip/__utilities/appendstruct.py new file mode 100644 index 0000000..130bb8e --- /dev/null +++ b/fieldtrip/__utilities/appendstruct.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def appendstruct(*args, **kwargs): + """ + APPENDSTRUCT appends a structure or a struct-array to another structure or + struct-array. It also works if the initial structure is an empty structure or an + empty double array. It also works if the input structures have different fields. + + Use as + ab = appendstruct(a, b) + + See also PRINTSTRUCT, MERGESTRUCT, COPYFIELDS, KEEPFIELDS, REMOVEFIELDS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/appendstruct.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("appendstruct", *args, **kwargs) diff --git a/fieldtrip/__utilities/copyfields.py b/fieldtrip/__utilities/copyfields.py new file mode 100644 index 0000000..61ec36a --- /dev/null +++ b/fieldtrip/__utilities/copyfields.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def copyfields(*args, **kwargs): + """ + COPYFIELDS copies a selection of the fields from one structure to another + + Use as + b = copyfields(a, b, fields); + which copies the specified fields over from structure a to structure b. Fields that + are specified but not present will be silently ignored. + + See also KEEPFIELDS, REMOVEFIELDS, RENAMEFIELDS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/copyfields.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("copyfields", *args, **kwargs) diff --git a/fieldtrip/__utilities/dccnpath.py b/fieldtrip/__utilities/dccnpath.py new file mode 100644 index 0000000..85ec5c1 --- /dev/null +++ b/fieldtrip/__utilities/dccnpath.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def dccnpath(*args, **kwargs): + """ + DCCNPATH manages the filename and path for test files. It helps to locate and read + test file from Linux, Windows or macOS computers both inside and outside the DCCN. + + Use as + filename = dccnpath(filename) + where the input filename corresponds to the test data on the DCCN cluster and the + output filename corresponds to the local file including the full path where the + test data is available. + + The location of the test data on the DCCN cluster is '/project/3031000.02/test' and + the location of the externally downloadable data is '/project/3031000.02/external/download' + and the specification of the input filename MUST start with the string '/project/3031000.02'. + + This function will search-and-replace the location on the DCCN cluster by the + location that applies to your computer. If needed, it will replace '/home' by 'H:', + '/project' by 'P:' and will replace forward by backward slashes. + + In case you have a local copy of the data, or if you are inside the DCCN and have + mounted the network drives in a non-standard fashion, you should specify the + data location using + global ft_default + ft_default.dccnpath = '/your/copy'; + + If you DO HAVE a local copy of the public data, it should contain a directory + with the name 'external/download'. The content of the test directory should match + that on the FieldTrip download server, for example '/your/copy/external/download/ctf'. + + If you DO NOT have a local copy and do not define ft_default.dccnpath manually, + then this function will automatically try to download the public data to a + temporary directory. + + See also WHICH, WEBSAVE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/dccnpath.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("dccnpath", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_affinecoordinates.py b/fieldtrip/__utilities/ft_affinecoordinates.py new file mode 100644 index 0000000..ea85954 --- /dev/null +++ b/fieldtrip/__utilities/ft_affinecoordinates.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def ft_affinecoordinates(*args, **kwargs): + """ + FT_AFFINECOORDINATES returns the affine coordinate transformation matrix that + converts FROM a specific head coordinate TO a specific head coordinate system. + + Use as + [transform] = ft_affinecoordinates(from, to) + + Note that translations are expressed in millimeters, therefore the geometrical data + to which this coordinate transformation is applied must also be specified in + millimeters. + + See also FT_CONVERT_COORDSYS, FT_CONVERT_UNITS, FT_HEADCOORDINATES, FT_WARP_APPLY + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_affinecoordinates.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_affinecoordinates", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_apply_montage.py b/fieldtrip/__utilities/ft_apply_montage.py new file mode 100644 index 0000000..8c3913f --- /dev/null +++ b/fieldtrip/__utilities/ft_apply_montage.py @@ -0,0 +1,78 @@ +from fieldtrip._runtime import Runtime + + +def ft_apply_montage(*args, **kwargs): + """ + FT_APPLY_MONTAGE changes the montage (i.e. linear combination) of a set of + electrode or gradiometer channels. A montage can be used for EEG rereferencing, MEG + synthetic gradients, MEG planar gradients or unmixing using ICA. This function not + only applies the montage to the EEG or MEG data, but also applies the montage to + the input EEG or MEG sensor array, which can subsequently be used for forward + computation and source reconstruction of the data. + + Use as + [sens] = ft_apply_montage(sens, montage, ...) + [data] = ft_apply_montage(data, montage, ...) + [freq] = ft_apply_montage(freq, montage, ...) + [montage] = ft_apply_montage(montage1, montage2, ...) + + A montage is specified as a structure with the fields + montage.tra = MxN matrix + montage.labelold = Nx1 cell-array + montage.labelnew = Mx1 cell-array + + As an example, a bipolar montage could look like this + bipolar.labelold = {'1', '2', '3', '4'} + bipolar.labelnew = {'1-2', '2-3', '3-4'} + bipolar.tra = [ + +1 -1 0 0 + 0 +1 -1 0 + 0 0 +1 -1 + ]; + + The montage can optionally also specify the channel type and unit of the input + and output data with + montage.chantypeold = Nx1 cell-array + montage.chantypenew = Mx1 cell-array + montage.chanunitold = Nx1 cell-array + montage.chanunitnew = Mx1 cell-array + + Additional options should be specified in key-value pairs and can be + 'keepunused' = string, 'yes' or 'no' (default = 'no') + 'feedback' = string, see FT_PROGRESS (default = 'text') + 'warning' = boolean, whether to show warnings (default = true) + + If the first input is a montage, then the second input montage will be + applied to the first. In effect, the output montage will first do + montage1, then montage2. + + See also FT_READ_SENS, FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_apply_montage.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_apply_montage", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_average_sens.py b/fieldtrip/__utilities/ft_average_sens.py new file mode 100644 index 0000000..0461d30 --- /dev/null +++ b/fieldtrip/__utilities/ft_average_sens.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def ft_average_sens(*args, **kwargs): + """ + FT_AVERAGE_SENS computes average sensor array from a series of input + arrays. Corresponding average fiducials can also be computed (optional) + + Use as + [asens, afid] = ft_average_sens(sens) + where sens is a 1xN structure array containing N sensor arrays + + Additional options should be specified in key-value pairs and can be + 'weights' a vector of weights (will be normalized to sum==1) + 'fiducials' optional structure array of headshapes + + See also FT_READ_SENS, FT_DATATYPE_SENS, FT_PREPARE_VOL_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_average_sens.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_average_sens", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_cfg2keyval.py b/fieldtrip/__utilities/ft_cfg2keyval.py new file mode 100644 index 0000000..4b10111 --- /dev/null +++ b/fieldtrip/__utilities/ft_cfg2keyval.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def ft_cfg2keyval(*args, **kwargs): + """ + FT_CFG2KEYVAL converts between a structure and a cell-array with key-value + pairs which can be used for optional input arguments. + + Use as + optarg = ft_cfg2keyval(cfg) + + See also FT_KEYVAL2CFG, FT_GETOPT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_cfg2keyval.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_cfg2keyval", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_channelcombination.py b/fieldtrip/__utilities/ft_channelcombination.py new file mode 100644 index 0000000..2d6fb08 --- /dev/null +++ b/fieldtrip/__utilities/ft_channelcombination.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def ft_channelcombination(*args, **kwargs): + """ + FT_CHANNELCOMBINATION creates a cell-array with combinations of EEG/MEG channels + for subsequent cross-spectral-density, coherence and/or connectivity ananalysis + + You should specify channel combinations as a two-column cell-array, + cfg.channelcmb = { 'EMG' 'MLF31' + 'EMG' 'MLF32' + 'EMG' 'MLF33' }; + to compare EMG with these three sensors, or + cfg.channelcmb = { 'MEG' 'MEG' }; + to make all MEG combinations, or + cfg.channelcmb = { 'EMG' 'MEG' }; + to make all combinations between the EMG and all MEG channels. + + For each column, you can specify a mixture of real channel labels + and of special strings that will be replaced by the corresponding + channel labels. Channels that are not present in the raw datafile + are automatically removed from the channel list. + + When directional connectivity measures will subsequently be computed, the + interpretation of each channel-combination is that the direction of the + interaction is from the first column to the second column. + + Note that the default behavior is to exclude symmetric pairs and + auto-combinations. + + See also FT_CHANNELSELECTION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_channelcombination.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_channelcombination", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_channelselection.py b/fieldtrip/__utilities/ft_channelselection.py new file mode 100644 index 0000000..3d93a8e --- /dev/null +++ b/fieldtrip/__utilities/ft_channelselection.py @@ -0,0 +1,83 @@ +from fieldtrip._runtime import Runtime + + +def ft_channelselection(*args, **kwargs): + """ + FT_CHANNELSELECTION makes a selection of EEG and/or MEG channel labels. This + function translates the user-specified list of channels into channel labels as they + occur in the data. This channel selection procedure can be used throughout + FieldTrip. + + You can specify a mixture of real channel labels and of special strings, or index + numbers that will be replaced by the corresponding channel labels. Channels that + are not present in the raw datafile are automatically removed from the channel + list. + + The order of the channels in the list that is returned corresponds to the order in + the data. + + E.g. the desired input specification can be: + 'all' is replaced by all channels in the datafile + 'gui' this will pop up a graphical user interface to select the channels + 'C*' is replaced by all channels that match the wildcard, e.g. C1, C2, C3, ... + '*1' is replaced by all channels that match the wildcard, e.g. C1, P1, F1, ... + 'M*1' is replaced by all channels that match the wildcard, e.g. MEG0111, MEG0131, MEG0131, ... + 'meg' is replaced by all MEG channels (works for CTF, 4D, Neuromag and Yokogawa) + 'megref' is replaced by all MEG reference channels (works for CTF and 4D) + 'meggrad' is replaced by all MEG gradiometer channels (works for CTF, Yokogawa and Neuromag306) + 'megplanar' is replaced by all MEG planar gradiometer channels (works for Neuromag306) + 'megmag' is replaced by all MEG magnetometer channels (works for Yokogawa and Neuromag306) + 'eeg' is replaced by all recognized EEG channels (this is system dependent) + 'eeg1020' is replaced by 'Fp1', 'Fpz', 'Fp2', 'F7', 'F3', ... + 'eog' is replaced by all recognized EOG channels + 'ecg' is replaced by all recognized ECG channels + 'nirs' is replaced by all channels recognized as NIRS channels + 'emg' is replaced by all channels in the datafile starting with 'EMG' + 'lfp' is replaced by all channels in the datafile starting with 'lfp' + 'mua' is replaced by all channels in the datafile starting with 'mua' + 'spike' is replaced by all channels in the datafile starting with 'spike' + 10 is replaced by the 10th channel in the datafile + + Other channel groups are + 'EEG1010' with approximately 90 electrodes + 'EEG1005' with approximately 350 electrodes + 'EEGREF' for mastoid and ear electrodes (M1, M2, LM, RM, A1, A2) + 'MZ' for MEG zenith + 'ML' for MEG left + 'MR' for MEG right + 'MLx', 'MRx' and 'MZx' with x=C,F,O,P,T for left/right central, frontal, occipital, parietal and temporal + + You can also exclude channels or channel groups using the following syntax + {'all', '-POz', '-Fp1', -EOG'} + + See also FT_PREPROCESSING, FT_SENSLABEL, FT_MULTIPLOTER, FT_MULTIPLOTTFR, + FT_SINGLEPLOTER, FT_SINGLEPLOTTFR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_channelselection.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_channelselection", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_checkconfig.py b/fieldtrip/__utilities/ft_checkconfig.py new file mode 100644 index 0000000..06ea2ff --- /dev/null +++ b/fieldtrip/__utilities/ft_checkconfig.py @@ -0,0 +1,72 @@ +from fieldtrip._runtime import Runtime + + +def ft_checkconfig(*args, **kwargs): + """ + FT_CHECKCONFIG checks the input cfg of the main FieldTrip functions + + It checks whether the cfg contains all the required options, it gives + a warning when renamed or deprecated options are used, and it makes sure + no forbidden options are used. If necessary and possible, this function + will adjust the cfg to the input requirements. If the input cfg does NOT + correspond to the requirements, this function gives an elaborate warning + message. + + It controls the relevant cfg options that are being passed on to other + functions, by putting them into substructures or converting them into the + required format. + + Use as + [cfg] = ft_checkconfig(cfg, ...) + + The behavior of checkconfig can be controlled by the following cfg options, which + can be set as global FieldTrip defaults (see FT_DEFAULTS) + cfg.checkconfig = 'pedantic', 'loose' or 'silent', this controls the how strict this function is + cfg.checksize = number in bytes (can be inf), this controls the maximum size of output cfg fields + + Optional input arguments should be specified as key-value pairs and can include + renamed = {'old', 'new'} % list the old and new option + renamedval = {'opt', 'old', 'new'} % list option and old and new value + allowedtype = {'opt', 'allowed1', ...} % list of allowed data type classes for a particular option, anything else will throw an error + allowedval = {'opt', 'allowed1', ...} % list of allowed values for a particular option, anything else will throw an error + required = {'opt1', 'opt2', etc.} % list the required options + allowed = {'opt1', 'opt2', etc.} % list the allowed options, all other options are forbidden + forbidden = {'opt1', 'opt2', etc.} % list the forbidden options, these result in an error + deprecated = {'opt1', 'opt2', etc.} % list the deprecated options + unused = {'opt1', 'opt2', etc.} % list the unused options, these will be removed and a warning is issued + createsubcfg = {'subname', etc.} % list the names of the sub-configuration items + createtopcfg = {'subname', etc.} % list the names of the sub-configuration items + dataset2files = 'yes', 'no' % converts dataset into headerfile and datafile + inside2logical = 'yes', 'no' % converts cfg.inside or cfg.sourcemodel.inside into logical representation + checksize = 'yes', 'no' % remove large fields from the cfg + + See also FT_CHECKDATA, FT_CHECKOPT, FT_DEFAULTS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_checkconfig.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_checkconfig", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_checkdata.py b/fieldtrip/__utilities/ft_checkdata.py new file mode 100644 index 0000000..25183c7 --- /dev/null +++ b/fieldtrip/__utilities/ft_checkdata.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def ft_checkdata(*args, **kwargs): + """ + FT_CHECKDATA checks the input data of the main FieldTrip functions, e.g. whether the + type of data structure corresponds with the required data. If necessary and possible, + this function will adjust the data structure to the input requirements (e.g. change + dimord, average over trials, convert inside from index into logical). + + If the input data does NOT correspond to the requirements, this function will give a + warning message and if applicable point the user to external documentation (link to + website). + + Use as + [data] = ft_checkdata(data, ...) + + Optional input arguments should be specified as key-value pairs and can include + feedback = 'yes' or 'no' + datatype = raw, freq, timelock, comp, spike, source, mesh, dip, volume, segmentation, parcellation + dimord = any combination of time, freq, chan, refchan, rpt, subj, chancmb, rpttap, pos + senstype = ctf151, ctf275, ctf151_planar, ctf275_planar, neuromag122, neuromag306, bti148, bti248, bti248_planar, magnetometer, electrode + fsample = sampling frequency to use to go from SPIKE to RAW representation + ismeg = 'yes' or 'no', requires the data to have a grad structure + iseeg = 'yes' or 'no', requires the data to have an elec structure + isnirs = 'yes' or 'no', requires the data to have an opto structure + hasunit = 'yes' or 'no' + hascoordsys = 'yes' or 'no' + haschantype = 'yes' or 'no' + haschanunit = 'yes' or 'no' + hassampleinfo = 'yes', 'no', or 'ifmakessense' (applies to raw and timelock data) + hascumtapcnt = 'yes' or 'no' (only applies to freq data) + hasdim = 'yes' or 'no' + hasdof = 'yes' or 'no' + hasbrain = 'yes' or 'no' (only applies to segmentation) + insidestyle = logical, index, can also be empty + cmbstyle = sparse, sparsewithpow, full, fullfast, fourier (applies to covariance and cross-spectral density) + segmentationstyle = indexed, probabilistic (only applies to segmentation) + parcellationstyle = indexed, probabilistic (only applies to parcellation) + trialinfostyle = matrix, table or empty + + For some options you can specify multiple values, e.g. + [data] = ft_checkdata(data, 'senstype', {'ctf151', 'ctf275'}), e.g. in megrealign + [data] = ft_checkdata(data, 'datatype', {'timelock', 'freq'}), e.g. in sourceanalysis + + See also FT_DATATYPE_XXX for each of the respective data types. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_checkdata.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_checkdata", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_checkopt.py b/fieldtrip/__utilities/ft_checkopt.py new file mode 100644 index 0000000..7d6b3bd --- /dev/null +++ b/fieldtrip/__utilities/ft_checkopt.py @@ -0,0 +1,76 @@ +from fieldtrip._runtime import Runtime + + +def ft_checkopt(*args, **kwargs): + """ + FT_CHECKOPT does a validity test on the types and values of a configuration + structure or cell-array with key-value pairs. + + Use as + opt = ft_checkopt(opt, key) + opt = ft_checkopt(opt, key, allowedtype) + opt = ft_checkopt(opt, key, allowedtype, allowedval) + + For allowedtype you can specify a string or a cell-array with multiple + strings. All the default MATLAB types can be specified, such as + 'double' + 'logical' + 'char' + 'single' + 'float' + 'int16' + 'cell' + 'struct' + 'function_handle' + + Furthermore, the following custom types can be specified + 'empty' + 'doublescalar' + 'doublevector' + 'doublebivector' i.e. [1 1] or [1 2] + 'ascendingdoublevector' i.e. [1 2 3 4 5], but not [1 3 2 4 5] + 'ascendingdoublebivector' i.e. [1 2], but not [2 1] + 'doublematrix' + 'numericscalar' + 'numericvector' + 'numericmatrix' + 'charcell' + + For allowedval you can specify a single value or a cell-array + with multiple values. + + This function will give an error or it returns the input configuration + structure or cell-array without modifications. A match on any of the + allowed types and any of the allowed values is sufficient to let this + function pass. + + See also FT_GETOPT, FT_SETOPT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_checkopt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_checkopt", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_compile_mex.py b/fieldtrip/__utilities/ft_compile_mex.py new file mode 100644 index 0000000..a96904e --- /dev/null +++ b/fieldtrip/__utilities/ft_compile_mex.py @@ -0,0 +1,61 @@ +from fieldtrip._runtime import Runtime + + +def ft_compile_mex(*args, **kwargs): + """ + FT_COMPILE_MEX can be used for compiling most of the FieldTrip MEX files Note that + this function does not put the MEX files in the correct location in the private + folders, this is managed by a Bash script. In case you are not working with Git and + you want to recompile the mex files for your platform, you can find all mex files + for your platform and move them to a backup directory that is not on your MATLAB + path. Subsequently you can rtun this function to recompile it on your platform with + your compiler settings + + The standards procedure for compiling mex files is detailed on + http://www.fieldtriptoolbox.org/development/guidelines/code#compiling_mex_files + + Please note that this script does NOT set up your MEX environment for you, so in + case you haven't selected the C compiler on Windows yet, you need to type 'mex + -setup' first to choose either the LCC, Borland or Microsoft compiler. If you want + to use MinGW, you also need to install Gnumex (http://gnumex.sourceforget.net), + which comes with its own procedure for setting up the MEX environment. + + The logic in this script is to first build a list of files that actually need + compilation for the particular platform that MATLAB is running on, and then to go + through that list. Functions are added to the list by giving their destination + directory and (relative to that) the name of the source file (without the .c). + Optionally, you can specify a list of platform this file needs to be compiled on + only, and a list of platforms where you don't compile it on. Finally, you can give + extra arguments to the MEX command, e.g., for including other c-sources or giving + compiler flags. + + See also MEX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_compile_mex.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_compile_mex", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/ft_compile_standalone.py b/fieldtrip/__utilities/ft_compile_standalone.py new file mode 100644 index 0000000..d779b80 --- /dev/null +++ b/fieldtrip/__utilities/ft_compile_standalone.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def ft_compile_standalone(*args, **kwargs): + """ + FT_COMPILE_STANDALONE compiles the FieldTrip functions along with + the standalone entry function into a compiled executable. + + The compiled executable includes + - all main FieldTrip m-files + - all main FieldTrip m-files dependencies for as long as these + dependencies are in the fieldtrip modules and external toolboxes + on the path, MATLAB built-in, or toolbox/(stats/images/signal) + functions + + See also FT_STANDALONE, FT_COMPILE_MEX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_compile_standalone.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_compile_standalone", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/ft_convert_coordsys.py b/fieldtrip/__utilities/ft_convert_coordsys.py new file mode 100644 index 0000000..69d8077 --- /dev/null +++ b/fieldtrip/__utilities/ft_convert_coordsys.py @@ -0,0 +1,72 @@ +from fieldtrip._runtime import Runtime + + +def ft_convert_coordsys(*args, **kwargs): + """ + FT_CONVERT_COORDSYS changes the coordinate system of the input object to the + specified coordinate system. The coordinate system of the input object is + determined from the 'coordsys' field in the input data, or needs to be determined + and specified interactively by the user. + + Use as + [output] = ft_convert_coordsys(input, target) + [output] = ft_convert_coordsys(input, target, method) + [output] = ft_convert_coordsys(input, target, method, template) + to determine and convert the coordinate system. + + With the optional method input argument you can determine whether to use SPM for an + affine or non-linear transformation. + method = 0: only an approximate coregistration (default for non-MRI data) + method = 1: an approximate coregistration, followed by spm_affreg + method = 2: an approximate coregistration, followed by spm_normalise (default for MRI data) + + The following input data structures are supported + electrode or gradiometer array, see FT_DATATYPE_SENS + volume conduction model, see FT_DATATYPE_HEADMODEL + source model, see FT_DATATYPE_SOURCE and FT_PREPARE_SOURCEMODEL + anatomical mri, see FT_DATATYPE_VOLUME + segmented mri, see FT_DATATYPE_SEGMENTATION + anatomical or functional atlas, see FT_READ_ATLAS + + Recognized and supported coordinate systems are 'ctf', 'bti', '4d', 'yokogawa', + 'eeglab', 'neuromag', 'itab', 'acpc', 'spm', 'mni', 'fsaverage', 'tal', 'scanras', + 'scanlps', 'dicom'. + + Furthermore, supported coordinate systems that do not specify the origin are 'ras', + 'als', 'lps', etc. See https://www.fieldtriptoolbox.org/faq/coordsys for more + details. + + Note that the conversion will be an automatic and approximate conversion, not + taking into account differences in individual anatomies/differences in conventions + where to put the fiducials. + + See also FT_DETERMINE_COORDSYS, FT_DETERMINE_UNITS, FT_CONVERT_UNITS, FT_PLOT_AXES, FT_PLOT_XXX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_convert_coordsys.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_convert_coordsys", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_datatype.py b/fieldtrip/__utilities/ft_datatype.py new file mode 100644 index 0000000..31dbaff --- /dev/null +++ b/fieldtrip/__utilities/ft_datatype.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def ft_datatype(*args, **kwargs): + """ + FT_DATATYPE determines the type of data represented in a FieldTrip data structure + and returns a string with raw, freq, timelock source, comp, spike, source, volume, + dip, montage, event. + + Use as + [type, dimord] = ft_datatype(data) + [bool] = ft_datatype(data, desired) + + See also FT_DATATYPE_COMP, FT_DATATYPE_FREQ, FT_DATATYPE_MVAR, + FT_DATATYPE_SEGMENTATION, FT_DATATYPE_PARCELLATION, FT_DATATYPE_SOURCE, + FT_DATATYPE_TIMELOCK, FT_DATATYPE_DIP, FT_DATATYPE_HEADMODEL, + FT_DATATYPE_RAW, FT_DATATYPE_SENS, FT_DATATYPE_SPIKE, FT_DATATYPE_VOLUME + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_datatype.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_datatype_comp.py b/fieldtrip/__utilities/ft_datatype_comp.py new file mode 100644 index 0000000..b4b6681 --- /dev/null +++ b/fieldtrip/__utilities/ft_datatype_comp.py @@ -0,0 +1,79 @@ +from fieldtrip._runtime import Runtime + + +def ft_datatype_comp(*args, **kwargs): + """ + FT_DATATYPE_COMP describes the FieldTrip MATLAB structure for comp data + + The comp data structure represents time-series channel-level data that has + been decomposed or unmixed from the channel level into its components or + "blind sources", for example using ICA (independent component analysis) or + PCA. This data structure is usually generated with the FT_COMPONENTANALYSIS + function. + + An example of a decomposed raw data structure with 100 components that resulted from + a 151-channel MEG recording is shown here: + + topo: [151x100 double] the component topographies + unmixing: [100x151 double] the component unmixing matrix + topolabel: {151x1 cell} the channel labels (e.g. 'MRC13') + label: {100x1 cell} the component labels (e.g. 'runica001') + time: {1x10 cell} the time axis [1*Ntime double] per trial + trial: {1x10 cell} the numeric data [151*Ntime double] per trial + grad: [1x1 struct] information about the sensor array (for EEG it is called elec) + cfg: [1x1 struct] the configuration used by the function that generated this data structure + + The only difference to the raw data structure is that the comp structure contains + the additional fields unmixing, topo and topolabel. Besides representing the time + series information as a raw data structure (see FT_DATATYPE_RAW), it is also + possible for time series information to be represented as timelock or freq + structures (see FT_DATATYPE_TIMELOCK or FT_DATATYPE_FREQ). + + Required fields: + - unmixing, topo, topolabel + + Optional fields: + - cfg, all fields from FT_DATATYPE_RAW, FT_DATATYPE_TIMELOCK or FT_DATATYPE_FREQ + + Historical fields: + - offset, fsample + + Revision history: + (2014) The combination of comp with raw, timelock or freq has been defined explicitly. + + (2011) The unmixing matrix has been added to the component data structure. + + (2003) The initial version was defined + + See also FT_DATATYPE, FT_DATATYPE_COMP, FT_DATATYPE_DIP, FT_DATATYPE_FREQ, + FT_DATATYPE_MVAR, FT_DATATYPE_RAW, FT_DATATYPE_SOURCE, FT_DATATYPE_SPIKE, + FT_DATATYPE_TIMELOCK, FT_DATATYPE_VOLUME + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_datatype_comp.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_comp", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_datatype_dip.py b/fieldtrip/__utilities/ft_datatype_dip.py new file mode 100644 index 0000000..0116ad4 --- /dev/null +++ b/fieldtrip/__utilities/ft_datatype_dip.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def ft_datatype_dip(*args, **kwargs): + """ + FT_DATATYPE_DIP descripts the FieldTrip MATLAB structure for dip data + + The dip structure represents a dipole model that has been fitted to + ERP or ERF data using a non-linear optimization approach. It is + usually generated by the FT_DIPOLEFITTING function. + + FIXME more information should be added here + + See also FT_DATATYPE, FT_DATATYPE_SOURCE, FT_DATATYPE_VOLUME + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_datatype_dip.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_dip", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_datatype_freq.py b/fieldtrip/__utilities/ft_datatype_freq.py new file mode 100644 index 0000000..48713f4 --- /dev/null +++ b/fieldtrip/__utilities/ft_datatype_freq.py @@ -0,0 +1,90 @@ +from fieldtrip._runtime import Runtime + + +def ft_datatype_freq(*args, **kwargs): + """ + FT_DATATYPE_FREQ describes the FieldTrip MATLAB structure for freq data + + The freq data structure represents frequency or time-frequency decomposed + channel-level data. This data structure is usually generated with the + FT_FREQANALYSIS function. + + An example of a freq data structure containing the powerspectrum for 306 channels + and 120 frequencies is + + dimord: 'chan_freq' defines how the numeric data should be interpreted + powspctrm: [306x120 double] the power spectrum + label: {306x1 cell} the channel labels + freq: [1x120 double] the frequencies expressed in Hz + cfg: [1x1 struct] the configuration used by the function that generated this data structure + + An example of a freq data structure containing the time-frequency resolved + spectral estimates of power (i.e. TFR) for 306 channels, 120 frequencies + and 60 timepoints is + + dimord: 'chan_freq_time' defines how the numeric data should be interpreted + powspctrm: [306x120x60 double] the power spectrum + label: {306x1 cell} the channel labels + freq: [1x120 double] the frequencies, expressed in Hz + time: [1x60 double] the time, expressed in seconds + cfg: [1x1 struct] the configuration used by the function that generated this data structure + + Required fields: + - freq, dimord, label or labelcmb + + Optional fields: + - powspctrm, fouriesspctrm, csdspctrm, cohspctrm, time, grad, elec, cumsumcnt, cumtapcnt, trialinfo + + Deprecated fields: + - + + Obsoleted fields: + - + + Revision history: + + (2011/latest) The description of the sensors has changed, see FT_DATATYPE_SENS + for further information. + + (2008) The presence of labelcmb in case of crsspctrm became optional, + from now on the crsspctrm can also be represented as Nchan * Nchan. + + (2006) The fourierspctrm field was added as alternative to powspctrm and + crsspctrm. The fields foi and toi were renamed to freq and time. + + (2003v2) The fields sgn and sgncmb were renamed into label and labelcmb. + + (2003v1) The initial version was defined. + + See also FT_DATATYPE, FT_DATATYPE_COMP, FT_DATATYPE_DIP, FT_DATATYPE_FREQ, + FT_DATATYPE_MVAR, FT_DATATYPE_RAW, FT_DATATYPE_SOURCE, FT_DATATYPE_SPIKE, + FT_DATATYPE_TIMELOCK, FT_DATATYPE_VOLUME + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_datatype_freq.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_freq", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_datatype_headmodel.py b/fieldtrip/__utilities/ft_datatype_headmodel.py new file mode 100644 index 0000000..f92dd71 --- /dev/null +++ b/fieldtrip/__utilities/ft_datatype_headmodel.py @@ -0,0 +1,98 @@ +from fieldtrip._runtime import Runtime + + +def ft_datatype_headmodel(*args, **kwargs): + """ + FT_DATATYPE_HEADMODEL describes the FieldTrip MATLAB structure for a volume + conduction model of the head that can be used for forward computations of the EEG + potentials or the MEG fields. The volume conduction model represents the + geometrical and the conductive properties of the head. These determine how the + secondary (or impressed) currents flow and how these contribute to the model + potential or field. + + A large number of forward solutions for the EEG and MEG are supported in FieldTrip, + each with its own specification of the MATLAB structure that describes the volume + conduction model of th ehead. It would be difficult to list all the possibilities + here. One common feature is that the volume conduction model should specify its + type, and that preferably it should specify the geometrical units in which it is + expressed (for example in mm, cm or m). + + An example of an EEG volume conduction model with 4 concentric spheres is: + + headmodel = + r: [86 88 94 100] + c: [0.33 1.79 0.042 0.33] + o: [0 0 0] + type: 'concentricspheres' + unit: 'mm' + + An example of an MEG volume conduction model with a single sphere fitted to + the scalp with its center 4 cm above the line connecting the ears is: + + headmodel = + r: [12] + o: [0 0 4] + type: 'singlesphere' + unit: 'cm' + + For each of the methods XXX for the volume conduction model, a corresponding + function FT_HEADMODEL_XXX exists that contains all specific details and + references to literature that describes the implementation. + + Required fields: + - type + + Optional fields: + - unit + + Deprecated fields: + - inner_skull_surface, source_surface, skin_surface, source, skin + + Obsoleted fields: + - + + Revision history: + + (2015/latest) Use the field name "pos" instead of "pnt" for vertex positions. + + (2014) All numeric values are represented in double precision. + + (2013) Always use the field "cond" for conductivity. + + (2012) Use consistent names for the volume conductor type in the structure, the + documentation and for the actual implementation, e.g. bem_openmeeg -> openmeeg, + fem_simbio -> simbio, concentric -> concentricspheres. Deprecated the fields + that indicate the index of the innermost and outermost surfaces. + + See also FT_PREPARE_HEADMODEL, FT_DATATYPE, FT_DATATYPE_COMP, FT_DATATYPE_DIP, + FT_DATATYPE_FREQ, FT_DATATYPE_MVAR, FT_DATATYPE_RAW, FT_DATATYPE_SOURCE, + FT_DATATYPE_SPIKE, FT_DATATYPE_TIMELOCK, FT_DATATYPE_VOLUME + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_datatype_headmodel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_headmodel", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_datatype_mvar.py b/fieldtrip/__utilities/ft_datatype_mvar.py new file mode 100644 index 0000000..cdb2ba0 --- /dev/null +++ b/fieldtrip/__utilities/ft_datatype_mvar.py @@ -0,0 +1,85 @@ +from fieldtrip._runtime import Runtime + + +def ft_datatype_mvar(*args, **kwargs): + """ + FT_DATATYPE_MVAR describes the FieldTrip MATLAB structure for multi-variate + autoregressive model data. + + The mvar datatype represents multivariate model estimates in the time- or + in the frequency-domain. This is usually obtained from FT_MVARANALYSIS, + optionally in combination with FT_FREQANALYSIS. + + The following is an example of sensor level MVAR model data in the time domain + + dimord: 'chan_chan_lag' defines how the numeric data should be interpreted + label: {3x1 cell} the channel labels + coeffs: [3x3x5 double] numeric data (MVAR model coefficients 3 channels x 3 channels x 5 time lags) + noisecov: [3x3 double] more numeric data (covariance matrix of the noise residuals 3 channels x 3 channels) + dof: 500 + fsampleorig: 200 + cfg: [1x1 struct] + + The following is an example of sensor-level MVAR model data in the frequency domain + + dimord: 'chan_chan_freq' defines how the numeric data should be interpreted + label: {3x1 cell} the channel labels + freq: [1x101 double] the frequencies, expressed in Hz + transfer: [3x3x101 double] + itransfer: [3x3x101 double] + noisecov: [3x3 double] + crsspctrm: [3x3x101 double] + dof: 500 + cfg: [1x1 struct] + + Required fields: + - label, dimord, freq + + Optional fields: + - too many to mention + + Deprecated fields: + - + + Obsoleted fields: + - + + Revision history: + + (2011/latest) The description of the sensors has changed, see FT_DATATYPE_SENS + for further information. + + (2008) The initial version was defined. + + See also FT_DATATYPE, FT_DATATYPE_COMP, FT_DATATYPE_DIP, FT_DATATYPE_FREQ, + FT_DATATYPE_MVAR, FT_DATATYPE_RAW, FT_DATATYPE_SOURCE, FT_DATATYPE_SPIKE, + FT_DATATYPE_TIMELOCK, FT_DATATYPE_VOLUME + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_datatype_mvar.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_mvar", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_datatype_parcellation.py b/fieldtrip/__utilities/ft_datatype_parcellation.py new file mode 100644 index 0000000..7fa5f0f --- /dev/null +++ b/fieldtrip/__utilities/ft_datatype_parcellation.py @@ -0,0 +1,93 @@ +from fieldtrip._runtime import Runtime + + +def ft_datatype_parcellation(*args, **kwargs): + """ + FT_DATATYPE_PARCELLATION describes the FieldTrip MATLAB structure for parcellated + cortex-based data and atlases. A parcellation can either be indexed or + probabilistic (see below). A common use of a parcellation is to look up the label + of a location with the peak activity, or to average MEG source reconstructed + activity over one parcel that is the region of interest, or over all parcels. + + A parcellation is a surface-based description with tissue types or classes for each + of the surface elements. Parcellations are often, but not always labeled. A + surface-based atlas is basically a very detailed parcellation with an anatomical + label for each vertex. + + An example of a surface-based Brodmann parcellation looks like this + + pos: [8192x3] positions of the vertices forming the cortical sheet + tri: [16382x3] triangles of the cortical sheet + coordsys: 'ctf' the (head) coordinate system in which the vertex positions are expressed + unit: 'mm' the units in which the coordinate system is expressed + brodmann: [8192x1 uint8] values from 1 to N, the value 0 means unknown + brodmannlabel: {Nx1 cell} + + An alternative representation of this parcellation is + + pos: [8192x3] positions of the vertices forming the cortical sheet + tri: [16382x3] triangles of the cortical sheet + coordsys: 'ctf' the (head) coordinate system in which the vertex positions are expressed + unit: 'mm' the units in which the coordinate system is expressed + Brodmann_Area_1: [8192x1 logical] binary map representing the voxels belonging to the specific area + Brodmann_Area_2: [8192x1 logical] binary map representing the voxels belonging to the specific area + Brodmann_Area_3: [8192x1 logical] binary map representing the voxels belonging to the specific area + ... + + The examples above demonstrate that a parcellation can be either indexed, consisting of + subsequent integer numbers (1, 2, ...) or probabilistic, consisting of real numbers + ranging from 0 to 1 that represent probabilities between 0% and 100%. An extreme case + is one where the probability is either 0 or 1, in which case the probability can be + represented as a binary or logical array. + + The only difference to the source data structure is that the parcellation structure + contains the additional fields xxx and xxxlabel. See FT_DATATYPE_SOURCE for further + details. + + Required fields: + - pos + + Optional fields: + - any field with dimensions that are consistent with pos + - unit, coordsys, fid, tri + + Deprecated fields: + - none + + Obsoleted fields: + - none + + Revision history: + (2012/latest) The initial version was defined in accordance with the representation of + a voxel-based segmentation. + + See also FT_DATATYPE, FT_DATATYPE_SOURCE, FT_DATATYPE_SEGMENTATION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_datatype_parcellation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_parcellation", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_datatype_raw.py b/fieldtrip/__utilities/ft_datatype_raw.py new file mode 100644 index 0000000..d7433e9 --- /dev/null +++ b/fieldtrip/__utilities/ft_datatype_raw.py @@ -0,0 +1,84 @@ +from fieldtrip._runtime import Runtime + + +def ft_datatype_raw(*args, **kwargs): + """ + FT_DATATYPE_RAW describes the FieldTrip MATLAB structure for raw data + + The raw datatype represents sensor-level time-domain data typically + obtained after calling FT_DEFINETRIAL and FT_PREPROCESSING. It contains + one or multiple segments of data, each represented as Nchan X Ntime + arrays. + + An example of a raw data structure with 151 MEG channels is + + label: {151x1 cell} the channel labels represented as a cell-array of strings + time: {1x266 cell} the time axis [1*Ntime double] per trial + trial: {1x266 cell} the numeric data as a cell array, with a matrix of [151*Ntime double] per trial + sampleinfo: [266x2 double] the begin and endsample of each trial relative to the recording on disk + trialinfo: [266x1 double] optional trigger or condition codes for each trial + hdr: [1x1 struct] the full header information of the original dataset on disk + grad: [1x1 struct] information about the sensor array (for EEG it is called elec) + cfg: [1x1 struct] the configuration used by the function that generated this data structure + + Required fields: + - time, trial, label + + Optional fields: + - sampleinfo, trialinfo, grad, elec, opto, hdr, cfg + + Deprecated fields: + - fsample + + Obsoleted fields: + - offset + + Revision history: + + (2011/latest) The description of the sensors has changed, see FT_DATATYPE_SENS + for further information. + + (2010v2) The trialdef field has been replaced by the sampleinfo and + trialinfo fields. The sampleinfo corresponds to trl(:,1:2), the trialinfo + to trl(4:end). + + (2010v1) In 2010/Q3 it shortly contained the trialdef field which was a copy + of the trial definition (trl) is generated by FT_DEFINETRIAL. + + (2007) It used to contain the offset field, which corresponds to trl(:,3). + Since the offset field is redundant with the time axis, the offset field is + from now on not present any more. It can be recreated if needed. + + (2003) The initial version was defined + + See also FT_DATATYPE, FT_DATATYPE_COMP, FT_DATATYPE_TIMELOCK, FT_DATATYPE_FREQ, + FT_DATATYPE_SPIKE, FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_datatype_raw.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_raw", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_datatype_segmentation.py b/fieldtrip/__utilities/ft_datatype_segmentation.py new file mode 100644 index 0000000..940b9cd --- /dev/null +++ b/fieldtrip/__utilities/ft_datatype_segmentation.py @@ -0,0 +1,110 @@ +from fieldtrip._runtime import Runtime + + +def ft_datatype_segmentation(*args, **kwargs): + """ + FT_DATATYPE_SEGMENTATION describes the FieldTrip MATLAB structure for segmented + voxel-based data and atlasses. A segmentation can either be indexed or + probabilistic (see below). + + A segmentation is a volumetric description which is usually derived from an + anatomical MRI, which describes for each voxel the tissue type. It for example + distinguishes between white matter, grey matter, csf, skull and skin. It is mainly + used for masking in visualization, construction of volume conduction models and for + construction of cortical sheets. An volume-based atlas is basically a very detailed + segmentation with an anatomical label for each voxel. + + For example, the AFNI TTatlas+tlrc segmented brain atlas (which can be created + with FT_READ_ATLAS) looks like this + + dim: [161 191 141] the size of the 3D volume in voxels + transform: [4x4 double] affine transformation matrix for mapping the voxel coordinates to head coordinate system + coordsys: 'tal' the transformation matrix maps the voxels into this (head) coordinate system + unit: 'mm' the units in which the coordinate system is expressed + brick0: [161x191x141 uint8] integer values from 1 to N, the value 0 means unknown + brick1: [161x191x141 uint8] integer values from 1 to M, the value 0 means unknown + brick0label: {Nx1 cell} + brick1label: {Mx1 cell} + + An example segmentation with binary values that can be used for construction of a + BEM volume conduction model of the head looks like this + + dim: [256 256 256] the dimensionality of the 3D volume + transform: [4x4 double] affine transformation matrix for mapping the voxel coordinates to head coordinate system + coordsys: 'ctf' the transformation matrix maps the voxels into this (head) coordinate system + unit: 'mm' the units in which the coordinate system is expressed + brain: [256x256x256 logical] binary map representing the voxels which belong to the brain + skull: [256x256x256 logical] binary map representing the voxels which belong to the skull + scalp: [256x256x256 logical] binary map representing the voxels which belong to the scalp + + An example of a whole-brain anatomical MRI that was segmented using FT_VOLUMESEGMENT + looks like this + + dim: [256 256 256] the size of the 3D volume in voxels + transform: [4x4 double] affine transformation matrix for mapping the voxel coordinates to head coordinate system + coordsys: 'ctf' the transformation matrix maps the voxels into this (head) coordinate system + unit: 'mm' the units in which the coordinate system is expressed + gray: [256x256x256 double] probabilistic map of the gray matter + white: [256x256x256 double] probabilistic map of the white matter + csf: [256x256x256 double] probabilistic map of the cerebrospinal fluid + + The examples above demonstrate that a segmentation can be indexed, i.e. consisting + of subsequent integer numbers (1, 2, ...) or probabilistic, consisting of real + numbers ranging from 0 to 1 that represent probabilities between 0% and 100%. An + extreme case is one where the probability is either 0 or 1, in which case the + probability can be represented as a binary or logical array. + + The only difference to the volume data representation is that the segmentation + structure contains the additional fields xxx and xxxlabel. See FT_DATATYPE_VOLUME + for further details. + + Required fields: + - dim, transform + + Optional fields: + - brain, skull, scalp, gray, white, csf, or any other field with dimensions that are consistent with dim + - unit, coordsys, fid + + Deprecated fields: + - none + + Obsoleted fields: + - none + + Revision history: + (2012/latest) The explicit distunction between the indexed and probabilistic + representation was made. For the indexed representation the additional + xxxlabel cell-array was introduced. + + (2005) The initial version was defined. + + See also FT_DATATYPE, FT_DATATYPE_VOLUME, FT_DATATYPE_PARCELLATION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_datatype_segmentation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_segmentation", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_datatype_sens.py b/fieldtrip/__utilities/ft_datatype_sens.py new file mode 100644 index 0000000..d19c955 --- /dev/null +++ b/fieldtrip/__utilities/ft_datatype_sens.py @@ -0,0 +1,127 @@ +from fieldtrip._runtime import Runtime + + +def ft_datatype_sens(*args, **kwargs): + """ + FT_DATATYPE_SENS describes the FieldTrip structure that represents an MEG, EEG, + sEEG, ECoG, or NIRS sensor array. This structure is commonly called "grad" for MEG, + "elec" for EEG and intranial EEG, "opto" for NIRS, or in general "sens" if it could + be any one. + + For all sensor types a distinction should be made between the channel (i.e. the + output of the transducer that is A/D converted) and the sensor, which may have some + spatial extent. For example in MEG gradiometers are comprised of multiple coils and + with EEG you can have a bipolar channel, where the position of the channel can be + represented as in between the position of the two electrodes. + + The structure for MEG gradiometers and/or magnetometers contains + sens.label = Mx1 cell-array with channel labels + sens.chanpos = Mx3 matrix with channel positions + sens.chanori = Mx3 matrix with channel orientations, used for synthetic planar gradient computation + sens.coilpos = Nx3 matrix with coil positions + sens.coilori = Nx3 matrix with coil orientations + sens.tra = MxN matrix to combine coils into channels + sens.balance = structure containing info about the balancing, See FT_APPLY_MONTAGE + and optionally + sens.chanposold = Mx3 matrix with original channel positions (in case sens.chanpos has been updated to contain NaNs, e.g. after FT_COMPONENTANALYSIS) + sens.chanoriold = Mx3 matrix with original channel orientations + sens.labelold = Mx1 cell-array with original channel labels + + The structure for EEG, sEEG or ECoG channels contains + sens.label = Mx1 cell-array with channel labels + sens.chanpos = Mx3 matrix with channel positions (often the same as electrode positions) + sens.elecpos = Nx3 matrix with electrode positions + sens.tra = MxN matrix to combine electrodes into channels + In case sens.tra is not present in the EEG sensor array, the channels + are assumed to be average referenced. + + The structure for NIRS channels contains + sens.label = Mx1 cell-array with channel labels + sens.chanpos = Mx3 matrix with position of the channels (usually halfway the transmitter and receiver) + sens.optopos = Nx3 matrix with the position of individual optodes + sens.optotype = Nx1 cell-array with information about the type of optode (receiver or transmitter) + sens.optolabel = Nx1 cell-array with optode labels + sens.wavelength = 1xK vector of all wavelengths that were used + sens.tra = MxN matrix that specifies for each of the M channels which of the N optodes transmits at which wavelength (positive integer from 1 to K), or receives (negative ingeger from 1 to K) + + The following fields apply to MEG, EEG, sEEG and ECoG + sens.chantype = Mx1 cell-array with the type of the channel, see FT_CHANTYPE + sens.chanunit = Mx1 cell-array with the units of the channel signal, e.g. 'V', 'fT' or 'T/cm', see FT_CHANUNIT + + Optional fields: + type, unit, fid, chantype, chanunit, coordsys, balance + + Historical fields: + pnt, pos, ori, pnt1, pnt2, fiberpos, fibertype, fiberlabel, transceiver, transmits, laserstrength + + Revision history: + (2025/latest) Explicitly deal with the balance field and sequence of montages. + + (2020/latest) Updated the specification of the NIRS sensor definition. + Dropped the laserstrength and renamed transmits into tra for consistency. + + (2019/latest) Updated the specification of the NIRS sensor definition. + Use "opto" instead of "fibers", see http://bit.ly/33WaqWU for details. + + (2016) The chantype and chanunit have become required fields. + Original channel details are specified with the suffix "old" rather than "org". + All numeric values are represented in double precision. + It is possible to convert the amplitude and distance units (e.g. from T to fT and + from m to mm) and it is possible to express planar and axial gradiometer channels + either in units of amplitude or in units of amplitude/distance (i.e. proper + gradient). + + (2011v2) The chantype and chanunit have been added for MEG. + + (2011v1) To facilitate determining the position of channels (e.g. for plotting) + in case of balanced MEG or bipolar EEG, an explicit distinction has been made + between chanpos+chanori and coilpos+coilori (for MEG) and chanpos and elecpos + (for EEG). The pnt and ori fields are removed. + + (2010) Added support for bipolar or otherwise more complex linear combinations + of EEG electrodes using sens.tra, similar to MEG. + + (2009) Noise reduction has been added for MEG systems in the balance field. + + (2006) The optional fields sens.type and sens.unit were added. + + (2003) The initial version was defined, which looked like this for EEG + sens.pnt = Mx3 matrix with electrode positions + sens.label = Mx1 cell-array with channel labels + and like this for MEG + sens.pnt = Nx3 matrix with coil positions + sens.ori = Nx3 matrix with coil orientations + sens.tra = MxN matrix to combine coils into channels + sens.label = Mx1 cell-array with channel labels + + See also FT_READ_SENS, FT_SENSTYPE, FT_CHANTYPE, FT_APPLY_MONTAGE, CTF2GRAD, FIF2GRAD, + BTI2GRAD, YOKOGAWA2GRAD, ITAB2GRAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_datatype_sens.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_sens", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_datatype_source.py b/fieldtrip/__utilities/ft_datatype_source.py new file mode 100644 index 0000000..aa352fc --- /dev/null +++ b/fieldtrip/__utilities/ft_datatype_source.py @@ -0,0 +1,87 @@ +from fieldtrip._runtime import Runtime + + +def ft_datatype_source(*args, **kwargs): + """ + FT_DATATYPE_SOURCE describes the FieldTrip MATLAB structure for data that is + represented at the source level. This is typically obtained with a beamformer of + minimum-norm source reconstruction using FT_SOURCEANALYSIS. + + An example of a source structure obtained after performing DICS (a frequency domain + beamformer scan) is shown here + + pos: [6732x3 double] positions at which the source activity could have been estimated + inside: [6732x1 logical] boolean vector that indicates at which positions the source activity was estimated + dim: [xdim ydim zdim] if the positions can be described as a 3D regular grid, this contains the + dimensionality of the 3D volume + cumtapcnt: [120x1 double] information about the number of tapers per original trial + time: 0.100 the latency at which the activity is estimated (in seconds) + freq: 30 the frequency at which the activity is estimated (in Hz) + pow: [6732x120 double] the estimated power at each source position + powdimord: 'pos_rpt' defines how the numeric data has to be interpreted, + in this case 6732 dipole positions x 120 repetitions (i.e. trials) + cfg: [1x1 struct] the configuration used by the function that generated this data structure + + Required fields: + - pos + + Optional fields: + - inside, pow, coh, eta, mom, ori, leadfield, filter, or any other field with dimensions that are consistent with pos or dim + - dim, transform, unit, coordsys, time, freq, cumtapcnt, dimord + + Deprecated fields: + - method, outside + + Obsoleted fields: + - xgrid, ygrid, zgrid, transform, latency, frequency + + Revision history: + + (2014) The subfields in the avg and trial fields are now present in the + main structure, e.g. source.avg.pow is now source.pow. Furthermore, the + inside is always represented as logical vector. + + (2011) The source representation should always be irregular, i.e. not + a 3-D volume, contain a "pos" field and not contain a "transform". + + (2010) The source structure should contain a general "dimord" or specific + dimords for each of the fields. The source reconstruction in the avg and + trial substructures has been moved to the toplevel. + + (2007) The xgrid/ygrid/zgrid fields have been removed, because they are + redundant. + + (2003) The initial version was defined + + See also FT_DATATYPE, FT_DATATYPE_COMP, FT_DATATYPE_DIP, FT_DATATYPE_FREQ, + FT_DATATYPE_MVAR, FT_DATATYPE_RAW, FT_DATATYPE_SOURCE, FT_DATATYPE_SPIKE, + FT_DATATYPE_TIMELOCK, FT_DATATYPE_VOLUME + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_datatype_source.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_source", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_datatype_spike.py b/fieldtrip/__utilities/ft_datatype_spike.py new file mode 100644 index 0000000..c5fcaf0 --- /dev/null +++ b/fieldtrip/__utilities/ft_datatype_spike.py @@ -0,0 +1,157 @@ +from fieldtrip._runtime import Runtime + + +def ft_datatype_spike(*args, **kwargs): + """ + FT_DATATYPE_SPIKE describes the FieldTrip MATLAB structure for spike data + + Spike data is obtained using FT_READ_SPIKE to read files from a Plexon, + Neuralynx or other animal electrophysiology data acquisition system. It + is characterised as a sparse point-process, i.e. each neuronal firing is + only represented as the time at which the firing happened. Optionally, + the spike waveform can also be represented. Using this waveform, the + neuronal firing events can be sorted into their single units. + + A required characteristic of the SPIKE structure is a cell-array with the + label of the (single or multi) units. + + label: {'unit1' 'unit2' 'unit3'} + + The fields of the SPIKE structure that contain the specific information + per spike depends on the available information. A relevant distinction + can be made between the representation of raw spikes that are not related + to the temporal structure of the experimental design (i.e trials), and + the data representation in which the spikes are related to the trial. + + For a continuous recording the SPIKE structure must contain a cell-array + with the raw timestamps as recorded by the hardware system. As example, + the original content of the .timestamp field can be + + timestamp: {[1x504 uint64] [1x50 uint64] [1x101 uint64]} + + An optional field that is typically obtained from the raw recording + contains the waveforms for every unit and label as a cell-array. For + example, the content of this field may be + + waveform: {[1x32x504 double] [1x32x50 double] [1x32x101 double]} + + If the data has been organised to reflect the temporal structure of the + experiment (i.e. the trials), the SPIKE structure should contain a + cell-array with the spike times relative to an experimental trigger. The + FT_SPIKE_MAKETRIALS function can be used to reorganise the SPIKE + structure such that the spike times are expressed relative to a trigger + instead of relative to the acquisition devices internal timestamp clock. + The time field then contains only those spikes that occurred within one of + the trials . The spike times are now expressed on seconds relative to the + trigger. + + time: {[1x504 double] [1x50 double] [1x101 double]} + + In addition, for every spike we register in which trial the spike was + recorded: + + trial: {[1x504 double] [1x50 double] [1x101 double]} + + To fully reconstruct the structure of the spike-train, it is required + that the exact start- and end-point of the trial (in seconds) is + represented. This is specified in a nTrials x 2 matrix. + + trialtime: [100x2 double] + + As an example, FT_SPIKE_MAKETRIALS could result in the following + SPIKE structure that represents the spikes of three units that were + observed in 100 trials: + + label: {'unit1' 'unit2' 'unit3'} + timestamp: {[1x504 double] [1x50 double] [1x101 double]} + timestampdimord: '{chan}_spike' + time: {[1x504 double] [1x50 double] [1x101 double]} + trial: {[1x504 double] [1x50 double] [1x101 double]} + trialtime: [100x2 double] + sampleinfo: [100x2 double] + waveform: {[1x32x504 double] [1x32x50 double] [1x32x101 double]} + waveformdimord: '{chan}_lead_time_spike' + + For analysing the relation between the spikes and the local field + potential (e.g. phase-locking), the SPIKE structure can have additional + fields such as fourierspctrm, lfplabel, freq and fourierspctrmdimord. + + For example, from the structure above we may obtain + + label: {'unit1' 'unit2' 'unit3'} + time: {[1x504 double] [1x50 double] [1x101 double]} + trial: {[1x504 double] [1x50 double] [1x101 double]} + trialtime: [100x2 double] + timestamp: {[1x504 double] [1x50 double] [1x101 double]} + timestampdimord: '{chan}_spike' + waveform: {[1x32x504 double] [1x32x50 double] [1x32x101 double]} + waveformdimord: '{chan}_lead_time_spike' + fourierspctrm: {504x2x20, 50x2x20, 101x2x20} + fourierspctrmdimord: '{chan}_spike_lfplabel_freq' + lfplabel: {'lfpchan1', 'lfpchan2'} + freq: [1x20 double] + + Required fields: + - label + - timestamp + + Optional fields: + - time, trial, trialtime + - timestampdimord + - unit, unitdimord + - waveform, waveformdimord + - fourierspctrm, fourierspctrmdimord, freq, lfplabel (these are extra outputs from FT_SPIKETRIGGEREDSPECTRUM and FT_SPIKE_TRIGGEREDSPECTRUM) + - hdr + - cfg + + Deprecated fields: + - origtime, origtrial + + Obsoleted fields: + - + + Revision history: + + (2020/latest) Add an explicit xxxdimord for each of the known fields. + + (2012) Changed the dimensionality of the waveform to allow both + stereotrode and tetrode data to be represented. + + (2011) Defined a consistent spike data representation that can + also contain the Fourier spectrum and other fields. Use the xxxdimord + to indicate the dimensions of the field. + + (2010) Introduced the time and the trialtime fields. + + (2007) Introduced the spike data representation. + + See also FT_DATATYPE, FT_DATATYPE_RAW, FT_DATATYPE_FREQ, FT_DATATYPE_TIMELOCK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_datatype_spike.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_spike", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_datatype_timelock.py b/fieldtrip/__utilities/ft_datatype_timelock.py new file mode 100644 index 0000000..9cc3f91 --- /dev/null +++ b/fieldtrip/__utilities/ft_datatype_timelock.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def ft_datatype_timelock(*args, **kwargs): + """ + FT_DATATYPE_TIMELOCK describes the FieldTrip MATLAB structure for timelock data + + The timelock data structure represents averaged or non-averaged event-releted + potentials (ERPs, in case of EEG) or ERFs (in case of MEG). This data structure is + usually generated with the FT_TIMELOCKANALYSIS or FT_TIMELOCKGRANDAVERAGE function. + + An example of a timelock structure containing the ERF for 151 channels MEG data is + + dimord: 'chan_time' defines how the numeric data should be interpreted + avg: [151x600 double] the average values of the activity for 151 channels x 600 timepoints + var: [151x600 double] the variance of the activity for 151 channels x 600 timepoints + label: {151x1 cell} the channel labels (e.g. 'MRC13') + time: [1x600 double] the timepoints in seconds + grad: [1x1 struct] information about the sensor array (for EEG data it is called elec) + cfg: [1x1 struct] the configuration used by the function that generated this data structure + + Required fields: + - label, dimord, time + + Optional fields: + - avg, var, dof, cov, trial, trialinfo, sampleinfo, grad, elec, opto, cfg + + Deprecated fields: + - + + Obsoleted fields: + - fsample + + Revision history: + + (2017/latest) The data structure cannot contain an average and simultaneously single + trial information any more, i.e. avg/var/dof and trial/individual are mutually exclusive. + + (2011v2) The description of the sensors has changed, see FT_DATATYPE_SENS + for further information. + + (2011) The field 'fsample' was removed, as it was redundant. + + (2003) The initial version was defined. + + See also FT_DATATYPE, FT_DATATYPE_COMP, FT_DATATYPE_FREQ, FT_DATATYPE_RAW + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_datatype_timelock.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_timelock", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_datatype_volume.py b/fieldtrip/__utilities/ft_datatype_volume.py new file mode 100644 index 0000000..74589d5 --- /dev/null +++ b/fieldtrip/__utilities/ft_datatype_volume.py @@ -0,0 +1,88 @@ +from fieldtrip._runtime import Runtime + + +def ft_datatype_volume(*args, **kwargs): + """ + FT_DATATYPE_VOLUME describes the FieldTrip MATLAB structure for volumetric data + such as an anatomical MRI. + + The volume data structure represents data on a regular volumetric 3-D grid, like an + anatomical MRI, a functional MRI, etc. It can also represent a source reconstructed + estimate of the activity measured with MEG. In this case the source reconstruction + is estimated or interpolated on the regular 3-D dipole grid (like a box). + + An example volume structure is + anatomy: [181x217x181 double] the numeric data, in this case anatomical information + dim: [181 217 181] the dimensionality of the 3D volume + transform: [4x4 double] 4x4 homogenous transformation matrix, specifying the transformation from voxel coordinates to head or world coordinates + unit: 'mm' geometrical units of the coordinate system + coordsys: 'ctf' description of the coordinate system + + Required fields: + - transform, dim + + Optional fields: + - anatomy, prob, stat, grey, white, csf, or any other field with dimensions that are consistent with dim + - unit, coordsys, fid + + Deprecated fields: + - dimord + + Obsoleted fields: + - none + + Revision history: + + (2014) The subfields in the avg and trial fields are now present in the + main structure, e.g. source.avg.pow is now source.pow. Furthermore, the + inside is always represented as logical array. + + (2012b) Ensure that the anatomy-field (if present) does not contain + infinite values. + + (2012) A placeholder 2012 version was created that ensured the axes + of the coordinate system to be right-handed. This actually never + has made it to the default version. An executive decision regarding + this has not been made as far as I (JM) am aware, and probably it's + a more principled approach to keep the handedness free, so don't mess + with it here. However, keep this snippet of code for reference. + + (2011) The dimord field was deprecated and we agreed that volume + data should be 3-dimensional and not N-dimensional with arbitrary + dimensions. In case time-frequency recolved data has to be represented + on a 3-d grid, the source representation should be used. + + (2010) The dimord field was added by some functions, but not by all + + (2003) The initial version was defined + + See also FT_DATATYPE, FT_DATATYPE_DIP, FT_DATATYPE_SOURCE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_datatype_volume.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_datatype_volume", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_debug.py b/fieldtrip/__utilities/ft_debug.py new file mode 100644 index 0000000..8e2cdd3 --- /dev/null +++ b/fieldtrip/__utilities/ft_debug.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def ft_debug(*args, **kwargs): + """ + FT_DEBUG prints a debug message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_debug(...) + with arguments similar to fprintf, or + ft_debug(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_debug off + or for specific ones using + ft_debug off msgId + + To switch them back on, you would use + ft_debug on + or for specific ones using + ft_debug on msgId + + Messages are only printed once per timeout period using + ft_debug timeout 60 + ft_debug once + or for specific ones using + ft_debug once msgId + + You can see the most recent messages and identifier using + ft_debug last + + You can query the current on/off/once state for all messages using + ft_debug query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_debug.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_debug", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_determine_coordsys.py b/fieldtrip/__utilities/ft_determine_coordsys.py new file mode 100644 index 0000000..3582999 --- /dev/null +++ b/fieldtrip/__utilities/ft_determine_coordsys.py @@ -0,0 +1,69 @@ +from fieldtrip._runtime import Runtime + + +def ft_determine_coordsys(*args, **kwargs): + """ + FT_DETERMINE_COORDSYS plots a geometrical object, allowing you to perform + a visual check on the coordinatesystem, the units and on the anatomical + labels for the coordinate system axes. + + Use as + [dataout] = ft_determine_coordsys(datain, ...) + where the input data structure can be either + - an anatomical MRI + - an electrode, gradiometer or optode definition + - a cortical or head surface mesh + - a volume conduction model of the head + or most other FieldTrip structures that represent geometrical information. + + Additional optional input arguments should be specified as key-value pairs + and can include + interactive = string, 'yes' or 'no' (default = 'yes') + axisscale = scaling factor for the reference axes and sphere (default = 1) + clim = lower and upper anatomical MRI limits (default = [0 1]) + + This function will pop up a figure that allows you to check whether the + alignment of the object relative to the coordinate system axes is correct + and what the anatomical labels of the coordinate system axes are. You + should switch on the 3D rotation option in the figure panel to rotate and + see the figure from all angles. To change the anatomical labels of the + coordinate system, you should press the corresponding keyboard button. + + Recognized and supported coordinate systems are 'ctf', 'bti', '4d', 'yokogawa', + 'eeglab', 'neuromag', 'itab', 'acpc', 'spm', 'mni', 'fsaverage', 'tal', 'scanras', + 'scanlps', 'dicom'. + + Furthermore, supported coordinate systems that do not specify the origin are 'ras', + 'als', 'lps', etc. See https://www.fieldtriptoolbox.org/faq/coordsys for more + details. + + See also FT_CONVERT_COORDSYS, FT_DETERMINE_UNITS, FT_CONVERT_UNITS, FT_PLOT_AXES, FT_PLOT_XXX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_determine_coordsys.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_determine_coordsys", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_documentationconfiguration.py b/fieldtrip/__utilities/ft_documentationconfiguration.py new file mode 100644 index 0000000..9cc99b8 --- /dev/null +++ b/fieldtrip/__utilities/ft_documentationconfiguration.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def ft_documentationconfiguration(*args, **kwargs): + """ + FT_DOCUMENTATIONCONFIGURATION is a helper function to maintain the online + documentation of all configuration options. + + Normal users will not be calling this function, but will rather look at + http://www.fieldtriptoolbox.org/configuration where the output of this + function can be found. + + See also FT_DOCUMENTATIONREFERENCE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_documentationconfiguration.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_documentationconfiguration", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_documentationreference.py b/fieldtrip/__utilities/ft_documentationreference.py new file mode 100644 index 0000000..9a1dd5f --- /dev/null +++ b/fieldtrip/__utilities/ft_documentationreference.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def ft_documentationreference(*args, **kwargs): + """ + FT_DOCUMENTATIONREFERENCE is a helper function to maintain the + online reference documentation. + + Normal users will not be calling this function, but will rather look at + http://www.fieldtriptoolbox.org/reference where the output of this function can + be found. + + See also FT_DOCUMENTATIONCONFIGURATION, MATLAB2MARKDOWN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_documentationreference.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_documentationreference", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/ft_error.py b/fieldtrip/__utilities/ft_error.py new file mode 100644 index 0000000..2a556e5 --- /dev/null +++ b/fieldtrip/__utilities/ft_error.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def ft_error(*args, **kwargs): + """ + FT_ERROR prints an error message on screen, just like the standard ERROR function. + + Use as + ft_error(...) + with arguments similar to fprintf, or + ft_error(msgId, ...) + with arguments similar to error. + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_error.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_error", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_fetch_data.py b/fieldtrip/__utilities/ft_fetch_data.py new file mode 100644 index 0000000..472bae7 --- /dev/null +++ b/fieldtrip/__utilities/ft_fetch_data.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def ft_fetch_data(*args, **kwargs): + """ + FT_FETCH_DATA mimics the behavior of FT_READ_DATA, but for a FieldTrip + raw data structure instead of a file on disk. + + Use as + [dat] = ft_fetch_data(data, ...) + + See also FT_READ_DATA, FT_FETCH_HEADER, FT_FETCH_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_fetch_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_fetch_data", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_fetch_event.py b/fieldtrip/__utilities/ft_fetch_event.py new file mode 100644 index 0000000..23da350 --- /dev/null +++ b/fieldtrip/__utilities/ft_fetch_event.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def ft_fetch_event(*args, **kwargs): + """ + FT_FETCH_EVENT mimics the behavior of FT_READ_EVENT, but for a FieldTrip + raw data structure instead of a file on disk. + + Use as + event = ft_fetch_event(data) + + See also FT_READ_EVENT, FT_FETCH_HEADER, FT_FETCH_DATA + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_fetch_event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_fetch_event", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_fetch_header.py b/fieldtrip/__utilities/ft_fetch_header.py new file mode 100644 index 0000000..e990464 --- /dev/null +++ b/fieldtrip/__utilities/ft_fetch_header.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def ft_fetch_header(*args, **kwargs): + """ + FT_FETCH_HEADER mimics the behavior of FT_READ_HEADER, but for a FieldTrip + raw data structure instead of a file on disk. + + Use as + hdr = ft_fetch_header(data) + + See also FT_READ_HEADER, FT_FETCH_DATA, FT_FETCH_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_fetch_header.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_fetch_header", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_findcfg.py b/fieldtrip/__utilities/ft_findcfg.py new file mode 100644 index 0000000..115024e --- /dev/null +++ b/fieldtrip/__utilities/ft_findcfg.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def ft_findcfg(*args, **kwargs): + """ + FT_FINDCFG searches for an element in the cfg structure + or in the nested previous cfgs + + Use as + val = ft_findcfg(cfg, var) + where the name of the variable should be specified as string. + + e.g. + trl = ft_findcfg(cfg, 'trl') + event = ft_findcfg(cfg, 'event') + + See also FT_GETOPT, FT_CFG2KEYVAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_findcfg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_findcfg", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_getopt.py b/fieldtrip/__utilities/ft_getopt.py new file mode 100644 index 0000000..46f910a --- /dev/null +++ b/fieldtrip/__utilities/ft_getopt.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def ft_getopt(*args, **kwargs): + """ + FT_GETOPT gets the value of a specified option from a configuration structure + or from a cell-array with key-value pairs. + + Use as + val = ft_getopt(s, key, default, emptymeaningful) + where the input values are + s = structure or cell-array + key = string + default = any valid MATLAB data type (optional, default = []) + emptymeaningful = boolean value (optional, default = false) + + If the key is present as field in the structure, or as key-value pair in the + cell-array, the corresponding value will be returned. + + If the key is not present, ft_getopt will return the default, or an empty array + when no default was specified. + + If the key is present but has an empty value, then the emptymeaningful flag + specifies whether the empty value or the default value should be returned. + If emptymeaningful==true, then the empty array will be returned. + If emptymeaningful==false, then the specified default will be returned. + + See also FT_SETOPT, FT_CHECKOPT, INPUTPARSER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_getopt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_getopt", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_hash.py b/fieldtrip/__utilities/ft_hash.py new file mode 100644 index 0000000..bd4e797 --- /dev/null +++ b/fieldtrip/__utilities/ft_hash.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def ft_hash(*args, **kwargs): + """ + FT_HASH computes a MD5 hash from a MATLAB variable or structure + + It will first try a hashing algorithm implemented as a mex file. + If that fails, it falls back to a slower one that is based on Java. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_hash.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_hash", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_hastoolbox.py b/fieldtrip/__utilities/ft_hastoolbox.py new file mode 100644 index 0000000..a355daf --- /dev/null +++ b/fieldtrip/__utilities/ft_hastoolbox.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def ft_hastoolbox(*args, **kwargs): + """ + FT_HASTOOLBOX tests whether an external toolbox is installed. Optionally it will + try to determine the path to the toolbox and install it automatically. + + Use as + [status] = ft_hastoolbox(toolbox, autoadd, silent) + + autoadd = -1 means that it will check and give an error when not yet installed + autoadd = 0 means that it will check and give a warning when not yet installed + autoadd = 1 means that it will check and give an error if it cannot be added + autoadd = 2 means that it will check and give a warning if it cannot be added + autoadd = 3 means that it will check but remain silent if it cannot be added + + silent = 0 means that it will give some feedback about adding the toolbox + silent = 1 means that it will not give feedback + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_hastoolbox.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_hastoolbox", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_headcoordinates.py b/fieldtrip/__utilities/ft_headcoordinates.py new file mode 100644 index 0000000..5008c86 --- /dev/null +++ b/fieldtrip/__utilities/ft_headcoordinates.py @@ -0,0 +1,126 @@ +from fieldtrip._runtime import Runtime + + +def ft_headcoordinates(*args, **kwargs): + """ + FT_HEADCOORDINATES returns the homogeneous coordinate transformation matrix + that converts the specified fiducials in any coordinate system (e.g. MRI) + into the rotated and translated headcoordinate system. + + Use as + [transform, coordsys] = ft_headcoordinates(fid1, fid2, fid3, coordsys) + or + [transform, coordsys] = ft_headcoordinates(fid1, fid2, fid3, fid4, coordsys) + + Depending on the desired coordinate system, the order of the fiducials is + interpreted as follows + + fid1 = nas + fid2 = lpa + fid3 = rpa + fid4 = extra point (optional) + + fid1 = ac + fid2 = pc + fid3 = midsagittal + fid4 = extra point (optional) + + fid1 = pt1 + fid2 = pt2 + fid3 = pt3 + fid4 = extra point (optional) + + fid1 = bregma + fid2 = lambda + fid3 = midsagittal + fid4 = extra point (optional) + + The fourth argument fid4 is optional and can be specified as an an extra point + which is assumed to have a positive Z-coordinate. It will be used to ensure correct + orientation of the Z-axis (ctf, 4d, bti, eeglab, yokogawa, neuromag, itab) or + X-axis (acpc, spm, mni, tal). The specification of this extra point may result in + the handedness of the transformation to be changed, but ensures consistency with + the handedness of the input coordinate system. + + The coordsys input argument is a string that determines how the location of the + origin and the direction of the axis is to be defined relative to the fiducials: + according to CTF conventions: coordsys = 'ctf' + according to 4D conventions: coordsys = '4d' or 'bti' + according to EEGLAB conventions: coordsys = 'eeglab' + according to NEUROMAG conventions: coordsys = 'itab' + according to ITAB conventions: coordsys = 'neuromag' + according to YOKOGAWA conventions: coordsys = 'yokogawa' + according to ASA conventions: coordsys = 'asa' + according to FTG conventions: coordsys = 'ftg' + according to ACPC conventions: coordsys = 'acpc' + according to SPM conventions: coordsys = 'spm' + according to MNI conventions: coordsys = 'mni' + according to Talairach conventions: coordsys = 'tal' + according to PAXINOS conventions: coordsys = 'paxinos' + If the coordsys input argument is not specified, it will default to 'ctf'. + + The CTF, 4D, YOKOGAWA and EEGLAB coordinate systems are defined as follows: + the origin is exactly between lpa and rpa + the X-axis goes towards nas + the Y-axis goes approximately towards lpa, orthogonal to X and in the plane spanned by the fiducials + the Z-axis goes approximately towards the vertex, orthogonal to X and Y + + The TALAIRACH, SPM and ACPC coordinate systems are defined as: + the origin corresponds with the anterior commissure + the Y-axis is along the line from the posterior commissure to the anterior commissure + the Z-axis is towards the vertex, in between the hemispheres + the X-axis is orthogonal to the midsagittal-plane, positive to the right + + The NEUROMAG and ITAB coordinate systems are defined as follows: + the X-axis is from the origin towards the RPA point (exactly through) + the Y-axis is from the origin towards the nasion (exactly through) + the Z-axis is from the origin upwards orthogonal to the XY-plane + the origin is the intersection of the line through LPA and RPA and a line orthogonal to L passing through the nasion + + The ASA coordinate system is defined as follows: + the origin is at the orthogonal intersection of the line from rpa-lpa and the line through nas + the X-axis goes towards nas + the Y-axis goes through rpa and lpa + the Z-axis goes approximately towards the vertex, orthogonal to X and Y + + The FTG coordinate system is defined as: + the origin corresponds with pt1 + the x-axis is along the line from pt1 to pt2 + the z-axis is orthogonal to the plane spanned by pt1, pt2 and pt3 + + The PAXINOS coordinate system is defined as: + the origin is at bregma + the x-axis extends along the Medial-Lateral direction, with positive towards the right + the y-axis points from dorsal to ventral, i.e. from inferior to superior + the z-axis passes through bregma and lambda and points from cranial to caudal, i.e. from anterior to posterior + + See also FT_ELECTRODEREALIGN, FT_VOLUMEREALIGN, FT_INTERACTIVEREALIGN, FT_AFFINECOORDINATES, COORDSYS2LABEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_headcoordinates.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headcoordinates", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_info.py b/fieldtrip/__utilities/ft_info.py new file mode 100644 index 0000000..3ecb8fe --- /dev/null +++ b/fieldtrip/__utilities/ft_info.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def ft_info(*args, **kwargs): + """ + FT_INFO prints an info message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_info(...) + with arguments similar to fprintf, or + ft_info(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_info off + or for specific ones using + ft_info off msgId + + To switch them back on, you would use + ft_info on + or for specific ones using + ft_info on msgId + + Messages are only printed once per timeout period using + ft_info timeout 60 + ft_info once + or for specific ones using + ft_info once msgId + + You can see the most recent messages and identifier using + ft_info last + + You can query the current on/off/once state for all messages using + ft_info query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_info.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_info", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_inverse_montage.py b/fieldtrip/__utilities/ft_inverse_montage.py new file mode 100644 index 0000000..318a58a --- /dev/null +++ b/fieldtrip/__utilities/ft_inverse_montage.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def ft_inverse_montage(*args, **kwargs): + """ + FT_INVERSE_MONTAGE constructs an inverse of the input montage matrix, + allowing a linear projection of the channel timeseries to be undone. + + Use as + montage = ft_inverse_montage(montage) + + See also FT_APPLY_MONTAGE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_inverse_montage.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_inverse_montage", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_keyval2cfg.py b/fieldtrip/__utilities/ft_keyval2cfg.py new file mode 100644 index 0000000..2a87b89 --- /dev/null +++ b/fieldtrip/__utilities/ft_keyval2cfg.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def ft_keyval2cfg(*args, **kwargs): + """ + FT_KEYVAL2CFG converts between a structure and a cell-array with key-value + pairs which can be used for optional input arguments. + + Use as + [cfg] = ft_keyval2cfg(varargin) + + See also FT_CFG2KEYVAL, FT_GETOPT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_keyval2cfg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_keyval2cfg", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_notice.py b/fieldtrip/__utilities/ft_notice.py new file mode 100644 index 0000000..87e6d57 --- /dev/null +++ b/fieldtrip/__utilities/ft_notice.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def ft_notice(*args, **kwargs): + """ + FT_NOTICE prints a notice message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. + + Use as + ft_notice(...) + with arguments similar to fprintf, or + ft_notice(msgId, ...) + with arguments similar to warning. + + You can switch of all messages using + ft_notice off + or for specific ones using + ft_notice off msgId + + To switch them back on, you would use + ft_notice on + or for specific ones using + ft_notice on msgId + + Messages are only printed once per timeout period using + ft_notice timeout 60 + ft_notice once + or for specific ones using + ft_notice once msgId + + You can see the most recent messages and identifier using + ft_notice last + + You can query the current on/off/once state for all messages using + ft_notice query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_notice.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_notice", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_platform_supports.py b/fieldtrip/__utilities/ft_platform_supports.py new file mode 100644 index 0000000..1b6827b --- /dev/null +++ b/fieldtrip/__utilities/ft_platform_supports.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def ft_platform_supports(*args, **kwargs): + """ + FT_PLATFORM_SUPPORTS returns a boolean indicating whether the current platform + supports a specific capability + + Use as + status = ft_platform_supports(what) + or + status = ft_platform_supports('matlabversion', min_version, max_version) + + The following values are allowed for the 'what' parameter, which means means that + the specific feature explained on the right is supported: + + 'which-all' which(...,'all') + 'exists-in-private-directory' exists(...) will look in the /private subdirectory to see if a file exists + 'onCleanup' onCleanup(...) + 'alim' alim(...) + 'int32_logical_operations' bitand(a,b) with a, b of type int32 + 'graphics_objects' graphics system is object-oriented + 'libmx_c_interface' libmx is supported through mex in the C-language (recent MATLAB versions only support C++) + 'images' all image processing functions in FieldTrip's external/images directory + 'signal' all signal processing functions in FieldTrip's external/signal directory + 'stats' all statistical functions in FieldTrip's external/stats directory + 'program_invocation_name' program_invocation_name() (GNU Octave) + 'singleCompThread' start MATLAB with -singleCompThread + 'nosplash' start MATLAB with -nosplash + 'nodisplay' start MATLAB with -nodisplay + 'nojvm' start MATLAB with -nojvm + 'no-gui' start GNU Octave with --no-gui + 'RandStream.setGlobalStream' RandStream.setGlobalStream(...) + 'RandStream.setDefaultStream' RandStream.setDefaultStream(...) + 'rng' rng(...) + 'rand-state' rand('state') + 'urlread-timeout' urlread(..., 'Timeout', t) + 'griddata-vector-input' griddata(...,...,...,a,b) with a and b vectors + 'griddata-v4' griddata(...,...,...,...,...,'v4') with v4 interpolation support + 'uimenu' uimenu(...) + 'weboptions' weboptions(...) + 'parula' parula(...) + 'datetime' datetime structure + 'html' html rendering in desktop + + See also FT_VERSION, VERSION, VER, VERLESSTHAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_platform_supports.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_platform_supports", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_postamble.py b/fieldtrip/__utilities/ft_postamble.py new file mode 100644 index 0000000..5a0e322 --- /dev/null +++ b/fieldtrip/__utilities/ft_postamble.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def ft_postamble(*args, **kwargs): + """ + FT_POSTAMBLE is a helper function that is included in many of the FieldTrip + functions and which takes care of some general settings and operations at the end + of the function. + + This ft_postamble m-file is a function, but internally it executes a number of + private scripts in the callers workspace. This allows the private script to access + the variables in the callers workspace and behave as if the script were included as + a header file in C-code. + + See also FT_PREAMBLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_postamble.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_postamble", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/ft_preamble.py b/fieldtrip/__utilities/ft_preamble.py new file mode 100644 index 0000000..2060b4c --- /dev/null +++ b/fieldtrip/__utilities/ft_preamble.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def ft_preamble(*args, **kwargs): + """ + FT_PREAMBLE is a helper function that is included in many of the FieldTrip + functions and which takes care of some general settings and operations at the + begin of the function. + + This ft_preamble m-file is a function, but internally it executes a + number of private scripts in the callers workspace. This allows the + private script to access the variables in the callers workspace and + behave as if the script were included as a header file in C-code. + + See also FT_POSTAMBLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_preamble.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preamble", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/ft_progress.py b/fieldtrip/__utilities/ft_progress.py new file mode 100644 index 0000000..1e726cf --- /dev/null +++ b/fieldtrip/__utilities/ft_progress.py @@ -0,0 +1,63 @@ +from fieldtrip._runtime import Runtime + + +def ft_progress(*args, **kwargs): + """ + FT_PROGRESS shows a graphical or non-graphical progress indication similar to the + standard WAITBAR function, but with the extra option of printing it in the command + window as a plain text string or as a rotating dial. Alternatively, you can also + specify it not to give feedback on the progress. + + Prior to the for-loop, you should call either + ft_progress('init', 'none', 'Please wait...') + ft_progress('init', 'text', 'Please wait...') + ft_progress('init', 'textbar', 'Please wait...') % ascii progress bar + ft_progress('init', 'dial', 'Please wait...') % rotating dial + ft_progress('init', 'etf', 'Please wait...') % estimated time to finish + ft_progress('init', 'gui', 'Please wait...') + + In each iteration of the for-loop, you should call either + ft_progress(x) % only show percentage + ft_progress(x, 'Processing event %d from %d', i, N) % show string, x=i/N + + After finishing the for-loop, you should call + ft_progress('close') + + Here is an example for the use of a progress indicator + ft_progress('init', 'etf', 'Please wait...'); + for i=1:100 + ft_progress(i/100, 'Processing event %d from %d', i, 100); + pause(0.03); + end + ft_progress('close') + + See also WAITBAR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_progress.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_progress", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/ft_save_workspace.py b/fieldtrip/__utilities/ft_save_workspace.py new file mode 100644 index 0000000..783122d --- /dev/null +++ b/fieldtrip/__utilities/ft_save_workspace.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def ft_save_workspace(*args, **kwargs): + """ + FT_SAVE_WORKSPACE saves every variable in the base workspace to a .mat file with + the same name as the variable in the workspace itself. For example, the variable + "ans" would be saved to the file "ans.mat". Prior to calling this function, you + might want to clean up your workspace using CLEAR or KEEP. + + Use as + ft_save_workspace(dirname) + + If the directory does not yet exist, this function will create it for you. If you + leave it empty, the files will be saved to the present working directory. + + For example, the following will save all variables to a time-stamped + sub-directory that is created inside the present working directory: + + ft_save_workspace(datestr(now)) + + See also SAVE, LOAD, SAVEFIG, CLEAR, KEEP + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_save_workspace.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_save_workspace", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/ft_scalingfactor.py b/fieldtrip/__utilities/ft_scalingfactor.py new file mode 100644 index 0000000..232697a --- /dev/null +++ b/fieldtrip/__utilities/ft_scalingfactor.py @@ -0,0 +1,91 @@ +from fieldtrip._runtime import Runtime + + +def ft_scalingfactor(*args, **kwargs): + """ + FT_SCALINGFACTOR determines the scaling factor from old to new units, i.e. it + returns a number with which the data in the old units needs to be multiplied + to get it expressed in the new units. + + Use as + factor = ft_scalingfactor(old, new) + where old and new are strings that specify the units. + + For example + ft_scalingfactor('m', 'cm') % returns 100 + ft_scalingfactor('V', 'uV') % returns 1000 + ft_scalingfactor('T/cm', 'fT/m') % returns 10^15 divided by 10^-2, which is 10^17 + ft_scalingfactor('cm^2', 'mm^2') % returns 100 + ft_scalingfactor('1/ms', 'Hz') % returns 1000 + + The following fundamental units are supported + metre m length l (a lowercase L), x, r L + kilogram kg mass m M + second s time t T + ampere A electric current I (an uppercase i) I + kelvin K thermodynamic temperature T # + mole mol amount of substance n N + candela cd luminous intensity Iv (an uppercase i with lowercase non-italicized v subscript) J + + The following derived units are supported + hertz Hz frequency 1/s T-1 + radian rad angle m/m dimensionless + steradian sr solid angle m2/m2 dimensionless + newton N force, weight kg#m/s2 M#L#T-2 + pascal Pa pressure, stress N/m2 M#L-1#T-2 + joule J energy, work, heat N#m = C#V = W#s M#L2#T-2 + coulomb C electric charge or quantity of electricity s#A T#I + volt V voltage, electrical potential difference, electromotive force W/A = J/C M#L2#T-3#I-1 + farad F electric capacitance C/V M-1#L-2#T4#I2 + siemens S electrical conductance 1/# = A/V M-1#L-2#T3#I2 + weber Wb magnetic flux J/A M#L2#T-2#I-1 + tesla T magnetic field strength V#s/m2 = Wb/m2 = N/(A#m) M#T-2#I-1 + henry H inductance V#s/A = Wb/A M#L2#T-2#I-2 + lumen lm luminous flux cd#sr J + lux lx illuminance lm/m2 L-2#J + becquerel Bq radioactivity (decays per unit time) 1/s T-1 + gray Gy absorbed dose (of ionizing radiation) J/kg L2#T-2 + sievert Sv equivalent dose (of ionizing radiation) J/kg L2#T-2 + katal kat catalytic activity mol/s T-1#N + + The following alternative units are supported + inch inch length + feet feet length + gauss gauss magnetic field strength + + The following derived units are not supported due to potential confusion + between their ascii character representation + ohm # electric resistance, impedance, reactance V/A M#L2#T-3#I-2 + watt W power, radiant flux J/s = V#A M#L2#T-3 + degree Celsius ?C temperature relative to 273.15 K K ? + + See also http://en.wikipedia.org/wiki/International_System_of_Units + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_scalingfactor.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_scalingfactor", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_selectdata.py b/fieldtrip/__utilities/ft_selectdata.py new file mode 100644 index 0000000..ef2c966 --- /dev/null +++ b/fieldtrip/__utilities/ft_selectdata.py @@ -0,0 +1,85 @@ +from fieldtrip._runtime import Runtime + + +def ft_selectdata(*args, **kwargs): + """ + FT_SELECTDATA makes a selection in the input data along specific data + dimensions, such as channels, time, frequency, trials, etc. It can also + be used to average the data along each of the specific dimensions. + + Use as + [data] = ft_selectdata(cfg, data, ...) + + The cfg argument is a configuration structure which can contain + cfg.tolerance = scalar, tolerance value to determine equality of time/frequency bins (default = 1e-5) + + For data with trials or subjects as repetitions, you can specify + cfg.trials = 1xN, trial indices to keep, can be 'all'. You can use logical indexing, where false(1,N) removes all the trials + cfg.avgoverrpt = string, can be 'yes' or 'no' (default = 'no') + + For data with a channel dimension you can specify + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION + cfg.avgoverchan = string, can be 'yes' or 'no' (default = 'no') + cfg.nanmean = string, can be 'yes' or 'no' (default = 'no') + + For data with channel combinations you can specify + cfg.channelcmb = Nx2 cell-array with selection of channels (default = 'all'), see FT_CHANNELCOMBINATION + cfg.avgoverchancmb = string, can be 'yes' or 'no' (default = 'no') + + For data with a time dimension you can specify + cfg.latency = scalar or string, can be 'all', 'minperiod', 'maxperiod', 'prestim', 'poststim', or [beg end], specify time range in seconds + cfg.avgovertime = string, can be 'yes' or 'no' (default = 'no') + cfg.nanmean = string, can be 'yes' or 'no' (default = 'no') + + For data with a frequency dimension you can specify + cfg.frequency = scalar or string, can be 'all', or [beg end], specify frequency range in Hz + cfg.avgoverfreq = string, can be 'yes' or 'no' (default = 'no') + cfg.nanmean = string, can be 'yes' or 'no' (default = 'no') + + When you average over a dimension, you can choose whether to keep that dimension in + the data representation or remove it altogether. + cfg.keeprptdim = 'yes' or 'no' (default is automatic) + cfg.keepchandim = 'yes' or 'no' (default = 'yes') + cfg.keepchancmbdim = 'yes' or 'no' (default = 'yes') + cfg.keeptimedim = 'yes' or 'no' (default = 'yes') + cfg.keepfreqdim = 'yes' or 'no' (default = 'yes') + + If multiple input arguments are provided, FT_SELECTDATA will adjust the individual + inputs such that either the INTERSECTION across inputs is retained (i.e. only the + channel, time, and frequency points that are shared across all input arguments), or + that the UNION across inputs is retained (replacing missing data with nans). In + either case, the order of the channels is made consistent across inputs. The + behavior can be specified with + cfg.select = string, can be 'intersect' or 'union' (default = 'intersect') + For raw data structures you cannot make the union. + + See also FT_DATATYPE, FT_CHANNELSELECTION, FT_CHANNELCOMBINATION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_selectdata.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_selectdata", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_setopt.py b/fieldtrip/__utilities/ft_setopt.py new file mode 100644 index 0000000..a1edd6b --- /dev/null +++ b/fieldtrip/__utilities/ft_setopt.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def ft_setopt(*args, **kwargs): + """ + FT_SETOPT assigns a value to an configuration structure or to a cell-array + with key-value pairs. It will overwrite the option if already present, or + append the option if not present. + + Use as + s = ft_setopt(s, key, val) + where s is a structure or a cell-array. + + See also FT_GETOPT, FT_CHECKOPT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_setopt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_setopt", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_source2full.py b/fieldtrip/__utilities/ft_source2full.py new file mode 100644 index 0000000..16f0714 --- /dev/null +++ b/fieldtrip/__utilities/ft_source2full.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def ft_source2full(*args, **kwargs): + """ + FT_SOURCE2FULL recreates the grid locations outside the brain in the source + reconstruction, so that the source volume again describes the full grid. + This undoes the memory savings that can be achieved using FT_SOURCE2SPARSE + and makes it possible again to plot the source volume and save it to an + external file. + + Use as + [source] = ft_source2full(source) + + See also FT_SOURCE2SPARSE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_source2full.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_source2full", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_source2grid.py b/fieldtrip/__utilities/ft_source2grid.py new file mode 100644 index 0000000..7c7d521 --- /dev/null +++ b/fieldtrip/__utilities/ft_source2grid.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def ft_source2grid(*args, **kwargs): + """ + FT_SOURCE2GRID removes the fields from a source structure that are + not necessary to reuse the dipole grid in another source estimation. + + Use as + [grid] = ft_source2grid(source); + + The resulting grid can be used in the configuration of another + run of FT_SOURCEANALYSIS. + + See also FTSOURCE2SPARSE, FT_SOURCE2FULL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_source2grid.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_source2grid", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_source2sparse.py b/fieldtrip/__utilities/ft_source2sparse.py new file mode 100644 index 0000000..73bb3a8 --- /dev/null +++ b/fieldtrip/__utilities/ft_source2sparse.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def ft_source2sparse(*args, **kwargs): + """ + FT_SOURCE2SPARSE removes the grid locations outside the brain from the source + reconstruction, thereby saving memory. + + This invalidates the fields that describe the grid, and also makes it + more difficult to make a plot of each of the slices of the source volume. + The original source structure can be recreated using FT_SOURCE2FULL. + + Use as + [source] = ft_source2sparse(source) + + See also FT_SOURCE2FULL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_source2sparse.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_source2sparse", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_standalone.py b/fieldtrip/__utilities/ft_standalone.py new file mode 100644 index 0000000..7b09202 --- /dev/null +++ b/fieldtrip/__utilities/ft_standalone.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def ft_standalone(*args, **kwargs): + """ + FT_STANDALONE is the entry function of the compiled FieldTrip application. + The compiled application can be used to execute FieldTrip data analysis + scripts. + + This function can be started on the interactive MATLAB command line as + ft_standalone script.m + ft_standalone script1.m script2.m ... + ft_standalone jobfile.mat + or after compilation on the Linux/macOS command line as + fieldtrip.sh script.m + fieldtrip.sh script1.m script2.m ... + fieldtrip.sh jobfile.mat + + It is possible to pass additional options on the MATLAB command line like + this on the MATLAB command line + ft_standalone --option value scriptname.m + or on the Linux/macOS command line + fieldtrip.sh --option value scriptname.m + The options and their values are automatically made available as local + variables in the script execution environment. + + See also FT_COMPILE_STANDALONE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_standalone.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_standalone", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/ft_struct2char.py b/fieldtrip/__utilities/ft_struct2char.py new file mode 100644 index 0000000..3ed0763 --- /dev/null +++ b/fieldtrip/__utilities/ft_struct2char.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def ft_struct2char(*args, **kwargs): + """ + FT_STRUCT2CHAR converts all string elements in a structure + into char-arrays. + + Use as + x = ft_struct2char(x) + + See also FT_STRUCT2STRING, FT_STRUCT2SINGLE, FT_STRUCT2DOUBLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_struct2char.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_struct2char", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_struct2double.py b/fieldtrip/__utilities/ft_struct2double.py new file mode 100644 index 0000000..21b3bb3 --- /dev/null +++ b/fieldtrip/__utilities/ft_struct2double.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def ft_struct2double(*args, **kwargs): + """ + FT_STRUCT2DOUBLE converts all single precision numeric data in a structure + into double precision. It will also convert plain matrices and + cell-arrays. + + Use as + x = ft_struct2double(x) + + Starting from MATLAB 7.0, you can use single precision data in your + computations, i.e. you do not have to convert back to double precision. + + MATLAB version 6.5 and older only support single precision for storing + data in memory or on disk, but do not allow computations on single + precision data. Therefore you should converted your data from single to + double precision after reading from file. + + See also FT_STRUCT2SINGLE, FT_STRUCT2CHAR, FT_STRUCT2STRING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_struct2double.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_struct2double", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_struct2single.py b/fieldtrip/__utilities/ft_struct2single.py new file mode 100644 index 0000000..bc8a2de --- /dev/null +++ b/fieldtrip/__utilities/ft_struct2single.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def ft_struct2single(*args, **kwargs): + """ + FT_STRUCT2SINGLE converts all double precision numeric data in a structure + into single precision, which takes up half the amount of memory compared + to double precision. It will also convert plain matrices and cell-arrays. + + Use as + x = ft_struct2single(x) + + Starting from MATLAB 7.0, you can use single precision data in your + computations, i.e. you do not have to convert back to double precision. + + MATLAB version 6.5 and older only support single precision for storing + data in memory or on disk, but do not allow computations on single + precision data. After reading a single precision structure from file, you + can convert it back with FT_STRUCT2DOUBLE. + + See also FT_STRUCT2DOUBLE, FT_STRUCT2CHAR, FT_STRUCT2STRING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_struct2single.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_struct2single", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_struct2string.py b/fieldtrip/__utilities/ft_struct2string.py new file mode 100644 index 0000000..58b25fa --- /dev/null +++ b/fieldtrip/__utilities/ft_struct2string.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def ft_struct2string(*args, **kwargs): + """ + FT_STRUCT2STRING converts all char-array elements in a structure + into strings. + + Use as + x = ft_struct2string(x) + + See also FT_STRUCT2CHAR, FT_STRUCT2SINGLE, FT_STRUCT2DOUBLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_struct2string.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_struct2string", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_test.py b/fieldtrip/__utilities/ft_test.py new file mode 100644 index 0000000..0dab089 --- /dev/null +++ b/fieldtrip/__utilities/ft_test.py @@ -0,0 +1,162 @@ +from fieldtrip._runtime import Runtime + + +def ft_test(*args, **kwargs): + """ + FT_TEST performs selected FieldTrip test scripts, finds and updates the dependencies of test scripts, finds which high-level FieldTrip functions are not tested, or reports on previous test + results from the dashboard database. + + Use as + ft_test inventorize ... + ft_test run ... + ft_test find_dependency ... + ft_test update_dependency ... + ft_test untested_functions ... + ft_test moxunit_run ... % this is obsolete + ft_test report ... % this is obsolete + ft_test compare ... % this is obsolete + + ========= INVENTORIZE ========= + + To list the tests based on their dependencies, you would do + ft_test inventorize + to list all test functions, or + ft_test inventorize data no + to list test functions that don't need any external data to run. + + Additional optional arguments are specified as key-value pairs and can include + dependency = string or cell-array of strings + upload = string, upload test results to the dashboard, can be 'yes' or 'no' (default = 'yes') + dccnpath = string, allow files to be read from the DCCN path, can be 'yes' or 'no' (default is automatic) + maxmem = number (in bytes) or string such as 10GB + maxwalltime = number (in seconds) or string such as HH:MM:SS + data = string or cell-array of strings with 'no', 'public' and/or 'private' + sort = string, can be 'alphabetical', 'walltime', 'mem' or 'random' (default = 'alphabetical') + returnerror = string, whether give an error upon detecting a failed script, can be 'immediate', 'final', 'no' (default = 'no') + + ========= RUN ========= + + To execute a test and submit the results to the dashboard database, you would do + ft_test run + to run all test functions, or + ft_test run test_bug46 + to run a selected test. + + Test functions should not require any input arguments. Any output arguments will + not be considered. + + Additional optional arguments are specified as key-value pairs and can include + dependency = string or cell-array of strings + upload = string, upload test results to the dashboard, can be 'yes' or 'no' (default = 'yes') + dccnpath = string, allow files to be read from the DCCN path, can be 'yes' or 'no' (default is automatic) + maxmem = number (in bytes) or string such as 10GB + maxwalltime = number (in seconds) or string such as HH:MM:SS + data = string or cell-array of strings with 'no', 'public' and/or 'private' + sort = string, can be 'alphabetical', 'walltime', 'mem' or 'random' (default = 'alphabetical') + returnerror = string, whether give an error upon detecting a failed script, can be 'immediate', 'final', 'no' (default = 'no') + + ========= FIND_DEPENDENCY ========= + + To find on what functions test scripts depend on, you would do + ft_test find_dependency test_bug46 + to find on what functions test_bug46 depends on. + + It outputs: + inlist = Nx1 cell-array, describes the rows and lists the test scripts + outlist = 1xM cell-array, describes the columns and lists the dependencies + depmat = NxM dependency matrix, see below + + The dependency matrix contains the following values: + - 0 if there is no dependency + - 2 for a direct dependency + + ========= UPDATE_DEPENDENCY ========= + + To update the DEPENDENCY header in a specific test script, you would do: + ft_test update_dependency test_bug46 + + ========= UNTESTED_FUNCTIONS ========= + + To find FieldTrip high-level functions not tested by any test scripts, + you would do + ft_test untested_functions + + ========= MOXUNIT_RUN ========= + + To execute tests using MOxUNit, you would do + ft_test moxunit_run + + This feature is still experimental, but should support the same + options as ft_test run (see above), and in addition: + xmloutput = string, filename for JUnit-like XML file with test + results (used for shippable CI). + exclude_if_prefix_equals_failed = string, if set to false (or 'no') + then tests are also run if their filename starts + with 'failed'. If set to true (or 'yes'), which is + the default, then filenames starting with 'failed' + are skipped. + + ========= REPORT ========= + + To print a table with the results on screen, you would do + ft_test report + to show all, or for a specific one + ft_test report test_bug46 + + Additional query arguments are specified as key-value pairs and can include + matlabversion = string, for example 2016b + fieldtripversion = string + branch = string + arch = string, can be glnxa64, maci64. win32 or win64 + hostname = string + user = string + + Optionally, you may capture the output to get the results as a Matlab table + array, in which case they are not automatically displayed. + rslt = ft_test('report', 'fieldtripversion', 'cef3396'); + + ========= COMPARE ========= + + To print a table comparing different test results, you would do + ft_test compare matlabversion 2015b 2016b + ft_test compare fieldtripversion ea3c2b9 314d186 + ft_test compare arch glnxa64 win32 + + Additional query arguments are specified as key-value pairs and can include + matlabversion = string, for example 2016b + fieldtripversion = string + branch = string + arch = string, can be glnxa64, maci64. win32 or win64 + hostname = string + user = string + + See also DCCNPATH, FT_VERSION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_test.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_test", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_trackusage.py b/fieldtrip/__utilities/ft_trackusage.py new file mode 100644 index 0000000..d3f980f --- /dev/null +++ b/fieldtrip/__utilities/ft_trackusage.py @@ -0,0 +1,61 @@ +from fieldtrip._runtime import Runtime + + +def ft_trackusage(*args, **kwargs): + """ + FT_TRACKUSAGE tracks the usage of specific FieldTrip components using a central + tracking server. This involves sending a small snippet of information to the + server. Tracking is only used to gather data on the usage of the FieldTrip + toolbox, to get information on the number of users and on the frequency of use + of specific toolbox functions. This allows the toolbox developers to improve the + FIeldTrip toolbox source code, documentation and to provide better support. + + This function will NOT upload any information about the data, nor about the + configuration that you are using in your analyses. + + This function will NOT upload any identifying details about you. Your username + and computer name are "salted" and subsequently converted with the MD5 + cryptographic hashing function into a unique identifier. Not knowing the salt, + it is impossible to decode these MD5 hashes and recover the original + identifiers. + + It is possible to disable the tracking for all functions by specifying + the following + global ft_defaults + ft_default.trackusage = 'no' + + See the following online documentation for more information + http://en.wikipedia.org/wiki/MD5 + http://en.wikipedia.org/wiki/Salt_(cryptography) + http://www.fieldtriptoolbox.org/faq/tracking + + See also FT_DEFAULTS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_trackusage.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_trackusage", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/ft_transform_geometry.py b/fieldtrip/__utilities/ft_transform_geometry.py new file mode 100644 index 0000000..a72a318 --- /dev/null +++ b/fieldtrip/__utilities/ft_transform_geometry.py @@ -0,0 +1,86 @@ +from fieldtrip._runtime import Runtime + + +def ft_transform_geometry(*args, **kwargs): + """ + FT_TRANSFORM_GEOMETRY applies a homogeneous coordinate transformation to a + structure with geometric information, for example a volume conduction model for the + head, gradiometer of electrode structure containing EEG or MEG sensor positions and + MEG coil orientations, a head shape or a source model. + + Use as + [output] = ft_transform_geometry(transform, input) + where the transform should be a 4x4 homogeneous transformation matrix and the input + data structure can be any of the FieldTrip data structures that describes + geometrical data, or + [output] = ft_transform_geometry(transform, input, method) + where the transform contains a set of parameters that can be converted into a 4x4 + homogeneous transformation matrix, using one of the supported methods: + 'rotate', 'scale', 'translate', 'rigidbody'. All methods require a 3-element vector + as parameters, apart from rigidbody, which requires 6 parameters. + + The units of the transformation matrix must be the same as the units in which the + geometric object is expressed. + + The type of geometric object constrains the type of allowed transformations. + + For sensor arrays: + If the input is an MEG gradiometer array, only a rigid-body translation plus + rotation are allowed. If the input is an EEG electrode or fNIRS optodes array, + global rescaling and individual axis rescaling is also allowed. + + For volume conduction models: + If the input is a volume conductor model of the following type: + localspheres model + singleshell model with the spherical harmonic coefficients already computed + BEM model with system matrix already computed + FEM model with volumetric elements + only a rigid-body translation plus rotation are allowed. + + If the input is a volume conductor model of the following type: + BEM model with the system matrix not yet computed + singleshell model with the spherical harmonic coefficients not yet computed + rotation, translation, global rescaling and individual axis rescaling is allowed. + + If the input is a volume conductor model of the following type: + single sphere + concentric spheres + rotation, translation and global rescaling is allowed. + + For source models, either defined as a 3D regular grid, a 2D mesh or unstructred + point cloud, rotation, translation, global rescaling and individual axis rescaling + is allowed. + + For anatomical MRIs and functional volumetric data, rotation, translation, global + rescaling and individual axis rescaling are allowed. + + See also FT_WARP_APPLY, FT_HEADCOORDINATES, FT_SCALINGFACTOR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_transform_geometry.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_transform_geometry", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_transform_headmodel.py b/fieldtrip/__utilities/ft_transform_headmodel.py new file mode 100644 index 0000000..5807f2a --- /dev/null +++ b/fieldtrip/__utilities/ft_transform_headmodel.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def ft_transform_headmodel(*args, **kwargs): + """ + This function is a backward compatibility wrapper for existing MATLAB scripts + that call a function that is not part of the FieldTrip toolbox any more. + + Please update your code to make it future-proof. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_transform_headmodel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_transform_headmodel", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_transform_headshape.py b/fieldtrip/__utilities/ft_transform_headshape.py new file mode 100644 index 0000000..e527dc6 --- /dev/null +++ b/fieldtrip/__utilities/ft_transform_headshape.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def ft_transform_headshape(*args, **kwargs): + """ + This function is a backward compatibility wrapper for existing MATLAB scripts + that call a function that is not part of the FieldTrip toolbox any more. + + Please update your code to make it future-proof. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_transform_headshape.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_transform_headshape", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_transform_sens.py b/fieldtrip/__utilities/ft_transform_sens.py new file mode 100644 index 0000000..9e3f330 --- /dev/null +++ b/fieldtrip/__utilities/ft_transform_sens.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def ft_transform_sens(*args, **kwargs): + """ + This function is a backward compatibility wrapper for existing MATLAB scripts + that call a function that is not part of the FieldTrip toolbox any more. + + Please update your code to make it future-proof. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_transform_sens.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_transform_sens", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_transform_vol.py b/fieldtrip/__utilities/ft_transform_vol.py new file mode 100644 index 0000000..33e5865 --- /dev/null +++ b/fieldtrip/__utilities/ft_transform_vol.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def ft_transform_vol(*args, **kwargs): + """ + This function is a backward compatibility wrapper for existing MATLAB scripts + that call a function that is not part of the FieldTrip toolbox any more. + + Please update your code to make it future-proof. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_transform_vol.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_transform_vol", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_version.py b/fieldtrip/__utilities/ft_version.py new file mode 100644 index 0000000..2863af5 --- /dev/null +++ b/fieldtrip/__utilities/ft_version.py @@ -0,0 +1,69 @@ +from fieldtrip._runtime import Runtime + + +def ft_version(*args, **kwargs): + """ + FT_VERSION returns the version of FieldTrip and the path where it is installed + + FieldTrip is not released with version numbers as "2.0", "2.1", etc. Instead, we + share our development version on http://github.com/fieldtrip/fieldtrip. You can use + git to make a local clone of the development version. Furthermore, we make + more-or-less daily releases of the code available on + https://github.com/fieldtrip/fieldtrip/releases and as zip file on our FTP server. + + If you use git with the development version, the version is labeled with the hash + of the latest commit like "128c693". You can access the specific version "XXXXXX" + at https://github.com/fieldtrip/fieldtrip/commit/XXXXXX. + + If you download the daily released version from our FTP server, the version is part + of the file name "fieldtrip-YYYYMMDD.zip", where YYY, MM and DD correspond to year, + month and day. + + Use as + ft_version + to display the latest revision number on screen, or + [ftver, ftpath] = ft_version + to get the version and the installation root directory. + + When using git with the development version, you can also get additional information with + ft_version revision + ft_version branch + ft_version clean + + On macOS you might have installed git along with Xcode instead of with homebrew, + which then requires that you agree to the Apple license. In that case it can + happen that this function stops, as in the background (invisible to you) it is + asking whether you agree. You can check this by typing "/usr/bin/git", which will + show the normal help message, or which will mention the license agreement. To + resolve this please open a terminal and type "sudo xcodebuild -license" + + See also FT_PLATFORM_SUPPORTS, VERSION, VER, VERLESSTHAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_version.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_version", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_warning.py b/fieldtrip/__utilities/ft_warning.py new file mode 100644 index 0000000..3fa2d66 --- /dev/null +++ b/fieldtrip/__utilities/ft_warning.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def ft_warning(*args, **kwargs): + """ + FT_WARNING prints a warning message on screen, depending on the verbosity + settings of the calling high-level FieldTrip function. This function works + similar to the standard WARNING function, but also features the "once" mode. + + Use as + ft_warning(...) + with arguments similar to fprintf, or + ft_warning(msgId, ...) + with arguments similar to warning. + + You can switch of all warning messages using + ft_warning off + or for specific ones using + ft_warning off msgId + + To switch them back on, you would use + ft_warning on + or for specific ones using + ft_warning on msgId + + Warning messages are only printed once per timeout period using + ft_warning timeout 60 + ft_warning once + or for specific ones using + ft_warning once msgId + + You can see the most recent messages and identifier using + ft_warning last + + You can query the current on/off/once state for all messages using + ft_warning query + + See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_warning.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_warning", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_warp_apply.py b/fieldtrip/__utilities/ft_warp_apply.py new file mode 100644 index 0000000..25435ff --- /dev/null +++ b/fieldtrip/__utilities/ft_warp_apply.py @@ -0,0 +1,83 @@ +from fieldtrip._runtime import Runtime + + +def ft_warp_apply(*args, **kwargs): + """ + FT_WARP_APPLY performs a 3D linear or nonlinear transformation on the input + coordinates, similar to those in AIR. You can find technical documentation + on warping in general at http://air.bmap.ucla.edu/AIR5 + + Use as + [output] = ft_warp_apply(M, input, method, tol) + where + M vector or matrix with warping parameters + input Nx3 matrix with input coordinates + output Nx3 matrix with the transformed or warped output coordinates + method string describing the transformation or warping method + tol (optional) value determining the numerical precision of the + output, to deal with numerical round-off imprecisions due to + the warping + + The methods 'nonlin0', 'nonlin2' ... 'nonlin5' specify a polynomial transformation. + The size of the transformation matrix depends on the order of the warp + zeroth order : 1 parameter per coordinate (translation) + first order : 4 parameters per coordinate (total 12, affine) + second order : 10 parameters per coordinate + third order : 20 parameters per coordinate + fourth order : 35 parameters per coordinate + fifth order : 56 parameters per coordinate (total 168) + The size of M should be 3xP, where P is the number of parameters per coordinate. + Alternatively, you can specify the method to be 'nonlinear', in which case the + order will be determined from the size of the matrix M. + + If the method 'homogeneous' is selected, the input matrix M should be a 4x4 + homogenous transformation matrix. + + If the method 'sn2individual' or 'individual2sn' is selected, the input M should be + a structure with the nonlinear spatial normalisation (warping) parameters created + by SPM8 or SPM12 for alignment between an individual subject and a template brain. + When using the 'old' method, M will have subfields like this: + Affine: [4x4 double] + Tr: [4-D double] + VF: [1x1 struct] + VG: [1x1 struct] + flags: [1x1 struct] + When using the 'new' or the 'mars' method, M will have subfields like this: + + If any other method is selected, it is assumed that it specifies the name of an + auxiliary function that will, when given the input parameter vector M, return an + 4x4 homogenous transformation matrix. Supplied functions are 'translate', 'rotate', + 'scale', 'rigidbody', 'globalrescale', 'traditional', 'affine', 'perspective', + 'quaternion'. + + See also FT_AFFINECOORDINATES, FT_HEADCOORDINATES, FT_WARP_OPTIM, FT_WARP_ERROR, + MAKETFORM, AFFINE2D, AFFINE3D + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_warp_apply.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_warp_apply", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_warp_error.py b/fieldtrip/__utilities/ft_warp_error.py new file mode 100644 index 0000000..1afc445 --- /dev/null +++ b/fieldtrip/__utilities/ft_warp_error.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def ft_warp_error(*args, **kwargs): + """ + FT_WARP_ERROR computes the mean distance after linear or non-linear warping + and can be used as the goalfunction in a 3D warping minimalisation + + Use as + dist = ft_warp_error(M, input, target, 'method') + + It returns the mean Euclidean distance (i.e. the residual) for an interactive + optimalization to transform the input towards the target using the + transformation M with the specified warping method. + + See also FT_WARP_OPTIM, FT_WARP_APPLY + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_warp_error.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_warp_error", *args, **kwargs) diff --git a/fieldtrip/__utilities/ft_warp_optim.py b/fieldtrip/__utilities/ft_warp_optim.py new file mode 100644 index 0000000..f3e26ae --- /dev/null +++ b/fieldtrip/__utilities/ft_warp_optim.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def ft_warp_optim(*args, **kwargs): + """ + FT_WARP_OPTIM determine intermediate positions using warping (deformation) + the input cloud of points is warped to match the target. + The strategy is to start with simpelest linear warp, followed by a more + elaborate linear warp, which then is followed by the nonlinear warps up + to the desired order. + + [result, M] = ft_warp_pnt(input, target, method) + input contains the Nx3 measured 3D positions + target contains the Nx3 template 3D positions + method should be any of + 'rigidbody' + 'globalrescale' + 'traditional' (default) + 'nonlin1' + 'nonlin2' + 'nonlin3' + 'nonlin4' + 'nonlin5' + + The default warping method is a traditional linear warp with individual + rescaling in each dimension. Optionally you can select a nonlinear warp + of the 1st (affine) up to the 5th order. + + When available, this function will use the MATLAB optimization toolbox. + + See also FT_WARP_APPLY, FT_WARP_ERRROR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/ft_warp_optim.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_warp_optim", *args, **kwargs) diff --git a/fieldtrip/__utilities/getsubfield.py b/fieldtrip/__utilities/getsubfield.py new file mode 100644 index 0000000..52f90a2 --- /dev/null +++ b/fieldtrip/__utilities/getsubfield.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def getsubfield(*args, **kwargs): + """ + GETSUBFIELD returns a field from a structure just like the standard + GETFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = getsubfield(s, 'fieldname') + or as + f = getsubfield(s, 'fieldname.subfieldname') + + See also GETFIELD, ISSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/getsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getsubfield", *args, **kwargs) diff --git a/fieldtrip/__utilities/hasyokogawa.py b/fieldtrip/__utilities/hasyokogawa.py new file mode 100644 index 0000000..0a6bbc4 --- /dev/null +++ b/fieldtrip/__utilities/hasyokogawa.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def hasyokogawa(*args, **kwargs): + """ + HASYOKOGAWA tests whether the data input toolbox for MEG systems by + Yokogawa (www.yokogawa.com, designed by KIT/EagleTechnology) is + installed. Only the newest version of the toolbox is accepted. + + Use as + string = hasyokogawa; + which returns a string describing the toolbox version, e.g. "12bitBeta3", + "16bitBeta3", or "16bitBeta6" for preliminary versions, or '1.5' for the + official Yokogawa MEG Reader Toolbox. An empty string is returned if the toolbox + is not installed. The string "unknown" is returned if it is installed but + the version is unknown. + + Alternatively you can use it as + [boolean] = hasyokogawa(desired); + where desired is a string with the desired version. + + See also READ_YOKOGAWA_HEADER, READ_YOKOGAWA_DATA, READ_YOKOGAWA_EVENT, + YOKOGAWA2GRAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/hasyokogawa.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("hasyokogawa", *args, **kwargs) diff --git a/fieldtrip/__utilities/issubfield.py b/fieldtrip/__utilities/issubfield.py new file mode 100644 index 0000000..cdfd9d0 --- /dev/null +++ b/fieldtrip/__utilities/issubfield.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def issubfield(*args, **kwargs): + """ + ISSUBFIELD tests for the presence of a field in a structure just like the standard + Matlab ISFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = issubfield(s, 'fieldname') + or as + f = issubfield(s, 'fieldname.subfieldname') + + This function returns true if the field is present and false if the field + is not present. + + See also ISFIELD, GETSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/issubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("issubfield", *args, **kwargs) diff --git a/fieldtrip/__utilities/istrue.py b/fieldtrip/__utilities/istrue.py new file mode 100644 index 0000000..79406e6 --- /dev/null +++ b/fieldtrip/__utilities/istrue.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def istrue(*args, **kwargs): + """ + ISTRUE converts an input argument like "yes/no", "true/false" or "on/off" into a + boolean. If the input is boolean, then it will remain like that. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/istrue.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("istrue", *args, **kwargs) diff --git a/fieldtrip/__utilities/keepfields.py b/fieldtrip/__utilities/keepfields.py new file mode 100644 index 0000000..da57a45 --- /dev/null +++ b/fieldtrip/__utilities/keepfields.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def keepfields(*args, **kwargs): + """ + KEEPFIELDS makes a selection of the fields in a structure + + Use as + s = keepfields(s, fields); + + See also REMOVEFIELDS, COPYFIELDS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/keepfields.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("keepfields", *args, **kwargs) diff --git a/fieldtrip/__utilities/keyval.py b/fieldtrip/__utilities/keyval.py new file mode 100644 index 0000000..cbd711c --- /dev/null +++ b/fieldtrip/__utilities/keyval.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def keyval(*args, **kwargs): + """ + KEYVAL returns the value that corresponds to the requested key in a + key-value pair list of variable input arguments + + Use as + [val] = keyval(key, varargin) + + See also VARARGIN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/keyval.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("keyval", *args, **kwargs) diff --git a/fieldtrip/__utilities/keyvalcheck.py b/fieldtrip/__utilities/keyvalcheck.py new file mode 100644 index 0000000..f9a5586 --- /dev/null +++ b/fieldtrip/__utilities/keyvalcheck.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def keyvalcheck(*args, **kwargs): + """ + KEYVALCHECK is a helper function for parsing optional key-value input pairs. + + Use as + keyvalcheck(argin, 'required', {'key1', 'key2', ...}) + keyvalcheck(argin, 'forbidden', {'key1', 'key2', ...}) + keyvalcheck(argin, 'optional', {'key1', 'key2', ...}) + + See also KEYVAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/keyvalcheck.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("keyvalcheck", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/markdown2matlab.py b/fieldtrip/__utilities/markdown2matlab.py new file mode 100644 index 0000000..ecb5ec3 --- /dev/null +++ b/fieldtrip/__utilities/markdown2matlab.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def markdown2matlab(*args, **kwargs): + """ + MARKDOWN2MATLAB converts a Markdown file to a MATLAB script or function. All text + is converted to comments, headings are converted to comment lines starting with %% + sections with code are properly formatted, and words that appear in bold, italic or + monospace are converted. + + Use as + markdown2matlab(infile, outfile) + + If no outfile is specified, it will write it to a .m file with the same name as + the infile. In case the file exists, it will be written with a numeric suffix. + + The best is to provide the full filepath, otherwise it will look for the file within + the current path. + + Optional input arguments can be specified as key-value pairs and can include + ... + + See also MATLAB2MARKDOWN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/markdown2matlab.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("markdown2matlab", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/match_str.py b/fieldtrip/__utilities/match_str.py new file mode 100644 index 0000000..c1e19de --- /dev/null +++ b/fieldtrip/__utilities/match_str.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def match_str(*args, **kwargs): + """ + MATCH_STR looks for matching labels in two lists of strings + and returns the indices into both the 1st and 2nd list of the matches. + They will be ordered according to the first input argument. + + Use as + [sel1, sel2] = match_str(strlist1, strlist2) + + The strings can be stored as a char matrix or as an vertical array of + cells, the matching is done for each row. + + When including a 1 as the third input argument, the output lists of + indices will be expanded to the size of the largest input argument. + Entries that occur only in one of the two inputs will correspond to a 0 + in the output, in this case. This can be convenient in rare cases if the + size of the input lists is meaningful. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/match_str.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("match_str", *args, **kwargs) diff --git a/fieldtrip/__utilities/match_val.py b/fieldtrip/__utilities/match_val.py new file mode 100644 index 0000000..b745f95 --- /dev/null +++ b/fieldtrip/__utilities/match_val.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def match_val(*args, **kwargs): + """ + MATCH_VAL looks for matching values in two arrays of values + and returns the indices into both the 1st and 2nd list of the matches. + They will be ordered according to the first input argument. + + Use as + [sel1, sel2] = match_str(vallist1, vallist2) + + See also MATCH_STR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/match_val.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("match_val", *args, **kwargs) diff --git a/fieldtrip/__utilities/matlab2markdown.py b/fieldtrip/__utilities/matlab2markdown.py new file mode 100644 index 0000000..1b4d22d --- /dev/null +++ b/fieldtrip/__utilities/matlab2markdown.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def matlab2markdown(*args, **kwargs): + """ + MATLAB2MARKDOWN converts a MATLAB script or function to Markdown format. All + comments are converted to text, comment lines starting with %% are converted to + headings, sections with code are properly formatted, and words that appear in bold, + italic or monospace are converted. + + Use as + matlab2markdown(infile, outfile, ...) + + If no outfile is specified, it will write it to a .md file with the same name as + the infile. In case the file exists, it will be written with a numeric suffix. + + The best is to provide the full filepath, otherwise it will look for the file within + the current path. + + Optional input arguments can be specified as key-value pairs and can include + imagestyle = 'none|inline|jekyll' + pageheader = 'none|jekyll' + overwrite = true/false, allow overwriting of the .md file (default = false) + highlight = string, 'matlab', 'plaintext' or '' (default = '') + ... + + See also MARKDOWN2MATLAB + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/matlab2markdown.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("matlab2markdown", *args, **kwargs, nargout=0) diff --git a/fieldtrip/__utilities/memtic.py b/fieldtrip/__utilities/memtic.py new file mode 100644 index 0000000..a964146 --- /dev/null +++ b/fieldtrip/__utilities/memtic.py @@ -0,0 +1,71 @@ +from fieldtrip._runtime import Runtime + + +def memtic(*args, **kwargs): + """ + MEMTIC start a MATLAB memory recorder + + MEMTIC and MEMTOC functions work together to measure memory usage. + MEMTIC, by itself, saves the current memory footprint that MEMTOC + uses later to measure the memory that was used between the two. + + Use as + MEMTIC + MEMTOC + to print the estimated memory use on screen, or + MEMTIC + M = MEMTOC + to return the estimated memory (in bytes) in variable M, or + C = MEMTIC + M = MEMTOC(C) + to specifically estimate the memory use between a well-defined tic/toc pair. + + Note that MATLAB uses internal memory allocation, garbage collection, shallow + copies of variables, and virtual memory. Due to the advanced handling of + memory for its variables, it is not easy and in certain cases not possible to + make a reliable and reproducible estimate based on the memory information + provided by the operating system. + + Example: measure the memory increase due to allocating a lot of memory. + Doing a "clear x" following the allocation and prior to MEMTOC does not + affect the memory that is reported. + + memtic + n = 125; x = cell(1,n); + for i=1:n + x{i} = randn(1000,1000); % 8kB per item + disp(i); + end + whos x + memtoc + + See also TIC, TOC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/memtic.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("memtic", *args, **kwargs) diff --git a/fieldtrip/__utilities/memtoc.py b/fieldtrip/__utilities/memtoc.py new file mode 100644 index 0000000..58fecbd --- /dev/null +++ b/fieldtrip/__utilities/memtoc.py @@ -0,0 +1,71 @@ +from fieldtrip._runtime import Runtime + + +def memtoc(*args, **kwargs): + """ + MEMTOC return the memory that was used + + MEMTIC and MEMTOC functions work together to measure memory usage. + MEMTIC, by itself, saves the current memory footprint that MEMTOC + uses later to measure the memory that was used between the two. + + Use as + MEMTIC + MEMTOC + to print the estimated memory use on screen, or + MEMTIC + M = MEMTOC + to return the estimated memory (in bytes) in variable M, or + C = MEMTIC + M = MEMTOC(C) + to specifically estimate the memory use between a well-defined tic/toc pair. + + Note that MATLAB uses internal memory allocation, garbage collection, shallow + copies of variables, and virtual memory. Due to the advanced handling of + memory for its variables, it is not easy and in certain cases not possible to + make a reliable and reproducible estimate based on the memory information + provided by the operating system. + + Example: measure the memory increase due to allocating a lot of memory. + Doing a "clear x" following the allocation and prior to MEMTOC does not + affect the memory that is reported. + + memtic + n = 125; x = cell(1,n); + for i=1:n + x{i} = randn(1000,1000); % 8kB per item + disp(i); + end + whos x + memtoc + + See also TIC, TOC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/memtoc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("memtoc", *args, **kwargs) diff --git a/fieldtrip/__utilities/nearest.py b/fieldtrip/__utilities/nearest.py new file mode 100644 index 0000000..50e67e2 --- /dev/null +++ b/fieldtrip/__utilities/nearest.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def nearest(*args, **kwargs): + """ + NEAREST return the index of an array nearest to a scalar + + Use as + [indx] = nearest(array, val, insideflag, toleranceflag) + + The second input val can be a scalar, or a [minval maxval] vector for + limits selection. + + If not specified or if left empty, the insideflag and the toleranceflag + will default to false. + + The boolean insideflag can be used to specify whether the value should be + within the array or not. For example nearest(1:10, -inf) will return 1, + but nearest(1:10, -inf, true) will return an error because -inf is not + within the array. + + The boolean toleranceflag is used when insideflag is true. It can be used + to specify whether some tolerance should be allowed for values that are + just outside the array. For example nearest(1:10, 0.99, true, false) will + return an error, but nearest(1:10, 0.99, true, true) will return 1. The + tolerance that is allowed is half the distance between the subsequent + values in the array. + + See also FIND + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/nearest.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nearest", *args, **kwargs) diff --git a/fieldtrip/__utilities/printstruct.py b/fieldtrip/__utilities/printstruct.py new file mode 100644 index 0000000..55bcc10 --- /dev/null +++ b/fieldtrip/__utilities/printstruct.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def printstruct(*args, **kwargs): + """ + PRINTSTRUCT converts a MATLAB structure into a multiple-line string that, when + evaluated by MATLAB, results in the original structure. It also works for most + other standard MATLAB classes, such as numbers, vectors, matrices, and cell-arrays. + + Use as + str = printstruct(val) + or + str = printstruct(name, val) + where "val" is any MATLAB variable, e.g. a scalar, vector, matrix, structure, or + cell-array. If you pass the name of the variable, the output is a piece of MATLAB code + that you can execute, i.e. an ASCII serialized representation of the variable. + + Example + a.field1 = 1; + a.field2 = 2; + s = printstruct(a) + + b = rand(3); + s = printstruct(b) + + s = printstruct('c', randn(10)>0.5) + + See also DISP, NUM2STR, INT2STR, MAT2STR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/printstruct.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("printstruct", *args, **kwargs) diff --git a/fieldtrip/__utilities/removefields.py b/fieldtrip/__utilities/removefields.py new file mode 100644 index 0000000..861633e --- /dev/null +++ b/fieldtrip/__utilities/removefields.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def removefields(*args, **kwargs): + """ + REMOVEFIELDS makes a selection of the fields in a structure + + Use as + s = removefields(s, fields); + + See also KEEPFIELDS, COPYFIELDS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/removefields.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("removefields", *args, **kwargs) diff --git a/fieldtrip/__utilities/renamefields.py b/fieldtrip/__utilities/renamefields.py new file mode 100644 index 0000000..92876c1 --- /dev/null +++ b/fieldtrip/__utilities/renamefields.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def renamefields(*args, **kwargs): + """ + RENAMEFIELDS renames a selection of the fields in a structure + + Use as + b = renamefields(a, old, new) + which renames the fields with the old name to the new name. Fields that + are specified but not present will be silently ignored. + + See also COPYFIELDS, KEEPFIELDS, REMOVEFIELDS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/renamefields.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("renamefields", *args, **kwargs) diff --git a/fieldtrip/__utilities/rmsubfield.py b/fieldtrip/__utilities/rmsubfield.py new file mode 100644 index 0000000..04797b6 --- /dev/null +++ b/fieldtrip/__utilities/rmsubfield.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def rmsubfield(*args, **kwargs): + """ + RMSUBFIELD removes the contents of the specified field from a structure + just like the standard Matlab RMFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = rmsubfield(s, 'fieldname') + or as + s = rmsubfield(s, 'fieldname.subfieldname') + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/rmsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rmsubfield", *args, **kwargs) diff --git a/fieldtrip/__utilities/setsubfield.py b/fieldtrip/__utilities/setsubfield.py new file mode 100644 index 0000000..7fe750f --- /dev/null +++ b/fieldtrip/__utilities/setsubfield.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def setsubfield(*args, **kwargs): + """ + SETSUBFIELD sets the contents of the specified field to a specified value + just like the standard Matlab SETFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = setsubfield(s, 'fieldname', value) + or as + s = setsubfield(s, 'fieldname.subfieldname', value) + + where nested is a logical, false denoting that setsubfield will create + s.subfieldname instead of s.fieldname.subfieldname + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/setsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("setsubfield", *args, **kwargs) diff --git a/fieldtrip/__utilities/strel_bol.py b/fieldtrip/__utilities/strel_bol.py new file mode 100644 index 0000000..11313af --- /dev/null +++ b/fieldtrip/__utilities/strel_bol.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def strel_bol(*args, **kwargs): + """ + STREL_BOL constructs a 3D sphere with the specified radius + that can be used as structural element in 3D image processing + + See STREL, IMERODE, IMDILATE (image processing toolbox) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/strel_bol.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("strel_bol", *args, **kwargs) diff --git a/fieldtrip/__utilities/tokenize.py b/fieldtrip/__utilities/tokenize.py new file mode 100644 index 0000000..107737e --- /dev/null +++ b/fieldtrip/__utilities/tokenize.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def tokenize(*args, **kwargs): + """ + TOKENIZE cuts a string into pieces, returning the pieces in a cell-array + + Use as + t = tokenize(str) + t = tokenize(str, sep) + t = tokenize(str, sep, rep) + where + str = the string that you want to cut into pieces + sep = the separator at which to cut (default is whitespace) + rep = whether to treat repeating separator characters as one (default is false) + + With the optional boolean flag "rep" you can specify whether repeated + separator characters should be squeezed together (e.g. multiple + spaces between two words). The default is rep=1, i.e. repeated + separators are treated as one. + + See also STRSPLIT, SPLIT, STRTOK, TEXTSCAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/utilities/tokenize.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("tokenize", *args, **kwargs) diff --git a/fieldtrip/_align_ijk2xyz.py b/fieldtrip/_align_ijk2xyz.py new file mode 100644 index 0000000..598c525 --- /dev/null +++ b/fieldtrip/_align_ijk2xyz.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def _align_ijk2xyz(*args, **kwargs): + """ + ALIGN_IJK2XYZ flips and permutes the 3D volume data such that the axes of + the voxel indices and the headcoordinates approximately correspond. The + homogeneous transformation matrix is modified accordingly, to ensure that + the headcoordinates of each individual voxel do not change. The intention + is to create a volume structure that has a transform matrix which is + approximately diagonal in the rotation part. + + First, the volume is permuted in order to get the largest (absolute) + values on the diagonal of the transformation matrix. This permutation is + reflected by the second output argument. + + Second, the volumes are flipped along the dimensions for which the main + diagonal elements of the transformation matrix are negative. This is + reflected by the third output argument. + + The second and third argument returned to allow you to reverse the operation. + Note that first the data have to be 'unflipped', and then 'unpermuted' (using + ipermute, rather than permute). + + See also ALIGN_XYZ2IJK, VOLUMEPERMUTE, VOLUMEFLIP + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/align_ijk2xyz.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("align_ijk2xyz", *args, **kwargs) diff --git a/fieldtrip/_align_presentation.py b/fieldtrip/_align_presentation.py new file mode 100644 index 0000000..8ad8802 --- /dev/null +++ b/fieldtrip/_align_presentation.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _align_presentation(*args, **kwargs): + """ + ALIGN_PRESENTATION is a helper function to align events from a NBS Presentation log + files to MEG/EEG triggers, or to a sequence of BOLD volumes. + + Use as + events3 = align_events(event1, options1, event2, options2) + where + event1 = events from NBS Presentation log file + event2 = events from the MEG/EEG trigger channel + or + event1 = events from NBS Presentation log file + event2 = events corresponding to each volume of the BOLD sequence + + The input "options1" and "options2" variables specify how the events should be + mapped to each other. The output "events3" variable corresponds to the events from + NBS Presentation log, but with the time aligned to the MEG/EEG dataset or to the + BOLD volumes. + + See also DATA2BIDS, FT_READ_EVENT, FT_DEFINETRIAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/align_presentation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("align_presentation", *args, **kwargs) diff --git a/fieldtrip/_align_xyz2ijk.py b/fieldtrip/_align_xyz2ijk.py new file mode 100644 index 0000000..080458c --- /dev/null +++ b/fieldtrip/_align_xyz2ijk.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _align_xyz2ijk(*args, **kwargs): + """ + ALIGN_XYZ2IJK updates the transform and coordsys fields such that the axes of the + resulting head coordinate system are aligned with the voxel indices. The intention + is to create a volume structure that can be plotted in native voxel coordinates. + + See also ALIGN_IJK2XYZ, VOLUMEPERMUTE, VOLUMEFLIP + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/align_xyz2ijk.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("align_xyz2ijk", *args, **kwargs) diff --git a/fieldtrip/_alpha_taper.py b/fieldtrip/_alpha_taper.py new file mode 100644 index 0000000..23df351 --- /dev/null +++ b/fieldtrip/_alpha_taper.py @@ -0,0 +1,64 @@ +from fieldtrip._runtime import Runtime + + +def _alpha_taper(*args, **kwargs): + """ + ALPHA_TAPER returns an asymmetric taper that can be used to construct a + complex wavelet with the peak at a distance of 0.8 times the cycle length + from the end. + + Use as + tap = alpha_taper(n, f) + where + n = number of samples + f = frequency of desired wavelet, relative to the sampling frequency + + The taper will be sufficiently long for a wavelet when n>=5/f. + + Example: + f = 0.01; % 10 Hz wavelet at 1000 Hz sampling rate + plot(alpha_taper(5/f, f)); hold on + plot(alpha_taper(5/f, f) .* cos(2*pi*10*(-499:0)/1000), 'r'); + plot(alpha_taper(5/f, f) .* sin(2*pi*10*(-499:0)/1000), 'g'); + + This function implements equation 3 from Mitchell, Baker and Baker (2007); + Muscle Responses to Transcranial Stimulation Depend on Background Oscillatory + Activity. http://jp.physoc.org/cgi/content/abstract/jphysiol.2007.134031v1 + + The original paper contains a typo. The equation 3 in the paper reads + W(F,t) = -(5/4)*F*t * exp( (1+(5/4)*F*t) * i*2*pi*F*t ) + but should read + W(F,t) = -(5/4)*F*t * exp( (1+(5/4)*F*t) + i*2*pi*F*t ) + since then it is equal to + W(F,t) = -(5/4)*F*t * exp(1+(5/4)*F*t) * exp(i*2*pi*F*t) + which is simply + W(F,t) = taper(F,t) * exp(i*2*pi*F*t) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/alpha_taper.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("alpha_taper", *args, **kwargs) diff --git a/fieldtrip/_append_common.py b/fieldtrip/_append_common.py new file mode 100644 index 0000000..770fde3 --- /dev/null +++ b/fieldtrip/_append_common.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _append_common(*args, **kwargs): + """ + APPEND_COMMON is used for concatenating raw, timelock or freq data + + The general bookkeeping and the correct specification of the cfg + should be taken care of by the calling function. + + See FT_APPENDDATA, FT_APPENDTIMELOCK, FT_APPENDFREQ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/append_common.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("append_common", *args, **kwargs) diff --git a/fieldtrip/_artifact2boolvec.py b/fieldtrip/_artifact2boolvec.py new file mode 100644 index 0000000..7f230ad --- /dev/null +++ b/fieldtrip/_artifact2boolvec.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _artifact2boolvec(*args, **kwargs): + """ + ARTIFACT2BOOLVEC converts between two representations of events or trials. + + FieldTrip uses a number of representations for events that are conceptually very similar + event = structure with type, value, sample, duration and offset + trl = Nx3 numerical array with begsample, endsample, offset + trl = table with 3 columns for begsample, endsample, offset + artifact = Nx2 numerical array with begsample, endsample + artifact = table with 2 columns for begsample, endsample + boolvec = 1xNsamples boolean vector with a thresholded TTL/trigger sequence + boolvec = MxNsamples matrix vector with a thresholded TTL/trigger sequence + + If trl or artifact are represented as a MATLAB table, they can have additional + columns. These additional columns have to be named and are not restricted to + numerical values. + + This function makes a Boolean vector (or matrix when artifact is a cell-array of + multiple artifact definitions) with 0 for artifact free sample and 1 for sample + containing an artifact according to artifact specification. The length of the + vector matches the last sample in the artifact definition, or endsample when + specified. + + See also ARTIFACT2BOOLVEC, ARTIFACT2EVENT, ARTIFACT2TRL, BOOLVEC2ARTIFACT, BOOLVEC2EVENT, BOOLVEC2TRL, EVENT2ARTIFACT, EVENT2BOOLVEC, EVENT2TRL, TRL2ARTIFACT, TRL2BOOLVEC, TRL2EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/artifact2boolvec.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("artifact2boolvec", *args, **kwargs) diff --git a/fieldtrip/_artifact2event.py b/fieldtrip/_artifact2event.py new file mode 100644 index 0000000..8efe9b8 --- /dev/null +++ b/fieldtrip/_artifact2event.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _artifact2event(*args, **kwargs): + """ + ARTIFACT2EVENT converts between two representations of events or trials. + + FieldTrip uses a number of representations for events that are conceptually very similar + event = structure with type, value, sample, duration and offset + trl = Nx3 numerical array with begsample, endsample, offset + trl = table with 3 columns for begsample, endsample, offset + artifact = Nx2 numerical array with begsample, endsample + artifact = table with 2 columns for begsample, endsample + boolvec = 1xNsamples boolean vector with a thresholded TTL/trigger sequence + boolvec = MxNsamples boolean matrix with a thresholded TTL/trigger sequence + + If trl or artifact are represented as a MATLAB table, they can have additional + columns. These additional columns have to be named and are not restricted to + numerical values. + + See also ARTIFACT2BOOLVEC, ARTIFACT2EVENT, ARTIFACT2TRL, BOOLVEC2ARTIFACT, BOOLVEC2EVENT, BOOLVEC2TRL, EVENT2ARTIFACT, EVENT2BOOLVEC, EVENT2TRL, TRL2ARTIFACT, TRL2BOOLVEC, TRL2EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/artifact2event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("artifact2event", *args, **kwargs) diff --git a/fieldtrip/_artifact2trl.py b/fieldtrip/_artifact2trl.py new file mode 100644 index 0000000..4855457 --- /dev/null +++ b/fieldtrip/_artifact2trl.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _artifact2trl(*args, **kwargs): + """ + ARTIFACT2TRL converts between two representations of events or trials. + + FieldTrip uses a number of representations for events that are conceptually very similar + event = structure with type, value, sample, duration and offset + trl = Nx3 numerical array with begsample, endsample, offset + trl = table with 3 columns for begsample, endsample, offset + artifact = Nx2 numerical array with begsample, endsample + artifact = table with 2 columns for begsample, endsample + boolvec = 1xNsamples boolean vector with a thresholded TTL/trigger sequence + boolvec = MxNsamples boolean matrix with a thresholded TTL/trigger sequence + + If trl or artifact are represented as a MATLAB table, they can have additional + columns. These additional columns have to be named and are not restricted to + numerical values. + + See also ARTIFACT2BOOLVEC, ARTIFACT2EVENT, ARTIFACT2TRL, BOOLVEC2ARTIFACT, BOOLVEC2EVENT, BOOLVEC2TRL, EVENT2ARTIFACT, EVENT2BOOLVEC, EVENT2TRL, TRL2ARTIFACT, TRL2BOOLVEC, TRL2EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/artifact2trl.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("artifact2trl", *args, **kwargs) diff --git a/fieldtrip/_artifact_level.py b/fieldtrip/_artifact_level.py new file mode 100644 index 0000000..9358547 --- /dev/null +++ b/fieldtrip/_artifact_level.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _artifact_level(*args, **kwargs): + """ + This function is shared between FT_REJECTVISUAL, FT_BADCHANNEL, + FT_BADSEGMENT, and FT_BADDATA + + Use as + level = artifact_level(dat, metric, mval, sd, connectivity) + where + dat = nchan*ntime, data of a single trial + metric = string, see below in the code + mval = mean value over all trials + sd = standard deviation over all trials + connectivity = nchan*nchan connectivity matrix + and + level = nchan*1 vector with values + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/artifact_level.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("artifact_level", *args, **kwargs) diff --git a/fieldtrip/_atlas_lookup.py b/fieldtrip/_atlas_lookup.py new file mode 100644 index 0000000..851820a --- /dev/null +++ b/fieldtrip/_atlas_lookup.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _atlas_lookup(*args, **kwargs): + """ + ATLAS_LOOKUP determines the anatomical label of a location in the given atlas. + + Use as + label = atlas_lookup(atlas, pos, ...); + + Optional input arguments should come in key-value pairs and can include + 'method' = 'sphere' (default) searches surrounding voxels in a sphere + 'cube' searches surrounding voxels in a cube + 'queryrange' = number, should be 1, 3, 5, 7, 9 or 11 (default = 3) + 'coordsys' = 'mni' or 'tal' (default = []) + + Dependent on the coordinates if the input points and the coordinates of the atlas, + the input positions are transformed between MNI and Talairach-Tournoux coordinates. + See http://www.mrc-cbu.cam.ac.uk/Imaging/Common/mnispace.shtml for more details. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/atlas_lookup.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("atlas_lookup", *args, **kwargs) diff --git a/fieldtrip/_avgref.py b/fieldtrip/_avgref.py new file mode 100644 index 0000000..5695a56 --- /dev/null +++ b/fieldtrip/_avgref.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _avgref(*args, **kwargs): + """ + AVGREF computes the average reference in each column + [data] = avgref(data) + + or it computes the re-referenced data relative to the + average over the selected channels + [data] = avgref(data, sel) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/avgref.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("avgref", *args, **kwargs) diff --git a/fieldtrip/_bandpassfilter.py b/fieldtrip/_bandpassfilter.py new file mode 100644 index 0000000..45aacbe --- /dev/null +++ b/fieldtrip/_bandpassfilter.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _bandpassfilter(*args, **kwargs): + """ + BANDPASSFILTER filters EEG/MEG data in a specified band + + Use as + [filt] = bandpassfilter(dat, Fsample, Fbp, N, type, dir) + where + dat data matrix (Nchans X Ntime) + Fsample sampling frequency in Hz + Fbp frequency band, specified as [Fhp Flp] + N optional filter order, default is 4 (but) or 25 (fir) + type optional filter type, can be + 'but' Butterworth IIR filter (default) + 'fir' FIR filter using MATLAB fir1 function + dir optional filter direction, can be + 'onepass' forward filter only + 'onepass-reverse' reverse filter only, i.e. backward in time + 'twopass' zero-phase forward and reverse filter (default) + + Note that a one- or two-pass filter has consequences for the + strength of the filter, i.e. a two-pass filter with the same filter + order will attenuate the signal twice as strong. + + See also LOWPASSFILTER, HIGHPASSFILTER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/bandpassfilter.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("bandpassfilter", *args, **kwargs) diff --git a/fieldtrip/_bandstopfilter.py b/fieldtrip/_bandstopfilter.py new file mode 100644 index 0000000..1c21928 --- /dev/null +++ b/fieldtrip/_bandstopfilter.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _bandstopfilter(*args, **kwargs): + """ + BANDSTOPFILTER filters EEG/MEG data in a specified band + + Use as + [filt] = bandstopfilter(dat, Fsample, Fbp, N, type, dir) + where + dat data matrix (Nchans X Ntime) + Fsample sampling frequency in Hz + Fbp frequency band, specified as [Fhp Flp] + N optional filter order, default is 4 (but) or 25 (fir) + type optional filter type, can be + 'but' Butterworth IIR filter (default) + 'fir' FIR filter using MATLAB fir1 function + dir optional filter direction, can be + 'onepass' forward filter only + 'onepass-reverse' reverse filter only, i.e. backward in time + 'twopass' zero-phase forward and reverse filter (default) + + Note that a one- or two-pass filter has consequences for the + strength of the filter, i.e. a two-pass filter with the same filter + order will attenuate the signal twice as strong. + + See also LOWPASSFILTER, HIGHPASSFILTER, BANDPASSFILTER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/bandstopfilter.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("bandstopfilter", *args, **kwargs) diff --git a/fieldtrip/_bg_rgba2rgb.py b/fieldtrip/_bg_rgba2rgb.py new file mode 100644 index 0000000..833759e --- /dev/null +++ b/fieldtrip/_bg_rgba2rgb.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def _bg_rgba2rgb(*args, **kwargs): + """ + BG_RGBA2RGB overlays a transparency masked colored image on a colored background, + and represents the result as an RGB matrix. + + Use as: + rgb = bg_rgba2rgb(bg, rgba) + + or + rgb = bg_rgba2rgb(bg, rgba, cmap, clim, alpha, amap, alim); + + When 2 input arguments are supplied: + bg = Nx3 matrix of background rgb-coded color-values, or MxNx3 + rgba = Nx4 matrix of rgb + alpha values, or MxNx4 + + When 7 input arguments are supplied: + bg = Nx3 matrix, Nx1 vector, 1x3 vector, MxN, or MxNx3. + rgba = Nx1 vector with 'functional values', or MxN. + cmap = Mx3 colormap, or MATLAB-supported name of colormap + clim = 1x2 vector denoting the color limits + alpha = Nx1 vector with 'alpha values', or MxN + amap = Mx1 alphamap, or MATLAB -supported name of alphamap ('rampup/down', 'vup/down') + alim = 1x2 vector denoting the opacity limits + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/bg_rgba2rgb.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("bg_rgba2rgb", *args, **kwargs) diff --git a/fieldtrip/_binomialprob.py b/fieldtrip/_binomialprob.py new file mode 100644 index 0000000..3eef52a --- /dev/null +++ b/fieldtrip/_binomialprob.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _binomialprob(*args, **kwargs): + """ + BINOMIALPROB computes the probability of observing a significant effect + in multiple tests. It allows you to test questions like "How likely + is it that there is a significant effect at this time-frequency point + for 8 out of 10 subjects, given that the probability of observing a + significant effect in a given subject is 5%" + + Use as + [bprob] = binomialprob(prob, alpha) + where + prob is a Nvoxel X Nsubject matrix with the single-subject probability + alpha is the probability of observing a significant voxel + + The function also has more advanced functionality, please read the code + if you are interested. + + See also BINOPDF, BINOCDF + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/binomialprob.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("binomialprob", *args, **kwargs) diff --git a/fieldtrip/_bivariate_common.py b/fieldtrip/_bivariate_common.py new file mode 100644 index 0000000..2ccbdd5 --- /dev/null +++ b/fieldtrip/_bivariate_common.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _bivariate_common(*args, **kwargs): + """ + BIVARIATE_COMMON makes a selection for a specific reference channel from a + bivariate (i.e. connectivity) dataset and returns that selection as a univariate + dataset. This is used in singleplot/multiplot/topoplot for both ER and TFR data. + + Use as + [varargout] = bivariate_common(cfg, varargin) + + See also TOPOPLOT_COMMON + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/bivariate_common.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("bivariate_common", *args, **kwargs) diff --git a/fieldtrip/_blc.py b/fieldtrip/_blc.py new file mode 100644 index 0000000..0f7476f --- /dev/null +++ b/fieldtrip/_blc.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _blc(*args, **kwargs): + """ + BLC does a baseline correction using the prestimulus interval of the data + + [data] = baseline(data, interval); + [data] = baseline(data, begin, end); + + If no begin and end are specified, the whole timeinterval is + used for baseline correction. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/blc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("blc", *args, **kwargs) diff --git a/fieldtrip/_blockindx2cmbindx.py b/fieldtrip/_blockindx2cmbindx.py new file mode 100644 index 0000000..e737ef0 --- /dev/null +++ b/fieldtrip/_blockindx2cmbindx.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _blockindx2cmbindx(*args, **kwargs): + """ + This is a helper function that is needed for the bookkeeping of the data, + when requesting (conditional)-blockwise granger causality estimates. Its + single use is in ft_connectivityanalysis, but in order to keep that code + clean, it was decided to put this function as a private function. + + Use as + [cmbindx, n, blocklabel] = blockindx2cmbindx(labelcmb, blockindx, + block) + + The purpose is to generate a cell-array (Nx2, same size as input array + block) of numeric indices, which index into the rows of the Mx2 labelcmb + array, and which can subsequently be used by lower-level functionality + (i.e. blockwise_conditionalgranger) to compute the connectivity metric of + interest. Blockindx is a 1x2 cell-array, which maps the individual + channels in blockindx{1} to an indexed block in blockindx{2}. Block + specifies in each row of cells two ordered lists of blocks that are + needed to compute a conditioned Granger spectrum. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/blockindx2cmbindx.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("blockindx2cmbindx", *args, **kwargs) diff --git a/fieldtrip/_boolvec2artifact.py b/fieldtrip/_boolvec2artifact.py new file mode 100644 index 0000000..821992e --- /dev/null +++ b/fieldtrip/_boolvec2artifact.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def _boolvec2artifact(*args, **kwargs): + """ + BOOLVEC2ARTIFACT converts between two representations of events or trials. + + FieldTrip uses a number of representations for events that are conceptually very similar + event = structure with type, value, sample, duration and offset + trl = Nx3 numerical array with begsample, endsample, offset + trl = table with 3 columns for begsample, endsample, offset + artifact = Nx2 numerical array with begsample, endsample + artifact = table with 2 columns for begsample, endsample + boolvec = 1xNsamples boolean vector with a thresholded TTL/trigger sequence + boolvec = MxNsamples boolean matrix with a thresholded TTL/trigger sequence + + If trl or artifact are represented as a MATLAB table, they can have additional + columns. These additional columns have to be named and are not restricted to + numerical values. + + This function makes an artifact definition from a Boolean vector, or a cell-array + of artifact definitions from a Boolean matrix. + + See also ARTIFACT2BOOLVEC, ARTIFACT2EVENT, ARTIFACT2TRL, BOOLVEC2ARTIFACT, BOOLVEC2EVENT, BOOLVEC2TRL, EVENT2ARTIFACT, EVENT2BOOLVEC, EVENT2TRL, TRL2ARTIFACT, TRL2BOOLVEC, TRL2EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/boolvec2artifact.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("boolvec2artifact", *args, **kwargs) diff --git a/fieldtrip/_boolvec2event.py b/fieldtrip/_boolvec2event.py new file mode 100644 index 0000000..f52f45a --- /dev/null +++ b/fieldtrip/_boolvec2event.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _boolvec2event(*args, **kwargs): + """ + BOOLVEC2EVENT converts between two representations of events or trials. + + FieldTrip uses a number of representations for events that are conceptually very similar + event = structure with type, value, sample, duration and offset + trl = Nx3 numerical array with begsample, endsample, offset + trl = table with 3 columns for begsample, endsample, offset + artifact = Nx2 numerical array with begsample, endsample + artifact = table with 2 columns for begsample, endsample + boolvec = 1xNsamples boolean vector with a thresholded TTL/trigger sequence + boolvec = MxNsamples boolean matrix with a thresholded TTL/trigger sequence + + If trl or artifact are represented as a MATLAB table, they can have additional + columns. These additional columns have to be named and are not restricted to + numerical values. + + See also ARTIFACT2BOOLVEC, ARTIFACT2EVENT, ARTIFACT2TRL, BOOLVEC2ARTIFACT, BOOLVEC2EVENT, BOOLVEC2TRL, EVENT2ARTIFACT, EVENT2BOOLVEC, EVENT2TRL, TRL2ARTIFACT, TRL2BOOLVEC, TRL2EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/boolvec2event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("boolvec2event", *args, **kwargs) diff --git a/fieldtrip/_boolvec2trl.py b/fieldtrip/_boolvec2trl.py new file mode 100644 index 0000000..3bb4231 --- /dev/null +++ b/fieldtrip/_boolvec2trl.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def _boolvec2trl(*args, **kwargs): + """ + BOOLVEC2TRL converts between two representations of events or trials. + + FieldTrip uses a number of representations for events that are conceptually very similar + event = structure with type, value, sample, duration and offset + trl = Nx3 numerical array with begsample, endsample, offset + trl = table with 3 columns for begsample, endsample, offset + artifact = Nx2 numerical array with begsample, endsample + artifact = table with 2 columns for begsample, endsample + boolvec = 1xNsamples boolean vector with a thresholded TTL/trigger sequence + boolvec = MxNsamples boolean matrix with a thresholded TTL/trigger sequence + + If trl or artifact are represented as a MATLAB table, they can have additional + columns. These additional columns have to be named and are not restricted to + numerical values. + + This function makes a trial definition from a Boolean vector, or a cell-array + of trial definitions from a Boolean matrix. + + See also ARTIFACT2BOOLVEC, ARTIFACT2EVENT, ARTIFACT2TRL, BOOLVEC2ARTIFACT, BOOLVEC2EVENT, BOOLVEC2TRL, EVENT2ARTIFACT, EVENT2BOOLVEC, EVENT2TRL, TRL2ARTIFACT, TRL2BOOLVEC, TRL2EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/boolvec2trl.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("boolvec2trl", *args, **kwargs) diff --git a/fieldtrip/_browse_audiovideo.py b/fieldtrip/_browse_audiovideo.py new file mode 100644 index 0000000..35dad38 --- /dev/null +++ b/fieldtrip/_browse_audiovideo.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _browse_audiovideo(*args, **kwargs): + """ + BROWSE_AUDIOVIDEO reads and vizualizes the audio and/or video data + corresponding to the EEG/MEG data segment that is passed into this + function. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/browse_audiovideo.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("browse_audiovideo", *args, **kwargs, nargout=0) diff --git a/fieldtrip/_browse_movieplotER.py b/fieldtrip/_browse_movieplotER.py new file mode 100644 index 0000000..96d4476 --- /dev/null +++ b/fieldtrip/_browse_movieplotER.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _browse_movieplotER(*args, **kwargs): + """ + BROWSE_MOVIEPLOTER is a helper function for FT_DATABROWSER and makes a + movie of the data that was selected. See ft_movieplotER for further details + on the options that can be specified as cfg.selcfg in ft_databrowser. + + See also BROWSE_MOVIEPLOTER, BROWSE_TOPOPLOTER, BROWSE_MULTIPLOTER, BROWSE_TOPOPLOTVAR, BROWSE_SIMPLEFFT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/browse_movieplotER.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("browse_movieplotER", *args, **kwargs, nargout=0) diff --git a/fieldtrip/_browse_multiplotER.py b/fieldtrip/_browse_multiplotER.py new file mode 100644 index 0000000..7e1ebeb --- /dev/null +++ b/fieldtrip/_browse_multiplotER.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _browse_multiplotER(*args, **kwargs): + """ + BROWSE_MULTIPLOTER is a simple helper function for FT_DATABROWSER and shows + an interactive multiplot of the selected data. + + See also BROWSE_MOVIEPLOTER, BROWSE_TOPOPLOTER, BROWSE_MULTIPLOTER, BROWSE_TOPOPLOTVAR, BROWSE_SIMPLEFFT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/browse_multiplotER.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("browse_multiplotER", *args, **kwargs, nargout=0) diff --git a/fieldtrip/_browse_simpleFFT.py b/fieldtrip/_browse_simpleFFT.py new file mode 100644 index 0000000..65bf3b1 --- /dev/null +++ b/fieldtrip/_browse_simpleFFT.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _browse_simpleFFT(*args, **kwargs): + """ + BROWSE_SIMPLEFFT is a helper function for FT_DATABROWSER that shows a + simple FFT of the data. + + Included are a button to switch between log and non-log space, and a + selection button to deselect channels, for the purpose of zooming in on + bad channels. + + See also BROWSE_MOVIEPLOTER, BROWSE_TOPOPLOTER, BROWSE_MULTIPLOTER, BROWSE_TOPOPLOTVAR, BROWSE_SIMPLEFFT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/browse_simpleFFT.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("browse_simpleFFT", *args, **kwargs, nargout=0) diff --git a/fieldtrip/_browse_topoplotER.py b/fieldtrip/_browse_topoplotER.py new file mode 100644 index 0000000..f2d9063 --- /dev/null +++ b/fieldtrip/_browse_topoplotER.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _browse_topoplotER(*args, **kwargs): + """ + BROWSE_TOPOPLOTER is a simple helper function for FT_DATABROWSER and shows + the average topography of the selected data. + + See also BROWSE_MOVIEPLOTER, BROWSE_TOPOPLOTER, BROWSE_MULTIPLOTER, BROWSE_TOPOPLOTVAR, BROWSE_SIMPLEFFT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/browse_topoplotER.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("browse_topoplotER", *args, **kwargs, nargout=0) diff --git a/fieldtrip/_browse_topoplotVAR.py b/fieldtrip/_browse_topoplotVAR.py new file mode 100644 index 0000000..22d78f7 --- /dev/null +++ b/fieldtrip/_browse_topoplotVAR.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _browse_topoplotVAR(*args, **kwargs): + """ + BROWSE_TOPOPLOTVAR is a simple helper function for FT_DATABROWSER that + computes the variance of band-pass filtered data and makes a topographic + plot. It serves to make a quick-and-dirty power topography. + + See also BROWSE_MOVIEPLOTER, BROWSE_TOPOPLOTER, BROWSE_MULTIPLOTER, BROWSE_TOPOPLOTVAR, BROWSE_SIMPLEFFT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/browse_topoplotVAR.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("browse_topoplotVAR", *args, **kwargs, nargout=0) diff --git a/fieldtrip/_bsscca.py b/fieldtrip/_bsscca.py new file mode 100644 index 0000000..ea85ea1 --- /dev/null +++ b/fieldtrip/_bsscca.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _bsscca(*args, **kwargs): + """ + BSSCCA computes the unmixing matrix based on the canonical correlation between + two sets of (possibly multivariate) signals, the sets may contain time shifted copies. + In its default, it implements the algorithm described in [1], computing the + canonical correlation between a set of signals and their lag-one-shifted + copy. Alternatively, if the input contains a reference signal (possibly multivariate), + the canonical correlation between the data in X and the reference signal is computed. + It requires JM's cellfunction toolbox on the MATLAB path: + (github.com/schoffelen/cellfunction.git) + + [1] DeClercq et al 2006, IEEE Biomed Eng 2583. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/bsscca.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("bsscca", *args, **kwargs) diff --git a/fieldtrip/_cellStruct2StructCell.py b/fieldtrip/_cellStruct2StructCell.py new file mode 100644 index 0000000..a678fe3 --- /dev/null +++ b/fieldtrip/_cellStruct2StructCell.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _cellStruct2StructCell(*args, **kwargs): + """ + Converts a cell-array of structure arrays into a structure array + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/cellStruct2StructCell.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("cellStruct2StructCell", *args, **kwargs) diff --git a/fieldtrip/_channelconnectivity.py b/fieldtrip/_channelconnectivity.py new file mode 100644 index 0000000..2646026 --- /dev/null +++ b/fieldtrip/_channelconnectivity.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _channelconnectivity(*args, **kwargs): + """ + CHANNELCONNECTIVIY creates a NxN matrix that describes whether channels + are connected as neighbours + + See also FT_PREPARE_NEIGHBOURS, TRIANGLE2CONNECTIVITY + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/channelconnectivity.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("channelconnectivity", *args, **kwargs) diff --git a/fieldtrip/_channelposition.py b/fieldtrip/_channelposition.py new file mode 100644 index 0000000..74c7aa8 --- /dev/null +++ b/fieldtrip/_channelposition.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _channelposition(*args, **kwargs): + """ + CHANNELPOSITION computes the channel positions and orientations from the + MEG coils, EEG electrodes or NIRS optodes + + Use as + [pos, ori, lab] = channelposition(sens) + where sens is an gradiometer, electrode, or optode array. + + See also FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/channelposition.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("channelposition", *args, **kwargs) diff --git a/fieldtrip/_chanscale_common.py b/fieldtrip/_chanscale_common.py new file mode 100644 index 0000000..59b4826 --- /dev/null +++ b/fieldtrip/_chanscale_common.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def _chanscale_common(*args, **kwargs): + """ + CHANSCALE_COMMON applies a scaling to specific channel types + + Use as + data = chanscale_common(cfg, data) + where the configuration contains + cfg.parameter + + For specific channel groups you can use + cfg.eegscale = number, scaling to apply to the EEG channels prior to display + cfg.eogscale = number, scaling to apply to the EOG channels prior to display + cfg.ecgscale = number, scaling to apply to the ECG channels prior to display + cfg.emgscale = number, scaling to apply to the EMG channels prior to display + cfg.megscale = number, scaling to apply to the MEG channels prior to display + cfg.megrefscale = number, scaling to apply to the MEG reference channels prior to display + cfg.magscale = number, scaling to apply to the MEG magnetometer channels prior to display (in addition to the cfg.megscale factor) + cfg.gradscale = number, scaling to apply to the MEG gradiometer channels prior to display (in addition to the cfg.megscale factor) + cfg.nirsscale = number, scaling to apply to the NIRS channels prior to display + + For individual control off the scaling for all channels you can use + cfg.chanscale = Nx1 vector with scaling factors, one per channel specified in cfg.channel + + For control over specific channels you can use + cfg.mychanscale = number, scaling to apply to the channels specified in cfg.mychan + cfg.mychan = Nx1 cell-array with selection of channels + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/chanscale_common.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("chanscale_common", *args, **kwargs) diff --git a/fieldtrip/_checkchan.py b/fieldtrip/_checkchan.py new file mode 100644 index 0000000..43d6fcc --- /dev/null +++ b/fieldtrip/_checkchan.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _checkchan(*args, **kwargs): + """ + last input is always the required string + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/checkchan.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("checkchan", *args, **kwargs) diff --git a/fieldtrip/_checkfreq.py b/fieldtrip/_checkfreq.py new file mode 100644 index 0000000..0657553 --- /dev/null +++ b/fieldtrip/_checkfreq.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _checkfreq(*args, **kwargs): + """ + last input is always the required string + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/checkfreq.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("checkfreq", *args, **kwargs) diff --git a/fieldtrip/_checkpos.py b/fieldtrip/_checkpos.py new file mode 100644 index 0000000..0fb4adb --- /dev/null +++ b/fieldtrip/_checkpos.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _checkpos(*args, **kwargs): + """ + last input is always the required string + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/checkpos.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("checkpos", *args, **kwargs) diff --git a/fieldtrip/_checktime.py b/fieldtrip/_checktime.py new file mode 100644 index 0000000..6c4e2a1 --- /dev/null +++ b/fieldtrip/_checktime.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _checktime(*args, **kwargs): + """ + last input is always the required string + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/checktime.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("checktime", *args, **kwargs) diff --git a/fieldtrip/_closedf.py b/fieldtrip/_closedf.py new file mode 100644 index 0000000..ccaefe9 --- /dev/null +++ b/fieldtrip/_closedf.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _closedf(*args, **kwargs): + """ + EDF=closedf(EDF) + Opens an EDF File (European Data Format for Biosignals) into MATLAB + About EDF + + EDF struct of EDF-Header of a EDF-File + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/closedf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("closedf", *args, **kwargs) diff --git a/fieldtrip/_clusterstat.py b/fieldtrip/_clusterstat.py new file mode 100644 index 0000000..1486fa5 --- /dev/null +++ b/fieldtrip/_clusterstat.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _clusterstat(*args, **kwargs): + """ + CLUSTERSTAT computers cluster statistic for multidimensional channel-freq-time or + volumetric source data + + See also TFCESTAT, FINDCLUSTER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/clusterstat.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("clusterstat", *args, **kwargs) diff --git a/fieldtrip/_colorspec2rgb.py b/fieldtrip/_colorspec2rgb.py new file mode 100644 index 0000000..0d650ae --- /dev/null +++ b/fieldtrip/_colorspec2rgb.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def _colorspec2rgb(*args, **kwargs): + """ + COLORSPEC2RGB converts the string color specification into the corresponding RGB + triplet(s), unless the string equals 'none', or is a hexadecimal (starting with #). + The optional second input argument determines the number of rows in the output Nx3 matrix, + when applicable. + + If the first input argument equals 'none', or starts with a '#', the output will be + the same as the input argument, and the assumption is that the downstream function + that uses the colorspec knows how to deal with this. Otherwise, a Nx3 matrix or 1x3 + vector will be returned. + + If the input string contains only characters from the following sequence + 'ymcrgbwk', an Mx3 matrix will be returned, where M is the number of characters in + the input string. If a second input argument N is defined (N>M), the output will be + expanded to have N number of rows. + + Otherwise, colorspec2rgb checks whether the input is a valid name for one of the + colors htmlcolors or standardcolors. If this also fails, colorspec2rgb checks + whether the colorspec defines a supported FieldTrip colormap. If this also fails, + an error is thrown. + + See https://nl.mathworks.com/help/matlab/creating_plots/specify-plot-colors.html + and https://nl.mathworks.com/matlabcentral/fileexchange/48155-convert-between-rgb-and-color-names + + See also HTMLCOLORS, STANDARDCOLORS, FT_COLORMAP, COLORMAP, COLORMAPEDITOR, BREWERMAP, MATPLOTLIB, CMOCEAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/colorspec2rgb.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("colorspec2rgb", *args, **kwargs) diff --git a/fieldtrip/_combineClusters.py b/fieldtrip/_combineClusters.py new file mode 100644 index 0000000..fead468 --- /dev/null +++ b/fieldtrip/_combineClusters.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _combineClusters(*args, **kwargs): + """ + COMBINECLUSTERS is a helper function for FINDCLUSTER. It searches for + adjacent clusters in neighbouring channels and combines them. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/combineClusters.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("combineClusters", *args, **kwargs) diff --git a/fieldtrip/_combine_transform.py b/fieldtrip/_combine_transform.py new file mode 100644 index 0000000..5b10fcd --- /dev/null +++ b/fieldtrip/_combine_transform.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _combine_transform(*args, **kwargs): + """ + COMBINE_TRANSFORM combines the 4x4 homogenous transformation + matrices of the rotation, the scaling and the translation and + combines them in the desired order. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/combine_transform.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("combine_transform", *args, **kwargs) diff --git a/fieldtrip/_comp2timelock.py b/fieldtrip/_comp2timelock.py new file mode 100644 index 0000000..18cf9c2 --- /dev/null +++ b/fieldtrip/_comp2timelock.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _comp2timelock(*args, **kwargs): + """ + COMP2TIMELOCK transform the independent components into something + on which the timelocked source reconstruction methods can + perform their trick. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/comp2timelock.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("comp2timelock", *args, **kwargs) diff --git a/fieldtrip/_constructplanargrad.py b/fieldtrip/_constructplanargrad.py new file mode 100644 index 0000000..897771a --- /dev/null +++ b/fieldtrip/_constructplanargrad.py @@ -0,0 +1,61 @@ +from fieldtrip._runtime import Runtime + + +def _constructplanargrad(*args, **kwargs): + """ + CONSTRUCTPLANARGRAD constructs a planar gradiometer array from an axial gradiometer + definition. This can be used to compute the planar field gradient for a known + (estimated) source configuration. + + Use as + [grad_planar] = constructplanargrad(cfg, grad_axial) + + Where cfg contains the following configuration details + cfg.baseline_axial = number (default is 5) + cfg.baseline_planar = number (default is 0.5) + cfg.planaraxial = 'no' or 'yes' (default) + + The option planaraxial='yes' specifies that the planar gradiometers + should consist of axial gradiometers, to make them comparable with + Ole Jensens planar gradient computation. If planaraxial='no', the + planar gradiometers will be more or less similar to the Neuromag + system. + + The input grad can be a CTF type axial gradiometer definition, but + just as well be a magnetometer definition. This function only assumes + that + grad.coilpos + grad.coilori + grad.label + exist and that the first Nlabel channels in pnt and ori should be + used to compute the position of the coils in the planar gradiometer + channels. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/constructplanargrad.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("constructplanargrad", *args, **kwargs) diff --git a/fieldtrip/_continuous_ns.py b/fieldtrip/_continuous_ns.py new file mode 100644 index 0000000..0a1a918 --- /dev/null +++ b/fieldtrip/_continuous_ns.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _continuous_ns(*args, **kwargs): + """ + CONTINUOUS_NS created a trial definition from a Neuroscan *.cnt file + which subsequently can be used in the EEG/MEG framework + + Use as + [trl] = continuous_ns(cfg) + + where the configuration should contain + cfg.trialdef.trigger = number or list with triggers + cfg.trialdef.prestim = pre-stimulus in seconds + cfg.trialdef.poststim = post-stimulus in seconds + + See also SINGLETRIAL_NS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/continuous_ns.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("continuous_ns", *args, **kwargs) diff --git a/fieldtrip/_coordsys2label.py b/fieldtrip/_coordsys2label.py new file mode 100644 index 0000000..14f44c6 --- /dev/null +++ b/fieldtrip/_coordsys2label.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _coordsys2label(*args, **kwargs): + """ + COORDSYS2LABEL returns the labels for the three axes, given the symbolic + string representation of the coordinate system. + + Use as + [labelx, labely, labelz] = coordsys2label(coordsys, format, both) + + The scalar argument 'format' results in return values like these + 0) 'R' + 1) 'right' + 2) 'the right' + 3) '+X (right)' + + The boolean argument 'both' results in return values like these + 0) 'right' i.e. only the direction that it is pointing to + 1) {'left' 'right'} i.e. both the directions that it is pointing from and to + + See also FT_DETERMINE_COORDSYS, FT_PLOT_AXES, FT_HEADCOORDINATES, SETVIEWPOINT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/coordsys2label.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("coordsys2label", *args, **kwargs) diff --git a/fieldtrip/_copy_brainvision_files.py b/fieldtrip/_copy_brainvision_files.py new file mode 100644 index 0000000..680d65f --- /dev/null +++ b/fieldtrip/_copy_brainvision_files.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _copy_brainvision_files(*args, **kwargs): + """ + COPY_BRAINVISION_FILES copies a BrainVision EEG dataset, which consists of a vhdr + header file, vmrk marker file and a data file with the extension dat, eeg or seg. + + Use as + copy_brainvision_files(oldname, newname, deleteflag) + + Both the old and the new filename should be strings corresponding to the header + file, i.e. including the vhdr extension. + + The third "deleteflag" argument is optional, it should be a boolean + that specifies whether the original files should be deleted after + copying or not (default = false). + + An earlier version of this function can be found on + - https://gist.github.com/robertoostenveld/e31637a777c514bf1e86272e1092316e + - https://gist.github.com/CPernet/e037df46e064ca83a49fb4c595d4566a + + See also COPY_CTF_FILES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/copy_brainvision_files.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("copy_brainvision_files", *args, **kwargs, nargout=0) diff --git a/fieldtrip/_copy_ctf_files.py b/fieldtrip/_copy_ctf_files.py new file mode 100644 index 0000000..a0768af --- /dev/null +++ b/fieldtrip/_copy_ctf_files.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _copy_ctf_files(*args, **kwargs): + """ + COPY_CTF_FILES copies a CTF dataset with all files and directories to a new CTF + dataset with another name. + + Use as + copy_brainvision_files(oldname, newname, deleteflag) + + Both the old and new name should refer to the CTF dataset directory, including + the .ds extension. + + The third "deleteflag" argument is optional, it should be a boolean + that specifies whether the original files should be deleted after + copying or not (default = false). + + See also COPY_BRAINVISION_FILES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/copy_ctf_files.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("copy_ctf_files", *args, **kwargs, nargout=0) diff --git a/fieldtrip/_cornerpoints.py b/fieldtrip/_cornerpoints.py new file mode 100644 index 0000000..fe0d8ed --- /dev/null +++ b/fieldtrip/_cornerpoints.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _cornerpoints(*args, **kwargs): + """ + CORNERPOINTS returns the eight corner points of an anatomical volume + in voxel and in head coordinates + + Use as + [voxel, head] = cornerpoints(dim, transform) + which will return two 8x3 matrices. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/cornerpoints.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("cornerpoints", *args, **kwargs) diff --git a/fieldtrip/_csp.py b/fieldtrip/_csp.py new file mode 100644 index 0000000..12b9875 --- /dev/null +++ b/fieldtrip/_csp.py @@ -0,0 +1,68 @@ +from fieldtrip._runtime import Runtime + + +def _csp(*args, **kwargs): + """ + CSP calculates the common spatial pattern (CSP) projection. + + Use as: + [W] = csp(C1, C2, m) + + This function implements the intents of the CSP algorithm described in [1]. + Specifically, CSP finds m spatial projections that maximize the variance (or + band power) in one condition (described by the [p x p] channel-covariance + matrix C1), and simultaneously minimizes the variance in the other (C2): + + W C1 W' = D + + and + + W (C1 + C2) W' = I, + + Where D is a diagonal matrix with decreasing values on it's diagonal, and I + is the identity matrix of matching shape. + The resulting [m x p] matrix can be used to project a zero-centered [p x n] + trial matrix X: + + S = W X. + + + Although the CSP is the de facto standard method for feature extraction for + motor imagery induced event-related desynchronization, it is not strictly + necessary [2]. + + [1] Zoltan J. Koles. The quantitative extraction and topographic mapping of + the abnormal components in the clinical EEG. Electroencephalography and + Clinical Neurophysiology, 79(6):440--447, December 1991. + + [2] Jason Farquhar. A linear feature space for simultaneous learning of + spatio-spectral filters in BCI. Neural Networks, 22:1278--1285, 2009. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/csp.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("csp", *args, **kwargs) diff --git a/fieldtrip/_ctf2grad.py b/fieldtrip/_ctf2grad.py new file mode 100644 index 0000000..f69098a --- /dev/null +++ b/fieldtrip/_ctf2grad.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _ctf2grad(*args, **kwargs): + """ + CTF2GRAD converts a CTF header to a gradiometer structure that can be understood by + the FieldTrip low-level forward and inverse routines. The fieldtrip/fileio + read_header function can use three different implementations of the low-level code + for CTF data. Each of these implementations is dealt with here. + + Use as + [grad, elec] = ctf2grad(hdr, dewar, coilaccuracy) + where + dewar = boolean, whether to return it in dewar or head coordinates (default is head coordinates) + coilaccuracy = empty or a number (default is empty) + coildeffile = empty or a filename of a valid coil_def.dat file + + See also BTI2GRAD, FIF2GRAD, MNE2GRAD, ITAB2GRAD, YOKOGAWA2GRAD, + FT_READ_SENS, FT_READ_HEADER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/ctf2grad.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ctf2grad", *args, **kwargs) diff --git a/fieldtrip/_defaultId.py b/fieldtrip/_defaultId.py new file mode 100644 index 0000000..4a9197a --- /dev/null +++ b/fieldtrip/_defaultId.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _defaultId(*args, **kwargs): + """ + DEFAULTID returns a string that can serve as warning or error identifier, + for example 'FieldTip:ft_read_header:line345'. + + See also WARNING, ERROR, FT_NOTICE, FT_INFO, FT_DEBUG + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/defaultId.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("defaultId", *args, **kwargs) diff --git a/fieldtrip/_denoise_artifact.py b/fieldtrip/_denoise_artifact.py new file mode 100644 index 0000000..7625fbc --- /dev/null +++ b/fieldtrip/_denoise_artifact.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _denoise_artifact(*args, **kwargs): + """ + DENOISE_ARTIFACT can be used for denoising source separation (DSS) + during component analysis + + See also COMPONENTANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/denoise_artifact.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("denoise_artifact", *args, **kwargs) diff --git a/fieldtrip/_det2x2.py b/fieldtrip/_det2x2.py new file mode 100644 index 0000000..9da538e --- /dev/null +++ b/fieldtrip/_det2x2.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _det2x2(*args, **kwargs): + """ + DET2X2 computes determinant of matrix x, using explicit analytic definition + if size(x,1) < 4, otherwise use MATLAB det-function + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/det2x2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("det2x2", *args, **kwargs) diff --git a/fieldtrip/_det3x3.py b/fieldtrip/_det3x3.py new file mode 100644 index 0000000..12329fd --- /dev/null +++ b/fieldtrip/_det3x3.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _det3x3(*args, **kwargs): + """ + DET3X3 computes determinant of matrix x, using explicit analytic definition + if size(x) = [3 3 K M] + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/det3x3.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("det3x3", *args, **kwargs) diff --git a/fieldtrip/_determine_griddim.py b/fieldtrip/_determine_griddim.py new file mode 100644 index 0000000..3de8304 --- /dev/null +++ b/fieldtrip/_determine_griddim.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _determine_griddim(*args, **kwargs): + """ + DETERMINE_GRIDDIM uses the labels and positions of electrodes in elec to + determine the dimensions of each set of electrodes (i.e., electrodes with + the same string, but different numbers) + + use as: + GridDim = determine_griddim(elec) + where elec is a structure that contains an elecpos field and a label field + and GridDim(1) = number of rows and GridDim(2) = number of columns + + See also FT_ELECTRODEREALIGN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/determine_griddim.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("determine_griddim", *args, **kwargs) diff --git a/fieldtrip/_determine_segmentationstyle.py b/fieldtrip/_determine_segmentationstyle.py new file mode 100644 index 0000000..0260330 --- /dev/null +++ b/fieldtrip/_determine_segmentationstyle.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _determine_segmentationstyle(*args, **kwargs): + """ + DETERMINE_SEGMENTATIONSTYLE is a helper function that determines the type of segmentation + contained in each of the fields. It is used by FT_DATATYPE_SEGMENTATION and + FT_DATATYPE_PARCELLATION. + + See also FIXSEGMENTATION, CONVERT_SEGMENTATIONSTYLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/determine_segmentationstyle.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("determine_segmentationstyle", *args, **kwargs) diff --git a/fieldtrip/_dftfilter.py b/fieldtrip/_dftfilter.py new file mode 100644 index 0000000..18062f9 --- /dev/null +++ b/fieldtrip/_dftfilter.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _dftfilter(*args, **kwargs): + """ + DFTFILTER line noise reduction filter for EEG/MEG data + + [filt] = dftfilter(dat, Fsample, Fline) + + where + dat data matrix (Nchans X Ntime) + Fsample sampling frequency in Hz + Fline line noise frequency + + The line frequency should be specified as a single number. + If omitted, a European default of 50Hz will be assumed. + + Preferaby the data should have a length that is a multiple + of the period of oscillation of the line noise (20ms for + 50Hz noise). + + See also NOTCHFILTER, + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/dftfilter.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("dftfilter", *args, **kwargs) diff --git a/fieldtrip/_dimassign.py b/fieldtrip/_dimassign.py new file mode 100644 index 0000000..33c9fd5 --- /dev/null +++ b/fieldtrip/_dimassign.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _dimassign(*args, **kwargs): + """ + function M=dimassign(A,dim,idx,B); + + The purpose of the function is shown by the following example: + If A and B are multidimensional matrixes, + A=dimassign(A,4,23,B); is the same as A(:,:,:,23,:,:,...)=B; + The difference is that the dimension is selected by a scalar, not by + the place between the brackets. + A(2,4,3)=B; will then be written as: A=dimassign(A,[1,2,3],[2,4,3],B); + In this last case B, of cource, must be a scalar. + A([1,2],:,3)=B; can be written as: A=dimassign(A,[1,3],{[1,2],3},B); + Of cource, again, the dimensions of B must fit! + (size(B)==size(A([1,2],:,3) in this particular case) + + See also the function DIMINDEX + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/dimassign.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("dimassign", *args, **kwargs) diff --git a/fieldtrip/_dimindex.py b/fieldtrip/_dimindex.py new file mode 100644 index 0000000..f37c18d --- /dev/null +++ b/fieldtrip/_dimindex.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _dimindex(*args, **kwargs): + """ + DIMINDEX makes a selection from a multi-dimensional array where the dimension is + selected by a scalar, not by the place between the brackets. + + Use as + M = dimindex(A,dim,idx) + + The purpose of the function is shown by the following example: + + A(:,:,:,23,:,:,...) is the same as dimindex(A,4,23) + A(2,4,3) is the same as dimindex(A,[1,2,3],[2,4,3]) + A(4,:,[5:10]) is the same as dimindex(A,[1,3],{4,[5:10]}) + + See also the function DIMASSIGN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/dimindex.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("dimindex", *args, **kwargs) diff --git a/fieldtrip/_dimlength.py b/fieldtrip/_dimlength.py new file mode 100644 index 0000000..5d4ab8f --- /dev/null +++ b/fieldtrip/_dimlength.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _dimlength(*args, **kwargs): + """ + DIMLENGTH(DATA, SELDIM, FLD) is a helper function to obtain n, the number + of elements along dimension seldim from the appropriate field from the + input data containing functional data. + + Use als + [n, fn] = dimlength(data, seldim, fld) + + It can be called with one input argument only, in which case it will + output two cell arrays containing the size of the functional fields, + based on the XXXdimord, and the corresponding XXXdimord fields. + + When the data contains a single dimord field (everything except source + data), the cell-arrays in the output only contain one element. + + See also FIXSOURCE, CREATEDIMORD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/dimlength.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("dimlength", *args, **kwargs) diff --git a/fieldtrip/_dimnum.py b/fieldtrip/_dimnum.py new file mode 100644 index 0000000..e6df958 --- /dev/null +++ b/fieldtrip/_dimnum.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _dimnum(*args, **kwargs): + """ + This function returns the number of the given dimension 'dim' in the dimord string. + + Syntax: [num,dims]=dimnum(dimord, dim) + + e.g. when dimord='rpt_chancmb_freq_time' and dim='time', dimnum returns num=4 + and dims contains {'rpt','chancmb','freq','tim'}. + e.g. when dimord='rpt_chancmb_freq_time' and dim='chancmb', dimnum returns num=2 + and dims again contains {'rpt','chancmb','freq','tim'}. + + For the known dimension types dim can also be 'time' or 'frequency'. + The known types are: + tim: 'time' + freq: 'frq', 'frequency' + chancmb: 'sgncmb', 'channel', 'signal combination', 'channels' + rpt: 'trial','trials' + + When dim is not found in dimord, an empty matrix is returned, but + dims then still contains all dims in dimord. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/dimnum.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("dimnum", *args, **kwargs) diff --git a/fieldtrip/_dist.py b/fieldtrip/_dist.py new file mode 100644 index 0000000..a00eb5a --- /dev/null +++ b/fieldtrip/_dist.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _dist(*args, **kwargs): + """ + DIST computes the Euclidian distance between the columns of the input matrix or + between the rows and columns of two input matrices. + + This function serves as a drop-in replacement for the dist function in the Neural + Networks toolbox. + + Use as + [d] = dist(x') + where x is for example an Nx3 matrix with vertices in 3D space, or as + [d] = dist(x, y') + where x and y are Nx3 and Mx3 matrices with vertices in 3D space + + See also DSEARCHN, KNNSEARCH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/dist.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("dist", *args, **kwargs) diff --git a/fieldtrip/_elec1020_follow.py b/fieldtrip/_elec1020_follow.py new file mode 100644 index 0000000..19c2173 --- /dev/null +++ b/fieldtrip/_elec1020_follow.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _elec1020_follow(*args, **kwargs): + """ + ELEC1020_FOLLOW + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/elec1020_follow.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("elec1020_follow", *args, **kwargs) diff --git a/fieldtrip/_elec1020_fraction.py b/fieldtrip/_elec1020_fraction.py new file mode 100644 index 0000000..7a3e515 --- /dev/null +++ b/fieldtrip/_elec1020_fraction.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _elec1020_fraction(*args, **kwargs): + """ + ELEC1020_FRACTION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/elec1020_fraction.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("elec1020_fraction", *args, **kwargs) diff --git a/fieldtrip/_elec1020_intersect.py b/fieldtrip/_elec1020_intersect.py new file mode 100644 index 0000000..b2ec17c --- /dev/null +++ b/fieldtrip/_elec1020_intersect.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _elec1020_intersect(*args, **kwargs): + """ + ELEC1020_INTERSECT determines the intersection of a mesh with a plane + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/elec1020_intersect.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("elec1020_intersect", *args, **kwargs) diff --git a/fieldtrip/_elec1020_locate.py b/fieldtrip/_elec1020_locate.py new file mode 100644 index 0000000..ec120fd --- /dev/null +++ b/fieldtrip/_elec1020_locate.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _elec1020_locate(*args, **kwargs): + """ + ELEC1020_LOCATE determines 10-20 (20%, 10% and 5%) electrode positions + on a scalp surface that is described by its surface triangulation + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/elec1020_locate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("elec1020_locate", *args, **kwargs) diff --git a/fieldtrip/_elproj.py b/fieldtrip/_elproj.py new file mode 100644 index 0000000..39874e8 --- /dev/null +++ b/fieldtrip/_elproj.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def _elproj(*args, **kwargs): + """ + ELPROJ makes a azimuthal projection of a 3D electrode cloud on a plane tangent to + the sphere fitted through the electrodes. The projection is along the z-axis. + + Use as + proj = elproj([x, y, z], 'method'); + + Method should be one of these: + 'gnomic' + 'stereographic' + 'orthographic' + 'inverse' + 'polar' + + Imagine a plane being placed against (tangent to) a globe. If + a light source inside the globe projects the graticule onto + the plane the result would be a planar, or azimuthal, map + projection. If the imaginary light is inside the globe a Gnomonic + projection results, if the light is antipodal a Sterographic, + and if at infinity, an Orthographic. + + The default projection is a BESA-like polar projection. + An inverse projection is the opposite of the default polar projection. + + See also PROJECTTRI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/elproj.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("elproj", *args, **kwargs) diff --git a/fieldtrip/_estimate_fwhm1.py b/fieldtrip/_estimate_fwhm1.py new file mode 100644 index 0000000..77f9486 --- /dev/null +++ b/fieldtrip/_estimate_fwhm1.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _estimate_fwhm1(*args, **kwargs): + """ + ESTIMATE_FWHM1(SOURCE, REMOVECENTER) + + This function computes the fwhm of the spatial filters, according to + Barnes et al 2003. the input source-structure should contain the filters + The fwhm-volume is appended to the output source-structure. It is assumed + that the dipole positions are defined on a regularly spaced 3D grid. + + This function can only deal with scalar filters. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/estimate_fwhm1.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("estimate_fwhm1", *args, **kwargs) diff --git a/fieldtrip/_estimate_fwhm2.py b/fieldtrip/_estimate_fwhm2.py new file mode 100644 index 0000000..a4ae07f --- /dev/null +++ b/fieldtrip/_estimate_fwhm2.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _estimate_fwhm2(*args, **kwargs): + """ + ESTIMATE_FWHM2(SOURCE, MAXDIST) + + This function computes the Gaussian fwhm of the spatial filters, according to + least-squares Gaussian fit including data points up until MAXDIST from the + locations of interest. + + This function can only deal with scalar filters. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/estimate_fwhm2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("estimate_fwhm2", *args, **kwargs) diff --git a/fieldtrip/_event2artifact.py b/fieldtrip/_event2artifact.py new file mode 100644 index 0000000..7f60a1e --- /dev/null +++ b/fieldtrip/_event2artifact.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _event2artifact(*args, **kwargs): + """ + EVENT2ARTIFACT converts between two representations of events or trials. + + FieldTrip uses a number of representations for events that are conceptually very similar + event = structure with type, value, sample, duration and offset + trl = Nx3 numerical array with begsample, endsample, offset + trl = table with 3 columns for begsample, endsample, offset + artifact = Nx2 numerical array with begsample, endsample + artifact = table with 2 columns for begsample, endsample + boolvec = 1xNsamples boolean vector with a thresholded TTL/trigger sequence + boolvec = MxNsamples boolean matrix with a thresholded TTL/trigger sequence + + If trl or artifact are represented as a MATLAB table, they can have additional + columns. These additional columns have to be named and are not restricted to + numerical values. + + See also ARTIFACT2BOOLVEC, ARTIFACT2EVENT, ARTIFACT2TRL, BOOLVEC2ARTIFACT, BOOLVEC2EVENT, BOOLVEC2TRL, EVENT2ARTIFACT, EVENT2BOOLVEC, EVENT2TRL, TRL2ARTIFACT, TRL2BOOLVEC, TRL2EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/event2artifact.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("event2artifact", *args, **kwargs) diff --git a/fieldtrip/_event2boolvec.py b/fieldtrip/_event2boolvec.py new file mode 100644 index 0000000..760e406 --- /dev/null +++ b/fieldtrip/_event2boolvec.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _event2boolvec(*args, **kwargs): + """ + EVENT2BOOLVEC converts between two representations of events or trials. + + FieldTrip uses a number of representations for events that are conceptually very similar + event = structure with type, value, sample, duration and offset + trl = Nx3 numerical array with begsample, endsample, offset + trl = table with 3 columns for begsample, endsample, offset + artifact = Nx2 numerical array with begsample, endsample + artifact = table with 2 columns for begsample, endsample + boolvec = 1xNsamples boolean vector with a thresholded TTL/trigger sequence + boolvec = MxNsamples boolean matrix with a thresholded TTL/trigger sequence + + If trl or artifact are represented as a MATLAB table, they can have additional + columns. These additional columns have to be named and are not restricted to + numerical values. + + See also ARTIFACT2BOOLVEC, ARTIFACT2EVENT, ARTIFACT2TRL, BOOLVEC2ARTIFACT, BOOLVEC2EVENT, BOOLVEC2TRL, EVENT2ARTIFACT, EVENT2BOOLVEC, EVENT2TRL, TRL2ARTIFACT, TRL2BOOLVEC, TRL2EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/event2boolvec.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("event2boolvec", *args, **kwargs) diff --git a/fieldtrip/_event2trl.py b/fieldtrip/_event2trl.py new file mode 100644 index 0000000..be08405 --- /dev/null +++ b/fieldtrip/_event2trl.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _event2trl(*args, **kwargs): + """ + EVENT2TRL converts between two representations of events or trials. + + FieldTrip uses a number of representations for events that are conceptually very similar + event = structure with type, value, sample, duration and offset + trl = Nx3 numerical array with begsample, endsample, offset + trl = table with 3 columns for begsample, endsample, offset + artifact = Nx2 numerical array with begsample, endsample + artifact = table with 2 columns for begsample, endsample + boolvec = 1xNsamples boolean vector with a thresholded TTL/trigger sequence + boolvec = MxNsamples boolean matrix with a thresholded TTL/trigger sequence + + If trl or artifact are represented as a MATLAB table, they can have additional + columns. These additional columns have to be named and are not restricted to + numerical values. + + See also ARTIFACT2BOOLVEC, ARTIFACT2EVENT, ARTIFACT2TRL, BOOLVEC2ARTIFACT, BOOLVEC2EVENT, BOOLVEC2TRL, EVENT2ARTIFACT, EVENT2BOOLVEC, EVENT2TRL, TRL2ARTIFACT, TRL2BOOLVEC, TRL2EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/event2trl.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("event2trl", *args, **kwargs) diff --git a/fieldtrip/_expand_orthogonal.py b/fieldtrip/_expand_orthogonal.py new file mode 100644 index 0000000..9c856f0 --- /dev/null +++ b/fieldtrip/_expand_orthogonal.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def _expand_orthogonal(*args, **kwargs): + """ + EXPAND_ORTHOGONAL determines an orthogonal expansion of the orthogonal basis + for the subspace spanned by the columns of the matrix input argument, which + must have more rows than columns, using either singular value decomposition + (svd) or the Gram-Schmidt method, see e.g., [1], (reference in code header). + + Usage: + B = expand_orthogonal(A); + B = expand_orthogonal(A,flg); + B = expand_orthogonal(A,flg,method); + + Input (Required): + A is a [nrows by ncols] matrix of (finite) numbers with nrows>=ncols + + Input (Optional): + flg is a number specifying whether the output should contain the columns + of A (flg = 0; default) normalized to unit length, or the orthogonal basis + for the subspace spanned by the columns of A (flg = 1) + + method = 'svd' (default) or 'gram-schmidt' specifies which method to use + for generating the orthogonal expansion of the input matrix + + Output: + B is a [nrows by nrows] matrix whose first ncols columns reflect either the + (normalized) columns of the intput or an orthonormal basis for the subspace + spanned by A; and the remaining (nrows-ncols) columns contain the orthogonal + expansions of the subspace spanned by A. + + See also: SVD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/expand_orthogonal.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("expand_orthogonal", *args, **kwargs) diff --git a/fieldtrip/_fdr.py b/fieldtrip/_fdr.py new file mode 100644 index 0000000..8d7b406 --- /dev/null +++ b/fieldtrip/_fdr.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _fdr(*args, **kwargs): + """ + FDR false discovery rate + + Use as + h = fdr(p, q) + + The input argument p is a vector or matrix with (uncorrected) p-values, the input argument + q is a scalar that reflects the critical alpha-threshold for the inferential decision. The + output argument h is a boolean matrix (same size as p) denoting for each sample whether + the null hypothesis can be rejected. + + This implements + Genovese CR, Lazar NA, Nichols T. + Thresholding of statistical maps in functional neuroimaging using the false discovery rate. + Neuroimage. 2002 Apr;15(4):870-8. + + There are two types of FDR correction (Benjamini-Hochberg & Benjamini-Yekutieli), of + which the second is currently implemented. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/fdr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fdr", *args, **kwargs) diff --git a/fieldtrip/_fieldtrip/__init__.py b/fieldtrip/_fieldtrip/__init__.py new file mode 100644 index 0000000..326dff2 --- /dev/null +++ b/fieldtrip/_fieldtrip/__init__.py @@ -0,0 +1,8 @@ +__all__ = [ + "endpoint", + "mpython_endpoint", +] + +from ._endpoint import endpoint + +mpython_endpoint = endpoint diff --git a/fieldtrip/_fieldtrip/_ctf/__init__.py b/fieldtrip/_fieldtrip/_ctf/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/fieldtrip/_fieldtrip/_endpoint.py b/fieldtrip/_fieldtrip/_endpoint.py new file mode 100644 index 0000000..cc05db4 --- /dev/null +++ b/fieldtrip/_fieldtrip/_endpoint.py @@ -0,0 +1,27 @@ +class _Endpoint: + # Lazy mpython endpoint. + # This is so the matlab runtime is only intiialized if the endpoint + # is used. This allows us to implement a `spm_standalone` entrypoint + # that calls mwpython2 if needed. + + def __init__(self): + self._deployed = None + + def _init_endpoint(self): + import matlab_runtime + from ._version import __matlab_release__ + from . import _ctf + + try: + matlab_runtime.init(__matlab_release__, install_if_missing=True) + except ValueError: + pass + self._deployed = matlab_runtime.import_deployed(_ctf) + + def __call__(self, *args, **kwargs): + if self._deployed is None: + self._init_endpoint() + return self._deployed.mpython_endpoint(*args, **kwargs) + + +endpoint = _Endpoint() diff --git a/fieldtrip/_fieldtrip/_version.py b/fieldtrip/_fieldtrip/_version.py new file mode 100644 index 0000000..57dbf54 --- /dev/null +++ b/fieldtrip/_fieldtrip/_version.py @@ -0,0 +1,2 @@ +__version__ = "20241219" +__matlab_release__ = "R2025b" diff --git a/fieldtrip/_find_innermost_boundary.py b/fieldtrip/_find_innermost_boundary.py new file mode 100644 index 0000000..de23d61 --- /dev/null +++ b/fieldtrip/_find_innermost_boundary.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _find_innermost_boundary(*args, **kwargs): + """ + FIND_INNERMOST_BOUNDARY locates innermost compartment of a BEM model + by looking at the containment of the triangular meshes describing + the surface boundaries + + [innermost] = find_innermost_boundary(bnd) + + with the boundaries described by a struct-array bnd with + bnd(i).pnt vertices of boundary i (matrix of size Nx3) + bnd(i).tri triangles of boundary i (matrix of size Mx3) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/find_innermost_boundary.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("find_innermost_boundary", *args, **kwargs) diff --git a/fieldtrip/_find_mesh_edge.py b/fieldtrip/_find_mesh_edge.py new file mode 100644 index 0000000..56226aa --- /dev/null +++ b/fieldtrip/_find_mesh_edge.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _find_mesh_edge(*args, **kwargs): + """ + FIND_MESH_EDGE returns the edge of a triangulated mesh + + [pnt, line] = find_mesh_edge(pnt, tri), where + + pnt contains the vertex locations and + line contains the indices of the linepieces connecting the vertices + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/find_mesh_edge.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("find_mesh_edge", *args, **kwargs) diff --git a/fieldtrip/_find_nearest.py b/fieldtrip/_find_nearest.py new file mode 100644 index 0000000..b653b7d --- /dev/null +++ b/fieldtrip/_find_nearest.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _find_nearest(*args, **kwargs): + """ + FIND_NEAREST finds the nearest vertex in a cloud of points and + does this efficiently for many target vertices at once (by means + of partitioning). + + Use as + [nearest, distance] = find_nearest(pnt1, pnt2, npart) + + See also KNNSEARCH, DIST, DSEARCHN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/find_nearest.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("find_nearest", *args, **kwargs) diff --git a/fieldtrip/_find_outermost_boundary.py b/fieldtrip/_find_outermost_boundary.py new file mode 100644 index 0000000..40f3509 --- /dev/null +++ b/fieldtrip/_find_outermost_boundary.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _find_outermost_boundary(*args, **kwargs): + """ + FIND_OUTERMOST_BOUNDARY locates outermost compartment of a BEM model + by looking at the containment of the triangular meshes describing + the surface boundaries + + [outermost] = find_innermost_boundary(bnd) + + with the boundaries described by a struct-array bnd with + bnd(i).pnt vertices of boundary i (matrix of size Nx3) + bnd(i).tri triangles of boundary i (matrix of size Mx3) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/find_outermost_boundary.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("find_outermost_boundary", *args, **kwargs) diff --git a/fieldtrip/_find_triangle_neighbours.py b/fieldtrip/_find_triangle_neighbours.py new file mode 100644 index 0000000..a7c5660 --- /dev/null +++ b/fieldtrip/_find_triangle_neighbours.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _find_triangle_neighbours(*args, **kwargs): + """ + FIND_TRIANGLE_NEIGHBOURS determines the three neighbours for each triangle + in a mesh. It returns NaN's if the triangle does not have a neighbour on + that particular side. + + [nb] = find_triangle_neighbours(pnt, tri) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/find_triangle_neighbours.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("find_triangle_neighbours", *args, **kwargs) diff --git a/fieldtrip/_find_vertex_neighbours.py b/fieldtrip/_find_vertex_neighbours.py new file mode 100644 index 0000000..86d1638 --- /dev/null +++ b/fieldtrip/_find_vertex_neighbours.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _find_vertex_neighbours(*args, **kwargs): + """ + FIND_VERTEX_NEIGHBOURS determines the neighbours of a specified vertex + in a mesh. + + [nb] = find_vertex_neighbours(pnt, tri, indx) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/find_vertex_neighbours.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("find_vertex_neighbours", *args, **kwargs) diff --git a/fieldtrip/_findcluster.py b/fieldtrip/_findcluster.py new file mode 100644 index 0000000..4cd263f --- /dev/null +++ b/fieldtrip/_findcluster.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def _findcluster(*args, **kwargs): + """ + FINDCLUSTER returns all connected clusters for a three-dimensional six-connected + neighborhood + + Use as + [cluster, num] = findcluster(onoff, spatdimneighbstructmat, minnbchan) + or ar + [cluster, num] = findcluster(onoff, spatdimneighbstructmat, spatdimneighbselmat, minnbchan) + where + onoff = is a 3D boolean matrix with size N1xN2xN3 + spatdimneighbstructmat = defines the neighbouring channels/combinations, see below + minnbchan = the minimum number of neighbouring channels/combinations + spatdimneighbselmat = is a special neighbourhood matrix that is used for selecting + channels/combinations on the basis of the minnbchan criterium + + The neighbourhood structure for the first dimension is specified using + spatdimneighbstructmat, which is a 2D (N1xN1) matrix. Each row and each column + corresponds to a channel (combination) along the first dimension and along that + row/column, elements with "1" define the neighbouring channel(s) (combinations). + The first dimension of onoff should correspond to the channel(s) (combinations). + + See also SPM_BWLABEL, BWLABEL, BWLABELN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/findcluster.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("findcluster", *args, **kwargs) diff --git a/fieldtrip/_fitsphere.py b/fieldtrip/_fitsphere.py new file mode 100644 index 0000000..f099864 --- /dev/null +++ b/fieldtrip/_fitsphere.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _fitsphere(*args, **kwargs): + """ + FITSPHERE fits the centre and radius of a sphere to a set of points + using Taubin's method. + + Use as + [center,radius] = fitsphere(pnt) + where + pnt = Nx3 matrix with the Cartesian coordinates of the surface points + and + center = the center of the fitted sphere + radius = the radius of the fitted sphere + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/fitsphere.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fitsphere", *args, **kwargs) diff --git a/fieldtrip/_fixbalance.py b/fieldtrip/_fixbalance.py new file mode 100644 index 0000000..3daaf16 --- /dev/null +++ b/fieldtrip/_fixbalance.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _fixbalance(*args, **kwargs): + """ + FIXBALANCE ensures that the balancing representation in grad.balance or + elec.balance field is up to date and consistent, specifically with the + list of linear projections (or montages) being applied specified as + cell-array in "current", and not as a string in "current" and cell-array + in "previous". + + See also FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/fixbalance.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixbalance", *args, **kwargs) diff --git a/fieldtrip/_fixcoordsys.py b/fieldtrip/_fixcoordsys.py new file mode 100644 index 0000000..2fb05dc --- /dev/null +++ b/fieldtrip/_fixcoordsys.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _fixcoordsys(*args, **kwargs): + """ + FIXCOORDSYS ensures that the coordinate system is consistently + described. E.g. SPM and MNI are technically the same coordinate + system, but the strings 'spm' and 'mni' are different. + + See also FT_DETERMINE_COORDSYS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/fixcoordsys.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixcoordsys", *args, **kwargs) diff --git a/fieldtrip/_fixdimord.py b/fieldtrip/_fixdimord.py new file mode 100644 index 0000000..bd176a9 --- /dev/null +++ b/fieldtrip/_fixdimord.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def _fixdimord(*args, **kwargs): + """ + FIXDIMORD ensures consistency between the dimord string and the axes + that describe the data dimensions. The main purpose of this function + is to ensure backward compatibility of all functions with data that has + been processed by older FieldTrip versions. + + Use as + [data] = fixdimord(data) + This will modify the data.dimord field to ensure consistency. + The name of the axis is the same as the name of the dimord, i.e. if + dimord='freq_time', then data.freq and data.time should be present. + + The default dimensions in the data are described by + 'time' + 'freq' + 'chan' + 'chancmb' + 'refchan' + 'subj' + 'rpt' + 'rpttap' + 'pos' + 'ori' + 'rgb' + 'comp' + 'voxel' + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/fixdimord.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixdimord", *args, **kwargs) diff --git a/fieldtrip/_fixdipole.py b/fieldtrip/_fixdipole.py new file mode 100644 index 0000000..9c45755 --- /dev/null +++ b/fieldtrip/_fixdipole.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _fixdipole(*args, **kwargs): + """ + FIXDIPOLE ensures that the dipole position and moment are + consistently represented throughout FieldTrip functions. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/fixdipole.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixdipole", *args, **kwargs) diff --git a/fieldtrip/_fixinside.py b/fieldtrip/_fixinside.py new file mode 100644 index 0000000..62cba8e --- /dev/null +++ b/fieldtrip/_fixinside.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _fixinside(*args, **kwargs): + """ + FIXINSIDE ensures that the region of interest (which is indicated by the + field "inside") is consistently defined for source structures and volume + structures. Furthermore, it solves backward compatibility problems. + + Use as + [source] = fixinside(source, 'logical'); + or + [source] = fixinside(source, 'index'); + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/fixinside.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixinside", *args, **kwargs) diff --git a/fieldtrip/_fixname.py b/fieldtrip/_fixname.py new file mode 100644 index 0000000..d886263 --- /dev/null +++ b/fieldtrip/_fixname.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _fixname(*args, **kwargs): + """ + FIXNAME changes all inappropriate characters in a string into '_' + so that it can be used as a filename or as a field name in a structure. + If the string begins with a digit, an 'x' is prepended. + + Use as + str = fixname(str) + + MATLAB 2014a introduces the matlab.lang.makeValidName and + matlab.lang.makeUniqueStrings functions for constructing unique + identifiers, but this particular implementation also works with + older MATLAB versions. + + See also DEBLANK, STRIP, PAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/fixname.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixname", *args, **kwargs) diff --git a/fieldtrip/_fixneighbours.py b/fieldtrip/_fixneighbours.py new file mode 100644 index 0000000..32a0727 --- /dev/null +++ b/fieldtrip/_fixneighbours.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _fixneighbours(*args, **kwargs): + """ + This function converts the old format of the neighbourstructure into the + new format - although it just works as a wrapper + + See also FT_NEIGHBOURSELECTION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/fixneighbours.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixneighbours", *args, **kwargs) diff --git a/fieldtrip/_fixpos.py b/fieldtrip/_fixpos.py new file mode 100644 index 0000000..3f15c63 --- /dev/null +++ b/fieldtrip/_fixpos.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _fixpos(*args, **kwargs): + """ + FIXPOS helper function to ensure that meshes are described properly + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/fixpos.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixpos", *args, **kwargs) diff --git a/fieldtrip/_fixsampleinfo.py b/fieldtrip/_fixsampleinfo.py new file mode 100644 index 0000000..0c5ee8b --- /dev/null +++ b/fieldtrip/_fixsampleinfo.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _fixsampleinfo(*args, **kwargs): + """ + FIXSAMPLEINFO checks for the existence of a sampleinfo and trialinfo field in the + provided raw or timelock data structure. If present, nothing is done; if absent, + this function attempts to reconstruct them based on either an trl-matrix present in + the cfg-tree, or by just assuming the trials are segments of a continuous + recording. + + See also FT_DATATYPE_RAW, FT_DATATYPE_TIMELOCK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/fixsampleinfo.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fixsampleinfo", *args, **kwargs) diff --git a/fieldtrip/_fopen_or_error.py b/fieldtrip/_fopen_or_error.py new file mode 100644 index 0000000..80443d1 --- /dev/null +++ b/fieldtrip/_fopen_or_error.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _fopen_or_error(*args, **kwargs): + """ + FOPEN_OR_ERROR Opens a file, like fopen, but throws an exception if the open failed. + + This keeps you from having to write "if fid < 0; error(...)" everywhere + you do an fopen. + + See also FOPEN, ISDIR_OR_MKDIR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/fopen_or_error.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fopen_or_error", *args, **kwargs) diff --git a/fieldtrip/_fourier2crsspctrm.py b/fieldtrip/_fourier2crsspctrm.py new file mode 100644 index 0000000..4519454 --- /dev/null +++ b/fieldtrip/_fourier2crsspctrm.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _fourier2crsspctrm(*args, **kwargs): + """ + FOURIER2CRSSPCTRM transforms a fourier-containing freq-structure + into a crsspctrm-containing freq-structure, in which the + powerspectra are also contained in the cross-spectra, being a + channelcombination of a channel with itself. + + Use as + [freq] = fourier2crsspctrm(cfg, freq) + + where you have the following configuration options: + cfg.channel = cell-array with selection of channels, + see CHANNELSELECTION for details + cfg.channelcmb = cell-array with selection of combinations between + channels, see CHANNELCOMBINATION for details + cfg.keeptrials = 'yes' or 'no' (default) + cfg.foilim = 2-element vector defining your frequency limits of + interest. By default the whole frequency range of the + input is taken. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/fourier2crsspctrm.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fourier2crsspctrm", *args, **kwargs) diff --git a/fieldtrip/_fourierspctrm2lcrsspctrm.py b/fieldtrip/_fourierspctrm2lcrsspctrm.py new file mode 100644 index 0000000..a85f513 --- /dev/null +++ b/fieldtrip/_fourierspctrm2lcrsspctrm.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def _fourierspctrm2lcrsspctrm(*args, **kwargs): + """ + FOURIERSPCTRM2LCRSSPCTRM is a helper function that converts the input fourierspctrm + into a lagged crsspctrm, to enable computation of lagged coherence as described in + the publication referenced below. It is used in ft_connectivityanalysis in order to + reorganize the input data. + + The input data should be organised in a structure as obtained from the + FT_FREQANALYSIS function (freq), such that freq contains the fields 'fourierspctrm' + and 'time'. The timepoints must be chosen such that the desired cfg.lag/cfg.foi + (lag in seconds) is an integer multiple of the time resolution in freq. + + Options come in key-value pairs, and may contain + lag = scalar (or vector) of time shifts, expressed in units of time + We recommend users to choose cfg.lag such that it is larger or equal + to the width of the wavelet used for each Fourier transform in ft_freqanalysis + timeresolved = 'yes' or 'no' (default='no'). If set to yes, lagged + coherence is calculated separately for each pair of timepoints that + is separated by lag + channelcmb = Mx2 cell-array with selection of channel pairs, + see ft_channelcombination, default = {'all' 'all'}; + + When this measure is used for your publication, please cite: + Fransen, Anne M. M, Van Ede, Freek, Maris, Eric (2015) Identifying + oscillations on the basis of rhythmicity. NeuroImage 118: 256-267. + You may also want to acknowledge the fact that J.M. Schoffelen has + written the actual implementation. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/fourierspctrm2lcrsspctrm.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fourierspctrm2lcrsspctrm", *args, **kwargs) diff --git a/fieldtrip/_freq2cumtapcnt.py b/fieldtrip/_freq2cumtapcnt.py new file mode 100644 index 0000000..bf3dfb3 --- /dev/null +++ b/fieldtrip/_freq2cumtapcnt.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _freq2cumtapcnt(*args, **kwargs): + """ + freq2cumtapcnt is a function. + freq = freq2cumtapcnt(freq, fsample) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/freq2cumtapcnt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("freq2cumtapcnt", *args, **kwargs) diff --git a/fieldtrip/_freq2timelock.py b/fieldtrip/_freq2timelock.py new file mode 100644 index 0000000..5a712fd --- /dev/null +++ b/fieldtrip/_freq2timelock.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _freq2timelock(*args, **kwargs): + """ + FREQ2TIMELOCK transform the frequency data into something + on which the timelocked source reconstruction methods can + perform their trick. + + This function also performs frequency and channel selection, using + cfg.frequency + cfg.channel + + After source reconstruction, you should use TIMELOCK2FREQ. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/freq2timelock.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("freq2timelock", *args, **kwargs) diff --git a/fieldtrip/_ft_fetch_sens.py b/fieldtrip/_ft_fetch_sens.py new file mode 100644 index 0000000..2a0e859 --- /dev/null +++ b/fieldtrip/_ft_fetch_sens.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def _ft_fetch_sens(*args, **kwargs): + """ + FT_FETCH_SENS mimics the behavior of FT_READ_SENS, but for a FieldTrip + data structure or a FieldTrip configuration instead of a file on disk. + + Use as + [sens] = ft_fetch_sens(cfg) + or as + [sens] = ft_fetch_sens(cfg, data) + + The sensor configuration can be passed into this function in four ways: + (1) in a configuration field + (2) in a file whose name is passed in a configuration field, see FT_READ_SENS + (3) in a layout file, see FT_PREPARE_LAYOUT + (4) in a data field + + The following fields are used from the configuration: + cfg.elec = structure with electrode positions or filename, see FT_READ_SENS + cfg.grad = structure with gradiometer definition or filename, see FT_READ_SENS + cfg.opto = structure with optode definition or filename, see FT_READ_SENS + cfg.layout = structure with layout definition or filename, see FT_PREPARE_LAYOUT + cfg.senstype = string, can be 'meg', 'eeg', or 'nirs', this is used to choose in combined data (default = 'eeg') + + When the sensors are not specified in the configuration, this function will + fetch the grad, elec or opto field from the data. + + See also FT_READ_SENS, FT_DATATYPE_SENS, FT_FETCH_DATA, FT_PREPARE_LAYOUT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/ft_fetch_sens.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_fetch_sens", *args, **kwargs) diff --git a/fieldtrip/_ft_getuserfun.py b/fieldtrip/_ft_getuserfun.py new file mode 100644 index 0000000..e0318cf --- /dev/null +++ b/fieldtrip/_ft_getuserfun.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _ft_getuserfun(*args, **kwargs): + """ + FT_GETUSERFUN will search the MATLAB path for a function with the + appropriate name, and return a function handle to the function. + Considered are, in this order: + - the name itself, i.e. you get exactly the same func back as you put in; + - the name with the specified prefix; + - the name with 'ft_' and the specified prefix. + + For example, calling FT_GETUSERFUN('general', 'trialfun') might return a + function named 'general', 'trialfun_general', or 'ft_trialfun_general', + whichever of those is found first and is not a compatibility wrapper. + + func can be a function handle, in which case it is returned as-is. + + If no appropriate function is found, the empty array [] will be returned. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/ft_getuserfun.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_getuserfun", *args, **kwargs) diff --git a/fieldtrip/_ft_inv.py b/fieldtrip/_ft_inv.py new file mode 100644 index 0000000..99a7306 --- /dev/null +++ b/fieldtrip/_ft_inv.py @@ -0,0 +1,87 @@ +from fieldtrip._runtime import Runtime + + +def _ft_inv(*args, **kwargs): + """ + FT_INV computes a matrix inverse with optional regularization. + + Use as + Y = ft_inv(X, ...) + + Additional options should be specified in key-value pairs and can be + method = string, method for inversion and regularization (see below). + The default method is 'lavrentiev'. + lambda = scalar value, or string (expressed as a percentage), specifying + the regularization parameter for Lavrentiev or Tikhonov + regularization, or the replacement value for winsorization. + When lambda is specified as a string containing a percentage, + e.g. '5%', it will be computed as the percentage of the average + eigenvalue. + kappa = scalar integer, reflects the ordinal singular value at which + the singular value spectrum will be truncated. + tolerance = scalar, reflects the fraction of the largest singular value + at which the singular value spectrum will be truncated. + The default is 10*eps*max(size(X)). + feedback = boolean, to visualize the singular value spectrum with the + lambda regularization and kappa truncation. + + The supported methods are: + + 'vanilla' - the MATLAB inv() function is used for inversion, no regularization is + applied. + + 'moorepenrose' - the Moore-Penrose pseudoinverse is computed, no regularization is + applied. + + 'tsvd' - this results in a pseudoinverse based on a singular value decomposition, + truncating the singular values according to either kappa or tolerance parameter + before reassembling the inverse. + + 'tikhonov' - the matrix is regularized according to the Tikhonov method using the + labmda parameter, after which the truncated svd method (i.e. similar to MATLAB + pinv) is used for inversion. + + 'lavrentiev' - the matrix is regularized according to the Lavrentiev method with a + weighted identity matrix using the labmda parameter, after which the truncated svd + method (i.e. similar to MATLAB pinv) is used for inversion. + + 'winsorize' - a truncated svd is computed, based on either kappa or tolerance + parameters, but in addition the singular values smaller than lambda are replaced by + the value according to lambda. + + Both for the lambda and the kappa option you can specify 'interactive' to pop up an + interactive display of the singular value spectrum that allows you to click in the figure. + + Rather than specifying kappa, you can also specify the tolerance as the ratio of + the largest eigenvalue at which eigenvalues will be truncated. + + See also INV, PINV, CONDEST, RANK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/ft_inv.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_inv", *args, **kwargs) diff --git a/fieldtrip/_ft_singletrialanalysis_aseo.py b/fieldtrip/_ft_singletrialanalysis_aseo.py new file mode 100644 index 0000000..969f33c --- /dev/null +++ b/fieldtrip/_ft_singletrialanalysis_aseo.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def _ft_singletrialanalysis_aseo(*args, **kwargs): + """ + FT_SINGLETRIALANALYSIS_ASEO executes single-trial analysis, using the ASEO + algorithm (Xu et al, 2009) + + Use as + [output] = ft_singletrialanalysis_aseo(cfg, data_fft, erp_fft) + where data_fft is the observed data in the frequency domain, erp_fft + contains the initial ERP components in the frequency domain. cfg is a + configuration structure according to + + OUTPUT---- + amp_est : Estimates of ERP components' amplitude + lat_est : Estimates of ERP components' latency + erp_est : Estimates of ERP waveforms in time domain + ar : Estimated AR coefficients of on-going activity + noise : Power spectrum of on-going activity fitted in AR model + sigma : Power of the input white noise of AR model for on-going activity + residual : Residual signal after removing ERPs in time domain + rejectflag : Each element of rejectflag indicating that the corresponding + trial should be rejected or not. For example, rejectflag(9)==1 means + the 9th trial is rejected. + corr_est : Correlation between the original data and the recovered signal + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/ft_singletrialanalysis_aseo.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_singletrialanalysis_aseo", *args, **kwargs) diff --git a/fieldtrip/_fwer.py b/fieldtrip/_fwer.py new file mode 100644 index 0000000..d58631b --- /dev/null +++ b/fieldtrip/_fwer.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _fwer(*args, **kwargs): + """ + FWER family-wise error rate control using Bonferoni method + + Use as + h = fwer(p, q) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/fwer.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fwer", *args, **kwargs) diff --git a/fieldtrip/_get_degrees_orders.py b/fieldtrip/_get_degrees_orders.py new file mode 100644 index 0000000..5573373 --- /dev/null +++ b/fieldtrip/_get_degrees_orders.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _get_degrees_orders(*args, **kwargs): + """ + this helper function assumes the order of the basis vectors, as computed + in the MNE-Python implementation is the same as the order of the basis + vectors as computed in the SPM implementation + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/get_degrees_orders.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("get_degrees_orders", *args, **kwargs) diff --git a/fieldtrip/_getdatfield.py b/fieldtrip/_getdatfield.py new file mode 100644 index 0000000..ba0697b --- /dev/null +++ b/fieldtrip/_getdatfield.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _getdatfield(*args, **kwargs): + """ + GETDATFIELD + + Use as + [datfield, dimord] = getdatfield(data) + where the output arguments are cell-arrays. + + See also GETDIMORD, GETDIMSIZ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/getdatfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getdatfield", *args, **kwargs) diff --git a/fieldtrip/_getdimord.py b/fieldtrip/_getdimord.py new file mode 100644 index 0000000..0db52e1 --- /dev/null +++ b/fieldtrip/_getdimord.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _getdimord(*args, **kwargs): + """ + GETDIMORD determine the dimensions and order of a data field in a FieldTrip + structure. + + Use as + dimord = getdimord(data, field) + + See also GETDIMSIZ, GETDATFIELD, FIXDIMORD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/getdimord.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getdimord", *args, **kwargs) diff --git a/fieldtrip/_getdimsiz.py b/fieldtrip/_getdimsiz.py new file mode 100644 index 0000000..6e0e532 --- /dev/null +++ b/fieldtrip/_getdimsiz.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _getdimsiz(*args, **kwargs): + """ + GETDIMSIZ + + Use as + dimsiz = getdimsiz(data, field) + or + dimsiz = getdimsiz(data, field, numdim) + + MATLAB will not return the size of a field in the data structure that has trailing + singleton dimensions, since those are automatically squeezed out. With the optional + numdim parameter you can specify how many dimensions the data element has. This + will result in the trailing singleton dimensions being added to the output vector. + + Example use + dimord = getdimord(datastructure, fieldname); + dimtok = tokenize(dimord, '_'); + dimsiz = getdimsiz(datastructure, fieldname, numel(dimtok)); + + See also GETDIMORD, GETDATFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/getdimsiz.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getdimsiz", *args, **kwargs) diff --git a/fieldtrip/_getorthoviewpos.py b/fieldtrip/_getorthoviewpos.py new file mode 100644 index 0000000..be4b457 --- /dev/null +++ b/fieldtrip/_getorthoviewpos.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _getorthoviewpos(*args, **kwargs): + """ + GETORTHOVIEWPOS obtains the orthographic projections of 3D positions + based on a given coordinate system and viewpoint + + Use as + getorthoviewpos(pos, coordsys, viewpoint) + + For example + getorthoviewpoint(pos, 'mni', 'superior') + + See alo SETVIEWPOINT, COORDSYS2LABEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/getorthoviewpos.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getorthoviewpos", *args, **kwargs) diff --git a/fieldtrip/_getsubfield.py b/fieldtrip/_getsubfield.py new file mode 100644 index 0000000..ce84437 --- /dev/null +++ b/fieldtrip/_getsubfield.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _getsubfield(*args, **kwargs): + """ + GETSUBFIELD returns a field from a structure just like the standard + GETFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = getsubfield(s, 'fieldname') + or as + f = getsubfield(s, 'fieldname.subfieldname') + + See also GETFIELD, ISSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/getsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getsubfield", *args, **kwargs) diff --git a/fieldtrip/_getusername.py b/fieldtrip/_getusername.py new file mode 100644 index 0000000..d4177e7 --- /dev/null +++ b/fieldtrip/_getusername.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _getusername(*args, **kwargs): + """ + GETUSERNAME + + Use as + str = getusername(); + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/getusername.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("getusername", *args, **kwargs) diff --git a/fieldtrip/_globalrescale.py b/fieldtrip/_globalrescale.py new file mode 100644 index 0000000..3e35fe0 --- /dev/null +++ b/fieldtrip/_globalrescale.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _globalrescale(*args, **kwargs): + """ + GLOBALRESCALE creates the homogenous spatial transformation matrix + for a 7 parameter rigid-body transformation with global rescaling + + Use as + [H] = globalrescale(f) + + The transformation vector f should contain the + x-shift + y-shift + z-shift + followed by the + pitch (rotation around x-axis) + roll (rotation around y-axis) + yaw (rotation around z-axis) + followed by the + global rescaling factor + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/globalrescale.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("globalrescale", *args, **kwargs) diff --git a/fieldtrip/_grid2transform.py b/fieldtrip/_grid2transform.py new file mode 100644 index 0000000..1964a21 --- /dev/null +++ b/fieldtrip/_grid2transform.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _grid2transform(*args, **kwargs): + """ + GRID2TRANSFORM ensures that the volume contains a homogenous transformation + matrix. If needed, a homogenous matrix is constructed from the xgrid/ygrid/zgrid + fields and those fields are changed to 1:Nx, 1:Ny and 1:Nz + + See also TRANSFORM2GRID + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/grid2transform.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("grid2transform", *args, **kwargs) diff --git a/fieldtrip/_guidelines.py b/fieldtrip/_guidelines.py new file mode 100644 index 0000000..715f332 --- /dev/null +++ b/fieldtrip/_guidelines.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _guidelines(*args, **kwargs): + """ + GUIDELINES searches for a contiguous block of commented text and shows + its contents. It is used to display additional help sections. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/guidelines.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("guidelines", *args, **kwargs) diff --git a/fieldtrip/_handle_atlas_input.py b/fieldtrip/_handle_atlas_input.py new file mode 100644 index 0000000..30efba3 --- /dev/null +++ b/fieldtrip/_handle_atlas_input.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _handle_atlas_input(*args, **kwargs): + """ + HANDLE_ATLAS_INPUT handles user input to specify volumetric atlases in some coordinate. It + does two things: (1) call FT_READ_ATLAS to read the atlas from file, if it is specified as a + string input, and (2) if the optional second data input argument is provided, and it has a + coordsys and/or unit field, checks the coordinate systems and units of the atlas and the + input against each other. + + This code was taken from ft_sourceplot to avoid duplication upon adding similar functionality + to ft_sourceplot_interactive. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/handle_atlas_input.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("handle_atlas_input", *args, **kwargs) diff --git a/fieldtrip/_handle_edit_input.py b/fieldtrip/_handle_edit_input.py new file mode 100644 index 0000000..3c212b1 --- /dev/null +++ b/fieldtrip/_handle_edit_input.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _handle_edit_input(*args, **kwargs): + """ + HANDLE_EDIT_INPUT deals with user-entered input in the GUI. This is used to select + channels and/or trials in FT_REJECTVISUAL and to select channels in FT_DATABROWSER + + The input text can consist of a string such as + 1 2 3 4 + 1:4 + [1 2 3 4] + [1:4] + This is converted in a list of numbers. + + The input text can also consist of a single non-numeric string or a string that + represents a cell-array of strings such as + all + {'MEG', '-MR*'} + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/handle_edit_input.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("handle_edit_input", *args, **kwargs) diff --git a/fieldtrip/_headsurface.py b/fieldtrip/_headsurface.py new file mode 100644 index 0000000..d2a9968 --- /dev/null +++ b/fieldtrip/_headsurface.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _headsurface(*args, **kwargs): + """ + HEADSURFACE constructs a triangulated description of the skin or brain + surface from a volume conduction model, from a set of electrodes or + gradiometers, or from a combination of the two. It returns a closed + surface. + + Use as + [pos, tri] = headsurface(headmodel, sens, ...) + where + headmodel = volume conduction model (structure) + sens = electrode or gradiometer array (structure) + + Optional arguments should be specified in key-value pairs: + surface = 'skin' or 'brain' (default = 'skin') + npos = number of vertices (default is determined automatic) + downwardshift = boolean, this will shift the lower rim of the helmet down with approximately 1/4th of its radius (default is 1) + inwardshift = number (default = 0) + headshape = string, file containing the head shape + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/headsurface.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("headsurface", *args, **kwargs) diff --git a/fieldtrip/_highpassfilter.py b/fieldtrip/_highpassfilter.py new file mode 100644 index 0000000..c805c30 --- /dev/null +++ b/fieldtrip/_highpassfilter.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _highpassfilter(*args, **kwargs): + """ + HIGHPASSFILTER removes low frequency components from EEG/MEG data + + Use as + [filt] = highpassfilter(dat, Fsample, Fhp, N, type, dir) + where + dat data matrix (Nchans X Ntime) + Fsample sampling frequency in Hz + Fhp filter frequency + N optional filter order, default is 6 (but) or 25 (fir) + type optional filter type, can be + 'but' Butterworth IIR filter (default) + 'fir' FIR filter using MATLAB fir1 function + dir optional filter direction, can be + 'onepass' forward filter only + 'onepass-reverse' reverse filter only, i.e. backward in time + 'twopass' zero-phase forward and reverse filter (default) + + Note that a one- or two-pass filter has consequences for the + strength of the filter, i.e. a two-pass filter with the same filter + order will attenuate the signal twice as strong. + + See also LOWPASSFILTER, BANDPASSFILTER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/highpassfilter.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("highpassfilter", *args, **kwargs) diff --git a/fieldtrip/_hline.py b/fieldtrip/_hline.py new file mode 100644 index 0000000..e400169 --- /dev/null +++ b/fieldtrip/_hline.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _hline(*args, **kwargs): + """ + HLINE plot a horizontal line in the current graph + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/hline.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("hline", *args, **kwargs, nargout=0) diff --git a/fieldtrip/_homer2opto.py b/fieldtrip/_homer2opto.py new file mode 100644 index 0000000..3da8353 --- /dev/null +++ b/fieldtrip/_homer2opto.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def _homer2opto(*args, **kwargs): + """ + HOMER2OPTO converts the Homer SD structure to a FieldTrip optode structure + + See https://www.nitrc.org/plugins/mwiki/index.php/homer2:Homer_Input_Files#NIRS_data_file_format + + The Homer SD structure contains the source/detector geometry and has the following fields: + + nSrcs - Number of lasers; scalar variable + nDets - Number of detectors; scalar variable + SrcPos - Array of probe coordinates of the lasers; dimensions by 3 + DetPos - Array of probe coordinates of the detectors; dimensions by 3 + Lambda - Wavelengths used for data acquisition; dimensions by 1 + MeasList - List of source/detector/wavelength measurement channels. It’s an array with dimensions, by 4.The meaning of the 4 columns are as follows: + Column 1 index of the source from the SD.SrcPos list. + Column 2 index of the detector from the SD.DetPos list. + Column 3 is unused right now and contains all ones. + Column 4 index of the wavelength from SD.Lambda. + + The FieldTrip optode structure is defined in FT_DATATYPE_SENS + + See also OPTO2HOMER, BTI2GRAD, CTF2GRAD, FIF2GRAD, ITAB2GRAD, MNE2GRAD, NETMEG2GRAD, YOKOGAWA2GRAD, FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/homer2opto.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("homer2opto", *args, **kwargs) diff --git a/fieldtrip/_homogenous2traditional.py b/fieldtrip/_homogenous2traditional.py new file mode 100644 index 0000000..2bf1ce2 --- /dev/null +++ b/fieldtrip/_homogenous2traditional.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def _homogenous2traditional(*args, **kwargs): + """ + HOMOGENOUS2TRADITIONAL estimates the traditional translation, rotation + and scaling parameters from a homogenous transformation matrix. It will + give an error if the homogenous matrix also describes a perspective + transformation. + + Use as + f = homogenous2traditional(H) + where H is a 4x4 homogenous transformation matrix and f is a vector with + nine elements describing + x-shift + y-shift + z-shift + followed by the + pitch (rotation around x-axis in degrees) + roll (rotation around y-axis in degrees) + yaw (rotation around z-axis in degrees) + followed by the + x-rescaling factor + y-rescaling factor + z-rescaling factor + + The order in which the transformations would be done is exactly opposite + as the list above, i.e. first z-rescale ... and finally x-shift. + + Example use: + t0 = [1 2 3]; r0 = [10 20 30]; s0 = [1.1 1.2 1.3] + H0 = translate(t0) * rotate(r0) * scale(s0) + f = homogenous2traditional(H0) + t1 = f(1:3); r1 = f(4:6); s1 = f(7:9); + H1 = translate(t1) * rotate(r1) * scale(s1) + + See also TRANSLATE, ROTATE, SCALE, HOMOGENOUS2QUATERNION, QUATERNION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/homogenous2traditional.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("homogenous2traditional", *args, **kwargs) diff --git a/fieldtrip/_htmlcolors.py b/fieldtrip/_htmlcolors.py new file mode 100644 index 0000000..75a4754 --- /dev/null +++ b/fieldtrip/_htmlcolors.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _htmlcolors(*args, **kwargs): + """ + HTMLCOLORS looks up the RGB value for a named color (string), or the name for a given RGB value + + Use as + rgb = htmlcolors(name) + or + name = htmlcolors(rgb) + or + list = htmlcolors + + See https://www.rapidtables.com/web/color/html-color-codes.html + and https://www.color-hex.com/color-palettes/ + + See also STANDARDCOLORS, COLORSPEC2RGB, FT_COLORMAP, COLORMAP, COLORMAPEDITOR, BREWERMAP, MATPLOTLIB, CMOCEAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/htmlcolors.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("htmlcolors", *args, **kwargs) diff --git a/fieldtrip/_ignorefields.py b/fieldtrip/_ignorefields.py new file mode 100644 index 0000000..dfd83f1 --- /dev/null +++ b/fieldtrip/_ignorefields.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _ignorefields(*args, **kwargs): + """ + IGNOREFIELDS returns a list of fields that can be present in the cfg structure that + should be ignored at various places in the code, e.g. for provenance, history, + size-checking, etc. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/ignorefields.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ignorefields", *args, **kwargs) diff --git a/fieldtrip/_inputlabel2outputlabel.py b/fieldtrip/_inputlabel2outputlabel.py new file mode 100644 index 0000000..65352aa --- /dev/null +++ b/fieldtrip/_inputlabel2outputlabel.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _inputlabel2outputlabel(*args, **kwargs): + """ + INPUTLABEL2OUTPUTLABEL is a subfunction which outputs the cell-arrays + outputlabel and the corresponding outputindex, and defines how the + channels in the original data have to be combined, to provide the + wished for combination of the channels, as defined in cfg.combinechan + + Configuration-options are: + cfg.combinechan = 'planar' combines the horizontal and vertical planar-gradients + 'pseudomeg' one gradiometer versus the rest + TODO: more flexible way of combining, e.g. by providing a cell-array + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/inputlabel2outputlabel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("inputlabel2outputlabel", *args, **kwargs) diff --git a/fieldtrip/_inside_contour.py b/fieldtrip/_inside_contour.py new file mode 100644 index 0000000..f1eed68 --- /dev/null +++ b/fieldtrip/_inside_contour.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _inside_contour(*args, **kwargs): + """ + inside_contour is a function. + bool = inside_contour(pos, contour) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/inside_contour.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("inside_contour", *args, **kwargs) diff --git a/fieldtrip/_interp_gridded.py b/fieldtrip/_interp_gridded.py new file mode 100644 index 0000000..377b64c --- /dev/null +++ b/fieldtrip/_interp_gridded.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _interp_gridded(*args, **kwargs): + """ + INTERP_GRIDDED computes a matrix that interpolates values that were + observed on positions in a regular 3-D grid onto positions that are + unstructured, e.g. the vertices of a cortical sheet. + + Use as + [val] = interp_gridded(transform, val, pos, ...) or + [interpmat, distmat] = interp_gridded(transform, val, pos, ...) + where + transform homogenous coordinate transformation matrix for the volume + val 3-D matrix with the values in the volume + pos Mx3 matrix with the vertex positions onto which the data should + be interpolated + + Optional arguments are specified in key-value pairs and can be + projmethod = 'nearest', 'sphere_avg', 'sphere_weighteddistance' + sphereradius = number + distmat = NxM matrix with precomputed distances + inside = indices for inside voxels (or logical array) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/interp_gridded.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("interp_gridded", *args, **kwargs) diff --git a/fieldtrip/_interp_ungridded.py b/fieldtrip/_interp_ungridded.py new file mode 100644 index 0000000..a2b0aa6 --- /dev/null +++ b/fieldtrip/_interp_ungridded.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _interp_ungridded(*args, **kwargs): + """ + INTERP_UNGRIDDED computes an interpolation matrix for two clouds of 3-D points + + To get the interpolated data, use as + [valto] = interp_ungridded(pos_from, pos_to, 'data', valfrom, ...) + or to get the interpolation matrix itself, use as + [interpmat, distmat] = interp_ungridded(pos_from, pos_to, ...) + where + pos_from Nx3 matrix with the vertex positions + pos_to Mx3 matrix with the vertex positions onto which the data should be interpolated + + Optional arguments are specified in key-value pairs and can be + data = NxK matrix with functional data + distmat = NxM matrix with precomputed distances + projmethod = 'nearest', 'sphere_avg', 'sphere_weighteddistance', 'smudge' + triout = triangulation for the second set of vertices + sphereradius = scalar + power = scalar, power parameter as in the Inverse Distance Weighting function proposed by Shepard (default = 1). + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/interp_ungridded.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("interp_ungridded", *args, **kwargs) diff --git a/fieldtrip/_intersect_line.py b/fieldtrip/_intersect_line.py new file mode 100644 index 0000000..673d3ab --- /dev/null +++ b/fieldtrip/_intersect_line.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _intersect_line(*args, **kwargs): + """ + INTERSECT_LINE finds the intersection points between a mesh and a line. + + Use as: + [points, pos, indx] = intersect_line(pnt, tri, pnt1, pnt2) + + Where pnt (Nx3) and tri (Mx3) define the mesh, and pnt1 (1x3) and pnt2 + (1x3) define the line. The output argument points (Px3) are the + intersection points, pos (Px1) the location on the line (relative to + pnt1) and indx is the index to the triangles of the mesh that are + intersected. + + This code is based from a function from the geom3d toolbox, that can be + found on matlab's file exchange. The original help is pasted below. The + original function was released under the BSD-license. + + Adapted to FieldTrip by Jan-Mathijs Schoffelen 2012 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/intersect_line.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("intersect_line", *args, **kwargs) diff --git a/fieldtrip/_inv3x3.py b/fieldtrip/_inv3x3.py new file mode 100644 index 0000000..7c9fa27 --- /dev/null +++ b/fieldtrip/_inv3x3.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _inv3x3(*args, **kwargs): + """ + INV3X3 computes inverse of matrix x, using explicit analytic definition + if size(x) = [3 3 K M] + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/inv3x3.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("inv3x3", *args, **kwargs) diff --git a/fieldtrip/_isalmostequal.py b/fieldtrip/_isalmostequal.py new file mode 100644 index 0000000..78153eb --- /dev/null +++ b/fieldtrip/_isalmostequal.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _isalmostequal(*args, **kwargs): + """ + ISALMOSTEQUAL compares two input variables and returns true/false + and a message containing the details on the observed difference. + + Use as + [ok, message] = isalmostequal(a, b) + [ok, message] = isalmostequal(a, b, ...) + + This works for all possible input variables a and b, like + numerical arrays, string arrays, cell arrays, structures + and nested data types. + + Optional input arguments come in key-value pairs, supported are + 'depth' number, for nested structures + 'abstol' number, absolute tolerance for numerical comparison + 'reltol' number, relative tolerance for numerical comparison + 'diffabs' boolean, check difference between absolute values for numericals (useful for e.g. mixing matrices which have arbitrary signs) + + See also ISEQUAL, ISEQUALNAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/isalmostequal.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("isalmostequal", *args, **kwargs) diff --git a/fieldtrip/_iscompatwrapper.py b/fieldtrip/_iscompatwrapper.py new file mode 100644 index 0000000..66f8a32 --- /dev/null +++ b/fieldtrip/_iscompatwrapper.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _iscompatwrapper(*args, **kwargs): + """ + ISCOMPATWRAPPER Checks whether the specified function name will invoke a + compatibility wrapper or not. + + Copyright (C) 2012, Donders Centre for Cognitive Neuroimaging, Nijmegen, NL + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + + $Id + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/iscompatwrapper.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("iscompatwrapper", *args, **kwargs) diff --git a/fieldtrip/_isdir_or_mkdir.py b/fieldtrip/_isdir_or_mkdir.py new file mode 100644 index 0000000..a29615d --- /dev/null +++ b/fieldtrip/_isdir_or_mkdir.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _isdir_or_mkdir(*args, **kwargs): + """ + ISDIR_OR_MKDIR Checks that a directory exists, or if not, creates the directory and + all its parent directories. + + See also FOPEN_OR_ERROR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/isdir_or_mkdir.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("isdir_or_mkdir", *args, **kwargs, nargout=0) diff --git a/fieldtrip/_isfunction.py b/fieldtrip/_isfunction.py new file mode 100644 index 0000000..a5e651c --- /dev/null +++ b/fieldtrip/_isfunction.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _isfunction(*args, **kwargs): + """ + ISFUNCTION tests whether the function of the specified name is a callable + function on the current MATLAB path. + + Note that this is *not* equivalent to calling exist(funcname, 'file'), + since that will return 7 in case funcname exists as a folder. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/isfunction.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("isfunction", *args, **kwargs) diff --git a/fieldtrip/_ismatch.py b/fieldtrip/_ismatch.py new file mode 100644 index 0000000..f2a645d --- /dev/null +++ b/fieldtrip/_ismatch.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _ismatch(*args, **kwargs): + """ + ISMATCH returns true if x is a member of array y, regardless of the class + of x and y, if y is a string, or a cell-array of strings, it can contain + the wildcard '*' + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/ismatch.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ismatch", *args, **kwargs) diff --git a/fieldtrip/_isrealmat.py b/fieldtrip/_isrealmat.py new file mode 100644 index 0000000..4afc589 --- /dev/null +++ b/fieldtrip/_isrealmat.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _isrealmat(*args, **kwargs): + """ + ISREALMAT returns true for a real matrix + + Use as + status = isrealmat(x) + + See also ISNUMERIC, ISREAL, ISVECTOR, ISREALVEC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/isrealmat.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("isrealmat", *args, **kwargs) diff --git a/fieldtrip/_isrealvec.py b/fieldtrip/_isrealvec.py new file mode 100644 index 0000000..0bd7109 --- /dev/null +++ b/fieldtrip/_isrealvec.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _isrealvec(*args, **kwargs): + """ + ISREALVEC returns true for a real row or column vector + + Use as + status = isrealvec(x) + + See also ISNUMERIC, ISREAL, ISVECTOR, ISREALMAT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/isrealvec.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("isrealvec", *args, **kwargs) diff --git a/fieldtrip/_issubfield.py b/fieldtrip/_issubfield.py new file mode 100644 index 0000000..cba914d --- /dev/null +++ b/fieldtrip/_issubfield.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _issubfield(*args, **kwargs): + """ + ISSUBFIELD tests for the presence of a field in a structure just like the standard + Matlab ISFIELD function, except that you can also specify nested fields + using a '.' in the fieldname. The nesting can be arbitrary deep. + + Use as + f = issubfield(s, 'fieldname') + or as + f = issubfield(s, 'fieldname.subfieldname') + + This function returns true if the field is present and false if the field + is not present. + + See also ISFIELD, GETSUBFIELD, SETSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/issubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("issubfield", *args, **kwargs) diff --git a/fieldtrip/_join_str.py b/fieldtrip/_join_str.py new file mode 100644 index 0000000..6b362b6 --- /dev/null +++ b/fieldtrip/_join_str.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _join_str(*args, **kwargs): + """ + join_str is a function. + t = join_str(separator, cells) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/join_str.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("join_str", *args, **kwargs) diff --git a/fieldtrip/_labelcmb2indx.py b/fieldtrip/_labelcmb2indx.py new file mode 100644 index 0000000..950d908 --- /dev/null +++ b/fieldtrip/_labelcmb2indx.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def _labelcmb2indx(*args, **kwargs): + """ + LABELCMB2INDX computes an array with indices, corresponding to the order + in a list of labels, for an Nx2 list of label combinations + + Use as + [indx] = labelcmb2indx(labelcmb, label) + or + [indx] = labelcmb2indx(labelcmb) + + Labelcmb is an Nx2 cell-array with label combinations, label is an Mx1 + cell-array with labels. If only one input is provided, the indices are + with respect to the rows in the labelcmb matrix, where the corresponding + auto combinations are located. As a consequence, the labelcmb matrix + needs to contain rows containing auto-combinations + + Example: + labelcmb = {'a' 'b';'a' 'c';'b' 'c';'a' 'a';'b' 'b';'c' 'c'}; + label = {'a';'b';'c'}; + + indx = labelcmb2indx(labelcmb, label) + returns: [1 2;1 3;2 3;1 1;2 2;3 3] + + indx = labelcmb2indx(labelcmb) + returns: [4 5;4 6;5 6;4 4;5 5;6;6] + + This is a helper function to FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/labelcmb2indx.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("labelcmb2indx", *args, **kwargs) diff --git a/fieldtrip/_lapcal.py b/fieldtrip/_lapcal.py new file mode 100644 index 0000000..0e2e87e --- /dev/null +++ b/fieldtrip/_lapcal.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _lapcal(*args, **kwargs): + """ + LAPCAL computes the finite difference approximation to the surface laplacian + matrix using a triangulation of the surface + + lap = lapcal(pnt, tri) + + where + pnt contains the positions of the vertices + tri contains the triangle definition + lap is the surface laplacian matrix + + See also LAPINT, LAPINTMAT, READ_TRI, SAVE_TRI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/lapcal.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("lapcal", *args, **kwargs) diff --git a/fieldtrip/_lbex.py b/fieldtrip/_lbex.py new file mode 100644 index 0000000..3a60eb0 --- /dev/null +++ b/fieldtrip/_lbex.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _lbex(*args, **kwargs): + """ + This function will add the field "subspace" to the sourcemodel definition. + + The subspace projection is based on the LBEX (local basis expansion) + method. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/lbex.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("lbex", *args, **kwargs) diff --git a/fieldtrip/_lineattributes_common.py b/fieldtrip/_lineattributes_common.py new file mode 100644 index 0000000..055127c --- /dev/null +++ b/fieldtrip/_lineattributes_common.py @@ -0,0 +1,72 @@ +from fieldtrip._runtime import Runtime + + +def _lineattributes_common(*args, **kwargs): + """ + LINEATTRIBUTES_COMMON implements consistent line attributes for multiple channels/conditions + + This function is used by + ft_databrowser + ft_multiplotER + ft_singleplotER + + It is not yet used by + ft_connectivityplot + ft_prepare_layout + + Use as + [linecolor, linestyle, linewidth] = lineattributes_common(cfg, varargin) + + The input varargin are the data object(s) which are the input of the caller function. + The output consists of: + + linecolor = N x 3 x M matrix with RGB values for N channels and M data arguments + linestyle = N x M cell-array with linestyle for N channels and M data arguments + linewidth = N x M matrix with linewidth for N channels and M data arguments + + The configuration can have the following parameters: + cfg.colorgroups = char or numeric vector determining whether the + different values are going to be distributed across channels + ('sequential'), or across data arguments ('condition'). Other + possibilities are 'allblacks', 'chantype', 'labelcharI', where + I is a scalar number indicating the I'th character of the label + based on which the grouping is done + cfg.stylegroups = char or numeric vector, same possibilities as above, save for 'allblacks' + cfg.widthgroups = char or numeric vector, same possibilities as above, save for 'allblacks' + cfg.linecolor = char, Nx3 matrix, or Nx3xM matrix + cfg.linestyle = char, or cell-array + cfg.linewidth = scalar, or NxM matrix + + If cfg.linecolor is a char, it should either be a sequence of characters that can be translated into + an RGB value (i.e., any of 'rbgcmykw'), or it can be 'spatial', in which case a color will be assigned + based on the layout.color field. Typically, this will be a color that is based on the x/y/z position of + the corresponding sensor. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/lineattributes_common.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("lineattributes_common", *args, **kwargs) diff --git a/fieldtrip/_lmoutr.py b/fieldtrip/_lmoutr.py new file mode 100644 index 0000000..b2630be --- /dev/null +++ b/fieldtrip/_lmoutr.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _lmoutr(*args, **kwargs): + """ + LMOUTR computes the la/mu parameters of a point projected to a triangle + + Use as + [la, mu, dist] = lmoutr(v1, v2, v3, r) + where v1, v2 and v3 are three vertices of the triangle, and r is + the point that is projected onto the plane spanned by the vertices + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/lmoutr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("lmoutr", *args, **kwargs) diff --git a/fieldtrip/_lmoutrn.py b/fieldtrip/_lmoutrn.py new file mode 100644 index 0000000..a4bc4ec --- /dev/null +++ b/fieldtrip/_lmoutrn.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _lmoutrn(*args, **kwargs): + """ + LMOUTRN computes the la/mu parameters of a point projected to triangles + + Use as + [la, mu, dist, proj] = lmoutrn(v1, v2, v3, r) + where v1, v2 and v3 are Nx3 matrices with vertex positions of the triangles, + and r is the point that is projected onto the planes spanned by the vertices + This is a vectorized version of Robert's lmoutrn function and is + generally faster than a for-loop around the mex-file. It also returns the + projection of the point r onto the planes of the triangles, and the signed + distance to the triangles. The sign of the distance is negative if the point + lies closer to the average across all vertices and the triangle under consideration. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/lmoutrn.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("lmoutrn", *args, **kwargs) diff --git a/fieldtrip/_loadvar.py b/fieldtrip/_loadvar.py new file mode 100644 index 0000000..7959494 --- /dev/null +++ b/fieldtrip/_loadvar.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _loadvar(*args, **kwargs): + """ + LOADVAR is a helper function for cfg.inputfile + + See also SAVEVAR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/loadvar.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("loadvar", *args, **kwargs) diff --git a/fieldtrip/_lowpassfilter.py b/fieldtrip/_lowpassfilter.py new file mode 100644 index 0000000..4329515 --- /dev/null +++ b/fieldtrip/_lowpassfilter.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _lowpassfilter(*args, **kwargs): + """ + LOWPASSFILTER removes high frequency components from EEG/MEG data + + Use as + [filt] = lowpassfilter(dat, Fsample, Flp, N, type, dir) + where + dat data matrix (Nchans X Ntime) + Fsample sampling frequency in Hz + Flp filter frequency + N optional filter order, default is 6 (but) or 25 (fir) + type optional filter type, can be + 'but' Butterworth IIR filter (default) + 'fir' FIR filter using MATLAB fir1 function + dir optional filter direction, can be + 'onepass' forward filter only + 'onepass-reverse' reverse filter only, i.e. backward in time + 'twopass' zero-phase forward and reverse filter (default) + + Note that a one- or two-pass filter has consequences for the + strength of the filter, i.e. a two-pass filter with the same filter + order will attenuate the signal twice as strong. + + See also HIGHPASSFILTER, BANDPASSFILTER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/lowpassfilter.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("lowpassfilter", *args, **kwargs) diff --git a/fieldtrip/_megplanar_fitplane.py b/fieldtrip/_megplanar_fitplane.py new file mode 100644 index 0000000..b0872e4 --- /dev/null +++ b/fieldtrip/_megplanar_fitplane.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _megplanar_fitplane(*args, **kwargs): + """ + Fit a plane through the B=f(x,y) plane and compute its two gradients + The first point in the plane is the gradiometer itself, + the neighbours are the subsequent points. This method also returns the + offset of the B-plane at each sensor, which is appriximately equal to the + field itself. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/megplanar_fitplane.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("megplanar_fitplane", *args, **kwargs) diff --git a/fieldtrip/_megplanar_orig.py b/fieldtrip/_megplanar_orig.py new file mode 100644 index 0000000..3be83c9 --- /dev/null +++ b/fieldtrip/_megplanar_orig.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _megplanar_orig(*args, **kwargs): + """ + This is the original method from Ole. It has a different way of + making the coordinate transformation that I do not fully understand. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/megplanar_orig.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("megplanar_orig", *args, **kwargs) diff --git a/fieldtrip/_megplanar_sincos.py b/fieldtrip/_megplanar_sincos.py new file mode 100644 index 0000000..6299b17 --- /dev/null +++ b/fieldtrip/_megplanar_sincos.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _megplanar_sincos(*args, **kwargs): + """ + This attempts to re-implements Ole's method, exept that the definition of the + horizontal and vertical direction is different. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/megplanar_sincos.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("megplanar_sincos", *args, **kwargs) diff --git a/fieldtrip/_menu_fieldtrip.py b/fieldtrip/_menu_fieldtrip.py new file mode 100644 index 0000000..08b8e1a --- /dev/null +++ b/fieldtrip/_menu_fieldtrip.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _menu_fieldtrip(*args, **kwargs): + """ + MENU_FIELDTRIP adds a FieldTrip-specific menu to a figure. + + See also MENU_VIEWPOINT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/menu_fieldtrip.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("menu_fieldtrip", *args, **kwargs, nargout=0) diff --git a/fieldtrip/_mergestruct.py b/fieldtrip/_mergestruct.py new file mode 100644 index 0000000..d139f0e --- /dev/null +++ b/fieldtrip/_mergestruct.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _mergestruct(*args, **kwargs): + """ + MERGESTRUCT merges the fields of a structure with another structure. The fields of + the 2nd structure are only copied in case they are absent in the 1st structure. + + Use as + s3 = mergestruct(s1, s2, emptymeaningful) + + See also PRINTSTRUCT, APPENDSTRUCT, COPYFIELDS, KEEPFIELDS, REMOVEFIELDS, MERGETABLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/mergestruct.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mergestruct", *args, **kwargs) diff --git a/fieldtrip/_mergetable.py b/fieldtrip/_mergetable.py new file mode 100644 index 0000000..af94c19 --- /dev/null +++ b/fieldtrip/_mergetable.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _mergetable(*args, **kwargs): + """ + MERGETABLE merges two tables where the rows and columns can be partially + overlapping or different. Values from the 2nd input have precedence in case the + same row and column is also present in the 1st. + + Use as + t3 = mergetable(t1, t2) + or + t3 = mergetable(t1, t2, key) + + See also MERGESTRUCT, JOIN, INNERJOIN, OUTERJOIN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/mergetable.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mergetable", *args, **kwargs) diff --git a/fieldtrip/_mesh2edge.py b/fieldtrip/_mesh2edge.py new file mode 100644 index 0000000..64ef111 --- /dev/null +++ b/fieldtrip/_mesh2edge.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _mesh2edge(*args, **kwargs): + """ + MESH2EDGE finds the edge lines from a triangulated mesh or the edge + surfaces from a tetrahedral or hexahedral mesh. An edge is defined as an + element that does not border any other element. This also implies that a + closed triangulated surface has no edges. + + Use as + [edge] = mesh2edge(mesh) + + See also POLY2TRI, TRI2BND + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/mesh2edge.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh2edge", *args, **kwargs) diff --git a/fieldtrip/_mesh_icosahedron.py b/fieldtrip/_mesh_icosahedron.py new file mode 100644 index 0000000..bfdb8d6 --- /dev/null +++ b/fieldtrip/_mesh_icosahedron.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_icosahedron(*args, **kwargs): + """ + MESH_ICOSAHEDRON returns the vertices and triangle of a 12-vertex icosahedral + mesh. + + Use as + [pos, tri] = mesh_icosahedron + + See also MESH_TETRAHEDRON, MESH_OCTAHEDRON, MESH_SPHERE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/mesh_icosahedron.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_icosahedron", *args, **kwargs) diff --git a/fieldtrip/_mesh_laplacian.py b/fieldtrip/_mesh_laplacian.py new file mode 100644 index 0000000..8473f91 --- /dev/null +++ b/fieldtrip/_mesh_laplacian.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_laplacian(*args, **kwargs): + """ + MESH_LAPLACIAN: Laplacian of irregular triangular mesh + + Useage: [lap,edge] = mesh_laplacian(vertex,face) + + Returns 'lap', the Laplacian (2nd spatial derivative) of an + irregular triangular mesh, and 'edge', the linear distances + between vertices of 'face'. 'lap' and 'edge' are square, + [Nvertices,Nvertices] in size, sparse in nature. + + It is assumed that 'vertex' contains the (x,y,z) Cartesian + coordinates of each vertex and that 'face' contains the + triangulation of vertex with indices into 'vertex' that + are numbered from 1:Nvertices. For information about + triangulation, see 'help convhull' or 'help convhulln'. + + The neighbouring vertices of vertex 'i' is given by: + + k = find(edge(i,:)); + + The math of this routine is given by: + + Oostendorp, Oosterom & Huiskamp (1989), + Interpolation on a triangulated 3D surface. + Journal of Computational Physics, 80: 331-343. + + See also EEG_INTERP_SCALP_MESH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/mesh_laplacian.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_laplacian", *args, **kwargs) diff --git a/fieldtrip/_mesh_octahedron.py b/fieldtrip/_mesh_octahedron.py new file mode 100644 index 0000000..3f7ef2c --- /dev/null +++ b/fieldtrip/_mesh_octahedron.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_octahedron(*args, **kwargs): + """ + MESH_OCTAHEDRON returns the vertices and triangles of an octahedron + + Use as + [pos tri] = mesh_octahedron; + + See also MESH_TETRAHEDRON, MESH_OCTAHEDRON, MESH_SPHERE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/mesh_octahedron.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_octahedron", *args, **kwargs) diff --git a/fieldtrip/_mesh_sphere.py b/fieldtrip/_mesh_sphere.py new file mode 100644 index 0000000..5ccec45 --- /dev/null +++ b/fieldtrip/_mesh_sphere.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_sphere(*args, **kwargs): + """ + MESH_SPHERE creates spherical mesh, with approximately nvertices vertices + + Use as + [pos, tri] = mesh_sphere(n, method) + + The input parameter 'n' specifies the (approximate) number of vertices. If n is + empty, or undefined, a 12 vertex icosahedron will be returned. If n is specified + but the method is not specified, the most optimal method will be selected based on + n. + - If log4((n-2)/10) is an integer, the mesh will be based on an icosahedron. + - If log4((n-2)/4) is an integer, the mesh will be based on a refined octahedron. + - If log4((n-2)/2) is an integer, the mesh will be based on a refined tetrahedron. + - Otherwise, an msphere will be used. + + The input parameter 'method' defines which algorithm or approach to use. This can + be 'icosahedron', 'octahedron', 'tetrahedron', 'fibonachi', 'msphere', or 'ksphere'. + + See also MESH_TETRAHEDRON, MESH_OCTAHEDRON, MESH_ICOSAHEDRON + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/mesh_sphere.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_sphere", *args, **kwargs) diff --git a/fieldtrip/_mesh_spherify.py b/fieldtrip/_mesh_spherify.py new file mode 100644 index 0000000..b57eaa7 --- /dev/null +++ b/fieldtrip/_mesh_spherify.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_spherify(*args, **kwargs): + """ + Takes a cortical mesh and scales it so that it fits into a + unit sphere. + + This function determines the points of the original mesh that support a + convex hull and determines the radius of those points. Subsequently the + radius of the support points is interpolated onto all vertices of the + original mesh, and the vertices of the original mesh are scaled by + dividing them by this interpolated radius. + + Use as + [pnt, tri] = mesh_spherify(pnt, tri, ...) + + Optional arguments should come as key-value pairs and may include + shift = 'no', mean', 'range' + smooth = number (default = 20) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/mesh_spherify.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_spherify", *args, **kwargs) diff --git a/fieldtrip/_mesh_tetrahedron.py b/fieldtrip/_mesh_tetrahedron.py new file mode 100644 index 0000000..4f8cfdc --- /dev/null +++ b/fieldtrip/_mesh_tetrahedron.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _mesh_tetrahedron(*args, **kwargs): + """ + MESH_TETRAHEDRON returns the vertices and triangles of a tetrahedron. + + Use as + [pos, tri] = mesh_tetrahedron; + + See also MESH_ICOSAHEDRON, MESH_OCTAHEDRON, MESH_SPHERE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/mesh_tetrahedron.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mesh_tetrahedron", *args, **kwargs) diff --git a/fieldtrip/_mni2tal.py b/fieldtrip/_mni2tal.py new file mode 100644 index 0000000..e0cd5d0 --- /dev/null +++ b/fieldtrip/_mni2tal.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _mni2tal(*args, **kwargs): + """ + Converts coordinates from MNI brain to best guess + for equivalent Talairach coordinates + FORMAT outpoints = mni2tal(inpoints) + Where inpoints is N by 3 or 3 by N matrix of coordinates + (N being the number of points) + outpoints is the coordinate matrix with Talairach points + Matthew Brett 10/8/99 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/mni2tal.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mni2tal", *args, **kwargs) diff --git a/fieldtrip/_mollify.py b/fieldtrip/_mollify.py new file mode 100644 index 0000000..973fb54 --- /dev/null +++ b/fieldtrip/_mollify.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _mollify(*args, **kwargs): + """ + This function does something + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/mollify.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mollify", *args, **kwargs) diff --git a/fieldtrip/_moviefunction.py b/fieldtrip/_moviefunction.py new file mode 100644 index 0000000..e8fee99 --- /dev/null +++ b/fieldtrip/_moviefunction.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _moviefunction(*args, **kwargs): + """ + we need cfg.plotfun to plot the data + data needs to be 3D, N x time x freq (last can be singleton) + N needs to correspond to number of vertices (channels, gridpoints, etc) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/moviefunction.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("moviefunction", *args, **kwargs, nargout=0) diff --git a/fieldtrip/_mplgndr.py b/fieldtrip/_mplgndr.py new file mode 100644 index 0000000..2797c3a --- /dev/null +++ b/fieldtrip/_mplgndr.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _mplgndr(*args, **kwargs): + """ + MPLGNDR associated Legendre functions + + y = mplgndr(n,k,x) computes the values of the associated Legendre + functions of order K up to degree N. + + The input x can be a matrix, and the result is of size numel(x) by N+1. + The i-th column is the associated Legendre function of order K and + degree i-1. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/mplgndr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mplgndr", *args, **kwargs) diff --git a/fieldtrip/_mtimes2x2.py b/fieldtrip/_mtimes2x2.py new file mode 100644 index 0000000..cfb3b3e --- /dev/null +++ b/fieldtrip/_mtimes2x2.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _mtimes2x2(*args, **kwargs): + """ + MTIMES2X2 compute x*y where the dimensionatity is 2x2xN or 2x2xNxM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/mtimes2x2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mtimes2x2", *args, **kwargs) diff --git a/fieldtrip/_mtimes3x3.py b/fieldtrip/_mtimes3x3.py new file mode 100644 index 0000000..9a6c04b --- /dev/null +++ b/fieldtrip/_mtimes3x3.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _mtimes3x3(*args, **kwargs): + """ + MTIMES3X3 compute x*y where the dimensionatity is 3x3xN or 3x3xNxM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/mtimes3x3.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mtimes3x3", *args, **kwargs) diff --git a/fieldtrip/_multivariate_decomp.py b/fieldtrip/_multivariate_decomp.py new file mode 100644 index 0000000..ec801bf --- /dev/null +++ b/fieldtrip/_multivariate_decomp.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def _multivariate_decomp(*args, **kwargs): + """ + MULTIVARIATE_DECOMP does a linear decomposition of multivariate time series, + based on the covariance matrix. + + Use as: + [E, D] = multivariate_decomp(C,x,y,method) + + Input arguments: + C = covariance matrix (or csd) between input time series + x = list of indices corresponding to group 1 + y = list of indices corresponding to group 2 + method = 'cca', or 'pls', 'mlr', decomposition method + (canonical correlation partial least squares, or multivariate + linear regression). In the case of mlr-like decompositions, + the indices for x reflect the independent variable) + realflag = true (default) or false. Do the operation on the real part + of the matrix if the input matrix is complex-valued + fastflag = true (default) or false. Compute the solution without an + eigenvalue decomposition (only when numel(x)==1) + + The implementation is based on Borga 2001, Canonical correlation, a + tutorial (can be found online). + + Output arguments: + E = projection matrix (not necessarily normalized). to get the orientation, + do orix = E(x,1)./norm(E(x,1)), and oriy = E(y,1)./norm(E(y,1)); + D = diagonal matrix with eigenvalues + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/multivariate_decomp.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("multivariate_decomp", *args, **kwargs) diff --git a/fieldtrip/_mutexunlock.py b/fieldtrip/_mutexunlock.py new file mode 100644 index 0000000..0cef345 --- /dev/null +++ b/fieldtrip/_mutexunlock.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _mutexunlock(*args, **kwargs): + """ + MUTEXUNLOCK removes a lockfile + + Use as + mutexunlock(lockfile) + + See also MUTEXLOCK and http://en.wikipedia.org/wiki/Mutual_exclusion + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/mutexunlock.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mutexunlock", *args, **kwargs, nargout=0) diff --git a/fieldtrip/_mxDeserialize.py b/fieldtrip/_mxDeserialize.py new file mode 100644 index 0000000..68a195c --- /dev/null +++ b/fieldtrip/_mxDeserialize.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _mxDeserialize(*args, **kwargs): + """ + MXDESERIALIZE reconstructs a MATLAB object from a uint8 array suitable + for passing down a comms channel to be reconstructed at the other end. + + See also MXSERIALIZE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/mxDeserialize.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mxDeserialize", *args, **kwargs) diff --git a/fieldtrip/_mxSerialize.py b/fieldtrip/_mxSerialize.py new file mode 100644 index 0000000..eb9bb69 --- /dev/null +++ b/fieldtrip/_mxSerialize.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _mxSerialize(*args, **kwargs): + """ + MXSERIALIZE converts any MATLAB object into a uint8 array suitable + for passing down a comms channel to be reconstructed at the other end. + + See also MXDESERIALIZE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/mxSerialize.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("mxSerialize", *args, **kwargs) diff --git a/fieldtrip/_ndgrid.py b/fieldtrip/_ndgrid.py new file mode 100644 index 0000000..290e1c4 --- /dev/null +++ b/fieldtrip/_ndgrid.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def _ndgrid(*args, **kwargs): + """ + NDGRID Generation of arrays for N-D functions and interpolation. + [X1,X2,X3,...] = NDGRID(x1,x2,x3,...) transforms the domain + specified by vectors x1,x2,x3, etc. into arrays X1,X2,X3, etc. that + can be used for the evaluation of functions of N variables and N-D + interpolation. The i-th dimension of the output array Xi are copies + of elements of the vector xi. + + [X1,X2,...] = NDGRID(x) is the same as [X1,X2,...] = NDGRID(x,x,...). + + For example, to evaluate the function x2*exp(-x1^2-x2^2-x^3) over the + range -2 < x1 < 2, -2 < x2 < 2, -2 < x3 < 2, + + [x1,x2,x3] = ndgrid(-2:.2:2, -2:.25:2, -2:.16:2); + z = x2 .* exp(-x1.^2 - x2.^2 - x3.^2); + slice(x2,x1,x3,z,[-1.2 .8 2],2,[-2 -.2]) + + NDGRID is like MESHGRID except that the order of the first two input + arguments are switched (i.e., [X1,X2,X3] = NDGRID(x1,x2,x3) produces + the same result as [X2,X1,X3] = MESHGRID(x2,x1,x3)). Because of + this, NDGRID is better suited to N-D problems that aren't spatially + based, while MESHGRID is better suited to problems in cartesian + space (2-D or 3-D). + + This is a drop-in replacement for the MATLAB version in elmat, which is + relatively slow for big grids. Note that this function only works up + to 5 dimensions + + See also MESHGRID, INTERPN. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/ndgrid.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ndgrid", *args, **kwargs) diff --git a/fieldtrip/_nex_cont.py b/fieldtrip/_nex_cont.py new file mode 100644 index 0000000..fa0c44f --- /dev/null +++ b/fieldtrip/_nex_cont.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _nex_cont(*args, **kwargs): + """ + nex_cont(filename, varname): Read continuous variable from a .nex file + + [adfreq, n, ts, fn, d] = nex_cont(filename, varname) + + INPUT: + filename - if empty string, will use File Open dialog + varname - variable name + + continuous (a/d) data come in fragments. Each fragment has a timestamp + and a number of a/d data points. The timestamp corresponds to + the time of recording of the first a/d value in this fragment. + All the data values stored in the vector d. + OUTPUT: + n - total number of data points + ts - array of fragment timestamps (one timestamp for fragment, in seconds) + fn - number of data points in each fragment + d - array of a/d values (in millivolts) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/nex_cont.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nex_cont", *args, **kwargs) diff --git a/fieldtrip/_nex_info.py b/fieldtrip/_nex_info.py new file mode 100644 index 0000000..e2012f5 --- /dev/null +++ b/fieldtrip/_nex_info.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _nex_info(*args, **kwargs): + """ + nex_info(filename) -- read and display .nex file info + + [nvar, names, types] = nex_info(filename) + + INPUT: + filename - if empty string, will use File Open dialog + OUTPUT: + nvar - number of variables in the file + names - [nvar 64] array of variable names + types - [1 nvar] array of variable types + Interpretation of type values: 0-neuron, 1-event, 2-interval, 3-waveform, + 4-population vector, 5-continuous variable, 6 - marker + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/nex_info.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nex_info", *args, **kwargs) diff --git a/fieldtrip/_nex_int.py b/fieldtrip/_nex_int.py new file mode 100644 index 0000000..c534fec --- /dev/null +++ b/fieldtrip/_nex_int.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _nex_int(*args, **kwargs): + """ + nex_int(filename, varname): Read interval variable from a .nex file + + [n, ts_left, ts_right] = nex_int(filename, varname) + + INPUT: + filename - if empty string, will use File Open dialog + varname - variable name + OUTPUT: + n - number of intervals + ts_left - array of left ends of the intervals (in seconds) + ts_right - array of right ends of the intervals (in seconds) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/nex_int.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nex_int", *args, **kwargs) diff --git a/fieldtrip/_nex_marker.py b/fieldtrip/_nex_marker.py new file mode 100644 index 0000000..64fb9ba --- /dev/null +++ b/fieldtrip/_nex_marker.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def _nex_marker(*args, **kwargs): + """ + nex_marker(filename, varname): Read a marker variable from a .nex file + + [n, nm, nl, ts, names, m] = nex_marker(filename, varname) + + INPUT: + filename - if empty string, will use File Open dialog + varname - variable name + + continuous (a/d) data come in fragments. Each fragment has a timestamp + and a number of a/d data points. The timestamp corresponds to + the time of recording of the first a/d value in this fragment. + All the data values stored in the vector d. + OUTPUT: + n - number of markers + nm - number of fields in each marker + nl - number of characters in each marker field + ts - array of marker timestamps (in seconds) + names - names of marker fields ([nm 64] character array) + m - character array of marker values [n nl nm] + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/nex_marker.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nex_marker", *args, **kwargs) diff --git a/fieldtrip/_nex_ts.py b/fieldtrip/_nex_ts.py new file mode 100644 index 0000000..f66eff8 --- /dev/null +++ b/fieldtrip/_nex_ts.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _nex_ts(*args, **kwargs): + """ + nex_ts(filename, varname): Read timestamps from a .nex file + + [n, ts] = nex_ts(filename, varname) + + INPUT: + filename - if empty string, will use File Open dialog + varname - variable name + OUTPUT: + n - number of timestamps + ts - array of timestamps (in seconds) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/nex_ts.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nex_ts", *args, **kwargs) diff --git a/fieldtrip/_nex_wf.py b/fieldtrip/_nex_wf.py new file mode 100644 index 0000000..c0f55dd --- /dev/null +++ b/fieldtrip/_nex_wf.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _nex_wf(*args, **kwargs): + """ + nex_wf(filename, varname): Read waveform variable from a .nex file + + [adfreq, n, ts, nf, w] = nex_wf(filename, varname) + + INPUT: + filename - if empty string, will use File Open dialog + varname - variable name + + + OUTPUT: + n - number of waveforms + ts - array of waveform timestamps (in seconds) + nf - number of data points in each waveform + w - matrix of waveform a/d values [n nf] (in millivolts) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/nex_wf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nex_wf", *args, **kwargs) diff --git a/fieldtrip/_nimh2grad.py b/fieldtrip/_nimh2grad.py new file mode 100644 index 0000000..d31862e --- /dev/null +++ b/fieldtrip/_nimh2grad.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _nimh2grad(*args, **kwargs): + """ + NIMH2GRAD constructs a gradiometer definition from the res4 header whish + is read using the NIMH implementation of ctf_read_res4. The grad + structure is compatible with FieldTrip and Robert Oostenveld's low-level + forward and inverse routines. + + Use as + hdr = ctf_read_res4(dataset); + grad = nimh2grad(hdr; + + See also CTF2GRAD, FIF2GRAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/nimh2grad.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nimh2grad", *args, **kwargs) diff --git a/fieldtrip/_notchfilter.py b/fieldtrip/_notchfilter.py new file mode 100644 index 0000000..9f8bde5 --- /dev/null +++ b/fieldtrip/_notchfilter.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _notchfilter(*args, **kwargs): + """ + NOTCHFILTER line noise reduction filter for EEG/MEG data + + [filt] = notchfilter(dat, Fsample, Fline) + + where + dat data matrix (Nchans X Ntime) + Fsample sampling frequency in Hz + Fline line noise frequency (would normally be 50Hz) + N optional filter order, default is 4 + + if Fline is specified as 50, a band of 48-52 is filtered out + if Fline is specified as [low high], that band is filtered out + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/notchfilter.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("notchfilter", *args, **kwargs) diff --git a/fieldtrip/_offset2time.py b/fieldtrip/_offset2time.py new file mode 100644 index 0000000..b0757b0 --- /dev/null +++ b/fieldtrip/_offset2time.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _offset2time(*args, **kwargs): + """ + OFFSET2TIME converts the offset of a trial definition into a time-axis + according to the definition from DEFINETRIAL + + Use as + [time] = offset2time(offset, fsample, nsamples) + + The trialdefinition "trl" is an Nx3 matrix. The first column contains + the sample-indices of the begin of the trial relative to the begin + of the raw data , the second column contains the sample_indices of + the end of the trials, and the third column contains the offset of + the trigger with respect to the trial. An offset of 0 means that + the first sample of the trial corresponds to the trigger. A positive + offset indicates that the first sample is later than the trigger, a + negative offset indicates a trial beginning before the trigger. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/offset2time.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("offset2time", *args, **kwargs) diff --git a/fieldtrip/_open_figure.py b/fieldtrip/_open_figure.py new file mode 100644 index 0000000..6889516 --- /dev/null +++ b/fieldtrip/_open_figure.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _open_figure(*args, **kwargs): + """ + OPEN_FIGURE is a helper function to open a figure with some specific settings + consistent over all FieldTrip functions that do plotting and/or that show a + graphical user interface. + + See also GCA, GCF, GROOT, + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/open_figure.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("open_figure", *args, **kwargs) diff --git a/fieldtrip/_openedf.py b/fieldtrip/_openedf.py new file mode 100644 index 0000000..7e5960e --- /dev/null +++ b/fieldtrip/_openedf.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _openedf(*args, **kwargs): + """ + EDF=openedf(FILENAME) + Opens an EDF File (European Data Format for Biosignals) in MATLAB (R) + About EDF + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/openedf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("openedf", *args, **kwargs) diff --git a/fieldtrip/_opto2homer.py b/fieldtrip/_opto2homer.py new file mode 100644 index 0000000..ef764e7 --- /dev/null +++ b/fieldtrip/_opto2homer.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def _opto2homer(*args, **kwargs): + """ + OPTO2HOMER constructs a Homer-compatible sensor definition (SD) from a FieldTrip + opto structure. + + See https://www.nitrc.org/plugins/mwiki/index.php/homer2:Homer_Input_Files#NIRS_data_file_format + + The Homer SD structure contains the source/detector geometry and has the following fields: + + nSrcs - Number of lasers; scalar variable + nDets - Number of detectors; scalar variable + SrcPos - Array of probe coordinates of the lasers; dimensions by 3 + DetPos - Array of probe coordinates of the detectors; dimensions by 3 + Lambda - Wavelengths used for data acquisition; dimensions by 1 + MeasList - List of source/detector/wavelength measurement channels. It’s an array with dimensions, by 4.The meaning of the 4 columns are as follows: + Column 1 index of the source from the SD.SrcPos list. + Column 2 index of the detector from the SD.DetPos list. + Column 3 is unused right now and contains all ones. + Column 4 index of the wavelength from SD.Lambda. + + The FieldTrip optode structure is defined in FT_DATATYPE_SENS + + See also HOMER2OPTO, FT_DATATYPE_SENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/opto2homer.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("opto2homer", *args, **kwargs) diff --git a/fieldtrip/_parameterselection.py b/fieldtrip/_parameterselection.py new file mode 100644 index 0000000..83be2d2 --- /dev/null +++ b/fieldtrip/_parameterselection.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _parameterselection(*args, **kwargs): + """ + PARAMETERSELECTION selects the parameters that are present as a volume in the data + add that have a dimension that is compatible with the specified dimensions of the + volume, i.e. either as a vector or as a 3D volume. + + Use as + [select] = parameterselection(param, data) + where + param cell-array, or single string, can be 'all' + data structure with anatomical or functional data + select returns the selected parameters as a cell-array + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/parameterselection.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("parameterselection", *args, **kwargs) diff --git a/fieldtrip/_parsekeyboardevent.py b/fieldtrip/_parsekeyboardevent.py new file mode 100644 index 0000000..91becff --- /dev/null +++ b/fieldtrip/_parsekeyboardevent.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _parsekeyboardevent(*args, **kwargs): + """ + PARSEKEYBOARDEVENT handles keyboard events for Windows, Mac OSX and Linux systems. + + shift+numpad number does not work on UNIX, since the shift modifier is always sent for numpad events + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/parsekeyboardevent.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("parsekeyboardevent", *args, **kwargs) diff --git a/fieldtrip/_patchsvd.py b/fieldtrip/_patchsvd.py new file mode 100644 index 0000000..02959f4 --- /dev/null +++ b/fieldtrip/_patchsvd.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def _patchsvd(*args, **kwargs): + """ + PATCHSVD computes a linear basis to span the leadfield for a defined patch + of the source space. It is called by FT_PREPARE_LEADFIELD. This function + was originally written to do something like Limpiti et al. + IEEE trans biomed eng 2006;53(9);1740-54, i.e. to create a linear basis + to span the leadfield for a patch of cortex, based on an SVD. It now also + implements the procedure to compute a (spatial basis) for a ROI's + leadfield, e.g. as per Backus et al. DOI:10.1016/j.cub.2015.12.048. + + Supported cfg options are: + cfg.patchsvd = 'yes', or a scalar. The scalar value is to support old + behavior, in which case it is treated as a distance to + define the inclusion of dipoles to define the patch + cfg.patchsvdnum = scalar, integer number or percentage, defining the + number of spatial components per patch, or the total + amount of 'spatial variance' explained by the the + patch' basis. Default is 5. + cfg.atlas = a specification of an atlas to be used for the + definition of the patches + + cfg.parcellation = string, name of the atlas field that is used for the + parcel labels. (default = []) + cfg.parcel = string, or cell-array of strings, specifying for which + parcels to return the output. (default = 'all') + + See also FT_VIRTUALCHANNEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/patchsvd.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("patchsvd", *args, **kwargs) diff --git a/fieldtrip/_peakdetect2.py b/fieldtrip/_peakdetect2.py new file mode 100644 index 0000000..45e5924 --- /dev/null +++ b/fieldtrip/_peakdetect2.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _peakdetect2(*args, **kwargs): + """ + PEAKDETECT2 detects peaks above a certain threshold in single-channel data + + Use as + [pindx, pval] = peakdetect(signal, min, mindist) + + mindist is optional, default is 1 + + See also PEAKDETECT, PEAKDETECT3 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/peakdetect2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("peakdetect2", *args, **kwargs) diff --git a/fieldtrip/_peakdetect3.py b/fieldtrip/_peakdetect3.py new file mode 100644 index 0000000..0c6765c --- /dev/null +++ b/fieldtrip/_peakdetect3.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _peakdetect3(*args, **kwargs): + """ + PEAKDETECT3 detects peaks above a certain threshold in single-channel data + + Use as + [pindx, pval] = peakdetect3(dat, threshold, mindist) + + See also PEAKDETECT, PEAKDETECT2 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/peakdetect3.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("peakdetect3", *args, **kwargs) diff --git a/fieldtrip/_pinvNx2.py b/fieldtrip/_pinvNx2.py new file mode 100644 index 0000000..eb297e1 --- /dev/null +++ b/fieldtrip/_pinvNx2.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _pinvNx2(*args, **kwargs): + """ + PINVNX2 computes a pseudo-inverse of the M slices of an MxNx2 real-valued matrix. + Output has dimensionality Mx2xN. This implementation is generally faster + than calling pinv in a for-loop, once M > 2 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/pinvNx2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("pinvNx2", *args, **kwargs) diff --git a/fieldtrip/_plgndr.py b/fieldtrip/_plgndr.py new file mode 100644 index 0000000..cfe3697 --- /dev/null +++ b/fieldtrip/_plgndr.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _plgndr(*args, **kwargs): + """ + PLGNDR associated Legendre function + + y = plgndr(n,k,x) computes the values of the associated Legendre functions + of degree N and order K + + implemented as MEX file + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/plgndr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("plgndr", *args, **kwargs) diff --git a/fieldtrip/_plinprojn.py b/fieldtrip/_plinprojn.py new file mode 100644 index 0000000..1af1cd8 --- /dev/null +++ b/fieldtrip/_plinprojn.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _plinprojn(*args, **kwargs): + """ + PLINPROJN projects a point onto a line or linepiece + + [proj, dist] = plinprojn(l1, l2, r, flag) + + where l1 and l2 are Nx3 matrices with the begin and endpoints of the linepieces, + and r is the point that is projected onto the lines + This is a vectorized version of Robert's plinproj function and is + generally faster than a for-loop around the mex-file. + + the optional flag can be: + 0 (default) project the point anywhere on the complete line + 1 project the point within or on the edge of the linepiece + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/plinprojn.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("plinprojn", *args, **kwargs) diff --git a/fieldtrip/_pntdist.py b/fieldtrip/_pntdist.py new file mode 100644 index 0000000..8f43c0b --- /dev/null +++ b/fieldtrip/_pntdist.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _pntdist(*args, **kwargs): + """ + PNTDIST returns the euclidian distance between two points + + [dist] = pntdist(pnt1, pnt2) + + where pnt1 and pnt2 must be Npnt x 3 + or either one can be Npnt x 1 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/pntdist.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("pntdist", *args, **kwargs) diff --git a/fieldtrip/_poly2tri.py b/fieldtrip/_poly2tri.py new file mode 100644 index 0000000..97319bd --- /dev/null +++ b/fieldtrip/_poly2tri.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _poly2tri(*args, **kwargs): + """ + POLY2TRI converts the polygons in a mesh to triangles by splitting + them in half. The input polygons should consist of 4 vertices. + Curvature is not considered and the resulting split will only be + optimal for flat polygons. + + Use as + mesh = poly2tri(mesh) + + See also MESH2EDGE, TRI2BND + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/poly2tri.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("poly2tri", *args, **kwargs) diff --git a/fieldtrip/_pos2dim.py b/fieldtrip/_pos2dim.py new file mode 100644 index 0000000..53c1298 --- /dev/null +++ b/fieldtrip/_pos2dim.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _pos2dim(*args, **kwargs): + """ + POS2DIM reconstructs the volumetric dimensions from an ordered list of + positions. + + Use as + [dim] = pos2dim(pos) + where pos is an ordered list of positions. + + The output dim is a 3-element vector which correspond to the 3D + volumetric dimensions + + See also POS2TRANSFORM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/pos2dim.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("pos2dim", *args, **kwargs) diff --git a/fieldtrip/_pos2dim3d.py b/fieldtrip/_pos2dim3d.py new file mode 100644 index 0000000..4ccba66 --- /dev/null +++ b/fieldtrip/_pos2dim3d.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _pos2dim3d(*args, **kwargs): + """ + POS2DIM3D reconstructs the volumetric dimensions from an ordered list of + positions. optionally, the original dim can be provided, and the (2:end) + elements are appended to the output. + + Use as + [dim] = pos2dim3d(pos, dimold) + where pos is an ordered list of positions and where the (optional) + dimold is a vector with the original dimensionality of the anatomical + or functional data. + + The output dim is a 1x3 or 1xN vector of which the first three elements + correspond to the 3D volumetric dimensions. + + See also POS2DIM, POS2TRANSFORM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/pos2dim3d.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("pos2dim3d", *args, **kwargs) diff --git a/fieldtrip/_pos2transform.py b/fieldtrip/_pos2transform.py new file mode 100644 index 0000000..4b22e10 --- /dev/null +++ b/fieldtrip/_pos2transform.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _pos2transform(*args, **kwargs): + """ + POS2TRANSFORM reconstructs a transformation matrix from an ordered list + of positions. + + Use as + [transform] = pos2transform(pos, dim) + where pos is an ordered list of positions that should specify a full 3D volume. + + The output transform is a 4x4 homogenous transformation matrix which transforms + from 'voxelspace' into the positions provided in the input + + See also POS2DIM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/pos2transform.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("pos2transform", *args, **kwargs) diff --git a/fieldtrip/_prepare_design.py b/fieldtrip/_prepare_design.py new file mode 100644 index 0000000..923d97a --- /dev/null +++ b/fieldtrip/_prepare_design.py @@ -0,0 +1,76 @@ +from fieldtrip._runtime import Runtime + + +def _prepare_design(*args, **kwargs): + """ + PREPARE_DESIGN makes a design matrix on the basis of the information in + cfg (i.c., cfg.statistic, cfg.ext, and an initial design in cfg.design) + and puts this design matrix in cfg.design. PREPARE_DESIGN also gives default + values for cfg.ivar, which specifies the independent variable, and cfg.uvar, + which specifies the units-of-observation. + + PREPARE_DESIGN will be called from STATISTICS_WRAPPER whenever the user + has not specified the cfg.design field. + + To construct the design matrix, PREPARE_DESIGN has to know whether + cfg.statistic is a statistic for a between- or a within-units + design. This is because, for the calculation of a statistic for a + within-units design, the unit-of-observation to which a particular + replication belongs has to be known. PREPARE_DESIGN determines the design + type (between or within) on the basis of cfg.statistic. + + The design type has implications for how the data have to be passed to + PREPARE_DESIGN: + 1. For a between-units design, by default, cfg.design is equal to the + last column of cfg.design. (If cfg.design is produced by + PREPARE_TIMEFREQDATA, and the varargin-argument of PREPARE_TIMEFREQDATA + contains one data set for every condition, then this column + contains the rank orders of these data sets.) This default + option can be overruled by cfg.ext, which contains an + external variable of order Nreplications X Nextvar. (Nextvar is the number of + external variables, and this can be larger that 1.) The order of the + replications is determined by the order of the data sets in varargin: the + replications in varargin{1} come first, followed by the replications + in varargin{2}, etc. In the case of multiple external variables, by specifying + cfg.ivar and cfg.cvar, the independent and the control variables can be specified. + + 2. For a within-units design, the default option is the following: (1) + the independent variable is equal to the last column of data.design, + and (2) the unit-variable is equal to the next-to-last column of + data.design. This default option only makes sense if the + varargin-argument of PREPARE_TIMEFREQDATA contains one data set for + every condition, and if the units in these data sets (subjects or + trials) correspond to each other. This default option can be overruled by + cfg.ext, which has order Nwcond X Nextvar or (Nunits*Nwcond) X Nextvar. + (Nwcond is the number of within-unit conditions.) The default option of + comparing all within-units conditions with each other can be overruled by + specifying 'ivar' and 'cvar'. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/prepare_design.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("prepare_design", *args, **kwargs) diff --git a/fieldtrip/_prepare_freq_matrices.py b/fieldtrip/_prepare_freq_matrices.py new file mode 100644 index 0000000..ecaa9a8 --- /dev/null +++ b/fieldtrip/_prepare_freq_matrices.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _prepare_freq_matrices(*args, **kwargs): + """ + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + SUBFUNCTION that converts a freq structure into Cf, Cr and Pr + this is used in FT_SOURCEANALYSIS + + This function returns data matrices with a channel order that is consistent + with the original channel order in the data. + + The order of the channels in the output data is according to the input cfg.channel, + which therefore must be specified as a cell-array with actual labels, not as an + input like 'all' that still needs to be interpreted by FT_CHANNELSELECTION. + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/prepare_freq_matrices.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("prepare_freq_matrices", *args, **kwargs) diff --git a/fieldtrip/_prepare_headmodel.py b/fieldtrip/_prepare_headmodel.py new file mode 100644 index 0000000..688f623 --- /dev/null +++ b/fieldtrip/_prepare_headmodel.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _prepare_headmodel(*args, **kwargs): + """ + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + SUBFUNCTION that helps to prepare the electrodes/gradiometers and the + volume conduction model. This is used in sourceanalysis and dipolefitting. + + This function will get the gradiometer/electrode definition and the volume + conductor definition. + + Subsequently it will remove the gradiometers/electrodes that are not + present in the data. Finally it with attach the gradiometers to a + multi-sphere head model (if supplied) or attach the electrodes to + the skin surface of a BEM head model. + + This function will return the electrodes/gradiometers in an order that is + consistent with the order in cfg.channel, or - in case that is empty - in + the order of the input electrode/gradiometer definition. + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/prepare_headmodel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("prepare_headmodel", *args, **kwargs) diff --git a/fieldtrip/_prepare_mesh_cortexhull.py b/fieldtrip/_prepare_mesh_cortexhull.py new file mode 100644 index 0000000..a2e20df --- /dev/null +++ b/fieldtrip/_prepare_mesh_cortexhull.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def _prepare_mesh_cortexhull(*args, **kwargs): + """ + PREPARE_MESH_CORTEXHULL creates a mesh representing the cortex hull, i.e. + the smoothed envelope around the pial surface created by FreeSurfer + + This function relies on the FreeSurfer and iso2mesh software packages + + Configuration options: + cfg.headshape = a filename containing the pial surface computed by + FreeSurfer recon-all ('/path/to/surf/lh.pial') + cfg.fshome = FreeSurfer folder location + (default: '/Applications/freesurfer') + cfg.resolution = resolution of the volume delimited by headshape being + floodfilled by mris_fill (default: 1) + cfg.outer_surface_sphere = diameter of the sphere used by make_outer_surface + to close the sulci using morphological operations (default: 15) + cfg.smooth_steps = number of standard smoothing iterations (default: 0) + cfg.laplace_steps = number of Laplacian (non-shrinking) smoothing + iterations (default: 2000) + cfg.fixshrinkage = reduce possible shrinkage due to smoothing (default: 'no') + cfg.expansion_mm = amount in mm with which the hull is re-expanded, applies + when cfg.fixshrinkage = 'yes' (default: 'auto') + + See also FT_PREPARE_MESH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/prepare_mesh_cortexhull.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("prepare_mesh_cortexhull", *args, **kwargs) diff --git a/fieldtrip/_prepare_mesh_fittemplate.py b/fieldtrip/_prepare_mesh_fittemplate.py new file mode 100644 index 0000000..580f569 --- /dev/null +++ b/fieldtrip/_prepare_mesh_fittemplate.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _prepare_mesh_fittemplate(*args, **kwargs): + """ + PREPARE_MESH_FITTEMPLATE computes an affine transformation matrix between 2 point clouds + + This function relies on cpd toolbox from Myronenko, see https://sites.google.com/site/myronenko/research/cpd + + See also FT_PREPARE_MESH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/prepare_mesh_fittemplate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("prepare_mesh_fittemplate", *args, **kwargs) diff --git a/fieldtrip/_prepare_mesh_headshape.py b/fieldtrip/_prepare_mesh_headshape.py new file mode 100644 index 0000000..e494a78 --- /dev/null +++ b/fieldtrip/_prepare_mesh_headshape.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _prepare_mesh_headshape(*args, **kwargs): + """ + PREPARE_MESH_HEADSHAPE + + Configuration options should include + cfg.headshape = a filename containing headshape, a Nx3 matrix with surface + points, or a structure with a single or multiple boundaries + cfg.smooth = a scalar indicating the number of non-shrinking + smoothing iterations (default = no smoothing) + cfg.numvertices = numeric vector, should have same number of elements as the + number of tissues + + See also PREPARE_MESH_MANUAL, PREPARE_MESH_SEGMENTATION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/prepare_mesh_headshape.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("prepare_mesh_headshape", *args, **kwargs) diff --git a/fieldtrip/_prepare_mesh_hexahedral.py b/fieldtrip/_prepare_mesh_hexahedral.py new file mode 100644 index 0000000..d8b1788 --- /dev/null +++ b/fieldtrip/_prepare_mesh_hexahedral.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _prepare_mesh_hexahedral(*args, **kwargs): + """ + PREPARE_MESH_HEXAHEDRAL + + Configuration options for generating a regular 3-D grid + cfg.tissue = cell with the names of the compartments that should be meshed + cfg.shift + cfg.background + + See also PREPARE_MESH_SEGMENTATION, PREPARE_MESH_MANUAL, PREPARE_MESH_HEADSHAPE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/prepare_mesh_hexahedral.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("prepare_mesh_hexahedral", *args, **kwargs) diff --git a/fieldtrip/_prepare_mesh_manual.py b/fieldtrip/_prepare_mesh_manual.py new file mode 100644 index 0000000..e81b07b --- /dev/null +++ b/fieldtrip/_prepare_mesh_manual.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _prepare_mesh_manual(*args, **kwargs): + """ + PREPARE_MESH_MANUAL is called by PREPARE_MESH and opens a GUI to manually + select points/polygons in an mri dataset. + + It allows: + Visualization of 3d data in 3 different projections + Adjustment of brightness for every slice + Storage of the data points in an external .mat file + Retrieval of previously saved data points + Slice fast scrolling with keyboard arrows + Polygons or points selection/deselection + + See also PREPARE_MESH_SEGMENTATION, PREPARE_MESH_HEADSHAPE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/prepare_mesh_manual.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("prepare_mesh_manual", *args, **kwargs) diff --git a/fieldtrip/_prepare_mesh_segmentation.py b/fieldtrip/_prepare_mesh_segmentation.py new file mode 100644 index 0000000..91f2b3c --- /dev/null +++ b/fieldtrip/_prepare_mesh_segmentation.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _prepare_mesh_segmentation(*args, **kwargs): + """ + PREPARE_MESH_SEGMENTATION + + The following configuration options can be specified for the iso2mesh method + cfg.maxsurf = 1 = only use the largest disjointed surface + 0 = use all surfaces for that levelset + cfg.radbound = a scalar indicating the radius of the target surface + mesh element bounding sphere + + See also PREPARE_MESH_MANUAL, PREPARE_MESH_HEADSHAPE, PREPARE_MESH_HEXAHEDRAL, + PREPARE_MESH_TETRAHEDRAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/prepare_mesh_segmentation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("prepare_mesh_segmentation", *args, **kwargs) diff --git a/fieldtrip/_prepare_mesh_tetrahedral.py b/fieldtrip/_prepare_mesh_tetrahedral.py new file mode 100644 index 0000000..4239ace --- /dev/null +++ b/fieldtrip/_prepare_mesh_tetrahedral.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _prepare_mesh_tetrahedral(*args, **kwargs): + """ + PREPARE_MESH_TETRAHEDRAL + + See also PREPARE_MESH_MANUAL, PREPARE_MESH_HEADSHAPE, + PREPARE_MESH_HEXAHEDRAL, PREPARE_MESH_SEGMENTATION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/prepare_mesh_tetrahedral.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("prepare_mesh_tetrahedral", *args, **kwargs) diff --git a/fieldtrip/_prepare_resampled_data.py b/fieldtrip/_prepare_resampled_data.py new file mode 100644 index 0000000..9c9a1dc --- /dev/null +++ b/fieldtrip/_prepare_resampled_data.py @@ -0,0 +1,69 @@ +from fieldtrip._runtime import Runtime + + +def _prepare_resampled_data(*args, **kwargs): + """ + PREPARE_RESAMPLED_DATA performs resampling of the input data for + multiple variables in a single or multiple conditions. The resampling + will be performed along the first dimension of every input variable. This + function is intended to be used as subfunction for various algorithms + implemented in FieldTrip. + + Supported resampling strategies are + jackknife for one condition + bootstrap for one condition + permutation for two conditions + resampling for two or more conditions + You can also specify that you do not want any resampling, in which case + only the average over the original data will be computed. + + Use as + [cfg, varargout] = prepare_resampled_data(cfg, varargin) + where the configuration can contain + cfg.jackknife = 'yes' or 'no' + cfg.bootstrap = 'yes' or 'no' + cfg.pseudovalue = 'yes' or 'no' + cfg.randomization = 'yes' or 'no' + cfg.permutation = 'yes' or 'no' + cfg.numbootstrap = number + cfg.numrandomization = number + cfg.numpermutation = number, or 'all' + and the input and output data is orgainzed according to the examples below. + + for N data objects in one condition + [cfg, r1, r2 ... rN] = prepare_resampled_data(cfg, o1, o2 ... oN) + + for N data objects in two conditions + [cfg, r11 ... r1N, r21 ... rN] = prepare_resampled_data(cfg, o11 ... o1N, o21 ... o2N) + + for multiple data objects in three conditions + [cfg, r11..., r21 ..., r31 ...] = prepare_resampled_data(cfg, o11 ..., o21 ..., o31 ...); + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/prepare_resampled_data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("prepare_resampled_data", *args, **kwargs) diff --git a/fieldtrip/_preproc.py b/fieldtrip/_preproc.py new file mode 100644 index 0000000..6a72873 --- /dev/null +++ b/fieldtrip/_preproc.py @@ -0,0 +1,146 @@ +from fieldtrip._runtime import Runtime + + +def _preproc(*args, **kwargs): + """ + PREPROC applies various preprocessing steps on a single piece of EEG/MEG data + that has been read from a data file. + + This low-level function serves as a subfunction for all FieldTrip modules that want + to preprocess the data, such as FT_PREPROCESSING, FT_ARTIFACT_XXX, + FT_TIMELOCKANALYSIS, etc. It ensures consistent handling of both MEG and EEG data + and consistency in the use of all preprocessing configuration options. + + Use as + [dat, label, time, cfg] = preproc(dat, label, time, cfg, begpadding, endpadding) + + The required input arguments are + dat Nchan x Ntime data matrix + label Nchan x 1 cell-array with channel labels + time Ntime x 1 vector with the latency in seconds + cfg configuration structure, see below + and the optional input arguments are + begpadding number of samples that was used for padding (see below) + endpadding number of samples that was used for padding (see below) + + The output is + dat Nchan x Ntime data matrix + label Nchan x 1 cell-array with channel labels + time Ntime x 1 vector with the latency in seconds + cfg configuration structure, optionally with extra defaults set + + Note that the number of input channels and the number of output channels can be + different, for example when the user specifies that he/she wants to add the + implicit EEG reference channel to the data matrix. + + The filtering of the data can introduce artifacts at the edges, hence it is better + to pad the data with some extra signal at the begin and end. After filtering, this + padding is removed and the other preprocessing steps are applied to the remainder + of the data. The input fields begpadding and endpadding should be specified in + samples. You can also leave them empty, which implies that the data is not padded. + + The configuration can contain + cfg.lpfilter = 'no' or 'yes' lowpass filter + cfg.hpfilter = 'no' or 'yes' highpass filter + cfg.bpfilter = 'no' or 'yes' bandpass filter + cfg.bsfilter = 'no' or 'yes' bandstop filter + cfg.dftfilter = 'no' or 'yes' line noise removal using discrete fourier transform + cfg.medianfilter = 'no' or 'yes' jump preserving median filter + cfg.lpfreq = lowpass frequency in Hz + cfg.hpfreq = highpass frequency in Hz + cfg.bpfreq = bandpass frequency range, specified as [low high] in Hz + cfg.bsfreq = bandstop frequency range, specified as [low high] in Hz + cfg.dftfreq = line noise frequencies for DFT filter, default [50 100 150] Hz + cfg.lpfiltord = lowpass filter order (default set in low-level function) + cfg.hpfiltord = highpass filter order (default set in low-level function) + cfg.bpfiltord = bandpass filter order (default set in low-level function) + cfg.bsfiltord = bandstop filter order (default set in low-level function) + cfg.medianfiltord = length of median filter + cfg.lpfilttype = digital filter type, 'but' (default) or 'firws' or 'fir' or 'firls' + cfg.hpfilttype = digital filter type, 'but' (default) or 'firws' or 'fir' or 'firls' + cfg.bpfilttype = digital filter type, 'but' (default) or 'firws' or 'fir' or 'firls' + cfg.bsfilttype = digital filter type, 'but' (default) or 'firws' or 'fir' or 'firls' + cfg.lpfiltdir = filter direction, 'twopass' (default), 'onepass' or 'onepass-reverse' or 'onepass-zerophase' (default for firws) or 'onepass-minphase' (firws, non-linear!) + cfg.hpfiltdir = filter direction, 'twopass' (default), 'onepass' or 'onepass-reverse' or 'onepass-zerophase' (default for firws) or 'onepass-minphase' (firws, non-linear!) + cfg.bpfiltdir = filter direction, 'twopass' (default), 'onepass' or 'onepass-reverse' or 'onepass-zerophase' (default for firws) or 'onepass-minphase' (firws, non-linear!) + cfg.bsfiltdir = filter direction, 'twopass' (default), 'onepass' or 'onepass-reverse' or 'onepass-zerophase' (default for firws) or 'onepass-minphase' (firws, non-linear!) + cfg.lpinstabilityfix = deal with filter instability, 'no', 'reduce', 'split' (default = 'no') + cfg.hpinstabilityfix = deal with filter instability, 'no', 'reduce', 'split' (default = 'no') + cfg.bpinstabilityfix = deal with filter instability, 'no', 'reduce', 'split' (default = 'no') + cfg.bsinstabilityfix = deal with filter instability, 'no', 'reduce', 'split' (default = 'no') + cfg.lpfiltdf = lowpass transition width (firws, overrides order, default set in low-level function) + cfg.hpfiltdf = highpass transition width (firws, overrides order, default set in low-level function) + cfg.bpfiltdf = bandpass transition width (firws, overrides order, default set in low-level function) + cfg.bsfiltdf = bandstop transition width (firws, overrides order, default set in low-level function) + cfg.lpfiltwintype = lowpass window type, 'hann' or 'hamming' (default) or 'blackman' or 'kaiser' (firws) + cfg.hpfiltwintype = highpass window type, 'hann' or 'hamming' (default) or 'blackman' or 'kaiser' (firws) + cfg.bpfiltwintype = bandpass window type, 'hann' or 'hamming' (default) or 'blackman' or 'kaiser' (firws) + cfg.bsfiltwintype = bandstop window type, 'hann' or 'hamming' (default) or 'blackman' or 'kaiser' (firws) + cfg.lpfiltdev = lowpass max passband deviation (firws with 'kaiser' window, default 0.001 set in low-level function) + cfg.hpfiltdev = highpass max passband deviation (firws with 'kaiser' window, default 0.001 set in low-level function) + cfg.bpfiltdev = bandpass max passband deviation (firws with 'kaiser' window, default 0.001 set in low-level function) + cfg.bsfiltdev = bandstop max passband deviation (firws with 'kaiser' window, default 0.001 set in low-level function) + cfg.dftreplace = 'zero' or 'neighbour', method used to reduce line noise, 'zero' implies DFT filter, 'neighbour' implies spectrum interpolation (default = 'zero') + cfg.dftbandwidth = bandwidth of line noise frequencies, applies to spectrum interpolation, in Hz (default = [1 2 3]) + cfg.dftneighbourwidth = bandwidth of frequencies neighbouring line noise frequencies, applies to spectrum interpolation, in Hz (default = [2 2 2]) + cfg.plotfiltresp = 'no' or 'yes', plot filter responses (firws, default = 'no') + cfg.usefftfilt = 'no' or 'yes', use fftfilt instead of filter (firws, default = 'no') + cfg.demean = 'no' or 'yes' + cfg.baselinewindow = [begin end] in seconds, the default is the complete trial + cfg.detrend = 'no' or 'yes', this is done on the complete trial + cfg.polyremoval = 'no' or 'yes', this is done on the complete trial + cfg.polyorder = polynome order (default = 2) + cfg.derivative = 'no' (default) or 'yes', computes the first order derivative of the data, using the MATLAB gradient function + cfg.hilbert = 'no', 'abs', 'complex', 'real', 'imag', 'absreal', 'absimag' or 'angle' (default = 'no') + cfg.rectify = 'no' or 'yes' + cfg.precision = 'single' or 'double' (default = 'double') + cfg.absdiff = 'no' or 'yes', computes absolute of the first order difference (i.e. first diff then rectify), using the MATLAB diff function + + Preprocessing options that you should only use for EEG data are + cfg.reref = 'no' or 'yes' (default = 'no') + cfg.refchannel = cell-array with new EEG reference channel(s) + cfg.refmethod = 'avg', 'median', 'rest', 'bipolar' or 'laplace' (default = 'avg') + cfg.groupchans = 'yes' or 'no', should channels be rereferenced in separate groups + for bipolar and laplace methods, this requires channnels to be + named using an alphanumeric code, where letters represent the + group and numbers represent the order of the channel whithin + its group (default = 'no') + cfg.leadfield = matrix or cell-array, this is required when refmethod is 'rest' + The leadfield can be a single matrix (channels X sources) which + is calculated by using the forward theory, based on the + electrode montage, head model and equivalent source model. + It can also be the output of FT_PREPARE_LEADFIELD based on a + realistic head model. + cfg.implicitref = 'label' or empty, add the implicit EEG reference as zeros (default = []) + cfg.montage = 'no' or a montage structure (default = 'no') + + See also FT_READ_DATA, FT_READ_HEADER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/preproc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("preproc", *args, **kwargs) diff --git a/fieldtrip/_print_tim.py b/fieldtrip/_print_tim.py new file mode 100644 index 0000000..b0b3bb4 --- /dev/null +++ b/fieldtrip/_print_tim.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _print_tim(*args, **kwargs): + """ + SUBFUNCTION for pretty-printing time in hours, minutes, ... + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/print_tim.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("print_tim", *args, **kwargs) diff --git a/fieldtrip/_procrustes_trans.py b/fieldtrip/_procrustes_trans.py new file mode 100644 index 0000000..647f310 --- /dev/null +++ b/fieldtrip/_procrustes_trans.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _procrustes_trans(*args, **kwargs): + """ + PROCRUSTES_TRANS returns the homogenous coordinate transformation matrix + that warps the specified input points to the target points. + + Use as + [h] = procrustes_trans(input, target) + where + input Nx3 matrix with coordinates + target Nx3 matrix with coordinates + + The algorithm used for the calculation of the rotation matrix is knonwn + as the Procrustes method. Its use for MEG coordinate transformation has + been suggested in Fuchs et al. TBME vol. 42, 1995, p. 416ff. + + See also WARP_OPTIM, HEADCOORDINATES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/procrustes_trans.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("procrustes_trans", *args, **kwargs) diff --git a/fieldtrip/_project_elec.py b/fieldtrip/_project_elec.py new file mode 100644 index 0000000..d298837 --- /dev/null +++ b/fieldtrip/_project_elec.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _project_elec(*args, **kwargs): + """ + PROJECT_ELEC projects electrodes on a triangulated surface + and returns triangle index, la/mu parameters and distance + + Use as + [el, prj] = project_elec(elc, pnt, tri) + which returns + el = Nx4 matrix with [tri, la, mu, dist] for each electrode + prj = Nx3 matrix with the projected electrode position + + See also TRANSFER_ELEC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/project_elec.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("project_elec", *args, **kwargs) diff --git a/fieldtrip/_projecttri.py b/fieldtrip/_projecttri.py new file mode 100644 index 0000000..b65c7c2 --- /dev/null +++ b/fieldtrip/_projecttri.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _projecttri(*args, **kwargs): + """ + PROJECTTRI makes a closed triangulation of a list of vertices by + projecting them onto a unit sphere and subsequently by constructing + a convex hull triangulation. + + Use as + tri = projecttri(pos, method) + where method is either 'convhull' (default) or 'delaunay'. + + See also SURFACE_NORMALS, PCNORMALS, ELPROJ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/projecttri.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("projecttri", *args, **kwargs) diff --git a/fieldtrip/_ptriproj.py b/fieldtrip/_ptriproj.py new file mode 100644 index 0000000..7e198a9 --- /dev/null +++ b/fieldtrip/_ptriproj.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _ptriproj(*args, **kwargs): + """ + PTRIPROJ projects a point onto the plane going through a triangle + + Use as + [proj, dist] = ptriproj(v1, v2, v3, r, flag) + where v1, v2 and v3 are three vertices of the triangle, and r is + the point that is projected onto the plane spanned by the vertices + + the optional flag can be: + 0 (default) project the point anywhere on the complete plane + 1 project the point within or on the edge of the triangle + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/ptriproj.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ptriproj", *args, **kwargs) diff --git a/fieldtrip/_ptriprojn.py b/fieldtrip/_ptriprojn.py new file mode 100644 index 0000000..0f79e0b --- /dev/null +++ b/fieldtrip/_ptriprojn.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _ptriprojn(*args, **kwargs): + """ + PTRIPROJN projects a point onto the plane going through a set of + triangles + + Use as + [proj, dist] = ptriprojn(v1, v2, v3, r, flag) + where v1, v2 and v3 are Nx3 matrices with vertex positions of the triangles, + and r is the point that is projected onto the planes spanned by the vertices + This is a vectorized version of Robert's ptriproj function and is + generally faster than a for-loop around the mex-file. + + the optional flag can be: + 0 (default) project the point anywhere on the complete plane + 1 project the point within or on the edge of the triangle + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/ptriprojn.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ptriprojn", *args, **kwargs) diff --git a/fieldtrip/_ptriside.py b/fieldtrip/_ptriside.py new file mode 100644 index 0000000..5b3af27 --- /dev/null +++ b/fieldtrip/_ptriside.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _ptriside(*args, **kwargs): + """ + PTRISIDE determines the side of a plane on which a set of points lie. It + returns 0 for the points that lie exactly on the plane. + + [side] = ptriside(v1, v2, v3, r) + + the side of points r is determined relative to the plane spanned by + vertices v1, v2 and v3. v1,v2 and v3 should be 1x3 vectors. r should be a + Nx3 matrix + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/ptriside.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ptriside", *args, **kwargs) diff --git a/fieldtrip/_quaternion.py b/fieldtrip/_quaternion.py new file mode 100644 index 0000000..137ed3b --- /dev/null +++ b/fieldtrip/_quaternion.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _quaternion(*args, **kwargs): + """ + QUATERNION returns the homogenous coordinate transformation matrix corresponding to + a coordinate transformation described by 7 quaternion parameters. + + Use as + [H] = quaternion(Q) + where + Q [q0, q1, q2, q3, q4, q5, q6] vector with parameters + H corresponding homogenous transformation matrix + + If the input vector has length 6, it is assumed to represent a unit quaternion without scaling. + + See Neuromag/Elekta/Megin MaxFilter manual version 2.2, section "D2 Coordinate Matching", page 77 for more details and + https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#Conversion_to_and_from_the_matrix_representation + + See also TRANSLATE, ROTATE, SCALE, HOMOGENOUS2QUATERNION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/quaternion.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("quaternion", *args, **kwargs) diff --git a/fieldtrip/_randstatprob.py b/fieldtrip/_randstatprob.py new file mode 100644 index 0000000..8c4dfbe --- /dev/null +++ b/fieldtrip/_randstatprob.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def _randstatprob(*args, **kwargs): + """ + RANDSTATPROB computes the non-parametric probability of the observed + value under the assumption that the random observations are equally + probable under the null hypothesis. + + Use as + p = randstatprob(randobs, realobs, tail, correctm) + where + randobs = Nvox x Nrnd + realobs = Nvox x 1, or Nvox x Nobs (for multiple observations) + tail = 0 for two-sided test + tail = 1 for one-sided test with realobs>=randobs + tail = -1 for one-sided test with realobs<=randobs + correctm = 0 do not correct for multiple comparisons + 1 correct for multiple comparisons using the maximum statistic + 2 correct for multiple comparisons using ordered statistics + + Each row of the input data contains all the (real or randomized) + observations in one voxel. Multiple comparison can be performed by + creating a reference distribution based on the minimum or maximum + of all voxels for each randomization. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/randstatprob.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("randstatprob", *args, **kwargs) diff --git a/fieldtrip/_raw2data.py b/fieldtrip/_raw2data.py new file mode 100644 index 0000000..9167c05 --- /dev/null +++ b/fieldtrip/_raw2data.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _raw2data(*args, **kwargs): + """ + RAW2DATA is a helper function that converts raw data to various types of + averages. This function is used to apply the analysis steps that were + written for use on preprocessed data also on averaged data. + + This function is the counterpart of DATA2RAW and is used in MEGREALIGN, MEGPLANAR, MEGREPAIR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/raw2data.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("raw2data", *args, **kwargs) diff --git a/fieldtrip/_read_besa_avr.py b/fieldtrip/_read_besa_avr.py new file mode 100644 index 0000000..059492e --- /dev/null +++ b/fieldtrip/_read_besa_avr.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _read_besa_avr(*args, **kwargs): + """ + READ_BESA_AVR reads average EEG data in BESA format + + Use as + [avr] = read_besa_avr(filename) + + This will return a structure with the header information in + avr.npnt + avr.tsb + avr.di + avr.sb + avr.sc + avr.Nchan (optional) + avr.label (optional) + and the ERP data is contained in the Nchan X Nsamples matrix + avr.data + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/read_besa_avr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_besa_avr", *args, **kwargs) diff --git a/fieldtrip/_read_besa_mul.py b/fieldtrip/_read_besa_mul.py new file mode 100644 index 0000000..3581935 --- /dev/null +++ b/fieldtrip/_read_besa_mul.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _read_besa_mul(*args, **kwargs): + """ + READ_BESA_MUL reads data from a BESA multiplexed (*.mul) file + + Use as + dat = read_besa_mul(filename); + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/read_besa_mul.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_besa_mul", *args, **kwargs) diff --git a/fieldtrip/_read_besa_src.py b/fieldtrip/_read_besa_src.py new file mode 100644 index 0000000..e52cbf4 --- /dev/null +++ b/fieldtrip/_read_besa_src.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _read_besa_src(*args, **kwargs): + """ + READ_BESA_SRC reads a beamformer source reconstruction from a BESA file + + Use as + [src] = read_besa_src(filename) + + The output structure contains a minimal representation of the contents + of the file. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/read_besa_src.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_besa_src", *args, **kwargs) diff --git a/fieldtrip/_read_besa_swf.py b/fieldtrip/_read_besa_swf.py new file mode 100644 index 0000000..7496aa7 --- /dev/null +++ b/fieldtrip/_read_besa_swf.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _read_besa_swf(*args, **kwargs): + """ + READ_BESA_SWF + + Use as + [swf] = read_besa_swf(filename) + + This will return a structure with the header information in + swf.label cell-array with labels + swf.data data matrix, Nchan X Npnts + swf.npnt + swf.tsb + swf.di + swf.sb + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/read_besa_swf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_besa_swf", *args, **kwargs) diff --git a/fieldtrip/_read_besa_tfc.py b/fieldtrip/_read_besa_tfc.py new file mode 100644 index 0000000..2b865f3 --- /dev/null +++ b/fieldtrip/_read_besa_tfc.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _read_besa_tfc(*args, **kwargs): + """ + READ_BESA_TFC imports data from a BESA *.tfc file + + Use as + [DataType, ConditionName, Channels, Time, Frequency, Data] = read_besa_tfc(FILENAME) + + This reads data from the BESA Time-Frequency-Coherence output data file + FILENAME and returns the following data: + ConditionName: name of analyzed condition + ChannelLabels: character array of channel labels + Time: array of sampled time instants + Frequency: array of sampled frequencies + Data: 3D data matrix with indices (channel,time,frequency) + Info: Struct containing additional information: + DataType: type of the exported data + ConditionName: name of analyzed condition + NumbeOfTrials: Number of trials on which the data is based + StatisticsCorrection: Type of statistics correction for multiple testing + EvokedSignalSubtraction: Type of evoked signal subtraction + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/read_besa_tfc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_besa_tfc", *args, **kwargs) diff --git a/fieldtrip/_read_ctf_hc.py b/fieldtrip/_read_ctf_hc.py new file mode 100644 index 0000000..338f116 --- /dev/null +++ b/fieldtrip/_read_ctf_hc.py @@ -0,0 +1,65 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_hc(*args, **kwargs): + """ + READ_CTF_HC reads the MEG headcoil marker positions from an ascii file + and computes the coordinate transformation required to get from from + dewar to head-coordinates + + the definition of head coordinates is according to CTF standard: + - the origin is exactly between LPA and RPA + - the positive x-axis goes throught NAS + - the positive y-axis goes (approximately) through LPA + - the positive z-axis goes up, orthogonal to the x- and y-axes + + hc = read_ctf_hc(filename) + + returns a structure with the following fields + hc.dewar.nas marker positions relative to dewar + hc.dewar.lpa + hc.dewar.rpa + hc.head.nas marker positions relative to head (measured) + hc.head.lpa + hc.head.rpa + hc.standard.nas marker positions relative to head (expected) + hc.standard.lpa + hc.standard.rpa + and + hc.affine parameter for affine transformation (1x12) + hc.homogenous homogenous transformation matrix (4x4, see warp3d) + hc.translation translation vector (1x3) + hc.rotation rotation matrix (3x3) + + Gradiometer positions can be transformed into head coordinates using the + homogeneous transformation matrix, or using the affine parameters and + the warp3d function from the WARPING toolbox + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/read_ctf_hc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_hc", *args, **kwargs) diff --git a/fieldtrip/_read_ctf_hist.py b/fieldtrip/_read_ctf_hist.py new file mode 100644 index 0000000..de92eca --- /dev/null +++ b/fieldtrip/_read_ctf_hist.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _read_ctf_hist(*args, **kwargs): + """ + READ_CTF_HIST + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/read_ctf_hist.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_ctf_hist", *args, **kwargs) diff --git a/fieldtrip/_read_imotions_txt.py b/fieldtrip/_read_imotions_txt.py new file mode 100644 index 0000000..12c1b5e --- /dev/null +++ b/fieldtrip/_read_imotions_txt.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _read_imotions_txt(*args, **kwargs): + """ + READ_IMOTIONS_TXT reads *.txt files that are exported from the iMotions software. + + Use as + dat = read_imotions_txt(filename + + See also TEXTSCAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/read_imotions_txt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_imotions_txt", *args, **kwargs) diff --git a/fieldtrip/_read_labview_dtlg.py b/fieldtrip/_read_labview_dtlg.py new file mode 100644 index 0000000..0977419 --- /dev/null +++ b/fieldtrip/_read_labview_dtlg.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _read_labview_dtlg(*args, **kwargs): + """ + READ_LABVIEW_DTLG + + Use as + dat = read_labview_dtlg(filename, datatype) + where datatype can be 'int32' or 'int16' + + The output of this function is a structure. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/read_labview_dtlg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("read_labview_dtlg", *args, **kwargs) diff --git a/fieldtrip/_refine.py b/fieldtrip/_refine.py new file mode 100644 index 0000000..73d3561 --- /dev/null +++ b/fieldtrip/_refine.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def _refine(*args, **kwargs): + """ + REFINE a 3D surface that is described by a triangulation + + Use as + [pos, tri] = refine(pos, tri) + [pos, tri] = refine(pos, tri, 'banks') + [pos, tri, texture] = refine(pos, tri, 'banks', texture) + [pos, tri] = refine(pos, tri, 'updown', numtri) + + If no method is specified, the default is to refine the mesh globally by bisecting + each edge according to the algorithm described in Banks, 1983. + + The Banks method allows the specification of a subset of triangles to be refined + according to Banks' algorithm. Adjacent triangles will be gracefully dealt with. + + The alternative 'updown' method refines the mesh a couple of times + using Banks' algorithm, followed by a downsampling using the REDUCEPATCH + function. + + If the textures of the vertices are specified, the textures for the new + vertices are computed + + The Banks method is a memory efficient implementation which remembers the + previously inserted vertices. The refinement algorithm executes in linear + time with the number of triangles. It is mentioned in + http://www.cs.rpi.edu/~flaherje/pdf/fea8.pdf, which also contains the original + reference. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/refine.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("refine", *args, **kwargs) diff --git a/fieldtrip/_regularize_in.py b/fieldtrip/_regularize_in.py new file mode 100644 index 0000000..c9efe3b --- /dev/null +++ b/fieldtrip/_regularize_in.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _regularize_in(*args, **kwargs): + """ + regularize_in is a function. + [in_removes, out_removes] = regularize_in(int_order, ext_order, S, ismag, extended_remove) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/regularize_in.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("regularize_in", *args, **kwargs) diff --git a/fieldtrip/_regularize_out.py b/fieldtrip/_regularize_out.py new file mode 100644 index 0000000..0103a6a --- /dev/null +++ b/fieldtrip/_regularize_out.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _regularize_out(*args, **kwargs): + """ + regularize_out is a function. + [out_remove] = regularize_out(int_order, ext_order, S, ismag, extended_remove) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/regularize_out.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("regularize_out", *args, **kwargs) diff --git a/fieldtrip/_rejectvisual_channel.py b/fieldtrip/_rejectvisual_channel.py new file mode 100644 index 0000000..09180b1 --- /dev/null +++ b/fieldtrip/_rejectvisual_channel.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _rejectvisual_channel(*args, **kwargs): + """ + SUBFUNCTION for ft_rejectvisual + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/rejectvisual_channel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rejectvisual_channel", *args, **kwargs) diff --git a/fieldtrip/_rejectvisual_summary.py b/fieldtrip/_rejectvisual_summary.py new file mode 100644 index 0000000..1881be8 --- /dev/null +++ b/fieldtrip/_rejectvisual_summary.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _rejectvisual_summary(*args, **kwargs): + """ + SUBFUNCTION for ft_rejectvisual + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/rejectvisual_summary.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rejectvisual_summary", *args, **kwargs) diff --git a/fieldtrip/_rejectvisual_trial.py b/fieldtrip/_rejectvisual_trial.py new file mode 100644 index 0000000..c3c064e --- /dev/null +++ b/fieldtrip/_rejectvisual_trial.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _rejectvisual_trial(*args, **kwargs): + """ + SUBFUNCTION for ft_rejectvisual + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/rejectvisual_trial.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rejectvisual_trial", *args, **kwargs) diff --git a/fieldtrip/_remove_double_vertices.py b/fieldtrip/_remove_double_vertices.py new file mode 100644 index 0000000..8a67d22 --- /dev/null +++ b/fieldtrip/_remove_double_vertices.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _remove_double_vertices(*args, **kwargs): + """ + REMOVE_DOUBLE_VERTICES removes double vertices from a triangular, tetrahedral or + hexahedral mesh, renumbering the vertex-indices for the elements. + + Use as + [pos, tri] = remove_double_vertices(pos, tri) + [pos, tet] = remove_double_vertices(pos, tet) + [pos, hex] = remove_double_vertices(pos, hex) + + See also REMOVE_VERTICES, REMOVE_UNUSED_VERTICES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/remove_double_vertices.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("remove_double_vertices", *args, **kwargs) diff --git a/fieldtrip/_remove_unused_vertices.py b/fieldtrip/_remove_unused_vertices.py new file mode 100644 index 0000000..ca9f3fd --- /dev/null +++ b/fieldtrip/_remove_unused_vertices.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _remove_unused_vertices(*args, **kwargs): + """ + REMOVE_UNUSED_VERTICES removes unused vertices from a triangular, tetrahedral or + hexahedral mesh, renumbering the vertex-indices for the elements. + + Use as + [pos, tri] = remove_unused_vertices(pos, tri) + [pos, tet] = remove_unused_vertices(pos, tet) + [pos, hex] = remove_unused_vertices(pos, hex) + + See also REMOVE_VERTICES, REMOVE_DOUBLE_VERTICES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/remove_unused_vertices.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("remove_unused_vertices", *args, **kwargs) diff --git a/fieldtrip/_remove_vertices.py b/fieldtrip/_remove_vertices.py new file mode 100644 index 0000000..f782528 --- /dev/null +++ b/fieldtrip/_remove_vertices.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _remove_vertices(*args, **kwargs): + """ + REMOVE_VERTICES removes specified indexed vertices from a triangular, tetrahedral + or hexahedral mesh renumbering the vertex-indices for the elements and removing all + resulting 'open' elements. + + Use as + [pos, tri] = remove_vertices(pos, tri, sel) + [pos, tet] = remove_vertices(pos, tet, sel) + [pos, hex] = remove_vertices(pos, hex, sel) + + See also REMOVE_DOUBLE_VERTICES, REMOVE_UNUSED_VERTICES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/remove_vertices.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("remove_vertices", *args, **kwargs) diff --git a/fieldtrip/_reorderdim.py b/fieldtrip/_reorderdim.py new file mode 100644 index 0000000..a6a217d --- /dev/null +++ b/fieldtrip/_reorderdim.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _reorderdim(*args, **kwargs): + """ + REORDERDIM reorders array A along dimension dim with the specified + indices inds. The following should output 1: + + B1 = reorderdim(A,2,[1 3 2]); + B2 = A(:,[1 3 2],:,:); + + all(B1(:) == B2(:)) + + The main use for this function is when a selection as displayed above + needs to be made when the number of dimensions of A is only known at + runtime and not at 'code'-time (i.e. when A can have arbitrary + dimensions). + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/reorderdim.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("reorderdim", *args, **kwargs) diff --git a/fieldtrip/_resampledesign.py b/fieldtrip/_resampledesign.py new file mode 100644 index 0000000..be6c17c --- /dev/null +++ b/fieldtrip/_resampledesign.py @@ -0,0 +1,79 @@ +from fieldtrip._runtime import Runtime + + +def _resampledesign(*args, **kwargs): + """ + RESAMPLEDESIGN returns a resampling matrix, in which each row can be + used to resample either the original design matrix or the original data. + The random resampling is done given user-specified constraints on the + experimental design, e.g. to swap within paired observations but not + between pairs. + + Use as + [resample] = randomizedesign(cfg, design) + where the configuration can contain + cfg.resampling = 'permutation' or 'bootstrap' + cfg.numrandomization = number (e.g. 300), can be 'all' in case of two conditions + cfg.ivar = number or list with indices, independent variable(s) + cfg.uvar = number or list with indices, unit variable(s) + cfg.wvar = number or list with indices, within-cell variable(s) + cfg.cvar = number or list with indices, control variable(s) + + The "Independent variable" codes the condition number. Since the data is + assumed to be independent from the condition number any reshuffeling of + the condition number is allowed and ivar does NOT affect the resampling + outcome. + + The "Unit of observation variable" corresponds to the subject number (in a + within-subject manipulation) or the trial number (in a within-trial + manipulation). It is best understood by considering that it corresponds + to the "pairing" of the data in a paired T-test or repeared measures + ANOVA. The uvar affects the resampling outcome in the way that only + resamplings within one unit of observation are returned (e.g. swap + conditions within a subject, not over subjects). + + The "Within-cell variable" corresponds to the grouping of the data in + cells, where the multiple observations in a groups should not be broken + apart. This for example applies to multiple tapers in a spectral estimate + of a single trial of data (the "rpttap" dimension), where different + tapers should not be shuffled separately. Another example is a blocked + fMRI design, with a different condition in each block and multiple + repetitions of the same condition within a block. Assuming that there is + a slow HRF that convolutes the trials within a block, you can shuffle the + blocks but not the individual trials in a block. + + The "Control variable" can be seen as the opposite from the within-cell + variable: it allows you to specify blocks in which the resampling should + be done, at the same time controlling that repetitions are not shuffled + between different control blocks. + + See also FT_STATISTICS_MONTECARLO + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/resampledesign.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("resampledesign", *args, **kwargs) diff --git a/fieldtrip/_retriangulate.py b/fieldtrip/_retriangulate.py new file mode 100644 index 0000000..1de694d --- /dev/null +++ b/fieldtrip/_retriangulate.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def _retriangulate(*args, **kwargs): + """ + RETRIANGULATE projects a triangulation onto another triangulation + thereby providing a a new triangulation of the old one. + + Use as + [pnt, tri] = retriangulate(pnt1, tri1, pnt2, tri2, flag) + where + pnt1, tri1 describe the desired surface + pnt2, tri2 describe the triangulation that will be projected on surface 1 + + The optional flag determines whether the center of the triangulations should be + shifted to the origin before the projection is done. The resulting surface will + be shifted back to its original location. + + flag=0 means no shift (default) + flag=1 means shifting to the geometrical mean of the respective triangulations + flag=2 means shifting to the center of the bounding box of the respective triangulations + flag=3 means shifting to the geometrical mean of the first triangulation + flag=4 means shifting to the center of the bounding box of the first triangulation + flag=5 means shifting to the geometrical mean of the second triangulation + flag=6 means shifting to the center of the bounding box of the second triangulation + + The projection is done from the coordinate system origin (0,0,0). + + See also ICOSAHEDRONxxx, ISOSURFACE, REDUCEPATCH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/retriangulate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("retriangulate", *args, **kwargs) diff --git a/fieldtrip/_rigidbody.py b/fieldtrip/_rigidbody.py new file mode 100644 index 0000000..096c0a7 --- /dev/null +++ b/fieldtrip/_rigidbody.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _rigidbody(*args, **kwargs): + """ + RIGIDBODY creates the homogenous spatial transformation matrix + for a 6 parameter rigid-body transformation + + Use as + [H] = rigidbody(f) + + The transformation vector f should contain the + x-shift + y-shift + z-shift + followed by the + pitch (rotation around x-axis, in degrees) + roll (rotation around y-axis, in degrees) + yaw (rotation around z-axis, in degrees) + + See also ROTATE, TRANSLATE, SCALE, QUATERNION, HOMOGENOUS2TRADITIONAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/rigidbody.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rigidbody", *args, **kwargs) diff --git a/fieldtrip/_rmsubfield.py b/fieldtrip/_rmsubfield.py new file mode 100644 index 0000000..e2e4776 --- /dev/null +++ b/fieldtrip/_rmsubfield.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _rmsubfield(*args, **kwargs): + """ + RMSUBFIELD removes the contents of the specified field from a structure + just like the standard Matlab RMFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = rmsubfield(s, 'fieldname') + or as + s = rmsubfield(s, 'fieldname.subfieldname') + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/rmsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rmsubfield", *args, **kwargs) diff --git a/fieldtrip/_rollback_provenance.py b/fieldtrip/_rollback_provenance.py new file mode 100644 index 0000000..040c9fa --- /dev/null +++ b/fieldtrip/_rollback_provenance.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _rollback_provenance(*args, **kwargs): + """ + ROLLBACK_PROVENANCE rolls the provenance one step back and should + be used whenever a FT function calls another FT function without + the user being (or having to be) aware of this. + + Some examples for use + + tmpcfg = []; + tmpcfg.downsample = cfg.downsample; % simply copy this option + tmpcfg.smooth = 'no'; % override the default for this option + mri = ft_volumedownsample(tmpcfg, mri); + [cfg, mri] = rollback_provenance(cfg, mri); + + tmpcfg = []; + tmpcfg.parameter = cfg.parameter; + [varargin{:}] = ft_selectdata(tmpcfg, varargin{:}); + [cfg, varargin{:}] = rollback_provenance(cfg, varargin{:}); + + See also FT_PREAMBLE, FT_POSTAMBLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/rollback_provenance.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rollback_provenance", *args, **kwargs) diff --git a/fieldtrip/_rotate.py b/fieldtrip/_rotate.py new file mode 100644 index 0000000..a371167 --- /dev/null +++ b/fieldtrip/_rotate.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def _rotate(*args, **kwargs): + """ + ROTATE returns the homogenous coordinate transformation matrix + corresponding to a rotation around the x, y and z-axis. The direction of + the rotation is according to the right-hand rule. + + Use as + [H] = rotate(R) + where + R [rx, ry, rz] in degrees + H corresponding homogenous transformation matrix + + Note that the order in which the rotations are performs matters. The + rotation is first done around the z-axis, then the y-axis and finally the + x-axis. + + See also TRANSLATE, SCALE, RIGIDBODY, QUATERNION, HOMOGENOUS2TRADITIONAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/rotate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rotate", *args, **kwargs) diff --git a/fieldtrip/_routlm.py b/fieldtrip/_routlm.py new file mode 100644 index 0000000..15170ba --- /dev/null +++ b/fieldtrip/_routlm.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _routlm(*args, **kwargs): + """ + ROUTLM computes the projection of a point from its la/mu parameters + these equal the "Barycentric" coordinates + + Use as + [proj] = routlm(v1, v2, v3, la, mu) + where v1, v2 and v3 are three vertices of the triangle + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/routlm.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("routlm", *args, **kwargs) diff --git a/fieldtrip/_runtime.py b/fieldtrip/_runtime.py new file mode 100644 index 0000000..2b54c9a --- /dev/null +++ b/fieldtrip/_runtime.py @@ -0,0 +1,24 @@ +from mpython.runtime import Runtime as RuntimeBase + + +class Runtime(RuntimeBase): + """ + Runtime specialization that imports the correct CTF. + """ + + @classmethod + def _import_runtime(cls): + from . import _fieldtrip + + return _fieldtrip + + +class RuntimeMixin: + """ + Mixin that SPM classes must inherit so that they can call the + correct runtime. + """ + + @classmethod + def _runtime(cls): + return Runtime diff --git a/fieldtrip/_rv.py b/fieldtrip/_rv.py new file mode 100644 index 0000000..71addbd --- /dev/null +++ b/fieldtrip/_rv.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _rv(*args, **kwargs): + """ + RV returns the relative residual variance between measured and simulated data + + rv = rv(measured, simulated) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/rv.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("rv", *args, **kwargs) diff --git a/fieldtrip/_sampleinfo2trl.py b/fieldtrip/_sampleinfo2trl.py new file mode 100644 index 0000000..924cdb6 --- /dev/null +++ b/fieldtrip/_sampleinfo2trl.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _sampleinfo2trl(*args, **kwargs): + """ + SAMPLEINFO2TRL constructs the trial definition from the sampleinfo, the time axes + and optionally from the trialinfo + + Use as + trl = sampleinfo2trl(data) + + See also ARTIFACT2BOOLVEC, ARTIFACT2EVENT, ARTIFACT2TRL, BOOLVEC2ARTIFACT, BOOLVEC2EVENT, BOOLVEC2TRL, EVENT2ARTIFACT, EVENT2BOOLVEC, EVENT2TRL, TRL2ARTIFACT, TRL2BOOLVEC, TRL2EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/sampleinfo2trl.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sampleinfo2trl", *args, **kwargs) diff --git a/fieldtrip/_sandwich2x2.py b/fieldtrip/_sandwich2x2.py new file mode 100644 index 0000000..d923ea4 --- /dev/null +++ b/fieldtrip/_sandwich2x2.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _sandwich2x2(*args, **kwargs): + """ + SANDWICH2X2 compute x*y*x' provided y is Hermitian and dimensionality is 2x2xN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/sandwich2x2.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sandwich2x2", *args, **kwargs) diff --git a/fieldtrip/_sandwich3x3.py b/fieldtrip/_sandwich3x3.py new file mode 100644 index 0000000..ec2d38b --- /dev/null +++ b/fieldtrip/_sandwich3x3.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _sandwich3x3(*args, **kwargs): + """ + SANDWICH3X3 compute x*y*x' provided y is Hermitian and dimensionality is 3x3xN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/sandwich3x3.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sandwich3x3", *args, **kwargs) diff --git a/fieldtrip/_savevar.py b/fieldtrip/_savevar.py new file mode 100644 index 0000000..f7e2385 --- /dev/null +++ b/fieldtrip/_savevar.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _savevar(*args, **kwargs): + """ + SAVEVAR is a helper function for cfg.outputfile + + See also LOADVAR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/savevar.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("savevar", *args, **kwargs, nargout=0) diff --git a/fieldtrip/_scale.py b/fieldtrip/_scale.py new file mode 100644 index 0000000..390d657 --- /dev/null +++ b/fieldtrip/_scale.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _scale(*args, **kwargs): + """ + SCALE returns the homogenous coordinate transformation matrix + corresponding to a scaling along the x, y and z-axis + + Use as + [H] = translate(S) + where + S [sx, sy, sz] scaling along each of the axes + H corresponding homogenous transformation matrix + + See also TRANSLATE, ROTATE, RIGIDBODY, QUATERNION, HOMOGENOUS2TRADITIONAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/scale.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("scale", *args, **kwargs) diff --git a/fieldtrip/_sel50p.py b/fieldtrip/_sel50p.py new file mode 100644 index 0000000..bfa3e28 --- /dev/null +++ b/fieldtrip/_sel50p.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _sel50p(*args, **kwargs): + """ + This function will add the field "subspace" to the grid definition. + + The subspace projection corresponds to selecting 50% of the + channels that are the closest to the dipole. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/sel50p.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sel50p", *args, **kwargs) diff --git a/fieldtrip/_select2d.py b/fieldtrip/_select2d.py new file mode 100644 index 0000000..297eb92 --- /dev/null +++ b/fieldtrip/_select2d.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _select2d(*args, **kwargs): + """ + SELECT2D helper function for selecting a rectangular region + in the current figure using the mouse. + + Use as + [x, y] = select2d + + It returns a 2-element vector x and a 2-element vector y + with the corners of the selected region. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/select2d.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("select2d", *args, **kwargs) diff --git a/fieldtrip/_select3d.py b/fieldtrip/_select3d.py new file mode 100644 index 0000000..c668f4f --- /dev/null +++ b/fieldtrip/_select3d.py @@ -0,0 +1,88 @@ +from fieldtrip._runtime import Runtime + + +def _select3d(*args, **kwargs): + """ + SELECT3D(H) Determines the selected point in 3-D data space. + P = SELECT3D determines the point, P, in data space corresponding + to the current selection position. P is a point on the first + patch or surface face intersected along the selection ray. If no + face is encountered along the selection ray, P returns empty. + + P = SELECT3D(H) constrains selection to graphics handle H and, + if applicable, any of its children. H can be a figure, axes, + patch, or surface object. + + [P V] = SELECT3D(...), V is the closest face or line vertex + selected based on the figure's current object. + + [P V VI] = SELECT3D(...), VI is the index into the object's + x,y,zdata properties corresponding to V, the closest face vertex + selected. + + [P V VI FACEV] = SELECT3D(...), FACE is an array of vertices + corresponding to the face polygon containing P and V. + + [P V VI FACEV FACEI] = SELECT3D(...), FACEI is the row index into + the object's face array corresponding to FACE. For patch + objects, the face array can be obtained by doing + get(mypatch,'faces'). For surface objects, the face array + can be obtained from the output of SURF2PATCH (see + SURF2PATCH for more information). + + RESTRICTIONS: + SELECT3D supports surface, patch, or line object primitives. For surface + and patches, the algorithm assumes non-self-intersecting planar faces. + For line objects, the algorithm always returns P as empty, and V will + be the closest vertex relative to the selection point. + + Example: + + h = surf(peaks); + zoom(10); + disp('Click anywhere on the surface, then hit return') + pause + [p v vi face facei] = select3d; + marker1 = line('xdata',p(1),'ydata',p(2),'zdata',p(3),'marker','o',... + 'erasemode','xor','markerfacecolor','k'); + marker2 = line('xdata',v(1),'ydata',v(2),'zdata',v(3),'marker','o',... + 'erasemode','xor','markerfacecolor','k'); + marker2 = line('erasemode','xor','xdata',face(1,:),'ydata',face(2,:),... + 'zdata',face(3,:),'linewidth',10); + disp(sprintf('\nYou clicked at\nX: %.2f\nY: %.2f\nZ: %.2f',p(1),p(2),p(3)')) + disp(sprintf('\nThe nearest vertex is\nX: %.2f\nY: %.2f\nZ: %.2f',v(1),v(2),v(3)')) + + Version 1.2 2-15-02 + Copyright Joe Conti 2002 + Send comments to jconti@mathworks.com + + See also GINPUT, GCO. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/select3d.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("select3d", *args, **kwargs) diff --git a/fieldtrip/_select_channel_list.py b/fieldtrip/_select_channel_list.py new file mode 100644 index 0000000..96d63d4 --- /dev/null +++ b/fieldtrip/_select_channel_list.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _select_channel_list(*args, **kwargs): + """ + SELECT_CHANNEL_LIST presents a dialog for selecting multiple elements + from a cell-array with strings, such as the labels of EEG channels. + The dialog presents two columns with an add and remove mechanism. + + select = select_channel_list(label, initial, titlestr) + + with + initial indices of channels that are initially selected + label cell-array with channel labels (strings) + titlestr title for dialog (optional) + and + select indices of selected channels + + If the user presses cancel, the initial selection will be returned. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/select_channel_list.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("select_channel_list", *args, **kwargs) diff --git a/fieldtrip/_setsubfield.py b/fieldtrip/_setsubfield.py new file mode 100644 index 0000000..2c4b760 --- /dev/null +++ b/fieldtrip/_setsubfield.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _setsubfield(*args, **kwargs): + """ + SETSUBFIELD sets the contents of the specified field to a specified value + just like the standard Matlab SETFIELD function, except that you can also + specify nested fields using a '.' in the fieldname. The nesting can be + arbitrary deep. + + Use as + s = setsubfield(s, 'fieldname', value) + or as + s = setsubfield(s, 'fieldname.subfieldname', value) + + where nested is a logical, false denoting that setsubfield will create + s.subfieldname instead of s.fieldname.subfieldname + + See also SETFIELD, GETSUBFIELD, ISSUBFIELD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/setsubfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("setsubfield", *args, **kwargs) diff --git a/fieldtrip/_setviewpoint.py b/fieldtrip/_setviewpoint.py new file mode 100644 index 0000000..a68e80e --- /dev/null +++ b/fieldtrip/_setviewpoint.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _setviewpoint(*args, **kwargs): + """ + SETVIEWPOINT changes the viewpoint for a 3D image that contains data in a known coordinate system + + Use as + setviewpoint(ax, coordsys, viewpoint) + + For example + setviewpoint(gca, 'mni', 'left') + + See also GETORTHOVIEWPOS, COORDSYS2LABEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/setviewpoint.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("setviewpoint", *args, **kwargs, nargout=0) diff --git a/fieldtrip/_shiftpredict.py b/fieldtrip/_shiftpredict.py new file mode 100644 index 0000000..698ae5e --- /dev/null +++ b/fieldtrip/_shiftpredict.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _shiftpredict(*args, **kwargs): + """ + SHIFTPREDICT implements a shift-predictor for testing significance + of coherence within a single condition. This function is a subfunction + for SOURCESTATISTICS_SHIFTPREDICT and FREQSTATISTICS_SHIFTPREDICT. + + cfg.method + cfg.numrandomization + cfg.method + cfg.method + cfg.loopdim + cfg.feedback + cfg.method + cfg.loopdim + cfg.correctm + cfg.tail + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/shiftpredict.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("shiftpredict", *args, **kwargs) diff --git a/fieldtrip/_sine_taper.py b/fieldtrip/_sine_taper.py new file mode 100644 index 0000000..dd46708 --- /dev/null +++ b/fieldtrip/_sine_taper.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _sine_taper(*args, **kwargs): + """ + Compute Riedel & Sidorenko sine tapers. + sine_taper(n, k) produces the first 2*k tapers of length n, + returned as the columns of d. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/sine_taper.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sine_taper", *args, **kwargs) diff --git a/fieldtrip/_smartinput.py b/fieldtrip/_smartinput.py new file mode 100644 index 0000000..414ce1b --- /dev/null +++ b/fieldtrip/_smartinput.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _smartinput(*args, **kwargs): + """ + SMARTINPUT helper function for smart interactive input from the command line + + Use as + [newval, change] = smartinput(question, oldval) + + See also INPUT, PAUSE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/smartinput.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("smartinput", *args, **kwargs) diff --git a/fieldtrip/_smooth_source.py b/fieldtrip/_smooth_source.py new file mode 100644 index 0000000..0555eef --- /dev/null +++ b/fieldtrip/_smooth_source.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _smooth_source(*args, **kwargs): + """ + [SOURCE] = SMOOTH(SOURCE, VARARGIN) + + computes location specific 3D gaussian kernels based on a FWHM estimate + source should contain the fields + fwhm, specifying for each voxel the FWHM of the smoothing kernel in the xyz-direction + pos, allowing for the units to be correct + + key-value pairs should contain + parameter = string, field to be used for the smoothing + maxdist = scalar, maximum distance for filter kernel + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/smooth_source.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("smooth_source", *args, **kwargs) diff --git a/fieldtrip/_smudge.py b/fieldtrip/_smudge.py new file mode 100644 index 0000000..6a272cc --- /dev/null +++ b/fieldtrip/_smudge.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _smudge(*args, **kwargs): + """ + SMUDGE(DATIN, TRI) computes a smudged version of the input data datain, + given a triangulation tri. The algorithm is according to what is in + MNE-Suite, documented in chapter 8.3 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/smudge.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("smudge", *args, **kwargs) diff --git a/fieldtrip/_solid_angle.py b/fieldtrip/_solid_angle.py new file mode 100644 index 0000000..014aae7 --- /dev/null +++ b/fieldtrip/_solid_angle.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _solid_angle(*args, **kwargs): + """ + SOLID_ANGLE of a planar triangle as seen from the origin + + The solid angle W subtended by a surface S is defined as the surface + area W of a unit sphere covered by the surface's projection onto the + sphere. Solid angle is measured in steradians, and the solid angle + corresponding to all of space being subtended is 4*pi sterradians. + + Use: + [w] = solid_angle(v1, v2, v3) + or + [w] = solid_angle(pnt, tri) + where v1, v2 and v3 are the vertices of a single triangle in 3D or + pnt and tri contain a description of a triangular mesh (this will + compute the solid angle for each triangle) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/solid_angle.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("solid_angle", *args, **kwargs) diff --git a/fieldtrip/_specest_nanfft.py b/fieldtrip/_specest_nanfft.py new file mode 100644 index 0000000..b542050 --- /dev/null +++ b/fieldtrip/_specest_nanfft.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _specest_nanfft(*args, **kwargs): + """ + SPECEST_NANFFT computes a fast Fourier transform in the presence of NaNs + in the data + + Use as + [spectrum] = specest_nanfft(dat, ...) + where + dat = matrix of chan*sample + time = vector, containing time in seconds for each sample + spectrum = matrix of taper*chan*foi*toi of fourier coefficients + + Optional arguments should be specified in key-value pairs and can include: + basis = precomputes set of basis functions (sines/cosines) + datataype = 0, 1, 2 + + FIXME: FFT speed not yet optimized, e.g. MATLAB version, transpose or not, ... + FIXME: function is recursive, should be avoided in favor of transparancy + + See also SPECEST_MTMFFT, SPECEST_CONVOL, SPECEST_HILBERT, SPECEST_MTMCONVOL, SPECEST_MVAR, SPECEST_WAVELET + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/specest_nanfft.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("specest_nanfft", *args, **kwargs) diff --git a/fieldtrip/_sphericalSplineInterpolate.py b/fieldtrip/_sphericalSplineInterpolate.py new file mode 100644 index 0000000..39d77b8 --- /dev/null +++ b/fieldtrip/_sphericalSplineInterpolate.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _sphericalSplineInterpolate(*args, **kwargs): + """ + interpolate matrix for spherical interpolation + + W = sphericalSplineInterpolate(src,dest,lambda,order,type,tol) + + Inputs: + src - [3 x N] old electrode positions + dest - [3 x M] new electrode positions + lambda - [float] regularisation parameter for smoothing the estimates (1e-5) + order - [float] order of the polynomial interplotation to use (4) + type - [str] one of; ('spline') + 'spline' - spherical Spline + 'slap' - surface Laplician (aka. CSD) + tol - [float] tolerance for the legendre poly approx (1e-7) + Outputs: + W - [M x N] linear mapping matrix between old and new co-ords + + Based upon the paper: Perrin89 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/sphericalSplineInterpolate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sphericalSplineInterpolate", *args, **kwargs) diff --git a/fieldtrip/_sphsplint.py b/fieldtrip/_sphsplint.py new file mode 100644 index 0000000..db5dec1 --- /dev/null +++ b/fieldtrip/_sphsplint.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def _sphsplint(*args, **kwargs): + """ + SPHSPLINT computes the spherical spline interpolation and the surface + laplacian of an EEG potential distribution + + Use as + [WVo, WLo] = sphsplint(elc1, elc2) + [WVo, WLo] = sphsplint(elc1, elc2, order, degree, lambda) + where + elc1 electrode positions where potential is known + elc2 electrode positions where potential is not known + and + WVo filter for the potential at electrode locations in elc2 + WLo filter for the laplacian at electrode locations in elc2 + order order of splines + degree degree of Legendre polynomials + lambda regularization parameter + + See also LAPINT, LAPINTMAT, LAPCAL + This implements + F. Perrin, J. Pernier, O. Bertrand, and J. F. Echallier. + Spherical splines for scalp potential and curernt density mapping. + Electroencephalogr Clin Neurophysiol, 72:184-187, 1989. + including their corrections in + F. Perrin, J. Pernier, O. Bertrand, and J. F. Echallier. + Corrigenda: EEG 02274, Electroencephalography and Clinical + Neurophysiology 76:565. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/sphsplint.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("sphsplint", *args, **kwargs) diff --git a/fieldtrip/_spikesort.py b/fieldtrip/_spikesort.py new file mode 100644 index 0000000..6954cda --- /dev/null +++ b/fieldtrip/_spikesort.py @@ -0,0 +1,61 @@ +from fieldtrip._runtime import Runtime + + +def _spikesort(*args, **kwargs): + """ + SPIKESORT uses a variation on the cocktail sort algorithm in combination + with a city block distance to achieve N-D trial pairing between spike + counts. The sorting is not guaranteed to result in the optimal pairing. A + linear pre-sorting algorithm is used to create good initial starting + positions. + + The goal of this function is to achieve optimal trial-pairing prior to + stratifying the spike numbers in two datasets by random removal of some + spikes in the trial and channel with the largest numnber of spikes. + Pre-sorting based on the city-block distance between the spike count + ensures that as few spikes as possible are lost. + + Use as + [srtA, srtB, indA, indB] = spikesort(numA, numB, ...) + + Optional arguments should be specified as key-value pairs and can include + 'presort' number representing the column, 'rowwise' or 'global' + + Example + numA = reshape(randperm(100*3), 100, 3); + numB = reshape(randperm(100*3), 100, 3); + [srtA, srtB, indA, indB] = spikesort(numA, numB); + % check that the order is correct, the following should be zero + numA(indA,:) - srtA + numB(indB,:) - srtB + + See also COCKTAILSORT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/spikesort.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("spikesort", *args, **kwargs) diff --git a/fieldtrip/_splint.py b/fieldtrip/_splint.py new file mode 100644 index 0000000..5c17dc0 --- /dev/null +++ b/fieldtrip/_splint.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def _splint(*args, **kwargs): + """ + SPLINT computes the spherical spline interpolation and the surface laplacian + of an EEG potential distribution + + Use as + [V2, L2, L1] = splint(elc1, V1, elc2) + where + elc1 electrode positions where potential is known + elc2 electrode positions where potential is not known + V1 known potential + and + V2 potential at electrode locations in elc2 + L2 laplacian of potential at electrode locations in elc2 + L1 laplacian of potential at electrode locations in elc1 + order order of splines + degree degree of Legendre polynomials + lambda regularization parameter + + See also LAPINT, LAPINTMAT, LAPCAL + This implements + F. Perrin, J. Pernier, O. Bertrand, and J. F. Echallier. + Spherical splines for scalp potential and curernt density mapping. + Electroencephalogr Clin Neurophysiol, 72:184-187, 1989. + including their corrections in + F. Perrin, J. Pernier, O. Bertrand, and J. F. Echallier. + Corrigenda: EEG 02274, Electroencephalography and Clinical + Neurophysiology 76:565. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/splint.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("splint", *args, **kwargs) diff --git a/fieldtrip/_splitstruct.py b/fieldtrip/_splitstruct.py new file mode 100644 index 0000000..8285063 --- /dev/null +++ b/fieldtrip/_splitstruct.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _splitstruct(*args, **kwargs): + """ + SPLITSTRUCT splits a structure into names and values + + See also PRINTSTRUCT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/splitstruct.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("splitstruct", *args, **kwargs) diff --git a/fieldtrip/_standardcolors.py b/fieldtrip/_standardcolors.py new file mode 100644 index 0000000..e146f99 --- /dev/null +++ b/fieldtrip/_standardcolors.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def _standardcolors(*args, **kwargs): + """ + STANDARDCOLORS looks up the RGB value for a named color that is specified as + a string, or looks up the name given the RGB value. + + Use as + rgb = standardcolors(name) + or + name = standardcolors(rgb) + or + list = standardcolors + + This returns a predefined color as [red green blue] values, according to + the following mapping: + red = [255 0 0]/255; + green = [ 0 192 0]/255; + blue = [ 0 0 255]/255; + magenta = [255 255 0]/255; + cyan = [ 0 255 255]/255; + yellow = [255 255 0]/255; + white = [255 255 255]/255; + black = [ 0 0 0]/255; + brain = [202 100 100]/255; + skull = [140 85 85]/255 + cortex = [255 213 119]/255; + cortex_light = [199 194 169]/255; + cortex_dark = [100 97 85]/255; + skin = [249 223 192]/255; + skin_light = [249 223 192]/255; + skin_medium_light = [225 194 158]/255; + skin_medium = [188 142 106]/255; + skin_medium_dark = [155 102 65]/255; + skin_dark = [ 91 71 61]/255; + + The different skin-based colors follow the Fitzpatrick scale with type I and II + combined, and return RGB values that approximate those used by Apple in the emoji + skin tones. See also https://emojipedia.org/emoji-modifier-sequence/ + + If no specific skin tone is specified, this function returns a light skin color. + This corresponds with that of one of the developers who approximated his own skin + color more than 15 years ago upon the first implementation of this function. + + See also HTMLCOLORS, COLORSPEC2RGB, FT_COLORMAP, COLORMAP, COLORMAPEDITOR, BREWERMAP, MATPLOTLIB, CMOCEAM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/standardcolors.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("standardcolors", *args, **kwargs) diff --git a/fieldtrip/_standardise.py b/fieldtrip/_standardise.py new file mode 100644 index 0000000..c76ecb0 --- /dev/null +++ b/fieldtrip/_standardise.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _standardise(*args, **kwargs): + """ + STANDARDISE computes the zscore of a matrix along dimension dim + has similar functionality as the stats-toolbox's zscore function + + Use as + x = standardise(x, dim) + + See also ZSCORE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/standardise.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("standardise", *args, **kwargs) diff --git a/fieldtrip/_strel_bol.py b/fieldtrip/_strel_bol.py new file mode 100644 index 0000000..ef5d8aa --- /dev/null +++ b/fieldtrip/_strel_bol.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _strel_bol(*args, **kwargs): + """ + STREL_BOL constructs a 3D sphere with the specified radius + that can be used as structural element in 3D image processing + + See STREL, IMERODE, IMDILATE (image processing toolbox) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/strel_bol.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("strel_bol", *args, **kwargs) diff --git a/fieldtrip/_surface_area.py b/fieldtrip/_surface_area.py new file mode 100644 index 0000000..a66932a --- /dev/null +++ b/fieldtrip/_surface_area.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _surface_area(*args, **kwargs): + """ + SURFACE_AREA computes the surface area of each of the triangles in a mesh + + Use as + area = surface_area(pos, tri) + + See also SURFACE_ORIENTATION, SURFACE_INSIDE, SURFACE_NESTING, PROJECTTRI, PCNORMALS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/surface_area.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("surface_area", *args, **kwargs) diff --git a/fieldtrip/_surface_inside.py b/fieldtrip/_surface_inside.py new file mode 100644 index 0000000..b2fd760 --- /dev/null +++ b/fieldtrip/_surface_inside.py @@ -0,0 +1,45 @@ +from fieldtrip._runtime import Runtime + + +def _surface_inside(*args, **kwargs): + """ + SURFACE_INSIDE determines if a point is inside/outside a triangle mesh + whereby the bounding triangle mesh should be closed. + + Use as + inside = surface_inside(dippos, pos, tri) + where + dippos position of point of interest (can be 1x3 or Nx3) + pos bounding mesh vertices + tri bounding mesh triangles + + See also SURFACE_AREA, SURFACE_ORIENTATION, SURFACE_NORMALS, SURFACE_NESTING, SOLID_ANGLE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/surface_inside.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("surface_inside", *args, **kwargs) diff --git a/fieldtrip/_surface_normals.py b/fieldtrip/_surface_normals.py new file mode 100644 index 0000000..794ba8a --- /dev/null +++ b/fieldtrip/_surface_normals.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _surface_normals(*args, **kwargs): + """ + SURFACE_NORMALS compute the surface normals of a triangular mesh + for each triangle or for each vertex + + Use as + nrm = surface_normals(pnt, tri, opt) + where opt is either 'vertex' (default) or 'triangle'. + + See also SURFACE_AREA, SURFACE_ORIENTATION, SURFACE_INSIDE, SURFACE_NESTING, PROJECTTRI, PCNORMALS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/surface_normals.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("surface_normals", *args, **kwargs) diff --git a/fieldtrip/_surface_orientation.py b/fieldtrip/_surface_orientation.py new file mode 100644 index 0000000..49838cc --- /dev/null +++ b/fieldtrip/_surface_orientation.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _surface_orientation(*args, **kwargs): + """ + SURFACE_ORIENTATION returns the string 'inward' or 'outward' or 'unknown', + depending on the surface orientation. + + Use as + str = surface_orientation(pos, tri) + or + str = surface_orientation(pos, tri, ori) + + See also SURFACE_AREA, SURFACE_NESTING, SURFACE_NORMALS, SURFACE_NESTING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/surface_orientation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("surface_orientation", *args, **kwargs) diff --git a/fieldtrip/_surface_shift.py b/fieldtrip/_surface_shift.py new file mode 100644 index 0000000..8411b05 --- /dev/null +++ b/fieldtrip/_surface_shift.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _surface_shift(*args, **kwargs): + """ + SURFACE_SHIFT inflates or deflates a triangulated surface by moving the + vertices outward or inward along their normals. + + Use as + pos = surface_inflate(pos, tri, amount) + where pos and tri describe the surface. + + See also SURFACE_NORMALS, SURFACE_ORIENTATION, SURFACE_INSIDE, + SURFACE_NESTING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/surface_shift.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("surface_shift", *args, **kwargs) diff --git a/fieldtrip/_svdfft.py b/fieldtrip/_svdfft.py new file mode 100644 index 0000000..25e7f75 --- /dev/null +++ b/fieldtrip/_svdfft.py @@ -0,0 +1,46 @@ +from fieldtrip._runtime import Runtime + + +def _svdfft(*args, **kwargs): + """ + SVDFFT computes a rotated FFT matrix, using the real part of the cross-spectral + density matrix. This rotation ensures that the phase relationship of the underlying + sources does not change, while rotating the channels such that the first channel + contains the maximal amplitude signal. + + Use as + [fr, ut] = svdfft(f, n, trltapcnt); + where + n number of components (orientations) to keep in the output (e.g. 1, 2 or 3) + trltapcnt vector of length Ntrials with the number of tapers + + See also SVD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/svdfft.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("svdfft", *args, **kwargs) diff --git a/fieldtrip/_swapmemfile.py b/fieldtrip/_swapmemfile.py new file mode 100644 index 0000000..eca01ba --- /dev/null +++ b/fieldtrip/_swapmemfile.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _swapmemfile(*args, **kwargs): + """ + SWAPMEMFILE swaps a variable from file into memory and clears it + again from the memory on the subsequent call + + Use with extreme caution! + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/swapmemfile.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("swapmemfile", *args, **kwargs) diff --git a/fieldtrip/_tal2mni.py b/fieldtrip/_tal2mni.py new file mode 100644 index 0000000..b3ad240 --- /dev/null +++ b/fieldtrip/_tal2mni.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _tal2mni(*args, **kwargs): + """ + Converts coordinates to MNI brain best guess + from Talairach coordinates + FORMAT outpoints = tal2mni(inpoints) + Where inpoints is N by 3 or 3 by N matrix of coordinates + (N being the number of points) + outpoints is the coordinate matrix with MNI points + Matthew Brett 2/2/01 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/tal2mni.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("tal2mni", *args, **kwargs) diff --git a/fieldtrip/_tfcestat.py b/fieldtrip/_tfcestat.py new file mode 100644 index 0000000..6147ced --- /dev/null +++ b/fieldtrip/_tfcestat.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _tfcestat(*args, **kwargs): + """ + TFCESTAT computes threshold-free cluster statistic multidimensional channel-freq-time or + volumetric source data + + See also CLUSTERSTAT, FINDCLUSTER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/tfcestat.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("tfcestat", *args, **kwargs) diff --git a/fieldtrip/_time2offset.py b/fieldtrip/_time2offset.py new file mode 100644 index 0000000..21f5e58 --- /dev/null +++ b/fieldtrip/_time2offset.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _time2offset(*args, **kwargs): + """ + TIME2OFFSET converts a time-axis of a trial into the offset in samples + according to the definition from DEFINETRIAL + + Use as + [offset] = time2offset(time, fsample) + + The trialdefinition "trl" is an Nx3 matrix. The first column contains + the sample-indices of the begin of the trial relative to the begin + of the raw data , the second column contains the sample_indices of + the end of the trials, and the third column contains the offset of + the trigger with respect to the trial. An offset of 0 means that + the first sample of the trial corresponds to the trigger. A positive + offset indicates that the first sample is later than the trigger, a + negative offset indicates a trial beginning before the trigger. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/time2offset.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("time2offset", *args, **kwargs) diff --git a/fieldtrip/_timelock2freq.py b/fieldtrip/_timelock2freq.py new file mode 100644 index 0000000..b208967 --- /dev/null +++ b/fieldtrip/_timelock2freq.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _timelock2freq(*args, **kwargs): + """ + TIMELOCK2FREQ transform the reconstructed dipole moment into + something that again resembles the physical input parameter in + the frequency domain. + + This is needed after source reconstruction using FREQ2TIMELOCK. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/timelock2freq.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("timelock2freq", *args, **kwargs) diff --git a/fieldtrip/_topoplot_common.py b/fieldtrip/_topoplot_common.py new file mode 100644 index 0000000..3f6bacb --- /dev/null +++ b/fieldtrip/_topoplot_common.py @@ -0,0 +1,36 @@ +from fieldtrip._runtime import Runtime + + +def _topoplot_common(*args, **kwargs): + """ + TOPOPLOT_COMMON is shared by FT_TOPOPLOTTFR, FT_TOPOPLOTER and FT_TOPOPLOTIC, which + serve as placeholder for the documentation and for the pre/postamble. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/topoplot_common.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("topoplot_common", *args, **kwargs) diff --git a/fieldtrip/_traditional.py b/fieldtrip/_traditional.py new file mode 100644 index 0000000..b602a19 --- /dev/null +++ b/fieldtrip/_traditional.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def _traditional(*args, **kwargs): + """ + TRADITIONAL creates the homogenous spatial transformation matrix + for a 9 parameter traditional "Talairach-model" transformation + + Use as + [H] = traditional(f) + + The transformation vector f should contain the + x-shift + y-shift + z-shift + followed by the + pitch (rotation around x-axis) + roll (rotation around y-axis) + yaw (rotation around z-axis) + followed by the + x-rescaling factor + y-rescaling factor + z-rescaling factor + + The order in which the transformations are done is exactly opposite as + the list above, i.e. first z-rescale, ... and finally x-shift. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/traditional.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("traditional", *args, **kwargs) diff --git a/fieldtrip/_transfer2coeffs.py b/fieldtrip/_transfer2coeffs.py new file mode 100644 index 0000000..b69cd0e --- /dev/null +++ b/fieldtrip/_transfer2coeffs.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _transfer2coeffs(*args, **kwargs): + """ + TRANSFER2COEFFS converts a spectral transfer matrix into the time domain + equivalent multivariate autoregressive coefficients up to a specified + lag, starting from lag 1. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/transfer2coeffs.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("transfer2coeffs", *args, **kwargs) diff --git a/fieldtrip/_transform2grid.py b/fieldtrip/_transform2grid.py new file mode 100644 index 0000000..536ef02 --- /dev/null +++ b/fieldtrip/_transform2grid.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _transform2grid(*args, **kwargs): + """ + TRANSFORM2GRID ensures that the volume contains the definition of the + cardian axes, i.e. xgrid/ygrid/zgrid. If the voluyme contains a + homogenous coordinate transformation axis that is unequal to eye(4), it + will try to construct the cardinal axis from that transformation matrix. + + See also GRID2TRANSFORM + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/transform2grid.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("transform2grid", *args, **kwargs) diff --git a/fieldtrip/_translate.py b/fieldtrip/_translate.py new file mode 100644 index 0000000..1db25d3 --- /dev/null +++ b/fieldtrip/_translate.py @@ -0,0 +1,44 @@ +from fieldtrip._runtime import Runtime + + +def _translate(*args, **kwargs): + """ + TRANSLATE returns the homogenous coordinate transformation matrix + corresponding to a translation along the x, y and z-axis + + Use as + [H] = translate(T) + where + T [tx, ty, tz] translation along each of the axes + H corresponding homogenous transformation matrix + + See also ROTATE, SCALE, RIGIDBODY, QUATERNION, HOMOGENOUS2TRADITIONAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/translate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("translate", *args, **kwargs) diff --git a/fieldtrip/_triangle2connectivity.py b/fieldtrip/_triangle2connectivity.py new file mode 100644 index 0000000..c8c68d1 --- /dev/null +++ b/fieldtrip/_triangle2connectivity.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _triangle2connectivity(*args, **kwargs): + """ + TRIANGLE2CONNECTIVITY computes a connectivity-matrix from a triangulation. + + Use as + [connmat] = triangle2connectivity(tri) + or + [connmat] = triangle2connectivity(tri, pos) + + The input tri is an Mx3 matrix describing a triangulated surface, + containing indices to connecting vertices. The output connmat is a sparse + logical NxN matrix, with ones, where vertices are connected, and zeros + otherwise. + + If you specify the vertex positions in the second input argument as Nx3 + matrix, the output will be a sparse matrix with the lengths of the + edges between the connected vertices. + + See also CHANNELCONNECTIVIY + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/triangle2connectivity.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("triangle2connectivity", *args, **kwargs) diff --git a/fieldtrip/_triangle2distance.py b/fieldtrip/_triangle2distance.py new file mode 100644 index 0000000..faf4a63 --- /dev/null +++ b/fieldtrip/_triangle2distance.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _triangle2distance(*args, **kwargs): + """ + TRIANGLE2DISTANCE computes the geodesic distance (across the edges) on a + mesh, using Dijkstra's algorithm. The Dijkstra code is an efficient + vectorized version of a function from MIT's graphtool toolbox, operating + on an adjacency matrix. + + Use as + d = triangle2distance(tri, pos, s) + + Input arguments: + tri = Mx3 matrix describing the triangles + pos = Nx3 matrix describing the position of the vertices + s = (can be empty), scalar or vector with indices for the points for + which the distance (to all other points) will be computed. If + empty or not defined, all points will be considered. + + Output argument: + d = Nxnumel(s) distance matrix + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/triangle2distance.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("triangle2distance", *args, **kwargs) diff --git a/fieldtrip/_triangle4pt.py b/fieldtrip/_triangle4pt.py new file mode 100644 index 0000000..21a8d14 --- /dev/null +++ b/fieldtrip/_triangle4pt.py @@ -0,0 +1,70 @@ +from fieldtrip._runtime import Runtime + + +def _triangle4pt(*args, **kwargs): + """ + TRIANGLE4PNT takes the volume model and estimates the 4th point of each + triangle of each mesh. + + Use as + headmodel = triangle4pt(headmodel) + + In each headmodel.bnd sub-structure, a field '.pnt4' is added. The '.pnt4' + field is a Ntri*3 matrix, with the coordinates of a point for each + triangle in the meshed surface. + + Explanations: + The point is that for some BEM, specifically 'solid angle', calculation + it is necessary to estimate the local curvature of the true surface which + is approximated by the flat triangle. One way to proceed is to use + "close by" vertices to estimate the overall area's curvature. + A more elegant(?) way uses a 4th point for each triangle: the "centroid" + of the triangle is simply pusehd away from the triangle surface to fix + the local surface curvature (assuming the surface is smooth enough). + This 4th point is thus hovering above/under the triangle and can be used + to fit a sphere on the triangle in a realistic way. + + Method: + - The 4th point can/could be defined at the tessalation stage, based on + the anatomical images directly. + - With any model, the curvature can be estimated/approximated by looking + at the vertices around the triangle considered and fit a sphere on + those few vertices, assuming the surface is smooth enough + The latter option is the one followed here. + The extra-vertices considered here are those 3 which are linked to the + triangle by 2 edges. + __________________________________________________________________________ + + written by Christophe Phillips, 2009/01/19 + Cyclotron Research Centre, University of li?ge, belgium + + $Id$ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/triangle4pt.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("triangle4pt", *args, **kwargs) diff --git a/fieldtrip/_triangulate_seg.py b/fieldtrip/_triangulate_seg.py new file mode 100644 index 0000000..c6c8768 --- /dev/null +++ b/fieldtrip/_triangulate_seg.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def _triangulate_seg(*args, **kwargs): + """ + TRIANGULATE_SEG constructs a triangulation of the outer surface of a segmented + volume. It starts at the center of the volume and projects the vertices of an + evenly triangulated sphere onto the outer surface. The resulting surface is by + construction star-shaped from the origin of the sphere. + + Use as + [pnt, tri] = triangulate_seg(seg, npnt, origin) + + Input arguments: + seg = 3D-matrix (boolean) containing the segmented volume + npnt = requested number of vertices + origin = 1x3 vector specifying the location of the origin of the sphere + in voxel indices. This argument is optional. If undefined, the + origin of the sphere will be in the centre of the volume. + + Output arguments: + pnt = Nx3 matrix of vertex locations + tri = Mx3 matrix of triangles + + The segmentation will be checked for holes, and filled if necessary. Also, the + segmentation will be checked to consist of a single boolean blob. If not, only the + outer surface of the largest will be triangulated. SPM is used for both the filling + and checking for multiple blobs. + + See also MESH_SPHERE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/triangulate_seg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("triangulate_seg", *args, **kwargs) diff --git a/fieldtrip/_tritrisect.py b/fieldtrip/_tritrisect.py new file mode 100644 index 0000000..b60e085 --- /dev/null +++ b/fieldtrip/_tritrisect.py @@ -0,0 +1,38 @@ +from fieldtrip._runtime import Runtime + + +def _tritrisect(*args, **kwargs): + """ + TRITRISECT computes the intersection line of a triangle with a plane + spanned by three vertices v1, v2 and v3. + + [l1, l2] = tritrisect(v1, v2, v3, t1, t2, t3) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/tritrisect.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("tritrisect", *args, **kwargs) diff --git a/fieldtrip/_trl2artifact.py b/fieldtrip/_trl2artifact.py new file mode 100644 index 0000000..717d219 --- /dev/null +++ b/fieldtrip/_trl2artifact.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _trl2artifact(*args, **kwargs): + """ + TRL2ARTIFACT converts between two representations of events or trials. + + FieldTrip uses a number of representations for events that are conceptually very similar + event = structure with type, value, sample, duration and offset + trl = Nx3 numerical array with begsample, endsample, offset + trl = table with 3 columns for begsample, endsample, offset + artifact = Nx2 numerical array with begsample, endsample + artifact = table with 2 columns for begsample, endsample + boolvec = 1xNsamples boolean vector with a thresholded TTL/trigger sequence + boolvec = MxNsamples boolean matrix with a thresholded TTL/trigger sequence + + If trl or artifact are represented as a MATLAB table, they can have additional + columns. These additional columns have to be named and are not restricted to + numerical values. + + See also ARTIFACT2BOOLVEC, ARTIFACT2EVENT, ARTIFACT2TRL, BOOLVEC2ARTIFACT, BOOLVEC2EVENT, BOOLVEC2TRL, EVENT2ARTIFACT, EVENT2BOOLVEC, EVENT2TRL, TRL2ARTIFACT, TRL2BOOLVEC, TRL2EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/trl2artifact.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("trl2artifact", *args, **kwargs) diff --git a/fieldtrip/_trl2boolvec.py b/fieldtrip/_trl2boolvec.py new file mode 100644 index 0000000..b3c5a62 --- /dev/null +++ b/fieldtrip/_trl2boolvec.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _trl2boolvec(*args, **kwargs): + """ + TRL2BOOLVEC converts between two representations of events or trials. + + FieldTrip uses a number of representations for events that are conceptually very similar + event = structure with type, value, sample, duration and offset + trl = Nx3 numerical array with begsample, endsample, offset + trl = table with 3 columns for begsample, endsample, offset + artifact = Nx2 numerical array with begsample, endsample + artifact = table with 2 columns for begsample, endsample + boolvec = 1xNsamples boolean vector with a thresholded TTL/trigger sequence + boolvec = MxNsamples boolean matrix with a thresholded TTL/trigger sequence + + If trl or artifact are represented as a MATLAB table, they can have additional + columns. These additional columns have to be named and are not restricted to + numerical values. + + See also ARTIFACT2BOOLVEC, ARTIFACT2EVENT, ARTIFACT2TRL, BOOLVEC2ARTIFACT, BOOLVEC2EVENT, BOOLVEC2TRL, EVENT2ARTIFACT, EVENT2BOOLVEC, EVENT2TRL, TRL2ARTIFACT, TRL2BOOLVEC, TRL2EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/trl2boolvec.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("trl2boolvec", *args, **kwargs) diff --git a/fieldtrip/_trl2event.py b/fieldtrip/_trl2event.py new file mode 100644 index 0000000..754f8c4 --- /dev/null +++ b/fieldtrip/_trl2event.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def _trl2event(*args, **kwargs): + """ + TRL2EVENT converts between two representations of events or trials. + + FieldTrip uses a number of representations for events that are conceptually very similar + event = structure with type, value, sample, duration and offset + trl = Nx3 numerical array with begsample, endsample, offset + trl = table with 3 columns for begsample, endsample, offset + artifact = Nx2 numerical array with begsample, endsample + artifact = table with 2 columns for begsample, endsample + boolvec = 1xNsamples boolean vector with a thresholded TTL/trigger sequence + boolvec = MxNsamples boolean matrix with a thresholded TTL/trigger sequence + + If trl or artifact are represented as a MATLAB table, they can have additional + columns. These additional columns have to be named and are not restricted to + numerical values. + + See also ARTIFACT2BOOLVEC, ARTIFACT2EVENT, ARTIFACT2TRL, BOOLVEC2ARTIFACT, BOOLVEC2EVENT, BOOLVEC2TRL, EVENT2ARTIFACT, EVENT2BOOLVEC, EVENT2TRL, TRL2ARTIFACT, TRL2BOOLVEC, TRL2EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/trl2event.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("trl2event", *args, **kwargs) diff --git a/fieldtrip/_uidisplaytext.py b/fieldtrip/_uidisplaytext.py new file mode 100644 index 0000000..a431a00 --- /dev/null +++ b/fieldtrip/_uidisplaytext.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _uidisplaytext(*args, **kwargs): + """ + UIDISPLAYTEXT opens a figure for displaying multi-line text + in an "edit" user interface control element. + + Use as + uidisplaytext(str, title) + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/uidisplaytext.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("uidisplaytext", *args, **kwargs, nargout=0) diff --git a/fieldtrip/_undobalancing.py b/fieldtrip/_undobalancing.py new file mode 100644 index 0000000..c940f01 --- /dev/null +++ b/fieldtrip/_undobalancing.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _undobalancing(*args, **kwargs): + """ + UNDOBALANCING removes all balancing coefficients from the gradiometer sensor array + + This is used in CHANNELPOSITION, FT_PREPARE_LAYOUT, FT_SENSTYPE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/undobalancing.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("undobalancing", *args, **kwargs) diff --git a/fieldtrip/_univariate2bivariate.py b/fieldtrip/_univariate2bivariate.py new file mode 100644 index 0000000..2170b11 --- /dev/null +++ b/fieldtrip/_univariate2bivariate.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def _univariate2bivariate(*args, **kwargs): + """ + UNIVARIATE2BIVARIATE is a helper function for FT_CONNECTIVITYANALYSIS + + Use as + [data, powindx, hasrpt] = univariate2bivariate(data, inparam, outparam, dtype, ...) + where + data = FieldTrip structure according to dtype (see below) + inparam = string + outparam = string + dtype = string, can be 'freq', 'source', 'raw' + and additional options come in key-value pairs and can include + channelcmb = + demeanflag = + keeprpt = + sqrtflag = + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/univariate2bivariate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("univariate2bivariate", *args, **kwargs) diff --git a/fieldtrip/_unparcellate.py b/fieldtrip/_unparcellate.py new file mode 100644 index 0000000..25c24c7 --- /dev/null +++ b/fieldtrip/_unparcellate.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def _unparcellate(*args, **kwargs): + """ + UNPARCELLATE performs the reverse of a parcellation, by assigigning each + parcel's activation to the vertices that contributed to that parcel. + + Use as + + fun = unparcellate(data, parcellation, parameter, parcelparam, varargin) + + Required inputs: + + data = structure (or matrix) containing the parcellated functional data + parcellation = structure describing the parcellation, i.e. the parcel + membership for each of the vertices + parameter = string (or cell-array with labels) that specifies the + parameter to be used (if data is a structure) or how to + interpret the rows in the data matrix (if data is a matrix) + + Additional inputs are key-value pairs and pertain to bivariate data with + a 'labelcmb' specified in the input argument 'parameter'. + + avgoverref = 'yes' (or 'no') + directionality = 'both' (or 'inflow'/'outflow') + + Outputs: + fun = matrix Nvertices x size(data.(parameter),2) (or Nvertices x + size(data,2), containing the unparcellated data + + If the input was bivariate data with a labelcmb, an optional second + output argument gives a list of the reference parcels. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/unparcellate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("unparcellate", *args, **kwargs) diff --git a/fieldtrip/_val2nearestchan.py b/fieldtrip/_val2nearestchan.py new file mode 100644 index 0000000..80d790d --- /dev/null +++ b/fieldtrip/_val2nearestchan.py @@ -0,0 +1,40 @@ +from fieldtrip._runtime import Runtime + + +def _val2nearestchan(*args, **kwargs): + """ + VAL2NEARESTCHAN returns the label of the channel with the value nearest + to the specified value. + + use as channame = val2nearestchan(data,val) + val = [time y] with time in sec + works only on raw data + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/val2nearestchan.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("val2nearestchan", *args, **kwargs) diff --git a/fieldtrip/_validate_seg.py b/fieldtrip/_validate_seg.py new file mode 100644 index 0000000..f2aede7 --- /dev/null +++ b/fieldtrip/_validate_seg.py @@ -0,0 +1,51 @@ +from fieldtrip._runtime import Runtime + + +def _validate_seg(*args, **kwargs): + """ + VALIDATE_SEG ensures that the segmentation represents tissue types in a cumulative than exclusive + manner. + + Use as + [tissue1, tissue2, tissue3] = validate_segmentation(tissue1, tissue2, tissue3) + where the second two input (and output) arguments are optional. In case of more than one input + argument the tissue-types should follow eachother from inside towards outside (e.g. tissue1 = brain, + tissue2 = skull, tissue = scalp). + + The output will consist of one or more boolean segmentations without empty spaces inside. + In such way, more than one tissue-types will be represented in an overlapping manner. If + the input is invalid and cannot be converted to overlapping segmentations, this function will give + an error. + + This function makes use of functions from the MATLAB Signal Processing Toolbox. + + See also TRIANGULATE_SEG, PREPARE_MESH_SEGMENTATION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/validate_seg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("validate_seg", *args, **kwargs) diff --git a/fieldtrip/_version.py b/fieldtrip/_version.py new file mode 100644 index 0000000..d4ce68d --- /dev/null +++ b/fieldtrip/_version.py @@ -0,0 +1 @@ +__version__ = "20241219.beta1" diff --git a/fieldtrip/_vline.py b/fieldtrip/_vline.py new file mode 100644 index 0000000..1578f17 --- /dev/null +++ b/fieldtrip/_vline.py @@ -0,0 +1,35 @@ +from fieldtrip._runtime import Runtime + + +def _vline(*args, **kwargs): + """ + VLINE plot a vertical line in the current graph + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/vline.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("vline", *args, **kwargs, nargout=0) diff --git a/fieldtrip/_volplot.py b/fieldtrip/_volplot.py new file mode 100644 index 0000000..4d80a8f --- /dev/null +++ b/fieldtrip/_volplot.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def _volplot(*args, **kwargs): + """ + VOLPLOT make 2D or 3D plot of volumetric data (e.g. MRI) + that is defined on a regular orthogonal grid + + volplot(dat, sel) or + volplot(x, y, z, dat, sel) + volplot(x, y, z, dat, sel, caxis) + + where sel is one of + [x, y, z] intersection through the three orthogonal directions + index linear index of the voxel of interest + 'min' intersection at the minimum + 'max' intersection at the maximum + 'center' intersect at the center of each axis + 'interactive' intersect at the center, then go into interactive mode + 'maxproject' project the maximum value along each orthogonal direction + 'sumproject' integrated value along each orthogonal direction (glassbrain) + 'montage' show all slices + and caxis is the [min max] used for the color scaling + + See also TRIPLOT, LINEPLOT (in ~roberto/matlab/misc) + See also NDGRID + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/volplot.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("volplot", *args, **kwargs) diff --git a/fieldtrip/_volumeedit.py b/fieldtrip/_volumeedit.py new file mode 100644 index 0000000..592d63b --- /dev/null +++ b/fieldtrip/_volumeedit.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _volumeedit(*args, **kwargs): + """ + VOLUMEEDIT allows for editing of a (booleanized) volume, in order to + remove unwanted voxels. Interaction proceeds with the keyboard and the + mouse. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/volumeedit.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("volumeedit", *args, **kwargs) diff --git a/fieldtrip/_volumefillholes.py b/fieldtrip/_volumefillholes.py new file mode 100644 index 0000000..216bffa --- /dev/null +++ b/fieldtrip/_volumefillholes.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _volumefillholes(*args, **kwargs): + """ + VOLUMEFILLHOLES is a helper function for segmentations + + See also VOLUMETHRESHOLD, VOLUMESMOOTH, VOLUMEPAD, VOLUMESELECTLARGEST + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/volumefillholes.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("volumefillholes", *args, **kwargs) diff --git a/fieldtrip/_volumeflip.py b/fieldtrip/_volumeflip.py new file mode 100644 index 0000000..a0c8782 --- /dev/null +++ b/fieldtrip/_volumeflip.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _volumeflip(*args, **kwargs): + """ + VOLUMEFLIP + + See also VOLUMEPERMUTE, ALIGN_IJK2XYZ, ALIGN_XYZ2IJK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/volumeflip.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("volumeflip", *args, **kwargs) diff --git a/fieldtrip/_volumepad.py b/fieldtrip/_volumepad.py new file mode 100644 index 0000000..fde4210 --- /dev/null +++ b/fieldtrip/_volumepad.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _volumepad(*args, **kwargs): + """ + VOLUMEPAR is a helper function for segmentations. It adds a layer on all sides to + ensure that the tissue can be meshed all the way up to the edges this also ensures + that the mesh at the bottom of the neck will be closed. + + See also VOLUMEFILLHOLES, VOLUMESMOOTH, VOLUMETHRESHOLD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/volumepad.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("volumepad", *args, **kwargs) diff --git a/fieldtrip/_volumepermute.py b/fieldtrip/_volumepermute.py new file mode 100644 index 0000000..0e68075 --- /dev/null +++ b/fieldtrip/_volumepermute.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _volumepermute(*args, **kwargs): + """ + VOLUMEPERMUTE + + See also VOLUMEFLIP, ALIGN_IJK2XYZ, ALIGN_XYZ2IJK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/volumepermute.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("volumepermute", *args, **kwargs) diff --git a/fieldtrip/_volumeselectlargest.py b/fieldtrip/_volumeselectlargest.py new file mode 100644 index 0000000..c241e00 --- /dev/null +++ b/fieldtrip/_volumeselectlargest.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _volumeselectlargest(*args, **kwargs): + """ + VOLUMESELECTLARGEST is a helper function for segmentations + + See also VOLUMEFILLHOLES, VOLUMETHRESHOLD, VOLUMESMOOTH, VOLUMEPAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/volumeselectlargest.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("volumeselectlargest", *args, **kwargs) diff --git a/fieldtrip/_volumesmooth.py b/fieldtrip/_volumesmooth.py new file mode 100644 index 0000000..d1abc63 --- /dev/null +++ b/fieldtrip/_volumesmooth.py @@ -0,0 +1,37 @@ +from fieldtrip._runtime import Runtime + + +def _volumesmooth(*args, **kwargs): + """ + VOLUMESMOOTH is a helper function for segmentations + + See also VOLUMETHRESHOLD, VOLUMEFILLHOLES + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/volumesmooth.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("volumesmooth", *args, **kwargs) diff --git a/fieldtrip/_volumethreshold.py b/fieldtrip/_volumethreshold.py new file mode 100644 index 0000000..3c45b98 --- /dev/null +++ b/fieldtrip/_volumethreshold.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _volumethreshold(*args, **kwargs): + """ + VOLUMETHRESHOLD is a helper function for segmentations. It applies a + relative threshold and subsequently looks for the largest connected part, + thereby removing small blobs such as vitamine E capsules. + + See also VOLUMEFILLHOLES, VOLUMESMOOTH, VOLUMEPAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/volumethreshold.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("volumethreshold", *args, **kwargs) diff --git a/fieldtrip/_warp_dykstra2012.py b/fieldtrip/_warp_dykstra2012.py new file mode 100644 index 0000000..076d250 --- /dev/null +++ b/fieldtrip/_warp_dykstra2012.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def _warp_dykstra2012(*args, **kwargs): + """ + WARP_DYKSTRA2012 projects the ECoG grid / strip onto a cortex hull + using the algorithm described in Dykstra et al. (2012, Neuroimage) in + which the distance from original positions and the deformation of the + grid are minimized. This function relies on MATLAB's optimization toolbox. + To align ECoG electrodes to the pial surface, you first need to compute + the cortex hull with FT_PREPARE_MESH. + + Additional configuration options to the original functionality + cfg.maxiter = number (default: 50), maximum number of optimization + iterations + cfg.pairmethod = 'pos' (default) or 'label', the method for electrode + pairing on which the deformation energy is based + cfg.isodistance = 'yes', 'no' (default) or number, to enforce isotropic + inter-electrode distances (pairmethod 'label' only) + cfg.deformweight = number (default: 1), weight of deformation relative + to shift energy cost (lower increases grid flexibility) + + See also FT_ELECTRODEREALIGN, FT_PREPARE_MESH, WARP_HERMES2010 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/warp_dykstra2012.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("warp_dykstra2012", *args, **kwargs) diff --git a/fieldtrip/_warp_fsaverage.py b/fieldtrip/_warp_fsaverage.py new file mode 100644 index 0000000..64df162 --- /dev/null +++ b/fieldtrip/_warp_fsaverage.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _warp_fsaverage(*args, **kwargs): + """ + WARP_FSAVERAGE maps electrodes onto FreeSurfer's fsaverage brain. + This surface-based registration technique solely considers the curvature + patterns of the cortex and thus can be used for the spatial normalization + of electrodes located on or near the cortical surface. To perform + surface-based normalization, you first need to process the subject's MRI + with FreeSurfer's recon-all functionality. + + The configuration must contain the following options + cfg.headshape = string, filename containing subject headshape + (e.g. ) + cfg.fshome = string, path to freesurfer + + See also FT_ELECTRODEREALIGN, FT_PREPARE_MESH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/warp_fsaverage.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("warp_fsaverage", *args, **kwargs) diff --git a/fieldtrip/_warp_fsaverage_sym.py b/fieldtrip/_warp_fsaverage_sym.py new file mode 100644 index 0000000..380d1fb --- /dev/null +++ b/fieldtrip/_warp_fsaverage_sym.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def _warp_fsaverage_sym(*args, **kwargs): + """ + WARP_FSAVERAGE_SYM maps left or right hemisphere electrodes onto + FreeSurfer's fsaverage_sym's left hemisphere. To perform this mapping, + you first need to have processed the subject's MRI with FreeSurfer's + recon-all functionality and additionaly have registered the subject's resulting + surfaces to freesurfer fsaverage_sym template using surfreg as described + in section 1.2 of https://surfer.nmr.mgh.harvard.edu/fswiki/Xhemi + + The configuration must contain the following options + cfg.headshape = string, filename containing subject headshape + (e.g. ) + cfg.fshome = string, path to freesurfer + + See also FT_ELECTRODEREALIGN, WARP_FSAVERAGE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/warp_fsaverage_sym.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("warp_fsaverage_sym", *args, **kwargs) diff --git a/fieldtrip/_warp_fsinflated.py b/fieldtrip/_warp_fsinflated.py new file mode 100644 index 0000000..5498e4c --- /dev/null +++ b/fieldtrip/_warp_fsinflated.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def _warp_fsinflated(*args, **kwargs): + """ + WARP_FSINFLATED maps electrodes from FreeSurfer's pial surface to + FreeSurfer's inflated brain. + + The configuration must contain the following options: + cfg.headshape = string, filename containing subject headshape + (e.g. ) + cfg.fshome = string, path to freesurfer + + See also FT_ELECTRODEREALIGN, FT_PREPARE_MESH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/warp_fsinflated.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("warp_fsinflated", *args, **kwargs) diff --git a/fieldtrip/_warp_hermes2010.py b/fieldtrip/_warp_hermes2010.py new file mode 100644 index 0000000..dadd868 --- /dev/null +++ b/fieldtrip/_warp_hermes2010.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def _warp_hermes2010(*args, **kwargs): + """ + WARP_HERMES2010 projects the ECoG grid / strip onto a cortex hull + using the algorithm described in Hermes et al. (2010, + J Neurosci methods) in which electrodes are projected onto the pial + surface using the orthogonal local norm vector to the grid. To align ECoG + electrodes to the pial surface, you first need to compute the cortex hull + with FT_PREPARE_MESH. + + See also FT_ELECTRODEREALIGN, FT_PREPARE_MESH, WARP_DYKSTRA2012 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/warp_hermes2010.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("warp_hermes2010", *args, **kwargs) diff --git a/fieldtrip/_wizard_base.py b/fieldtrip/_wizard_base.py new file mode 100644 index 0000000..fe35c89 --- /dev/null +++ b/fieldtrip/_wizard_base.py @@ -0,0 +1,39 @@ +from fieldtrip._runtime import Runtime + + +def _wizard_base(*args, **kwargs): + """ + This is the low level wizard function. It evaluates the MATLAB content + in the workspace of the calling function. To prevent overwriting + variables in the BASE workspace, this function should be called from a + wrapper function. The wrapper function whoudl pause execution untill the + wizard figure is deleted. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/wizard_base.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("wizard_base", *args, **kwargs) diff --git a/fieldtrip/_write_neuralynx_nse.py b/fieldtrip/_write_neuralynx_nse.py new file mode 100644 index 0000000..57dd56a --- /dev/null +++ b/fieldtrip/_write_neuralynx_nse.py @@ -0,0 +1,41 @@ +from fieldtrip._runtime import Runtime + + +def _write_neuralynx_nse(*args, **kwargs): + """ + WRITE_NEURALYNX_NSE writes spike timestamps and waveforms to a NSE file + The input data should be scaled in uV. + + Use as + write_neuralynx_nse(filename, nse) + + See also READ_NEURALYNX_NSE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/private/write_neuralynx_nse.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("write_neuralynx_nse", *args, **kwargs, nargout=0) diff --git a/fieldtrip/besa2fieldtrip.py b/fieldtrip/besa2fieldtrip.py new file mode 100644 index 0000000..1f80531 --- /dev/null +++ b/fieldtrip/besa2fieldtrip.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def besa2fieldtrip(*args, **kwargs): + """ + BESA2FIELDTRIP reads and converts various BESA datafiles into a FieldTrip + data structure, which subsequently can be used for statistical analysis + or other analysis methods implemented in Fieldtrip. + + Use as + [output] = besa2fieldtrip(input) + where the input should be a string specifying the BESA file, or a MATLAB structure + with data that was exported by BESA. The output is a MATLAB structure that is + compatible with FieldTrip. + + The format of the output structure depends on the type of datafile: + *.avr is converted to a structure similar to the output of FT_TIMELOCKANALYSIS + *.mul is converted to a structure similar to the output of FT_TIMELOCKANALYSIS + *.swf is converted to a structure similar to the output of FT_TIMELOCKANALYSIS (*) + *.tfc is converted to a structure similar to the output of FT_FREQANALYSIS (*) + *.dat is converted to a structure similar to the output of FT_SOURCANALYSIS + *.dat combined with a *.gen or *.generic is converted to a structure similar to the output of FT_PREPROCESSING + + (*) If the BESA toolbox by Karsten Hochstatter is found on your MATLAB path, the + readBESAxxx functions will be used (where xxx=tfc/swf), alternatively the private + functions from FieldTrip will be used. + + See also EEGLAB2FIELDTRIP, SPM2FIELDTRIP + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/besa2fieldtrip.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("besa2fieldtrip", *args, **kwargs) diff --git a/fieldtrip/bis2fieldtrip.py b/fieldtrip/bis2fieldtrip.py new file mode 100644 index 0000000..6c9e0f1 --- /dev/null +++ b/fieldtrip/bis2fieldtrip.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def bis2fieldtrip(*args, **kwargs): + """ + BIS2FIELDTRIP reads BioImage Suite .mgrid files and converts them + into a FieldTrip-compatible elec datatype structure and converts electrode + positions from BioImage Suite mgrid that are in 'xyz' to head coordinates + of the corresponding MRI volume + + Use as + elec = bis2fieldtrip('Subject_grid.mgrid', 'Subject_MR.nii') + + See also FIELDTRIP2BIS, FT_READ_SENS, READ_BIOIMAGE_MGRID + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/bis2fieldtrip.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("bis2fieldtrip", *args, **kwargs) diff --git a/fieldtrip/data2bids.py b/fieldtrip/data2bids.py new file mode 100644 index 0000000..a59bab0 --- /dev/null +++ b/fieldtrip/data2bids.py @@ -0,0 +1,210 @@ +from fieldtrip._runtime import Runtime + + +def data2bids(*args, **kwargs): + """ + DATA2BIDS is a helper function to convert MRI, MEG, EEG, iEEG or NIRS data to the + Brain Imaging Data Structure. The overall idea is that you write a MATLAB script in + which you call this function multiple times, once for each individually recorded + data file (or data set). It will write the corresponding sidecar JSON and TSV files + for each data file. + + Use as + data2bids(cfg) + or as + data2bids(cfg, data) + + The first input argument 'cfg' is the configuration structure, which contains the + details for the (meta)data and which specifies the sidecar files you want to write. + The optional 'data' argument corresponds to preprocessed raw data according to + FT_DATAYPE_RAW or an anatomical MRI according to FT_DATAYPE_VOLUME. The optional + data input argument allows you to write preprocessed electrophysiological data + and/or realigned and defaced anatomical MRI to disk. + + The implementation in this function aims to correspond to the latest BIDS version. + See https://bids-specification.readthedocs.io/ for the full specification + and http://bids.neuroimaging.io/ for further details. + + The configuration structure should contains + cfg.method = string, can be 'decorate', 'copy' or 'convert', see below (default is automatic) + cfg.dataset = string, filename of the input data + cfg.outputfile = string, optional filename for the output data (default is automatic) + cfg.writejson = string, 'yes', 'replace', 'merge' or 'no' (default = 'yes') + cfg.writetsv = string, 'yes', 'replace', 'merge' or 'no' (default = 'yes') + + This function starts from existing data file on disk or from a FieldTrip compatible + data structure in MATLAB memory that is passed as the second input argument. + Depending on cfg.method it will add the sidecar files, copy the dataset and add + sidecar files, or convert the dataset and add the sidecar files. Each of the + methods is discussed here. + + DECORATE - data2bids will read the header details and events from the data and write + the appropriate sidecar files alongside the existing dataset. You would use this to + obtain the sidecar files for data files that are already in the BIDS organization. + + CONVERT - data2bids will read the input data (or use the specified input data) and + write it to a new output file that is BIDS compliant. The output format is NIfTI + for MRI data, and BrainVision for EEG and iEEG. Note that MEG data files are stored + in BIDS in their native format and this function will NOT convert them for you. + + COPY - data2bids will copy the data from the input data file to the output data + file, which renames it, but does not change its content. Furthermore, it will read + the header details and events from the data and construct the appropriate sidecar + files. + + Although you can explicitly specify cfg.outputfile yourself, it is recommended to + use the following configuration options. This results in a BIDS compliant output + directory and file name. With these options data2bids will also write or, if + already present, update the participants.tsv and scans.tsv files. + cfg.bidsroot = string, top level directory for the BIDS output + cfg.sub = string, subject name + cfg.ses = string, optional session name + cfg.run = number, optional + cfg.task = string, task name is required for functional data + cfg.suffix = string, can be any of 'FLAIR', 'FLASH', 'PD', 'PDT2', 'PDmap', 'T1map', 'T1rho', 'T1w', 'T2map', 'T2star', 'T2w', 'angio', 'audio', 'bold', 'bval', 'bvec', 'channels', 'coordsystem', 'defacemask', 'dwi', 'eeg', 'emg', 'epi', 'events', 'eyetracker', 'fieldmap', 'headshape', 'ieeg', 'inplaneT1', 'inplaneT2', 'magnitude', 'magnitude1', 'magnitude2', 'meg', 'motion', 'nirs', 'phase1', 'phase2', 'phasediff', 'photo', 'physio', 'sbref', 'stim', 'video' + cfg.acq = string + cfg.ce = string + cfg.rec = string + cfg.dir = string + cfg.mod = string + cfg.echo = string + cfg.proc = string + cfg.tracksys = string + cfg.space = string + cfg.desc = string + + If you specify cfg.bidsroot, this function will also write the dataset_description.json + file. Among others, you can specify the following fields: + cfg.dataset_description.writesidecar = 'yes' or 'no' (default = 'yes') + cfg.dataset_description.Name = string + cfg.dataset_description.BIDSVersion = string + cfg.dataset_description.License = string + cfg.dataset_description.Authors = cell-array of strings + cfg.dataset_description.ReferencesAndLinks = cell-array of strings + cfg.dataset_description.EthicsApprovals = cell-array of strings + cfg.dataset_description.Funding = cell-array of strings + cfg.dataset_description.Acknowledgements = string + cfg.dataset_description.HowToAcknowledge = string + cfg.dataset_description.DatasetDOI = string + + If you specify cfg.bidsroot, you can also specify additional information to be + added as extra columns in the participants.tsv and scans.tsv files. For example: + cfg.participants.age = scalar + cfg.participants.sex = string, 'm' or 'f' + cfg.scans.acq_time = string, should be formatted according to RFC3339 as '2019-05-22T15:13:38' + cfg.sessions.acq_time = string, should be formatted according to RFC3339 as '2019-05-22T15:13:38' + cfg.sessions.pathology = string, recommended when different from healthy + If any of these values is specified as [] or as nan, it will be written to + the tsv file as 'n/a'. + + If you specify cfg.bidsroot, this function can also write some modality agnostic + files at the top-level of the dataset. You can specify their content here and/or + subsequently edit them with a text editor. + cfg.README = string (default is a template with instructions) + cfg.LICENSE = string (no default) + cfg.CHANGES = string (no default) + + General BIDS options that apply to all data types are + cfg.InstitutionName = string + cfg.InstitutionAddress = string + cfg.InstitutionalDepartmentName = string + cfg.Manufacturer = string + cfg.ManufacturersModelName = string + cfg.DeviceSerialNumber = string + cfg.SoftwareVersions = string + + General BIDS options that apply to all functional data types are + cfg.TaskName = string + cfg.TaskDescription = string + cfg.Instructions = string + cfg.CogAtlasID = string + cfg.CogPOID = string + + For anatomical and functional MRI data you can specify cfg.dicomfile to read the + detailed MRI scanner and sequence details from the header of that DICOM file. This + will be used to fill in the details of the corresponding JSON file. + cfg.dicomfile = string, filename of a matching DICOM file for header details (default = []) + cfg.deface = string, 'yes' or 'no' (default = 'no') + + You can specify cfg.events as a Nx3 matrix with the "trl" trial definition (see + FT_DEFINETRIAL) or as a MATLAB table. When specified as table, you can use the + "trl" format from FT_DEFINETRIAL with the first three columns corresponding to the + begsample, endsample and offset (in samples). You can also a table with the + "events.tsv" format with the first two columns corresponding to the onset and + duration (in seconds). In either case the table can have additional columns with + numerical or string values. If you do not specify cfg.events, the events will be + read from the MEG/EEG/iEEG dataset. + cfg.events = trial definition (see FT_DEFINETRIAL) or event structure (see FT_READ_EVENT) + + If NBS Presentation was used in combination with another functional data type, you + can specify cfg.presentationfile with the name of the presentation log file, which + will be aligned with the data based on triggers (MEG/EEG/iEEG) or based on the + volumes (fMRI). Events from the presentation log file will also be written to + events.tsv. To indicate how triggers (in MEG/EEG/iEEG) or volumes (in fMRI) match + the presentation events, you should specify the mapping between them. + cfg.presentationfile = string, optional filename for the presentation log file + cfg.trigger.eventtype = string (default = []) + cfg.trigger.eventvalue = string or number + cfg.trigger.skip = 'last'/'first'/'none' + cfg.presentation.eventtype = string (default = []) + cfg.presentation.eventvalue = string or number + cfg.presentation.skip = 'last'/'first'/'none' + + For EEG and iEEG data you can specify an electrode definition according to + FT_DATATYPE_SENS as an "elec" field in the input data, or you can specify it as + cfg.elec or you can specify a filename with electrode information. + cfg.elec = structure with electrode positions or filename, see FT_READ_SENS + + For NIRS data you can specify an optode definition according to + FT_DATATYPE_SENS as an "opto" field in the input data, or you can specify + it as cfg.opto or you can specify a filename with optode information. + cfg.opto = structure with optode positions or filename,see FT_READ_SENS + + There are more BIDS options for the mri/meg/eeg/ieeg data type specific sidecars. + Rather than listing them all here, please open this function in the MATLAB editor, + and scroll down a bit to see what those are. In general the information in the JSON + files is specified by a field that is specified in CamelCase + cfg.mri.SomeOption = string, please check the MATLAB code + cfg.meg.SomeOption = string, please check the MATLAB code + cfg.eeg.SomeOption = string, please check the MATLAB code + cfg.ieeg.SomeOption = string, please check the MATLAB code + cfg.nirs.SomeOption = string, please check the MATLAB code + cfg.coordsystem.SomeOption = string, please check the MATLAB code + The information for TSV files is specified with a column header in lowercase or + snake_case and represents a list of items + cfg.channels.some_option = cell-array, please check the MATLAB code + cfg.events.some_option = cell-array, please check the MATLAB code + cfg.electrodes.some_option = cell-array, please check the MATLAB code + cfg.optodes.some_option = cell-array, please check the MATLAB code + + See also FT_DATAYPE_RAW, FT_DATAYPE_VOLUME, FT_DATATYPE_SENS, FT_DEFINETRIAL, + FT_PREPROCESSING, FT_READ_MRI, FT_READ_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/data2bids.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("data2bids", *args, **kwargs) diff --git a/fieldtrip/edf2fieldtrip.py b/fieldtrip/edf2fieldtrip.py new file mode 100644 index 0000000..4672938 --- /dev/null +++ b/fieldtrip/edf2fieldtrip.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def edf2fieldtrip(*args, **kwargs): + """ + EDF2FIELDTRIP reads data from a EDF file with channels that have a different + sampling rates. It upsamples all data to the highest sampling rate and + concatenates all channels into a raw data structure that is compatible with the + output of FT_PREPROCESSING. + + Use as + data = edf2fieldtrip(filename) + or + [data, event] = edf2fieldtrip(filename) + + For reading EDF files in which all channels have the same sampling rate, you can + use the standard procedure with FT_DEFINETRIAL and FT_PREPROCESSING. + + See also FT_PREPROCESSING, FT_DEFINETRIAL, FT_REDEFINETRIAL, + FT_READ_EVENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/edf2fieldtrip.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("edf2fieldtrip", *args, **kwargs) diff --git a/fieldtrip/fieldtrip2besa.py b/fieldtrip/fieldtrip2besa.py new file mode 100644 index 0000000..3579a67 --- /dev/null +++ b/fieldtrip/fieldtrip2besa.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def fieldtrip2besa(*args, **kwargs): + """ + FIELDTRIP2BESA saves a FieldTrip data structures to a corresponding BESA file. This + export function is based on documentation that was provided by Todor Jordanov of + BESA. + + Use as + fieldtrip2besa(filename, data) + with data as obtained from FT_PREPROCESSING to export single trial data as a + set of .avr files. + + Use as + fieldtrip2besa(filename, elec) + or + fieldtrip2besa(filename, grad) + with an electrode structure as obtained from FT_READ_SENS to export channel + positions to an .elp file. + + Additional key-value pairs can be specified according to + channel = cell-array, can be used to make subset and to reorder the channels + + See also FIELDTRIP2SPSS, FIELDTRIP2FIFF + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fieldtrip2besa.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fieldtrip2besa", *args, **kwargs, nargout=0) diff --git a/fieldtrip/fieldtrip2bis.py b/fieldtrip/fieldtrip2bis.py new file mode 100644 index 0000000..faa6091 --- /dev/null +++ b/fieldtrip/fieldtrip2bis.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def fieldtrip2bis(*args, **kwargs): + """ + FIELDTRIP2BIS writes BioImage Suite .mgrid files with eletrode + positions in 'xyz' coordinates using a elec datatype structure and the + corresponding MRI volume + + Use as + fieldtrip2bis('Subject_grid.mgrid', elec, 'Subject_MR.nii') + + See also BIS2FIELDTRIP, FT_WRITE_SENS, WRITE_BIOIMAGE_MGRID + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fieldtrip2bis.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fieldtrip2bis", *args, **kwargs, nargout=0) diff --git a/fieldtrip/fieldtrip2ctf.py b/fieldtrip/fieldtrip2ctf.py new file mode 100644 index 0000000..8001db9 --- /dev/null +++ b/fieldtrip/fieldtrip2ctf.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def fieldtrip2ctf(*args, **kwargs): + """ + FIELDTRIP2CTF saves a FieldTrip data structure to a CTF dataset. + + The file to which the data is exported depends on the input data structure that you + provide. The "raw" and "timelock" structures can be exported to a CTF dataset. The + "montage" structure can be exported to a CTF "Virtual Channels" file. + + Use as + fieldtrip2ctf(filename, data, ...) + where filename is a string and data is a FieldTrip raw, timelock or montage + structure. + + Additional options should be specified in key-value pairs and can be + 'ds' = struct, original dataset information as obtained with readCTFds + + See also FT_DATATYPE, FT_APPLY_MONTAGE, FT_VOLUMEWRITE, FT_SOURCEWRITE, FT_WRITE_DATA + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fieldtrip2ctf.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fieldtrip2ctf", *args, **kwargs, nargout=0) diff --git a/fieldtrip/fieldtrip2fiff.py b/fieldtrip/fieldtrip2fiff.py new file mode 100644 index 0000000..31edb36 --- /dev/null +++ b/fieldtrip/fieldtrip2fiff.py @@ -0,0 +1,76 @@ +from fieldtrip._runtime import Runtime + + +def fieldtrip2fiff(*args, **kwargs): + """ + FIELDTRIP2FIFF saves a FieldTrip raw data structure as a fiff-file, allowing it + to be further analyzed by the Neuromag/Elekta/Megin software, or in MNE-python. + + Use as + fieldtrip2fiff(filename, data) + where filename is the name of the output file, and data is a raw data structure + as obtained from FT_PREPROCESSING, or a timelock structure obtained from + FT_TIMELOCKANALYSIS. If the input data is a raw data structure with a single + trial, a continuous fif-file will be written. If the input data contains multiple + trials, either in a timelock or raw format, and epoched fif-file will be written. + If trials have different time axes, nans will be added to pad the trials to equal + length and time axis. If the input data contains an average across trials, an evoked + fif-file will be written. + + Additional options can be specified as key-value pairs: + precision = string ('single'/'double'), determines the precision with which the + numeric data is written to file, default is the class of the data. + coordsys = string ('native'/'neuromag'), determines the coordinate system in which + the MEG sensors are written (default = 'neuromag'). In case of + 'neuromag' the MEG sensors are expressed in (approximate) neuromag + coordinates, which may facilitate downstream handling of the fif-files + in other software such as MNE-python. This is according to the + official fif-file format definition. This option does not have an + effect on EEG electrodes or fNIRS optodes. + event = structure as obtained from FT_READ_EVENT, note that the sampling in the + event structure should be the same as the sampling of the data structure, + i.e. the values in data.sampleinfo should be in line with event.sample, and + the sampling rate should be the same. No check will be performed. Also, the + events will only be written to file if the input data is of type raw with + a single trial. + eventtype = string or cell array of string with the event types to be + written to the continuous fif-file (default is all) + hdr = structure as obtained from FT_READ_HEADER + + If present in the data, the original header is reused (also removing the non-used channels). + Otherwise, the function attempts to create the header, which might or might not be correct + (e.g. with respect to the scaling and the sensor locations). + + The events are written in MNE format (three columns) into the continuous + fif-file, with a mapping string that allows for a richer interpretation of the events. + + See also FT_DATATYPE_RAW, FT_DATATYPE_TIMELOCK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fieldtrip2fiff.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fieldtrip2fiff", *args, **kwargs, nargout=0) diff --git a/fieldtrip/fieldtrip2homer.py b/fieldtrip/fieldtrip2homer.py new file mode 100644 index 0000000..84e263b --- /dev/null +++ b/fieldtrip/fieldtrip2homer.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def fieldtrip2homer(*args, **kwargs): + """ + FIELDTRIP2HOMER converts a continuous raw data structure from FieldTrip format to + Homer format. + + Use as + nirs = fieldtrip2homer(data, ...) + where the input data structure is formatted according to the output of + FT_PREPROCESSING and the output nirs structure is according to Homer. + + Additional options should be specified in key-value pairs and can be + 'event' = event structure that corresponds to the data, see FT_READ_EVENT + + See https://www.nitrc.org/plugins/mwiki/index.php/homer2:Homer_Input_Files#NIRS_data_file_format + for a description of the Homer data structure. + + See also HOMER2FIELDTRIP, FT_PREPROCESSING, FT_DATATYPE_RAW + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fieldtrip2homer.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fieldtrip2homer", *args, **kwargs) diff --git a/fieldtrip/fieldtrip2spss.py b/fieldtrip/fieldtrip2spss.py new file mode 100644 index 0000000..0e3d336 --- /dev/null +++ b/fieldtrip/fieldtrip2spss.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def fieldtrip2spss(*args, **kwargs): + """ + FIELDTRIP2SPSS compiles data and correpsonding labels into a textfile, + suitable for importing into SPSS or JASP (jasp-stats.org). + + Use as + fieldtrip2spss(filename, labels, data) + + When exporting from MATLAB, set: + - filename; should be string (e.g. 'counts.txt') + - labels; should be a cell-array (e.g. {'ones', 'twos', 'threes'}) + - data; should be either a vector or matrix (e.g. [1 2 3; 1 2 3; 1 2 3]) + + When importing to SPSS, set; + - variables included at top of file: 'yes' + - first case of data on line number: '2' (default) + - delimiter appearing between variables: 'tab' (default) + + In case the columns that make up the data matrix have unequal lengths + (e.g. because of different number of subjects per group), use: + data = ones(30,2)*9999 + data(1:30,1) = 1 (30 subj in Group 1) + data(1:20,2) = 2 (20 subj in Group 2) + After importing to SPSS, click the Missing cell in the Variable View + window and enter 9999 as the missing value definition. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/fieldtrip2spss.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("fieldtrip2spss", *args, **kwargs, nargout=0) diff --git a/fieldtrip/ft_analysispipeline.py b/fieldtrip/ft_analysispipeline.py new file mode 100644 index 0000000..1162c4a --- /dev/null +++ b/fieldtrip/ft_analysispipeline.py @@ -0,0 +1,92 @@ +from fieldtrip._runtime import Runtime + + +def ft_analysispipeline(*args, **kwargs): + """ + FT_ANALYSIPIPELINE reconstructs the complete analysis pipeline that was used to create + the input FieldTrip data structure. The pipeline will be visualized as a flowchart. + In the future it might be possible to output the complete pipeline as a MATLAB script + or in a specialized pipeline format like PSOM, JIST, LONI, or Taverna. + + Use as + output = ft_analysispipeline(cfg, data) + + The first cfg input contains the settings that apply to the behavior of this + particular function and the second data input argument can be the output of any + FieldTrip function, e.g. FT_PREPROCESSING, FT_TIMELOCKANALYSIS, FT_SOURCEANALYSIS, + FT_FREQSTATISTICS or whatever you like. + + Alternatively, for the second data input argument you can also only give the + configuration of the processed data (for example data.cfg) instead of the full data + structure. + + The configuration options that apply to the behavior of this function are + cfg.filename = string, filename without the extension + cfg.filetype = string, can be 'matlab', 'html', 'dot' or 'prov' + cfg.feedback = string, 'no', 'text', 'gui' or 'yes', whether text and/or + graphical feedback should be presented (default = 'yes') + cfg.showinfo = string or cell-array of strings, information to display + in the GUI boxes, can be any combination of + 'functionname', 'revision', 'matlabversion', + 'computername', 'username', 'calltime', 'timeused', + 'memused', 'workingdir', 'scriptpath' (default = + 'functionname', only display function name). Can also + be 'all', show all pipeline. Please note that if you want + to show a lot of information, this will require a lot + of screen real estate. + + This function uses the nested cfg and cfg.previous that are present in + the data structure. It will use the configuration and the nested previous + configurations to climb all the way back into the tree. This funtction + will print a complete MATLAB script to screen (and optionally to file). + Furthermore, it will show an interactive graphical flowchart + representation of the steps taken during the pipeline(i). In the flowchart + you can click on one of the steps to see the configuration details of + that pipeline(i). + + Example use: + data = ft_timelocksimulation([]); + data_bl = ft_timelockbaseline([], data); + data_avg = ft_timelockanalysis([], data_bl); + ft_analysispipeline([], data_avg) + + Note that the nested cfg and cfg.previous in your data might not contain + all details that are required to reconstruct a complete and valid + analysis script. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + If you specify this, the input data will be read from a *.mat file on disk. The + file should contain only a single variable, corresponding with the input structure. + + See also FT_PREPROCESSING, FT_TIMELOCKANALYSIS, FT_FREQANALYSIS, FT_SOURCEANALYSIS, + FT_CONNECTIVITYANALYSIS, FT_NETWORKANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_analysispipeline.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_analysispipeline", *args, **kwargs) diff --git a/fieldtrip/ft_annotate.py b/fieldtrip/ft_annotate.py new file mode 100644 index 0000000..a1c2287 --- /dev/null +++ b/fieldtrip/ft_annotate.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def ft_annotate(*args, **kwargs): + """ + FT_ANNOTATE returns the same output data as the user has provided as input, but allows + to add comments to that data structure. These comments are stored along with the other + provenance information and can be displayed with FT_ANALYSISPIPELINE. Adding comments + is especially useful if you have manually (i.e. in plain MATLAB) modified the data + structure, whereby some provenance information is missing. + + Use as + outdata = ft_annotate(cfg, indata) + where the input data structure can be any of the FieldTrip data structures and + the configuration structure should contain + cfg.comment = string + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_ANALYSISPIPELINE, FT_MATH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_annotate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_annotate", *args, **kwargs) diff --git a/fieldtrip/ft_anonymizedata.py b/fieldtrip/ft_anonymizedata.py new file mode 100644 index 0000000..c3bb8b5 --- /dev/null +++ b/fieldtrip/ft_anonymizedata.py @@ -0,0 +1,68 @@ +from fieldtrip._runtime import Runtime + + +def ft_anonymizedata(*args, **kwargs): + """ + FT_ANONYMIZEDATA clears the value of potentially identifying fields in + the data and in the provenance information, i.e., it updates the data and + the configuration structure and history that is maintained by FieldTrip + in the cfg field. + + Use as + output = ft_anonymizedata(cfg, data) + where data is any FieldTrip data structure and cfg is a configuration + structure that should contain + cfg.keepnumeric = 'yes' or 'no', keep numeric fields (default = 'yes') + cfg.keepfield = cell-array with strings, fields to keep (default = {}) + cfg.removefield = cell-array with strings, fields to remove (default = {}) + cfg.keepvalue = cell-array with strings, values to keep (default = {}) + cfg.removevalue = cell-array with strings, values to remove (default = {}) + + The graphical user interface consists of a table that shows the name and + value of each provenance element, and whether it should be kept or + removed. Furthermore, it has a number of buttons: + - sort specify which column is used for sorting + - apply apply the current selection of 'keep' and 'remove' and hide the corresponding rows + - keep all toggle all visibe rows to 'keep' + - remove all toggle all visibe rows to 'keep' + - clear all clear all visibe rows, i.e. neither 'keep' nor 'remove' + - quit apply the current selection of 'keep' and 'remove' and exit + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_DEFACEVOLUME, FT_DEFACEMESH, FT_ANALYSISPIPELINE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_anonymizedata.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_anonymizedata", *args, **kwargs) diff --git a/fieldtrip/ft_appenddata.py b/fieldtrip/ft_appenddata.py new file mode 100644 index 0000000..b200892 --- /dev/null +++ b/fieldtrip/ft_appenddata.py @@ -0,0 +1,76 @@ +from fieldtrip._runtime import Runtime + + +def ft_appenddata(*args, **kwargs): + """ + FT_APPENDDATA concatenates multiple raw data structures that have been preprocessed + separately into a single raw data structure. + + Use as + data = ft_appenddata(cfg, data1, data2, data3, ...) + + The following configuration options are supported: + cfg.keepsampleinfo = 'yes', 'no', 'ifmakessense' (default = 'ifmakessense') + + If the input datasets all have the same channels, the trials will be concatenated. + This is useful for example if you have different experimental conditions, which, + besides analyzing them separately, for some reason you also want to analyze + together. The function will check for consistency in the order of the channels. If + the order is inconsistent the channel order of the output will be according to the + channel order of the first data structure in the input. + + If the input datasets have different channels, but the same number of trials, the + channels will be concatenated within each trial. This is useful for example if the + data that you want to analyze contains both MEG and EMG channels which require + different preprocessing options. + + If you concatenate trials and the data originates from the same original datafile, + the sampleinfo is consistent and you can specify cfg.keepsampleinfo='yes'. If the + data originates from different datafiles, the sampleinfo is inconsistent and does + not point to the same recording, hence you should specify cfg.keepsampleinfo='no'. + + Occasionally, the data needs to be concatenated in the trial dimension while + there's a slight discrepancy in the channels in the input data (e.g. missing + channels in one of the data structures). The function will then return a data + structure containing only the channels which are present in all inputs. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. The data structure in the input file should be a + cell-array for this particular function. + + See also FT_PREPROCESSING, FT_DATAYPE_RAW, FT_APPENDTIMELOCK, FT_APPENDFREQ, + FT_APPENDSOURCE, FT_APPENDSENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_appenddata.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_appenddata", *args, **kwargs) diff --git a/fieldtrip/ft_appendfreq.py b/fieldtrip/ft_appendfreq.py new file mode 100644 index 0000000..79dee9c --- /dev/null +++ b/fieldtrip/ft_appendfreq.py @@ -0,0 +1,64 @@ +from fieldtrip._runtime import Runtime + + +def ft_appendfreq(*args, **kwargs): + """ + FT_APPENDFREQ concatenates multiple frequency or time-frequency data structures + that have been processed separately. If the input data structures contain different + channels, it will be concatenated along the channel direction. If the channels are + identical in the input data structures, the data will be concatenated along the + repetition dimension. + + Use as + combined = ft_appendfreq(cfg, freq1, freq2, ...) + + The configuration should contain + cfg.parameter = string, the name of the field to concatenate + + The configuration can optionally contain + cfg.appenddim = string, the dimension to concatenate over (default is automatic) + cfg.tolerance = scalar, tolerance to determine how different the frequency and/or + time axes are allowed to still be considered compatible (default = 1e-5) + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a + *.mat file on disk and/or the output data will be written to a *.mat file. + These mat files should contain only a single variable, corresponding with + the input/output structure. + + If you encounter difficulties with memory usage, you can use + cfg.memory = 'low' or 'high', whether to be memory or computationally efficient, respectively (default = 'high') + + See also FT_FREQANALYSIS, FT_DATATYPE_FREQ, FT_APPENDDATA, FT_APPENDTIMELOCK, + FT_APPENDSENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_appendfreq.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_appendfreq", *args, **kwargs) diff --git a/fieldtrip/ft_appendlayout.py b/fieldtrip/ft_appendlayout.py new file mode 100644 index 0000000..2885fd0 --- /dev/null +++ b/fieldtrip/ft_appendlayout.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def ft_appendlayout(*args, **kwargs): + """ + FT_APPENDLAYOUT concatenates multiple layout descriptions that have been constructed + separately. + + Use as + combined = ft_appendlayout(cfg, layout1, layout2, ...) + where the input layouts result from FT_PREPARE_LAYOUT and the configuration + should contain + cfg.direction = string, 'horizontal' or 'vertical' (default = 'horizontal') + cfg.align = string, 'center', 'left', 'right', 'top' or 'bottom' (default = 'center') + cfg.distance = number, distance between layouts (default is automatic) + cfg.xscale = number, scaling to apply to input layouts along the horizontal direction (default = 1) + cfg.yscale = number, scaling to apply to input layouts along the vertical direction (default = 1) + + See also FT_PREPARE_LAYOUT, FT_LAYOUTPLOT, FT_APPENDSENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_appendlayout.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_appendlayout", *args, **kwargs) diff --git a/fieldtrip/ft_appendsens.py b/fieldtrip/ft_appendsens.py new file mode 100644 index 0000000..bc98b38 --- /dev/null +++ b/fieldtrip/ft_appendsens.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def ft_appendsens(*args, **kwargs): + """ + FT_APPENDSENS concatenates multiple sensor definitions that have been processed + separately. + + Use as + combined = ft_appendsens(cfg, sens1, sens2, ...) + + A call to FT_APPENDSENS results in the label, pos and ori fields to be + concatenated, and the tra matrix to be merged. Any duplicate electrodes + will be removed. The labelold and chanposold fields are kept under the + condition that they are identical across the inputs. + + See also FT_ELECTRODEPLACEMENT, FT_ELECTRODEREALIGN, FT_DATAYPE_SENS, + FT_APPENDDATA, FT_APPENDTIMELOCK, FT_APPENDFREQ, FT_APPENDSOURCE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_appendsens.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_appendsens", *args, **kwargs) diff --git a/fieldtrip/ft_appendsource.py b/fieldtrip/ft_appendsource.py new file mode 100644 index 0000000..19b0c45 --- /dev/null +++ b/fieldtrip/ft_appendsource.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def ft_appendsource(*args, **kwargs): + """ + FT_APPENDSOURCE concatenates multiple volumetric source reconstruction data + structures that have been processed separately. + + Use as + combined = ft_appendsource(cfg, source1, source2, ...) + + If the source reconstructions were computed for different ROIs or different slabs + of a regular 3D grid (as indicated by the source positions), the data will be + concatenated along the spatial dimension. + + If the source reconstructions were computed on the same source positions, but for + different frequencies and/or latencies, e.g. for time-frequency spectrally + decomposed data, the data will be concatenated along the frequency and/or time + dimension, but only of the frequency or time axes are well-behaved, i.e. all data + points along the dimension of interest should be sortable across data objects; + interleaving across data objects is not possible. + + See also FT_SOURCEANALYSIS, FT_DATATYPE_SOURCE, FT_APPENDDATA, FT_APPENDTIMELOCK, + FT_APPENDFREQ + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_appendsource.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_appendsource", *args, **kwargs) diff --git a/fieldtrip/ft_appendspike.py b/fieldtrip/ft_appendspike.py new file mode 100644 index 0000000..c0766f7 --- /dev/null +++ b/fieldtrip/ft_appendspike.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def ft_appendspike(*args, **kwargs): + """ + FT_APPENDSPIKE combines continuous data (i.e. LFP) with point-process data + (i.e. spikes) into a single large dataset. For each spike channel an + additional continuos channel is inserted in the data that contains + zeros most of the time, and an occasional one at the samples at which a + spike occurred. The continuous and spike data are linked together using + the timestamps. + + Use as + [spike] = ft_appendspike(cfg, spike1, spike2, spike3, ...) + where the input structures come from FT_READ_SPIKE, or as + [data] = ft_appendspike(cfg, data, spike1, spike2, ...) + where the first data structure is the result of FT_PREPROCESSING + and the subsequent ones come from FT_READ_SPIKE. + + See also FT_APPENDDATA, FT_PREPROCESSING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_appendspike.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_appendspike", *args, **kwargs) diff --git a/fieldtrip/ft_appendtimelock.py b/fieldtrip/ft_appendtimelock.py new file mode 100644 index 0000000..a8fc50f --- /dev/null +++ b/fieldtrip/ft_appendtimelock.py @@ -0,0 +1,63 @@ +from fieldtrip._runtime import Runtime + + +def ft_appendtimelock(*args, **kwargs): + """ + FT_APPENDTIMELOCK concatenates multiple timelock (ERP/ERF) data structures that + have been processed separately. If the input data structures contain different + channels, it will be concatenated along the channel direction. If the channels are + identical in the input data structures, the data will be concatenated along the + repetition dimension. + + Use as + combined = ft_appendtimelock(cfg, timelock1, timelock2, ...) + + The configuration can contain + cfg.appenddim = string, the dimension to concatenate over which to append, + this can be 'chan' and 'rpt' (default is automatic) + cfg.tolerance = scalar, tolerance to determine how different the time axes + are allowed to still be considered compatible (default = 1e-5) + cfg.keepsampleinfo = 'yes', 'no', 'ifmakessense' (default = 'ifmakessense') + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a + *.mat file on disk and/or the output data will be written to a *.mat file. + These mat files should contain only a single variable, corresponding with + the input/output structure. + + If you encounter difficulties with memory usage, you can use + cfg.memory = 'low' or 'high', whether to be memory or computationally efficient, respectively (default = 'high') + + See also FT_TIMELOCKANALYSIS, FT_DATATYPE_TIMELOCK, FT_APPENDDATA, FT_APPENDFREQ, + FT_APPENDSOURCE, FT_APPENDSENS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_appendtimelock.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_appendtimelock", *args, **kwargs) diff --git a/fieldtrip/ft_artifact_clip.py b/fieldtrip/ft_artifact_clip.py new file mode 100644 index 0000000..0d4aebf --- /dev/null +++ b/fieldtrip/ft_artifact_clip.py @@ -0,0 +1,76 @@ +from fieldtrip._runtime import Runtime + + +def ft_artifact_clip(*args, **kwargs): + """ + FT_ARTIFACT_CLIP scans the data segments of interest for channels that clip, i.,e. + channels that have a constant value for a prolonged time, often indicating that the + signal was outside the range for the amplifier. These clipping artifacts are + detected by the signal being completely flat for a given amount of time. + + Use as + [cfg, artifact] = ft_artifact_clip(cfg) + with the configuration options + cfg.dataset = string with the filename + or + cfg.headerfile = string with the filename + cfg.datafile = string with the filename + and optionally + cfg.headerformat + cfg.dataformat + + Alternatively you can use it as + [cfg, artifact] = ft_artifact_clip(cfg, data) + where the input data is a structure as obtained from FT_PREPROCESSING. + + In both cases the configuration should also contain + cfg.trl = structure that defines the data segments of interest, see FT_DEFINETRIAL + cfg.continuous = 'yes' or 'no' whether the file contains continuous data (default is automatic) + and + cfg.artfctdef.clip.channel = Nx1 cell-array with selection of channels, see FT_CHANNELSELECTION for details + cfg.artfctdef.clip.pretim = pre-artifact rejection interval in seconds (default = 0) + cfg.artfctdef.clip.psttim = post-artifact rejection interval in seconds (default = 0) + cfg.artfctdef.clip.timethreshold = number, minimum duration in seconds of a segment with consecutive identical samples to be considered as 'clipped' + cfg.artfctdef.clip.amplthreshold = number, minimum amplitude difference in consecutive samples to be considered as 'clipped' (default = 0) + string, percent of the amplitude range considered as 'clipped' (i.e. '1%') + + The output argument "artifact" is a Nx2 matrix comparable to the "trl" matrix of + FT_DEFINETRIAL. The first column of which specifying the beginsamples of an + artifact period, the second column contains the endsamples of the artifactperiods. + + To facilitate data-handling and distributed computing, you can use + cfg.inputfile = ... + to read the input data from a *.mat file on disk. This mat files should contain + only a single variable named 'data', corresponding to the input structure. + + See also FT_REJECTARTIFACT, FT_ARTIFACT_CLIP, FT_ARTIFACT_ECG, FT_ARTIFACT_EOG, + FT_ARTIFACT_JUMP, FT_ARTIFACT_MUSCLE, FT_ARTIFACT_THRESHOLD, FT_ARTIFACT_ZVALUE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_artifact_clip.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_artifact_clip", *args, **kwargs) diff --git a/fieldtrip/ft_artifact_ecg.py b/fieldtrip/ft_artifact_ecg.py new file mode 100644 index 0000000..b48c45f --- /dev/null +++ b/fieldtrip/ft_artifact_ecg.py @@ -0,0 +1,76 @@ +from fieldtrip._runtime import Runtime + + +def ft_artifact_ecg(*args, **kwargs): + """ + FT_ARTIFACT_ECG performs a peak-detection on the ECG-channel and identifies the + windows around the QRS peak as artifacts. Using FT_REJECTARTIFACT you can remove + these windows from your data, or using FT_REMOVETEMPLATEARTIFACT you can subtract + an averaged template artifact from your data. + + Use as + [cfg, artifact] = ft_artifact_ecg(cfg) + with the configuration options + cfg.dataset = string with the filename + or + cfg.headerfile = string with the filename + cfg.datafile = string with the filename + and optionally + cfg.headerformat + cfg.dataformat + + Alternatively you can use it as + [cfg, artifact] = ft_artifact_ecg(cfg, data) + where the input data is a structure as obtained from FT_PREPROCESSING. + + In both cases the configuration should also contain + cfg.trl = structure that defines the data segments of interest. See FT_DEFINETRIAL + cfg.continuous = 'yes' or 'no' whether the file contains continuous data + and + cfg.artfctdef.ecg.channel = Nx1 cell-array with selection of channels, see FT_CHANNELSELECTION for details + cfg.artfctdef.ecg.pretim = pre-artifact rejection interval in seconds (default = 0.05) + cfg.artfctdef.ecg.psttim = post-artifact rejection interval in seconds (default = 0.3) + cfg.artfctdef.ecg.cutoff = peak threshold (default = 3) + cfg.artfctdef.ecg.inspect = Nx1 list of channels which will be shown as a QRS-locked average + + The output argument "artifact" is a Nx2 matrix comparable to the "trl" matrix of + FT_DEFINETRIAL. The first column of which specifying the begin samples of an + artifact period, the second column contains the end samples of the QRS periods. + + To facilitate data-handling and distributed computing, you can use + cfg.inputfile = ... + to read the input data from a *.mat file on disk. This mat files should contain + only a single variable named 'data', corresponding to the input structure. + + See also FT_REJECTARTIFACT, FT_REMOVETEMPLATEARTIFACT, FT_ARTIFACT_CLIP, FT_ARTIFACT_ECG, + FT_ARTIFACT_EOG, FT_ARTIFACT_JUMP, FT_ARTIFACT_MUSCLE, FT_ARTIFACT_THRESHOLD, + FT_ARTIFACT_ZVALUE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_artifact_ecg.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_artifact_ecg", *args, **kwargs) diff --git a/fieldtrip/ft_artifact_eog.py b/fieldtrip/ft_artifact_eog.py new file mode 100644 index 0000000..e227c99 --- /dev/null +++ b/fieldtrip/ft_artifact_eog.py @@ -0,0 +1,82 @@ +from fieldtrip._runtime import Runtime + + +def ft_artifact_eog(*args, **kwargs): + """ + FT_ARTIFACT_EOG scans data segments of interest for EOG artifacts. + + Use as + [cfg, artifact] = ft_artifact_eog(cfg) + with the configuration options + cfg.dataset = string with the filename + or + cfg.headerfile = string with the filename + cfg.datafile = string with the filename + and optionally + cfg.headerformat + cfg.dataformat + + Alternatively you can use it as + [cfg, artifact] = ft_artifact_eog(cfg, data) + where the input data is a structure as obtained from FT_PREPROCESSING. + + In both cases the configuration should also contain + cfg.trl = structure that defines the data segments of interest, see FT_DEFINETRIAL + cfg.continuous = 'yes' or 'no' whether the file contains continuous data + + Prior to artifact detection, the data is preprocessed (again) with the following + configuration parameters, which are optimal for identifying EOG artifacts. + cfg.artfctdef.eog.bpfilter = 'yes' + cfg.artfctdef.eog.bpfilttype = 'but' + cfg.artfctdef.eog.bpfreq = [1 15] + cfg.artfctdef.eog.bpfiltord = 4 + cfg.artfctdef.eog.hilbert = 'yes' + + Artifacts are identified by means of thresholding the z-transformed value + of the preprocessed data. + cfg.artfctdef.eog.channel = Nx1 cell-array with selection of channels, see FT_CHANNELSELECTION for details + cfg.artfctdef.eog.cutoff = z-value at which to threshold (default = 4) + cfg.artfctdef.eog.trlpadding = number in seconds (default = 0.5) + cfg.artfctdef.eog.fltpadding = number in seconds (default = 0.1) + cfg.artfctdef.eog.artpadding = number in seconds (default = 0.1) + + The output argument "artifact" is a Nx2 matrix comparable to the "trl" matrix of + FT_DEFINETRIAL. The first column of which specifying the beginsamples of an + artifact period, the second column contains the endsamples of the artifactperiods. + + To facilitate data-handling and distributed computing, you can use + cfg.inputfile = ... + to read the input data from a *.mat file on disk. This mat files should contain + only a single variable named 'data', corresponding to the input structure. + + See also FT_REJECTARTIFACT, FT_ARTIFACT_CLIP, FT_ARTIFACT_ECG, FT_ARTIFACT_EOG, + FT_ARTIFACT_JUMP, FT_ARTIFACT_MUSCLE, FT_ARTIFACT_THRESHOLD, FT_ARTIFACT_ZVALUE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_artifact_eog.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_artifact_eog", *args, **kwargs) diff --git a/fieldtrip/ft_artifact_jump.py b/fieldtrip/ft_artifact_jump.py new file mode 100644 index 0000000..7bb47db --- /dev/null +++ b/fieldtrip/ft_artifact_jump.py @@ -0,0 +1,80 @@ +from fieldtrip._runtime import Runtime + + +def ft_artifact_jump(*args, **kwargs): + """ + FT_ARTIFACT_JUMP scans data segments of interest for SQUID jump artifacts. + + Use as + [cfg, artifact] = ft_artifact_jump(cfg) + with the configuration options + cfg.dataset = string with the filename + or + cfg.headerfile = string with the filename + cfg.datafile = string with the filename + and optionally + cfg.headerformat + cfg.dataformat + + Alternatively you can use it as + [cfg, artifact] = ft_artifact_jump(cfg, data) + where the input data is a structure as obtained from FT_PREPROCESSING. + + In both cases the configuration should also contain + cfg.trl = structure that defines the data segments of interest, see FT_DEFINETRIAL + cfg.continuous = 'yes' or 'no' whether the file contains continuous data + + Prior to artifact detection, the data is preprocessed (again) with the following + configuration parameters, which are optimal for identifying SQUID jump artifacts. + cfg.artfctdef.jump.medianfilter = 'yes' + cfg.artfctdef.jump.medianfiltord = 9 + cfg.artfctdef.jump.absdiff = 'yes' + + Artifacts are identified by means of thresholding the z-transformed value + of the preprocessed data. + cfg.artfctdef.jump.channel = Nx1 cell-array with selection of channels, see FT_CHANNELSELECTION for details + cfg.artfctdef.jump.cutoff = z-value at which to threshold (default = 20) + cfg.artfctdef.jump.trlpadding = number in seconds (default = 0.0) + cfg.artfctdef.jump.fltpadding = number in seconds (default = 0.0) + cfg.artfctdef.jump.artpadding = number in seconds (default = 0.0) + + The output argument "artifact" is a Nx2 matrix comparable to the "trl" matrix of + FT_DEFINETRIAL. The first column of which specifying the beginsamples of an + artifact period, the second column contains the endsamples of the artifactperiods. + + To facilitate data-handling and distributed computing, you can use + cfg.inputfile = ... + to read the input data from a *.mat file on disk. This mat files should contain + only a single variable named 'data', corresponding to the input structure. + + See also FT_REJECTARTIFACT, FT_ARTIFACT_CLIP, FT_ARTIFACT_ECG, FT_ARTIFACT_EOG, + FT_ARTIFACT_JUMP, FT_ARTIFACT_MUSCLE, FT_ARTIFACT_THRESHOLD, FT_ARTIFACT_ZVALUE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_artifact_jump.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_artifact_jump", *args, **kwargs) diff --git a/fieldtrip/ft_artifact_muscle.py b/fieldtrip/ft_artifact_muscle.py new file mode 100644 index 0000000..97058ef --- /dev/null +++ b/fieldtrip/ft_artifact_muscle.py @@ -0,0 +1,83 @@ +from fieldtrip._runtime import Runtime + + +def ft_artifact_muscle(*args, **kwargs): + """ + FT_ARTIFACT_MUSCLE scans data segments of interest for muscle artifacts. + + Use as + [cfg, artifact] = ft_artifact_muscle(cfg) + with the configuration options + cfg.dataset = string with the filename + or + cfg.headerfile = string with the filename + cfg.datafile = string with the filename + and optionally + cfg.headerformat + cfg.dataformat + + Alternatively you can use it as + [cfg, artifact] = ft_artifact_muscle(cfg, data) + where the input data is a structure as obtained from FT_PREPROCESSING. + + In both cases the configuration should also contain + cfg.trl = structure that defines the data segments of interest, see FT_DEFINETRIAL + cfg.continuous = 'yes' or 'no' whether the file contains continuous data + + Prior to artifact detection, the data is preprocessed (again) with the following + configuration parameters, which are optimal for identifying muscle artifacts. + cfg.artfctdef.muscle.bpfilter = 'yes' + cfg.artfctdef.muscle.bpfreq = [110 140] + cfg.artfctdef.muscle.bpfiltord = 8 + cfg.artfctdef.muscle.bpfilttype = 'but' + cfg.artfctdef.muscle.hilbert = 'yes' + cfg.artfctdef.muscle.boxcar = 0.2 + + Artifacts are identified by means of thresholding the z-transformed value + of the preprocessed data. + cfg.artfctdef.muscle.channel = Nx1 cell-array with selection of channels, see FT_CHANNELSELECTION for details + cfg.artfctdef.muscle.cutoff = z-value at which to threshold (default = 4) + cfg.artfctdef.muscle.trlpadding = number in seconds (default = 0.1) + cfg.artfctdef.muscle.fltpadding = number in seconds (default = 0.1) + cfg.artfctdef.muscle.artpadding = number in seconds (default = 0.1) + + The output argument "artifact" is a Nx2 matrix comparable to the "trl" matrix of + FT_DEFINETRIAL. The first column of which specifying the beginsamples of an + artifact period, the second column contains the endsamples of the artifactperiods. + + To facilitate data-handling and distributed computing, you can use + cfg.inputfile = ... + to read the input data from a *.mat file on disk. This mat files should contain + only a single variable named 'data', corresponding to the input structure. + + See also FT_REJECTARTIFACT, FT_ARTIFACT_CLIP, FT_ARTIFACT_ECG, FT_ARTIFACT_EOG, + FT_ARTIFACT_JUMP, FT_ARTIFACT_MUSCLE, FT_ARTIFACT_THRESHOLD, FT_ARTIFACT_ZVALUE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_artifact_muscle.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_artifact_muscle", *args, **kwargs) diff --git a/fieldtrip/ft_artifact_nan.py b/fieldtrip/ft_artifact_nan.py new file mode 100644 index 0000000..233a27e --- /dev/null +++ b/fieldtrip/ft_artifact_nan.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def ft_artifact_nan(*args, **kwargs): + """ + FT_ARTIFACT_NAN identifies artifacts that are indicated in the data as NaN (not a + number) values. + + Use as + [cfg, artifact] = ft_artifact_nan(cfg, data) + where the input data is a structure as obtained from FT_REJECTARTIFACT with the + option cfg.artfctdef.reject='nan', or from FT_REJECTVISUAL with cfg.keeptrial='nan' + or cfg.keepchannel='nan'. + + The configuration can contain + cfg.artfctdef.nan.channel = Nx1 cell-array with selection of channels, see FT_CHANNELSELECTION for details + + The output argument "artifact" is a Nx2 matrix comparable to the "trl" matrix of + FT_DEFINETRIAL. The first column of which specifying the beginsamples of an + artifact period, the second column contains the endsamples of the artifactperiods. + + To facilitate data-handling and distributed computing, you can use + cfg.inputfile = ... + to read the input data from a *.mat file on disk. This mat files should contain + only a single variable named 'data', corresponding to the input structure. + + See also FT_REJECTARTIFACT, FT_ARTIFACT_CLIP, FT_ARTIFACT_ECG, FT_ARTIFACT_EOG, + FT_ARTIFACT_JUMP, FT_ARTIFACT_MUSCLE, FT_ARTIFACT_THRESHOLD, FT_ARTIFACT_ZVALUE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_artifact_nan.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_artifact_nan", *args, **kwargs) diff --git a/fieldtrip/ft_artifact_threshold.py b/fieldtrip/ft_artifact_threshold.py new file mode 100644 index 0000000..8fdd62e --- /dev/null +++ b/fieldtrip/ft_artifact_threshold.py @@ -0,0 +1,91 @@ +from fieldtrip._runtime import Runtime + + +def ft_artifact_threshold(*args, **kwargs): + """ + FT_ARTIFACT_THRESHOLD scans data segments of interest for channels in which the + signal exceeds a specified minimum or maximum value, or in which the peak-to-peak + range within the trial exceeds a specified threshold. + + Use as + [cfg, artifact] = ft_artifact_threshold(cfg) + with the configuration options + cfg.dataset = string with the filename + or + cfg.headerfile = string with the filename + cfg.datafile = string with the filename + and optionally + cfg.headerformat + cfg.dataformat + + Alternatively you can use it as + [cfg, artifact] = ft_artifact_threshold(cfg, data) + where the input data is a structure as obtained from FT_PREPROCESSING. + + In both cases the configuration should also contain + cfg.trl = structure that defines the data segments of interest, see FT_DEFINETRIAL + cfg.continuous = 'yes' or 'no' whether the file contains continuous data + and + cfg.artfctdef.threshold.channel = cell-array with channel labels + cfg.artfctdef.threshold.bpfilter = 'no' or 'yes' (default = 'yes') + cfg.artfctdef.threshold.bpfreq = [0.3 30] + cfg.artfctdef.threshold.bpfiltord = 4 + + In the same way as specifying the options for band-pass filtering, it is also + possible to specify lpfilter, hpfilter, bsfilter, dftfilter or medianfilter, see + FT_PREPROCESSING. + + The detection of artifacts is done according to the following settings, + you should specify at least one of these thresholds + cfg.artfctdef.threshold.min = value in uV or T, default -inf + cfg.artfctdef.threshold.max = value in uV or T, default inf + cfg.artfctdef.threshold.onset = value in uV or T, default inf + cfg.artfctdef.threshold.offset = value in uV or T, default inf + + When cfg.artfctdef.threshold.onset and offset are used, the rising and falling + flank are thresholded with different values. In case onset and offset are both + positive, the data will be thresholded above their values. In case both onset and + offset are negative, the data will be thresholded below their values. + + Note that this function does not support artifactpadding or filterpadding. + + The output argument "artifact" is a Nx2 matrix comparable to the "trl" matrix of + FT_DEFINETRIAL. The first column of which specifying the beginsamples of an + artifact period, the second column contains the endsamples of the artifactperiods. + + To facilitate data-handling and distributed computing, you can use + cfg.inputfile = ... + to read the input data from a *.mat file on disk. This mat files should contain + only a single variable named 'data', corresponding to the input structure. + + See also FT_REJECTARTIFACT, FT_ARTIFACT_CLIP, FT_ARTIFACT_ECG, FT_ARTIFACT_EOG, + FT_ARTIFACT_JUMP, FT_ARTIFACT_MUSCLE, FT_ARTIFACT_THRESHOLD, FT_ARTIFACT_ZVALUE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_artifact_threshold.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_artifact_threshold", *args, **kwargs) diff --git a/fieldtrip/ft_artifact_tms.py b/fieldtrip/ft_artifact_tms.py new file mode 100644 index 0000000..926c47d --- /dev/null +++ b/fieldtrip/ft_artifact_tms.py @@ -0,0 +1,102 @@ +from fieldtrip._runtime import Runtime + + +def ft_artifact_tms(*args, **kwargs): + """ + FT_ARTIFACT_TMS reads the data segments of interest from file and identifies + artefacts in EEG recordings that were done during TMS stimulation. + + Use as + [cfg, artifact] = ft_artifact_tms(cfg) + with the configuration options + cfg.dataset = string with the filename + or + cfg.headerfile = string with the filename + cfg.datafile = string with the filename + and optionally + cfg.headerformat + cfg.dataformat + + Alternatively you can use it as + [cfg, artifact] = ft_artifact_tms(cfg, data) + where the input data is a structure as obtained from FT_PREPROCESSING. + + In both cases the configuration should also contain + cfg.trl = structure that defines the data segments of interest, see FT_DEFINETRIAL + cfg.continuous = 'yes' or 'no' whether the file contains continuous data (default = 'yes') + and + cfg.method = 'detect' or 'marker', see below. + cfg.prestim = scalar, time in seconds prior to onset of detected event to mark as artifactual (default = 0.005 seconds) + cfg.poststim = scalar, time in seconds post onset of detected even to mark as artifactual (default = 0.010 seconds) + + The different methods are described in detail below. + + With cfg.method='detect', TMS-artifact are detected on basis of transient + high-amplidude gradients that are typical for TMS-pulses. The data is preprocessed + (again) with the following settings, which are optimal for identifying TMS-pulses. + Artifacts are identified by means of thresholding the z-transformed value of the + preprocessed data. This method acts as a wrapper around FT_ARTIFACT_ZVALUE. + cfg.artfctdef.tms.derivative = 'yes' + cfg.artfctdef.tms.channel = Nx1 cell-array with selection of channels, see FT_CHANNELSELECTION for details + cfg.artfctdef.tms.cutoff = z-value at which to threshold (default = 4) + cfg.artfctdef.tms.trlpadding = 0.1 + cfg.artfctdef.tms.fltpadding = 0.1 + cfg.artfctdef.tms.artpadding = 0.01 + Be aware that if one artifact falls within this specified range of another + artifact, both artifact will be counted as one. Depending on cfg.prestim and + cfg.poststim you may not mark enough data as artifactual. + + With cfg.method='marker', TMS-artifact onsets and offsets are based on + markers/triggers that are written into the EEG dataset. This method acts as a + wrapper around FT_DEFINETRIAL to determine on- and offsets of TMS pulses by reading + markers in the EEG. + cfg.trialfun = function name, see below (default = 'ft_trialfun_general') + cfg.trialdef.eventtype = 'string' + cfg.trialdef.eventvalue = number, string or list with numbers or strings + The cfg.trialfun option is a string containing the name of a function that you + wrote yourself and that FT_ARTIFACT_TMS will call. The function should take the + cfg-structure as input and should give a NxM matrix with M>=3 in the same format as + "trl" as the output. You can add extra custom fields to the configuration structure + to pass as arguments to your own trialfun. Furthermore, inside the trialfun you can + use the FT_READ_EVENT function to get the event information from your data file. + + The output argument "artifact" is a Nx2 matrix comparable to the "trl" matrix of + FT_DEFINETRIAL. The first column of which specifying the beginsamples of an + artifact period, the second column contains the endsamples of the artifactperiods. + + To facilitate data-handling and distributed computing, you can use + cfg.inputfile = ... + to read the input data from a *.mat file on disk. This mat files should contain + only a single variable named 'data', corresponding to the input structure. + + See also FT_REJECTARTIFACT, FT_ARTIFACT_CLIP, FT_ARTIFACT_ECG, FT_ARTIFACT_EOG, + FT_ARTIFACT_JUMP, FT_ARTIFACT_MUSCLE, FT_ARTIFACT_THRESHOLD, FT_ARTIFACT_ZVALUE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_artifact_tms.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_artifact_tms", *args, **kwargs) diff --git a/fieldtrip/ft_artifact_zvalue.py b/fieldtrip/ft_artifact_zvalue.py new file mode 100644 index 0000000..a719497 --- /dev/null +++ b/fieldtrip/ft_artifact_zvalue.py @@ -0,0 +1,167 @@ +from fieldtrip._runtime import Runtime + + +def ft_artifact_zvalue(*args, **kwargs): + """ + FT_ARTIFACT_ZVALUE scans data segments of interest for artifacts, by means of + thresholding the z-scored values of signals that have been preprocessed, + using heuristics that increase the sensitivity to detect certain types of artifacts. + Depending on the preprocessing options, this method will be sensitive to EOG, muscle + or SQUID jump artifacts. The z-scoring is applied in order to make the threshold + independent of the phsyical units in the data. + + Use as + [cfg, artifact] = ft_artifact_zvalue(cfg) + with the configuration options + cfg.trl = structure that defines the data segments of interest, see FT_DEFINETRIAL + cfg.continuous = 'yes' or 'no' whether the file contains continuous data. + If the data has not been recorded continuously, then the cfg.trl should + stricly observe the boundaries of the discontinuous segments, and the + permitted values padding options (described below) are restricted to 0. + cfg.dataset = string with the filename + or + cfg.headerfile = string with the filename + cfg.datafile = string with the filename + and optionally + cfg.headerformat + cfg.dataformat + + Alternatively you can use it as + [cfg, artifact] = ft_artifact_zvalue(cfg, data) + where the input data is a structure as obtained from FT_PREPROCESSING. Any preprocessing options + defined in the cfg will be applied to the data before the z-scoring and thresholding. + + In both cases the configuration should also contain + cfg.trl = structure that defines the data segments of interest, see FT_DEFINETRIAL + cfg.continuous = 'yes' or 'no' whether the file contains continuous data + and + cfg.artfctdef.zvalue.channel = Nx1 cell-array with selection of channels, see FT_CHANNELSELECTION for details + cfg.artfctdef.zvalue.cutoff = number, z-value threshold + cfg.artfctdef.zvalue.trlpadding = number in seconds + cfg.artfctdef.zvalue.fltpadding = number in seconds + cfg.artfctdef.zvalue.artpadding = number in seconds + + If you encounter difficulties with memory usage, you can use + cfg.memory = 'low' or 'high', whether to be memory or computationally efficient, respectively (default = 'high') + + The optional configuration settings (see below) are: + cfg.artfctdef.zvalue.artfctpeak = 'yes' or 'no' + cfg.artfctdef.zvalue.artfctpeakrange = [begin end] + cfg.artfctdef.zvalue.interactive = 'yes' or 'no' + cfg.artfctdef.zvalue.zscore = 'yes' (default) or 'no' + cfg.artfctdef.zvalue.keepintermediate = 'no' (default) or 'yes' + + If you specify cfg.artfctdef.zvalue.artfctpeak='yes', a peak detection on the suprathreshold + z-scores will be performed, and the artifact will be defined relative to + the peak, where the begin and end points will be defined by + cfg.artfctdef.zvalue artfctpeakrange, rather than by the time points that + exceed the threshold. + + You can specify cfg.artfctdef.zvalue.artfctpeakrange if you want to use the + detected artifacts as input to the DSS method of FT_COMPONENTANALYSIS. The result + is saved into cfg.artfctdef.zvalue.artifact. The range will automatically + respect the trial boundaries, i.e. it will be shorter if peak is near the beginning + or end of a trial. Samples between trials will be removed, thus this will not match + the sampleinfo of the data structure. + + If you specify cfg.artfctdef.zvalue.zscore = 'no', the data will NOT be z-scored prior + to thresholding. This goes a bit against the name of the function, but it may be useful + if the threshold is to be defined in meaningful physical units, e.g. degrees of visual + angle for eye position data. + + If you specify cfg.artfctdef.zvalue.keepintermediate = 'yes', the intermediate data + that has been used for the artifacts' definition will be passed to the output. This + allows for the (potentially lengthy) computations to be uncoupled from the interactive + part. + + If you specify cfg.artfctdef.zvalue.interactive = 'yes', a graphical user interface + will show in which you can manually accept/reject the detected artifacts, and/or + change the threshold. To control the graphical interface via keyboard, use the + following keys: + + q : Stop + + comma : Step to the previous artifact trial + a : Specify artifact trial to display + period : Step to the next artifact trial + + x : Step 10 trials back + leftarrow : Step to the previous trial + t : Specify trial to display + rightarrow : Step to the next trial + c : Step 10 trials forward + + k : Keep trial + space : Mark complete trial as artifact + r : Mark part of trial as artifact + + downarrow : Shift the z-threshold down + z : Specify the z-threshold + uparrow : Shift the z-threshold down + + Configuration settings related to the preprocessing of the data are + cfg.artfctdef.zvalue.lpfilter = 'no' or 'yes' lowpass filter + cfg.artfctdef.zvalue.hpfilter = 'no' or 'yes' highpass filter + cfg.artfctdef.zvalue.bpfilter = 'no' or 'yes' bandpass filter + cfg.artfctdef.zvalue.bsfilter = 'no' or 'yes' bandstop filter for line noise removal + cfg.artfctdef.zvalue.dftfilter = 'no' or 'yes' line noise removal using discrete fourier transform + cfg.artfctdef.zvalue.medianfilter = 'no' or 'yes' jump preserving median filter + cfg.artfctdef.zvalue.lpfreq = lowpass frequency in Hz + cfg.artfctdef.zvalue.hpfreq = highpass frequency in Hz + cfg.artfctdef.zvalue.bpfreq = bandpass frequency range, specified as [low high] in Hz + cfg.artfctdef.zvalue.bsfreq = bandstop frequency range, specified as [low high] in Hz + cfg.artfctdef.zvalue.lpfiltord = lowpass filter order + cfg.artfctdef.zvalue.hpfiltord = highpass filter order + cfg.artfctdef.zvalue.bpfiltord = bandpass filter order + cfg.artfctdef.zvalue.bsfiltord = bandstop filter order + cfg.artfctdef.zvalue.medianfiltord = length of median filter + cfg.artfctdef.zvalue.lpfilttype = digital filter type, 'but' (default) or 'firws' or 'fir' or 'firls' + cfg.artfctdef.zvalue.hpfilttype = digital filter type, 'but' (default) or 'firws' or 'fir' or 'firls' + cfg.artfctdef.zvalue.bpfilttype = digital filter type, 'but' (default) or 'firws' or 'fir' or 'firls' + cfg.artfctdef.zvalue.bsfilttype = digital filter type, 'but' (default) or 'firws' or 'fir' or 'firls' + cfg.artfctdef.zvalue.detrend = 'no' or 'yes' + cfg.artfctdef.zvalue.demean = 'no' or 'yes' + cfg.artfctdef.zvalue.baselinewindow = [begin end] in seconds, the default is the complete trial + cfg.artfctdef.zvalue.hilbert = 'no' or 'yes' + cfg.artfctdef.zvalue.rectify = 'no' or 'yes' + + The output argument "artifact" is a Nx2 matrix comparable to the "trl" matrix of + FT_DEFINETRIAL. The first column of which specifying the beginsamples of an + artifact period, the second column contains the endsamples of the artifactperiods. + + To facilitate data-handling and distributed computing, you can use + cfg.inputfile = ... + to read the input data from a *.mat file on disk. This mat files should contain + only a single variable named 'data', corresponding to the input structure. + + See also FT_REJECTARTIFACT, FT_ARTIFACT_CLIP, FT_ARTIFACT_ECG, FT_ARTIFACT_EOG, + FT_ARTIFACT_JUMP, FT_ARTIFACT_MUSCLE, FT_ARTIFACT_THRESHOLD, FT_ARTIFACT_ZVALUE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_artifact_zvalue.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_artifact_zvalue", *args, **kwargs) diff --git a/fieldtrip/ft_audiovideobrowser.py b/fieldtrip/ft_audiovideobrowser.py new file mode 100644 index 0000000..2e75623 --- /dev/null +++ b/fieldtrip/ft_audiovideobrowser.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def ft_audiovideobrowser(*args, **kwargs): + """ + FT_AUDIOVIDEOBROWSER reads and vizualizes the audio and/or video data + corresponding to the EEG/MEG data that is passed into this function. + + Use as + ft_audiovideobrowser(cfg) + or as + ft_audiovideobrowser(cfg, data) + where the input data is the result from FT_PREPROCESSING or from FT_COMPONENTANALYSIS. + + The configuration structure can contain the following options + cfg.datahdr = header structure of the EEG/MEG data, see FT_READ_HEADER + cfg.audiohdr = header structure of the audio data, see FT_READ_HEADER + cfg.videohdr = header structure of the video data, see FT_READ_HEADER + cfg.audiofile = string with the filename + cfg.videofile = string with the filename + cfg.trl = Nx3 matrix, expressed in the MEG/EEG data samples, see FT_DEFINETRIAL + cfg.anonymize = [x1 x2 y1 y2], range in pixels for placing a bar over the eyes (default = []) + cfg.interactive = 'yes' or 'no' (default = 'yes') + + If you do NOT specify cfg.datahdr, the header must be present in the input data. + If you do NOT specify cfg.audiohdr, the header will be read from the audio file. + If you do NOT specify cfg.videohdr, the header will be read from the video file. + If you do NOT specify cfg.trl, the input data should contain a sampleinfo field. + + See also FT_DATABROWSER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_audiovideobrowser.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_audiovideobrowser", *args, **kwargs, nargout=0) diff --git a/fieldtrip/ft_badchannel.py b/fieldtrip/ft_badchannel.py new file mode 100644 index 0000000..9b75c89 --- /dev/null +++ b/fieldtrip/ft_badchannel.py @@ -0,0 +1,98 @@ +from fieldtrip._runtime import Runtime + + +def ft_badchannel(*args, **kwargs): + """ + FT_BADCHANNEL tries to identify bad channels in a MEG or EEG dataset. Different + methods are implemented to identify bad channels, these are largely shared with + those implemented in FT_REJECTVISUAL with the summary method. The methods are + shortly described in detail below. + + VAR, STD, MIN, MAX, MAXABS, RANGE, KURTOSIS, ZVALUE - compute the specified metric + for each channel in each trial and check whether it exceeds the threshold. + + NEIGHBEXPVAR - identifies channels that cannot be explained very well by a linear + combination of their neighbours. A general linear model is used to compute the + explained variance. A value close to 1 means that a channel is similar to its + neighbours, a value close to 0 indicates a "bad" channel. + + NEIGHBCORR - identifies channels that have low correlation with each of their + neighbours. The rationale is that "bad" channel have inherent noise that is + uncorrelated with other sensors. + + NEIGHBSTDRATIO - identifies channels that have a standard deviation which is very + different from that of each of their neighbours. This computes the difference in + the standard deviation of each channel to each of its neighbours, relative to that + of the neighbours. + + Use as + [cfg] = ft_badchannel(cfg, data) + where the input data corresponds to the output from FT_PREPROCESSING. + + The configuration should contain + cfg.metric = string, describes the metric that should be computed in summary mode for each channel in each trial, can be + 'var' variance within each channel (default) + 'std' standard deviation within each channel + 'db' decibel value within each channel + 'mad' median absolute deviation within each channel + '1/var' inverse variance within each channel + 'min' minimum value in each channel + 'max' maximum value in each channel + 'maxabs' maximum absolute value in each channel + 'range' range from min to max in each channel + 'kurtosis' kurtosis, i.e. measure of peakedness of the amplitude distribution + 'zvalue' mean and std computed over all time and trials, per channel + 'neighbexpvar' relative variance explained by neighboring channels in each trial + cfg.threshold = scalar, the optimal value depends on the methods and on the data characteristics + cfg.neighbours = neighbourhood structure, see FT_PREPARE_NEIGHBOURS for details + cfg.nbdetect = 'any', 'most', 'all', 'median', see below (default = 'median') + cfg.feedback = 'yes' or 'no', whether to show an image of the neighbour values (default = 'no') + + The following options allow you to make a pre-selection + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION for details + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + + The 'neighcorrel' and 'neighstdratio' methods implement the bad channel detection + (more or less) according to the paper "Adding dynamics to the Human Connectome + Project with MEG", Larson-Prior et al. https://doi.org/10.1016/j.neuroimage.2013.05.056. + + Most methods compute a scalar value for each channel that can simply be + thresholded. The NEIGHBCORR and NEIGHBSTDRATIO compute a vector with a value for + each of the neighbour of a channel. The cfg.nbdetect option allows you to specify + whether you want to flag the channel as bad in case 'all' of its neighbours exceed + the threshold, if 'most' exceed the threshold, or if 'any' of them exceeds the + threshold. Note that when you specify 'any', then all channels neighbouring a bad + channel will also be marked as bad, since they all have at least one bad neighbour. + You can also specify 'median', in which case the threshold is applied to the median + value over neighbours. + + See also FT_BADSEGMENT, FT_BADDATA, FT_REJECTVISUAL, FT_CHANNELREPAIR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_badchannel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_badchannel", *args, **kwargs) diff --git a/fieldtrip/ft_baddata.py b/fieldtrip/ft_baddata.py new file mode 100644 index 0000000..262d685 --- /dev/null +++ b/fieldtrip/ft_baddata.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def ft_baddata(*args, **kwargs): + """ + FT_BADDATA identifies bad data in a MEG or EEG dataset by looping over all trials + and all channels. Each channel in each trial is considered separately, in the + remainder of the help we will refer to this as "traces". Different methods are + implemented, these are largely shared with those implemented in FT_REJECTVISUAL + with the "summary" method. The methods are shortly described in detail below. Bad + traces are replaced in the output data with nan. + + VAR, STD, MIN, MAX, MAXABS, RANGE, KURTOSIS, ZVALUE - compute the specified metric + for each channel in each trial and check whether it exceeds the threshold. + + NEIGHBEXPVAR - identifies channels that cannot be explained very well by a linear + combination of their neighbours. A general linear model is used to compute the + explained variance. A value close to 1 means that a channel is similar to its + neighbours, a value close to 0 indicates a "bad" channel. + + Use as + [data_clean] = ft_baddata(cfg, data) + where the input data corresponds to the output from FT_PREPROCESSING. + + The configuration should contain + cfg.metric = string, describes the metric that should be computed in summary mode for each channel in each trial, can be + 'var' variance within each channel (default) + 'std' standard deviation within each channel + 'db' decibel value within each channel + 'mad' median absolute deviation within each channel + '1/var' inverse variance within each channel + 'min' minimum value in each channel + 'max' maximum value in each channel + 'maxabs' maximum absolute value in each channel + 'range' range from min to max in each channel + 'kurtosis' kurtosis, i.e. measure of peakedness of the amplitude distribution in trace + 'zvalue' mean and std computed over all time and trials, per channel + 'neighbexpvar' relative variance explained by neighboring channels in each trial + cfg.threshold = scalar, the appropriate value depends on the data characteristics and the metric + cfg.feedback = 'yes' or 'no', whether to show an image of the neighbour values (default = 'no') + + The following options allow you to make a pre-selection + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION for details + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + + See also FT_BADCHANNEL, FT_BADSEGMENT, FT_REJECTVISUAL, FT_CHANNELREPAIR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_baddata.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_baddata", *args, **kwargs) diff --git a/fieldtrip/ft_badsegment.py b/fieldtrip/ft_badsegment.py new file mode 100644 index 0000000..cba93d1 --- /dev/null +++ b/fieldtrip/ft_badsegment.py @@ -0,0 +1,97 @@ +from fieldtrip._runtime import Runtime + + +def ft_badsegment(*args, **kwargs): + """ + FT_BADSEGMENT tries to identify bad segments or trials in a MEG or EEG dataset. + Different methods are implemented to identify bad channels, these are largely + shared with those implemented in FT_REJECTVISUAL with the summary method. + + VAR, STD, MIN, MAX, MAXABS, RANGE, KURTOSIS, ZVALUE - compute the specified metric + for each channel in each trial and check whether it exceeds the threshold. + + NEIGHBEXPVAR - identifies channels that cannot be explained very well by a linear + combination of their neighbours. A general linear model is used to compute the + explained variance. A value close to 1 means that a channel is similar to its + neighbours, a value close to 0 indicates a "bad" channel. + + NEIGHBCORR - identifies channels that have low correlation with each of their + neighbours. The rationale is that "bad" channel have inherent noise that is + uncorrelated with other sensors. + + NEIGHBSTDRATIO - identifies channels that have a standard deviation which is very + different from that of each of their neighbours. This computes the difference in + the standard deviation of each channel to each of its neighbours, relative to that + of the neighbours. + + Use as + [cfg, artifact] = ft_badchannel(cfg, data) + where the input data corresponds to the output from FT_PREPROCESSING. + + The configuration should contain + cfg.metric = string, describes the metric that should be computed in summary mode for each channel in each trial, can be + 'var' variance within each channel (default) + 'std' standard deviation within each channel + 'db' decibel value within each channel + 'mad' median absolute deviation within each channel + '1/var' inverse variance within each channel + 'min' minimum value in each channel + 'max' maximum value in each channel + 'maxabs' maximum absolute value in each channel + 'range' range from min to max in each channel + 'kurtosis' kurtosis, i.e. measure of peakedness of the amplitude distribution + 'zvalue' mean and std computed over all time and trials, per channel + 'neighbexpvar' relative variance explained by neighboring channels in each trial + cfg.threshold = scalar, the optimal value depends on the methods and on the data characteristics + cfg.neighbours = neighbourhood structure, see FT_PREPARE_NEIGHBOURS for details + cfg.nbdetect = 'any', 'most', 'all', 'median', see below (default = 'median') + cfg.feedback = 'yes' or 'no', whether to show an image of the neighbour values (default = 'no') + + The following options allow you to make a pre-selection + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION for details + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + + The 'neighcorrel' and 'neighstdratio' methods implement the bad channel detection + (more or less) according to the paper "Adding dynamics to the Human Connectome + Project with MEG", Larson-Prior et al. https://doi.org/10.1016/j.neuroimage.2013.05.056. + + Most methods compute a scalar value for each channel that can simply be + thresholded. The NEIGHBCORR and NEIGHBSTDRATIO compute a vector with a value for + each of the neighbour of a channel. The cfg.nbdetect option allows you to specify + whether you want to flag the channel as bad in case 'all' of its neighbours exceed + the threshold, if 'most' exceed the threshold, or if 'any' of them exceeds the + threshold. Note that when you specify 'any', then all channels neighbouring a bad + channel will also be marked as bad, since they all have at least one bad neighbour. + You can also specify 'median', in which case the threshold is applied to the median + value over neighbours. + + See also FT_BADCHANNEL, FT_BADDATA, FT_REJECTVISUAL, FT_REJECTARTIFACT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_badsegment.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_badsegment", *args, **kwargs) diff --git a/fieldtrip/ft_channelnormalise.py b/fieldtrip/ft_channelnormalise.py new file mode 100644 index 0000000..e4c73e6 --- /dev/null +++ b/fieldtrip/ft_channelnormalise.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def ft_channelnormalise(*args, **kwargs): + """ + FT_CHANNELNORMALISE shifts and scales all channels of the the input data. + The default behavior is to subtract each channel's mean, and scale to a + standard deviation of 1, for each channel individually. + + Use as + [dataout] = ft_channelnormalise(cfg, data) + + The configuration can contain + cfg.channel = 'all', or a selection of channels + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.demean = 'yes' or 'no' (or boolean value) (default = 'yes') + cfg.scale = scalar value used for scaling (default = 1) + cfg.method = 'perchannel', or 'acrosschannel', computes the + standard deviation per channel, or across all channels. + The latter method leads to the same scaling across + channels and preserves topographical distributions + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_COMPONENTANALYSIS, FT_FREQBASELINE, FT_TIMELOCKBASELINE + + Copyright (C) 2010, Jan-Mathijs Schoffelen + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_channelnormalise.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_channelnormalise", *args, **kwargs) diff --git a/fieldtrip/ft_channelrepair.py b/fieldtrip/ft_channelrepair.py new file mode 100644 index 0000000..1c87197 --- /dev/null +++ b/fieldtrip/ft_channelrepair.py @@ -0,0 +1,88 @@ +from fieldtrip._runtime import Runtime + + +def ft_channelrepair(*args, **kwargs): + """ + FT_CHANNELREPAIR repairs bad or missing channels in the data by replacing + them with the plain average of of all neighbours, by a weighted average + of all neighbours, by an interpolation based on a surface Laplacian, or + by spherical spline interpolating (see Perrin et al., 1989). + + Use as + [interp] = ft_channelrepair(cfg, data) + where the input data corresponds to the output from FT_PREPROCESSING. + + The configuration should contain + cfg.method = 'weighted', 'average', 'spline', 'slap' or 'nan' (default = 'weighted') + cfg.badchannel = cell-array, see FT_CHANNELSELECTION for details + cfg.missingchannel = cell-array, see FT_CHANNELSELECTION for details + cfg.neighbours = neighbourhood structure, see FT_PREPARE_NEIGHBOURS for details + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.lambda = regularisation parameter (default = 1e-5, for method 'spline' and 'slap') + cfg.order = order of the polynomial interpolation (default = 4 for methods 'spline' and 'slap') + cfg.senstype = string, which type of data to repair. Can be 'meg', 'eeg' or 'nirs' (default is automatic) + + The weighted and average method are less reliable in case multiple bad channels lie + next to each other. In that case the bad channels will be removed from the + neighbours and not considered for interpolation. + + If you want to reconstruct channels that are absent in your data, those + channels may also be missing from the sensor definition (grad, elec or opto) + and determining the neighbours is non-trivial. In that case you must use + a complete sensor definition from another dataset or from a template. + + The EEG, MEG or NIRS sensor positions can be present as a field in the + data (data.grad/data.elec/data.opto, depending on the type of data), + or can be specified as cfg option. Either one is required for the following + methods: 'weighted', 'spline', and 'slap'. Depending on the type of + data this should be one of the following + cfg.elec = structure with electrode positions or filename, see FT_READ_SENS + cfg.grad = structure with gradiometer definition or filename, see FT_READ_SENS + cfg.opto = structure with optode definition, see FT_READ_SENS + + This function will only repair one type of channels (MEG, EEG or NIRS) at + a time. If you want to repair multiple types of channels, you should call + it multiple times and use FT_SELECTDATA and FT_APPENDDATA. + + This function only interpolates data over space, not over time. If you want to + interpolate using temporal information, e.g. using a segment of data before and + after the nan-marked artifact, you should use FT_INTERPOLATENAN. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_MEGREALIGN, FT_MEGPLANAR, FT_PREPARE_NEIGHBOURS, FT_INTERPOLATENAN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_channelrepair.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_channelrepair", *args, **kwargs) diff --git a/fieldtrip/ft_clusterplot.py b/fieldtrip/ft_clusterplot.py new file mode 100644 index 0000000..ce36606 --- /dev/null +++ b/fieldtrip/ft_clusterplot.py @@ -0,0 +1,70 @@ +from fieldtrip._runtime import Runtime + + +def ft_clusterplot(*args, **kwargs): + """ + FT_CLUSTERPLOT plots a series of topographies with highlighted clusters. + + Use as + ft_clusterplot(cfg, stat) + where the input data is obtained from FT_TIMELOCKSTATISTICS or FT_FREQSTATISTICS. + + The configuration options can be + cfg.alpha = number, highest cluster p-value to be plotted max 0.3 (default = 0.05) + cfg.highlightseries = 1x5 cell-array, highlight option series with 'on', 'labels' or 'numbers' (default {'on', 'on', 'on', 'on', 'on'} for p < [0.01 0.05 0.1 0.2 0.3] + cfg.highlightsymbolseries = 1x5 vector, highlight marker symbol series (default ['*', 'x', '+', 'o', '.'] for p < [0.01 0.05 0.1 0.2 0.3] + cfg.highlightsizeseries = 1x5 vector, highlight marker size series (default [6 6 6 6 6] for p < [0.01 0.05 0.1 0.2 0.3]) + cfg.highlightcolorpos = color of highlight marker for positive clusters (default = [0 0 0]) + cfg.highlightcolorneg = color of highlight marker for negative clusters (default = [0 0 0]) + cfg.subplotsize = layout of subplots ([h w], default [3 5]) + cfg.saveaspng = string, filename of the output figures (default = 'no') + cfg.visible = string, 'on' or 'off' whether figure will be visible (default = 'on') + cfg.position = location and size of the figure, specified as [left bottom width height] (default is automatic) + cfg.renderer = string, 'opengl', 'zbuffer', 'painters', see RENDERERINFO (default is automatic, try 'painters' when it crashes) + cfg.toi = vector, or 'all' (default) indicates which time + points (or frequency bins) are to be plotted. If specified as 'all' only the + data points with identified clusters are plotted + cfg.figure = 'yes' or 'no', whether to open a new figure. You can also specify a figure handle from FIGURE, GCF or SUBPLOT. (default = 'yes') + cfg.figurename = string, title of the figure window + cfg.position = location and size of the figure, specified as [left bottom width height] (default is automatic) + cfg.renderer = string, 'opengl', 'zbuffer', 'painters', see RENDERERINFO (default is automatic, try 'painters' when it crashes) + + You can also specify most configuration options that apply to FT_TOPOPLOTER or FT_TOPOPLOTTFR, + except for cfg.xlim, any of the highlight options, cfg.comment and cfg.commentpos. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + If you specify this option the input data will be read from a *.mat + file on disk. This mat files should contain only a single variable named 'data', + corresponding to the input structure. + + See also FT_TOPOPLOTTFR, FT_TOPOPLOTER, FT_MOVIEPLOTTFR, FT_MOVIEPLOTER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_clusterplot.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_clusterplot", *args, **kwargs) diff --git a/fieldtrip/ft_combineplanar.py b/fieldtrip/ft_combineplanar.py new file mode 100644 index 0000000..3a3bb06 --- /dev/null +++ b/fieldtrip/ft_combineplanar.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def ft_combineplanar(*args, **kwargs): + """ + FT_COMBINEPLANAR computes the planar gradient magnitude over both directions + combining the two gradients at each sensor to a single positive-valued number. This + can be done for single-trial/averaged planar gradient ERFs or single-trial/averaged + TFRs. + + Use as + [data] = ft_combineplanar(cfg, data) + where data contains an averaged planar-gradient ERF or single-trial or + averaged TFRs. + + The configuration can contain + cfg.method = 'sum', 'svd', 'abssvd', or 'complex' (default = 'sum') + cfg.updatesens = 'yes' or 'no', whether to update the sensor array with the spatial projector (default = 'yes') + and for timelocked input data (i.e. ERFs), the configuration can also contain + cfg.demean = 'yes' or 'no' (default = 'no') + cfg.baselinewindow = [begin end] + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_MEGPLANAR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_combineplanar.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_combineplanar", *args, **kwargs) diff --git a/fieldtrip/ft_componentanalysis.py b/fieldtrip/ft_componentanalysis.py new file mode 100644 index 0000000..3cf1f5f --- /dev/null +++ b/fieldtrip/ft_componentanalysis.py @@ -0,0 +1,169 @@ +from fieldtrip._runtime import Runtime + + +def ft_componentanalysis(*args, **kwargs): + """ + FT_COMPONENTANALYSIS performs independent component analysis or other + spatio-temporal decompositions of EEG or MEG data. This function computes + the topography and timecourses of the components. The output of this + function can be further analyzed with FT_TIMELOCKANALYSIS or + FT_FREQANALYSIS. + + Use as + [comp] = ft_componentanalysis(cfg, data) + where cfg is a configuration structure and the input data is obtained from + FT_PREPROCESSING or from FT_TIMELOCKANALYSIS. + + The configuration should contain + cfg.method = 'runica', 'fastica', 'binica', 'pca', 'svd', 'jader', + 'varimax', 'dss', 'cca', 'sobi', 'white' or 'csp' + (default = 'runica') + cfg.channel = cell-array with channel selection (default = 'all'), + see FT_CHANNELSELECTION for details + cfg.split = cell-array of channel types between which covariance + is split, it can also be 'all' or 'no' (default = 'no') + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.numcomponent = 'all' or number (default = 'all') + cfg.demean = 'yes' or 'no', whether to demean the input data (default = 'yes') + cfg.updatesens = 'yes' or 'no', whether to update the sensor array with the spatial projector (default = 'yes') + cfg.feedback = 'no', 'text', 'textbar', 'gui' (default = 'text') + + The runica method supports the following method-specific options. The + values that these options can take can be found with HELP RUNICA. + cfg.runica.extended + cfg.runica.pca + cfg.runica.sphering + cfg.runica.weights + cfg.runica.lrate + cfg.runica.block + cfg.runica.anneal + cfg.runica.annealdeg + cfg.runica.stop + cfg.runica.maxsteps + cfg.runica.bias + cfg.runica.momentum + cfg.runica.specgram + cfg.runica.posact + cfg.runica.verbose + cfg.runica.logfile + cfg.runica.interput + + The fastica method supports the following method-specific options. The + values that these options can take can be found with HELP FASTICA. + cfg.fastica.approach + cfg.fastica.numOfIC + cfg.fastica.g + cfg.fastica.finetune + cfg.fastica.a1 + cfg.fastica.a2 + cfg.fastica.mu + cfg.fastica.stabilization + cfg.fastica.epsilon + cfg.fastica.maxNumIterations + cfg.fastica.maxFinetune + cfg.fastica.sampleSize + cfg.fastica.initGuess + cfg.fastica.verbose + cfg.fastica.displayMode + cfg.fastica.displayInterval + cfg.fastica.firstEig + cfg.fastica.lastEig + cfg.fastica.interactivePCA + cfg.fastica.pcaE + cfg.fastica.pcaD + cfg.fastica.whiteSig + cfg.fastica.whiteMat + cfg.fastica.dewhiteMat + cfg.fastica.only + + The binica method supports the following method-specific options. The + values that these options can take can be found with HELP BINICA. + cfg.binica.extended + cfg.binica.pca + cfg.binica.sphering + cfg.binica.lrate + cfg.binica.blocksize + cfg.binica.maxsteps + cfg.binica.stop + cfg.binica.weightsin + cfg.binica.verbose + cfg.binica.filenum + cfg.binica.posact + cfg.binica.annealstep + cfg.binica.annealdeg + cfg.binica.bias + cfg.binica.momentum + + The dss method requires the following method-specific option and supports + a whole lot of other options. The values that these options can take can + be found with HELP DSS_CREATE_STATE. + cfg.dss.denf.function + cfg.dss.denf.params + + The sobi method supports the following method-specific options. The + values that these options can take can be found with HELP SOBI. + cfg.sobi.n_sources + cfg.sobi.p_correlations + + The csp method implements the common-spatial patterns method. For CSP, the + following specific options can be defined: + cfg.csp.classlabels = vector that assigns a trial to class 1 or 2. + cfg.csp.numfilters = the number of spatial filters to use (default: 6). + + The icasso method implements icasso. It runs fastica a specified number of + times, and provides information about the stability of the components found + The following specific options can be defined, see ICASSOEST: + cfg.icasso.mode + cfg.icasso.Niter + + Instead of specifying a component analysis method, you can also specify + a previously computed unmixing matrix, which will be used to estimate the + component timecourses in this data. This requires + cfg.unmixing = NxN unmixing matrix + cfg.topolabel = Nx1 cell-array with the channel labels + + You may specify a particular seed for random numbers called by + rand/randn/randi, or the random state used by a previous call to this + function to replicate results. For example: + cfg.randomseed = integer seed value of user's choice + cfg.randomseed = comp.cfg.callinfo.randomseed (from previous call) + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_TOPOPLOTIC, FT_REJECTCOMPONENT, FASTICA, RUNICA, BINICA, SVD, + JADER, VARIMAX, DSS, CCA, SOBI, ICASSO + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_componentanalysis.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_componentanalysis", *args, **kwargs) diff --git a/fieldtrip/ft_conjunctionanalysis.py b/fieldtrip/ft_conjunctionanalysis.py new file mode 100644 index 0000000..371f5ab --- /dev/null +++ b/fieldtrip/ft_conjunctionanalysis.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def ft_conjunctionanalysis(*args, **kwargs): + """ + FT_CONJUNCTIONANALYSIS finds the minimum statistic common across two or + more contrasts, i.e. data following ft_xxxstatistics. Furthermore, it + finds the overlap of sensors/voxels that show statistically significant + results (a logical AND on the mask fields). + + Alternatively, it finds minimalistic mean power values in the + input datasets. Here, a type 'relative change' baselinecorrection + prior to conjunction is advised. + + Use as + [stat] = ft_conjunctionanalysis(cfg, stat1, stat2, .., statN) + + where the input data is the result from either FT_TIMELOCKSTATISTICS, + FT_FREQSTATISTICS, or FT_SOURCESTATISTICS + + No configuration options are yet implemented. + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS, FT_SOURCESTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_conjunctionanalysis.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_conjunctionanalysis", *args, **kwargs) diff --git a/fieldtrip/ft_connectivityanalysis.py b/fieldtrip/ft_connectivityanalysis.py new file mode 100644 index 0000000..732a43a --- /dev/null +++ b/fieldtrip/ft_connectivityanalysis.py @@ -0,0 +1,84 @@ +from fieldtrip._runtime import Runtime + + +def ft_connectivityanalysis(*args, **kwargs): + """ + FT_CONNECTIVITYANALYSIS computes various measures of connectivity between + MEG/EEG channels or between source-level signals. + + Use as + stat = ft_connectivityanalysis(cfg, data) + stat = ft_connectivityanalysis(cfg, timelock) + stat = ft_connectivityanalysis(cfg, freq) + stat = ft_connectivityanalysis(cfg, source) + where the first input argument is a configuration structure (see below) + and the second argument is the output of FT_PREPROCESSING, + FT_TIMELOCKANLAYSIS, FT_FREQANALYSIS, FT_MVARANALYSIS or FT_SOURCEANALYSIS. + + The different connectivity metrics are supported only for specific + datatypes (see below). + + The configuration structure has to contain + cfg.method = string, can be + 'amplcorr', amplitude correlation, support for freq and source data + 'coh', coherence, support for freq, freqmvar and source data. + For partial coherence also specify cfg.partchannel, see below. + For imaginary part of coherency or coherency also specify + cfg.complex, see below. + 'csd', cross-spectral density matrix, can also calculate partial + csds - if cfg.partchannel is specified, support for freq + and freqmvar data + 'dtf', directed transfer function, support for freq and freqmvar data + 'granger', granger causality, support for freq and freqmvar data + 'pdc', partial directed coherence, support for freq and freqmvar data + 'plv', phase-locking value, support for freq and freqmvar data + 'powcorr', power correlation, support for freq and source data + 'powcorr_ortho', power correlation with single trial + orthogonalisation, support for source data + 'ppc' pairwise phase consistency + 'psi', phaseslope index, support for freq and freqmvar data + 'wpli', weighted phase lag index (signed one, still have to + take absolute value to get indication of strength of + interaction. Note that this measure has a positive + bias. Use wpli_debiased to avoid this. + 'wpli_debiased' debiased weighted phase lag index (estimates squared wpli) + 'wppc' weighted pairwise phase consistency + 'corr' Pearson correlation, support for timelock or raw data + 'laggedcoherence', lagged coherence estimate + 'plm' phase linearity measurement + 'mim' multivariate interaction measure, support for freq data + 'cancoh' canonical coherence, support for freq data + + Additional configuration options are + cfg.channel = Nx1 cell-array containing a list of channels which are + used for the subsequent computations. This only has an effect + when the input data is univariate. See FT_CHANNELSELECTION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_connectivityanalysis.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_connectivityanalysis", *args, **kwargs) diff --git a/fieldtrip/ft_connectivityplot.py b/fieldtrip/ft_connectivityplot.py new file mode 100644 index 0000000..c8a3315 --- /dev/null +++ b/fieldtrip/ft_connectivityplot.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def ft_connectivityplot(*args, **kwargs): + """ + FT_CONNECTIVITYPLOT plots channel-level frequency resolved connectivity. The + data are rendered in a square grid of subplots, each subplot containing the + connectivity spectrum between the two respective channels. + + Use as + ft_connectivityplot(cfg, data) + where the first input argument is a configuration structure (see below) + and the input data is a structure obtained from FT_CONNECTIVITYANALYSIS + using a frequency-domain connectivity metric. Consequently the input data + should have a dimord of 'chan_chan_freq', or 'chan_chan_freq_time'. + + The configuration can have the following options + cfg.parameter = string, the functional parameter to be plotted (default = 'cohspctrm') + cfg.xlim = 'maxmin', 'maxabs', 'zeromax', 'minzero', or [xmin xmax] (default = 'maxmin') + cfg.ylim = 'maxmin', 'maxabs', 'zeromax', 'minzero', or [ymin ymax] (default = 'maxmin') + cfg.zlim = plotting limits for color dimension, 'maxmin', 'maxabs', 'zeromax', 'minzero', or [zmin zmax] (default = 'maxmin') + cfg.channel = list of channels to be included for the plotting (default = 'all'), see FT_CHANNELSELECTION for details + + See also FT_CONNECTIVITYANALYSIS, FT_CONNECTIVITYSIMULATION, FT_MULTIPLOTCC, FT_TOPOPLOTCC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_connectivityplot.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_connectivityplot", *args, **kwargs) diff --git a/fieldtrip/ft_connectivitysimulation.py b/fieldtrip/ft_connectivitysimulation.py new file mode 100644 index 0000000..a95a95d --- /dev/null +++ b/fieldtrip/ft_connectivitysimulation.py @@ -0,0 +1,130 @@ +from fieldtrip._runtime import Runtime + + +def ft_connectivitysimulation(*args, **kwargs): + """ + FT_CONNECTIVITYSIMULATION simulates channel-level time-series data with a + specified connectivity structure. This function returns an output data + structure that resembles the output of FT_PREPROCESSING. + + Use as + [data] = ft_connectivitysimulation(cfg) + which will return a raw data structure that resembles the output of + FT_PREPROCESSING. + + The configuration structure should contain + cfg.method = string, can be 'linear_mix', 'mvnrnd', 'ar', 'ar_reverse' (see below) + cfg.nsignal = scalar, number of signals + cfg.ntrials = scalar, number of trials + cfg.triallength = in seconds + cfg.fsample = in Hz + + Method 'linear_mix' implements a linear mixing with optional time shifts + where the number of unobserved signals can be different from the number + of observed signals + + Required configuration options: + cfg.mix = matrix, [nsignal x number of unobserved signals] + specifying the mixing from the unobserved signals to + the observed signals, or + = matrix, [nsignal x number of unobserved signals x number of + samples] specifying the mixing from the + unobserved signals to the observed signals which + changes as a function of time within the trial + = cell-arry, [1 x ntrials] with each cell a matrix as + specified above, when a trial-specific mixing is + required + cfg.delay = matrix, [nsignal x number of unobserved signals] + specifying the time shift (in samples) between the + unobserved signals and the observed signals + + Optional configuration options + cfg.bpfilter = 'yes' (or 'no') + cfg.bpfreq = [bplow bphigh] (default: [15 25]) + cfg.demean = 'yes' (or 'no') + cfg.baselinewindow = [begin end] in seconds, the default is the complete trial + cfg.absnoise = scalar (default: 1), specifying the standard deviation of + white noise superimposed on top of the simulated signals + cfg.randomseed = 'yes' or a number or vector with the seed value (default = 'yes') + + Method 'mvnrnd' implements a linear mixing with optional timeshifts in + where the number of unobserved signals is equal to the number of observed + signals. This method used the MATLAB function mvnrnd. The implementation + is a bit ad-hoc and experimental, so users are discouraged to apply it. + The time shift occurs only after the linear mixing, so the effect of the + parameters on the simulation is not really clear. This method will be + disabled in the future. + + Required configuration options + cfg.covmat = covariance matrix between the signals + cfg.delay = delay vector between the signals in samples + + Optional configuration options + cfg.bpfilter = 'yes' (or 'no') + cfg.bpfreq = [bplow bphigh] (default: [15 25]) + cfg.demean = 'yes' (or 'no') + cfg.baselinewindow = [begin end] in seconds, the default is the complete trial + cfg.absnoise = scalar (default: 1), specifying the standard + deviation of white noise superimposed on top + of the simulated signals + + Method 'ar' implements a multivariate autoregressive model to generate + the data. + + Required configuration options + cfg.params = matrix, [nsignal x nsignal x number of lags] specifying the + autoregressive coefficient parameters. A non-zero + element at cfg.params(i,j,k) means a + directional influence from signal j onto + signal i (at lag k). + cfg.noisecov = matrix, [nsignal x nsignal] specifying the covariance + matrix of the innovation process + + Method 'ar_reverse' implements a multivariate autoregressive + autoregressive model to generate the data, where the model coefficients + are reverse-computed, based on the interaction pattern specified. + + Required configuration options + cfg.coupling = nxn matrix, specifying coupling strength, rows causing + column + cfg.delay = nxn matrix, specifying the delay, in seconds, from one + signal's spectral component to the other signal, rows + causing column + cfg.ampl = nxn matrix, specifying the amplitude + cfg.bpfreq = nxnx2 matrix, specifying the lower and upper frequencies + of the bands that are transmitted, rows causing column + + The generated signals will have a spectrum that is 1/f + additional + band-limited components, as specified in the configuration. + + See also FT_FREQSIMULATION, FT_DIPOLESIMULATION, FT_SPIKESIMULATION, + FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_connectivitysimulation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_connectivitysimulation", *args, **kwargs) diff --git a/fieldtrip/ft_crossfrequencyanalysis.py b/fieldtrip/ft_crossfrequencyanalysis.py new file mode 100644 index 0000000..5ba4a9a --- /dev/null +++ b/fieldtrip/ft_crossfrequencyanalysis.py @@ -0,0 +1,90 @@ +from fieldtrip._runtime import Runtime + + +def ft_crossfrequencyanalysis(*args, **kwargs): + """ + FT_CROSSFREQUENCYANALYSIS performs cross-frequency analysis + + Use as + crossfreq = ft_crossfrequencyanalysis(cfg, freq) + crossfreq = ft_crossfrequencyanalysis(cfg, freqlo, freqhi) + + The input data should be organised in a structure as obtained from the + FT_FREQANALYSIS function. The configuration should be according to + + cfg.freqlow = scalar or vector, selection of frequencies for the low frequency data + cfg.freqhigh = scalar or vector, selection of frequencies for the high frequency data + + Channel selection can be specified according to whether one wants to perform within- or + cross-channel analysis. + + For within-channel analysis (default), you should specifies only a single channel selection: + cfg.channel = cell-array with selection of channels, see FT_CHANNELSELECTION + In this case, the output "dimord" will be "chan_freqlow_freqhigh" + + For cross-channel analysis, you should specifies two channel selections: + cfg.chanlow = cell-array with selection of channels for the phase providing channels from the + freqlow data argument, with wildcards allowed, see FT_CHANNELSELECTION + cfg.chanhigh = cell-array with selection of channels for the amplitude providing channels from the + freqhigh data argument, with wildcards allowed, see FT_CHANNELSELECTION + In this case, the output "dimord" will be "chancmb_freqlow_freqhigh" and "label" + field will be replaced with "labelcmb" (corresponding to the dimension "chancmb") + describing the pairs of channel combinations as + {'chanlow01' 'chanhigh01' + 'chanlow01' 'chanhigh02' + ... + 'chanlow02' 'chanhigh01' + 'chanlow02' 'chanhigh02' + ... + } + N.B.: The order of channels corresponds to their order in the original "label" field + + Various metrics for cross-frequency coupling have been introduced in a number of + scientific publications, but these do not use a consistent method naming scheme, + nor implement it in exactly the same way. The particular implementation in this + code tries to follow the most common format, generalizing where possible. If you + want details about the algorithms, please look into the code. + cfg.method = string, can be + 'coh' - coherence + 'plv' - phase locking value + 'mvl' - mean vector length + 'mi' - modulation index + 'pac' - phase amplitude coupling + + The modulation index and phase amplitude coupling implement + Tort A. B. L., Komorowski R., Eichenbaum H., Kopell N. (2010). Measuring Phase-Amplitude + Coupling Between Neuronal Oscillations of Different Frequencies. J Neurophysiol 104: + 1195?1210. doi:10.1152/jn.00106.2010 + + cfg.keeptrials = string, can be 'yes' or 'no' + + See also FT_FREQANALYSIS, FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_crossfrequencyanalysis.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_crossfrequencyanalysis", *args, **kwargs) diff --git a/fieldtrip/ft_databrowser.py b/fieldtrip/ft_databrowser.py new file mode 100644 index 0000000..4828c0b --- /dev/null +++ b/fieldtrip/ft_databrowser.py @@ -0,0 +1,157 @@ +from fieldtrip._runtime import Runtime + + +def ft_databrowser(*args, **kwargs): + """ + FT_DATABROWSER can be used for visual inspection of data. Artifacts that were + detected by artifact functions (see FT_ARTIFACT_xxx functions where xxx is the type + of artifact) are marked. Additionally data pieces can be marked and unmarked as + artifact by manual selection. The output cfg contains the updated specification of + the artifacts. + + Use as + [cfg] = ft_databrowser(cfg) + [cfg] = ft_databrowser(cfg, data) + If you only specify the configuration structure, it should contain the name of the + dataset on your hard disk (see below). If you specify input data, it should be a + data structure as obtained from FT_PREPROCESSING or from FT_COMPONENTANALYSIS. + + If you want to browse data that is on disk, you have to specify + cfg.dataset = string with the filename + Instead of specifying the dataset, you can also explicitly specify the name of the + file containing the header information and the name of the file containing the + data, using + cfg.datafile = string with the filename + cfg.headerfile = string with the filename + + The following configuration options are supported: + cfg.ylim = vertical scaling, can be 'maxmin', 'maxabs' or [ymin ymax] (default = 'maxabs') + cfg.zlim = color scaling to apply to component topographies, 'minmax', 'maxabs' (default = 'maxmin') + cfg.blocksize = duration in seconds for cutting continuous data in segments + cfg.trl = structure that defines the data segments of interest, only applicable for trial-based data + cfg.continuous = 'yes' or 'no', whether the data should be interpreted as continuous or trial-based + cfg.allowoverlap = 'yes' or 'no', whether data that is overlapping in multiple trials is allowed (default = 'no') + cfg.channel = cell-array with channel labels, see FT_CHANNELSELECTION + cfg.channelclamped = cell-array with channel labels, that when using the 'vertical' viewmode will always be shown at the bottom. This is useful for showing ECG/EOG channels along with the other channels + cfg.compscale = string, 'global' or 'local', defines whether the colormap for the topographic scaling is applied per topography or on all visualized components (default = 'local') + cfg.viewmode = string, 'vertical', 'butterfly', or 'component' for visualizing ICA/PCA topographies together with the timecourses (default = 'vertical') + cfg.plotlabels = 'yes', 'no' or 'some', whether to plot channel labels in vertical viewmode. The option 'some' plots one label for every ten channels, which is useful if there are many channels (default = 'some') + cfg.plotevents = 'no' or 'yes', whether to plot event markers (default = 'yes') + cfg.ploteventlabels = 'type=value', 'colorvalue' (default = 'type=value') + cfg.eventcolor = string with line colors or Nx3 color map, colors used for plotting the different types of events (default is automatic) + cfg.artifactcolor = string with line colors or Nx3 color map, colors used for plotting the different types of artifacts (default is automatic) + cfg.artfctdef.xxx.artifact = Nx2 matrix with artifact segments see FT_ARTIFACT_xxx functions + cfg.selectfeature = string, name of feature to be selected/added (default = 'visual') + cfg.selectmode = 'markartifact', 'markpeakevent', 'marktroughevent' (default = 'markartifact') + cfg.colorgroups = 'sequential', 'allblack', 'labelcharN' (N = Nth character in label), 'chantype' or a vector with the length of the number of channels defining the groups (default = 'sequential') + cfg.linecolor = string with line colors or Nx3 color map (default = customized lines map with 15 colors) + cfg.linewidth = linewidth in points (default = 0.5) + cfg.linestyle = linestyle/marker type, see options of the PLOT function (default = '-') + cfg.verticalpadding = number or 'auto', padding to be added to top and bottom of plot to avoid channels largely dissappearing when viewmode = 'vertical'/'component' (default = 'auto'). The padding is expressed as a proportion of the total height added to the top and bottom. The setting 'auto' determines the padding depending on the number of channels that are being plotted. + cfg.selfun = string, name of function that is evaluated using the right-click context menu. The selected data and cfg.selcfg are passed on to this function. + cfg.selcfg = configuration options for function in cfg.selfun + cfg.seldat = 'selected' or 'all', specifies whether only the currently selected or all channels will be passed to the selfun (default = 'selected') + cfg.figure = 'yes' or 'no', whether to open a new figure. You can also specify a figure handle from FIGURE, GCF or SUBPLOT. (default = 'yes') + cfg.figurename = string, title of the figure window + cfg.visible = string, 'on' or 'off' whether figure will be visible (default = 'on') + cfg.position = location and size of the figure, specified as [left bottom width height] (default is automatic) + cfg.renderer = string, 'opengl', 'zbuffer', 'painters', see RENDERERINFO (default is automatic, try 'painters' when it crashes) + cfg.colormap = string, or Nx3 matrix, see FT_COLORMAP + + The following options for the scaling of the EEG, EOG, ECG, EMG, MEG and NIRS channels + is optional and can be used to bring the absolute numbers of the different + channel types in the same range (e.g. fT and uV). The channel types are determined + from the input data using FT_CHANNELSELECTION. + cfg.eegscale = number, scaling to apply to the EEG channels prior to display + cfg.eogscale = number, scaling to apply to the EOG channels prior to display + cfg.ecgscale = number, scaling to apply to the ECG channels prior to display + cfg.emgscale = number, scaling to apply to the EMG channels prior to display + cfg.megscale = number, scaling to apply to the MEG channels prior to display + cfg.gradscale = number, scaling to apply to the MEG gradiometer channels prior to display (in addition to the cfg.megscale factor) + cfg.magscale = number, scaling to apply to the MEG magnetometer channels prior to display (in addition to the cfg.megscale factor) + cfg.nirsscale = number, scaling to apply to the NIRS channels prior to display + cfg.mychanscale = number, scaling to apply to the channels specified in cfg.mychan + cfg.mychan = Nx1 cell-array with selection of channels + cfg.chanscale = Nx1 vector with scaling factors, one per channel specified in cfg.channel + + You can specify preprocessing options that are to be applied to the data prior to + display. Most options from FT_PREPROCESSING are supported. They should be specified + in the sub-structure cfg.preproc like these examples + cfg.preproc.lpfilter = 'no' or 'yes' lowpass filter (default = 'no') + cfg.preproc.lpfreq = lowpass frequency in Hz + cfg.preproc.demean = 'no' or 'yes', whether to apply baseline correction (default = 'no') + cfg.preproc.detrend = 'no' or 'yes', remove linear trend from the data (done per trial) (default = 'no') + cfg.preproc.baselinewindow = [begin end] in seconds, the default is the complete trial (default = 'all') + + In case of component viewmode, a layout is required. If no layout is specified, an + attempt is made to construct one from the sensor definition that is present in the + data or specified in the configuration. + cfg.layout = filename of the layout, see FT_PREPARE_LAYOUT + cfg.elec = structure with electrode positions or filename, see FT_READ_SENS + cfg.grad = structure with gradiometer definition or filename, see FT_READ_SENS + Additional plotting options for the component viewmode: + cfg.gridscale = scalar, number of points along both directions for interpolation (default = 45 here) + cfg.shading = string, 'none', 'flat', 'interp' (default = 'flat') + cfg.interplimits = string, 'sensors' or 'mask' (default here = 'mask') + cfg.interpolation = string, 'nearest', 'linear', 'natural', 'cubic' or 'v4' (default = 'v4') + cfg.contournum = topoplot contour lines + + The default font size might be too small or too large, depending on the number of + channels. You can use the following options to change the size of text inside the + figure and along the axes. + cfg.fontsize = number, fontsize inside the figure (default = 0.03) + cfg.fontunits = string, can be 'normalized', 'points', 'pixels', 'inches' or 'centimeters' (default = 'normalized') + cfg.axisfontsize = number, fontsize along the axes (default = 10) + cfg.axisfontunits = string, can be 'normalized', 'points', 'pixels', 'inches' or 'centimeters' (default = 'points') + + When visually selection data, a right-click will bring up a context-menu containing + functions to be executed on the selected data. You can use your own function using + cfg.selfun and cfg.selcfg. You can use multiple functions by giving the names/cfgs + as a cell-array. + + In butterfly and vertical mode, you can use the "identify" button to reveal the name of a + channel. Please be aware that it searches only vertically. This means that it will + return the channel with the amplitude closest to the point you have clicked at the + specific time point. This might be counterintuitive at first. + + The "cfg.artfctdef" structure in the output cfg is comparable to the configuration + used by the artifact detection functions like FT_ARTIFACT_ZVALUE and in + FT_REJECTARTIFACT. It contains for each artifact type an Nx2 matrix in which the + first column corresponds to the begin samples of an artifact period, the second + column contains the end samples of the artifact periods. + + In case the databrowser crashes and you cannot close the window, use delete(gcf) to + get rid of the figure. + + See also FT_PREPROCESSING, FT_REJECTARTIFACT, FT_ARTIFACT_EOG, FT_ARTIFACT_MUSCLE, + FT_ARTIFACT_JUMP, FT_ARTIFACT_MANUAL, FT_ARTIFACT_THRESHOLD, FT_ARTIFACT_CLIP, + FT_ARTIFACT_ECG, FT_COMPONENTANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_databrowser.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_databrowser", *args, **kwargs) diff --git a/fieldtrip/ft_defacemesh.py b/fieldtrip/ft_defacemesh.py new file mode 100644 index 0000000..3c3a441 --- /dev/null +++ b/fieldtrip/ft_defacemesh.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def ft_defacemesh(*args, **kwargs): + """ + FT_DEFACEMESH allows you to de-identify a scalp surface mesh by erasing specific + regions, such as the face and ears. The interactive graphical user interface allows + you to position a box over the anatomical data inside which all vertices will be + removed. You might have to call this function multiple times when both face and + ears need to be removed. Following defacing, you should check the result with + FT_PLOT_MESH. + + Use as + mesh = ft_defacemesh(cfg, mesh) + + The configuration can contain the following options + cfg.method = string, specification of the shape that is used + as a boundary for exclusion, can be either 'box' or 'plane' (default = 'box') + cfg.translate = initial position of the center of the box, or a point on the plane (default = [0 0 0]) + cfg.scale = initial size of the box along each dimension (default is automatic) + cfg.rotate = initial rotation of the box, or the plane (default = [0 0 0]) + cfg.selection = which vertices to keep, can be 'inside' or 'outside' (default = 'outside') + + See also FT_ANONYMIZEDATA, FT_DEFACEVOLUME, FT_ANALYSISPIPELINE, FT_PLOT_MESH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_defacemesh.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_defacemesh", *args, **kwargs) diff --git a/fieldtrip/ft_defacevolume.py b/fieldtrip/ft_defacevolume.py new file mode 100644 index 0000000..960762f --- /dev/null +++ b/fieldtrip/ft_defacevolume.py @@ -0,0 +1,65 @@ +from fieldtrip._runtime import Runtime + + +def ft_defacevolume(*args, **kwargs): + """ + FT_DEFACEVOLUME allows you to de-identify an anatomical MRI by erasing specific + regions, such as the face and ears. The interactive graphical user interface allows + you to position a box over the anatomical data inside which all anatomical voxel + values will be replaced by zero. You might have to call this function multiple + times when both face and ears need to be removed. Following defacing, you should + check the result with FT_SOURCEPLOT. + + Use as + mri = ft_defacevolume(cfg, mri) + + The configuration can contain the following options + cfg.method = 'box', 'plane', 'spm' (default = 'box') + + If you specify the box method, the following options apply + cfg.translate = initial position of the center of the box, or a point + on the plane, (default = [0 0 0]) + cfg.scale = initial size of the box along each dimension (default is automatic) + cfg.rotate = initial rotation of the box, or the plane (default = [0 0 0]) + cfg.selection = which voxels to keep, can be 'inside' or 'outside' (default = 'outside') + cfg.smooth = 'no' or the FWHM of the gaussian kernel in voxels (default = 'no') + cfg.keepbrain = 'no' or 'yes', segment and retain the brain (default = 'no') + cfg.feedback = 'no' or 'yes', whether to provide graphical feedback (default = 'no') + + If you specify no smoothing, the selected area will be zero-masked. If you + specify a certain amount of smoothing (in voxels FWHM), the selected area will + be replaced by a smoothed version of the data. + + The spm method does not have any options, it uses SPM_DEFACE from the + SPM12 toolbox. + + See also FT_ANONYMIZEDATA, FT_DEFACEMESH, FT_ANALYSISPIPELINE, FT_SOURCEPLOT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_defacevolume.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_defacevolume", *args, **kwargs) diff --git a/fieldtrip/ft_defaults.py b/fieldtrip/ft_defaults.py new file mode 100644 index 0000000..55efe23 --- /dev/null +++ b/fieldtrip/ft_defaults.py @@ -0,0 +1,78 @@ +from fieldtrip._runtime import Runtime + + +def ft_defaults(*args, **kwargs): + """ + FT_DEFAULTS (ending with "s") sets some general settings in the global variable + ft_default (without the "s") and takes care of the required path settings. You can + call this function in your startup.m script. This function is also called at the + begin of all FieldTrip functions. + + The global configuration defaults are stored in the global "ft_default" structure. + The ft_checkconfig function that is called by many FieldTrip functions will merge + these global configuration defaults with the cfg ctructure that you pass to + the FieldTrip function that you are calling. + + The global options and their default values are + ft_default.checkconfig = string, can be 'pedantic', 'loose', 'silent' (default = 'loose') + ft_default.checkpath = string, can be 'pedantic', 'once', 'no' (default = 'pedantic') + ft_default.checksize = number in bytes, can be inf (default = 1e5) + ft_default.checkstring = string, can be 'yes' or 'no' (default = 'yes'), convert "strings" in cfg to 'chars' + ft_default.showlogo = string, can be 'yes' or 'no' (default = 'yes') + ft_default.showcallinfo = string, can be 'yes' or 'no' (default = 'yes') + ft_default.trackcallinfo = string, can be 'yes' or 'no' (default = 'yes') + ft_default.trackusage = false, or string with salt for one-way encryption of identifying information (by default this is enabled and an automatic salt is created) + ft_default.trackdatainfo = string, can be 'yes' or 'no' (default = 'no') + ft_default.keepprevious = string, can be 'yes' or 'no' (default = 'yes') + ft_default.outputfilepresent = string, can be 'keep', 'overwrite', 'error' (default = 'overwrite') + ft_default.debug = string, can be 'display', 'displayonerror', 'displayonsuccess', 'save', 'saveonerror', saveonsuccess' or 'no' (default = 'no') + ft_default.toolbox.signal = string, can be 'compat' or 'matlab' (default is automatic, see below) + ft_default.toolbox.stats = string, can be 'compat' or 'matlab' (default is automatic, see below) + ft_default.toolbox.images = string, can be 'compat' or 'matlab' (default is automatic, see below) + ft_default.reproducescript = string, directory to which the script and intermediate data are written (default = []) + + If you want to overrule these default settings, you can add something like this in your startup.m script + ft_defaults + global ft_default + ft_default.option1 = value1 + ft_default.option2 = value2 + + The toolbox option for signal, stats and images allows you to specify whether you + want to use the original version from MathWorks or a compatible drop-in to be used. + When you use the Radboud University license server, i.e. at the Donders, the + default is 'compat'. This has the advantage that you do not need a license for + these toolboxes; we do not have that many licenses and parallel computations on our + Donders compute cluster would otherwise use all licenses. In all other cases, the + default is 'matlab' when the toolbox is available, and 'compat' when it is not + available. + + See also FT_HASTOOLBOX, FT_CHECKCONFIG, FT_TRACKUSAGE, LICENSE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_defaults.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_defaults", *args, **kwargs, nargout=0) diff --git a/fieldtrip/ft_definetrial.py b/fieldtrip/ft_definetrial.py new file mode 100644 index 0000000..6bc6cfc --- /dev/null +++ b/fieldtrip/ft_definetrial.py @@ -0,0 +1,117 @@ +from fieldtrip._runtime import Runtime + + +def ft_definetrial(*args, **kwargs): + """ + FT_DEFINETRIAL defines the trials or segments of data that will be used for further + processing and analysis, i.e. the pieces of data that will be read in by + FT_PREPROCESSING. Trials are defined by their begin and end sample in the data file + and each trial has an offset that defines where the relative t=0 point (usually the + sample at which the trigger is detected) is for that trial or segment. + + Use as + [cfg] = ft_definetrial(cfg) + where the configuration structure should contain + cfg.trialdef = structure with the details of trial definition, see below + cfg.trialfun = string with the function name, see below (default = 'ft_trialfun_general') + cfg.representation = 'numeric' or 'table', determines how the trial definition is returned (default is automatic) + and furthermore + cfg.dataset = string with the filename + or + cfg.headerfile = string with the filename + cfg.datafile = string with the filename + and optionally + cfg.headerformat = string, see FT_FILETYPE (default is automatic) + cfg.dataformat = string, see FT_FILETYPE (default is automatic) + cfg.eventformat = string, see FT_FILETYPE (default is automatic) + + In general, a call to FT_DEFINETRIAL results in the trial definition "trl" being + added to the output configuration. The trials are defined on the basis of events or + triggers by a user-specified MATLAB function that is subsequently referred to as + the trial function. The user can specify their own custom function tailored to the + experimental paradigm, or use one of the default trial functions (see below). + + Simple trial definitions (for example based on a single trigger) are supported by + FT_TRIALFUN_GENERAL, which is specified as the default. It supports the following + options + cfg.trialdef.eventtype = string, or cell-array with strings + cfg.trialdef.eventvalue = number, string, or list with numbers or strings + cfg.trialdef.prestim = number, latency in seconds (optional) + cfg.trialdef.poststim = number, latency in seconds (optional) + + To read all data from a continuous file in a single or in multiple segments, + FT_TRIALFUN_GENERAL understands the following options + cfg.trialdef.triallength = duration in seconds (can also be 1 or Inf) + cfg.trialdef.ntrials = number of trials (can also be 1 or Inf) + cfg.trialdef.overlap = number between 0 and 1 (exclusive) specifying the fraction of overlap between snippets (0 = no overlap) + + To display a list with the events in your data on screen, you can use + FT_TRIALFUN_SHOW. This is useful for diagnostics; no actual trials will be defined. + + To display a graphical user interface dialog that allows you to select events of + interest, you can use FT_TRIALFUN_GUI. + + The trial definition "trl" is an Nx3 matrix or table, where N is the number of + trials. The first column contains the sample-indices of the start of each trial + relative to the start of the raw data, the second column contains the sample + indices of the end of each trial, and the third column contains the offset of the + trigger with respect to the trial. An offset of 0 means that the first sample of + the trial corresponds to the trigger. A positive offset indicates that the first + sample is later than the trigger, and a negative offset indicates that the trial + begins before the trigger. + + Besides the required three columns in the trial definition "trl" that represent + start, end and offset, it can have contain additional columns . These additional + columns can be used by a custom trialfun to provide information about each trial, + such as trigger codes, response latencies, trial type, and response correctness. + After FT_PREPROCESSING these additional columns of the "trl" matrix will be + represented in the "trialinfo" field. + + If FT_TRIALFUN_GENERAL or FT_TRIALFUN_GUI has been used to generate the "trl" + matrix or table, the function may return a fourth column that refers to the + event-code for the corresponding trial. Whether or not this column is returned + depends on the acquisition system. In general, this fourth column is generated by + default if the event codes are represented numerically, or as a string starting + with 'S' or 'R' (for BrainVision data). + + If you need to define the segments of interest on the basis of a conditional + sequence of events (e.g. stimulus trigger followed by a correct response) or on + basis of some signal feature that needs to be detected in the data, you should + supply in cfg.trialfun the name of a function that you wrote yourself and that + FT_DEFINETRIAL will call. The function receives the cfg structure as input and + should return a NxM matrix in the same format as "trl" as the output. You can add + extra custom fields to cfg.trialdef to pass to your own trialfun. See below for + pointers to some examples. + + See also FT_PREPROCESSING, FT_READ_HEADER, FT_READ_EVENT, FT_TRIALFUN_GENERAL, + FT_TRIALFUN_GUI, FT_TRIALFUN_SHOW, FT_TRIALFUN_BIDS, FT_TRIALFUN_EXAMPLE1, + FT_TRIALFUN_EXAMPLE2 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_definetrial.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_definetrial", *args, **kwargs) diff --git a/fieldtrip/ft_denoise_amm.py b/fieldtrip/ft_denoise_amm.py new file mode 100644 index 0000000..ad61c2c --- /dev/null +++ b/fieldtrip/ft_denoise_amm.py @@ -0,0 +1,58 @@ +from fieldtrip._runtime import Runtime + + +def ft_denoise_amm(*args, **kwargs): + """ + FT_DENOISE_AMM implements an adaptive multipole modelling based + projection algorithm to suppress interference outside an ellipsoid + spanned by an MEG array. It is based on: REFERENCE. + + Use as + dataout = ft_denoise_amm(cfg, datain) + where the input data should come from FT_PREPROCESSING or + FT_TIMELOCKANALYSIS and the configuration should contain + cfg.channel = Nx1 cell-array with selection of channels (default = 'MEG'), see FT_CHANNELSELECTION for details + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.pertrial = 'no' or 'yes', compute the temporal projection per trial (default = 'no') + cfg.demean = 'yes' or 'no', demean the data per epoch (default = 'yes') + cfg.updatesens = 'yes' or 'no', whether to update the sensor array with the spatial projector (default = 'yes') + cfg.amm = structure with parameters that determine the behavior of the algorithm + cfg.amm.order_in = scalar, order of the spheroidal harmonics basis that spans the in space (default = 9) + cfg.amm.order_out = scalar, order of the spheroidal harmonics basis that spans the out space (default = 2) + cfg.amm.reducerank + cfg.amm.thr + + The implementation is based on Tim Tierney's code written for SPM. + + See also FT_PREPROCESSING, FT_DENOISE_DSSP, FT_DENOISE_HFC, + FT_DENOISE_PCA, FT_DENOISE_PREWHITEN, FT_DENOISE_SSP, FT_DENOISE_SSS, + FT_DENOISE_SYNTHETIC, FT_DENOISE_TSR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_denoise_amm.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_denoise_amm", *args, **kwargs) diff --git a/fieldtrip/ft_denoise_dssp.py b/fieldtrip/ft_denoise_dssp.py new file mode 100644 index 0000000..0dbd30f --- /dev/null +++ b/fieldtrip/ft_denoise_dssp.py @@ -0,0 +1,63 @@ +from fieldtrip._runtime import Runtime + + +def ft_denoise_dssp(*args, **kwargs): + """ + FT_DENOISE_DSSP implements a dual signal subspace projection algorithm + to suppress interference outside a predefined source region of + interest. It is based on: Sekihara et al. J. Neural Eng. 2016 13(3), and + Sekihara et al. J. Neural Eng. 2018 15(3). + + Use as + dataout = ft_denoise_dssp(cfg, datain) + where the input data should come from FT_PREPROCESSING or + FT_TIMELOCKANALYSIS and the configuration should contain + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION for details + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.pertrial = 'no' or 'yes', compute the temporal projection per trial (default = 'no') + cfg.sourcemodel = structure, source model with precomputed leadfields, see FT_PREPARE_LEADFIELD + cfg.demean = 'yes' or 'no', demean the data per epoch (default = 'yes') + cfg.dssp = structure with parameters that determine the behavior of the algorithm + cfg.dssp.n_space = 'all', or scalar. Number of dimensions for the + initial spatial projection. + cfg.dssp.n_in = 'all', or scalar. Number of dimensions of the + subspace describing the field inside the ROI. + cfg.dssp.n_out = 'all', or scalar. Number of dimensions of the + subspace describing the field outside the ROI. + cfg.dssp.n_intersect = scalar (default = 0.9). Number of dimensions (if + value is an integer>=1), or threshold for the + included eigenvalues (if value<1), determining + the dimensionality of the intersection. + + See also FT_PREPROCESSING, FT_DENOISE_AMM, FT_DENOISE_HFC, + FT_DENOISE_PCA, FT_DENOISE_PREWHITEN, FT_DENOISE_SSP, FT_DENOISE_SSS, + FT_DENOISE_SYNTHETIC, FT_DENOISE_TSR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_denoise_dssp.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_denoise_dssp", *args, **kwargs) diff --git a/fieldtrip/ft_denoise_hfc.py b/fieldtrip/ft_denoise_hfc.py new file mode 100644 index 0000000..1c23218 --- /dev/null +++ b/fieldtrip/ft_denoise_hfc.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def ft_denoise_hfc(*args, **kwargs): + """ + FT_DENOISE_HFC implements harmonic field correction, which models external + interference on the recordings as a harmonic magnetic field. It is particulaly + useful for MEG data with low channel numbers, such as OPM data. + + The homogenous field correction method implements Tierney et al. (2021) NIMG, + https://doi.org/10.1016/j.neuroimage.2021.118484. + + The harmonic expansion method implements Tierney et al. (2022) NIMG, + https://doi.org/10.1016/j.neuroimage.2022.119338. + + Use as + data = ft_denoise_hfc(cfg, data) + + The configuration should contain + cfg.channel = channels for HFC (default = 'all') + cfg.order = number, spherical harmonic order (default = 1) + order = 1 is a homogenous field + order = 2 includes gradients + order = 3 includes quadratic terms, etc. + cfg.trials = which trials do you want to denoise? (default = 'all') + cfg.updatesens = 'yes' or 'no', whether to update the sensor array with the spatial projector (default = 'yes') + cfg.feedback = do you want feedback (default = 'yes') + cfg.residualcheck = do you want to check channel residuals (default = 'yes') + cfg.residualthresh = number in pT, what level of residual signal is fine for quality assurance (default = 50) + + See also FT_PREPROCESSING, FT_DENOISE_AMM, FT_DENOISE_DSSP, + FT_DENOISE_PCA, FT_DENOISE_PREWHITEN, FT_DENOISE_SSP, FT_DENOISE_SSS, + FT_DENOISE_SYNTHETIC, FT_DENOISE_TSR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_denoise_hfc.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_denoise_hfc", *args, **kwargs) diff --git a/fieldtrip/ft_denoise_pca.py b/fieldtrip/ft_denoise_pca.py new file mode 100644 index 0000000..e557c9e --- /dev/null +++ b/fieldtrip/ft_denoise_pca.py @@ -0,0 +1,69 @@ +from fieldtrip._runtime import Runtime + + +def ft_denoise_pca(*args, **kwargs): + """ + FT_DENOISE_PCA performs a principal component analysis (PCA) on specified reference + channels and subtracts the projection of the data of interest onto this orthogonal + basis from the data of interest. This is the algorithm which is applied by BTi/4D to + compute noise cancellation weights on a dataset of interest. This function has been + designed for BTi/4D MEG data, but can also be applied to data from other MEG systems. + + Use as + [dataout] = ft_denoise_pca(cfg, data) + or as + [dataout] = ft_denoise_pca(cfg, data, refdata) + where "data" is a raw data structure that was obtained with FT_PREPROCESSING. If + you specify the additional input "refdata", the specified reference channels for + the regression will be taken from this second data structure. This can be useful + when reference-channel specific preprocessing needs to be done (e.g. low-pass + filtering). + + The output structure dataout contains the denoised data in a format that is + consistent with the output of FT_PREPROCESSING. + + The configuration should contain + cfg.channel = the channels to be denoised (default = 'MEG') + cfg.refchannel = the channels used as reference signal (default = 'MEGREF') + cfg.truncate = optional truncation of the singular value spectrum (default = 'no') + cfg.zscore = standardize reference data prior to PCA (default = 'no') + cfg.trials = list of trials that are used (default = 'all') + cfg.pertrial = 'yes' or 'no', whether to regress out the references on a per-trial basis (default = 'no') + cfg.updatesens = 'yes' or 'no', whether to update the sensor array with the spatial projector (default = 'yes') + + if cfg.truncate is integer n > 1, n will be the number of singular values kept. + if 0 < cfg.truncate < 1, the singular value spectrum will be thresholded at the + fraction cfg.truncate of the largest singular value. + + See also FT_PREPROCESSING, FT_DENOISE_AMM, FT_DENOISE_DSSP, + FT_DENOISE_HFC, FT_DENOISE_PREWHITEN, FT_DENOISE_SSP, FT_DENOISE_SSS, + FT_DENOISE_SYNTHETIC, FT_DENOISE_TSR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_denoise_pca.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_denoise_pca", *args, **kwargs) diff --git a/fieldtrip/ft_denoise_prewhiten.py b/fieldtrip/ft_denoise_prewhiten.py new file mode 100644 index 0000000..97961de --- /dev/null +++ b/fieldtrip/ft_denoise_prewhiten.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def ft_denoise_prewhiten(*args, **kwargs): + """ + FT_DENOISE_PREWHITEN applies a spatial prewhitening operation to the data using the + inverse noise covariance matrix. The consequence is that all channels are expressed + in singnal-to-noise units, causing different channel types to be comparable. This + ensures equal weighting in source estimation on data with different channel types. + + Use as + dataout = ft_denoise_prewhiten(cfg, datain, noise) + where the datain is the original data from FT_PREPROCESSING and + noise should contain the estimated noise covariance from + FT_TIMELOCKANALYSIS. + + The configuration structure can contain + cfg.channel = cell-array, see FT_CHANNELSELECTION (default = 'all') + cfg.split = cell-array of channel types between which covariance is split, it can also be 'all' or 'no' + cfg.lambda = scalar, or string, regularization parameter for the inverse + cfg.kappa = scalar, truncation parameter for the inverse + cfg.updatesens = 'yes' or 'no', whether to update the sensor array with the spatial projector (default = 'yes') + + The channel selection relates to the channels that are pre-whitened using the same + selection of channels in the noise covariance. All channels present in the input + data structure will be present in the output, including trigger and other auxiliary + channels. + + See also FT_PREPROCESSING, FT_DENOISE_AMM, FT_DENOISE_DSSP, + FT_DENOISE_HFC, FT_DENOISE_PCA, FT_DENOISE_SSP, FT_DENOISE_SSS, + FT_DENOISE_SYNTHETIC, FT_DENOISE_TSR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_denoise_prewhiten.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_denoise_prewhiten", *args, **kwargs) diff --git a/fieldtrip/ft_denoise_ssp.py b/fieldtrip/ft_denoise_ssp.py new file mode 100644 index 0000000..51eb31e --- /dev/null +++ b/fieldtrip/ft_denoise_ssp.py @@ -0,0 +1,68 @@ +from fieldtrip._runtime import Runtime + + +def ft_denoise_ssp(*args, **kwargs): + """ + FT_DENOISE_SSP projects out topographies based on ambient noise on + Neuromag/Elekta/MEGIN systems. These topographies are estimated during maintenance + visits from the engineers of MEGIN. + Alternatively, computes projectors from reference data (e.g., empty room) if it + is given as an additional input. For best results, make sure to preprocess + the reference data the same as the data to denoise. + + Use as + [data] = ft_denoise_ssp(cfg, data) + or + [data] = ft_denoise_ssp(cfg, data, refdata) + where the input data should come from FT_PREPROCESSING or + FT_TIMELOCKANALYSIS and the configuration should contain + cfg.channel = the channels to be denoised (default = 'all') + cfg.refchannel = the channels used as reference signal (default = 'MEG') + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.ssp = 'all' or a cell array of SSP names to apply (default = 'all') + cfg.updatesens = 'yes' or 'no', whether to update the sensor array with the spatial projector (default = 'yes') + + If refdata is specified, the configuration should also contain + cfg.numcomponent = number of principal components to project out of the data + (default = 3) + + To facilitate data-handling and distributed cmputing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_PREPROCESSING, FT_DENOISE_AMM, FT_DENOISE_DSSP, + FT_DENOISE_HFC, FT_DENOISE_PCA, FT_DENOISE_PREWHITEN, FT_DENOISE_SSS, + FT_DENOISE_SYNTHETIC, FT_DENOISE_TSR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_denoise_ssp.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_denoise_ssp", *args, **kwargs) diff --git a/fieldtrip/ft_denoise_sss.py b/fieldtrip/ft_denoise_sss.py new file mode 100644 index 0000000..14de61f --- /dev/null +++ b/fieldtrip/ft_denoise_sss.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def ft_denoise_sss(*args, **kwargs): + """ + FT_DENOISE_SSS implements an spherical harmonics based projection + algorithm to suppress interference outside an sphere spanned by an MEG + array. + + Use as + dataout = ft_denoise_sss(cfg, datain) + where the input data should come from FT_PREPROCESSING or + FT_TIMELOCKANALYSIS and the configuration should contain + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION for details + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.pertrial = 'no' or 'yes', compute the temporal projection per trial (default = 'yes') + cfg.demean = 'yes' or 'no', demean the data per epoch (default = 'yes') + cfg.updatesens = 'yes' or 'no', whether to update the sensor array with the spatial projector (default = 'yes') + cfg.sss = structure with parameters that determine the behavior of the algorithm + cfg.sss.order_in = scalar, order of the spherical harmonics basis that spans the in space (default = 8) + cfg.sss.order_out = scalar, order of the spherical harmonics basis that spans the out space (default = 3) + + The implementation is based on Tim Tierney's code written for SPM. + + See also FT_PREPROCESSING, FT_DENOISE_AMM, FT_DENOISE_DSSP, + FT_DENOISE_HFC, FT_DENOISE_PCA, FT_DENOISE_PREWHITEN, FT_DENOISE_SSP, + FT_DENOISE_SYNTHETIC, FT_DENOISE_TSR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_denoise_sss.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_denoise_sss", *args, **kwargs) diff --git a/fieldtrip/ft_denoise_synthetic.py b/fieldtrip/ft_denoise_synthetic.py new file mode 100644 index 0000000..89715fd --- /dev/null +++ b/fieldtrip/ft_denoise_synthetic.py @@ -0,0 +1,57 @@ +from fieldtrip._runtime import Runtime + + +def ft_denoise_synthetic(*args, **kwargs): + """ + FT_DENOISE_SYNTHETIC computes CTF higher-order synthetic gradients for + preprocessed data and for the corresponding gradiometer definition. + + Use as + [data] = ft_denoise_synthetic(cfg, data) + where the input data should come from FT_PREPROCESSING or + FT_TIMELOCKANALYSIS and the configuration should contain + cfg.gradient = 'none', 'G1BR', 'G2BR' or 'G3BR' specifies the gradiometer + type to which the data should be changed + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.updatesens = 'yes' or 'no', whether to update the sensor array with the spatial projector (default = 'yes') + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_PREPROCESSING, FT_DENOISE_AMM, FT_DENOISE_DSSP, + FT_DENOISE_HFC, FT_DENOISE_PCA, FT_DENOISE_PREWHITEN, FT_DENOISE_SSP, + FT_DENOISE_SSS, FT_DENOISE_TSR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_denoise_synthetic.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_denoise_synthetic", *args, **kwargs) diff --git a/fieldtrip/ft_denoise_tsr.py b/fieldtrip/ft_denoise_tsr.py new file mode 100644 index 0000000..003ec61 --- /dev/null +++ b/fieldtrip/ft_denoise_tsr.py @@ -0,0 +1,102 @@ +from fieldtrip._runtime import Runtime + + +def ft_denoise_tsr(*args, **kwargs): + """ + FT_DENOISE_TSR performs a regression analysis, using a (time-shifted set + of) reference signal(s) as independent variable. It is a generic + implementation of the method described by De Cheveigne + (https://doi.org/10.1016/j.jneumeth.2007.06.003), or can be + used to compute temporal-response-functions (see e.g. Crosse + (https://doi.org/10.3389/fnhum.2016.00604)), or + spatial filters based on canonical correlation (see Thielen + (https://doi.org/10.1371/journal.pone.0133797)) + + Use as + [dataout] = ft_denoise_tsr(cfg, data) + or + [dataout] = ft_denoise_tsr(cfg, data, refdata) + where "data" is a raw data structure that was obtained with FT_PREPROCESSING. If + you specify the additional input "refdata", the specified reference channels for + the regression will be taken from this second data structure. This can be useful + when reference-channel specific preprocessing needs to be done (e.g. low-pass + filtering). + + The output structure dataout contains the denoised data in a format consistent + with the output of FT_PREPROCESSING. + + The configuration options are: + cfg.refchannel = the channels used as reference signal (default = 'MEGREF'), see FT_SELECTDATA + cfg.channel = the channels to be denoised (default = 'all'), see FT_SELECTDATA + cfg.method = string, 'mlr', 'cca', 'pls', 'svd', option specifying the criterion for the regression + (default = 'mlr') + cfg.reflags = integer array, specifying temporal lags (in msec) by which to shift refchannel + with respect to data channels + cfg.trials = integer array, trials to be used in regression, see FT_SELECTDATA + cfg.testtrials = cell-array or string, trial indices to be used as test folds in a cross-validation scheme + (numel(cfg.testrials == number of folds)) + cfg.nfold = scalar, indicating the number of test folds to + use in a cross-validation scheme + cfg.standardiserefdata = string, 'yes' or 'no', whether or not to standardise reference data + prior to the regression (default = 'no') + cfg.standardisedata = string, 'yes' or 'no', whether or not to standardise dependent variable + prior to the regression (default = 'no') + cfg.demeanrefdata = string, 'yes' or 'no', whether or not to make + reference data zero mean prior to the regression (default = 'no') + cfg.demeandata = string, 'yes' or 'no', whether or not to make + dependent variable zero mean prior to the regression (default = 'no') + cfg.threshold = integer array, ([1 by 2] or [1 by numel(cfg.channel) + numel(cfg.reflags)]), + regularization or shrinkage ('lambda') parameter to be loaded on the diagonal of the + penalty term (if cfg.method == 'mlrridge' or 'mlrqridge') + cfg.updatesens = 'yes' or 'no', whether to update the sensor array with the spatial projector (default = 'yes') + cfg.perchannel = 'yes' or 'no', whether or not to perform estimation of beta weights separately per channel + cfg.output = string, 'model' or 'residual' (defaul = 'model'), + specifies what is outputed in .trial field in + cfg.performance = string, 'pearson' or 'r-squared' (default = + 'pearson'), indicating what performance metric is outputed in .weights(k).performance + field of for the k-th fold + cfg.covmethod = string, 'finite', or 'overlapfinite' (default + = 'finite'), compute covariance for the auto + terms on the finite datapoints per channel, or + only on the datapoints that are finite for the + cross terms. If there is a large number of + unshared nans across datasets, and if this number + is large in comparison to the total number of + datapoints the 'finite' method may become unstable. + + If cfg.threshold is 1 x 2 integer array, the cfg.threshold(1) parameter scales + uniformly in the dimension of predictor variable and cfg.threshold(2) in the + space of response variable. + + See also FT_PREPROCESSING, FT_DENOISE_AMM, FT_DENOISE_DSSP, + FT_DENOISE_HFC, FT_DENOISE_PCA, FT_DENOISE_PREWHITEN, FT_DENOISE_SSP, + FT_DENOISE_SSS, FT_DENOISE_SYNTHETIC + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_denoise_tsr.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_denoise_tsr", *args, **kwargs) diff --git a/fieldtrip/ft_detect_movement.py b/fieldtrip/ft_detect_movement.py new file mode 100644 index 0000000..08f46dc --- /dev/null +++ b/fieldtrip/ft_detect_movement.py @@ -0,0 +1,78 @@ +from fieldtrip._runtime import Runtime + + +def ft_detect_movement(*args, **kwargs): + """ + FT_SACCADE_DETECTION performs detection of movements such as saccades and + microsaccades, but also joystick movements, from time series data over multiple + trials. Different methods for detecting movements are implemented, which are + described in detail below: + + VELOCITY2D - detects micro/saccades using a two-dimensional (2D) velocity according + to "Engbert R, Kliegl R (2003) Vision Res 43:1035-1045". The vertical and the + horizontal eyetracker time series (for one eye) are transformed into velocities and + microsaccades are indentified as "outlier" eye movements that exceed a given + threshold for velocity and duration. This method has the additional options + cfg.velocity2D.kernel = vector 1 x nsamples, kernel to compute velocity (default = [1 1 0 -1 -1].*(data.fsample/6); + cfg.velocity2D.demean = 'no' or 'yes', whether to apply centering correction (default = 'yes') + cfg.velocity2D.mindur = minimum microsaccade durantion in samples (default = 3); + cfg.velocity2D.velthres = threshold for velocity outlier detection (default = 6); + + CLUSTERING - detects movements according to "Otero-Millan et al., (2014) J Vis 14". + + Use as + [cfg, movement] = ft_detect_movement(cfg, data) + where the input data should be organised in a structure as obtained from the + FT_PREPROCESSING function. + + The configuration can contain the following options + cfg.method = string representing the method for movement detection + 'velocity2D' detects microsaccades using the 2D velocity + 'clustering' use unsupervised clustering method to detect microsaccades + cfg.channel = Nx1 cell-array with selection of channels, see FT_CHANNELSELECTION for details, (default = 'all') + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + + The output argument "movement" is a Nx3 matrix. The first and second columns + specify the begining and end samples of a movement period (saccade, joystick, ...), + and the third column contains the peak velocity/acceleration movement. The thrid + column allows to convert movements into spike data representation, making it + compatible with the spike toolbox functions. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_DATABROWSER, FT_DATATYPE_SPIKE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_detect_movement.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_detect_movement", *args, **kwargs) diff --git a/fieldtrip/ft_dipolefitting.py b/fieldtrip/ft_dipolefitting.py new file mode 100644 index 0000000..3ee01b2 --- /dev/null +++ b/fieldtrip/ft_dipolefitting.py @@ -0,0 +1,124 @@ +from fieldtrip._runtime import Runtime + + +def ft_dipolefitting(*args, **kwargs): + """ + FT_DIPOLEFITTING perform grid search and non-linear fit with one or multiple + dipoles and try to find the location where the dipole model is best able + to explain the measured EEG or MEG topography. + + This function will initially scan the whole brain with a single dipole on + a regular coarse grid, and subsequently start at the most optimal location + with a non-linear search. Alternatively you can specify the initial + location of the dipole(s) and the non-linear search will start from there. + + Use as + [source] = ft_dipolefitting(cfg, data) + + The configuration has the following general fields + cfg.numdipoles = number, default is 1 + cfg.symmetry = 'x', 'y' or 'z' symmetry for two dipoles, can be empty (default = []) + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), + see FT_CHANNELSELECTION for details + cfg.gridsearch = 'yes' or 'no', perform global grid search for initial + guess for the dipole parameters (default = 'yes') + cfg.nonlinear = 'yes' or 'no', perform nonlinear search for optimal + dipole parameters (default = 'yes') + + If a grid search is performed, a source model needs to be specified. This should either be + specified as cfg.sourcemodel (see below), or as a set of parameters to define a 3-D regular grid. + In the latter case, a complete grid is constructed using FT_PREPARE_SOURCEMODEL. The specification + of a regular 3-D grid, aligned with the axes of the head coordinate system, can be obtained with + cfg.xgrid = vector (e.g. -20:1:20) or 'auto' (default = 'auto') + cfg.ygrid = vector (e.g. -20:1:20) or 'auto' (default = 'auto') + cfg.zgrid = vector (e.g. 0:1:20) or 'auto' (default = 'auto') + cfg.resolution = number (e.g. 1 cm) + If the source model destribes a triangulated cortical sheet, it is described as + cfg.sourcemodel.pos = N*3 matrix with the vertex positions of the cortical sheet + cfg.sourcemodel.tri = M*3 matrix that describes the triangles connecting the vertices + Alternatively the position of the dipoles at locations of interest can be + user-specified, for example obtained from an anatomical or functional MRI + cfg.sourcemodel.pos = N*3 matrix with position of each source + cfg.sourcemodel.inside = N*1 vector with boolean value whether grid point is inside brain (optional) + cfg.sourcemodel.dim = [Nx Ny Nz] vector with dimensions in case of 3-D grid (optional) + + If you do not start with a grid search, you have to give a starting location + for the nonlinear search + cfg.dip.pos = initial dipole position, matrix of Ndipoles x 3 + + The conventional approach is to fit dipoles to event-related averages, which + within FieldTrip can be obtained from the FT_TIMELOCKANALYSIS or from + the FT_TIMELOCKGRANDAVERAGE function. This has the additional options + cfg.latency = [begin end] in seconds or 'all' (default = 'all') + cfg.model = 'moving' or 'regional' + A moving dipole model has a different position (and orientation) for each + timepoint, or for each component. A regional dipole model has the same + position for each timepoint or component, and a different orientation. + + You can also fit dipoles to the spatial topographies of an independent + component analysis, obtained from the FT_COMPONENTANALYSIS function. + This has the additional options + cfg.component = array with numbers (can be empty -> all) + + You can also fit dipoles to the spatial topographies that are present + in the data in the frequency domain, which can be obtained using the + FT_FREQANALYSIS function. This has the additional options + cfg.frequency = single number (in Hz) + + Low level details of the fitting can be specified in the cfg.dipfit structure + cfg.dipfit.display = level of display, can be 'off', 'iter', 'notify' or 'final' (default = 'iter') + cfg.dipfit.optimfun = function to use, can be 'fminsearch' or 'fminunc' (default is determined automatic) + cfg.dipfit.maxiter = maximum number of function evaluations allowed (default depends on the optimfun) + cfg.dipfit.checkinside = boolean, check that the dipole remains in the source compartment (default = false) + + Optionally, you can modify the leadfields by reducing the rank, i.e. remove the weakest orientation + cfg.reducerank = 'no', or number (default = 3 for EEG, 2 for MEG) + cfg.backproject = 'yes' or 'no', determines when reducerank is applied whether the + lower rank leadfield is projected back onto the original linear + subspace, or not (default = 'yes') + + The volume conduction model of the head should be specified as + cfg.headmodel = structure with volume conduction model, see FT_PREPARE_HEADMODEL + + The EEG or MEG sensor positions can be present in the data or can be specified as + cfg.elec = structure with electrode positions or filename, see FT_READ_SENS + cfg.grad = structure with gradiometer definition or filename, see FT_READ_SENS + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_SOURCEANALYSIS, FT_PREPARE_LEADFIELD, FT_PREPARE_HEADMODEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_dipolefitting.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_dipolefitting", *args, **kwargs) diff --git a/fieldtrip/ft_dipolesimulation.py b/fieldtrip/ft_dipolesimulation.py new file mode 100644 index 0000000..db469fa --- /dev/null +++ b/fieldtrip/ft_dipolesimulation.py @@ -0,0 +1,90 @@ +from fieldtrip._runtime import Runtime + + +def ft_dipolesimulation(*args, **kwargs): + """ + FT_DIPOLESIMULATION simulates channel-level time-series data that consists of the + the spatial distribution of the the field or potential of one or multiple dipoles. + + Use as + data = ft_dipolesimulation(cfg) + which will return a raw data structure that resembles the output of + FT_PREPROCESSING. + + The dipoles position and orientation have to be specified with + cfg.sourcemodel.pos = [Rx Ry Rz] (size Nx3) + cfg.sourcemodel.mom = [Qx Qy Qz] (size 3xN) + cfg.sourcemodel.unit = string, can be 'mm', 'cm', 'm' (default is automatic) + + The timecourse of the dipole activity is given as a cell-array with one + dipole signal per trial + cfg.sourcemodel.signal = cell-array with one dipole signal per trial + or by specifying the parameters of a sine-wave signal + cfg.sourcemodel.frequency = in Hz + cfg.sourcemodel.phase = in radians + cfg.sourcemodel.amplitude = per dipole + + The number of trials and the time axes of the trials can be specified by + cfg.fsample = simulated sample frequency (default = 1000) + cfg.trllen = length of simulated trials in seconds (default = 1) + cfg.numtrl = number of simulated trials (default = 10) + cfg.baseline = number (default = 0.3) + or by + cfg.time = cell-array with one time axis per trial, for example obtained from an existing dataset + + Random white noise can be added to the data in each trial, either by + specifying an absolute or a relative noise level + cfg.relnoise = add noise with level relative to data signal + cfg.absnoise = add noise with absolute level + cfg.randomseed = 'yes' or a number or vector with the seed value (default = 'yes') + + Optional input arguments are + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), + see FT_CHANNELSELECTION for details + cfg.dipoleunit = units for dipole amplitude (default nA*m) + cfg.chanunit = Nx1 cell-array with units for the channel data + + Optionally, you can modify the leadfields by reducing the rank, i.e. remove the weakest orientation + cfg.reducerank = 'no', or number (default = 3 for EEG, 2 for MEG) + cfg.backproject = 'yes' or 'no', determines when reducerank is applied whether the + lower rank leadfield is projected back onto the original linear + subspace, or not (default = 'yes') + + The volume conduction model of the head should be specified as + cfg.headmodel = structure with volume conduction model, see FT_PREPARE_HEADMODEL + + The EEG or MEG sensor positions should be specified as + cfg.elec = structure with electrode positions or filename, see FT_READ_SENS + cfg.grad = structure with gradiometer definition or filename, see FT_READ_SENS + + See also FT_SOURCEANALYSIS, FT_DIPOLEFITTING, FT_TIMELOCKSIMULATION, + FT_FREQSIMULATION, FT_CONNECTIVITYSIMULATION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_dipolesimulation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_dipolesimulation", *args, **kwargs) diff --git a/fieldtrip/ft_electrodeplacement.py b/fieldtrip/ft_electrodeplacement.py new file mode 100644 index 0000000..7cf2c6c --- /dev/null +++ b/fieldtrip/ft_electrodeplacement.py @@ -0,0 +1,132 @@ +from fieldtrip._runtime import Runtime + + +def ft_electrodeplacement(*args, **kwargs): + """ + FT_ELECTRODEPLACEMENT allows manual placement of electrodes on a MRI scan, CT scan + or on a triangulated surface of the head. This function supports different methods. + + VOLUME - Navigate an orthographic display of a volume (e.g. CT or MRI scan), and + assign an electrode label to the current crosshair location by clicking on a label + in the eletrode list. You can undo the selection by clicking on the same label + again. The electrode labels shown in the list can be prespecified using cfg.channel + when calling ft_electrodeplacement. The zoom slider allows zooming in at the + location of the crosshair. The intensity sliders allow thresholding the image's low + and high values. The magnet feature transports the crosshair to the nearest peak + intensity voxel, within a certain voxel radius of the selected location. The labels + feature displays the labels of the selected electrodes within the orthoplot. The + global feature allows toggling the view between all and near-crosshair + markers. The scan feature allows toggling between scans when another scan + is given as input. + + HEADSHAPE - Navigate a triangulated scalp (for EEG) or brain (for ECoG) surface, + and assign an electrode location by clicking on the surface. The electrode is + placed on the triangulation itself. + + 1020 - Starting from a triangulated scalp surface and the nasion, inion, left and + right pre-auricular points, this automatically constructs and follows contours over + the surface according to the 5% system. Electrodes are placed at certain relative + distances along these countours. This is an extension of the 10-20 standard + electrode placement system and includes the 20%, 10% and 5% locations. See + "Oostenveld R, Praamstra P. The five percent electrode system for high-resolution + EEG and ERP measurements. Clin Neurophysiol. 2001 Apr;112(4):713-9" for details. + + SHAFT - This is for placing electrodes along a linear sEEG shaft. The tip of the + shaft corresponding to the first electrode, another point along the shaft, and the + distance between the electrodes should be specified. If the shaft is not straight + but curved, you should specify multiple (at least two) points along the shaft, + i.e., specify cfg.shaft.along as an Nx3 array for N points along the shaft. The + number of electrodes to be distributed along the shaft is determined from cfg.channel. + + GRID - This is for placing electrodes on a regular MxN ECoG grid. Each of the four + cornerpoints of the grid must be specified, along with the dimensions of the grid. + Following piecewise linear placement of the electrodes on the grid, you can use + FT_ELECTRODEREALIGN with cfg.method='project' to project them to the curved brain + surface. + + Use as + [elec] = ft_electrodeplacement(cfg, mri) + [elec] = ft_electrodeplacement(cfg, ct) + [elec] = ft_electrodeplacement(cfg, mri, ct, ..) + where the second and subsequent input arguments should be one or multiple + anatomical MRIs and/or CTs, or + [elec] = ft_electrodeplacement(cfg, headshape) + where the input headshape should be a surface triangulation. + + The configuration can contain the following options + cfg.method = string representing the method for placing the electrodes + 'volume' interactively locate electrodes on three orthogonal slices of a volumetric MRI or CT scan + 'headshape' interactively locate electrodes on a head surface + '1020' automatically locate electrodes on a head surface according to the 10-20 system + 'shaft' automatically locate electrodes along a linear sEEG shaft + 'grid' automatically locate electrodes on a MxN ECoG grid + cfg.figure = 'yes' or 'no', whether to open a new figure. You can also specify a figure handle from FIGURE, GCF or SUBPLOT. (default = 'yes') + cfg.figurename = string, title of the figure window + cfg.position = location and size of the figure, specified as [left bottom width height] (default is automatic) + cfg.renderer = string, 'opengl', 'zbuffer', 'painters', see RENDERERINFO (default = 'opengl') + + The following options apply to the 'volume' method + cfg.parameter = string, field in data (default = 'anatomy' if present in data) + cfg.channel = Nx1 cell-array with selection of channels (default = {'1' '2' ...}) + cfg.elec = struct containing previously placed electrodes (this overwrites cfg.channel) + cfg.clim = color range of the data (default = [0 1], i.e. the full range) + cfg.magtype = string representing the 'magnet' type used for placing the electrodes + 'peakweighted' place electrodes at weighted peak intensity voxel (default) + 'troughweighted' place electrodes at weighted trough intensity voxel + 'peak' place electrodes at peak intensity voxel (default) + 'trough' place electrodes at trough intensity voxel + 'weighted' place electrodes at center-of-mass + cfg.magradius = number representing the radius for the cfg.magtype based search (default = 3) + + The following options apply to the '1020' method + cfg.fiducial.nas = 1x3 vector with coordinates + cfg.fiducial.ini = 1x3 vector with coordinates + cfg.fiducial.lpa = 1x3 vector with coordinates + cfg.fiducial.rpa = 1x3 vector with coordinates + cfg.feedback = string, can be 'yes' or 'no' for detailed feedback (default = 'yes') + + The following options apply to the 'shaft' method + cfg.shaft.tip = 1x3 position of the electrode at the tip of the shaft + cfg.shaft.along = 1x3 or Nx3 positions along the shaft + cfg.shaft.distance = scalar, distance between electrodes + + The following options apply to the 'grid' method + cfg.grid.corner1 = 1x3 position of the upper left corner point + cfg.grid.corner2 = 1x3 position of the upper right corner point + cfg.grid.corner3 = 1x3 position of the lower left corner point + cfg.grid.corner4 = 1x3 position of the lower right corner point + + In the interactive 'headshape' and 'volume' methods you can click once on an + already assigned electrode to jump to that electrode position and you can click + twice to remove the assigned electrode position. + + See also FT_ELECTRODEREALIGN, FT_VOLUMEREALIGN, FT_VOLUMESEGMENT, FT_PREPARE_MESH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_electrodeplacement.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_electrodeplacement", *args, **kwargs) diff --git a/fieldtrip/ft_electroderealign.py b/fieldtrip/ft_electroderealign.py new file mode 100644 index 0000000..74d8d73 --- /dev/null +++ b/fieldtrip/ft_electroderealign.py @@ -0,0 +1,171 @@ +from fieldtrip._runtime import Runtime + + +def ft_electroderealign(*args, **kwargs): + """ + FT_ELECTRODEREALIGN rotates, translates, scales, warps and/or projects EEG + electrode positions. The different methods are described in detail below. + + INTERACTIVE - This displays the skin surface together with the electrode or + gradiometer positions, and allows you to manually adjust (using the graphical user + interface) the rotation, translation and scaling parameters, so that the electrodes + correspond with the skin. + + FIDUCIAL - This applies a rigid body realignment based on three fiducial or + anatomical locations. After realigning, the fiducials that are part of the input + electrode set (typically nose, left and right ear) are along the same axes as + the fiducials in the target electrode set. + + TEMPLATE - This applies a linear or non-linear spatial transformation/deformation + that automatically minimizes the distance between the input electrodes and a target + electrode set. The warping methods use a non-linear search to minimize the distance + between the input electrode positions and the corresponding target electrode. + + HEADSHAPE - This applies a spatial transformation/deformation that automatically + minimizes the distance between the electrodes and the head surface. The warping + methods use a non-linear search to minimize the distance between the input electrode + positions and the projection of the electrodes on the head surface. + + PROJECT - This projects each of the electrodes to the nearest point on the + head surface mesh. + + MOVEINWARD - This moves all electrodes inward according to their normals. + + MNI - This transforms the electrodes nonlinearly using the same transformation of + the individual anatomical MRI to the MNI template. + + Use as + [elec_realigned] = ft_electroderealign(cfg) + with the electrode or gradiometer details in the configuration, or as + [elec_realigned] = ft_electroderealign(cfg, elec_input) + with the electrode or gradiometer definition as 2nd input argument. + + The configuration can contain the following options + cfg.method = string representing the method for aligning or placing the electrodes + 'interactive' realign manually using a graphical user interface + 'fiducial' realign using three fiducials (e.g. NAS, LPA and RPA) + 'template' realign the electrodes to match a target electrode set + 'headshape' realign the electrodes to fit the head surface + 'project' projects electrodes onto the head surface + 'moveinward' moves electrodes inward along their normals + 'mni' transforms electrodes from individual subject to MNI space + cfg.warp = string describing the spatial transformation for the template and headshape methods + 'rigidbody' apply a rigid-body warp (default) + 'globalrescale' apply a rigid-body warp with global rescaling + 'traditional' apply a rigid-body warp with individual axes rescaling + 'nonlin1' apply a 1st order non-linear warp + 'nonlin2' apply a 2nd order non-linear warp + 'nonlin3' apply a 3rd order non-linear warp + 'nonlin4' apply a 4th order non-linear warp + 'nonlin5' apply a 5th order non-linear warp + 'dykstra2012' back-project ECoG onto the cortex using energy minimzation + 'hermes2010' back-project ECoG onto the cortex along the local norm vector + 'fsaverage' surface-based realignment with FreeSurfer fsaverage brain (left->left or right->right) + 'fsaverage_sym' surface-based realignment with FreeSurfer fsaverage_sym left hemisphere (left->left or right->left) + 'fsinflated' surface-based realignment with FreeSurfer individual subject inflated brain (left->left or right->right) + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION for details + cfg.keepchannel = string, 'yes' or 'no' (default = 'no') + cfg.fiducial = cell-array with the name of three fiducials used for aligning to the target (default = {'nasion', 'lpa', 'rpa'}) + cfg.casesensitive = 'yes' or 'no', determines whether string comparisons between electrode labels are case sensitive (default = 'yes') + cfg.feedback = 'yes' or 'no' (default = 'no') + + The electrode positions can be present in the 2nd input argument or can be specified as + cfg.elec = structure with electrode positions or filename, see FT_READ_SENS + + If your input EEG electrodes include the positions of anatomical landmarks or + fiducials, you can specify the target location of those, for example here in + millimeter according to the CTF coordinate system with the nose along X and the + ears along +Y and -Y + cfg.target.pos(1,:) = [110 0 0] % target location of the nose + cfg.target.pos(2,:) = [0 90 0] % target location of the left ear + cfg.target.pos(3,:) = [0 -90 0] % target location of the right ear + cfg.target.label = {'NAS', 'LPA', 'RPA'} + + If you want to align the input EEG electrodes to a target electrode sets or to + multiple target electrode sets (which will be averaged), you should specify the + target electrode sets either as electrode structures (i.e. when they are already + read in memory) or as their file names using + cfg.target = single electrode set to serve as the target + or + cfg.target{1..N} = list of electrode sets to serve as the target, these will be averaged + + If you want to align EEG electrodes to the head surface, you should specify the head surface as + cfg.headshape = a filename containing headshape, a structure containing a + single triangulated boundary, or a Nx3 matrix with surface + points + + If you want to align ECoG electrodes to the pial surface, you first need to compute + the cortex hull with FT_PREPARE_MESH. Then use either the algorithm described in + Dykstra et al. (2012, Neuroimage) or in Hermes et al. (2010, J Neurosci methods) to + snap the electrodes back to the cortical hull, e.g. + cfg.method = 'headshape' + cfg.warp = 'dykstra2012', or 'hermes2010' + cfg.headshape = a filename containing headshape, a structure containing a + single triangulated boundary, or a Nx3 matrix with surface + points + cfg.feedback = 'yes' or 'no' (default), feedback of the iteration procedure + + Additional configuration options for cfg.warp='dykstra2012' + cfg.maxiter = number (default: 50), maximum number of optimization iterations + cfg.pairmethod = 'pos' (default) or 'label', the method for electrode + pairing on which the deformation energy is based + cfg.isodistance = 'yes', 'no' (default) or number, to enforce isotropic + inter-electrode distances (pairmethod 'label' only) + cfg.deformweight = number (default: 1), weight of deformation relative + to shift energy cost (lower increases grid flexibility) + + If you want to move the electrodes inward, you should specify + cfg.moveinward = number, the distance that the electrode should be moved + inward (negative numbers result in an outward move) + + If you want to align ECoG electrodes to the freesurfer average brain, you should + specify the path to your headshape (e.g., lh.pial), and ensure you have the + corresponding registration file (e.g., lh.sphere.reg) in the same directory. + Moreover, the path to the local freesurfer home is required. Note that, because the + electrodes are being aligned to the fsaverage brain, the corresponding brain should + be also used when plotting the data, i.e. use freesurfer/subjects/fsaverage/surf/lh.pial + rather than surface_pial_left.mat + cfg.method = 'headshape' + cfg.warp = 'fsaverage' + cfg.headshape = string, filename containing subject headshape (e.g. ) + cfg.fshome = string, path to freesurfer + + If you want to transform electrodes from individual subject coordinates to MNI + space, you should specify the following + cfg.mri = structure with the individual anatomical MRI relative to which electrodes are specified, or the filename of the MRI, see FT_READ_MRI + cfg.templatemri = string, filename of the MNI template (default = 'T1.mnc' for SPM2 or 'T1.nii' for SPM8 and SPM12) + cfg.spmversion = string, 'spm2', 'spm8', 'spm12' (default = 'spm12') + cfg.spmmethod = string, 'old', 'new' or 'mars', see FT_VOLUMENORMALISE + cfg.nonlinear = string, 'yes' or 'no', see FT_VOLUMENORMALISE + + See also FT_READ_SENS, FT_VOLUMEREALIGN, FT_INTERACTIVEREALIGN, + FT_DETERMINE_COORDSYS, FT_PREPARE_MESH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_electroderealign.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_electroderealign", *args, **kwargs) diff --git a/fieldtrip/ft_electrodermalactivity.py b/fieldtrip/ft_electrodermalactivity.py new file mode 100644 index 0000000..77d52df --- /dev/null +++ b/fieldtrip/ft_electrodermalactivity.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def ft_electrodermalactivity(*args, **kwargs): + """ + FT_ELECTRODERMALACTIVITY estimates the electrodermal activity from a recording of + the electric resistance of the skin. + + Use as + eda = ft_electrodermalactivity(cfg, data) + where the input data is a structure as obtained from FT_PREPROCESSING. + + The configuration structure has the following options + cfg.channel = selected channel for processing, see FT_CHANNELSELECTION + cfg.feedback = 'yes' or 'no' + cfg.medianwindow = scalar, length of window for median filter in seconds (default = 8) + + After using this function you can use FT_REDEFINETRIAL and FT_TIMELOCKANLAYSIS to + investigate electrodermal responses (EDRs) to stimulation. You can use + FT_ARTIFACT_THRESHOLD to determine the timing and frequency of nonspecific EDRs. + + See https://doi.org/10.1111/j.1469-8986.2012.01384.x "Publication recommendations + for electrodermal measurements" by the SPR for an introduction in electrodermal + methods and for recommendations. + + See also FT_HEARTRATE, FT_HEADMOVEMENT, FT_REGRESSCONFOUND + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_electrodermalactivity.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_electrodermalactivity", *args, **kwargs) diff --git a/fieldtrip/ft_eventtiminganalysis.py b/fieldtrip/ft_eventtiminganalysis.py new file mode 100644 index 0000000..3d343c8 --- /dev/null +++ b/fieldtrip/ft_eventtiminganalysis.py @@ -0,0 +1,106 @@ +from fieldtrip._runtime import Runtime + + +def ft_eventtiminganalysis(*args, **kwargs): + """ + FT_EVENTTIMINGANALYSIS computes a model of single trial event- related activity, + by estimating per trial the latency (and amplitude) of event-related signal + components. + + Use as + [dataout] = ft_eventtiminganalysis(cfg, data) + where data is single-channel raw data as obtained by FT_PREPROCESSING + and cfg is a configuration structure according to + + cfg.method = method for estimating event-related activity + 'aseo', analysis of single-trial ERP and ongoing + activity (according to Xu et al, 2009) + 'gbve', graph-based variability estimation + (according to Gramfort et al, IEEE TBME 2009) + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), + see FT_CHANNELSELECTION for details + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.output = 'model', or 'residual', which returns the modelled data, + or the residuals. + + Method specific options are specified in the appropriate substructure. + + For the ASEO method, the following options can be specified: + cfg.aseo.noiseEstimate = 'non-parametric' or 'parametric', estimate noise + using parametric or non-parametric (default) method + cfg.aseo.tapsmofrq = value, smoothing parameter of noise for + nonparametric estimation (default = 5) + cfg.aseo.jitter = value, time jitter in initial timewindow + estimate (in seconds). default 0.050 seconds + cfg.aseo.numiteration = value, number of iteration (default = 1) + cfg.aseo.initlatency = Nx2 matrix, initial set of latencies in seconds of event- + related components, give as [comp1start, comp1end; + comp2start, comp2end] (default not + specified). For multiple channels it should + be a cell-array, one matrix per channel + Alternatively, rather than specifying a (set of latencies), one can also + specify: + + cfg.aseo.initcomp = vector, initial estimate of the waveform + components. For multiple channels it should + be a cell-array, one matrix per channel. + + For the GBVE method, the following options can be specified: + cfg.gbve.sigma = vector, range of sigma values to explore in + cross-validation loop (default: 0.01:0.01:0.2) + cfg.gbve.distance = scalar, distance metric to use as + evaluation criterion, see plugin code for + more informatoin + cfg.gbve.alpha = vector, range of alpha values to explor in + cross-validation loop (default: [0 0.001 0.01 0.1]) + cfg.gbve.exponent = scalar, see plugin code for information + cfg.gbve.use_maximum = boolean, (default: 1) consider the positive going peak + cfg.gbve.show_pca = boolean, see plugin code (default 0) + cfg.gbve.show_trial_number = boolean, see plugin code (default 0) + cfg.gbve.verbose = boolean (default: 1) + cfg.gbve.disp_log = boolean, see plugin code (default 0) + cfg.gbve.latency = vector [min max], latency range in s + (default: [-inf inf]) + cfg.gbve.xwin = scalar smoothing parameter for moving + average smoothing (default: 1), see + eeglab's movav function for more + information. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_SINGLETRIALANALYSIS_ASEO + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_eventtiminganalysis.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_eventtiminganalysis", *args, **kwargs) diff --git a/fieldtrip/ft_examplefunction.py b/fieldtrip/ft_examplefunction.py new file mode 100644 index 0000000..e5f728d --- /dev/null +++ b/fieldtrip/ft_examplefunction.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def ft_examplefunction(*args, **kwargs): + """ + FT_EXAMPLEFUNCTION demonstrates to new developers how a FieldTrip function should look like + + Use as + outdata = ft_examplefunction(cfg, indata) + where indata is <> + and cfg is a configuration structure that should contain + + <> + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_examplefunction.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_examplefunction", *args, **kwargs) diff --git a/fieldtrip/ft_freqanalysis.py b/fieldtrip/ft_freqanalysis.py new file mode 100644 index 0000000..f572393 --- /dev/null +++ b/fieldtrip/ft_freqanalysis.py @@ -0,0 +1,249 @@ +from fieldtrip._runtime import Runtime + + +def ft_freqanalysis(*args, **kwargs): + """ + FT_FREQANALYSIS performs frequency and time-frequency analysis + on time series data over multiple trials + + Use as + [freq] = ft_freqanalysis(cfg, data) + + The input data should be organised in a structure as obtained from + FT_PREPROCESSING or FT_MVARANALYSIS. The configuration depends on the + type of computation that you want to perform. + + The configuration should contain: + cfg.method = different methods of calculating the spectra + 'mtmfft', analyses an entire spectrum for the entire data + length, implements multitaper frequency transformation. + 'mtmconvol', implements multitaper time-frequency + transformation based on multiplication in the + frequency domain. + 'wavelet', implements wavelet time frequency + transformation (using Morlet wavelets) based on + multiplication in the frequency domain. + 'tfr', implements wavelet time frequency + transformation (using Morlet wavelets) based on + convolution in the time domain. + 'mvar', does a fourier transform on the coefficients + of an estimated multivariate autoregressive model, + obtained with FT_MVARANALYSIS. In this case, the + output will contain a spectral transfer matrix, + the cross-spectral density matrix, and the + covariance matrix of the innovation noise. + 'superlet', combines Morlet-wavelet based + decompositions, see below. + 'irasa', implements Irregular-Resampling Auto-Spectral + Analysis (IRASA), to separate the fractal components + from the periodicities in the signal. + 'hilbert', implements the filter-Hilbert method, see + below. + cfg.output = 'pow' return the power-spectra + 'powandcsd' return the power and the cross-spectra + 'fourier' return the complex Fourier-spectra + 'fractal' (when cfg.method = 'irasa'), return the + fractal component of the spectrum (1/f) + 'original' (when cfg.method = 'irasa'), return the + full power spectrum + 'fooof' returns a smooth power-spectrum, + based on a parametrization of a mixture of aperiodic and periodic + components (only works with cfg.method = 'mtmfft') + 'fooof_aperiodic' returns a power-spectrum with the + fooof based estimate of the aperiodic part of the signal. + 'fooof_peaks' returns a power-spectrum with the fooof + based estimate of the aperiodic signal removed, + it's expressed as + 10^(log10(fooof)-log10(fooof_aperiodic)) + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), + see FT_CHANNELSELECTION for details + cfg.channelcmb = Mx2 cell-array with selection of channel pairs (default = {'all' 'all'}), + see FT_CHANNELCOMBINATION for details + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.keeptrials = 'yes' or 'no', return individual trials or average (default = 'no') + cfg.keeptapers = 'yes' or 'no', return individual tapers or average (default = 'no') + cfg.pad = number, 'nextpow2', or 'maxperlen' (default), length + in seconds to which the data can be padded out. The + padding will determine your spectral resolution. If you + want to compare spectra from data pieces of different + lengths, you should use the same cfg.pad for both, in + order to spectrally interpolate them to the same + spectral resolution. The new option 'nextpow2' rounds + the maximum trial length up to the next power of 2. By + using that amount of padding, the FFT can be computed + more efficiently in case 'maxperlen' has a large prime + factor sum. + cfg.padtype = string, type of padding (default 'zero', see + ft_preproc_padding) + cfg.polyremoval = number (default = 0), specifying the order of the + polynome which is fitted and subtracted from the time + domain data prior to the spectral analysis. For + example, a value of 1 corresponds to a linear trend. + The default is a mean subtraction, thus a value of 0. + If no removal is requested, specify -1. + see FT_PREPROC_POLYREMOVAL for details + + + METHOD SPECIFIC OPTIONS AND DESCRIPTIONS + + MTMFFT performs frequency analysis on any time series trial data using a + conventional single taper (e.g. Hanning) or using the multiple tapers based on + discrete prolate spheroidal sequences (DPSS), also known as the Slepian + sequence. + cfg.taper = 'dpss', 'hanning' or many others, see WINDOW (default = 'dpss') + For cfg.output='powandcsd', you should specify the channel combinations + between which to compute the cross-spectra as cfg.channelcmb. Otherwise + you should specify only the channels in cfg.channel. + cfg.foilim = [begin end], frequency band of interest + OR + cfg.foi = vector 1 x numfoi, frequencies of interest + cfg.tapsmofrq = number, the amount of spectral smoothing through + multi-tapering. Note that 4 Hz smoothing means + plus-minus 4 Hz, i.e. a 8 Hz smoothing box. + + MTMCONVOL performs time-frequency analysis on any time series trial data using + the 'multitaper method' (MTM) based on Slepian sequences as tapers. + Alternatively, you can use conventional tapers (e.g. Hanning). + cfg.tapsmofrq = vector 1 x numfoi, the amount of spectral smoothing + through multi-tapering. Note that 4 Hz smoothing means + plus-minus 4 Hz, i.e. a 8 Hz smoothing box. + cfg.foi = vector 1 x numfoi, frequencies of interest + cfg.taper = 'dpss', 'hanning' or many others, see WINDOW (default = 'dpss') + For cfg.output='powandcsd', you should specify the channel combinations + between which to compute the cross-spectra as cfg.channelcmb. Otherwise + you should specify only the channels in cfg.channel. + cfg.t_ftimwin = vector 1 x numfoi, length of time window (in seconds) + cfg.toi = vector 1 x numtoi, the times on which the analysis + windows should be centered (in seconds), or a string + such as '50%' or 'all'. Both string options + use all timepoints available in the data, but 'all' + centers a spectral estimate on each sample, whereas + the percentage specifies the degree of overlap between + the shortest time windows from cfg.t_ftimwin. + + WAVELET performs time-frequency analysis on any time series trial data using the + 'wavelet method' based on Morlet wavelets. Using mulitplication in the frequency + domain instead of convolution in the time domain. + cfg.foi = vector 1 x numfoi, frequencies of interest + OR + cfg.foilim = [begin end], frequency band of interest + cfg.toi = vector 1 x numtoi, the times on which the analysis + windows should be centered (in seconds) + cfg.width = 'width', or number of cycles, of the wavelet (default = 7) + cfg.gwidth = determines the length of the used wavelets in standard + deviations of the implicit Gaussian kernel and should + be chosen >= 3; (default = 3) + + The standard deviation in the frequency domain (sf) at frequency f0 is + defined as: sf = f0/width + The standard deviation in the temporal domain (st) at frequency f0 is + defined as: st = 1/(2*pi*sf) + + HILBERT performs time-frequency analysis on any time series data using a frequency specific + bandpass filter, followed by the Hilbert transform. + cfg.foi = vector 1 x numfoi, frequencies of interest + cfg.toi = vector 1 x numtoi, the time points for which the estimates will be returned (in seconds) + cfg.width = scalar, or vector (default: 1), specifying the half bandwidth of the filter; + cfg.edgartnan = 'no' (default) or 'yes', replace filter edges with nans, works only for finite impulse response (FIR) filters, and + requires a user specification of the filter order + + For the bandpass filtering the following options can be specified, the default values are as in FT_PREPROC_BANDPASSFILTER, for more + information see the help of FT_PREPROCESSING + cfg.bpfilttype + cfg.bpfiltord = (optional) scalar, or vector 1 x numfoi; + cfg.bpfiltdir + cfg.bpinstabilityfix + cfg.bpfiltdf + cfg.bpfiltwintype + cfg.bpfiltdev + + SUPERLET performs time-frequency analysis on any time series trial data using the + 'superlet method' based on a frequency-wise combination of Morlet wavelets of varying cycle + widths (see Moca et al. 2021, https://doi.org/10.1038/s41467-020-20539-9). + cfg.foi = vector 1 x numfoi, frequencies of interest + OR + cfg.foilim = [begin end], frequency band of interest + cfg.toi = vector 1 x numtoi, the times on which the analysis + windows should be centered (in seconds) + cfg.width = 'width', or number of cycles, of the base wavelet (default = 3) + cfg.gwidth = determines the length of the used wavelets in standard + deviations of the implicit Gaussian kernel and should + be chosen >= 3; (default = 3) + cfg.combine = 'additive', 'multiplicative' (default = 'multiplicative') + determines if cycle numbers of wavelets comprising a superlet + are chosen additively or multiplicatively + cfg.order = vector 1 x numfoi, superlet order, i.e. number of combined + wavelets, for individual frequencies of interest. + + The standard deviation in the frequency domain (sf) at frequency f0 is + defined as: sf = f0/width + The standard deviation in the temporal domain (st) at frequency f0 is + defined as: st = 1/(2*pi*sf) + + TFR performs time-frequency analysis on any time series trial data using the + 'wavelet method' based on Morlet wavelets. Using convolution in the time domain + instead of multiplication in the frequency domain. + cfg.foi = vector 1 x numfoi, frequencies of interest + OR + cfg.foilim = [begin end], frequency band of interest + cfg.width = 'width', or number of cycles, of the wavelet (default = 7) + cfg.gwidth = determines the length of the used wavelets in standard + deviations of the implicit Gaussian kernel and should + be choosen >= 3; (default = 3) + + IRASA (Irregular-Resampling Auto-Spectral Analysis) estimates the + 'fractal' component of the power spectrum (https://doi.org/10.1007/s10548-015-0448-0), + by stretching/compressing the sampling rate, and combining the geometric means of + the power spectra resulting from the stretching/compression. The default behavior is + according to the implementation in the referenced paper, where each input segment's + power spectrum is computed according to a Welch-type overlapping windowed estimation. + cfg.taper = 'dpss', 'hanning' or many others, see WINDOW (default = 'hanning'), in case of 'dpss' + only the first Slepian is used + cfg.hset = vector of stretching/compression ratios (default = (1.1:0.05:1.9)) + cfg.nwindow = scalar, number of overlapping windows per segment (default = 10) + cfg.windowlength = scalar, 'auto', or 'all', length of window in seconds (default = 'auto') + cfg.mfunc = string, 'median', or 'trimmean', method to aggregate across geometric means of spectra (default = 'median') + cfg.output = string, 'fractal', or 'original' (default = 'fractal'), computes either fractal component, or the original + spectrum (for comparison), based on the same parameters (minus the stretching/compression) + + MVAR estimates the spectrum based on Autoregressive models, requires output from FT_MVARANALYSIS. + See FT_FREQANALYSIS_MVAR. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a + *.mat file on disk and/or the output data will be written to a *.mat + file. These mat files should contain only a single variable, + corresponding with the input/output structure. + + See also FT_FREQSTATISTICS, FT_FREQDESCRIPTIVES, FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_freqanalysis.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_freqanalysis", *args, **kwargs) diff --git a/fieldtrip/ft_freqanalysis_mvar.py b/fieldtrip/ft_freqanalysis_mvar.py new file mode 100644 index 0000000..0da075d --- /dev/null +++ b/fieldtrip/ft_freqanalysis_mvar.py @@ -0,0 +1,68 @@ +from fieldtrip._runtime import Runtime + + +def ft_freqanalysis_mvar(*args, **kwargs): + """ + FT_FREQANALYSIS_MVAR performs frequency analysis on + mvar data, by fourier transformation of the coefficients. The output + contains cross-spectral density, spectral transfer matrix, and the + covariance of the innovation noise. The dimord = 'chan_chan(_freq)(_time) + + The function is stand-alone, but is typically called through + FT_FREQANALYSIS, specifying cfg.method = 'mvar'. + + Use as + [freq] = ft_freqanalysis(cfg, data), with cfg.method = 'mvar' + + or + + [freq] = ft_freqanalysis_mvar(cfg, data) + + The input data structure should be a data structure created by + FT_MVARANALYSIS, i.e. a data-structure of type 'mvar'. + + The configuration can contain: + cfg.foi = vector with the frequencies at which the spectral quantities + are estimated (in Hz). Default: 0:1:Nyquist + cfg.feedback = 'none', or any of the methods supported by FT_PROGRESS, + for providing feedback to the user in the command + window. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_MVARANALYSIS, FT_DATATYPE_MVAR, FT_PROGRESS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_freqanalysis_mvar.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_freqanalysis_mvar", *args, **kwargs) diff --git a/fieldtrip/ft_freqbaseline.py b/fieldtrip/ft_freqbaseline.py new file mode 100644 index 0000000..1ae0c2c --- /dev/null +++ b/fieldtrip/ft_freqbaseline.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def ft_freqbaseline(*args, **kwargs): + """ + FT_FREQBASELINE performs baseline normalization for time-frequency data + + Use as + [freq] = ft_freqbaseline(cfg, freq) + where the freq data comes from FT_FREQANALYSIS and the configuration + should contain + cfg.baseline = [begin end] (default = 'no'), alternatively an + Nfreq x 2 matrix can be specified, that provides + frequency specific baseline windows. + cfg.baselinetype = 'absolute', 'relative', 'relchange', 'normchange', 'db', 'vssum' or 'zscore' (default = 'absolute') + cfg.parameter = field for which to apply baseline normalization, or + cell-array of strings to specify multiple fields to normalize + (default = 'powspctrm') + + See also FT_FREQANALYSIS, FT_TIMELOCKBASELINE, FT_FREQCOMPARISON, + FT_FREQGRANDAVERAGE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_freqbaseline.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_freqbaseline", *args, **kwargs) diff --git a/fieldtrip/ft_freqdescriptives.py b/fieldtrip/ft_freqdescriptives.py new file mode 100644 index 0000000..051195f --- /dev/null +++ b/fieldtrip/ft_freqdescriptives.py @@ -0,0 +1,72 @@ +from fieldtrip._runtime import Runtime + + +def ft_freqdescriptives(*args, **kwargs): + """ + FT_FREQDESCRIPTIVES computes descriptive univariate statistics of + the frequency or time-frequency decomposition of the EEG/MEG signal, + thus the powerspectrum and its standard error. + + Use as + [freq] = ft_freqdescriptives(cfg, freq) + [freq] = ft_freqdescriptives(cfg, freqmvar) + + The data in freq should be organised in a structure as obtained from + from the FT_FREQANALYSIS or FT_MVARANALYSIS function. The output structure is comparable + to the input structure and can be used in most functions that require + a freq input. + + The configuration options are + cfg.variance = 'yes' or 'no', estimate standard error in the standard way (default = 'no') + cfg.jackknife = 'yes' or 'no', estimate standard error by means of the jack-knife (default = 'no') + cfg.keeptrials = 'yes' or 'no', estimate single trial power (useful for fourier data) (default = 'no') + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), + see FT_CHANNELSELECTION for details + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.frequency = [fmin fmax] or 'all', to specify a subset of frequencies (default = 'all') + cfg.latency = [tmin tmax] or 'all', to specify a subset of latencies (default = 'all') + + A variance estimate can only be computed if results from trials and/or + tapers have been kept. + + Descriptive statistics of bivariate metrics is not computed by this function anymore. To this end you + should use FT_CONNECTIVITYANALYSIS. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_FREQANALYSIS, FT_FREQSTATISTICS, FT_FREQBASELINE, FT_CONNECTIVITYANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_freqdescriptives.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_freqdescriptives", *args, **kwargs) diff --git a/fieldtrip/ft_freqgrandaverage.py b/fieldtrip/ft_freqgrandaverage.py new file mode 100644 index 0000000..a4707e6 --- /dev/null +++ b/fieldtrip/ft_freqgrandaverage.py @@ -0,0 +1,63 @@ +from fieldtrip._runtime import Runtime + + +def ft_freqgrandaverage(*args, **kwargs): + """ + FT_FREQGRANDAVERAGE computes the average powerspectrum or time-frequency spectrum + over multiple subjects + + Use as + [grandavg] = ft_freqgrandaverage(cfg, freq1, freq2, freq3...) + + The input data freq1..N are obtained from either FT_FREQANALYSIS with + keeptrials=no or from FT_FREQDESCRIPTIVES. The configuration structure + can contain + cfg.keepindividual = 'yes' or 'no' (default = 'no') + cfg.foilim = [fmin fmax] or 'all', to specify a subset of frequencies (default = 'all') + cfg.toilim = [tmin tmax] or 'all', to specify a subset of latencies (default = 'all') + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), + see FT_CHANNELSELECTION for details + cfg.parameter = string or cell-array of strings indicating which + parameter(s) to average. default is set to + 'powspctrm', if it is present in the data. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. For this particular function, the input should be + specified as a cell-array. + + See also FT_TIMELOCKGRANDAVERAGE, FT_FREQANALYSIS, FT_FREQDESCRIPTIVES, + FT_FREQBASELINE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_freqgrandaverage.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_freqgrandaverage", *args, **kwargs) diff --git a/fieldtrip/ft_freqinterpolate.py b/fieldtrip/ft_freqinterpolate.py new file mode 100644 index 0000000..1e0d96e --- /dev/null +++ b/fieldtrip/ft_freqinterpolate.py @@ -0,0 +1,54 @@ +from fieldtrip._runtime import Runtime + + +def ft_freqinterpolate(*args, **kwargs): + """ + FT_FREQINTERPOLATE interpolates frequencies by looking at neighbouring + values or simply replaces a piece in the spectrum by NaN. + + Use as + freq = ft_freqinterpolate(cfg, freq) + where freq is the output of FT_FREQANALYSIS or FT_FREQDESCRIPTIVES and the + configuration may contain + cfg.method = 'nan', 'linear' (default = 'nan') + cfg.foilim = Nx2 matrix with begin and end of each interval to be + interpolated (default = [49 51; 99 101; 149 151]) + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_FREQANALYSIS, FT_FREQDESCRIPTIVES, FT_FREQSIMULATION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_freqinterpolate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_freqinterpolate", *args, **kwargs) diff --git a/fieldtrip/ft_freqsimulation.py b/fieldtrip/ft_freqsimulation.py new file mode 100644 index 0000000..7626dae --- /dev/null +++ b/fieldtrip/ft_freqsimulation.py @@ -0,0 +1,168 @@ +from fieldtrip._runtime import Runtime + + +def ft_freqsimulation(*args, **kwargs): + """ + FT_FREQSIMULATION simulates channel-level time-series data . The data is built up + from different frequencies and can contain a signal in which the different + frequencies interact (i.e. cross-frequency coherent). Different methods are + possible to make data with specific properties. + + Use as + [data] = ft_freqsimulation(cfg) + which will return a raw data structure that resembles the output of + FT_PREPROCESSING. + + The configuration options can include + cfg.method = The methods are explained in more detail below, but they can be + 'superimposed' simply add the contribution of the different frequencies + 'broadband' create a single broadband signal component + 'phalow_amphigh' phase of low freq correlated with amplitude of high freq + 'amplow_amphigh' amplitude of low freq correlated with amplithude of high freq + 'phalow_freqhigh' phase of low freq correlated with frequency of high signal + 'asymmetric' single signal component with asymmetric positive/negative deflections + cfg.output = which channels should be in the output data, can be 'mixed' or 'all' (default = 'all') + cfg.randomseed = 'yes' or a number or vector with the seed value (default = 'yes') + + The number of trials and the time axes of the trials can be specified by + cfg.fsample = simulated sample frequency (default = 1200) + cfg.trllen = length of simulated trials in seconds (default = 1) + cfg.numtrl = number of simulated trials (default = 1) + cfg.baseline = number (default = 0) + or by + cfg.time = cell-array with one time axis per trial, which are for example obtained from an existing dataset + + For each of the methods default parameters are configured to generate + example data, including noise. To get full control over the generated + data you should explicitly set all parameters involved in the method + of your choise. The interpretation of the following signal components + depends on the specified method: + + cfg.s1.freq = frequency of signal 1 + cfg.s1.phase = phase (in rad) relative to cosine of signal 1 (default depends on method) + = number or 'random' + cfg.s1.ampl = amplitude of signal 1 + cfg.s2.freq = frequency of signal 2 + cfg.s2.phase = phase (in rad) relative to cosine of signal 1 (default depends on method) + = number or 'random' + cfg.s2.ampl = amplitude of signal 2 + cfg.s3.freq = frequency of signal 3 + cfg.s3.phase = phase (in rad) relative to cosine of signal 1 (default depends on method) + = number or 'random' + cfg.s3.ampl = amplitude of signal 3 + cfg.s4.freq = frequency of signal 4 + cfg.s4.phase = phase (in rad) relative to cosine of signal 1 (default depends on method) + = number or 'random' + cfg.s4.ampl = amplitude of signal 4 + + cfg.n1.ampl = root-mean-square amplitude of wide-band signal prior to filtering + cfg.n1.bpfreq = [Flow Fhigh] + cfg.n2.ampl = root-mean-square amplitude of wide-band signal prior to filtering + cfg.n2.bpfreq = [Flow Fhigh] + + cfg.asymmetry = amount of asymmetry (default = 0, which is none) + cfg.noise.ampl = amplitude of noise + + + In the method 'superimposed' the signal contains just the sum of the different frequency contributions: + s1: first frequency + s2: second frequency + s3: third frequency + and the output consists of the following channels: + 1st channel: mixed signal = s1 + s2 + s3 + noise + 2nd channel: s1 + 3rd channel: s2 + 4th channel: s3 + 5th channel: noise + + In the method 'broadband' the signal contains a the superposition of two + broadband signal components, which are created by bandpass filtering a + Gaussian noise signal: + n1: first broadband signal + n2: second broadband signal + and the output consists of the following channels: + 1st channel: mixed signal = n1 + n2 + noise + 2nd channel: n1 + 3rd channel: n2 + 4th channel: noise + + In the method 'phalow_amphigh' the signal is build up of 4 components; s1, s2, s3 and noise: + s1: amplitude modulation (AM), frequency of this signal should be lower than s2 + s2: second frequency, frequncy that becomes amplitude modulated + s3: DC shift of s1, should have frequency of 0 + and the output consists of the following channels: + 1st channel: mixed signal = (s1 + s3)*s2 + noise, + 2nd channel: s1 + 3rd channel: s2 + 4th channel: s3 + 5th channel: noise + + In the method 'amplow_amphigh' the signal is build up of 5 components; s1, s2, s3, s4 and noise. + s1: first frequency + s2: second frequency + s3: DC shift of s1 and s2, should have frequency of 0 + s4: amplitude modulation (AM), frequency of this signal should be lower than s1 and s2 + and the output consists of the following channels: + 1st channel: mixed signal = (s4 + s3)*s1 + (s4 + s3)*s2 + noise, + 2nd channel: s1 + 3rd channel: s2 + 4th channel: s3 + 5th channel: noise + 6th channel: s4 + 7th channel: mixed part 1: (s4 + s3)*s1 + 8th channel: mixed part 2: (s4 + s3)*s2 + + In the method 'phalow_freqhigh' a frequency modulated signal is created. + signal is build up of 3 components; s1, s2 and noise. + s1: represents the base signal that will be modulated + s2: signal that will be used for the frequency modulation + and the output consists of the following channels: + 1st channel: mixed signal = s1.ampl * cos(ins_pha) + noise + 2nd channel: s1 + 3rd channel: s2 + 4th channel: noise + 5th channel: inst_pha_base instantaneous phase of the high (=base) frequency signal s1 + 6th channel: inst_pha_mod low frequency phase modulation, this is equal to s2 + 7th channel: inst_pha instantaneous phase, i.e. inst_pha_base + inst_pha_mod + + In the method 'asymmetric' there is only one periodic signal, but that + signal is more peaked for the positive than for the negative deflections. + The average of the signal over time is zero. + s1: represents the frequency of the base signal + and the output consists of the following channels: + 1st channel: mixed signal = asymmetric signal + noise + 2nd channel: sine wave with base frequency and phase, i.e. s1 + 3rd channel: asymmetric signal + 4th channel: noise + + See also FT_FREQANALYSIS, FT_TIMELOCKSIMULATION, FT_DIPOLESIMULATION, + FT_CONNECTIVITYSIMULATION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_freqsimulation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_freqsimulation", *args, **kwargs) diff --git a/fieldtrip/ft_freqstatistics.py b/fieldtrip/ft_freqstatistics.py new file mode 100644 index 0000000..916a640 --- /dev/null +++ b/fieldtrip/ft_freqstatistics.py @@ -0,0 +1,82 @@ +from fieldtrip._runtime import Runtime + + +def ft_freqstatistics(*args, **kwargs): + """ + FT_FREQSTATISTICS computes significance probabilities and/or critical + values of a parametric statistical test or a non-parametric permutation + test. + + Use as + [stat] = ft_freqstatistics(cfg, freq1, freq2, ...) + where the input data is the result from FT_FREQANALYSIS, FT_FREQDESCRIPTIVES + or from FT_FREQGRANDAVERAGE. + + The configuration can contain the following options for data selection + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), + see FT_CHANNELSELECTION for details + cfg.latency = [begin end] in seconds or 'all' (default = 'all') + cfg.frequency = [begin end], can be 'all' (default = 'all') + cfg.avgoverchan = 'yes' or 'no' (default = 'no') + cfg.avgovertime = 'yes' or 'no' (default = 'no') + cfg.avgoverfreq = 'yes' or 'no' (default = 'no') + cfg.parameter = string (default = 'powspctrm') + + If you specify cfg.correctm='cluster', then the following is required + cfg.neighbours = neighbourhood structure, see FT_PREPARE_NEIGHBOURS + + Furthermore, the configuration should contain + cfg.method = different methods for calculating the significance probability and/or critical value + 'montecarlo' get Monte-Carlo estimates of the significance probabilities and/or critical values from the permutation distribution, + 'analytic' get significance probabilities and/or critical values from the analytic reference distribution + (typically, the sampling distribution under the null hypothesis), + 'stats' use a parametric test from the MATLAB statistics toolbox, + 'crossvalidate' use crossvalidation to compute predictive performance + 'mvpa' use functionality from the MVPA-light toolbox for classification or multivariate regression + + cfg.design = Nxnumobservations: design matrix (for examples/advice, please see the Fieldtrip wiki, + especially cluster-permutation tutorial and the 'walkthrough' design-matrix section) + + The other cfg options depend on the method that you select. You + should read the help of the respective subfunction FT_STATISTICS_XXX + for the corresponding configuration options and for a detailed + explanation of each method. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_FREQANALYSIS, FT_FREQDESCRIPTIVES, FT_FREQGRANDAVERAGE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_freqstatistics.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_freqstatistics", *args, **kwargs) diff --git a/fieldtrip/ft_geometryplot.py b/fieldtrip/ft_geometryplot.py new file mode 100644 index 0000000..7f78b47 --- /dev/null +++ b/fieldtrip/ft_geometryplot.py @@ -0,0 +1,85 @@ +from fieldtrip._runtime import Runtime + + +def ft_geometryplot(*args, **kwargs): + """ + FT_GEOMETRYPLOT plots objects in 3D, such as sensors, headmodels, sourcemodels, + headshapes, meshes, etcetera. It provides an easy-to-use wrapper for the + corresponding FT_PLOT_XXX functions. + + Use as + ft_geometryplot(cfg) + where the cfg structure contains the geometrical objects that have to be plotted + cfg.elec = structure, see FT_READ_SENS + cfg.grad = structure, see FT_READ_SENS + cfg.opto = structure, see FT_READ_SENS + cfg.headshape = structure, see FT_READ_HEADSHAPE + cfg.headmodel = structure, see FT_PREPARE_HEADMODEL and FT_READ_HEADMODEL + cfg.sourcemodel = structure, see FT_PREPARE_SOURCEMODEL + cfg.dipole = structure, see FT_DIPOLEFITTING + cfg.mri = structure, see FT_READ_MRI + cfg.mesh = structure, see FT_PREPARE_MESH + cfg.axes = string, 'yes' or 'no' (default = 'no') + + Furthermore, there are a number of general options + cfg.unit = string, 'mm', 'cm', 'm' with the geometrical units (default depends on the data) + cfg.coordsys = string, with the coordinate system (default depends on the data) + cfg.figure = 'yes' or 'no', whether to open a new figure. You can also specify a figure handle from FIGURE, GCF or SUBPLOT. (default = 'yes') + cfg.figurename = string, title of the figure window + cfg.position = location and size of the figure, specified as [left bottom width height] (default is automatic) + cfg.renderer = string, 'opengl', 'zbuffer', 'painters', see RENDERERINFO. The OpenGL renderer is required when using opacity (default = 'opengl') + cfg.title = string, title of the plot + + You can specify the style with which the objects are displayed using + cfg.elecstyle = cell-array or structure, see below + cfg.gradstyle = cell-array or structure, see below + cfg.optostyle = cell-array or structure, see below + cfg.headshapestyle = cell-array or structure, see below + cfg.headmodelstyle = cell-array or structure, see below + cfg.sourcemodelstyle = cell-array or structure, see below + cfg.dipolestyle = cell-array or structure, see below + cfg.mristyle = cell-array or structure, see below + cfg.meshstyle = cell-array or structure, see below + + For each of the xxxstyle options, you can specify a cell-array with key value pairs + similar as in FT_INTERACTIVEREALIGN. These options will be passed on to the + corresponding FT_PLOT_XXX function. You can also specify the options as a + structure. For example, the following two specifications are equivalent + cfg.headshapestyle = {'facecolor', 'skin', 'edgecolor', 'none'}; + and + cfg.headshapestyle.facecolor = 'skin'; + cfg.headshapestyle.edgecolor = 'none'; + + In the figure with graphical user interface you will be able to adjust most of the + settings that determine how the objects are displayed. + + See also PLOTTING, FT_SOURCEPLOT, FT_INTERACTIVEREALIGN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_geometryplot.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_geometryplot", *args, **kwargs) diff --git a/fieldtrip/ft_globalmeanfield.py b/fieldtrip/ft_globalmeanfield.py new file mode 100644 index 0000000..da58407 --- /dev/null +++ b/fieldtrip/ft_globalmeanfield.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def ft_globalmeanfield(*args, **kwargs): + """ + FT_GLOBALMEANFIELD calculates global mean field amplitude or power of input data + + Use as + [gmf] = ft_globalmeanfield(cfg, data) + + The data should be organised in a structure as obtained from the + FT_TIMELOCKANALYSIS function. The configuration should be according to + FT_PREPROCESSING function. The configuration should be according to + + cfg.method = string, determines whether the amplitude or power should be calculated (see below, default is 'amplitude', can be 'power') + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), + see FT_CHANNELSELECTION for details + + This function calculates the global mean field power, or amplitude, + as described in: + Lehmann D, Skrandies W. Reference-free identification of components of + checkerboard-evoked multichannel potential fields. Electroencephalogr Clin + Neurophysiol. 1980 Jun;48(6):609-21. PubMed PMID: 6155251. + + Please note that to calculate what is clasically referred to as Global + Mean Field Power, cfg.method must be 'amplitude'. The naming implies a + squared measure but this is not the case. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_TIMELOCKANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_globalmeanfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_globalmeanfield", *args, **kwargs) diff --git a/fieldtrip/ft_headcircumference.py b/fieldtrip/ft_headcircumference.py new file mode 100644 index 0000000..5b9f5cf --- /dev/null +++ b/fieldtrip/ft_headcircumference.py @@ -0,0 +1,50 @@ +from fieldtrip._runtime import Runtime + + +def ft_headcircumference(*args, **kwargs): + """ + FT_HEADCIRCUMFERENCE determines the head circumference from a triangulated mesh of + the scalp in the same way as it would be measured using a measuring tape for + fitting an EEG cap. + + Use as + circumference = ft_headcircumference(cfg, mesh) + where the input mesh corresponds to the output of FT_PREPARE_MESH. + + The configuration should contain + cfg.fiducial.nas = 1x3 vector with coordinates + cfg.fiducial.ini = 1x3 vector with coordinates + cfg.fiducial.lpa = 1x3 vector with coordinates + cfg.fiducial.rpa = 1x3 vector with coordinates + cfg.feedback = string, can be 'yes' or 'no' for detailed feedback (default = 'yes') + + See also FT_ELECTRODEPLACEMENT, FT_PREPARE_MESH, FT_VOLUMESEGMENT, FT_READ_HEADSHAPE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_headcircumference.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headcircumference", *args, **kwargs) diff --git a/fieldtrip/ft_headmovement.py b/fieldtrip/ft_headmovement.py new file mode 100644 index 0000000..78e342f --- /dev/null +++ b/fieldtrip/ft_headmovement.py @@ -0,0 +1,91 @@ +from fieldtrip._runtime import Runtime + + +def ft_headmovement(*args, **kwargs): + """ + FT_HEADMOVEMENT outputs a raw data structure, or cell-array of data structures + reflecting the variability in the subject's head poisition relative to the + MEG sensors, based on continuous head position information. Current support is + only for CTF-data. The output timeseries contain the raw HLC data, and a + parametrization of the head movement in terms of translation and + rotations in 3D space. The grad structure(s) have head position information + incorporated in the coils' position/orientation and/or in the tra + matrix, depending on the method used. + + Use as + data = ft_headmovement(cfg) + + where the configuration should contain + cfg.dataset = string with the filename + cfg.method = string, 'updatesens' (default), 'cluster', 'avgoverrpt', + 'pertrial_cluster', 'pertrial' (default = 'updatesens') + + optional arguments are + cfg.trl = empty (default), or Nx3 matrix with the trial + definition (see FT_DEFINETRIAL). When specified as empty, + the whole recording is used. + cfg.numclusters = number of segments with constant headposition in + which to split the data (default = 10). This argument + is only used for the methods that use clustering ('updatesens', + 'cluster', 'pertrial_cluster'). + + If cfg.method = 'updatesens', the grad in the single output structure has + a specification of the coils expanded as per the centroids of the position + clusters (obtained by kmeans clustering of the HLC time series). The balancing matrix + is a weighted concatenation of the original tra-matrix. This method requires + cfg.numclusters to be specified + + If cfg.method = 'avgoverrpt', the grad in the single output structure has + a specification of the coils according to the average head position + across the specified samples. + + If cfg.method = 'cluster', the cell-array of output structures represent + the epochs in which the head was considered to be positioned close to the + corresponding kmeans-cluster's centroid. The corresponding grad-structure + is specified according to this cluster's centroid. This method requires + cfg.numclusters to be specified. + + If cfg.method = 'pertrial', the cell-array of output structures contains + single trials, each trial with a trial-specific grad structure. Note that + this is extremely memory inefficient with large numbers of trials, and + probably an overkill. + + If cfg.method = 'pertrial_clusters', the cell-array of output structures + contains sets of trials where the trial-specific head position was + considered to be positioned close to the corresponding kmeans-cluster's + centroid. The corresponding grad-structure is specified accordin to the + cluster's centroid. This method requires cfg.numclusters to be specified. + + The updatesens method and related methods are described by Stolk et al., Online and + offline tools for head movement compensation in MEG. NeuroImage, 2012. + + See also FT_REGRESSCONFOUND, FT_REALTIME_HEADLOCALIZER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_headmovement.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_headmovement", *args, **kwargs) diff --git a/fieldtrip/ft_heartrate.py b/fieldtrip/ft_heartrate.py new file mode 100644 index 0000000..3f2e44e --- /dev/null +++ b/fieldtrip/ft_heartrate.py @@ -0,0 +1,82 @@ +from fieldtrip._runtime import Runtime + + +def ft_heartrate(*args, **kwargs): + """ + FT_HEARTRATE estimates the heart rate from a continuous PPG or ECG channel. It + returns a new data structure with a continuous representation of the heartrate in + beats per minute, the heart period (i.e., the RR interval) in seconds per interval, + the heartbeat phase and the moment of the heartbeat onsets. + + Use as + dataout = ft_heartrate(cfg, data) + where the input data is a structure as obtained from FT_PREPROCESSING and the + output is a similar structure with the same trials and time-charactersitics, but + with new channels describing the heart rate parameters. + + The configuration structure has the following general options + cfg.channel = selected channel for processing, see FT_CHANNELSELECTION + cfg.feedback = 'yes' or 'no' + cfg.method = string representing the method for heart beat detection + 'findpeaks' filtering and normalization, followed by FINDPEAKS (default) + 'pantompkin' implementation of the Pan-Tompkin algorithm for ECG beat detection + + For the 'findpeaks' method the following additional options can be specified + cfg.envelopewindow = scalar, time in seconds (default = 10) + cfg.peakseparation = scalar, time in seconds + cfg.threshold = scalar, usually between 0 and 1 (default = 0.4), 'MinPeakHeight' parameter for findpeaks function + cfg.mindistance = scalar, time in seconds for the minimal distance between consecutive peaks (default = 0), + 'MinPeakDistance' for findpeaks functions (after conversion from seconds into samples) + cfg.flipsignal = 'yes' or 'no', whether to flip the polarity of the signal (default is automatic) + and the data can be preprocessed on the fly using + cfg.preproc.bpfilter = 'yes' or 'no' + cfg.preproc.bpfreq = [low high], filter frequency in Hz + This implementation performs some filtering and amplitude normalization, followed + by the FINDPEAKS function. It works both for ECG as for PPG signals. + + For the 'pantompkin` method there are no additional options. This implements + - J Pan, W J Tompkins, "A Real-Time QRS Detection Algorithm", IEEE Trans Biomed Eng, 1985. https://doi.org/10.1109/tbme.1985.325532 + - H Sedghamiz, "Matlab Implementation of Pan Tompkins ECG QRS detector". https://doi.org/10.13140/RG.2.2.14202.59841 + + You can correct ectopic beats using the following options + cfg.ectopicbeatcorrect = 'yes' or 'no', replace a single ectopic beat (default = 'no') + cfg.ectopicbeatthreshold = fractional number as percentage (default = 0.2 + + An ectopic beat is a premature ventricual contraction, causing a very short-lived + increase in the variability in the rate. This can be corrected by replacing it with + a beat that falls exactly in between its neighbouring beats. A beat is detected as + ectopic if the RR-interval of a beat is 20% (default) smaller than the previous + beat-to-beat interval and is followed by an interval that is 20% (default) larger + (i.e. refractory period). The default threshold of 0.2 can be modified with + cfg.ectopicbeatthreshold. + + See also FT_ELECTRODERMALACTIVITY, FT_HEADMOVEMENT, FT_REGRESSCONFOUND + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_heartrate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_heartrate", *args, **kwargs) diff --git a/fieldtrip/ft_interactiverealign.py b/fieldtrip/ft_interactiverealign.py new file mode 100644 index 0000000..e8ce3f7 --- /dev/null +++ b/fieldtrip/ft_interactiverealign.py @@ -0,0 +1,73 @@ +from fieldtrip._runtime import Runtime + + +def ft_interactiverealign(*args, **kwargs): + """ + FT_INTERACTIVEREALIGN allows the user to interactively translate, rotate and scale an + individual geometrical object to a template geometrical object. It can for example be used + to align EEG electrodes to a model of the scalp surface. + + Use as + [cfg] = ft_interactiverealign(cfg) + + The configuration structure should contain the individuals geometrical object that + has to be realigned + cfg.individual.elec = structure, see FT_READ_SENS + cfg.individual.grad = structure, see FT_READ_SENS + cfg.individual.opto = structure, see FT_READ_SENS + cfg.individual.headmodel = structure, see FT_PREPARE_HEADMODEL + cfg.individual.headshape = structure, see FT_READ_HEADSHAPE + cfg.individual.mesh = structure, see FT_PREPARE_MESH + cfg.individual.mri = structure, see FT_READ_MRI + You can specify the style with which the objects are displayed using + cfg.individual.headmodelstyle = 'vertex', 'edge', 'surface' or 'both' (default = 'edge') + cfg.individual.headshapestyle = 'vertex', 'edge', 'surface' or 'both' (default = 'vertex') + + The configuration structure should also contain the geometrical object of a + template that serves as target + cfg.template.axes = string, 'yes' or 'no' (default = 'no') + cfg.template.elec = structure, see FT_READ_SENS + cfg.template.grad = structure, see FT_READ_SENS + cfg.template.opto = structure, see FT_READ_SENS + cfg.template.headmodel = structure, see FT_PREPARE_HEADMODEL + cfg.template.headshape = structure, see FT_READ_HEADSHAPE + cfg.template.mesh = structure, see FT_PREPARE_MESH + cfg.template.mri = structure, see FT_READ_MRI + You can specify the style with which the objects are displayed using + cfg.template.headmodelstyle = 'vertex', 'edge', 'surface' or 'both' (default = 'edge') + cfg.template.headshapestyle = 'vertex', 'edge', 'surface' or 'both' (default = 'vertex') + + You can specify one or multiple individual objects which will all be realigned and + one or multiple template objects. + + See also FT_VOLUMEREALIGN, FT_ELECTRODEREALIGN, FT_DETERMINE_COORDSYS, + FT_READ_SENS, FT_READ_HEADMODEL, FT_READ_HEADSHAPE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_interactiverealign.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_interactiverealign", *args, **kwargs) diff --git a/fieldtrip/ft_interpolatenan.py b/fieldtrip/ft_interpolatenan.py new file mode 100644 index 0000000..e045f14 --- /dev/null +++ b/fieldtrip/ft_interpolatenan.py @@ -0,0 +1,61 @@ +from fieldtrip._runtime import Runtime + + +def ft_interpolatenan(*args, **kwargs): + """ + FT_INTERPOLATENAN interpolates time series that contains segments of nans obtained + by replacing artifactual data with nans using, for example, FT_REJECTARTIFACT, or + by redefining trials with FT_REDEFINETRIAL resulting in trials with gaps. + + Use as + outdata = ft_interpolatenan(cfg, indata) + where cfg is a configuration structure and the input data is obtained from FT_PREPROCESSING. + + The configuration should contain + cfg.method = string, interpolation method, see INTERP1 (default = 'linear') + cfg.prewindow = value, length of data prior to interpolation window, in seconds (default = 1) + cfg.postwindow = value, length of data after interpolation window, in seconds (default = 1) + cfg.feedback = string, 'no', 'text', 'textbar', 'gui' (default = 'text') + + This function only interpolates over time, not over space. If you want to + interpolate using spatial information, e.g. using neighbouring channels, you should + use FT_CHANNELREPAIR. + + To facilitate data-handling and distributed computing, you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_REJECTARTIFACT, FT_REDEFINETRIAL, FT_CHANNELREPAIR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_interpolatenan.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_interpolatenan", *args, **kwargs) diff --git a/fieldtrip/ft_lateralizedpotential.py b/fieldtrip/ft_lateralizedpotential.py new file mode 100644 index 0000000..60b25e2 --- /dev/null +++ b/fieldtrip/ft_lateralizedpotential.py @@ -0,0 +1,81 @@ +from fieldtrip._runtime import Runtime + + +def ft_lateralizedpotential(*args, **kwargs): + """ + FT_LATERALIZEDPOTENTIAL computes lateralized potentials such as the + lateralized readiness potential (LRP) + + Use as + [lrp] = ft_lateralizedpotential(cfg, avgL, avgR) + + where the input datasets should come from FT_TIMELOCKANALYSIS + and the configuration should contain + cfg.channelcmb = Nx2 cell-array + + An example channelcombination containing the homologous channels + in the 10-20 standard system is + cfg.channelcmb = {'Fp1' 'Fp2' + 'F7' 'F8' + 'F3' 'F4' + 'T7' 'T8' + 'C3' 'C4' + 'P7' 'P8' + 'P3' 'P4' + 'O1' 'O2'} + + The lateralized potential is computed on combinations of channels and + not on indivudual channels. However, if you want to make a topographic + plot with e.g. FT_MULTIPLOTER, you can replace the output lrp.label + with lrp.plotlabel. + + The concept for the LRP was introduced approximately simultaneously in the + following two papers + - M. G. H. Coles. Modern mind-brain reading - psychophysiology, + physiology, and cognition. Psychophysiology, 26(3):251-269, 1988. + - R. de Jong, M. Wierda, G. Mulder, and L. J. Mulder. Use of + partial stimulus information in response processing. J Exp Psychol + Hum Percept Perform, 14:682-692, 1988. + and it is discussed in detail on a technical level in + - R. Oostenveld, D.F. Stegeman, P. Praamstra and A. van Oosterom. + Brain symmetry and topographic analysis of lateralized event-related + potentials. Clin Neurophysiol. 114(7):1194-202, 2003. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_TIMELOCKANALYSIS, FT_MULTIPLOTER + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_lateralizedpotential.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_lateralizedpotential", *args, **kwargs) diff --git a/fieldtrip/ft_layoutplot.py b/fieldtrip/ft_layoutplot.py new file mode 100644 index 0000000..eafdcd2 --- /dev/null +++ b/fieldtrip/ft_layoutplot.py @@ -0,0 +1,87 @@ +from fieldtrip._runtime import Runtime + + +def ft_layoutplot(*args, **kwargs): + """ + FT_LAYOUTPLOT makes a figure with the 2-D layout of the channel positions + for topoplotting and the individual channel axes (i.e. width and height + of the subfigures) for multiplotting. A correct 2-D layout is a + prerequisite for plotting the topographical distribution of the + potential or field distribution, or for plotting timecourses in a + topographical arrangement. + + This function uses the same configuration options as prepare_layout and + as the topoplotting and multiplotting functions. The difference is that + this function plots the layout without any data, which facilitates + the validation of your 2-D layout. + + Use as + ft_layoutplot(cfg, data) + + There are several ways in which a 2-D layout can be made: it can be read + directly from a *.lay file, it can be created based on 3-D electrode or + gradiometer positions in the configuration or in the data, or it can be + created based on the specification of an electrode of gradiometer file. + + You can specify either one of the following configuration options + cfg.layout = filename containg the layout + cfg.rotate = number, rotation around the z-axis in degrees (default = [], which means automatic) + cfg.projection = string, 2D projection method can be 'stereographic', 'ortographic', 'polar', 'gnomic' or 'inverse' (default = 'orthographic') + cfg.elec = structure with electrode positions or filename, see FT_READ_SENS + cfg.grad = structure with gradiometer definition or filename, see FT_READ_SENS + cfg.opto = structure with optode definition or filename, see FT_READ_SENS + cfg.output = filename to which the layout will be written (default = []) + cfg.montage = 'no' or a montage structure (default = 'no') + cfg.image = filename, use an image to construct a layout (e.g. usefull for ECoG grids) + cfg.box = string, 'yes' or 'no' whether box should be plotted around electrode (default = 'yes') + cfg.mask = string, 'yes' or 'no' whether the mask should be plotted (default = 'yes') + cfg.visible = string, 'on' or 'off' whether figure will be visible (default = 'on') + cfg.figure = 'yes' or 'no', whether to open a new figure. You can also specify a figure handle from FIGURE, GCF or SUBPLOT. (default = 'yes') + cfg.position = location and size of the figure, specified as [left bottom width height] (default is automatic) + cfg.renderer = string, 'opengl', 'zbuffer', 'painters', see RENDERERINFO (default is automatic, try 'painters' when it crashes) + + Alternatively the layout can be constructed from either + data.elec structure with electrode positions + data.grad structure with gradiometer definition + + Alternatively, you can specify + cfg.layout = 'ordered' + which will give you a 2-D ordered layout. Note that this is only suited + for multiplotting and not for topoplotting. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + If you specify this option the input data will be read from a *.mat + file on disk. This mat files should contain only a single variable named 'data', + corresponding to the input structure. + + See also FT_PREPARE_LAYOUT, FT_TOPOPLOTER, FT_TOPOPLOTTFR, FT_MULTIPLOTER, FT_MULTIPLOTTFR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_layoutplot.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_layoutplot", *args, **kwargs) diff --git a/fieldtrip/ft_math.py b/fieldtrip/ft_math.py new file mode 100644 index 0000000..939c3ef --- /dev/null +++ b/fieldtrip/ft_math.py @@ -0,0 +1,91 @@ +from fieldtrip._runtime import Runtime + + +def ft_math(*args, **kwargs): + """ + FT_MATH performs mathematical operations on FieldTrip data structures, + such as addition, subtraction, division, etc. + + Use as + data = ft_math(cfg, data1, data2, ...) + with one or multiple FieldTrip data structures as the input and the configuration + structure cfg in which you specify the mathematical operation that is to be + executed on the desired parameter from the data + cfg.parameter = string, field from the input data on which the operation is + performed, e.g. 'pow' or 'avg' + cfg.operation = string, for example '(x1-x2)/(x1+x2)' or 'x1/6' + + In the specification of the mathematical operation, x1 is the parameter obtained + from the first input data structure, x2 from the second, etc. + + Rather than specifying the operation as a string that is evaluated, you can also + specify it as a single operation. The advantage is that it is computed faster. + cfg.operation = string, can be 'add', 'subtract', 'divide', 'multiply', 'log10', 'abs' + 'sqrt', 'square' + If you specify only a single input data structure and the operation is 'add', + 'subtract', 'divide' or 'multiply', the configuration should also contain: + cfg.scalar = scalar value to be used in the operation + cfg.matrix = matrix with identical size as the data, it will be element-wise be applied + + The operation 'add' is implemented as follows + y = x1 + x2 + .... + if you specify multiple input arguments, or as + y = x1 + s + if you specify one input argument and a scalar value. + + The operation 'subtract' is implemented as follows + y = x1 - x2 - .... + if you specify multiple input arguments, or as + y = x1 - s + if you specify one input argument and a scalar value. + + The operation 'divide' is implemented as follows + y = x1 ./ x2 + if you specify two input arguments, or as + y = x1 / s + if you specify one input argument and a scalar value. + + The operation 'multiply' is implemented as follows + y = x1 .* x2 + if you specify two input arguments, or as + y = x1 * s + if you specify one input argument and a scalar value. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_DATATYPE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_math.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_math", *args, **kwargs) diff --git a/fieldtrip/ft_megplanar.py b/fieldtrip/ft_megplanar.py new file mode 100644 index 0000000..819cf4e --- /dev/null +++ b/fieldtrip/ft_megplanar.py @@ -0,0 +1,93 @@ +from fieldtrip._runtime import Runtime + + +def ft_megplanar(*args, **kwargs): + """ + FT_MEGPLANAR computes planar MEG gradients gradients for raw data or average + event-related field data. It can also convert frequency-domain data that was computed + using FT_FREQANALYSIS, as long as it contains the complex-valued fourierspcrm and not + only the powspctrm. + + Use as + [interp] = ft_megplanar(cfg, data) + where the input data corresponds to the output from FT_PREPROCESSING, + FT_TIMELOCKANALYSIS or FT_FREQANALYSIS (with output='fourier'). + + The configuration should contain + cfg.planarmethod = string, can be 'sincos', 'orig', 'fitplane', 'sourceproject' (default = 'sincos') + cfg.channel = Nx1 cell-array with selection of channels (default = {'megmag', 'meggrad'}), see FT_CHANNELSELECTION for details + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + + The methods orig, sincos and fitplane are all based on a neighbourhood interpolation. + For these methods you need to specify + cfg.neighbours = neighbourhood structure, see FT_PREPARE_NEIGHBOURS + + In the 'sourceproject' method a minumum current estimate is done using a large number + of dipoles that are placed in the upper layer of the brain surface, followed by a + forward computation towards a planar gradiometer array. This requires the + specification of a volume conduction model of the head and of a source model. The + 'sourceproject' method is not supported for frequency domain data. + + A dipole layer representing the brain surface must be specified with + cfg.inwardshift = depth of the source layer relative to the head model surface , + (default = 2.5 cm, which is appropriate for a skin-based head model) + cfg.spheremesh = number of dipoles in the source layer (default = 642) + cfg.tolerance = tolerance ratio for leadfield matrix inverse based on a truncated svd, + reflects the relative magnitude of the largest singular value + to retain (default = 1e-3) + cfg.headshape = a filename containing headshape, a structure containing a + single triangulated boundary, or a Nx3 matrix with surface + points + If no headshape is specified, the dipole layer will be based on the inner compartment + of the volume conduction model. + + Optionally, you can modify the leadfields by reducing the rank, i.e. remove the weakest orientation + cfg.reducerank = 'no', or number (default = 3 for EEG, 2 for MEG) + cfg.backproject = 'yes' or 'no', determines when reducerank is applied whether the + lower rank leadfield is projected back onto the original linear + subspace, or not (default = 'yes') + + The volume conduction model of the head should be specified as + cfg.headmodel = structure with volume conduction model, see FT_PREPARE_HEADMODEL + + The following cfg fields are optional: + cfg.feedback + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_COMBINEPLANAR, FT_PREPARE_NEIGHBOURS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_megplanar.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_megplanar", *args, **kwargs) diff --git a/fieldtrip/ft_megrealign.py b/fieldtrip/ft_megrealign.py new file mode 100644 index 0000000..e1a4f48 --- /dev/null +++ b/fieldtrip/ft_megrealign.py @@ -0,0 +1,110 @@ +from fieldtrip._runtime import Runtime + + +def ft_megrealign(*args, **kwargs): + """ + FT_MEGREALIGN interpolates MEG data towards standard gradiometer locations by + projecting the individual timelocked data towards a coarse source reconstructed + representation and computing the magnetic field on the standard gradiometer + locations. + + Use as + [interp] = ft_megrealign(cfg, data) + where the input data corresponds to the output from FT_PREPROCESSING. + + Required configuration options are + cfg.template + cfg.inwardshift + + The new gradiometer definition is obtained from a template dataset, + or can be constructed by averaging the gradiometer positions over + multiple datasets. + cfg.template = single dataset that serves as template + cfg.template(1..N) = datasets that are averaged into the standard + + The realignment is done by computing a minumum norm estimate using a + large number of dipoles that are placed in the upper layer of the brain + surface, followed by a forward computation towards the template + gradiometer array. This requires the specification of a volume conduction + model of the head and of a source model. + + A volume conduction model of the head should be specified with + cfg.headmodel = structure, see FT_PREPARE_HEADMODEL + + A source model (i.e. a superficial layer with distributed sources) can be + constructed from a headshape file, or from inner surface of the volume conduction + model using FT_PREPARE_SOURCEMODEL using the following options + cfg.spheremesh = number of dipoles in the source layer (default = 642) + cfg.inwardshift = depth of the source layer relative to the headshape + surface or volume conduction model (no default + supplied, see below) + cfg.headshape = a filename containing headshape, a structure containing a + single triangulated boundary, or a Nx3 matrix with surface + points + + If you specify a headshape and it describes the skin surface, you should specify an + inward shift of 2.5 cm. + + For a single-sphere or a local-spheres volume conduction model based on the skin + surface, an inward shift of 2.5 cm is reasonable. + + For a single-sphere or a local-spheres volume conduction model based on the brain + surface, you should probably use an inward shift of about 1 cm. + + For a realistic single-shell volume conduction model based on the brain surface, you + should probably use an inward shift of about 1 cm. + + Other configuration options are + cfg.tolerance = tolerance ratio for leadfield matrix inverse based on a truncated svd, + reflects the relative magnitude of the largest singular value + to retain (default =s 1e-3) + cfg.verify = 'yes' or 'no', show the percentage difference (default = 'yes') + cfg.feedback = 'yes' or 'no' (default = 'no') + cfg.channel = Nx1 cell-array with selection of channels (default = 'MEG'), + see FT_CHANNELSELECTION for details + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + + This implements the method described by T.R. Knosche, Transformation + of whole-head MEG recordings between different sensor positions. + Biomed Tech (Berl). 2002 Mar;47(3):59-62. For more information and + related methods, see Stolk et al., Online and offline tools for head + movement compensation in MEG. NeuroImage, 2012. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_PREPARE_LOCALSPHERES, FT_PREPARE_SINGLESHELL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_megrealign.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_megrealign", *args, **kwargs) diff --git a/fieldtrip/ft_meshrealign.py b/fieldtrip/ft_meshrealign.py new file mode 100644 index 0000000..48bb071 --- /dev/null +++ b/fieldtrip/ft_meshrealign.py @@ -0,0 +1,87 @@ +from fieldtrip._runtime import Runtime + + +def ft_meshrealign(*args, **kwargs): + """ + FT_MESHREALIGN rotates, translates and optionally scales a surface description of + the head or of the cortex. The different methods are described in detail below. + + INTERACTIVE - This displays the mesh surface together with an anatomical MRI, with + a head model, with electrodes, with gradiometers, with optodes, or simply with the + axis of the coordinate system, and you manually (using the graphical user + interface) adjust the rotation, translation and scaling parameters. + + FIDUCIAL - The coordinate system is updated according to the definition of the + coordinates of anatomical landmarks or fiducials that are specified in the + configuration. If the fiducials or anatomical landmarks are not specified in the + configuration, you will have to click them in an interactive display of the mesh + surface. + + Use as + mesh = ft_meshrealign(cfg, mesh) + where the mesh input argument comes from FT_READ_HEADSHAPE or FT_PREPARE_MESH. + + The configuration can contain the following options + cfg.method = string, can be 'interactive' or fiducial' (default = 'interactive') + cfg.coordsys = string specifying the origin and the axes of the coordinate + system. Supported coordinate systems are 'ctf', '4d', 'bti', + 'eeglab', 'neuromag', 'itab', 'yokogawa', 'asa', 'acpc', + and 'paxinos'. See http://tinyurl.com/ojkuhqz + + When cfg.method = 'fiducial' and cfg.coordsys is based on external anatomical + landmarks, as is common for EEG and MEG, the following can be used to specify the + position of the fiducials or anatomical landmarks: + cfg.fiducial.nas = [x y z], position of nasion + cfg.fiducial.lpa = [x y z], position of LPA + cfg.fiducial.rpa = [x y z], position of RPA + The fiducials or anatomical landmarks should be expressed in the same coordinates + and units as the input mesh. If the fiducials are not specified in the + configuration, the mesh is displayed and you have to click on the fiducials or + anatomical landmarks. + + When cfg.method = 'fiducial' you can specify + cfg.mri = structure, see FT_READ_MRI + cfg.headmodel = structure, see FT_PREPARE_HEADMODEL + cfg.elec = structure, see FT_READ_SENS + cfg.grad = structure, see FT_READ_SENS + cfg.opto = structure, see FT_READ_SENS + If none of these is specified, the x-, y- and z-axes will be shown. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_READ_HEADSHAPE, FT_PREPARE_MESH, FT_ELECTRODEREALIGN, FT_VOLUMEREALIGN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_meshrealign.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_meshrealign", *args, **kwargs) diff --git a/fieldtrip/ft_movieplotER.py b/fieldtrip/ft_movieplotER.py new file mode 100644 index 0000000..24e8184 --- /dev/null +++ b/fieldtrip/ft_movieplotER.py @@ -0,0 +1,79 @@ +from fieldtrip._runtime import Runtime + + +def ft_movieplotER(*args, **kwargs): + """ + FT_MOVIEPLOTER makes a movie of the the event-related potentials, event-related + fields or oscillatory activity (power or coherence) versus frequency. + + Use as + ft_movieplotER(cfg, timelock) + where the input data is from FT_TIMELOCKANALYSIS and the configuration + can contain + cfg.parameter = string, parameter that is color coded (default = 'avg') + cfg.xlim = 'maxmin' or [xmin xmax] (default = 'maxmin') + cfg.zlim = plotting limits for color dimension, 'maxmin', + 'maxabs', 'zeromax', 'minzero', or [zmin zmax] (default = 'maxmin') + cfg.speed = number, initial speed for interactive mode (default = 1) + cfg.samperframe = number, samples per frame for non-interactive mode (default = 1) + cfg.framespersec = number, frames per second for non-interactive mode (default = 5)% cfg.framesfile = 'string' or empty, filename of saved frames.mat (default = []) + cfg.layout = specification of the layout, see below + cfg.interpolatenan = string 'yes', 'no' interpolate over channels containing NaNs (default = 'yes') + cfg.colormap = string, or Nx3 matrix, see FT_COLORMAP + cfg.baseline = 'yes','no' or [time1 time2] (default = 'no'), see FT_TIMELOCKBASELINE + cfg.baselinetype = 'absolute' or 'relative' (default = 'absolute') + cfg.colorbar = 'yes', 'no' (default = 'no') + cfg.colorbartext = string indicating the text next to colorbar + cfg.figure = 'yes' or 'no', whether to open a new figure. You can also specify a figure handle from FIGURE, GCF or SUBPLOT. (default = 'yes') + cfg.figurename = string, title of the figure window + cfg.position = location and size of the figure, specified as [left bottom width height] (default is automatic) + cfg.renderer = string, 'opengl', 'zbuffer', 'painters', see RENDERERINFO (default is automatic, try 'painters' when it crashes) + + The layout defines how the channels are arranged. You can specify the + layout in a variety of ways: + - you can provide a pre-computed layout structure (see prepare_layout) + - you can give the name of an ascii layout file with extension *.lay + - you can give the name of an electrode file + - you can give an electrode definition, i.e. "elec" structure + - you can give a gradiometer definition, i.e. "grad" structure + If you do not specify any of these and the data structure contains an + electrode or gradiometer structure, that will be used for creating a + layout. If you want to have more fine-grained control over the layout + of the subplots, you should create your own layout file. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + If you specify this option the input data will be read from a *.mat + file on disk. This mat files should contain only a single variable named 'data', + corresponding to the input structure. + + See also FT_MULTIPLOTER, FT_TOPOPLOTER, FT_SINGLEPLOTER, FT_MOVIEPLOTTFR, FT_SOURCEMOVIE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_movieplotER.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_movieplotER", *args, **kwargs) diff --git a/fieldtrip/ft_movieplotTFR.py b/fieldtrip/ft_movieplotTFR.py new file mode 100644 index 0000000..135e940 --- /dev/null +++ b/fieldtrip/ft_movieplotTFR.py @@ -0,0 +1,86 @@ +from fieldtrip._runtime import Runtime + + +def ft_movieplotTFR(*args, **kwargs): + """ + FT_MOVIEPLOTTFR makes a movie of the time-frequency representation of power or + coherence. + + Use as + ft_movieplotTFR(cfg, data) + where the input data comes from FT_FREQANALYSIS or FT_FREQDESCRIPTIVES and the + configuration is a structure that can contain + cfg.parameter = string, parameter that is color coded (default = 'avg') + cfg.xlim = selection boundaries over first dimension in data (e.g., time) + 'maxmin' or [xmin xmax] (default = 'maxmin') + cfg.ylim = selection boundaries over second dimension in data (e.g., freq) + 'maxmin' or [xmin xmax] (default = 'maxmin') + cfg.zlim = plotting limits for color dimension, 'maxmin', + 'maxabs', 'zeromax', 'minzero', or [zmin zmax] (default = 'maxmin') + cfg.speed = number, initial speed for interactive mode (default = 1) + cfg.samperframe = number, samples per frame for non-interactive mode (default = 1) + cfg.framespersec = number, frames per second for non-interactive mode (default = 5) + cfg.framesfile = 'string' or empty, filename of saved frames.mat (default = []) + cfg.moviefreq = number, movie frames are all time points at the fixed frequency moviefreq (default = []) + cfg.movietime = number, movie frames are all frequencies at the fixed time movietime (default = []) + cfg.layout = specification of the layout, see below + cfg.interpolatenan = string 'yes', 'no' interpolate over channels containing NaNs (default = 'yes') + cfg.colormap = string, or Nx3 matrix, see FT_COLORMAP + cfg.interactive = 'no' or 'yes', make it interactive + cfg.baseline = 'yes','no' or [time1 time2] (default = 'no'), see FT_TIMELOCKBASELINE or FT_FREQBASELINE + cfg.baselinetype = 'absolute', 'relative', 'relchange', 'normchange', 'db' or 'zscore' (default = 'absolute') + cfg.colorbar = 'yes', 'no' (default = 'no') + cfg.colorbartext = string indicating the text next to colorbar + cfg.figure = 'yes' or 'no', whether to open a new figure. You can also specify a figure handle from FIGURE, GCF or SUBPLOT. (default = 'yes') + cfg.figurename = string, title of the figure window + cfg.position = location and size of the figure, specified as [left bottom width height] (default is automatic) + cfg.renderer = string, 'opengl', 'zbuffer', 'painters', see RENDERERINFO (default is automatic, try 'painters' when it crashes) + + The layout defines how the channels are arranged. You can specify the + layout in a variety of ways: + - you can provide a pre-computed layout structure (see prepare_layout) + - you can give the name of an ascii layout file with extension *.mat + - you can give the name of an electrode file + - you can give an electrode definition, i.e. "elec" structure + - you can give a gradiometer definition, i.e. "grad" structure + If you do not specify any of these and the data structure contains an + electrode or gradiometer structure, that will be used for creating a + layout. If you want to have more fine-grained control over the layout + of the subplots, you should create your own layout file. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + If you specify this option the input data will be read from a *.mat + file on disk. this mat files should contain only a single variable named 'data', + corresponding to the input structure. + + See also FT_MULTIPLOTTFR, FT_TOPOPLOTTFR, FT_SINGLEPLOTTFR, FT_MOVIEPLOTER, FT_SOURCEMOVIE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_movieplotTFR.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_movieplotTFR", *args, **kwargs) diff --git a/fieldtrip/ft_multiplotCC.py b/fieldtrip/ft_multiplotCC.py new file mode 100644 index 0000000..2bcbaec --- /dev/null +++ b/fieldtrip/ft_multiplotCC.py @@ -0,0 +1,42 @@ +from fieldtrip._runtime import Runtime + + +def ft_multiplotCC(*args, **kwargs): + """ + FT_MULTIPLOTCC visualises the coherence between channels by using + multiple topoplots. The topoplot at a given channel location shows the + coherence of that channel with all other channels. + + Use as + ft_multiplotCC(cfg, data) + + See also FT_PREPARE_LAYOUT, FT_TOPOPLOTCC, FT_CONNECTIVITYPLOT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_multiplotCC.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_multiplotCC", *args, **kwargs) diff --git a/fieldtrip/ft_multiplotER.py b/fieldtrip/ft_multiplotER.py new file mode 100644 index 0000000..25cd68f --- /dev/null +++ b/fieldtrip/ft_multiplotER.py @@ -0,0 +1,149 @@ +from fieldtrip._runtime import Runtime + + +def ft_multiplotER(*args, **kwargs): + """ + FT_MULTIPLOTER plots the event-related potentials or event-related fields + versus time, or the oscillatory activity (power or coherence) versus frequency. + Multiple datasets can be overlayed. The plots are arranged according to + the location of the channels specified in the layout. + + Use as + ft_multiplotER(cfg, data) + or + ft_multiplotER(cfg, data, data2, ..., dataN) + + The data can be an event-related potential or field produced by + FT_TIMELOCKANALYSIS, a power spectrum produced by FT_FREQANALYSIS or a coherence + spectrum produced by FT_FREQDESCRIPTIVES. + + If you specify multiple datasets they should contain the same channels, etc. + + The configuration can have the following parameters: + cfg.parameter = field to be plotted on y-axis, for example 'avg', 'powspctrm' or 'cohspctrm' (default is automatic) + cfg.maskparameter = field in the first dataset to be used for marking significant data + cfg.maskstyle = style used for masking of data, 'box', 'thickness' or 'saturation' (default = 'box') + cfg.maskfacealpha = mask transparency value between 0 and 1 + cfg.xlim = 'maxmin', 'maxabs', 'zeromax', 'minzero', or [xmin xmax] (default = 'maxmin') + cfg.ylim = 'maxmin', 'maxabs', 'zeromax', 'minzero', or [ymin ymax] (default = 'maxmin') + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION for details + cfg.refchannel = name of reference channel for visualising connectivity, can be 'gui' + cfg.magscale = number, scaling to apply to the MEG magnetometer channels prior to display + cfg.gradscale = number, scaling to apply to the MEG gradiometer channels prior to display + cfg.baseline = 'yes', 'no' or [time1 time2] (default = 'no'), see FT_TIMELOCKBASELINE or FT_FREQBASELINE + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.axes = string, 'yes' or 'no' whether to draw x- and y-axes for each graph (default = 'yes') + cfg.box = string, 'yes' or 'no' whether to draw a box around each graph (default = 'no') + cfg.showlabels = 'yes' or 'no' (default = 'no') + cfg.showoutline = 'yes' or 'no' (default = 'no') + cfg.showscale = 'yes' or 'no' (default = 'yes') + cfg.showcomment = 'yes' or 'no' (default = 'yes') + cfg.comment = string of text (default = date + limits) + Add 'comment' to graph (according to COMNT in the layout) + cfg.limittext = add user-defined text instead of cfg.comment, (default = cfg.comment) + cfg.fontsize = font size of comment and labels (default = 8) + cfg.interactive = 'yes' or 'no', make the plot interactive (default = 'yes') + In an interactive plot you can select areas and produce a new + interactive plot when a selected area is clicked. Multiple areas + can be selected by holding down the SHIFT key. + cfg.figure = 'yes' or 'no', whether to open a new figure. You can also specify a figure handle from FIGURE, GCF or SUBPLOT. (default = 'yes') + cfg.figurename = string, title of the figure window + cfg.position = location and size of the figure, specified as [left bottom width height] (default is automatic) + cfg.renderer = string, 'opengl', 'zbuffer', 'painters', see RENDERERINFO (default is automatic, try 'painters' when it crashes) + cfg.colorgroups = 'sequential', 'allblack', 'labelcharN' (N = Nth character in label), 'chantype' or a vector + with the length of the number of channels defining the groups (default = 'condition') + cfg.linestyle = linestyle/marker type, see options of the PLOT function (default = '-') + can be a single style for all datasets, or a cell-array containing one style for each dataset + cfg.linewidth = linewidth in points (default = 0.5) + cfg.linecolor = color(s) used for plotting the dataset(s). The default is defined in LINEATTRIBUTES_COMMON, see + the help of this function for more information. + cfg.directionality = '', 'inflow' or 'outflow' specifies for connectivity measures whether the + inflow into a node, or the outflow from a node is plotted. The (default) behavior + of this option depends on the dimord of the input data (see below). + cfg.layout = specify the channel layout for plotting using one of the supported ways (see below). + cfg.select = 'intersect' or 'union' with multiple input arguments determines the + pre-selection of the data that is considered for plotting (default = 'intersect') + cfg.viewmode = 'topographic' or 'butterfly', whether to use the topographic channel layout or a butterfly plot (default = 'topographic') + + The following options for the scaling of the EEG, EOG, ECG, EMG, MEG and NIRS channels + is optional and can be used to bring the absolute numbers of the different + channel types in the same range (e.g. fT and uV). The channel types are determined + from the input data using FT_CHANNELSELECTION. + cfg.eegscale = number, scaling to apply to the EEG channels prior to display + cfg.eogscale = number, scaling to apply to the EOG channels prior to display + cfg.ecgscale = number, scaling to apply to the ECG channels prior to display + cfg.emgscale = number, scaling to apply to the EMG channels prior to display + cfg.megscale = number, scaling to apply to the MEG channels prior to display + cfg.gradscale = number, scaling to apply to the MEG gradiometer channels prior to display (in addition to the cfg.megscale factor) + cfg.magscale = number, scaling to apply to the MEG magnetometer channels prior to display (in addition to the cfg.megscale factor) + cfg.nirsscale = number, scaling to apply to the NIRS channels prior to display + cfg.mychanscale = number, scaling to apply to the channels specified in cfg.mychan + cfg.mychan = Nx1 cell-array with selection of channels + cfg.chanscale = Nx1 vector with scaling factors, one per channel specified in cfg.channel + + For the plotting of directional connectivity data the cfg.directionality option + determines what is plotted. The default value and the supported functionality + depend on the dimord of the input data. If the input data is of dimord + 'chan_chan_XXX', the value of directionality determines whether, given the + reference channel(s), the columns (inflow), or rows (outflow) are selected for + plotting. In this situation the default is 'inflow'. Note that for undirected + measures, inflow and outflow should give the same output. If the input data is of + dimord 'chancmb_XXX', the value of directionality determines whether the rows in + data.labelcmb are selected. With 'inflow' the rows are selected if the + refchannel(s) occur in the right column, with 'outflow' the rows are selected if + the refchannel(s) occur in the left column of the labelcmb-field. Default in this + case is '', which means that all rows are selected in which the refchannel(s) + occur. This is to robustly support linearly indexed undirected connectivity + metrics. In the situation where undirected connectivity measures are linearly + indexed, specifying 'inflow' or 'outflow' can result in unexpected behavior. + + The layout defines how the channels are arranged and what the size of each + subplot is. You can specify the layout in a variety of ways: + - you can provide a pre-computed layout structure (see prepare_layout) + - you can give the name of an ascii layout file with extension *.lay + - you can give the name of an electrode file + - you can give an electrode definition, i.e. "elec" structure + - you can give a gradiometer definition, i.e. "grad" structure + If you do not specify any of these and the data structure contains an + electrode or gradiometer structure, that will be used for creating a + layout. If you want to have more fine-grained control over the layout + of the subplots, you should create your own layout file. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + If you specify this option the input data will be read from a *.mat + file on disk. This mat files should contain only a single variable named 'data', + corresponding to the input structure. For this particular function, the + data should be provided as a cell-array. + + See also FT_MULTIPLOTTFR, FT_SINGLEPLOTER, FT_SINGLEPLOTTFR, FT_TOPOPLOTER, + FT_TOPOPLOTTFR, FT_PREPARE_LAYOUT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_multiplotER.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_multiplotER", *args, **kwargs) diff --git a/fieldtrip/ft_multiplotTFR.py b/fieldtrip/ft_multiplotTFR.py new file mode 100644 index 0000000..abf5e32 --- /dev/null +++ b/fieldtrip/ft_multiplotTFR.py @@ -0,0 +1,153 @@ +from fieldtrip._runtime import Runtime + + +def ft_multiplotTFR(*args, **kwargs): + """ + FT_MULTIPLOTTFR plots the time-frequency representations of power or coherence + in a topographical layout. The plots of the indivual sensors are arranged + according to their location specified in the layout. + + Use as + ft_multiplotTFR(cfg, data) + + The data can be a time-frequency representation of power or coherence + that was computed using the FT_FREQANALYSIS or FT_FREQDESCRIPTIVES + functions. + + The configuration can have the following parameters: + cfg.parameter = field to be represented as color, for example 'powspctrm' or 'cohspctrm' (default depends on data.dimord) + cfg.maskparameter = field in the data to be used for masking of data, can be logical (e.g. significant data points) or numerical (e.g. t-values). + (not possible for mean over multiple channels, or when input contains multiple subjects + or trials) + cfg.maskstyle = style used to masking, 'opacity', 'saturation', or 'outline' (default = 'opacity') + 'outline' can only be used with a logical cfg.maskparameter + use 'saturation' or 'outline' when saving to vector-format (like *.eps) to avoid all sorts of image-problems + cfg.maskalpha = alpha value between 0 (transparent) and 1 (opaque) used for masking areas dictated by cfg.maskparameter (default = 1) + (will be ignored in case of numeric cfg.maskparameter or if cfg.maskstyle = 'outline') + cfg.masknans = 'yes' or 'no' (default = 'yes') + cfg.xlim = 'maxmin', 'maxabs', 'zeromax', 'minzero', or [xmin xmax] (default = 'maxmin') + cfg.ylim = 'maxmin', 'maxabs', 'zeromax', 'minzero', or [ymin ymax] (default = 'maxmin') + cfg.zlim = plotting limits for color dimension, 'maxmin', 'maxabs', 'zeromax', 'minzero', or [zmin zmax] (default = 'maxmin') + cfg.gradscale = number, scaling to apply to the MEG gradiometer channels prior to display + cfg.magscale = number, scaling to apply to the MEG magnetometer channels prior to display + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION for details + cfg.refchannel = name of reference channel for visualising connectivity, can be 'gui' + cfg.baseline = 'yes', 'no' or [time1 time2] (default = 'no'), see FT_FREQBASELINE + cfg.baselinetype = 'absolute', 'relative', 'relchange', 'normchange', 'db' or 'zscore' (default = 'absolute') + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.box = 'yes', 'no', whether to draw a box around each graph (default = 'no', if maskparameter is given default = 'yes') + cfg.hotkeys = enables hotkeys (up/down arrows) for dynamic colorbar adjustment + cfg.colorbar = 'yes', 'no' (default = 'no') + cfg.colorbartext = string indicating the text next to colorbar + cfg.colormap = string, or Nx3 matrix, see FT_COLORMAP + cfg.showlabels = 'yes', 'no' (default = 'no') + cfg.showoutline = 'yes', 'no' (default = 'no') + cfg.showscale = 'yes', 'no' (default = 'yes') + cfg.showcomment = 'yes', 'no' (default = 'yes') + cfg.comment = string of text (default = date + limits) + Add 'comment' to graph (according to COMNT in the layout) + cfg.limittext = add user-defined text instead of cfg.comment, (default = cfg.comment) + cfg.fontsize = font size of comment and labels (if present) (default = 8) + cfg.fontweight = font weight of comment and labels (if present) + cfg.interactive = Interactive plot 'yes' or 'no' (default = 'yes') + In a interactive plot you can select areas and produce a new + interactive plot when a selected area is clicked. Multiple areas + can be selected by holding down the SHIFT key. + cfg.figure = 'yes' or 'no', whether to open a new figure. You can also specify a figure handle from FIGURE, GCF or SUBPLOT. (default = 'yes') + cfg.figurename = string, title of the figure window + cfg.position = location and size of the figure, specified as [left bottom width height] (default is automatic) + cfg.renderer = string, 'opengl', 'zbuffer', 'painters', see RENDERERINFO (default is automatic, try 'painters' when it crashes) + cfg.directionality = '', 'inflow' or 'outflow' specifies for + connectivity measures whether the inflow into a + node, or the outflow from a node is plotted. The + (default) behavior of this option depends on the dimor + of the input data (see below). + cfg.layout = specify the channel layout for plotting using one of + the supported ways (see below). + + The following options for the scaling of the EEG, EOG, ECG, EMG, MEG and NIRS channels + is optional and can be used to bring the absolute numbers of the different + channel types in the same range (e.g. fT and uV). The channel types are determined + from the input data using FT_CHANNELSELECTION. + cfg.eegscale = number, scaling to apply to the EEG channels prior to display + cfg.eogscale = number, scaling to apply to the EOG channels prior to display + cfg.ecgscale = number, scaling to apply to the ECG channels prior to display + cfg.emgscale = number, scaling to apply to the EMG channels prior to display + cfg.megscale = number, scaling to apply to the MEG channels prior to display + cfg.gradscale = number, scaling to apply to the MEG gradiometer channels prior to display (in addition to the cfg.megscale factor) + cfg.magscale = number, scaling to apply to the MEG magnetometer channels prior to display (in addition to the cfg.megscale factor) + cfg.nirsscale = number, scaling to apply to the NIRS channels prior to display + cfg.mychanscale = number, scaling to apply to the channels specified in cfg.mychan + cfg.mychan = Nx1 cell-array with selection of channels + cfg.chanscale = Nx1 vector with scaling factors, one per channel specified in cfg.channel + + For the plotting of directional connectivity data the cfg.directionality + option determines what is plotted. The default value and the supported + functionality depend on the dimord of the input data. If the input data + is of dimord 'chan_chan_XXX', the value of directionality determines + whether, given the reference channel(s), the columns (inflow), or rows + (outflow) are selected for plotting. In this situation the default is + 'inflow'. Note that for undirected measures, inflow and outflow should + give the same output. If the input data is of dimord 'chancmb_XXX', the + value of directionality determines whether the rows in data.labelcmb are + selected. With 'inflow' the rows are selected if the refchannel(s) occur in + the right column, with 'outflow' the rows are selected if the + refchannel(s) occur in the left column of the labelcmb-field. Default in + this case is '', which means that all rows are selected in which the + refchannel(s) occur. This is to robustly support linearly indexed + undirected connectivity metrics. In the situation where undirected + connectivity measures are linearly indexed, specifying 'inflow' or + 'outflow' can result in unexpected behavior. + + The layout defines how the channels are arranged and what the size of each + subplot is. You can specify the layout in a variety of ways: + - you can provide a pre-computed layout structure, see FT_PREPARE_LAYOUT + - you can give the name of an ASCII layout file with extension *.lay + - you can give the name of an electrode file + - you can give an electrode definition, i.e. "elec" structure + - you can give a gradiometer definition, i.e. "grad" structure + If you do not specify any of these and the data structure contains an + electrode or gradiometer structure (common for MEG data, since the header + of the MEG datafile contains the gradiometer information), that will be + used for creating a layout. If you want to have more fine-grained control + over the layout of the subplots, you should create your own layout file. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + If you specify this option the input data will be read from a *.mat + file on disk. This mat files should contain only a single variable named 'data', + corresponding to the input structure. For this particular function, the + data should be provided as a cell-array. + + See also: + FT_MULTIPLOTER, FT_SINGLEPLOTER, FT_SINGLEPLOTTFR, FT_TOPOPLOTER, FT_TOPOPLOTTFR, + FT_PREPARE_LAYOUT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_multiplotTFR.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_multiplotTFR", *args, **kwargs) diff --git a/fieldtrip/ft_mvaranalysis.py b/fieldtrip/ft_mvaranalysis.py new file mode 100644 index 0000000..a87d53b --- /dev/null +++ b/fieldtrip/ft_mvaranalysis.py @@ -0,0 +1,98 @@ +from fieldtrip._runtime import Runtime + + +def ft_mvaranalysis(*args, **kwargs): + """ + FT_MVARANALYSIS performs multivariate autoregressive modeling on + time series data over multiple trials. + + Use as + [mvardata] = ft_mvaranalysis(cfg, data) + + The input data should be organised in a structure as obtained from + the FT_PREPROCESSING function. The configuration depends on the type + of computation that you want to perform. + The output is a data structure of datatype 'mvar' which contains the + multivariate autoregressive coefficients in the field coeffs, and the + covariance of the residuals in the field noisecov. + + The configuration should contain: + cfg.method = the name of the toolbox containing the function for the + actual computation of the ar-coefficients + this can be 'biosig' (default) or 'bsmart' + you should have a copy of the specified toolbox in order + to use mvaranalysis (both can be downloaded directly). + cfg.mvarmethod = scalar (only required when cfg.method = 'biosig'). + default is 2, relates to the algorithm used for the + computation of the AR-coefficients by mvar.m + cfg.order = scalar, order of the autoregressive model (default=10) + cfg.channel = 'all' (default) or list of channels for which an mvar model + is fitted. (Do NOT specify if cfg.channelcmb is + defined) + cfg.channelcmb = specify channel combinations as a + two-column cell-array with channels in each column between + which a bivariate model will be fit (overrides + cfg.channel) + cfg.keeptrials = 'no' (default) or 'yes' specifies whether the coefficients + are estimated for each trial separately, or on the + concatenated data + cfg.jackknife = 'no' (default) or 'yes' specifies whether the coefficients + are estimated for all leave-one-out sets of trials + cfg.zscore = 'no' (default) or 'yes' specifies whether the channel data + are z-transformed prior to the model fit. This may be + necessary if the magnitude of the signals is very different + e.g. when fitting a model to combined MEG/EMG data + cfg.demean = 'yes' (default) or 'no' explicit removal of DC-offset + cfg.ems = 'no' (default) or 'yes' explicit removal ensemble mean + + ft_mvaranalysis can be used to obtain one set of coefficients across + all time points in the data, also when the trials are of varying length. + + ft_mvaranalysis can be also used to obtain time-dependent sets of + coefficients based on a sliding window. In this case the input cfg + should contain: + + cfg.t_ftimwin = the width of the sliding window on which the coefficients + are estimated + cfg.toi = [t1 t2 ... tx] the time points at which the windows are + centered + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_PREPROCESSING, FT_SOURCESTATISTICS, FT_FREQSTATISTICS, + FT_TIMELOCKSTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_mvaranalysis.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_mvaranalysis", *args, **kwargs) diff --git a/fieldtrip/ft_neighbourplot.py b/fieldtrip/ft_neighbourplot.py new file mode 100644 index 0000000..8dd42d3 --- /dev/null +++ b/fieldtrip/ft_neighbourplot.py @@ -0,0 +1,71 @@ +from fieldtrip._runtime import Runtime + + +def ft_neighbourplot(*args, **kwargs): + """ + FT_NEIGHBOURPLOT visualizes neighbouring channels in a particular channel + configuration. The positions of the channel are specified in a + gradiometer or electrode configuration or from a layout. + + Use as + ft_neighbourplot(cfg) + or as + ft_neighbourplot(cfg, data) + + Where the configuration can contain + cfg.verbose = string, 'yes' or 'no', whether the function will print feedback text in the command window + cfg.neighbours = neighbourhood structure, see FT_PREPARE_NEIGHBOURS (optional) + cfg.enableedit = string, 'yes' or 'no', allows you to interactively add or remove edges between vertices (default = 'no') + cfg.visible = string, 'on' or 'off' whether figure will be visible (default = 'on') + cfg.figure = 'yes' or 'no', whether to open a new figure. You can also specify a figure handle from FIGURE, GCF or SUBPLOT. (default = 'yes') + cfg.figurename = string, title of the figure window + cfg.position = location and size of the figure, specified as [left bottom width height] (default is automatic) + cfg.renderer = string, 'opengl', 'zbuffer', 'painters', see MATLAB Figure Properties. If this function crashes, you should try 'painters'. + + and either one of the following options + cfg.layout = filename of the layout, see FT_PREPARE_LAYOUT + cfg.elec = structure with electrode positions or filename, see FT_READ_SENS + cfg.grad = structure with gradiometer definition or filename, see FT_READ_SENS + cfg.opto = structure with gradiometer definition or filename, see FT_READ_SENS + + If cfg.neighbours is not defined, this function will call + FT_PREPARE_NEIGHBOURS to determine the channel neighbours. The + following data fields may also be used by FT_PREPARE_NEIGHBOURS + data.elec = structure with electrode positions + data.grad = structure with gradiometer definition + data.opto = structure with optode definition + + If cfg.neighbours is empty, no neighbouring sensors are assumed. + + Use cfg.enableedit to interactively add or remove edges in your own neighbour structure. + + See also FT_PREPARE_NEIGHBOURS, FT_PREPARE_LAYOUT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_neighbourplot.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_neighbourplot", *args, **kwargs) diff --git a/fieldtrip/ft_networkanalysis.py b/fieldtrip/ft_networkanalysis.py new file mode 100644 index 0000000..5496c4d --- /dev/null +++ b/fieldtrip/ft_networkanalysis.py @@ -0,0 +1,76 @@ +from fieldtrip._runtime import Runtime + + +def ft_networkanalysis(*args, **kwargs): + """ + FT_NETWORKANALYSIS computes various network graph measures from + between-channel or between source-level EEG/MEG signals. This function + acts as a wrapper aroun the network metrics implemented in the brain + connectivity toolbox developed by Olaf Sporns and colleagues. + + Use as + stat = ft_networkanalysis(cfg, data) + + where the first input argument is a configuration structure (see below) + and the second argument is the output of FT_CONNECTIVITYANALYSIS. + + At present the input data should be channel-level data with dimord + 'chan_chan(_freq)(_time)' or source data with dimord + 'pos_pos(_freq)(_time)'. + + The configuration structure has to contain + cfg.method = string, specifying the graph measure that will be + computed. See below for the list of supported measures. + cfg.parameter = string specifying the bivariate parameter in the data + for which the graph measure will be computed. + + Supported methods are + assortativity + betweenness, betweenness centrality (nodes) + charpath, characteristic path length, needs distance matrix as + input + clustering_coef, clustering coefficient + degrees + density + distance + edge_betweenness, betweenness centrality (edges) + transitivity + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a + *.mat file on disk and/or the output data will be written to a *.mat + file. These mat files should contain only a single variable, + corresponding with the input/output structure. + + See also FT_CONNECTIVITYANALYSIS, FT_CONNECTIVITYPLOT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_networkanalysis.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_networkanalysis", *args, **kwargs) diff --git a/fieldtrip/ft_prepare_headmodel.py b/fieldtrip/ft_prepare_headmodel.py new file mode 100644 index 0000000..e1dc2ea --- /dev/null +++ b/fieldtrip/ft_prepare_headmodel.py @@ -0,0 +1,167 @@ +from fieldtrip._runtime import Runtime + + +def ft_prepare_headmodel(*args, **kwargs): + """ + FT_PREPARE_HEADMODEL constructs a volume conduction model from the geometry + of the head. The volume conduction model specifies how currents that are + generated by sources in the brain, e.g. dipoles, are propagated through the + tissue and how these result in externally measureable EEG potentials or MEG + fields. + + FieldTrip implements a variety of forward solutions, partially with internal + code and some of them using external toolboxes or executables. Each of the + forward solutions requires a set of configuration options which are listed + below. This function takes care of all the preparatory steps in the + construction of the volume conduction model and sets it up so that + subsequent computations are efficient and fast. + + Use as + headmodel = ft_prepare_headmodel(cfg) or + headmodel = ft_prepare_headmodel(cfg, mesh) with the output of FT_PREPARE_MESH or FT_READ_HEADSHAPE + headmodel = ft_prepare_headmodel(cfg, seg) with the output of FT_VOLUMESEGMENT + headmodel = ft_prepare_headmodel(cfg, elec) with the output of FT_READ_SENS + headmodel = ft_prepare_headmodel(cfg, sourcemodel) with the output of FT_PREPARE_LEADFIELD + + In general the input to this function is a geometrical description of the + shape of the head and a description of the electrical conductivity. The + geometrical description can be a set of surface points obtained from + fT_READ_HEADSHAPE, a surface mesh that was obtained from FT_PREPARE_MESH or + a segmented anatomical MRI that was obtained from FT_VOLUMESEGMENT. + + The cfg argument is a structure that can contain: + cfg.method = string that specifies the forward solution, see below + cfg.conductivity = a number or a vector containing the conductivities of the compartments + cfg.tissue = a string or integer, to be used in combination with a 'seg' for the + second intput. If 'brain', 'skull', and 'scalp' are fields + present in 'seg', then cfg.tissue need not be specified, as + these are defaults, depending on cfg.method. Otherwise, + cfg.tissue should refer to which field(s) of seg should be used. + + For EEG the following methods are available: + singlesphere analytical single sphere model + concentricspheres analytical concentric sphere model with up to 4 spheres + openmeeg boundary element method, based on the OpenMEEG software + bemcp boundary element method, based on the implementation from Christophe Phillips + dipoli boundary element method, based on the implementation from Thom Oostendorp + hbf boundary element method, based on the implementation from Matti Stenroos + asa boundary element method, based on the (commercial) ASA software + simbio finite element method, based on the SimBio software + duneuro finite element method, based on the DUNEuro software + fns finite difference method, based on the FNS software + infinite electric dipole in an infinite homogenous medium + halfspace infinite homogenous medium on one side, vacuum on the other + besa finite element leadfield matrix from BESA + interpolate interpolate the precomputed leadfield + + For MEG the following methods are available: + openmeeg boundary element method, based on the OpenMEEG software + hbf boundary element method, based on the implementation from Matti Stenroos + singlesphere analytical single sphere model + localspheres local spheres model for MEG, one sphere per channel + singleshell realisically shaped single shell approximation, based on the implementation from Guido Nolte + infinite magnetic dipole in an infinite vacuum + + Each specific method has its own specific configuration options which are listed below. + + BEMCP, DIPOLI, OPENMEEG + cfg.tissue see above; in combination with 'seg' input + cfg.isolatedsource (optional) + cfg.tempdir (optional) + cfg.tempname (optional) + + CONCENTRICSPHERES + cfg.tissue see above; in combination with 'seg' input + cfg.order (optional) + cfg.fitind (optional) + + LOCALSPHERES + cfg.grad + cfg.tissue see above; in combination with 'seg' input; default options are 'brain' or 'scalp' + cfg.feedback (optional) + cfg.radius (optional) + cfg.maxradius (optional) + cfg.baseline (optional) + + SIMBIO + cfg.conductivity + + DUNEURO + cfg.conductivity An array with the conductivities must be provided. (see above) + cfg.grid_filename Alternatively, a filename for the grid and a filename for the conductivities can be passed. + cfg.tensors_filename " + cfg.duneuro (optional) Additional settings can be provided for duneuro (see http://www.duneuro.org, and duneuro_defaults.m). + + SINGLESHELL + cfg.tissue see above; in combination with 'seg' input; default options are 'brain' or 'scalp' + cfg.order (optional) + + SINGLESPHERE + cfg.tissue see above; in combination with 'seg' input; default options are 'brain' or 'scalp'; must be only 1 value + + INTERPOLATE + cfg.outputfile (required) string, filename prefix for the output files + + BESA + cfg.headmodel (required) string, filename of precomputed FEM leadfield + cfg.elec (required) structure with electrode positions or filename, see FT_READ_SENS + cfg.outputfile (required) string, filename prefix for the output files + + FNS + cfg.tissue + cfg.tissueval + cfg.conductivity + cfg.elec + cfg.grad + cfg.transform + + HALFSPACE + cfg.point + cfg.submethod (optional) + + HBF + cfg.conductivity (required) [2 x n_boundaries] array with conductivity values for inside and outside of a boundary + cfg.isolatedsource (optional) set to 1 to apply isolated source approach on innermost boundary + cfg.checkmesh (optional) ['yes | 'no'] check the integrity and ordering of boundaries + + + More details for each of the specific methods can be found in the corresponding + low-level function which is called FT_HEADMODEL_XXX where XXX is the method + of choise. + + See also FT_PREPARE_MESH, FT_PREPARE_SOURCEMODEL, FT_PREPARE_LEADFIELD, + FT_HEADMODEL_BEMCP, FT_HEADMODEL_ASA, FT_HEADMODEL_DIPOLI, + FT_HEADMODEL_SIMBIO, FT_HEADMODEL_FNS, FT_HEADMODEL_HALFSPACE, + FT_HEADMODEL_INFINITE, FT_HEADMODEL_OPENMEEG, FT_HEADMODEL_SINGLESPHERE, + FT_HEADMODEL_CONCENTRICSPHERES, FT_HEADMODEL_LOCALSPHERES, + FT_HEADMODEL_SINGLESHELL, FT_HEADMODEL_INTERPOLATE, FT_HEADMODEL_DUNEURO, + FT_HEADMODEL_HBF + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_prepare_headmodel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_prepare_headmodel", *args, **kwargs) diff --git a/fieldtrip/ft_prepare_layout.py b/fieldtrip/ft_prepare_layout.py new file mode 100644 index 0000000..adc40fd --- /dev/null +++ b/fieldtrip/ft_prepare_layout.py @@ -0,0 +1,144 @@ +from fieldtrip._runtime import Runtime + + +def ft_prepare_layout(*args, **kwargs): + """ + FT_PREPARE_LAYOUT loads or creates a 2-D layout of the channel locations. This + layout is required for plotting the topographical distribution of the potential or + field distribution, or for plotting timecourses in a topographical arrangement. + + Use as + layout = ft_prepare_layout(cfg) + or + layout = ft_prepare_layout(cfg, data) + where the optional data input argument is any of the FieldTrip data structures. + + This returns a layout structure with the following elements + layout.pos = Nx2 matrix with the position where each channel should be plotted + layout.label = Nx1 cell-array with the channel labels + layout.width = Nx1 vector with the width of each box for multiplotting + layout.height = Nx1 vector with the height of each box for multiplotting + layout.mask = optional cell-array with line segments that determine the area for topographic interpolation + layout.outline = optional cell-array with line segments that represent the head, nose, ears, sulci or other anatomical features + layout.color = optional Nx3 matrix with rgb values for the channels' color, for fine-grained color behavior + + There are several ways in which a 2-D layout can be made: + 1) it can be read directly from a layout file + 2) it can be created on basis of an image or photo, + 3) it can be created from a projection of the 3-D sensor positions in the data, in the configuration, or in an electrode, gradiometer or optode file. + + Layout files are MATLAB *.mat files containing a single structure representing the layout + (see above). The layout file can also be an ASCII file with the extension *.lay, although + this file format is no longer recommended, since there is less control over the outline + of the head and the mask within which the interpolation is done. A large number of + template layout files is provided in the fieldtrip/template/layout directory. See + also http://www.fieldtriptoolbox.org/template/layout + + You can specify any one of the following configuration options + cfg.layout = filename containg the input layout (*.mat or *.lay file), this can also be a layout + structure, which is simply returned as-is (see below for details) + cfg.output = filename (ending in .mat or .lay) to which the layout will be written (default = []) + cfg.feedback = 'yes' or 'no', whether to show an image of the layout (default = 'no') + cfg.elec = structure with electrode positions or filename, see FT_READ_SENS + cfg.grad = structure with gradiometer definition or filename, see FT_READ_SENS + cfg.opto = structure with optode definition or filename, see FT_READ_SENS + cfg.rotate = number, rotation around the z-axis in degrees (default = [], which means automatic) + cfg.center = string, center and scale the electrodes in the sphere that represents the head, can be 'yes' or 'no' (default = 'no') + cfg.projection = string, 2D projection method can be 'stereographic', 'orthographic', 'polar' or 'gnomic' (default = 'polar') + When 'orthographic', cfg.viewpoint can be used to indicate to specificy projection (keep empty for legacy projection) + cfg.viewpoint = string indicating the view point that is used for orthographic projection of 3-D sensor + positions to the 2-D plane. The possible viewpoints are + 'left' - left sagittal view, L=anterior, R=posterior, top=top, bottom=bottom + 'right' - right sagittal view, L=posterior, R=anterior, top=top, bottom=bottom + 'topleft' - view from the top top, L=anterior, R=posterior, top=top, bottom=bottom + 'topright' - view from the top right, L=posterior, R=anterior, top=top, bottom=bottom + 'inferior' - inferior axial view, L=R, R=L, top=anterior, bottom=posterior + 'superior' - superior axial view, L=L, R=R, top=anterior, bottom=posterior + 'anterior' - anterior coronal view, L=R, R=L, top=top, bottom=bottom + 'posterior' - posterior coronal view, L=L, R=R, top=top, bottom=bottom + 'auto' - automatic guess of the most optimal of the above + tip: use cfg.viewpoint = 'auto' per iEEG electrode grid/strip/depth for more accurate results + tip: to obtain an overview of all iEEG electrodes, choose superior/inferior, use cfg.headshape/mri, and plot using FT_LAYOUTPLOT with cfg.box/mask = 'no' + cfg.outline = string, how to create the outline, can be 'circle', 'doublecirclecross', 'helmet', 'square', 'convex', 'headshape', 'mri' or 'no' (default is automatic) + cfg.mask = string, how to create the mask, can be 'circle', 'extended', 'square', 'convex', 'headshape', 'mri' or 'no' (default is automatic) + cfg.headshape = surface mesh (for example pial or head) to be used for generating an outline, see FT_READ_HEADSHAPE for details + cfg.mri = segmented anatomical MRI to be used for generating an outline, see FT_READ_MRI and FT_VOLUMESEGMENT for details + cfg.montage = 'no' or a montage structure (default = 'no') + cfg.image = filename, use an image to construct a layout (useful for ECoG grids) + cfg.bw = 'yes' or 'no', if an image is used and this option is true, the image is transformed in black and white (default = 'no', i.e. do not transform) + cfg.overlap = string, how to deal with overlapping channels when the layout is constructed from a sensor configuration structure. This can be + 'shift' - shift the positions in 2D space to remove the overlap (default) + 'keep' - do not shift, retain the overlap + 'no' - throw an error when overlap is present + cfg.channel = 'all', or Nx1 cell-array with selection of channels, see FT_CHANNELSELECTION for details + cfg.boxchannel = 'all', or Nx1 cell-array with selection of channels, see FT_CHANNELSELECTION for details + specificies channels to use for determining channel box size (default = 'all', recommended for MEG/EEG, a selection is recommended for iEEG) + cfg.skipscale = 'yes' or 'no', whether the scale should be included in the layout or not (default = 'no') + cfg.skipcomnt = 'yes' or 'no', whether the comment should be included in the layout or not (default = 'no') + cfg.color = empty, 'spatial', or Nx3 matrix, if non-empty, an Nx3 color matrix based on the position + of the sensors will be added (default = []) + + If you use cfg.headshape or cfg.mri to create a headshape outline, the input + geometry should be expressed in the same units and coordinate system as the input + sensors. + + Alternatively the layout can be constructed from either one of these in the input data structure: + data.elec = structure with electrode positions + data.grad = structure with gradiometer definition + data.opto = structure with optode definition + + Alternatively you can specify the following options for systematic layouts which + will be generated for all channels present in the data. Note that these layouts are + only suitable for multiplotting, not for topoplotting. + cfg.layout = 'ordered' will give you a NxN ordered layout + cfg.layout = 'vertical' will give you a Nx1 ordered layout + cfg.layout = 'horizontal' will give you a 1xN ordered layout + cfg.layout = 'butterfly' will give you a layout with all channels on top of each other + cfg.layout = 'circular' will distribute the channels on a circle + cfg.width = scalar (default is automatic) + cfg.height = scalar (default is automatic) + + For an sEEG shaft the option cfg.layout='vertical' or 'horizontal' is useful to + represent the channels in a linear sequence . In this case you can also specify the + direction of the shaft as going from left-to-right, top-to-bottom, etc. + cfg.direction = string, can be any of 'LR', 'RL' (for horizontal), 'TB', 'BT' (for vertical) + + For an ECoG grid the option cfg.layout='ordered' is useful to represent the + channels in a grid array. In this case you can also specify the number of rows + and/or columns and hwo the channels increment over the grid (e.g. first + left-to-right, then top-to-bottom). You can check the channel order of your grid + using FT_PLOT_LAYOUT. + cfg.rows = number of rows (default is automatic) + cfg.columns = number of columns (default is automatic) + cfg.direction = string, can be any of 'LRTB', 'RLTB', 'LRBT', 'RLBT', 'TBLR', 'TBRL', 'BTLR', 'BTRL' (default = 'LRTB') + + See also FT_TOPOPLOTER, FT_TOPOPLOTTFR, FT_MULTIPLOTER, FT_MULTIPLOTTFR, FT_PLOT_LAYOUT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_prepare_layout.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_prepare_layout", *args, **kwargs) diff --git a/fieldtrip/ft_prepare_leadfield.py b/fieldtrip/ft_prepare_leadfield.py new file mode 100644 index 0000000..ab91709 --- /dev/null +++ b/fieldtrip/ft_prepare_leadfield.py @@ -0,0 +1,113 @@ +from fieldtrip._runtime import Runtime + + +def ft_prepare_leadfield(*args, **kwargs): + """ + FT_PREPARE_LEADFIELD computes the forward model for many dipole locations + on a regular 2D or 3D sourcemodel and stores it for efficient inverse modelling + + Use as + [sourcemodel] = ft_prepare_leadfield(cfg, data) + + It is necessary to input the data on which you want to perform the inverse + computations, since that data generally contain the gradiometer information and + information about the channels that should be included in the forward model + computation. The data structure can be either obtained from FT_PREPROCESSING, + FT_FREQANALYSIS or FT_TIMELOCKANALYSIS. If the data is empty, all channels will be + included in the forward model. + + The configuration should contain + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), + see FT_CHANNELSELECTION for details + + The positions of the sources can be specified as a regular 3-D + sourcemodel that is aligned with the axes of the head coordinate system + cfg.xgrid = vector (e.g. -20:1:20) or 'auto' (default = 'auto') + cfg.ygrid = vector (e.g. -20:1:20) or 'auto' (default = 'auto') + cfg.zgrid = vector (e.g. 0:1:20) or 'auto' (default = 'auto') + cfg.resolution = number (e.g. 1 cm) for automatic sourcemodel generation + + Alternatively the position of a few sources at locations of interest can + be specified, for example obtained from an anatomical or functional MRI + cfg.sourcemodel.pos = N*3 matrix with position of each source + cfg.sourcemodel.inside = N*1 vector with boolean value whether sourcemodel point is inside brain (optional) + cfg.sourcemodel.dim = [Nx Ny Nz] vector with dimensions in case of 3-D sourcemodel (optional) + + The volume conduction model of the head should be specified as + cfg.headmodel = structure with volume conduction model, see FT_PREPARE_HEADMODEL + + The EEG or MEG sensor positions can be present in the data or can be specified as + cfg.elec = structure with electrode positions or filename, see FT_READ_SENS + cfg.grad = structure with gradiometer definition or filename, see FT_READ_SENS + + Optionally, you can modify the leadfields by reducing the rank (i.e. remove the + weakest orientation), or by normalizing each column. + cfg.reducerank = 'no', or number (default = 3 for EEG, 2 for MEG) + cfg.backproject = 'yes' or 'no', determines when reducerank is applied whether the + lower rank leadfield is projected back onto the original linear + subspace, or not (default = 'yes') + cfg.normalize = 'yes' or 'no' (default = 'no') + cfg.normalizeparam = depth normalization parameter (default = 0.5) + cfg.weight = number or Nx1 vector, weight for each dipole position to compensate + for the size of the corresponding patch (default = 1) + + Depending on the type of headmodel, some additional options may be + specified. + + For OPENMEEG based headmodels: + cfg.openmeeg.batchsize = scalar (default 1e4), number of dipoles + for which the leadfield is computed in a + single call to the low-level code. Trades off + memory efficiency for speed. + cfg.openmeeg.dsm = 'no'/'yes', reuse existing DSM if provided + cfg.openmeeg.keepdsm = 'no'/'yes', option to retain DSM (no by default) + cfg.openmeeg.nonadaptive = 'no'/'yes' + + For SINGLESHELL based headmodels: + cfg.singleshell.batchsize = scalar or 'all' (default 1), number of dipoles + for which the leadfield is computed in a + single call to the low-level code. Trades off + memory efficiency for speed. + + For HBF based headmodels: + cfg.hbf.batchsize = scalar or 'all' (default 1), number of dipoles + for which the leadfield is computed in a + single call to the low-level code. Trades off + memory efficiency for speed. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + If you specify this option the input data will be read from a *.mat + file on disk. This mat files should contain only a single variable named 'data', + corresponding to the input structure. + + See also FT_SOURCEANALYSIS, FT_DIPOLEFITTING, FT_PREPARE_HEADMODEL, FT_PREPARE_SOURCEMODEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_prepare_leadfield.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_prepare_leadfield", *args, **kwargs) diff --git a/fieldtrip/ft_prepare_mesh.py b/fieldtrip/ft_prepare_mesh.py new file mode 100644 index 0000000..dd23398 --- /dev/null +++ b/fieldtrip/ft_prepare_mesh.py @@ -0,0 +1,100 @@ +from fieldtrip._runtime import Runtime + + +def ft_prepare_mesh(*args, **kwargs): + """ + FT_PREPARE_MESH creates a triangulated surface mesh or tetrahedral/hexahedral + volume mesh that can be used as geometrical description for a volume conduction + model. The mesh can either be created manually from anatomical MRI data or can be + generated starting from a segmented MRI. This function can also be used to create a + cortex hull, i.e. the smoothed envelope around the pial surface created by + freesurfer. + + Use as + mesh = ft_prepare_mesh(cfg) + mesh = ft_prepare_mesh(cfg, mri) + mesh = ft_prepare_mesh(cfg, seg) + where the mri input argument is the result from FT_READ_MRI, FT_VOLUMEREALIGN or + FT_VOLUMERESLICE and the seg input argument is from FT_VOLUMESEGMENT. If you + specify an anatomical MRI, it will be segmented on the fly. + + The cfg argument is a structure that can contain: + cfg.method = string, can be 'interactive', 'projectmesh', 'iso2mesh', 'isosurface', + 'headshape', 'hexahedral', 'tetrahedral', 'cortexhull' or 'fittemplate' + cfg.tissue = cell-array with strings representing the tissue types, or numeric vector with integer values + cfg.numvertices = numeric vector, should have same number of elements as the number of tissues + + When providing an anatomical MRI or a segmentation, you should specify + cfg.downsample = integer number (default = 1, i.e. no downsampling), see FT_VOLUMEDOWNSAMPLE + cfg.spmversion = string, 'spm2', 'spm8', 'spm12' (default = 'spm12') + + For method 'headshape' you should specify + cfg.headshape = a filename containing headshape, a Nx3 matrix with surface + points, or a structure with a single or multiple boundaries + + For method 'cortexhull' you should not give input data, but specify + cfg.headshape = string, filename containing the pial surface computed by freesurfer recon-all + + For method 'fittemplate' you should specify + cfg.headshape = a filename containing headshape + cfg.template = a filename containing headshape + With this method you are fitting the headshape from the configuration to the template; + the resulting affine transformation is applied to the input mesh (or set of meshes), + which is subsequently returned as output variable. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + Example + mri = ft_read_mri('Subject01.mri'); + + cfg = []; + cfg.output = {'scalp', 'skull', 'brain'}; + segmentation = ft_volumesegment(cfg, mri); + + cfg = []; + cfg.tissue = {'scalp', 'skull', 'brain'}; + cfg.numvertices = [800, 1600, 2400]; + mesh = ft_prepare_mesh(cfg, segmentation); + + cfg = []; + cfg.method = 'cortexhull'; + cfg.headshape = '/path/to/surf/lh.pial'; + cfg.fshome = '/path/to/freesurfer dir'; + cortex_hull = ft_prepare_mesh(cfg); + + See also FT_VOLUMESEGMENT, FT_PREPARE_HEADMODEL, FT_PLOT_MESH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_prepare_mesh.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_prepare_mesh", *args, **kwargs) diff --git a/fieldtrip/ft_prepare_montage.py b/fieldtrip/ft_prepare_montage.py new file mode 100644 index 0000000..c87a0d5 --- /dev/null +++ b/fieldtrip/ft_prepare_montage.py @@ -0,0 +1,69 @@ +from fieldtrip._runtime import Runtime + + +def ft_prepare_montage(*args, **kwargs): + """ + FT_PREPARE_MONTAGE creates a referencing scheme based on the input configuration + options and the channels in the data structure. The resulting montage can be + given as input to FT_APPLY_MONTAGE, or as cfg.montage to FT_PREPROCESSING. + + Use as + montage = ft_prepare_montage(cfg, data) + + The configuration can contain the following fields: + cfg.refmethod = 'avg', 'comp', 'bipolar', 'laplace', 'doublebanana', 'longitudinal', 'circumferential', 'transverse' (default = 'avg') + cfg.implicitref = string with the label of the implicit reference, or empty (default = []) + cfg.refchannel = cell-array with new EEG reference channel(s), this can be 'all' for a common average reference + cfg.groupchans = 'yes' or 'no', should channels be rereferenced in separate groups + for bipolar and laplace methods, this requires channnels to be + named using an alphanumeric code, where letters represent the + group and numbers represent the order of the channel whithin + its group (default = 'no') + + The implicitref option allows adding the implicit reference channel to the data as + a channel with zeros. + + The resulting montage is a structure with the fields + montage.tra = MxN matrix + montage.labelold = Nx1 cell-array + montage.labelnew = Mx1 cell-array + + As an example, an output bipolar montage could look like this + bipolar.labelold = {'1', '2', '3', '4'} + bipolar.labelnew = {'1-2', '2-3', '3-4'} + bipolar.tra = [ + +1 -1 0 0 + 0 +1 -1 0 + 0 0 +1 -1 + ]; + + See also FT_PREPROCESSING, FT_APPLY_MONTAGE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_prepare_montage.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_prepare_montage", *args, **kwargs) diff --git a/fieldtrip/ft_prepare_neighbours.py b/fieldtrip/ft_prepare_neighbours.py new file mode 100644 index 0000000..2a65703 --- /dev/null +++ b/fieldtrip/ft_prepare_neighbours.py @@ -0,0 +1,87 @@ +from fieldtrip._runtime import Runtime + + +def ft_prepare_neighbours(*args, **kwargs): + """ + FT_PREPARE_NEIGHBOURS finds the channel neighbours for spatial clustering + or interpolation of bad channels. Using the 'distance' method, neighbours + are based on a minimum neighbourhood distance (in cfg.neighbourdist). + Using the 'triangulation' method calculates a triangulation based on a 2D + projection of the sensor positions. The 'template' method loads a default + template for the given data type. Alternatively, using the 'parcellation' + method, in combination with an atlas as input data, spatial neighbours + of parcels are determined, based on the spatial relationship between the + labeled mesh vertices. Currently, only atlases defined on a triangular + mesh are supported. + + Use as + neighbours = ft_prepare_neighbours(cfg) + or + neighbours = ft_prepare_neighbours(cfg, data) + with an input data structure with the channels of interest and that + contains a sensor description, or represents an atlas, see FT_READ_ATLAS + + The configuration can contain + cfg.channel = channels in the data for which neighbours should be determined + cfg.method = 'distance', 'triangulation' or 'template' + cfg.template = name of the template file, e.g. CTF275_neighb.mat + cfg.neighbourdist = number, maximum distance between neighbouring sensors + (only for 'distance', default is 40 mm) + cfg.compress = 'yes' or 'no', add extra edges by compressing in the + x- and y-direction (only for 'triangulation', default is yes) + cfg.feedback = 'yes' or 'no' (default = 'no') + + The 3D sensor positions can be present in the data or can be specified as + cfg.elec = structure with electrode positions or filename, see FT_READ_SENS + cfg.grad = structure with gradiometer definition or filename, see FT_READ_SENS + + The 2D channel positions can be specified as + cfg.layout = filename of the layout, see FT_PREPARE_LAYOUT + + With an atlas in the input, the method 'parcellation' has the additional + options + cfg.parcellation = string that denotes the field in the atlas that is to be used + + The output is an array of structures with the "neighbours" which is + structured like this: + neighbours(1).label = 'Fz'; + neighbours(1).neighblabel = {'Cz', 'F3', 'F3A', 'FzA', 'F4A', 'F4'}; + neighbours(2).label = 'Cz'; + neighbours(2).neighblabel = {'Fz', 'F4', 'RT', 'RTP', 'P4', 'Pz', 'P3', 'LTP', 'LT', 'F3'}; + neighbours(3).label = 'Pz'; + neighbours(3).neighblabel = {'Cz', 'P4', 'P4P', 'Oz', 'P3P', 'P3'}; + etc. + + Note that a channel is not considered to be a neighbour of itself. + + See also FT_NEIGHBOURPLOT, FT_PREPARE_LAYOUT, FT_DATATYPE_SENS, + FT_READ_SENS, FT_READ_ATLAS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_prepare_neighbours.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_prepare_neighbours", *args, **kwargs) diff --git a/fieldtrip/ft_prepare_sourcemodel.py b/fieldtrip/ft_prepare_sourcemodel.py new file mode 100644 index 0000000..b1400c4 --- /dev/null +++ b/fieldtrip/ft_prepare_sourcemodel.py @@ -0,0 +1,144 @@ +from fieldtrip._runtime import Runtime + + +def ft_prepare_sourcemodel(*args, **kwargs): + """ + FT_PREPARE_SOURCEMODEL constructs a source model, for example a 3D grid or a + cortical sheet. The source model that can be used for source reconstruction, + beamformer scanning, linear estimation and MEG interpolation. + + Use as + sourcemodel = ft_prepare_sourcemodel(cfg) + where the details of the configuration structure determine how the source + model will be constructed. + + The different approaches for constructing a source model are + cfg.method = 'basedongrid' regular 3D grid with explicit specification + 'basedonresolution' regular 3D grid with specification of the resolution + 'basedonpos' place dipoles at the predefined positions + 'basedonmri' regular 3D grid, based on segmented MRI, restricted to gray matter + 'basedonmni' regular 3D grid, based on a warped template grid, based on the MNI brain + 'basedoncortex' cortical sheet from external software such as Caret or FreeSurfer, can also be two separate hemispheres + 'basedonshape' surface mesh based on inward shifted head surface from an external file + 'basedonvol' surface mesh based on inward shifted brain surface from volume conductor + 'basedonfile' the sourcemodel should be read from file + 'basedoncentroids' irregular 3D grid based on volumetric mesh + The default method is determined automatically based on the configuration options + that you specify. + + BASEDONGRID - uses an explicitly specified grid, according to the following + configuration options: + cfg.xgrid = vector (e.g. -120:10:120) or 'auto' (default = 'auto') + cfg.ygrid = vector (e.g. -120:10:120) or 'auto' (default = 'auto') + cfg.zgrid = vector (e.g. -50:10:120) or 'auto' (default = 'auto') + + BASEDONRESOLUTION - uses an grid with the desired resolution, according + to the following configuration options: + cfg.resolution = number (e.g. 10 mm) for automatic grid generation + + BASEDONPOS - places sources on positions that you explicitly specify, according to + the following configuration options: + cfg.sourcemodel.pos = N*3 matrix with position of each source + cfg.sourcemodel.inside = N*1 vector with boolean value whether position is inside brain (optional) + cfg.sourcemodel.dim = [Nx Ny Nz] vector with dimensions in case of 3D grid (optional) + The following fields (from FT_PRERARE_LEADFIELD or FT_SOURCEANALYSIS) are + not used in this function, but will be copied along to the output: + cfg.sourcemodel.leadfield = cell-array + cfg.sourcemodel.filter = cell-array + cfg.sourcemodel.subspace + cfg.sourcemodel.lbex + + BASEDONMNI - uses source positions from a template sourcemodel that is inversely + warped from MNI coordinates to the individual subjects MRI. It uses the following + configuration options: + cfg.mri = structure with the anatomical MRI, or the filename of the MRI, see FT_READ_MRI + cfg.nonlinear = 'no' (or 'yes'), use non-linear normalization + cfg.resolution = scalar with the resolution of the template MNI grid, defined in mm (for example 6) + cfg.template = structure with the template sourcemodel, or the filename of a template sourcemodel (defined in MNI space) + cfg.templatemri = string, filename of the MNI template (default = 'T1.mnc' for SPM2 or 'T1.nii' for SPM8 and SPM12) + cfg.spmversion = string, 'spm2', 'spm8', 'spm12' (default = 'spm12') + cfg.spmmethod = string, 'old', 'new' or 'mars', see FT_VOLUMENORMALISE + cfg.nonlinear = string, 'yes' or 'no', see FT_VOLUMENORMALISE + Either cfg.resolution or cfg.template needs to be defined; if both are defined, cfg.template prevails. + + BASEDONMRI - makes a segmentation of the individual anatomical MRI and places + sources in the grey matter. It uses the following configuration options: + cfg.mri = can be filename, MRI structure or segmented MRI structure + cfg.threshold = 0.1, relative to the maximum value in the segmentation + cfg.smooth = 5, smoothing in voxels + + BASEDONCORTEX - places sources on the vertices of a cortical surface description + cfg.headshape = string, should be a *.fif file + + BASEDONCENTROIDS - places sources on the centroids of a volumetric mesh + cfg.headmodel = tetrahedral or hexahedral mesh + cfg.headmodel.type = 'simbio' + + Other configuration options include + cfg.unit = string, can be 'mm', 'cm', 'm' (default is automatic, based on the input data) + cfg.tight = 'yes' or 'no' (default is automatic) + cfg.inwardshift = number, amount to shift the innermost surface of the headmodel inward when determining + whether sources are inside or outside the source compartment (default = 0) + cfg.moveinward = number, amount to move sources inward to ensure a certain minimal distance to the innermost + surface of the headmodel (default = 0) + cfg.movetocentroids = 'yes' or 'no', move the dipoles to the centroids of the hexahedral + or tetrahedral mesh (default = 'no') + cfg.spherify = 'yes' or 'no', scale the source model so that it fits inside a sperical + volume conduction model (default = 'no') + cfg.symmetry = 'x', 'y' or 'z' symmetry for two dipoles, can be empty (default = []) + cfg.headshape = a filename for the headshape, a structure containing a single surface, + or a Nx3 matrix with headshape surface points (default = []) + cfg.spmversion = string, 'spm2', 'spm8', 'spm12' (default = 'spm12') + + The EEG or MEG sensor positions can be present in the data or can be specified as + cfg.elec = structure with electrode positions or filename, see FT_READ_SENS + cfg.grad = structure with gradiometer definition or filename, see FT_READ_SENS + + The headmodel or volume conduction model can be specified as + cfg.headmodel = structure with volume conduction model or filename, see FT_PREPARE_HEADMODEL + + The cfg.inwardshift option can be used for 3D grids to specify a positive (inward) + or negative (outward) number to shift the innermost surface of the headmodel + (usually the skull) when determining whether sources are to be flagged as inside or + outside the source compartment. Only sources flagged as inside will be considered + for subsequent source reconstructions. An ourward shift can be useful for a + spherical or singleshell MEG headmodel. For a source model based on a cortical + sheet in general you want all sources to be considered inside. For a BEM headmodel + (EEG or MEG), there should never be any sources outside the actual source + compartment. + + The cfg.moveinward option can be used for a source model based on a cortical sheet + to push the sources inward a little bit to ensure sufficient distance to the + innermost surface of a BEM headmodel (EEG or MEG). + + See also FT_PREPARE_LEADFIELD, FT_PREPARE_HEADMODEL, FT_SOURCEANALYSIS, + FT_DIPOLEFITTING, FT_MEGREALIGN + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_prepare_sourcemodel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_prepare_sourcemodel", *args, **kwargs) diff --git a/fieldtrip/ft_preprocessing.py b/fieldtrip/ft_preprocessing.py new file mode 100644 index 0000000..acf447c --- /dev/null +++ b/fieldtrip/ft_preprocessing.py @@ -0,0 +1,160 @@ +from fieldtrip._runtime import Runtime + + +def ft_preprocessing(*args, **kwargs): + """ + FT_PREPROCESSING reads MEG and/or EEG data according to user-specified trials + and applies several user-specified preprocessing steps to the signals. + + Use as + [data] = ft_preprocessing(cfg) + or + [data] = ft_preprocessing(cfg, data) + + The first input argument "cfg" is the configuration structure, which contains all + details for the dataset filename, trials and the preprocessing options. + + If you are calling FT_PREPROCESSING with only the configuration as first input + argument and the data still has to be read from file, you should specify + cfg.dataset = string with the filename + cfg.trl = Nx3 matrix with the trial definition, see FT_DEFINETRIAL + cfg.padding = length (in seconds) to which the trials are padded for filtering (default = 0) + cfg.padtype = string, type of padding (default: 'data' padding or + 'mirror', depending on feasibility) + cfg.continuous = 'yes' or 'no' whether the file contains continuous data + (default is determined automatic) + + Instead of specifying the dataset in the configuration, you can also explicitly + specify the name of the file containing the header information and the name of the + file containing the data, using + cfg.datafile = string with the filename + cfg.headerfile = string with the filename + + If you are calling FT_PREPROCESSING with the second input argument "data", then + that should contain data that was already read from file in a previous call to + FT_PREPROCESSING. In that case only the configuration options below apply. + + The channels that will be read and/or preprocessed are specified with + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), + see FT_CHANNELSELECTION for details + cfg.chantype = string or Nx1 cell-array with channel types to be read (only for NeuroOmega) + + The preprocessing options for the selected channels are specified with + cfg.lpfilter = 'no' or 'yes' lowpass filter (default = 'no') + cfg.hpfilter = 'no' or 'yes' highpass filter (default = 'no') + cfg.bpfilter = 'no' or 'yes' bandpass filter (default = 'no') + cfg.bsfilter = 'no' or 'yes' bandstop filter (default = 'no') + cfg.dftfilter = 'no' or 'yes' line noise removal using discrete fourier transform (default = 'no') + cfg.medianfilter = 'no' or 'yes' jump preserving median filter (default = 'no') + cfg.lpfreq = lowpass frequency in Hz + cfg.hpfreq = highpass frequency in Hz + cfg.bpfreq = bandpass frequency range, specified as [lowFreq highFreq] in Hz + cfg.bsfreq = bandstop frequency range, specified as [low high] in Hz (or as Nx2 matrix for notch filter) + cfg.dftfreq = line noise frequencies in Hz for DFT filter (default = [50 100 150]) + cfg.lpfiltord = lowpass filter order (default set in low-level function) + cfg.hpfiltord = highpass filter order (default set in low-level function) + cfg.bpfiltord = bandpass filter order (default set in low-level function) + cfg.bsfiltord = bandstop filter order (default set in low-level function) + cfg.lpfilttype = digital filter type, 'but' or 'firws' or 'fir' or 'firls' (default = 'but') + cfg.hpfilttype = digital filter type, 'but' or 'firws' or 'fir' or 'firls' (default = 'but') + cfg.bpfilttype = digital filter type, 'but' or 'firws' or 'fir' or 'firls' (default = 'but') + cfg.bsfilttype = digital filter type, 'but' or 'firws' or 'fir' or 'firls' (default = 'but') + cfg.lpfiltdir = filter direction, 'twopass' (default), 'onepass' or 'onepass-reverse' or 'onepass-zerophase' (default for firws) or 'onepass-minphase' (firws, non-linear!) + cfg.hpfiltdir = filter direction, 'twopass' (default), 'onepass' or 'onepass-reverse' or 'onepass-zerophase' (default for firws) or 'onepass-minphase' (firws, non-linear!) + cfg.bpfiltdir = filter direction, 'twopass' (default), 'onepass' or 'onepass-reverse' or 'onepass-zerophase' (default for firws) or 'onepass-minphase' (firws, non-linear!) + cfg.bsfiltdir = filter direction, 'twopass' (default), 'onepass' or 'onepass-reverse' or 'onepass-zerophase' (default for firws) or 'onepass-minphase' (firws, non-linear!) + cfg.lpinstabilityfix = deal with filter instability, 'no', 'reduce', 'split' (default = 'no') + cfg.hpinstabilityfix = deal with filter instability, 'no', 'reduce', 'split' (default = 'no') + cfg.bpinstabilityfix = deal with filter instability, 'no', 'reduce', 'split' (default = 'no') + cfg.bsinstabilityfix = deal with filter instability, 'no', 'reduce', 'split' (default = 'no') + cfg.lpfiltdf = lowpass transition width (firws, overrides order, default set in low-level function) + cfg.hpfiltdf = highpass transition width (firws, overrides order, default set in low-level function) + cfg.bpfiltdf = bandpass transition width (firws, overrides order, default set in low-level function) + cfg.bsfiltdf = bandstop transition width (firws, overrides order, default set in low-level function) + cfg.lpfiltwintype = lowpass window type, 'hann' or 'hamming' (default) or 'blackman' or 'kaiser' (firws) + cfg.hpfiltwintype = highpass window type, 'hann' or 'hamming' (default) or 'blackman' or 'kaiser' (firws) + cfg.bpfiltwintype = bandpass window type, 'hann' or 'hamming' (default) or 'blackman' or 'kaiser' (firws) + cfg.bsfiltwintype = bandstop window type, 'hann' or 'hamming' (default) or 'blackman' or 'kaiser' (firws) + cfg.lpfiltdev = lowpass max passband deviation (firws with 'kaiser' window, default 0.001 set in low-level function) + cfg.hpfiltdev = highpass max passband deviation (firws with 'kaiser' window, default 0.001 set in low-level function) + cfg.bpfiltdev = bandpass max passband deviation (firws with 'kaiser' window, default 0.001 set in low-level function) + cfg.bsfiltdev = bandstop max passband deviation (firws with 'kaiser' window, default 0.001 set in low-level function) + cfg.dftreplace = 'zero' or 'neighbour', method used to reduce line noise, 'zero' implies DFT filter, 'neighbour' implies spectrum interpolation (default = 'zero') + cfg.dftbandwidth = bandwidth of line noise frequencies, applies to spectrum interpolation, in Hz (default = [1 2 3]) + cfg.dftneighbourwidth = bandwidth of frequencies neighbouring line noise frequencies, applies to spectrum interpolation, in Hz (default = [2 2 2]) + cfg.plotfiltresp = 'no' or 'yes', plot filter responses (firws, default = 'no') + cfg.usefftfilt = 'no' or 'yes', use fftfilt instead of filter (firws, default = 'no') + cfg.medianfiltord = length of median filter (default = 9) + cfg.demean = 'no' or 'yes', whether to apply baseline correction (default = 'no') + cfg.baselinewindow = [begin end] in seconds, the default is the complete trial (default = 'all') + cfg.detrend = 'no' or 'yes', remove linear trend from the data (done per trial) (default = 'no') + cfg.polyremoval = 'no' or 'yes', remove higher order trend from the data (done per trial) (default = 'no') + cfg.polyorder = polynome order for poly trend removal (default = 2; note that all lower-order trends will also be removed when using cfg.polyremoval) + cfg.derivative = 'no' or 'yes', computes the first order derivative of the data (default = 'no') + cfg.hilbert = 'no', 'abs', 'complex', 'real', 'imag', 'absreal', 'absimag' or 'angle' (default = 'no') + cfg.rectify = 'no' or 'yes' (default = 'no') + cfg.precision = 'single' or 'double' (default = 'double') + cfg.absdiff = 'no' or 'yes', computes absolute derivative (i.e. first derivative then rectify) + + Preprocessing options that only apply to MEG data are + cfg.coordsys = string, 'head' or 'dewar' (default = 'head') + cfg.coilaccuracy = can be empty or a number (0, 1 or 2) to specify the accuracy (default = []) + cfg.coildeffile = can be empty or a string to a custom coil_def.dat file (default = []) + + Preprocessing options that you should only use for EEG data are + cfg.reref = 'no' or 'yes' (default = 'no') + cfg.refchannel = cell-array with new EEG reference channel(s), this can be 'all' for a common average reference + cfg.refmethod = 'avg', 'median', 'rest', 'bipolar' or 'laplace' (default = 'avg') + cfg.groupchans = 'yes' or 'no', should channels be rereferenced in separate groups for bipolar and laplace methods, + this requires channnels to be named using an alphanumeric code, where letters represent the group + and numbers represent the order of the channel whithin its group (default = 'no') + cfg.leadfield = leadfield structure, this is required when cfg.refmethod='rest', see FT_PREPARE_LEADFIELD + cfg.implicitref = 'label' or empty, add the implicit EEG reference as zeros (default = []) + cfg.montage = 'no' or a montage structure, see FT_APPLY_MONTAGE (default = 'no') + + Preprocessing options that you should only use when you are calling FT_PREPROCESSING with + also the second input argument "data" are + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + + Preprocessing options that you should only use when you are calling + FT_PREPROCESSING with a single cfg input argument are + cfg.method = 'trial' or 'channel', read data per trial or per channel (default = 'trial') + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_DEFINETRIAL, FT_REDEFINETRIAL, FT_APPENDDATA, FT_APPENDSPIKE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_preprocessing.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_preprocessing", *args, **kwargs) diff --git a/fieldtrip/ft_recodeevent.py b/fieldtrip/ft_recodeevent.py new file mode 100644 index 0000000..b924518 --- /dev/null +++ b/fieldtrip/ft_recodeevent.py @@ -0,0 +1,82 @@ +from fieldtrip._runtime import Runtime + + +def ft_recodeevent(*args, **kwargs): + """ + FT_RECODEEVENT will recode the event structure, given the trial + definition that was analyzed + + In FieldTrip, you always start with defining a "trl" field containing + the samples in the raw datafile that you want to analyze. That "trl" + is based on the events in the dataset. After artifact rejection, it may + be the case that trials have been removed completely, or that trials + have been cut into pieces. This complicates finding a match between the + original events and the pieces of data that are analyzed. This functino + restores that match. + + Use as + [ev] = ft_recodeevent(cfg, data) + where cfg is a structure with configuration settings and data contains the + (nested) configuration that describes the original trial definition and + event structure. + + Alternatively, you can also specify the event structure and trial definition + yourself with + [ev] = ft_recodeevent(cfg, event, trl) + + the configuration can contain + cfg.eventtype = empty, 'string' or cell-array with multiple strings + cfg.eventvalue = empty or a list of event values (can be numeric or string) + + cfg.searchrange = 'anywhere' search anywhere for the event, (default) + 'insidetrial' only search inside + 'outsidetrial' only search outside + 'beforetrial' only search before the trial + 'aftertrial' only search after the trial + 'beforezero' only search before time t=0 of each trial + 'afterzero' only search after time t=0 of each trial + + cfg.nearestto = 'trialzero' compare with time t=0 for each trial (default) + 'trialbegin' compare with the begin of each trial + 'trialend' compare with the end of each trial + + cfg.match = 'exact' or 'nearest' + + cfg.output = 'event' the event itself + 'eventvalue' the value of the event + 'eventnumber' the number of the event + 'samplenumber' the sample at which the event is located + 'samplefromoffset' number of samples from t=0 (c.f. response time) + 'samplefrombegin' number of samples from the begin of the trial + 'samplefromend' number of samples from the end of the trial + + See also FT_DEFINETRIAL, FT_REDEFINETRIAL, FT_PREPROCESSING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_recodeevent.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_recodeevent", *args, **kwargs) diff --git a/fieldtrip/ft_redefinetrial.py b/fieldtrip/ft_redefinetrial.py new file mode 100644 index 0000000..51940a4 --- /dev/null +++ b/fieldtrip/ft_redefinetrial.py @@ -0,0 +1,111 @@ +from fieldtrip._runtime import Runtime + + +def ft_redefinetrial(*args, **kwargs): + """ + FT_REDEFINETRIAL allows you to adjust the time axis of your data, i.e. to + change from stimulus-locked to response-locked. Furthermore, it allows + you to select a time window of interest, or to resegment your long trials + into shorter fragments. + + Use as + [data] = ft_redefinetrial(cfg, data) + where the input data should correspond to the output of FT_PREPROCESSING and the + configuration should be specified as explained below. Note that some options are + mutually exclusive. If you want to use both, you neew two calls to this function + to avoid confusion about the order in which they are applied. + + For selecting a subset of trials you can specify + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + + For selecting trials with a minimum length you can specify + cfg.minlength = length in seconds, can be 'maxperlen' (default = []) + + For realiging the time axes of all trials to a new reference time + point (i.e. change the definition for t=0) you can use the following + configuration option + cfg.offset = single number or Nx1 vector, by how many samples should the + time axes be shifted. i.e. if you want t=1 to be the new t=0, + set cfg.offset = -1*Fs (Fs is the sampling frequency in Hz). + If cfg.trials is defined, N must be equal to the original + number of trials or to the number of selected trials. + + For selecting a specific subsection within trials (i.e. cut out a time window + of interest) you can use the following configuration option + cfg.toilim = [tmin tmax], latency window in seconds, can be + Nx2 vector. If cfg.trials is defined, N must be equal + to the original number of trials or to the number of + selected trials. + + Alternatively you can specify the begin and end sample in each trial + cfg.begsample = single number or Nx1 vector, expressed in samples relative + to the start of the input trial. If cfg.trials is defined, + N must be equal to the original number of trials or to the + number of selected trials. + cfg.endsample = single number or Nx1 vector, expressed in samples relative + to the start of the input trial. If cfg.trials is defined, + N must be equal to the original number of trials or to the + number of selected trials. + + Alternatively you can specify a new trial definition, expressed in + samples relative to the original recording + cfg.trl = Nx3 matrix with the trial definition, see FT_DEFINETRIAL + + Alternatively you can specify the data to be cut into (non-)overlapping + segments, starting from the beginning of each trial. This may lead to loss + of data at the end of the trials + cfg.length = number (in seconds) that specifies the length of the required snippets + cfg.overlap = number between 0 and 1 (exclusive) specifying the fraction of overlap + between snippets (0 = no overlap) + cfg.updatetrialinfo = 'no' (default), or 'yes', which adds a column + with original trial indices trialinfo + cfg.keeppartial = 'no' (default), or 'yes', which keeps the partial sub + epochs at the end of the input trials + + + Alternatively you can merge or stitch pseudo-continuous segmented data back into a + continuous representation. This requires that the data has a valid sampleinfo field + and that there are no jumps in the signal in subsequent trials (e.g. due to + filtering or demeaning). If there are missing segments (e.g. due to artifact + rejection), the output data will have one trial for each section where the data is + continuous. + cfg.continuous = 'yes' + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_DEFINETRIAL, FT_RECODEEVENT, FT_PREPROCESSING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_redefinetrial.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_redefinetrial", *args, **kwargs) diff --git a/fieldtrip/ft_regressconfound.py b/fieldtrip/ft_regressconfound.py new file mode 100644 index 0000000..d393ed1 --- /dev/null +++ b/fieldtrip/ft_regressconfound.py @@ -0,0 +1,74 @@ +from fieldtrip._runtime import Runtime + + +def ft_regressconfound(*args, **kwargs): + """ + FT_REGRESSCONFOUND estimates the regression weight of a set of confounds + using a General Linear Model (GLM) and removes the estimated contribution + from the single-trial data. + + Use as + timelock = ft_regressconfound(cfg, timelock) + or as + freq = ft_regressconfound(cfg, freq) + or as + source = ft_regressconfound(cfg, source) + + where timelock, freq, or, source come from FT_TIMELOCKANALYSIS, + FT_FREQANALYSIS, or FT_SOURCEANALYSIS respectively, with keeptrials = 'yes' + + The cfg argument is a structure that should contain + cfg.confound = matrix, [Ntrials X Nconfounds], may not contain NaNs + + The following configuration options are supported: + cfg.reject = vector, [1 X Nconfounds], listing the confounds that + are to be rejected (default = 'all') + cfg.normalize = string, 'yes' or 'no', normalizing confounds (default = 'yes') + cfg.output = 'residual' (default), 'beta', or 'model'. + If 'residual' is specified, the output is a data + structure containing the residuals after regressing + out the in cfg.reject listed confounds. If 'beta' or 'model' + is specified, the output is a data structure containing + the regression weights or the model, respectively. + + This method is described by Stolk et al., Online and offline tools for head + movement compensation in MEG (Neuroimage, 2013) + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_REJECTCOMPONENT, FT_REJECTARTIFACT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_regressconfound.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_regressconfound", *args, **kwargs) diff --git a/fieldtrip/ft_rejectartifact.py b/fieldtrip/ft_rejectartifact.py new file mode 100644 index 0000000..d310a1f --- /dev/null +++ b/fieldtrip/ft_rejectartifact.py @@ -0,0 +1,85 @@ +from fieldtrip._runtime import Runtime + + +def ft_rejectartifact(*args, **kwargs): + """ + FT_REJECTARTIFACT removes data segments containing artifacts. It returns a + configuration structure with a modified trial definition which can be used for + preprocessing of only the clean data. + + You should start by detecting the artifacts in the data using the function + FT_ARTIFACT_xxx where xxx is the type of artifact. Subsequently FT_REJECTARTIFACT + looks at the detected artifacts and removes them from the trial definition or from + the data. In case you wish to replace bad parts by NaNs, you have to specify data + as an input parameter. + + Use as + [cfg] = ft_rejectartifact(cfg) + with the cfg as obtained from FT_DEFINETRIAL, or as + [data] = ft_rejectartifact(cfg, data) + with the data as obtained from FT_PREPROCESSING + + The following configuration options are supported + cfg.artfctdef.reject = 'none', 'partial', 'complete', 'nan', 'zero', or 'value' (default = 'complete') + cfg.artfctdef.minaccepttim = when using partial rejection, minimum length + in seconds of remaining trial (default = 0.1) + cfg.artfctdef.crittoilim = when using complete rejection, reject trial only when artifacts occur within + this time window (default = whole trial). This only works with in-memory data, + since trial time axes are unknown for data on disk. + cfg.artfctdef.feedback = 'yes' or 'no' (default = 'no') + cfg.artfctdef.invert = 'yes' or 'no' (default = 'no') + cfg.artfctdef.value = scalar value to replace the data in the artifact segments (default = nan) + cfg.artfctdef.eog.artifact = Nx2 matrix with artifact segments, this is added to the cfg by using FT_ARTIFACT_EOG + cfg.artfctdef.jump.artifact = Nx2 matrix with artifact segments, this is added to the cfg by using FT_ARTIFACT_JUMP + cfg.artfctdef.muscle.artifact = Nx2 matrix with artifact segments, this is added to the cfg by using FT_ARTIFACT_MUSCLE + cfg.artfctdef.zvalue.artifact = Nx2 matrix with artifact segments, this is added to the cfg by using FT_ARTIFACT_ZVALUE + cfg.artfctdef.visual.artifact = Nx2 matrix with artifact segments, this is added to the cfg by using FT_DATABROWSER + cfg.artfctdef.xxx.artifact = Nx2 matrix with artifact segments, this could be added by your own artifact detection function + + A trial that contains an artifact can be rejected completely or partially. In case + of partial rejection, a minimum length of the resulting sub-trials can be specified + using minaccepttim. + + Output: + If cfg is the only input parameter, the output is a cfg structure with an updated trl. + If cfg and data are both input parameters, the output is an updated raw data structure with only the clean data segments. + If cfg and data are both input parameters, and the cfg contains a trl field, an error is thrown. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + If you specify this option the input data will be read from a *.mat + file on disk. This mat files should contain only a single variable named 'data', + corresponding to the input structure. + + See also FT_ARTIFACT_ZVALUE, FT_ARTIFACT_EOG, FT_ARTIFACT_MUSCLE, FT_ARTIFACT_JUMP, + FT_ARTIFACT_THRESHOLD, FT_ARTIFACT_CLIP, FT_ARTIFACT_ECG, FT_DATABROWSER, + FT_REJECTVISUAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_rejectartifact.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_rejectartifact", *args, **kwargs) diff --git a/fieldtrip/ft_rejectcomponent.py b/fieldtrip/ft_rejectcomponent.py new file mode 100644 index 0000000..519a5c3 --- /dev/null +++ b/fieldtrip/ft_rejectcomponent.py @@ -0,0 +1,68 @@ +from fieldtrip._runtime import Runtime + + +def ft_rejectcomponent(*args, **kwargs): + """ + FT_REJECTCOMPONENT backprojects an ICA (or similar) decomposition to the + channel level after removing the independent components that contain + the artifacts. This function does not automatically detect the artifact + components, you will have to do that yourself. + + Use as + [data] = ft_rejectcomponent(cfg, comp) + or as + [data] = ft_rejectcomponent(cfg, comp, data) + + where the input comp is the result of FT_COMPONENTANALYSIS. The output + data will have the same format as the output of FT_PREPROCESSING. + + An optional input argument data can be provided. In that case + componentanalysis will do a subspace projection of the input data + onto the space which is spanned by the topographies in the unmixing + matrix in comp, after removal of the artifact components. Please use + this option of including data as input, if you wish to use the output + data.grad in further computation, for example for leadfield computation. + + The configuration structure can contain + cfg.component = list of components to remove, e.g. [1 4 7] or see FT_CHANNELSELECTION + cfg.demean = 'no' or 'yes', whether to demean the input data (default = 'yes') + cfg.updatesens = 'yes' or 'no', whether to update the sensor array with the spatial projector (default = 'yes') + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_COMPONENTANALYSIS, FT_PREPROCESSING + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_rejectcomponent.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_rejectcomponent", *args, **kwargs) diff --git a/fieldtrip/ft_rejectvisual.py b/fieldtrip/ft_rejectvisual.py new file mode 100644 index 0000000..f095891 --- /dev/null +++ b/fieldtrip/ft_rejectvisual.py @@ -0,0 +1,127 @@ +from fieldtrip._runtime import Runtime + + +def ft_rejectvisual(*args, **kwargs): + """ + FT_REJECTVISUAL shows the preprocessed data in all channels and/or trials to allow + the user to make a visual selection of the data that should be rejected. The data + can be displayed in a "summary" mode, in which case the variance (or another + metric) in each channel and each trial is computed. Alternatively, all channels can + be shown at once allowing paging through the trials, or all trials can be shown, + allowing paging through the channels. + + Use as + [data] = ft_rejectvisual(cfg, data) + + The configuration can contain + cfg.method = string, describes how the data should be shown, this can be + 'summary' show a single number for each channel and trial (default) + 'channel' show the data per channel, all trials at once + 'trial' show the data per trial, all channels at once + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION for details + cfg.keepchannel = string, determines how to deal with channels that are not selected, can be + 'no' completely remove deselected channels from the data (default) + 'yes' keep deselected channels in the output data + 'nan' fill the channels that are deselected with NaNs + 'zero' fill the channels that are deselected with zeros + 'repair' repair the deselected channels using FT_CHANNELREPAIR + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.keeptrial = string, determines how to deal with trials that are + not selected, can be + 'no' completely remove deselected trials from the data (default) + 'yes' keep deselected trials in the output data + 'nan' fill the trials that are deselected with NaNs + 'zero' fill the trials that are deselected with zeros + cfg.metric = string, describes the metric that should be computed in summary mode + for each channel in each trial, can be + 'var' variance within each channel (default) + 'std' standard deviation within each channel + 'db' decibel value within each channel + 'mad' median absolute deviation within each channel + '1/var' inverse variance within each channel + 'min' minimum value in each channel + 'max' maximum value each channel + 'maxabs' maximum absolute value in each channel + 'range' range from min to max in each channel + 'kurtosis' kurtosis, i.e. measure of peakedness of the amplitude distribution + 'zvalue' mean and std computed over all time and trials, per channel + 'neighbexpvar' relative variance explained by neighboring channels in each trial + cfg.neighbours = neighbourhood structure, see FT_PREPARE_NEIGHBOURS for details + cfg.latency = [begin end] in seconds, or 'all', 'minperiod', 'maxperiod', 'prestim', 'poststim' (default = 'all') + cfg.viewmode = 'remove', 'toggle' or 'hide', only applies to summary mode (default = 'remove') + cfg.box = string, 'yes' or 'no' whether to draw a box around each graph (default = 'no') + cfg.ylim = 'maxmin', 'maxabs', 'zeromax', 'minzero', or [ymin ymax] (default = 'maxmin') + + The following options for the scaling of the EEG, EOG, ECG, EMG, MEG and NIRS channels + is optional and can be used to bring the absolute numbers of the different + channel types in the same range (e.g. fT and uV). The channel types are determined + from the input data using FT_CHANNELSELECTION. + cfg.eegscale = number, scaling to apply to the EEG channels prior to display + cfg.eogscale = number, scaling to apply to the EOG channels prior to display + cfg.ecgscale = number, scaling to apply to the ECG channels prior to display + cfg.emgscale = number, scaling to apply to the EMG channels prior to display + cfg.megscale = number, scaling to apply to the MEG channels prior to display + cfg.gradscale = number, scaling to apply to the MEG gradiometer channels prior to display (in addition to the cfg.megscale factor) + cfg.magscale = number, scaling to apply to the MEG magnetometer channels prior to display (in addition to the cfg.megscale factor) + cfg.nirsscale = number, scaling to apply to the NIRS channels prior to display + cfg.mychanscale = number, scaling to apply to the channels specified in cfg.mychan + cfg.mychan = Nx1 cell-array with selection of channels + cfg.chanscale = Nx1 vector with scaling factors, one per channel specified in cfg.channel + + Optionally, the raw data is preprocessed (filtering etc.) prior to displaying it or + prior to computing the summary metric. The preprocessing and the selection of the + latency window is NOT applied to the output data. + + The following settings are useful for identifying EOG artifacts: + cfg.preproc.bpfilter = 'yes' + cfg.preproc.bpfilttype = 'but' + cfg.preproc.bpfreq = [1 15] + cfg.preproc.bpfiltord = 4 + cfg.preproc.rectify = 'yes' + + The following settings are useful for identifying muscle artifacts: + cfg.preproc.bpfilter = 'yes' + cfg.preproc.bpfreq = [110 140] + cfg.preproc.bpfiltord = 8 + cfg.preproc.bpfilttype = 'but' + cfg.preproc.rectify = 'yes' + cfg.preproc.boxcar = 0.2 + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_REJECTARTIFACT, FT_REJECTCOMPONENT, FT_BADSEGMENT, FT_BADCHANNEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_rejectvisual.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_rejectvisual", *args, **kwargs) diff --git a/fieldtrip/ft_removetemplateartifact.py b/fieldtrip/ft_removetemplateartifact.py new file mode 100644 index 0000000..b45fd37 --- /dev/null +++ b/fieldtrip/ft_removetemplateartifact.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def ft_removetemplateartifact(*args, **kwargs): + """ + FT_REMOVETEMPLATEARTIFACT removes an artifact from preprocessed data by template + subtraction. The template can for example be formed by averaging an ECG-triggered + MEG timecourse. + + Use as + dataclean = ft_removetemplateartifact(cfg, data, template) + where data is raw data as obtained from FT_PREPROCESSING and template is a averaged + timelock structure as obtained from FT_TIMELOCKANALYSIS. The configuration should + be according to + + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION for details + cfg.artifact = Mx2 matrix with sample numbers of the artifact segments, e.g. obtained from FT_ARTIFACT_EOG + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_ARTIFACT_ECG, FT_PREPROCESSING, FT_TIMELOCKANALYSIS, FT_REJECTCOMPONENT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_removetemplateartifact.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_removetemplateartifact", *args, **kwargs) diff --git a/fieldtrip/ft_reproducescript.py b/fieldtrip/ft_reproducescript.py new file mode 100644 index 0000000..19a2103 --- /dev/null +++ b/fieldtrip/ft_reproducescript.py @@ -0,0 +1,47 @@ +from fieldtrip._runtime import Runtime + + +def ft_reproducescript(*args, **kwargs): + """ + FT_REPRODUCESCRIPT is a helper function to clean up the script and intermediate + datafiles that are the result from using the cfg.reproducescript option. You should + call this function all the way at the end of your analysis. This function will look + at all intermediate files in the output directory, remove input and output files + that are the same and update the script accordingly. + + Use as + ft_reproducescript(cfg) + + The configuration structure should contain + cfg.reproducescript = string, directory with the script and intermediate data + + See also FT_ANALYSISPIPELINE, FT_DEFAULTS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_reproducescript.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_reproducescript", *args, **kwargs, nargout=0) diff --git a/fieldtrip/ft_resampledata.py b/fieldtrip/ft_resampledata.py new file mode 100644 index 0000000..e9e31d6 --- /dev/null +++ b/fieldtrip/ft_resampledata.py @@ -0,0 +1,86 @@ +from fieldtrip._runtime import Runtime + + +def ft_resampledata(*args, **kwargs): + """ + FT_RESAMPLEDATA performs a resampling or downsampling of the data to a specified + new sampling frequency, or an inperpolation of the data measured with one sampling + frequency to another. The latter is useful when merging data measured on two + different acquisition devices, or when the samples in two recordings are slightly + shifted. + + Use as + [data] = ft_resampledata(cfg, data) + + The data should be organised in a structure as obtained from the FT_PREPROCESSING + function. The configuration should contain + cfg.resamplefs = frequency at which the data will be resampled + cfg.method = resampling method, see RESAMPLE, DOWNSAMPLE, DECIMATE (default = 'resample') + cfg.detrend = 'no' or 'yes', detrend the data prior to resampling (no default specified, see below) + cfg.demean = 'no' or 'yes', whether to apply baseline correction (default = 'no') + cfg.baselinewindow = [begin end] in seconds, the default is the complete trial (default = 'all') + cfg.feedback = 'no', 'text', 'textbar', 'gui' (default = 'text') + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.sampleindex = 'no' or 'yes', add a channel with the original sample indices (default = 'no') + + Rather than resapling to a specific sampling frequency, you can also specify a time + axis on which you want the data to be resampled. This is useful for merging data + from two acquisition devices, after resampledata you can call FT_APPENDDATA to + concatenate the channels from the different acquisition devices. + cfg.time = cell-array with one time axis per trial (i.e., from another dataset) + cfg.method = interpolation method, see INTERP1 (default = 'pchip') + cfg.extrapval = extrapolation behaviour, scalar value or 'extrap' (default is as in INTERP1) + + The default method is 'resample' when you specify cfg.resamplefs, and 'pchip' when + you specify cfg.time. + + The methods 'resample' and 'decimate' automatically apply an anti-aliasing low-pass + filter. You can also explicitly specify an anti-aliasing low pass filter. This is + particularly adviced when downsampling using the 'downsample' method, but also when + strong noise components are present just above the new Nyquist frequency. + cfg.lpfilter = 'yes' or 'no' (default = 'no') + cfg.lpfreq = scalar value for low pass frequency (there is no default, so needs to be always specified) + cfg.lpfilttype = string, filter type (default is set in ft_preproc_lowpassfilter) + cfg.lpfiltord = scalar, filter order (default is set in ft_preproc_lowpassfilter) + + More documentation about anti-alias filtering can be found in this FAQ on the FieldTrip website. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_PREPROCESSING, FT_APPENDDATA, FT_PREPROC_LOWPASSFILTER, RESAMPLE, DOWNSAMPLE, DECIMATE, INTERP1 + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_resampledata.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_resampledata", *args, **kwargs) diff --git a/fieldtrip/ft_respiration.py b/fieldtrip/ft_respiration.py new file mode 100644 index 0000000..ffa109a --- /dev/null +++ b/fieldtrip/ft_respiration.py @@ -0,0 +1,52 @@ +from fieldtrip._runtime import Runtime + + +def ft_respiration(*args, **kwargs): + """ + FT_RESPIRATION estimates the respiration rate from a respiration belt, temperature + sensor, movement sensor or from the heart rate. It returns a new data structure + with a continuous representation of the rate and phase. + + Use as + dataout = ft_respiration(cfg, data) + where the input data is a structure as obtained from FT_PREPROCESSING. + + The configuration structure has the following options + cfg.channel = selected channel for processing, see FT_CHANNELSELECTION + cfg.peakseparation = scalar, time in seconds + cfg.envelopewindow = scalar, time in seconds + cfg.feedback = 'yes' or 'no' + The input data can be preprocessed on the fly using + cfg.preproc.bpfilter = 'yes' or 'no' (default = 'yes') + cfg.preproc.bpfreq = [low high], filter frequency in Hz + + See also FT_HEARTRATE, FT_ELECTRODERMALACTIVITY, FT_HEADMOVEMENT, FT_REGRESSCONFOUND + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_respiration.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_respiration", *args, **kwargs) diff --git a/fieldtrip/ft_scalpcurrentdensity.py b/fieldtrip/ft_scalpcurrentdensity.py new file mode 100644 index 0000000..5927c6e --- /dev/null +++ b/fieldtrip/ft_scalpcurrentdensity.py @@ -0,0 +1,112 @@ +from fieldtrip._runtime import Runtime + + +def ft_scalpcurrentdensity(*args, **kwargs): + """ + FT_SCALPCURRENTDENSITY computes an estimate of the SCD using the + second-order derivative (the surface Laplacian) of the EEG potential + distribution + + The relation between the surface Laplacian and the SCD is explained + in more detail on http://tinyurl.com/ptovowl. + + Use as + [data] = ft_scalpcurrentdensity(cfg, data) + or + [timelock] = ft_scalpcurrentdensity(cfg, timelock) + where the input data is obtained from FT_PREPROCESSING or from + FT_TIMELOCKANALYSIS. The output data has the same format as the input + and can be used in combination with most other FieldTrip functions + such as FT_FREQANALYSIS or FT_TOPOPLOTER. + + The configuration should contain + cfg.method = 'finite' for finite-difference method or + 'spline' for spherical spline method + 'hjorth' for Hjorth approximation method + cfg.elec = structure with electrode positions or filename, see FT_READ_SENS + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.feedback = string, 'no', 'text', 'textbar', 'gui' (default = 'text') + + The finite method require the following + cfg.conductivity = conductivity of the scalp (default = 0.33 S/m) + + The spline and finite method require the following + cfg.conductivity = conductivity of the scalp (default = 0.33 S/m) + cfg.lambda = regularization parameter (default = 1e-05) + cfg.order = order of the splines (default = 4) + cfg.degree = degree of legendre polynomials (default for + <=32 electrodes = 9, + <=64 electrodes = 14, + <=128 electrodes = 20, + else = 32 + + The hjorth method requires the following + cfg.neighbours = neighbourhood structure, see FT_PREPARE_NEIGHBOURS + + For the spline method you can specify the following + cfg.badchannel = cell-array, see FT_CHANNELSELECTION for details (default = []) + + Note that the scalp conductivity, electrode dimensions and the potential + all have to be expressed in the same SI units, otherwise the units of + the SCD values are not scaled correctly. The spatial distribution still + will be correct. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + The 'finite' method implements + TF Oostendorp, A van Oosterom; The surface Laplacian of the potential: + theory and application. IEEE Trans Biomed Eng, 43(4): 394-405, 1996. + G Huiskamp; Difference formulas for the surface Laplacian on a + triangulated sphere. Journal of Computational Physics, 2(95): 477-496, + 1991. + + The 'spline' method implements + F. Perrin, J. Pernier, O. Bertrand, and J. F. Echallier. + Spherical splines for scalp potential and curernt density mapping. + Electroencephalogr Clin Neurophysiol, 72:184-187, 1989 + including their corrections in + F. Perrin, J. Pernier, O. Bertrand, and J. F. Echallier. + Corrigenda: EEG 02274, Electroencephalography and Clinical + Neurophysiology 76:565. + + The 'hjorth' method implements + B. Hjort; An on-line transformation of EEG scalp potentials into + orthogonal source derivation. Electroencephalography and Clinical + Neurophysiology 39:526-530, 1975. + + See also FT_PREPROCESSING, FT_TIMELOCKANALYSIS, FT_FREQNALYSIS, FT_TOPOPLOTER. + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_scalpcurrentdensity.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_scalpcurrentdensity", *args, **kwargs) diff --git a/fieldtrip/ft_singleplotER.py b/fieldtrip/ft_singleplotER.py new file mode 100644 index 0000000..dea4e30 --- /dev/null +++ b/fieldtrip/ft_singleplotER.py @@ -0,0 +1,131 @@ +from fieldtrip._runtime import Runtime + + +def ft_singleplotER(*args, **kwargs): + """ + FT_SINGLEPLOTER plots the event-related fields or potentials of a single + channel or the average over multiple channels. Multiple datasets can be + overlayed. + + Use as + ft_singleplotER(cfg, data) + or + ft_singleplotER(cfg, data1, data2, ..., datan) + + The data can be an erp/erf produced by FT_TIMELOCKANALYSIS, a power + spectrum or time-frequency respresentation produced by FT_FREQANALYSIS or + a connectivity spectrum produced by FT_CONNECTIVITYANALYSIS. + + The configuration can have the following parameters: + cfg.parameter = field to be plotted on y-axis, for example 'avg', 'powspctrm' or 'cohspctrm' (default is automatic) + cfg.maskparameter = field in the first dataset to be used for masking of data; this is not supported when + computing the mean over multiple channels, or when giving multiple input datasets (default = []) + cfg.maskstyle = style used for masking of data, 'box', 'thickness' or 'saturation' (default = 'box') + cfg.maskfacealpha = mask transparency value between 0 and 1 + cfg.xlim = 'maxmin' or [xmin xmax] (default = 'maxmin') + cfg.ylim = 'maxmin', 'maxabs', 'zeromax', 'minzero', or [ymin ymax] (default = 'maxmin') + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION for details + cfg.title = string, title of plot + cfg.showlegend = 'yes' or 'no', show the legend with the colors (default = 'no') + cfg.refchannel = name of reference channel for visualising connectivity, can be 'gui' + cfg.baseline = 'yes', 'no' or [time1 time2] (default = 'no'), see ft_timelockbaseline + cfg.baselinetype = 'absolute', 'relative', 'relchange', 'normchange', 'db', 'vssum' or 'zscore' (default = 'absolute'), only relevant for TFR data. + See ft_freqbaseline. + cfg.trials = 'all' or a selection given as a 1xn vector (default = 'all') + cfg.fontsize = font size of title (default = 8) + cfg.hotkeys = enables hotkeys (leftarrow/rightarrow/uparrow/downarrow/m) for dynamic zoom and translation (ctrl+) of the axes + cfg.interactive = interactive plot 'yes' or 'no' (default = 'yes') + in a interactive plot you can select areas and produce a new + interactive plot when a selected area is clicked. multiple areas + can be selected by holding down the shift key. + cfg.figure = 'yes' or 'no', whether to open a new figure. You can also specify a figure handle from FIGURE, GCF or SUBPLOT. (default = 'yes') + cfg.figurename = string, title of the figure window + cfg.position = location and size of the figure, specified as [left bottom width height] (default is automatic) + cfg.renderer = string, 'opengl', 'zbuffer', 'painters', see RENDERERINFO (default is automatic, try 'painters' when it crashes) + cfg.linestyle = linestyle/marker type, see options of the PLOT function (default = '-') + can be a single style for all datasets, or a cell-array containing one style for each dataset + cfg.linewidth = linewidth in points (default = 0.5) + cfg.linecolor = color(s) used for plotting the dataset(s). The default is defined in LINEATTRIBUTES_COMMON, see + the help of this function for more information + cfg.directionality = '', 'inflow' or 'outflow' specifies for + connectivity measures whether the inflow into a + node, or the outflow from a node is plotted. The + (default) behavior of this option depends on the dimor + of the input data (see below). + cfg.select = 'intersect' or 'union' (default = 'intersect') + with multiple input arguments determines the + pre-selection of the data that is considered for + plotting. + cfg.showlocations = 'no' (default), or 'yes'. plot a small spatial layout of all sensors, highlighting the specified subset + cfg.layouttopo = filename, or struct (see FT_PREPARE_LAYOUT) used for showing the locations with cfg.showlocations = 'yes' + + The following options for the scaling of the EEG, EOG, ECG, EMG, MEG and NIRS channels + is optional and can be used to bring the absolute numbers of the different + channel types in the same range (e.g. fT and uV). The channel types are determined + from the input data using FT_CHANNELSELECTION. + cfg.eegscale = number, scaling to apply to the EEG channels prior to display + cfg.eogscale = number, scaling to apply to the EOG channels prior to display + cfg.ecgscale = number, scaling to apply to the ECG channels prior to display + cfg.emgscale = number, scaling to apply to the EMG channels prior to display + cfg.megscale = number, scaling to apply to the MEG channels prior to display + cfg.gradscale = number, scaling to apply to the MEG gradiometer channels prior to display (in addition to the cfg.megscale factor) + cfg.magscale = number, scaling to apply to the MEG magnetometer channels prior to display (in addition to the cfg.megscale factor) + cfg.nirsscale = number, scaling to apply to the NIRS channels prior to display + cfg.mychanscale = number, scaling to apply to the channels specified in cfg.mychan + cfg.mychan = Nx1 cell-array with selection of channels + cfg.chanscale = Nx1 vector with scaling factors, one per channel specified in cfg.channel + + For the plotting of directional connectivity data the cfg.directionality + option determines what is plotted. The default value and the supported + functionality depend on the dimord of the input data. If the input data + is of dimord 'chan_chan_XXX', the value of directionality determines + whether, given the reference channel(s), the columns (inflow), or rows + (outflow) are selected for plotting. In this situation the default is + 'inflow'. Note that for undirected measures, inflow and outflow should + give the same output. If the input data is of dimord 'chancmb_XXX', the + value of directionality determines whether the rows in data.labelcmb are + selected. With 'inflow' the rows are selected if the refchannel(s) occur in + the right column, with 'outflow' the rows are selected if the + refchannel(s) occur in the left column of the labelcmb-field. Default in + this case is '', which means that all rows are selected in which the + refchannel(s) occur. This is to robustly support linearly indexed + undirected connectivity metrics. In the situation where undirected + connectivity measures are linearly indexed, specifying 'inflow' or + 'outflow' can result in unexpected behavior. + + to facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + if you specify this option the input data will be read from a *.mat + file on disk. this mat files should contain only a single variable named 'data', + corresponding to the input structure. + + See also FT_SINGLEPLOTTFR, FT_MULTIPLOTER, FT_MULTIPLOTTFR, FT_TOPOPLOTER, FT_TOPOPLOTTFR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_singleplotER.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_singleplotER", *args, **kwargs) diff --git a/fieldtrip/ft_singleplotTFR.py b/fieldtrip/ft_singleplotTFR.py new file mode 100644 index 0000000..593893c --- /dev/null +++ b/fieldtrip/ft_singleplotTFR.py @@ -0,0 +1,115 @@ +from fieldtrip._runtime import Runtime + + +def ft_singleplotTFR(*args, **kwargs): + """ + FT_SINGLEPLOTTFR plots the time-frequency representation of power of a + single channel or the average over multiple channels. + + Use as + ft_singleplotTFR(cfg,data) + + The input freq structure should be a a time-frequency representation of + power or coherence that was computed using the FT_FREQANALYSIS function. + + The configuration can have the following parameters: + cfg.parameter = field to be plotted on z-axis, e.g. 'powspctrm' (default depends on data.dimord) + cfg.maskparameter = field in the data to be used for masking of data, can be logical (e.g. significant data points) or numerical (e.g. t-values). + (not possible for mean over multiple channels, or when input contains multiple subjects + or trials) + cfg.maskstyle = style used to masking, 'opacity', 'saturation', or 'outline' (default = 'opacity') + 'outline' can only be used with a logical cfg.maskparameter + use 'saturation' or 'outline' when saving to vector-format (like *.eps) to avoid all sorts of image-problems + cfg.maskalpha = alpha value between 0 (transparent) and 1 (opaque) used for masking areas dictated by cfg.maskparameter (default = 1) + (will be ignored in case of numeric cfg.maskparameter or if cfg.maskstyle = 'outline') + cfg.masknans = 'yes' or 'no' (default = 'yes') + cfg.xlim = 'maxmin' or [xmin xmax] (default = 'maxmin') + cfg.ylim = 'maxmin' or [ymin ymax] (default = 'maxmin') + cfg.zlim = plotting limits for color dimension, 'maxmin', 'maxabs', 'zeromax', 'minzero', or [zmin zmax] (default = 'maxmin') + cfg.baseline = 'yes', 'no' or [time1 time2] (default = 'no'), see FT_FREQBASELINE + cfg.baselinetype = 'absolute', 'relative', 'relchange', 'normchange', 'db' or 'zscore' (default = 'absolute') + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), + see FT_CHANNELSELECTION for details + cfg.title = string, title of plot + cfg.refchannel = name of reference channel for visualising connectivity, can be 'gui' + cfg.fontsize = font size of title (default = 8) + cfg.hotkeys = enables hotkeys (leftarrow/rightarrow/uparrow/downarrow/pageup/pagedown/m) for dynamic zoom and translation (ctrl+) of the axes and color limits + cfg.colormap = string, or Nx3 matrix, see FT_COLORMAP + cfg.colorbar = 'yes', 'no' (default = 'yes') + cfg.colorbartext = string indicating the text next to colorbar + cfg.interactive = interactive plot 'yes' or 'no' (default = 'yes') + In a interactive plot you can select areas and produce a new + interactive plot when a selected area is clicked. Multiple areas + can be selected by holding down the SHIFT key. + cfg.position = location and size of the figure, specified as [left bottom width height] (default is automatic) + cfg.renderer = string, 'opengl', 'zbuffer', 'painters', see RENDERERINFO (default is automatic, try 'painters' when it crashes) + cfg.directionality = '', 'inflow' or 'outflow' specifies for + connectivity measures whether the inflow into a + node, or the outflow from a node is plotted. The + (default) behavior of this option depends on the dimor + of the input data (see below). + cfg.figure = 'yes', 'no', or 'subplot', whether to open a new figure. You can also specify a figure + handle from FIGURE, GCF or SUBPLOT. (default = 'yes'). With multiple data inputs, 'subplot' + will make subplots in a single figure. + cfg.figurename = string, title of the figure window + cfg.position = location and size of the figure, specified as [left bottom width height] (default is automatic) + cfg.renderer = string, 'opengl', 'zbuffer', 'painters', see RENDERERINFO (default is automatic, try 'painters' when it crashes) + + The following options for the scaling of the EEG, EOG, ECG, EMG, MEG and NIRS channels + is optional and can be used to bring the absolute numbers of the different + channel types in the same range (e.g. fT and uV). The channel types are determined + from the input data using FT_CHANNELSELECTION. + cfg.eegscale = number, scaling to apply to the EEG channels prior to display + cfg.eogscale = number, scaling to apply to the EOG channels prior to display + cfg.ecgscale = number, scaling to apply to the ECG channels prior to display + cfg.emgscale = number, scaling to apply to the EMG channels prior to display + cfg.megscale = number, scaling to apply to the MEG channels prior to display + cfg.gradscale = number, scaling to apply to the MEG gradiometer channels prior to display (in addition to the cfg.megscale factor) + cfg.magscale = number, scaling to apply to the MEG magnetometer channels prior to display (in addition to the cfg.megscale factor) + cfg.nirsscale = number, scaling to apply to the NIRS channels prior to display + cfg.mychanscale = number, scaling to apply to the channels specified in cfg.mychan + cfg.mychan = Nx1 cell-array with selection of channels + cfg.chanscale = Nx1 vector with scaling factors, one per channel specified in cfg.channel + + For the plotting of directional connectivity data the cfg.directionality option determines what is plotted. The default + value and the supported functionality depend on the dimord of the input data. If the input data is of dimord 'chan_chan_XXX', + the value of directionality determines whether, given the reference channel(s), the columns (inflow), or rows (outflow) are + selected for plotting. In this situation the default is 'inflow'. Note that for undirected measures, inflow and outflow should + give the same output. If the input data is of dimord 'chancmb_XXX', the value of directionality determines whether the rows in + data.labelcmb are selected. With 'inflow' the rows are selected if the refchannel(s) occur in the right column, with 'outflow' + the rows are selected if the refchannel(s) occur in the left column of the labelcmb-field. Default in this case is '', which + means that all rows are selected in which the refchannel(s) occur. This is to robustly support linearly indexed undirected + connectivity metrics. In the situation where undirected connectivity measures are linearly indexed, specifying 'inflow' or + outflow' can result in unexpected behavior. + + See also FT_SINGLEPLOTER, FT_MULTIPLOTER, FT_MULTIPLOTTFR, FT_TOPOPLOTER, FT_TOPOPLOTTFR + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_singleplotTFR.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_singleplotTFR", *args, **kwargs) diff --git a/fieldtrip/ft_sliceinterp.py b/fieldtrip/ft_sliceinterp.py new file mode 100644 index 0000000..d8825bc --- /dev/null +++ b/fieldtrip/ft_sliceinterp.py @@ -0,0 +1,111 @@ +from fieldtrip._runtime import Runtime + + +def ft_sliceinterp(*args, **kwargs): + """ + FT_SLICEINTERP plots a 2D-montage of source reconstruction and anatomical MRI + after these have been interpolated onto the same grid. + + Use as + ft_sliceinterp(cfg, interp) + or + [rgbimage] = ft_sliceinterp(cfg, interp), rgbimage is the monatage image + + where interp is the output of sourceinterpolate and cfg is a structure + with any of the following fields: + + cfg.funparameter = string with the functional parameter of interest (default = 'source') + cfg.maskparameter = parameter used as opacity mask (default = 'none') + cfg.clipmin = value or 'auto' (clipping of source data) + cfg.clipmax = value or 'auto' (clipping of source data) + cfg.clipsym = 'yes' or 'no' (default) symmetrical clipping + cfg.colormap = colormap for source overlay (default is jet(128)) + cfg.colmin = source value mapped to the lowest color (default = 'auto') + cfg.colmax = source value mapped to the highest color (default = 'auto') + cfg.maskclipmin = value or 'auto' (clipping of mask data) + cfg.maskclipmax = value or 'auto' (clipping of mask data) + cfg.maskclipsym = 'yes' or 'no' (default) symmetrical clipping + cfg.maskmap = opacitymap for source overlay (default is linspace(0,1,128)) + cfg.maskcolmin = mask value mapped to the lowest opacity, i.e. completely transparent (default ='auto') + cfg.maskcolmin = mask value mapped to the highest opacity, i.e. non-transparent (default = 'auto') + cfg.alpha = value between 0 and 1 or 'adaptive' (default) + cfg.nslices = integer value, default is 20 + cfg.dim = integer value, default is 3 (dimension to slice) + cfg.spacemin = 'auto' (default) or integer (first slice position) + cfg.spacemax = 'auto' (default) or integer (last slice position) + cfg.resample = integer value, default is 1 (for resolution reduction) + cfg.rotate = number of ccw 90 deg slice rotations (default = 0) + cfg.title = optional title (default is '') + cfg.whitebg = 'yes' or 'no' (default = 'yes') + cfg.flipdim = flip data along the sliced dimension, 'yes' or 'no' (default = 'no') + cfg.marker = [Nx3] array defining N marker positions to display + cfg.markersize = radius of markers (default = 5); + cfg.markercolor = [1x3] marker color in RGB (default = [1 1 1], i.e. white) + cfg.interactive = 'yes' or 'no' (default), interactive coordinates and source values + + if cfg.alpha is set to 'adaptive' the opacity of the source overlay + linearly follows the source value: maxima are opaque and minima are + transparent. + + if cfg.spacemin and/or cfg.spacemax are set to 'auto' the sliced + space is automatically restricted to the evaluated source-space + + if cfg.colmin and/or cfg.colmax are set to 'auto' the colormap is mapped + to source values the following way: if source values are either all + positive or all negative the colormap is mapped to from + min(source) to max(source). If source values are negative and positive + the colormap is symmetrical mapped around 0 from -max(abs(source)) to + +max(abs(source)). + + If cfg.maskparameter specifies a parameter to be used as an opacity mask + cfg.alpha is not used. Instead the mask values are maped to an opacitymap + that can be specified using cfg.maskmap. The mapping onto that + opacitymap is controlled as for the functional data using the + corresponding clipping and min/max options. + + if cfg.whitebg is set to 'yes' the function estimates the head volume and + displays a white background outside the head, which can save a lot of black + printer toner. + + if cfg.interactive is set to 'yes' a button will be displayed for + interactive data evaluation and coordinate reading. After clicking the + button named 'coords' you can click on any position in the slice montage. + After clicking these coordinates and their source value are displayed in + a text box below the button. The coordinates correspond to indeces in the + input data array: + + f = interp.source(coord_1,coord_2,coord_3) + + The coordinates are not affected by any transformations used for displaying + the data such as cfg.dim, cfg.rotate,cfg.flipdim or cfg.resample. + + See also FT_SOURCEANALYSIS, FT_VOLUMERESLICE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_sliceinterp.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_sliceinterp", *args, **kwargs) diff --git a/fieldtrip/ft_sourceanalysis.py b/fieldtrip/ft_sourceanalysis.py new file mode 100644 index 0000000..e4a70d7 --- /dev/null +++ b/fieldtrip/ft_sourceanalysis.py @@ -0,0 +1,158 @@ +from fieldtrip._runtime import Runtime + + +def ft_sourceanalysis(*args, **kwargs): + """ + FT_SOURCEANALYSIS performs beamformer dipole analysis on EEG or MEG data + after preprocessing and a timelocked or frequency analysis + + Use as + [source] = ft_sourceanalysis(cfg, freq) + or + [source] = ft_sourceanalysis(cfg, timelock) + + where the second input argument with the data should be organised in a structure + as obtained from the FT_FREQANALYSIS or FT_TIMELOCKANALYSIS function. The + configuration "cfg" is a structure containing the specification of the head model, + the source model, and other options. + + The different source reconstruction algorithms that are implemented are + cfg.method = 'lcmv' linear constrained minimum variance beamformer + 'sam' synthetic aperture magnetometry + 'dics' dynamic imaging of coherent sources + 'pcc' partial canonical correlation/coherence + 'mne' minimum norm estimation + 'rv' scan residual variance with single dipole + 'music' multiple signal classification + 'sloreta' standardized low-resolution electromagnetic tomography + 'eloreta' exact low-resolution electromagnetic tomography + The DICS and PCC methods are for frequency or time-frequency domain data, all other + methods are for time domain data. ELORETA can be used both for time, frequency and + time-frequency domain data. + + The complete grid with dipole positions and optionally precomputed leadfields is + constructed using FT_PREPARE_SOURCEMODEL. It can be specified as as a regular 3-D + grid that is aligned with the axes of the head coordinate system using + cfg.xgrid = vector (e.g. -20:1:20) or 'auto' (default = 'auto') + cfg.ygrid = vector (e.g. -20:1:20) or 'auto' (default = 'auto') + cfg.zgrid = vector (e.g. 0:1:20) or 'auto' (default = 'auto') + cfg.resolution = number (e.g. 1 cm) for automatic grid generation + If the source model destribes a triangulated cortical sheet, it is described as + cfg.sourcemodel.pos = N*3 matrix with the vertex positions of the cortical sheet + cfg.sourcemodel.tri = M*3 matrix that describes the triangles connecting the vertices + Alternatively the position of a few dipoles at locations of interest can be + user-specified, for example obtained from an anatomical or functional MRI + cfg.sourcemodel.pos = N*3 matrix with position of each source + cfg.sourcemodel.inside = N*1 vector with boolean value whether grid point is inside brain (optional) + cfg.sourcemodel.dim = [Nx Ny Nz] vector with dimensions in case of 3-D grid (optional) + + Besides the source positions, you may also include previously computed + spatial filters and/or leadfields using + cfg.sourcemodel.filter + cfg.sourcemodel.leadfield + + The following strategies are supported to obtain statistics for the source parameters using + multiple trials in the data, either directly or through a resampling-based approach + cfg.rawtrial = 'no' or 'yes' construct filter from single trials, apply to single trials. Note that you also may want to set cfg.keeptrials='yes' to keep all trial information, especially if using in combination with sourcemodel.filter + cfg.jackknife = 'no' or 'yes' jackknife resampling of trials + cfg.pseudovalue = 'no' or 'yes' pseudovalue resampling of trials + cfg.bootstrap = 'no' or 'yes' bootstrap resampling of trials + cfg.numbootstrap = number of bootstrap replications (e.g. number of original trials) + If none of these options is specified, the average over the trials will + be computed prior to computing the source reconstruction. + + To obtain statistics over the source parameters between two conditions, you + can also use a resampling procedure that reshuffles the trials over both + conditions. In that case, you should call the function with two datasets + containing single trial data like + [source] = ft_sourceanalysis(cfg, freqA, freqB) + [source] = ft_sourceanalysis(cfg, timelockA, timelockB) + and you should specify + cfg.randomization = 'no' or 'yes' + cfg.permutation = 'no' or 'yes' + cfg.numrandomization = number, e.g. 500 + cfg.numpermutation = number, e.g. 500 or 'all' + + If you have not specified a sourcemodel with pre-computed leadfields, the leadfield + for each source position will be computed on the fly, in the lower level function that + is called for the heavy lifting. In that case you can modify parameters for the forward + computation, e.g. by reducing the rank (i.e. remove the weakest orientation), or by + normalizing each column. + cfg.reducerank = 'no', or number (default = 3 for EEG, 2 for MEG) + cfg.backproject = 'yes' or 'no', determines when reducerank is applied whether the + lower rank leadfield is projected back onto the original linear + subspace, or not (default = 'yes') + cfg.normalize = 'yes' or 'no' (default = 'no') + cfg.normalizeparam = depth normalization parameter (default = 0.5) + cfg.weight = number or Nx1 vector, weight for each dipole position to compensate + for the size of the corresponding patch (default = 1) + + Other configuration options are + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION for details + cfg.frequency = single number (in Hz) + cfg.latency = single number in seconds, for time-frequency analysis + cfg.refchan = reference channel label (for coherence) + cfg.refdip = reference dipole location (for coherence) + cfg.supchan = suppressed channel label(s) + cfg.supdip = suppressed dipole location(s) + cfg.keeptrials = 'no' or 'yes' + cfg.keepleadfield = 'no' or 'yes' + + Some options need to be specified as method specific options, and determine the low-level computation of the inverse operator. + The functionality (and applicability) of the (sub-)options are documented in the lower-level ft_inverse_ functions. + Replace with one of the supported methods. + cfg..lambda = number or empty for automatic default + cfg..kappa = number or empty for automatic default + cfg..tol = number or empty for automatic default + cfg..projectnoise = 'no' or 'yes' + cfg..keepfilter = 'no' or 'yes' + cfg..keepcsd = 'no' or 'yes' + cfg..keepmom = 'no' or 'yes' + cfg..feedback = 'no', 'text', 'textbar', 'gui' (default = 'text') + + The volume conduction model of the head should be specified as + cfg.headmodel = structure with volume conduction model, see FT_PREPARE_HEADMODEL + + The EEG or MEG sensor positions can be present in the data or can be specified as + cfg.elec = structure with electrode positions or filename, see FT_READ_SENS + cfg.grad = structure with gradiometer definition or filename, see FT_READ_SENS + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_SOURCEDESCRIPTIVES, FT_SOURCESTATISTICS, FT_PREPARE_LEADFIELD, + FT_PREPARE_HEADMODEL, FT_PREPARE_SOURCEMODEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_sourceanalysis.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_sourceanalysis", *args, **kwargs) diff --git a/fieldtrip/ft_sourcedescriptives.py b/fieldtrip/ft_sourcedescriptives.py new file mode 100644 index 0000000..df04648 --- /dev/null +++ b/fieldtrip/ft_sourcedescriptives.py @@ -0,0 +1,77 @@ +from fieldtrip._runtime import Runtime + + +def ft_sourcedescriptives(*args, **kwargs): + """ + FT_SOURCEDESCRIPTIVES computes descriptive parameters of the source + analysis results. + + Use as + [source] = ft_sourcedescriptives(cfg, source) + + where cfg is a structure with the configuration details and source is the + result from a beamformer source estimation. The configuration can contain + cfg.cohmethod = 'regular', 'lambda1', 'canonical' + cfg.powmethod = 'regular', 'lambda1', 'trace', 'none' + cfg.supmethod = 'chan_dip', 'chan', 'dip', 'none' (default) + cfg.projectmom = 'yes' or 'no' (default = 'no') + cfg.eta = 'yes' or 'no' (default = 'no') + cfg.kurtosis = 'yes' or 'no' (default = 'no') + cfg.keeptrials = 'yes' or 'no' (default = 'no') + cfg.keepcsd = 'yes' or 'no' (default = 'no') + cfg.keepnoisecsd = 'yes' or 'no' (default = 'no') + cfg.keepmom = 'yes' or 'no' (default = 'yes') + cfg.keepnoisemom = 'yes' or 'no' (default = 'yes') + cfg.resolutionmatrix = 'yes' or 'no' (default = 'no') + cfg.feedback = 'no', 'text' (default), 'textbar', 'gui' + + The following option only applies to timecourses. + cfg.flipori = 'yes' or 'no' (default = 'no') + + The following option only applies to single-trial timecourses. + cfg.fixedori = 'within_trials' or 'over_trials' (default = 'over_trials') + + If repeated trials are present that have undergone some sort of + resampling (i.e. jackknife, bootstrap, singletrial or rawtrial), the mean, + variance and standard error of mean will be computed for all source + parameters. This is done after applying the optional transformation + on the power and projected noise. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_SOURCEANALYSIS, FT_SOURCESTATISTICS, FT_MATH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_sourcedescriptives.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_sourcedescriptives", *args, **kwargs) diff --git a/fieldtrip/ft_sourcegrandaverage.py b/fieldtrip/ft_sourcegrandaverage.py new file mode 100644 index 0000000..a40945c --- /dev/null +++ b/fieldtrip/ft_sourcegrandaverage.py @@ -0,0 +1,66 @@ +from fieldtrip._runtime import Runtime + + +def ft_sourcegrandaverage(*args, **kwargs): + """ + FT_SOURCEGRANDAVERAGE averages source reconstructions over either multiple + subjects or conditions. It computes the average and variance for all + known source parameters. The output can be used in FT_SOURCESTATISTICS + with the method 'parametric'. + + Alternatively, it can construct an average for multiple input source + reconstructions in two conditions after randomly reassigning the + input data over the two conditions. The output then can be used in + FT_SOURCESTATISTICS with the method 'randomization' or 'randcluster'. + + The input source structures should be spatially alligned to each other + and should have the same positions for the sourcemodel. + + Use as + [grandavg] = ft_sourcegrandaverage(cfg, source1, source2, ...) + + where the source structures are obtained from FT_SOURCEANALYSIS or + from FT_VOLUMENORMALISE, and the configuration can contain the + following fields: + cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'nai' or 'coh' + cfg.keepindividual = 'no' or 'yes' + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. For this particular function, the input data + should be structured as a single cell-array. + + See also FT_SOURCEANALYSIS, FT_SOURCEDESCRIPTIVES, FT_SOURCESTATISTICS, FT_MATH + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_sourcegrandaverage.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_sourcegrandaverage", *args, **kwargs) diff --git a/fieldtrip/ft_sourceinterpolate.py b/fieldtrip/ft_sourceinterpolate.py new file mode 100644 index 0000000..6b6324a --- /dev/null +++ b/fieldtrip/ft_sourceinterpolate.py @@ -0,0 +1,100 @@ +from fieldtrip._runtime import Runtime + + +def ft_sourceinterpolate(*args, **kwargs): + """ + FT_SOURCEINTERPOLATE interpolates source activity or statistical maps onto the + voxels or vertices of an anatomical description of the brain. Both the functional + and the anatomical data can either describe a volumetric 3D regular grid, a + triangulated description of the cortical sheet or an arbitrary cloud of points. + + The functional data in the output data will be interpolated at the locations at + which the anatomical data are defined. For example, if the anatomical data was + volumetric, the output data is a volume-structure, containing the resliced source + and the anatomical volume that can be visualized using FT_SOURCEPLOT or written to + file using FT_SOURCEWRITE. + + The following scenarios can be considered: + + - Both functional data and anatomical data are defined on 3D regular grids, for + example with a low-res grid for the functional data and a high-res grid for the + anatomy. + + - The functional data is defined on a 3D regular grid and the anatomical data is + defined on an irregular point cloud, which can be a 2D triangulated surface mesh. + + - The functional data is defined on an irregular point cloud, which can be a 2D + triangulated surface mesh, and the anatomical data is defined on a 3D regular grid. + + - Both the functional and the anatomical data are defined on an irregular point + cloud, which can be a 2D triangulated mesh. + + - The functional data is defined on a low-resolution 2D triangulated surface mesh and the + anatomical data is defined on a high-resolution 2D triangulated surface mesh, where the + low-res vertices form a subset of the high-res vertices. This allows for mesh-based + interpolation. The algorithm currently implemented is so-called 'smudging' as it is + also applied by the MNE-suite software. + + Use as + [interp] = ft_sourceinterpolate(cfg, source, anatomy) + [interp] = ft_sourceinterpolate(cfg, stat, anatomy) + where + source is the output of FT_SOURCEANALYSIS + stat is the output of FT_SOURCESTATISTICS + anatomy is the output of FT_READ_MRI, or one of the FT_VOLUMExxx functions, + or a cortical sheet that was read with FT_READ_HEADSHAPE, + or a regular 3D grid created with FT_PREPARE_SOURCEMODEL. + + The configuration should contain: + cfg.parameter = string or cell-array with the functional parameter(s) to be interpolated + cfg.downsample = integer number (default = 1, i.e. no downsampling) + cfg.interpmethod = string, can be 'nearest', 'linear', 'cubic', 'spline', 'sphere_avg', 'sphere_weighteddistance', or 'smudge' (default = 'linear for interpolating two 3D volumes, 'nearest' for all other cases) + + For interpolating two 3D regular grids or volumes onto each other the supported + interpolation methods are 'nearest', 'linear', 'cubic' or 'spline'. For all other + cases the supported interpolation methods are 'nearest', 'sphere_avg', + 'sphere_weighteddistance' or 'smudge'. + + The functional and anatomical data should be expressed in the same + coordinate sytem, i.e. either both in MEG headcoordinates (NAS/LPA/RPA) + or both in SPM coordinates (AC/PC). + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_READ_MRI, FT_READ_HEADSHAPE, FT_SOURCEPLOT, FT_SOURCEANALYSIS, + FT_SOURCEWRITE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_sourceinterpolate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_sourceinterpolate", *args, **kwargs) diff --git a/fieldtrip/ft_sourcemovie.py b/fieldtrip/ft_sourcemovie.py new file mode 100644 index 0000000..22be9bc --- /dev/null +++ b/fieldtrip/ft_sourcemovie.py @@ -0,0 +1,53 @@ +from fieldtrip._runtime import Runtime + + +def ft_sourcemovie(*args, **kwargs): + """ + FT_SOURCEMOVIE displays the source reconstruction on a cortical mesh + and allows the user to scroll through time with a movie. + + Use as + ft_sourcemovie(cfg, source) + where the input source data is obtained from FT_SOURCEANALYSIS, or a + a parcellated source structure (i.e. contains a brainordinate field) and + cfg is a configuration structure that should contain + + cfg.funparameter = string, functional parameter that is color coded (default = 'avg.pow') + cfg.maskparameter = string, functional parameter that is used for opacity (default = []) + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + If you specify this option the input data will be read from a *.mat + file on disk. This mat files should contain only a single variable named 'data', + corresponding to the input structure. + + See also FT_SOURCEPLOT, FT_SOURCEINTERPOLATE, FT_SOURCEPARCELLATE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_sourcemovie.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_sourcemovie", *args, **kwargs) diff --git a/fieldtrip/ft_sourceparcellate.py b/fieldtrip/ft_sourceparcellate.py new file mode 100644 index 0000000..7dddaca --- /dev/null +++ b/fieldtrip/ft_sourceparcellate.py @@ -0,0 +1,61 @@ +from fieldtrip._runtime import Runtime + + +def ft_sourceparcellate(*args, **kwargs): + """ + FT_SOURCEPARCELLATE combines the source-reconstruction parameters over the parcels, for + example by averaging all the values in the anatomically or functionally labeled parcel. + + Use as + output = ft_sourceparcellate(cfg, source, parcellation) + where the input source is a 2D surface-based or 3-D voxel-based source grid that was for + example obtained from FT_SOURCEANALYSIS or FT_COMPUTE_LEADFIELD. The input parcellation is + described in detail in FT_DATATYPE_PARCELLATION (2-D) or FT_DATATYPE_SEGMENTATION (3-D) and + can be obtained from FT_READ_ATLAS or from a custom parcellation/segmentation for your + individual subject. The output is a channel-based representation with the combined (e.g. + averaged) representation of the source parameters per parcel. + + The configuration "cfg" is a structure that can contain the following fields + cfg.method = string, method to combine the values, see below (default = 'mean') + cfg.parcellation = string, fieldname that contains the desired parcellation + cfg.parameter = cell-array with strings, fields that should be parcellated (default = 'all') + + The values within a parcel or parcel-combination can be combined with different methods: + 'mean' compute the mean + 'median' compute the median (unsupported for fields that are represented in a cell-array) + 'eig' compute the largest eigenvector + 'min' take the minimal value + 'max' take the maximal value + 'maxabs' take the signed maxabs value + 'std' take the standard deviation + + See also FT_SOURCEANALYSIS, FT_DATATYPE_PARCELLATION, FT_DATATYPE_SEGMENTATION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_sourceparcellate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_sourceparcellate", *args, **kwargs) diff --git a/fieldtrip/ft_sourceplot.py b/fieldtrip/ft_sourceplot.py new file mode 100644 index 0000000..35efd70 --- /dev/null +++ b/fieldtrip/ft_sourceplot.py @@ -0,0 +1,233 @@ +from fieldtrip._runtime import Runtime + + +def ft_sourceplot(*args, **kwargs): + """ + FT_SOURCEPLOT plots functional source reconstruction data on slices or on a surface, + optionally as an overlay on anatomical MRI data, where statistical data can be used to + determine the opacity of the mask. Input data comes from FT_SOURCEANALYSIS, + FT_SOURCEGRANDAVERAGE or statistical values from FT_SOURCESTATISTICS. + + Use as + ft_sourceplot(cfg, anatomical) + ft_sourceplot(cfg, functional) + ft_sourceplot(cfg, functional, anatomical) + where the input data can contain either anatomical, functional or statistical data, + or a combination of them. + + The input data can be in a 3-D volumetric representation or in a 2-D cortical sheet + representation. If both anatomical and functional/statistical data is provided as input, + they should be represented in the same coordinate system or interpolated on the same + geometrical representation, e.g. using FT_SOURCEINTERPOLATE. + + The slice and ortho visualization plot the data in the input data voxel arrangement, i.e. + the three ortho views are the 1st, 2nd and 3rd dimension of the 3-D data matrix, not of + the head coordinate system. The specification of the coordinate for slice intersection + is specified in head coordinates, i.e. relative to anatomical landmarks or fiducials and + expressed in mm or cm. If you want the visualisation to be consistent with the head + coordinate system, you can reslice the data using FT_VOLUMERESLICE. See http://bit.ly/1OkDlVF + + The configuration should contain: + cfg.method = 'ortho', plots the data on three orthogonal slices + 'slice', plots the data on a number of slices in the same plane + 'surface', plots the data on a 3D brain surface + 'glassbrain', plots a max-projection through the brain + 'vertex', plots the grid points or vertices scaled according to the functional value + 'cloud', plot the data as clouds, spheres, or points scaled according to the functional value + and + cfg.anaparameter = string, field in data with the anatomical data (default = 'anatomy' if present in data) + cfg.funparameter = string, field in data with the functional parameter of interest (default = []) + cfg.maskparameter = string, field in the data to be used for opacity masking of fun data (default = []) + If values are between 0 and 1, zero is fully transparant and one is fully opaque. + If values in the field are not between 0 and 1 they will be scaled depending on the values + of cfg.opacitymap and cfg.opacitylim (see below) + You can use masking in several ways, f.i. + - use outcome of statistics to show only the significant values and mask the insignificant + NB see also cfg.opacitymap and cfg.opacitylim below + - use the functional data itself as mask, the highest value (and/or lowest when negative) + will be opaque and the value closest to zero transparent + - Make your own field in the data with values between 0 and 1 to control opacity directly + + The following parameters can be used in all methods: + cfg.downsample = downsampling for resolution reduction, integer value (default = 1) (orig: from surface) + cfg.atlas = string, filename of atlas to use (default = []) see FT_READ_ATLAS + for ROI masking (see 'masking' below) or for orthogonal plots (see method='ortho' below) + cfg.visible = string, 'on' or 'off' whether figure will be visible (default = 'on') + cfg.figure = 'yes' or 'no', whether to open a new figure. You can also specify a figure handle from FIGURE, GCF or SUBPLOT. (default = 'yes') + cfg.position = location and size of the figure, specified as [left bottom width height] (default is automatic) + cfg.renderer = string, 'opengl', 'zbuffer', 'painters', see RENDERERINFO. The OpenGL renderer is required when using opacity (default = 'opengl') + + The following parameters can be used for the functional data: + cfg.funcolormap = colormap for functional data, see COLORMAP (default = 'auto') + 'auto', depends structure funparameter, or on funcolorlim + - funparameter: only positive values, or funcolorlim:'zeromax' -> 'hot' + - funparameter: only negative values, or funcolorlim:'minzero' -> 'cool' + - funparameter: both pos and neg values, or funcolorlim:'maxabs' -> 'default' + - funcolorlim: [min max] if min & max pos-> 'hot', neg-> 'cool', both-> 'default' + cfg.funcolorlim = color range of the functional data (default = 'auto') + [min max] + 'maxabs', from -max(abs(funparameter)) to +max(abs(funparameter)) + 'zeromax', from 0 to max(funparameter) + 'minzero', from min(funparameter) to 0 + 'auto', if funparameter values are all positive: 'zeromax', + all negative: 'minzero', both possitive and negative: 'maxabs' + cfg.colorbar = 'yes' or 'no' (default = 'yes') + cfg.colorbartext = string indicating the text next to colorbar + + The 'ortho' method can also plot time and/or frequency, the other methods can not. + If your functional data has a time and/or frequency dimension, you can use + cfg.latency = scalar or string, can be 'all', 'prestim', 'poststim', or [beg end], specify time range in seconds + cfg.avgovertime = string, can be 'yes' or 'no' (default = 'no') + cfg.frequency = scalar or string, can be 'all', or [beg end], specify frequency range in Hz + cfg.avgoverfreq = string, can be 'yes' or 'no' (default = 'no') + + The following parameters can be used for the masking data: + cfg.maskstyle = 'opacity', or 'colormix'. If 'opacity', low-level + graphics opacity masking is applied, if + 'colormix', the color data is explicitly + expressed as a single RGB value, incorporating + the opacitymask. Yields faster and more robust + rendering in general. + cfg.opacitymap = opacitymap for mask data, see ALPHAMAP (default = 'auto') + 'auto', depends structure maskparameter, or on opacitylim + - maskparameter: only positive values, or opacitylim:'zeromax' -> 'rampup' + - maskparameter: only negative values, or opacitylim:'minzero' -> 'rampdown' + - maskparameter: both pos and neg values, or opacitylim:'maxabs' -> 'vdown' + - opacitylim: [min max] if min & max pos-> 'rampup', neg-> 'rampdown', both-> 'vdown' + - NB. to use p-values use 'rampdown' to get lowest p-values opaque and highest transparent + cfg.opacitylim = range of mask values to which opacitymap is scaled (default = 'auto') + [min max] + 'maxabs', from -max(abs(maskparameter)) to +max(abs(maskparameter)) + 'zeromax', from 0 to max(abs(maskparameter)) + 'minzero', from min(abs(maskparameter)) to 0 + 'auto', if maskparameter values are all positive: 'zeromax', + all negative: 'minzero', both positive and negative: 'maxabs' + cfg.roi = string or cell of strings, region(s) of interest from anatomical atlas (see cfg.atlas above) + everything is masked except for ROI + + When cfg.method='ortho', three orthogonal slices will be rendered. You can click in any + of the slices to update the display in the other two. You can also use the arrow keys on + your keyboard to navigate in one-voxel steps. Note that the slices are along the first, + second and third voxel dimension, which do not neccessarily correspond to the axes of the + head coordinate system. See http://bit.ly/1OkDlVF + + The following parameters apply when cfg.method='ortho' + cfg.location = location of cut, (default = 'auto') + 'auto', 'center' if only anatomy, 'max' if functional data + 'min' and 'max' position of min/max funparameter + 'center' of the brain + [x y z], coordinates in voxels or head, see cfg.locationcoordinates + cfg.locationcoordinates = coordinate system used in cfg.location, 'head' or 'voxel' (default = 'head') + 'head', headcoordinates as mm or cm + 'voxel', voxelcoordinates as indices + cfg.crosshair = 'yes' or 'no' (default = 'yes') + cfg.axis = 'on' or 'off' (default = 'on') + cfg.queryrange = number, in atlas voxels (default = 1) + cfg.clim = lower and upper anatomical MRI limits (default = [0 1]) + + When cfg.method='slice', a NxM montage with a large number of slices will be rendered. + All slices are evenly spaced and along the same dimension. + + The following parameters apply for cfg.method='slice' + cfg.nslices = number of slices, (default = 20) + cfg.slicerange = range of slices in data, (default = 'auto') + 'auto', full range of data + [min max], coordinates of first and last slice in voxels + cfg.slicedim = dimension to slice 1 (x-axis) 2(y-axis) 3(z-axis) (default = 3) + cfg.title = string, title of the plot + cfg.figurename = string, title of the figure window + + When cfg.method='surface', the functional data will be rendered onto a cortical mesh + (can be an inflated mesh). If the input source data contains a tri-field (i.e. a + description of a mesh), no interpolation is needed. If the input source data does not + contain a tri-field, an interpolation is performed onto a specified surface. Note that + the coordinate system in which the surface is defined should be the same as the coordinate + system that is represented in the pos-field. + + The following parameters apply to cfg.method='surface' when an interpolation is required + cfg.surffile = string, file that contains the surface (default = 'surface_white_both.mat') + 'surface_white_both.mat' contains a triangulation that corresponds with the + SPM anatomical template in MNI coordinates + cfg.surfinflated = string, file that contains the inflated surface (default = []) + may require specifying a point-matching (uninflated) surffile + cfg.surfdownsample = number (default = 1, i.e. no downsampling) + cfg.projmethod = projection method, how functional volume data is projected onto surface + 'nearest', 'project', 'sphere_avg', 'sphere_weighteddistance' + cfg.projvec = vector (in mm) to allow different projections that + are combined with the method specified in cfg.projcomb + cfg.projcomb = 'mean', 'max', method to combine the different projections + cfg.projweight = vector of weights for the different projections (default = 1) + cfg.projthresh = implements thresholding on the surface level + for example, 0.7 means 70% of maximum + cfg.sphereradius = maximum distance from each voxel to the surface to be + included in the sphere projection methods, expressed in mm + cfg.distmat = precomputed distance matrix (default = []) + + The following parameters apply to cfg.method='surface' irrespective of whether an interpolation is required + cfg.camlight = 'yes' or 'no' (default = 'yes') + cfg.facecolor = [r g b] values or string, for example 'skin', 'skull', 'brain', 'black', 'red', 'r', + or an Nx3 or Nx1 array where N is the number of faces + cfg.vertexcolor = [r g b] values or string, for example 'skin', 'skull', 'brain', 'black', 'red', 'r', + or an Nx3 or Nx1 array where N is the number of vertices + cfg.edgecolor = [r g b] values or string, for example 'skin', 'skull', 'brain', 'black', 'red', 'r' + + When cfg.method = 'cloud', the functional data will be rendered as as clouds (groups of points), + spheres, or single points at each sensor position. These spheres or point clouds can either be + viewed in 3D or as 2D slices. The 'anatomical' input may also consist of a single or multiple + triangulated surface meshes in an Nx1 cell-array to be plotted with the interpolated functional + data (see FT_PLOT_CLOUD). + + The following parameters apply to cfg.method='cloud' + cfg.cloudtype = 'point' plots a single point at each sensor position + 'cloud' (default) plots each a group of spherically arranged points at each sensor position + 'surf' plots a single spherical surface mesh at each sensor position + cfg.radius = scalar, maximum radius of cloud (default = 4) + cfg.colorgrad = 'white' or a scalar (e.g. 1), degree to which color of points in cloud + changes from its center + cfg.slice = requires 'anatomical' as input (default = 'none') + '2d', plots 2D slices through the cloud with an outline of the mesh + '3d', draws an outline around the mesh at a particular slice + cfg.ori = 'x', 'y', or 'z', specifies the orthogonal plane which will be plotted (default = 'y') + cfg.slicepos = 'auto' or Nx1 vector specifying the position of the + slice plane along the orientation axis (default = 'auto': chooses slice(s) with + the most data) + cfg.nslices = scalar, number of slices to plot if 'slicepos' = 'auto (default = 1) + cfg.minspace = scalar, minimum spacing between slices if nslices>1 (default = 1) + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + If you specify this option the input data will be read from a *.mat file on + disk. This mat files should contain only a single variable corresponding to the + input structure. + + See also FT_SOURCEMOVIE, FT_SOURCEANALYSIS, FT_SOURCEGRANDAVERAGE, FT_SOURCESTATISTICS, + FT_VOLUMELOOKUP, FT_READ_ATLAS, FT_READ_MRI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_sourceplot.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_sourceplot", *args, **kwargs) diff --git a/fieldtrip/ft_sourceplot_interactive.py b/fieldtrip/ft_sourceplot_interactive.py new file mode 100644 index 0000000..f03243c --- /dev/null +++ b/fieldtrip/ft_sourceplot_interactive.py @@ -0,0 +1,78 @@ +from fieldtrip._runtime import Runtime + + +def ft_sourceplot_interactive(*args, **kwargs): + """ + FT_SOURCEPLOT_INTERACTIVE provides a rapid way to plot 3D surface + renderings of pos_time or pos_freq functional data, and interactively + explore them. One figure is created with surface plots of the individual + conditions, and by default a plot of the functional data averaged over + the entire cortex is created over time (or frequency). Users can click in + the line graph to shift the time point for which the functional data is + shown in the surface plots. Additionally, users can Shift+Click in the + surface plots to add a "virtual electrode", for which a new line graph + figure will be created. + + Input data needs to be source+mesh, so has to contain a tri, pos, and one + functional field plus a time- or frequency axis. + + Configuration options (all optional) include: + cfg.parameter = string, functional parameter to plot. Default = 'pow'. + cfg.data_labels = cell array of strings, describing each data input argument. Default = + {'Input 1',...,'Input N'} + cfg.time_label = string, xlabel for line graphs of functional data. Default = 'Time + (s)' for data with time dimension, 'Frequency (Hz)' for data with + freq dimension. + cfg.pow_label = string, ylabel for line graphs of functional data. Default = 'Current + density (a.u.)'. + cfg.clim = string, or 2-element numeric vector specifying the color limits + (see 'has_diff' option below). + cfg.has_diff = 1x1 logical, default = false. If true, this function will treat the + last data input argument slightly differently from the ones before + it, which is useful in case you wish to plot a difference score in + addition to two per-condition current densities. Specifically, if + true, (1) the line plots generated by this function will not include + the last data input argument; and (2) the colours limits for the + surface plot corresponding to the last data input argument will be + set symmetrically around zero (if cfg.clim is left empty - see + above). + cfg.atlas = string, filename of an atlas to use in generating title strings for + the line graphs corresponding to 'virtual electrodes' placed on the + surface plots. Atlas must be in the coordinate system of the + specified data input arguments. See FT_READ_ATLAS. + + Example use: + cfg = []; + cfg.data_labels = {'Congruent', 'Incongruent'}; + ft_sourceplot_interactive(cfg, sourceFC, sourceFIC); + + See also FT_SOURCEPLOT, FT_SOURCEMOVIE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_sourceplot_interactive.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_sourceplot_interactive", *args, **kwargs) diff --git a/fieldtrip/ft_sourcestatistics.py b/fieldtrip/ft_sourcestatistics.py new file mode 100644 index 0000000..2989bb0 --- /dev/null +++ b/fieldtrip/ft_sourcestatistics.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def ft_sourcestatistics(*args, **kwargs): + """ + FT_SOURCESTATISTICS computes the probability for a given null-hypothesis using + a parametric statistical test or using a non-parametric randomization test. + + Use as + [stat] = ft_sourcestatistics(cfg, source1, source2, ...) + where the input data is the result from FT_SOURCEANALYSIS, FT_SOURCEDESCRIPTIVES + or FT_SOURCEGRANDAVERAGE. The source structures should be spatially alligned + to each other and should have the same positions for the sourcemodel. + + The configuration should contain the following option for data selection + cfg.parameter = string, describing the functional data to be processed, e.g. 'pow', 'nai' or 'coh' + + Furthermore, the configuration should contain: + cfg.method = different methods for calculating the probability of the null-hypothesis, + 'montecarlo' uses a non-parametric randomization test to get a Monte-Carlo estimate of the probability, + 'analytic' uses a parametric test that results in analytic probability, + 'stats' (soon deprecated) uses a parametric test from the MATLAB statistics toolbox, + + The other cfg options depend on the method that you select. You + should read the help of the respective subfunction FT_STATISTICS_XXX + for the corresponding configuration options and for a detailed + explanation of each method. + + See also FT_SOURCEANALYSIS, FT_SOURCEDESCRIPTIVES, FT_SOURCEGRANDAVERAGE, FT_MATH, + FT_STATISTICS_MONTECARLO, FT_STATISTICS_ANALYTIC, FT_STATISTICS_CROSSVALIDATE, FT_STATISTICS_STATS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_sourcestatistics.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_sourcestatistics", *args, **kwargs) diff --git a/fieldtrip/ft_sourcewrite.py b/fieldtrip/ft_sourcewrite.py new file mode 100644 index 0000000..6c1fe80 --- /dev/null +++ b/fieldtrip/ft_sourcewrite.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def ft_sourcewrite(*args, **kwargs): + """ + FT_SOURCEWRITE exports source-reconstructed results to gifti or nifti format file. + The appropriate output file depends on whether the source locations are described by + on a cortically constrained sheet (gifti) or by a regular 3D lattice (nifti). + + Use as + ft_sourcewrite(cfg, source) + where source is a source structure obtained from FT_SOURCEANALYSIS and + cfg is a structure that should contain + + cfg.filename = string, filename without the extension + cfg.filetype = string, can be 'nifti', 'gifti' or 'cifti' (default is automatic) + cfg.parameter = string, functional parameter to be written to file + cfg.precision = string, can be 'single', 'double', etc. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + If you specify this the input data will be read from a *.mat + file on disk. This mat file should contain only a single variable, + corresponding with the input data structure. + + See also FT_SOURCEANALYSIS, FT_SOURCEDESCRIPTIVES, FT_VOLUMEWRITE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_sourcewrite.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_sourcewrite", *args, **kwargs, nargout=0) diff --git a/fieldtrip/ft_statistics_analytic.py b/fieldtrip/ft_statistics_analytic.py new file mode 100644 index 0000000..69bdaf5 --- /dev/null +++ b/fieldtrip/ft_statistics_analytic.py @@ -0,0 +1,77 @@ +from fieldtrip._runtime import Runtime + + +def ft_statistics_analytic(*args, **kwargs): + """ + FT_STATISTICS_ANALYTIC performs a parametric statistical test on the data, based on + a known (i.e. analytic) distribution of the test statistic. It is not recommended + to call this function directly, but instead you should call the function that is + associated with the type of data on which you want to perform the test. This is + because important data bookkeeping operations on the data are performed in the + higher-level functions, which are assumed to have been handled correctly for the + input arguments into this function. + + Use as + stat = ft_timelockstatistics(cfg, data1, data2, data3, ...) + stat = ft_freqstatistics (cfg, data1, data2, data3, ...) + stat = ft_sourcestatistics (cfg, data1, data2, data3, ...) + + where the data is obtained from FT_TIMELOCKANALYSIS, FT_FREQANALYSIS or + FT_SOURCEANALYSIS respectively, or from FT_TIMELOCKGRANDAVERAGE, + FT_FREQGRANDAVERAGE or FT_SOURCEGRANDAVERAGE respectively + and with cfg.method = 'analytic' + + The configuration options that can be specified are: + cfg.statistic = string, statistic to compute for each sample or voxel (see below) + cfg.correctm = string, apply multiple-comparison correction, 'no', 'bonferroni', 'holm', 'hochberg', 'fdr' (default = 'no') + cfg.alpha = number, critical value for rejecting the null-hypothesis (default = 0.05) + cfg.tail = number, -1, 1 or 0 (default = 0) + cfg.ivar = number or list with indices, independent variable(s) + cfg.uvar = number or list with indices, unit variable(s) + cfg.wvar = number or list with indices, within-block variable(s) + + The parametric statistic that is computed for each sample (and for + which the analytic probability of the null-hypothesis is computed) is + specified as + cfg.statistic = 'indepsamplesT' independent samples T-statistic, + 'indepsamplesF' independent samples F-statistic, + 'indepsamplesregrT' independent samples regression coefficient T-statistic, + 'indepsamplesZcoh' independent samples Z-statistic for coherence, + 'depsamplesT' dependent samples T-statistic, + 'depsamplesFmultivariate' dependent samples F-statistic MANOVA, + 'depsamplesregrT' dependent samples regression coefficient T-statistic, + 'actvsblT' activation versus baseline T-statistic. + or you can specify your own low-level statistical function. + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS, FT_SOURCESTATISTICS + FT_STATISTICS_MONTECARLO, FT_STATISTICS_STATS, FT_STATISTICS_MVPA, + FT_STATISTICS_CROSSVALIDATE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_statistics_analytic.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statistics_analytic", *args, **kwargs) diff --git a/fieldtrip/ft_statistics_crossvalidate.py b/fieldtrip/ft_statistics_crossvalidate.py new file mode 100644 index 0000000..890bc92 --- /dev/null +++ b/fieldtrip/ft_statistics_crossvalidate.py @@ -0,0 +1,68 @@ +from fieldtrip._runtime import Runtime + + +def ft_statistics_crossvalidate(*args, **kwargs): + """ + FT_STATISTICS_CROSSVALIDATE performs cross-validation using a prespecified + multivariate analysis. It is not recommended to call this function directly, + but instead you should call the function that is associated with the type of data on + which you want to perform the test. This is because important data bookkeeping + operations on the data are performed in the higher-level functions, which are + assumed to have been handled correctly for the input arguments into this function. + Also, notably, a prespecified randomseed in the cfg is handled in the higher + level function, not here. + + Use as + stat = ft_timelockstatistics(cfg, data1, data2, data3, ...) + stat = ft_freqstatistics (cfg, data1, data2, data3, ...) + stat = ft_sourcestatistics (cfg, data1, data2, data3, ...) + + where the data is obtained from FT_TIMELOCKANALYSIS, FT_FREQANALYSIS or + FT_SOURCEANALYSIS respectively, or from FT_TIMELOCKGRANDAVERAGE, + FT_FREQGRANDAVERAGE or FT_SOURCEGRANDAVERAGE respectively + and with cfg.method = 'crossvalidate' + + The configuration options that can be specified are: + cfg.mva = a multivariate analysis (default = {dml.standardizer dml.svm}) + cfg.statistic = a cell-array of statistics to report (default = {'accuracy' 'binomial'}) + cfg.nfolds = number of cross-validation folds (default = 5) + cfg.resample = true/false; upsample less occurring classes during + training and downsample often occurring classes + during testing (default = false) + + This returns: + stat.statistic = the statistics to report + stat.model = the models associated with this multivariate analysis + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS, FT_SOURCESTATISTICS + FT_STATISTICS_ANALYTIC, FT_STATISTICS_MONTECARLO, FT_STATISTICS_MVPA, + FT_STATISTICS_CROSSVALIDATE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_statistics_crossvalidate.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statistics_crossvalidate", *args, **kwargs) diff --git a/fieldtrip/ft_statistics_montecarlo.py b/fieldtrip/ft_statistics_montecarlo.py new file mode 100644 index 0000000..488339b --- /dev/null +++ b/fieldtrip/ft_statistics_montecarlo.py @@ -0,0 +1,110 @@ +from fieldtrip._runtime import Runtime + + +def ft_statistics_montecarlo(*args, **kwargs): + """ + FT_STATISTICS_MONTECARLO performs a nonparametric statistical test by calculating + Monte-Carlo estimates of the significance probabilities and/or critical values from + the permutation distribution. It is not recommended to call this function directly, + but instead you should call the function that is associated with the type of data on + which you want to perform the test. This is because important data bookkeeping + operations on the data are performed in the higher-level functions, which are + assumed to have been handled correctly for the input arguments into this function. + Also, notably, a prespecified randomseed in the cfg is handled in the higher + level function, not here. + + Use as + stat = ft_timelockstatistics(cfg, data1, data2, data3, ...) + stat = ft_freqstatistics (cfg, data1, data2, data3, ...) + stat = ft_sourcestatistics (cfg, data1, data2, data3, ...) + + where the data is obtained from FT_TIMELOCKANALYSIS, FT_FREQANALYSIS or + FT_SOURCEANALYSIS respectively, or from FT_TIMELOCKGRANDAVERAGE, + FT_FREQGRANDAVERAGE or FT_SOURCEGRANDAVERAGE respectively + and with cfg.method = 'montecarlo'. + + The configuration options that can be specified are: + cfg.numrandomization = number of randomizations, can be 'all' + cfg.correctm = string, apply multiple-comparison correction, 'no', 'max', cluster', 'tfce', 'bonferroni', 'holm', 'hochberg', 'fdr' (default = 'no') + cfg.alpha = number, critical value for rejecting the null-hypothesis per tail (default = 0.05) + cfg.tail = number, -1, 1 or 0 (default = 0) + cfg.correcttail = string, correct p-values or alpha-values when doing a two-sided test, 'alpha','prob' or 'no' (default = 'no') + cfg.ivar = number or list with indices, independent variable(s) + cfg.uvar = number or list with indices, unit variable(s) + cfg.wvar = number or list with indices, within-cell variable(s) + cfg.cvar = number or list with indices, control variable(s) + cfg.feedback = string, 'gui', 'text', 'textbar' or 'no' (default = 'text') + cfg.randomseed = string, 'yes', 'no' or a number (default = 'yes'), this option is not used in this + function directly, but is handled by ft_statistics. If you want to control + the random number generator while calling ft_statistics_montecarlo directly, it should + be specified on the command line (or in the caller script) just prior to calling this + function. + + If you use a cluster-based statistic, you can specify the following options that + determine how the single-sample or single-voxel statistics will be thresholded and + combined into one statistical value per cluster. + cfg.clusterstatistic = how to combine the single samples that belong to a cluster, 'maxsum', 'maxsize', 'wcm' (default = 'maxsum') + the option 'wcm' refers to 'weighted cluster mass', a statistic that combines cluster size and intensity; + see Hayasaka & Nichols (2004) NeuroImage for details + cfg.clusterthreshold = method for single-sample threshold, 'parametric', 'nonparametric_individual', 'nonparametric_common' (default = 'parametric') + cfg.clusteralpha = for either parametric or nonparametric thresholding per tail (default = 0.05) + cfg.clustercritval = for parametric thresholding (default is determined by the statfun) + cfg.clustertail = -1, 1 or 0 (default = 0) + + To include the channel dimension for clustering of channel level data, you should specify + cfg.neighbours = neighbourhood structure, see FT_PREPARE_NEIGHBOURS + If you specify an empty neighbourhood structure, clustering will only be done + over frequency and/or time and not over neighbouring channels. + + The statistic that is computed for each sample in each random reshuffling + of the data is specified as + cfg.statistic = 'indepsamplesT' independent samples T-statistic, + 'indepsamplesF' independent samples F-statistic, + 'indepsamplesregrT' independent samples regression coefficient T-statistic, + 'indepsamplesZcoh' independent samples Z-statistic for coherence, + 'depsamplesT' dependent samples T-statistic, + 'depsamplesFmultivariate' dependent samples F-statistic MANOVA, + 'depsamplesregrT' dependent samples regression coefficient T-statistic, + 'actvsblT' activation versus baseline T-statistic. + or you can specify your own low-level statistical function. + + You can also use a custom statistic of your choice that is sensitive to the + expected effect in the data. You can implement the statistic in a "statfun" that + will be called for each randomization. The requirements on a custom statistical + function is that the function is called ft_statfun_xxx, and that the function returns + a structure with a "stat" field containing the single sample statistical values. + Have a look at the functions in the fieldtrip/statfun directory (e.g. + FT_STATFUN_INDEPSAMPLEST) for the correct format of the input and output. + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS, FT_SOURCESTATISTICS, + FT_STATISTICS_ANALYTIC, FT_STATISTICS_STATS, FT_STATISTICS_MVPA, + FT_STATISTICS_CROSSVALIDATE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_statistics_montecarlo.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statistics_montecarlo", *args, **kwargs) diff --git a/fieldtrip/ft_statistics_mvpa.py b/fieldtrip/ft_statistics_mvpa.py new file mode 100644 index 0000000..aaef86d --- /dev/null +++ b/fieldtrip/ft_statistics_mvpa.py @@ -0,0 +1,183 @@ +from fieldtrip._runtime import Runtime + + +def ft_statistics_mvpa(*args, **kwargs): + """ + FT_STATISTICS_MVPA performs multivariate pattern classification or regression using + the MVPA-Light toolbox. The function supports cross-validation, searchlight + analysis, generalization, nested preprocessing, a variety of classification and + regression metrics, as well as statistical testing of these metrics. + It is not recommended to call this function directly, + but instead you should call the function that is associated with the type of data on + which you want to perform the test. This is because important data bookkeeping + operations on the data are performed in the higher-level functions, which are + assumed to have been handled correctly for the input arguments into this function. + Also, notably, a prespecified randomseed in the cfg is handled in the higher + level function, not here. + + Use as + stat = ft_timelockstatistics(cfg, data1, data2, data3, ...) + stat = ft_freqstatistics (cfg, data1, data2, data3, ...) + stat = ft_sourcestatistics (cfg, data1, data2, data3, ...) + + where the data is obtained from FT_TIMELOCKANALYSIS, FT_FREQANALYSIS or + FT_SOURCEANALYSIS respectively, or from FT_TIMELOCKGRANDAVERAGE, + FT_FREQGRANDAVERAGE or FT_SOURCEGRANDAVERAGE respectively + and with cfg.method = 'mvpa' + + The configuration options that can be specified are: + cfg.features = specifies the name or index of the dimension(s) + that serve(s) as features for the classifier or + regression model. Dimensions that are not + samples or features act as search + dimensions. For instance, assume the data is a + 3D array of size [samples x channels x time]. + If mvpa.features = 2, the channels serve as + features. A classification is then performed for + each time point (we call time a searchlight + dimension). Conversely, if mvpa.features = 3, the + time points serve as features. A classification + is performed for each channel (channel is a + searchlight dimension). + If cfg.features = [], then all non-sample + dimensions serve as searchlight dimensions. + If the dimensions have names (i.e. cfg.dimord + exists), then instead of numbers the feature can + be specified as a string (e.g. 'chan'). + Default value is chosen based on the (optional) + specification of the other searchlight options (see + below). If nothing is defined, the default will be 'chan'/2. + cfg.generalize = specifies the name or index of the dimensions + that serves for generalization (if any). For + instance, if the data is [samples x channels x + time], and mvpa.generalize = 3, a time x time + generalization is performed. If mvpa.generalize = + 2, a electrode x electrode generalization is + performed. mvpa.generalize must refer to a + searchlight dimension, therefore its value must + be different from the value of mvpa.features. + (default []) + + The configuration contains a substruct cfg.mvpa that contains detailed + options for the MVPA. Possible fields + cfg.mvpa.classifier = string specifying the classifier + Available classifiers: + 'ensemble' Ensemble of classifiers. Any of the other + classifiers can be used as a learner. + 'kernel_fda' Kernel Fisher Discriminant Analysis + 'lda' Regularized linear discriminant analysis + (LDA) (for two classes) + 'logreg' Logistic regression + 'multiclass_lda' LDA for more than two classes + 'naive_bayes' Naive Bayes + 'svm' Support Vector Machine (SVM) + More details on the classifiers: https://github.com/treder/MVPA-Light#classifiers-for-two-classes- + Additionally, you can choose 'libsvm' or + 'liblinear' as a model. They provide interfaces + for logistic regression, SVM, and Support Vector + Regression. Note that they can act as either + classifiers or regression models. An installation + of LIBSVM or LIBLINEAR is required. + cfg.mvpa.model = string specifying the regression model. If a + regression model has been specified, + cfg.mvpa.classifier should be empty (and vice + versa). If neither a classifier nor regression + model is specified, a LDA classifier is used by + default. + + Available regression models: + 'ridge Ridge regression + 'kernel_ridge' Kernel Ridge regression + More details on the regression models: https://github.com/treder/MVPA-Light#regression-models- + cfg.mvpa.metric = string, classification or regression metric, or + cell array with multiple metrics. + Classification metrics: accuracy auc confusion + dval f1 kappa precision recall tval + Regression metrics: mae mse r_squared + + cfg.mvpa.hyperparameter = struct, structure with hyperparameters for the + classifier or regression model (see HYPERPARAMETERS below) + cfg.mvpa.feedback = 'yes' or 'no', whether or not to print feedback on the console (default 'yes') + + To obtain a realistic estimate of classification performance, cross-validation + is used. It is controlled by the following parameters: + cfg.mvpa.cv = string, cross-validation type, either 'kfold', 'leaveout' + 'holdout', or 'predefined'. If 'none', no cross-validation is + used and the model is tested on the training + set. (default 'kfold') + cfg.mvpa.k = number of folds in k-fold cross-validation (default 5) + cfg.mvpa.repeat = number of times the cross-validation is repeated + with new randomly assigned folds (default 5) + cfg.mvpa.p = if cfg.cv is 'holdout', p is the fraction of test + samples (default 0.1) + cfg.mvpa.stratify = if 1, the class proportions are approximately + preserved in each test fold (default 1) + cfg.mvpa.fold = if cv='predefined', fold is a vector of length + #samples that specifies the fold each sample belongs to + + More information about each classifier is found in the documentation of + MVPA-Light (github.com/treder/MVPA-Light/). + + HYPERPARAMETERS: + Each classifier comes with its own set of hyperparameters, such as + regularization parameters and the kernel. Hyperparameters can be set + using the cfg.mvpa.hyperparameter substruct. For instance, in LDA, + cfg.mvpa.hyperparameter = 'auto' sets the lambda regularization parameter. + + The specification of the hyperparameters is found in the training function + for each model at github.com/treder/MVPA-Light/tree/master/model + If a hyperparameter is not specified, default values are used. + + SEARCHLIGHT ANALYSIS: + Data dimensions that are not samples or features serve as 'search + dimensions'. For instance, if the data is [samples x chan x time] + and mvpa.features = 'time', then the channel dimension serves as search + dimension: a separate analysis is carried out for each channel. Instead + of considering each channel individually, a searchlight can be defined + such that each channel is used together with its neighbours. Neighbours + can be specified using the cfg.neighbours field: + + cfg.neighbours = neighbourhood structure, see FT_PREPARE_NEIGHBOURS + cfg.timwin = integer, if MVPA is performed for each time point, + timwin specfies the total size of the time window + that is considered as features. + Example: for cfg.timwin = 3 a given time point is considered + together with the immediately preceding and following + time points. Increasing timwin typially + leads to smoother results along the time axis. + cfg.freqwin = integer, acts like cfg.timwin but across frequencies + + This returns: + stat.metric = this contains the requested metric + + See also FT_TIMELOCKSTATISTICS, FT_FREQSTATISTICS, FT_SOURCESTATISTICS, + FT_STATISTICS_ANALYTIC, FT_STATISTICS_STATS, FT_STATISTICS_MONTECARLO, FT_STATISTICS_CROSSVALIDATE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_statistics_mvpa.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statistics_mvpa", *args, **kwargs) diff --git a/fieldtrip/ft_statistics_stats.py b/fieldtrip/ft_statistics_stats.py new file mode 100644 index 0000000..9b15c9e --- /dev/null +++ b/fieldtrip/ft_statistics_stats.py @@ -0,0 +1,70 @@ +from fieldtrip._runtime import Runtime + + +def ft_statistics_stats(*args, **kwargs): + """ + FT_STATISTICS_STATS performs a massive univariate statistical test using the MATLAB + statistics toolbox. It is not recommended to call this function directly, + but instead you should call the function that is associated with the type of data on + which you want to perform the test. This is because important data bookkeeping + operations on the data are performed in the higher-level functions, which are + assumed to have been handled correctly for the input arguments into this function. + + Use as + stat = ft_timelockstatistics(cfg, data1, data2, data3, ...) + stat = ft_freqstatistics (cfg, data1, data2, data3, ...) + stat = ft_sourcestatistics (cfg, data1, data2, data3, ...) + + where the data is obtained from FT_TIMELOCKANALYSIS, FT_FREQANALYSIS or + FT_SOURCEANALYSIS respectively, or from FT_TIMELOCKGRANDAVERAGE, + FT_FREQGRANDAVERAGE or FT_SOURCEGRANDAVERAGE respectively + and with cfg.method = 'stats' + + The configuration options that can be specified are: + cfg.alpha = number, critical value for rejecting the null-hypothesis (default = 0.05) + cfg.tail = number, -1, 1 or 0 (default = 0) + cfg.feedback = string, 'gui', 'text', 'textbar' or 'no' (default = 'textbar') + cfg.method = 'stats' + cfg.statistic = 'ttest' test against a mean of zero + 'ttest2' compare the mean in two conditions + 'paired-ttest' + 'anova1' + 'kruskalwallis' + 'signtest' + 'signrank' + 'pearson' + 'kendall' + 'spearman' + + See also TTEST, TTEST2, KRUSKALWALLIS, SIGNTEST, SIGNRANK, FT_TIMELOCKSTATISTICS, + FT_FREQSTATISTICS, FT_SOURCESTATISTICS FT_STATISTICS_ANALYTIC, FT_STATISTICS_STATS, + FT_STATISTICS_MONTECARLO, FT_STATISTICS_CROSSVALIDATE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_statistics_stats.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_statistics_stats", *args, **kwargs) diff --git a/fieldtrip/ft_steadystatesimulation.py b/fieldtrip/ft_steadystatesimulation.py new file mode 100644 index 0000000..7c9551d --- /dev/null +++ b/fieldtrip/ft_steadystatesimulation.py @@ -0,0 +1,106 @@ +from fieldtrip._runtime import Runtime + + +def ft_steadystatesimulation(*args, **kwargs): + """ + FT_STEADYSTATESIMULATION creates a simulated EEG/MEG dataset. This function + allows to simulate the effect of several independent stimulus trains. These can + be presented as a periodic sequence, or as single (or few) transient stimuli. + This function creates a single block of data. You can call it repeatedly and use + FT_APPENDDATA to combine different blocks. + + Use as + data = ft_steadystatesimulation(cfg) + where cfg is a configuration structure that should contain + cfg.fsample = scalar, sampling frequency in Hz (default = 512) + cfg.duration = scalar, trial length in seconds (default = 4.56) + cfg.baseline = scalar, baseline length in seconds (default = 0) + cfg.ntrials = integer N, number of trials (default = 320) + cfg.iti = scalar, inter-trial interval in seconds (default = 1) + cfg.randomseed = 'yes' or a number or vector with the seed value (default = 'yes') + + Each trial can contain multiple nested experimental manipulations + cfg.level1.condition = scalar, or vector of length L1 (default = 1) + cfg.level1.gain = scalar, or vector of length L1 (default = 1) + cfg.level2.condition = scalar, or vector of length L2 (default = 1) + cfg.level2.gain = scalar, or vector of length L2 (default = 1) + cfg.level3.condition = scalar, or vector of length L3 (default = 1) + cfg.level3.gain = scalar, or vector of length L3 (default = 1) + If you don't need level 2 and up, specify the condition and gain as empty. + Idem for level 3 and up. + + Stimuli are created at the lowest experimental level, and are modulated according to the product of the gain of all levels. + Each trial can contain one or multiple stimuli. + The behavior of each stimuli is specified with + cfg.stimulus1.mode = 'periodic', 'transient' or 'off' (default = 'periodic') + cfg.stimulus2.mode = 'periodic', 'transient' or 'off' (default = 'transient') + + If the stimulus is periodic (below as example for stimulus1), the following options apply + cfg.stimulus1.number = does not apply for periodic stimuli + cfg.stimulus1.onset = in seconds, first stimulus relative to the start of the trial (default = 0) + cfg.stimulus1.onsetjitter = in seconds, max jitter that is added to the onset (default = 0) + cfg.stimulus1.isi = in seconds, i.e. for 10Hz you would specify 0.1 seconds as the interstimulus interval (default = 0.1176) + cfg.stimulus1.isijitter = in seconds, max jitter relative to the previous stimulus (default = 0) + cfg.stimulus2.condition = does not apply for periodic stimuli + cfg.stimulus2.gain = does not apply for periodic stimuli + cfg.stimulus1.kernelshape = 'sine' + cfg.stimulus1.kernelduration = in seconds (default = isi) + + If the stimulus is transient (below as example for stimulus2), the following options apply + cfg.stimulus2.number = scalar M, how many transients are to be presented per trial (default = 4) + cfg.stimulus2.onset = in seconds, first stimulus relative to the start of the trial (default = 0.7) + cfg.stimulus2.onsetjitter = in seconds, max jitter that is added to the onset (default = 0.2) + cfg.stimulus2.isi = in seconds as the interstimulus interval (default = 0.7) + cfg.stimulus2.isijitter = in seconds, max jitter relative to the previous stimulus (default = 0.2) + cfg.stimulus2.condition = 1xM vector with condition codes for each transient within a trial (default = [1 1 2 2]) + cfg.stimulus2.gain = 1xM vector with gain for each condition for each transient within a trial (default = [1 1 1 1]) + cfg.stimulus2.kernelshape = 'hanning' + cfg.stimulus2.kernelduration = in seconds (default = 0.75*isi) + + RANDOMIZATIONS: + - The onsetjitter is randomized between 0 and the value given, and is always added to the onset. + - The isijitter is randomized between 0 and the value given, and is always added to the interstimulus interval (isi). + - For periodic stimuli, which are constant within a trial, the condition code and gain are shuffled over all trials. + - For transient stimuli, the condition code and gain are shuffled within each trial. + + Using the default settings, we model a peripherally presented flickering stimulus + that appears at different excentricities together with a centrally presented + transient stimulus that appears 4x per trial. To simulate the experiment described + at , you have to call this 4 times with a different cfg.configuration and + cfg.gain to model the task load and use FT_APPENDDATA to concatenate the trials. In + this case cfg.condition models the factor "task load" (2 levels, low and high), + cfg.stimulus1.condition models the factor "excentricity" (4 levels), and + cfg.stimulation2.condition models the factor "stimulus type" (2 levels, non-target + or target). + + See also FT_DIPOLESIMULATION, FT_TIMELOCKSIMULATION, FT_FREQSIMULATION, + FT_CONNECTIVITYSIMULATION, FT_APPENDDATA + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_steadystatesimulation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_steadystatesimulation", *args, **kwargs) diff --git a/fieldtrip/ft_stratify.py b/fieldtrip/ft_stratify.py new file mode 100644 index 0000000..6802f7c --- /dev/null +++ b/fieldtrip/ft_stratify.py @@ -0,0 +1,73 @@ +from fieldtrip._runtime import Runtime + + +def ft_stratify(*args, **kwargs): + """ + FT_STRATIFY tries to reduce the variance in a specific feature in the data + that is not related to an effect in two or multiple conditions, but where + that feature may confound the analysis. Stratification is implemented by + randomly removing elements from the data, making the distribution of the + data equal on that feature. + + Use as + [output] = ft_stratify(cfg, input1, input2, ...), or + [output, binaxis] = ft_stratify(cfg, input1, input2, ...) + + For the histogram and the split method, each input is a Nchan X Nobs + matrix. The output is a cell-array with in each cell the same data as in + the corresponding input, except that the observations that should be + removed are marked with a NaN. + + For the equatespike method, each input is a Ntrials X 1 cell-array. Each + trial should contain the spike firing moments (i.e. a logical Nchans X + Nsamples matrix). The output is a cell-array with in each cell the same + data as in the corresponding input, except that spike numbers have been + equated in each trial and channel. + + The configuration should contain + cfg.method = 'histogram' + 'splithilo' + 'splitlohi' + 'splitlolo' + 'splithihi' + 'equatespike' + + The following options apply only to histogram and split methods. + cfg.equalbinavg = 'yes' + cfg.numbin = 10 + cfg.numiter = 2000 + + The following options apply only to the equatespike method. + cfg.pairtrials = 'spikesort', 'linkage' or 'no' (default = 'spikesort') + cfg.channel = 'all' or list with indices ( default = 'all') + + See also FT_FREQSTATISTICS, FT_TIMELOCKSTATISTICS, FT_SOURCESTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_stratify.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_stratify", *args, **kwargs) diff --git a/fieldtrip/ft_timelockanalysis.py b/fieldtrip/ft_timelockanalysis.py new file mode 100644 index 0000000..6690e1d --- /dev/null +++ b/fieldtrip/ft_timelockanalysis.py @@ -0,0 +1,61 @@ +from fieldtrip._runtime import Runtime + + +def ft_timelockanalysis(*args, **kwargs): + """ + FT_TIMELOCKANALYSIS computes the timelocked average ERP/ERF and optionally computes + the covariance matrix over the specified time window. + + Use as + [timelock] = ft_timelockanalysis(cfg, data) + + The data should be organised in a structure as obtained from FT_PREPROCESSING. + The configuration should be according to + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION for details + cfg.latency = [begin end] in seconds, or 'all', 'minperiod', 'maxperiod', 'prestim', 'poststim' (default = 'all') + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.keeptrials = 'yes' or 'no', return individual trials or average (default = 'no') + cfg.nanmean = string, can be 'yes' or 'no' (default = 'yes') + cfg.normalizevar = 'N' or 'N-1' (default = 'N-1') + cfg.covariance = 'no' or 'yes' (default = 'no') + cfg.covariancewindow = [begin end] in seconds, or 'all', 'minperiod', 'maxperiod', 'prestim', 'poststim' (default = 'all') + cfg.removemean = 'yes' or 'no', for the covariance computation (default = 'yes') + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_TIMELOCKGRANDAVERAGE, FT_TIMELOCKSTATISTICS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_timelockanalysis.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_timelockanalysis", *args, **kwargs) diff --git a/fieldtrip/ft_timelockbaseline.py b/fieldtrip/ft_timelockbaseline.py new file mode 100644 index 0000000..dc76662 --- /dev/null +++ b/fieldtrip/ft_timelockbaseline.py @@ -0,0 +1,55 @@ +from fieldtrip._runtime import Runtime + + +def ft_timelockbaseline(*args, **kwargs): + """ + FT_TIMELOCKBASELINE performs baseline correction for ERF and ERP data. To apply + baseline correction to data that is not timelocked, use ft_preprocessing instead. + + Use as + [timelock] = ft_timelockbaseline(cfg, timelock) + where the timelock data is the output from FT_TIMELOCKANALYSIS, and the + configuration should contain + cfg.baseline = [begin end] (default = 'no') + cfg.channel = cell-array, see FT_CHANNELSELECTION + cfg.parameter = field for which to apply baseline normalization, or + cell-array of strings to specify multiple fields to normalize + (default = 'avg') + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_TIMELOCKANALYSIS, FT_FREQBASELINE, FT_TIMELOCKGRANDAVERAGE, FT_DATATYPE_TIMELOCK + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_timelockbaseline.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_timelockbaseline", *args, **kwargs) diff --git a/fieldtrip/ft_timelockgrandaverage.py b/fieldtrip/ft_timelockgrandaverage.py new file mode 100644 index 0000000..bea124a --- /dev/null +++ b/fieldtrip/ft_timelockgrandaverage.py @@ -0,0 +1,75 @@ +from fieldtrip._runtime import Runtime + + +def ft_timelockgrandaverage(*args, **kwargs): + """ + FT_TIMELOCKGRANDAVERAGE computes ERF/ERP average and variance + over multiple subjects or over blocks within one subject + + Use as + [grandavg] = ft_timelockgrandaverage(cfg, avg1, avg2, avg3, ...) + + where + avg1..N are the ERF/ERP averages as obtained from FT_TIMELOCKANALYSIS + + and cfg is a configuration structure with + cfg.method = string, 'across' or 'within' (default = 'across'), see below for details + cfg.parameter = string, which parameter to average (default = 'avg') + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION for details + cfg.latency = [begin end] in seconds or 'all' (default = 'all') + cfg.keepindividual = string, 'yes' or 'no' (default = 'no') + cfg.nanmean = string, can be 'yes' or 'no' (default = 'yes') + cfg.normalizevar = string, 'N' or 'N-1' (default = 'N-1') + + If cfg.method = 'across', a plain average is performed, i.e. the requested + parameter in each input argument is weighted equally in the average. This is useful + when averaging across subjects. The variance-field will contain the variance across + the parameter of interest, and the output dof-field will contain the number of + input arguments. + + If cfg.method = 'within', a weighted average is performed, i.e. the requested + parameter in each input argument is weighted according to the degrees of freedom in + the dof-field. This is useful when averaging within subjects across blocks, e.g. + when each block was recorded in a separate file. The variance-field will contain + the variance across all input observations, and the output dof-field will contain + the total number of observations. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. For this particular function, the input should be + structured as a cell-array. + + See also FT_TIMELOCKANALYSIS, FT_TIMELOCKSTATISTICS, FT_TIMELOCKBASELINE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_timelockgrandaverage.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_timelockgrandaverage", *args, **kwargs) diff --git a/fieldtrip/ft_timelocksimulation.py b/fieldtrip/ft_timelocksimulation.py new file mode 100644 index 0000000..9e9ce88 --- /dev/null +++ b/fieldtrip/ft_timelocksimulation.py @@ -0,0 +1,71 @@ +from fieldtrip._runtime import Runtime + + +def ft_timelocksimulation(*args, **kwargs): + """ + FT_TIMELOCKSIMULATION computes simulated data that consists of multiple trials in + with each trial contains an event-related potential or field. Following + construction of the time-locked signal in each trial by this function, the signals + can be passed into FT_TIMELOCKANALYSIS to obtain the average and the variance. + + Use as + [data] = ft_timelockstatistics(cfg) + which will return a raw data structure that resembles the output of + FT_PREPROCESSING. + + The number of trials and the time axes of the trials can be specified by + cfg.fsample = simulated sample frequency (default = 1000) + cfg.trllen = length of simulated trials in seconds (default = 1) + cfg.numtrl = number of simulated trials (default = 10) + cfg.baseline = number (default = 0.3) + or by + cfg.time = cell-array with one time axis per trial, which are for example obtained from an existing dataset + + The signal is constructed from three underlying functions. The shape is + controlled with + cfg.s1.numcycli = number (default = 1) + cfg.s1.ampl = number (default = 1.0) + cfg.s2.numcycli = number (default = 2) + cfg.s2.ampl = number (default = 0.7) + cfg.s3.numcycli = number (default = 4) + cfg.s3.ampl = number (default = 0.2) + cfg.noise.ampl = number (default = 0.1) + Specifying numcycli=1 results in a monophasic signal, numcycli=2 is a biphasic, + etc. The three signals are scaled to the indicated amplitude, summed up and a + certain amount of noise is added. + + Other configuration options include + cfg.numchan = number (default = 5) + cfg.randomseed = 'yes' or a number or vector with the seed value (default = 'yes') + + See also FT_TIMELOCKANALYSIS, FT_TIMELOCKSTATISTICS, FT_FREQSIMULATION, + FT_DIPOLESIMULATION, FT_CONNECTIVITYSIMULATION + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_timelocksimulation.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_timelocksimulation", *args, **kwargs) diff --git a/fieldtrip/ft_timelockstatistics.py b/fieldtrip/ft_timelockstatistics.py new file mode 100644 index 0000000..ef9d153 --- /dev/null +++ b/fieldtrip/ft_timelockstatistics.py @@ -0,0 +1,72 @@ +from fieldtrip._runtime import Runtime + + +def ft_timelockstatistics(*args, **kwargs): + """ + FT_TIMELOCKSTATISTICS computes significance probabilities and/or critical values of a parametric statistical test + or a non-parametric permutation test. + + Use as + [stat] = ft_timelockstatistics(cfg, timelock1, timelock2, ...) + where the input data is the result from either FT_TIMELOCKANALYSIS or + FT_TIMELOCKGRANDAVERAGE. + + The configuration can contain the following options for data selection + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), + see FT_CHANNELSELECTION for details + cfg.latency = [begin end] in seconds or 'all' (default = 'all') + cfg.avgoverchan = 'yes' or 'no' (default = 'no') + cfg.avgovertime = 'yes' or 'no' (default = 'no') + cfg.parameter = string (default = 'trial' or 'avg') + + Furthermore, the configuration should contain + cfg.method = different methods for calculating the significance probability and/or critical value + 'montecarlo' get Monte-Carlo estimates of the significance probabilities and/or critical values from the permutation distribution, + 'analytic' get significance probabilities and/or critical values from the analytic reference distribution + (typically, the sampling distribution under the null hypothesis), + 'stats' use a parametric test from the MATLAB statistics toolbox, + 'mvpa' use functionality from the MVPA-light toolbox for classification or multivariate regression + + The other cfg options depend on the method that you select. You + should read the help of the respective subfunction FT_STATISTICS_XXX + for the corresponding configuration options and for a detailed + explanation of each method. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_TIMELOCKANALYSIS, FT_TIMELOCKGRANDAVERAGE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_timelockstatistics.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_timelockstatistics", *args, **kwargs) diff --git a/fieldtrip/ft_topoplotCC.py b/fieldtrip/ft_topoplotCC.py new file mode 100644 index 0000000..c6fdd26 --- /dev/null +++ b/fieldtrip/ft_topoplotCC.py @@ -0,0 +1,74 @@ +from fieldtrip._runtime import Runtime + + +def ft_topoplotCC(*args, **kwargs): + """ + FT_TOPOPLOTCC plots the coherence or connectivity between channel pairs + + Use as + ft_topoplotCC(cfg, freq) + + The configuration should contain: + cfg.feedback = string (default = 'textbar') + cfg.layout = specification of the layout, see FT_PREPARE_LAYOUT + cfg.foi = the frequency of interest which is to be plotted (default is the first frequency bin) + cfg.widthparam = string, parameter to be used to control the line width (see below) + cfg.alphaparam = string, parameter to be used to control the opacity (see below) + cfg.colorparam = string, parameter to be used to control the line color + cfg.visible = string, 'on' or 'off' whether figure will be visible (default = 'on') + cfg.figure = 'yes' or 'no', whether to open a new figure. You can also specify a figure handle from FIGURE, GCF or SUBPLOT. (default = 'yes') + cfg.position = location and size of the figure, specified as [left bottom width height] (default is automatic) + cfg.renderer = string, 'opengl', 'zbuffer', 'painters', see RENDERERINFO (default is automatic, try 'painters' when it crashes) + + The widthparam should be indicated in pixels, e.g. usefull numbers are 1 and + larger. + + The alphaparam should be indicated as opacity between 0 (fully transparent) + and 1 (fully opaque). + + The default is to plot the connections as lines, but you can also use + bidirectional arrows: + cfg.arrowhead = string, 'none', 'stop', 'start', 'both' (default = 'none') + cfg.arrowsize = scalar, size of the arrow head in figure units, + i.e. the same units as the layout (default is automatically determined) + cfg.arrowoffset = scalar, amount that the arrow is shifted to the side in figure units, + i.e. the same units as the layout (default is automatically determined) + cfg.arrowlength = scalar, amount by which the length is reduced relative to the complete line (default = 0.8) + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + If you specify this option the input data will be read from a *.mat + file on disk. This mat files should contain only a single variable named 'data', + corresponding to the input structure. For this particular function, the input should be + structured as a cell-array. + + See also FT_PREPARE_LAYOUT, FT_MULTIPLOTCC, FT_CONNECTIVITYPLOT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_topoplotCC.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_topoplotCC", *args, **kwargs) diff --git a/fieldtrip/ft_topoplotER.py b/fieldtrip/ft_topoplotER.py new file mode 100644 index 0000000..6c11e2d --- /dev/null +++ b/fieldtrip/ft_topoplotER.py @@ -0,0 +1,144 @@ +from fieldtrip._runtime import Runtime + + +def ft_topoplotER(*args, **kwargs): + """ + FT_TOPOPLOTER plots the topographic distribution over the head of a 2-dimensional + data representations such as the event-related potentials or fields, or a power + or connectivity spectrum. + + Use as + ft_topoplotER(cfg, timelock) + or + ft_topoplotER(cfg, freq) + + The data can be an ERP/ERF produced by FT_TIMELOCKANALYSIS, a power spectrum + (without time dimension) produced by FT_FREQANALYSIS or a connectivity spectrum + produced by FT_CONNECTIVITYANALYSIS. Also, the output to FT_FREQSTATISTICS and + FT_TIMELOCKSTATISTICS can be visualised. + + The configuration can have the following parameters + cfg.parameter = field that contains the data to be plotted as color, for example 'avg', 'powspctrm' or 'cohspctrm' (default is automatic) + cfg.maskparameter = field in the data to be used for masking of data. It should have alues between 0 and 1, where 0 corresponds to transparent. + cfg.xlim = limit for 1st dimension in data (e.g., time), can be 'maxmin' or [xmin xmax] (default = 'maxmin') + cfg.zlim = limits for color dimension, 'maxmin', 'maxabs', 'zeromax', 'minzero', or [zmin zmax] (default = 'maxmin') + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION for details + cfg.refchannel = name of reference channel for visualising connectivity, can be 'gui' + cfg.baseline = 'yes','no' or [time1 time2] (default = 'no'), see FT_TIMELOCKBASELINE or FT_FREQBASELINE + cfg.baselinetype = 'absolute' or 'relative' (default = 'absolute') + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.magscale = number, scaling to apply to the MEG magnetometer channels prior to display + cfg.gradscale = number, scaling to apply to the MEG gradiometer channels prior to display + cfg.colormap = string, or Nx3 matrix, see FT_COLORMAP + cfg.marker = 'on', 'labels', 'numbers', 'off' + cfg.markersymbol = channel marker symbol (default = 'o') + cfg.markercolor = channel marker color (default = [0 0 0] (black)) + cfg.markersize = channel marker size (default = 2) + cfg.markerfontsize = font size of channel labels (default = 8 pt) + cfg.highlight = 'off', 'on', 'labels', 'numbers' + cfg.highlightchannel = Nx1 cell-array with selection of channels, or vector containing channel indices see FT_CHANNELSELECTION + cfg.highlightsymbol = highlight marker symbol (default = 'o') + cfg.highlightcolor = highlight marker color (default = [0 0 0] (black)) + cfg.highlightsize = highlight marker size (default = 6) + cfg.highlightfontsize = highlight marker size (default = 8) + cfg.hotkeys = enables hotkeys (pageup/pagedown/m) for dynamic zoom and translation (ctrl+) of the color limits + cfg.colorbar = whether to show a colorbar alongside the figure (default = 'no') + 'no' do not show a colorbar + 'yes' at the default MATLAB location + 'North' inside plot box near top + 'South' inside bottom + 'East' inside right + 'West' inside left + 'NorthOutside' outside plot box near top + 'SouthOutside' outside bottom + 'EastOutside' outside right + 'WestOutside' outside left + cfg.colorbartext = string indicating the text next to colorbar + cfg.interplimits = limits for interpolation (default = 'head') + 'sensors' to furthest sensor + 'head' to edge of head + cfg.interpolation = 'linear', 'cubic', 'nearest', 'v4' (default = 'v4') see GRIDDATA + cfg.style = plot style (default = 'both') + 'straight' colormap only + 'contour' contour lines only + 'both' both colormap and contour lines + 'fill' constant color between lines + 'blank' only the head shape + 'straight_imsat' colormap only, vector-graphics friendly + 'both_imsat' both colormap and contour lines, vector-graphics friendly + cfg.gridscale = scaling grid size that determines resolution of figure (default = 67) + cfg.shading = 'flat' or 'interp' (default = 'flat') + cfg.comment = 'no', 'auto' or 'xlim' (default = 'auto') + 'auto': date, xparam and zparam limits are printed + 'xlim': only xparam limits are printed + cfg.commentpos = string or two numbers, position of the comment (default = 'leftbottom') + 'lefttop' 'leftbottom' 'middletop' 'middlebottom' 'righttop' 'rightbottom' + 'title' to place comment as title + 'layout' to place comment as specified for COMNT in layout + [x y] coordinates + cfg.interactive = Interactive plot 'yes' or 'no' (default = 'yes') + In an interactive plot you can select areas and produce a new interactive plot when a + selected area is clicked. Multiple areas can be selected by holding down the SHIFT key. + cfg.directionality = '', 'inflow' or 'outflow' specifies for connectivity measures whether the inflow into a + node, or the outflow from a node is plotted. The (default) behavior of this option depends + on the dimord of the input data (see below). + cfg.layout = specify the channel layout for plotting using one of the supported ways (see below). + cfg.interpolatenan = 'yes' or 'no', whether to interpolate over channels containing NaNs (default = 'yes') + cfg.figure = 'yes', 'no', or 'subplot', whether to open a new figure. You can also specify a figure + handle from FIGURE, GCF or SUBPLOT. (default = 'yes'). With multiple data inputs, 'subplot' + will make subplots in a single figure. + + For the plotting of directional connectivity data the cfg.directionality option determines what is plotted. The default + value and the supported functionality depend on the dimord of the input data. If the input data is of dimord 'chan_chan_XXX', + the value of directionality determines whether, given the reference channel(s), the columns (inflow), or rows (outflow) are + selected for plotting. In this situation the default is 'inflow'. Note that for undirected measures, inflow and outflow should + give the same output. If the input data is of dimord 'chancmb_XXX', the value of directionality determines whether the rows in + data.labelcmb are selected. With 'inflow' the rows are selected if the refchannel(s) occur in the right column, with 'outflow' + the rows are selected if the refchannel(s) occur in the left column of the labelcmb-field. Default in this case is '', which + means that all rows are selected in which the refchannel(s) occur. This is to robustly support linearly indexed undirected + connectivity metrics. In the situation where undirected connectivity measures are linearly indexed, specifying 'inflow' or + outflow' can result in unexpected behavior. + + The layout defines how the channels are arranged. You can specify the + layout in a variety of ways: + - you can provide a pre-computed layout structure, see FT_PREPARE_LAYOUT + - you can give the name of an ascii layout file with extension *.lay + - you can give the name of an electrode file + - you can give an electrode definition, i.e. "elec" structure + - you can give a gradiometer definition, i.e. "grad" structure + If you do not specify any of these and the data structure contains an + electrode or gradiometer structure, that will be used for creating a + layout. If you want to have more fine-grained control over the layout + of the subplots, you should create your own layout file. + + See also FT_SINGLEPLOTER, FT_MULTIPLOTER, FT_SINGLEPLOTTFR, FT_MULTIPLOTTFR, + FT_TOPOPLOTTFR, FT_PREPARE_LAYOUT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_topoplotER.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_topoplotER", *args, **kwargs) diff --git a/fieldtrip/ft_topoplotIC.py b/fieldtrip/ft_topoplotIC.py new file mode 100644 index 0000000..2d97adf --- /dev/null +++ b/fieldtrip/ft_topoplotIC.py @@ -0,0 +1,112 @@ +from fieldtrip._runtime import Runtime + + +def ft_topoplotIC(*args, **kwargs): + """ + FT_TOPOPLOTIC plots the topographic distribution of an independent + component that was computed using the FT_COMPONENTANALYSIS function, + as a 2-D circular view (looking down at the top of the head). + + Use as + ft_topoplotIC(cfg, comp) + where the input comp structure should be obtained from FT_COMPONENTANALYSIS. + + The configuration should have the following parameters: + cfg.component = field that contains the independent component(s) to be plotted as color + cfg.layout = specification of the layout, see below + + The configuration can have the following parameters: + cfg.colormap = string, or Nx3 matrix, see FT_COLORMAP + cfg.zlim = plotting limits for color dimension, 'maxmin', 'maxabs', 'zeromax', 'minzero', or [zmin zmax] (default = 'maxmin') + cfg.marker = 'on', 'labels', 'numbers', 'off' + cfg.markersymbol = channel marker symbol (default = 'o') + cfg.markercolor = channel marker color (default = [0 0 0] (black)) + cfg.markersize = channel marker size (default = 2) + cfg.markerfontsize = font size of channel labels (default = 8 pt) + cfg.highlight = 'on', 'labels', 'numbers', 'off' + cfg.highlightchannel = Nx1 cell-array with selection of channels, or vector containing channel indices see FT_CHANNELSELECTION + cfg.highlightsymbol = highlight marker symbol (default = 'o') + cfg.highlightcolor = highlight marker color (default = [0 0 0] (black)) + cfg.highlightsize = highlight marker size (default = 6) + cfg.highlightfontsize = highlight marker size (default = 8) + cfg.colorbar = 'yes' + 'no' (default) + 'North' inside plot box near top + 'South' inside bottom + 'East' inside right + 'West' inside left + 'NorthOutside' outside plot box near top + 'SouthOutside' outside bottom + 'EastOutside' outside right + 'WestOutside' outside left + cfg.colorbartext = string indicating the text next to colorbar + cfg.interplimits = limits for interpolation (default = 'head') + 'sensors' to furthest sensor + 'head' to edge of head + cfg.interpolation = 'linear','cubic','nearest','v4' (default = 'v4') see GRIDDATA + cfg.style = plot style (default = 'both') + 'straight' colormap only + 'contour' contour lines only + 'both' both colormap and contour lines + 'fill' constant color between lines + 'blank' only the head shape + 'straight_imsat' colormap only, vector-graphics friendly + 'both_imsat' both colormap and contour lines, vector-graphics friendly + cfg.gridscale = scaling grid size (default = 67) + determines resolution of figure + cfg.shading = 'flat' 'interp' (default = 'flat') + cfg.comment = string 'no' 'auto' or 'xlim' (default = 'auto') + 'auto': date, xparam and zparam limits are printed + 'xlim': only xparam limits are printed + cfg.commentpos = string or two numbers, position of comment (default 'leftbottom') + 'lefttop' 'leftbottom' 'middletop' 'middlebottom' 'righttop' 'rightbottom' + 'title' to place comment as title + 'layout' to place comment as specified for COMNT in layout + [x y] coordinates + cfg.title = string or 'auto' or 'off', specify a figure title, or use 'component N' (default) as the title + cfg.figure = 'yes', 'no' or 'subplot', whether to open a new figure. You can also specify a figure handle from FIGURE, GCF or SUBPLOT. (default = 'subplot') + cfg.renderer = string, 'opengl', 'zbuffer', 'painters', see RENDERERINFO (default is automatic, try 'painters' when it crashes) + + The layout defines how the channels are arranged. You can specify the + layout in a variety of ways: + - you can provide a pre-computed layout structure (see prepare_layout) + - you can give the name of an ascii layout file with extension *.lay + - you can give the name of an electrode file + - you can give an electrode definition, i.e. "elec" structure + - you can give a gradiometer definition, i.e. "grad" structure + If you do not specify any of these and the data structure contains an + electrode or gradiometer structure, that will be used for creating a + layout. If you want to have more fine-grained control over the layout + of the subplots, you should create your own layout file. + + See also FT_COMPONENTANALYSIS, FT_REJECTCOMPONENT, FT_TOPOPLOTTFR, + FT_SINGLEPLOTTFR, FT_MULTIPLOTTFR, FT_PREPARE_LAYOUT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_topoplotIC.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_topoplotIC", *args, **kwargs) diff --git a/fieldtrip/ft_topoplotTFR.py b/fieldtrip/ft_topoplotTFR.py new file mode 100644 index 0000000..6d37b77 --- /dev/null +++ b/fieldtrip/ft_topoplotTFR.py @@ -0,0 +1,154 @@ +from fieldtrip._runtime import Runtime + + +def ft_topoplotTFR(*args, **kwargs): + """ + FT_TOPOPLOTTFR plots the topographic distribution over the head + of a 3-dimensional data representations such as time-frequency + representation of the power or coherence spectrum. + + Use as + ft_topoplotTFR(cfg, freq) + + The input freq structrure should contain a time-resolved power or + coherence spectrum from FT_FREQANALYSIS or FT_FREQDESCRIPTIVES. + + The configuration can have the following parameters + cfg.parameter = field that contains the data to be plotted as color, for example 'avg', 'powspctrm' or 'cohspctrm' (default is automatic) + cfg.maskparameter = field in the data to be used for masking of data. It should have alues between 0 and 1, where 0 corresponds to transparent. + cfg.xlim = limit for 1st dimension in data (e.g., time), can be 'maxmin' or [xmin xmax] (default = 'maxmin') + cfg.ylim = limit for 2nd dimension in data (e.g., freq), can be 'maxmin' or [ymin ymax] (default = 'maxmin') + cfg.zlim = limits for color dimension, 'maxmin', 'maxabs', 'zeromax', 'minzero', or [zmin zmax] (default = 'maxmin') + cfg.channel = Nx1 cell-array with selection of channels (default = 'all'), see FT_CHANNELSELECTION for details + cfg.refchannel = name of reference channel for visualising connectivity, can be 'gui' + cfg.baseline = 'yes','no' or [time1 time2] (default = 'no'), see FT_TIMELOCKBASELINE or FT_FREQBASELINE + cfg.baselinetype = 'absolute' or 'relative' (default = 'absolute') + cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all') + cfg.magscale = number, scaling to apply to the MEG magnetometer channels prior to display + cfg.gradscale = number, scaling to apply to the MEG gradiometer channels prior to display + cfg.colormap = string, or Nx3 matrix, see FT_COLORMAP + cfg.marker = 'on', 'labels', 'numbers', 'off' + cfg.markersymbol = channel marker symbol (default = 'o') + cfg.markercolor = channel marker color (default = [0 0 0] (black)) + cfg.markersize = channel marker size (default = 2) + cfg.markerfontsize = font size of channel labels (default = 8 pt) + cfg.highlight = 'off', 'on', 'labels', 'numbers' + cfg.highlightchannel = Nx1 cell-array with selection of channels, or vector containing channel indices see FT_CHANNELSELECTION + cfg.highlightsymbol = highlight marker symbol (default = 'o') + cfg.highlightcolor = highlight marker color (default = [0 0 0] (black)) + cfg.highlightsize = highlight marker size (default = 6) + cfg.highlightfontsize = highlight marker size (default = 8) + cfg.hotkeys = enables hotkeys (pageup/pagedown/m) for dynamic zoom and translation (ctrl+) of the color limits + cfg.colorbar = 'yes' + 'no' (default) + 'North' inside plot box near top + 'South' inside bottom + 'East' inside right + 'West' inside left + 'NorthOutside' outside plot box near top + 'SouthOutside' outside bottom + 'EastOutside' outside right + 'WestOutside' outside left + cfg.colorbartext = string indicating the text next to colorbar + cfg.interplimits = limits for interpolation (default = 'head') + 'sensors' to furthest sensor + 'head' to edge of head + cfg.interpolation = 'linear','cubic','nearest','v4' (default = 'v4') see GRIDDATA + cfg.style = plot style (default = 'both') + 'straight' colormap only + 'contour' contour lines only + 'both' both colormap and contour lines + 'fill' constant color between lines + 'blank' only the head shape + 'straight_imsat' colormap only, vector-graphics friendly + 'both_imsat' both colormap and contour lines, vector-graphics friendly + cfg.gridscale = scaling grid size (default = 67) + determines resolution of figure + cfg.shading = 'flat' or 'interp' (default = 'flat') + cfg.comment = 'no', 'auto' or 'xlim' (default = 'auto') + 'auto': date, xparam, yparam and parameter limits are printed + 'xlim': only xparam limits are printed + 'ylim': only yparam limits are printed + cfg.commentpos = string or two numbers, position of the comment (default = 'leftbottom') + 'lefttop' 'leftbottom' 'middletop' 'middlebottom' 'righttop' 'rightbottom' + 'title' to place comment as title + 'layout' to place comment as specified for COMNT in layout + [x y] coordinates + cfg.interactive = Interactive plot 'yes' or 'no' (default = 'yes') + In a interactive plot you can select areas and produce a new + interactive plot when a selected area is clicked. Multiple areas + can be selected by holding down the SHIFT key. + cfg.directionality = '', 'inflow' or 'outflow' specifies for + connectivity measures whether the inflow into a + node, or the outflow from a node is plotted. The + (default) behavior of this option depends on the dimor + of the input data (see below). + cfg.layout = specify the channel layout for plotting using one of + the supported ways (see below). + cfg.interpolatenan = string 'yes', 'no' (default = 'yes') + interpolate over channels containing NaNs + cfg.figure = 'yes', 'no', or 'subplot', whether to open a new figure. You can also specify a figure + handle from FIGURE, GCF or SUBPLOT. (default = 'yes'). With multiple data inputs, 'subplot' + will make subplots in a single figure. + + For the plotting of directional connectivity data the cfg.directionality option determines what is plotted. The default + value and the supported functionality depend on the dimord of the input data. If the input data is of dimord 'chan_chan_XXX', + the value of directionality determines whether, given the reference channel(s), the columns (inflow), or rows (outflow) are + selected for plotting. In this situation the default is 'inflow'. Note that for undirected measures, inflow and outflow should + give the same output. If the input data is of dimord 'chancmb_XXX', the value of directionality determines whether the rows in + data.labelcmb are selected. With 'inflow' the rows are selected if the refchannel(s) occur in the right column, with 'outflow' + the rows are selected if the refchannel(s) occur in the left column of the labelcmb-field. Default in this case is '', which + means that all rows are selected in which the refchannel(s) occur. This is to robustly support linearly indexed undirected + connectivity metrics. In the situation where undirected connectivity measures are linearly indexed, specifying 'inflow' or + outflow' can result in unexpected behavior. + + The layout defines how the channels are arranged. You can specify the + layout in a variety of ways: + - you can provide a pre-computed layout structure (see prepare_layout) + - you can give the name of an ascii layout file with extension *.lay + - you can give the name of an electrode file + - you can give an electrode definition, i.e. "elec" structure + - you can give a gradiometer definition, i.e. "grad" structure + If you do not specify any of these and the data structure contains an + electrode or gradiometer structure, that will be used for creating a + layout. If you want to have more fine-grained control over the layout + of the subplots, you should create your own layout file. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.inputfile = ... + If you specify this option the input data will be read from a *.mat + file on disk. This mat files should contain only a single variable named 'data', + corresponding to the input structure. For this particular function, the input should be + structured as a cell-array. + + See also FT_TOPOPLOTER, FT_TOPOPLOTIC, FT_SINGLEPLOTTFR, FT_MULTIPLOTTFR, FT_PREPARE_LAYOUT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_topoplotTFR.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_topoplotTFR", *args, **kwargs) diff --git a/fieldtrip/ft_virtualchannel.py b/fieldtrip/ft_virtualchannel.py new file mode 100644 index 0000000..d34872b --- /dev/null +++ b/fieldtrip/ft_virtualchannel.py @@ -0,0 +1,77 @@ +from fieldtrip._runtime import Runtime + + +def ft_virtualchannel(*args, **kwargs): + """ + FT_VIRTUALCHANNEL creates virtual channel data, combining numeric data from a data + structure defined at the channel level with spatial filter information from a + source data structure, and optional parcellation information. + + Use as + output = ft_virtualchannel(cfg, data, source) + or + output = ft_virtualchannel(cfg, data, source, parcellation) + + where the input "data" is a channel-level data structure that can be linearly + mapped onto the virtual channel level, e.g. a raw data structure obtained with + FT_PREPROCESSING, a timelock structure, obtained with FT_TIMELOCKANALYSIS, or a + freq structure with fourierspectra, obtained with FT_FREQANALYSIS. + + The input "source" is a source structure that has been obtained with + FT_SOURCEANALYSIS, and which contains spatial filter information for at least one + dipole location, in the source.filter, or source.avg.filter field. + + The optional input "parcellation" is described in detail in + FT_DATATYPE_PARCELLATION (2-D) or FT_DATATYPE_SEGMENTATION (3-D) and can be + obtained from FT_READ_ATLAS or from a custom parcellation/segmentation for your + individual subject. Alternatively, the input "source" can already contain a + parcellation. + + The configuration "cfg" is a structure that should either contain + cfg.pos = Nx3 matrix containing the dipole positions for the virtual + channel(s). These positions should match the entries in + the source.pos field. (default = []) + or + cfg.parcellation = string, name of the field that is used for the + parcel labels. (default = []) + cfg.parcel = string, or cell-array of strings, specifying for which + parcels to return the output. (default = 'all') + + Moreover, the cfg structure can contain + cfg.method = string, determines how the components of the specified virtual + channel(s) are to to be combined. 'svd' (default), 'none', 'pca', + 'runica', 'fastica', 'dss'. + cfg.numcomponent = scalar (or 'all'), determines the number of components per virtual + channel in the output. (default = 1) + + See also FT_SOURCEANALYSIS, FT_DATATYPE_PARCELLATION, FT_DATATYPE_SEGMENTATION, + FT_SOURCEPARCELLATE, FT_COMPONENTANALYSIS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_virtualchannel.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_virtualchannel", *args, **kwargs) diff --git a/fieldtrip/ft_volumebiascorrect.py b/fieldtrip/ft_volumebiascorrect.py new file mode 100644 index 0000000..7962b26 --- /dev/null +++ b/fieldtrip/ft_volumebiascorrect.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def ft_volumebiascorrect(*args, **kwargs): + """ + FT_VOLUMEBIASCORRECT corrects the image inhomogeneity bias in an anatomical MRI + + Use as + mri_unbias = ft_volumebiascorrect(cfg, mri) + where the input mri should be a single anatomical volume organised in a structure + as obtained from the FT_READ_MRI function + + The configuration structure can contain + cfg.spmversion = string, 'spm8', 'spm12' (default = 'spm12') + cfg.opts = struct, containing spmversion specific options. + See the code below and the SPM-documentation for + more information. + + See also FT_VOLUMEREALIGN FT_VOLUMESEGMENT FT_VOLUMENORMALISE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_volumebiascorrect.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_volumebiascorrect", *args, **kwargs) diff --git a/fieldtrip/ft_volumedownsample.py b/fieldtrip/ft_volumedownsample.py new file mode 100644 index 0000000..49d8d69 --- /dev/null +++ b/fieldtrip/ft_volumedownsample.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def ft_volumedownsample(*args, **kwargs): + """ + FT_VOLUMEDOWNSAMPLE downsamples, or more precisely decimates an anatomical MRI or + source reconstruction and optionally normalizes its coordinate axes, keeping the + homogenous transformation matrix correct. + + Use as + [downsampled] = ft_volumedownsample(cfg, data) + where the input data structure should be an anatomical MRI that was for example + read with FT_READ_MRI or should be a volumetric source reconstruction from + FT_SOURCEANALYSIS or FT_SOURCEINTERPOLATE. + + The configuration can contain + cfg.downsample = integer number (default = 1, i.e. no downsampling) + cfg.parameter = string, data field to downsample (default = 'all') + cfg.smooth = 'no' or the FWHM of the gaussian kernel in voxels (default = 'no') + cfg.keepinside = 'yes' or 'no', keep the inside/outside labeling (default = 'yes') + cfg.spmversion = string, 'spm2', 'spm8', 'spm12' (default = 'spm12') + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_SOURCEINTERPOLATE, FT_VOLUMEWRITE and FT_VOLUMENORMALISE + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_volumedownsample.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_volumedownsample", *args, **kwargs) diff --git a/fieldtrip/ft_volumelookup.py b/fieldtrip/ft_volumelookup.py new file mode 100644 index 0000000..be14f14 --- /dev/null +++ b/fieldtrip/ft_volumelookup.py @@ -0,0 +1,99 @@ +from fieldtrip._runtime import Runtime + + +def ft_volumelookup(*args, **kwargs): + """ + FT_VOLUMELOOKUP can be used in to combine an anatomical or functional + atlas with the source reconstruction results. You can use it for forward + and reverse lookup. + + Given the region of interest (ROI) as anatomical or functional label, it + looks up the locations and creates a mask (as a binary volume) based on + the label. Given the ROI as point in the brain, it creates a sphere or + box around that point. In these two case the function is to be used as: + mask = ft_volumelookup(cfg, volume) + + Given a binary volume that indicates a ROI or a point of interest (POI), + it looks up the corresponding anatomical or functional labels from the + atlas. In this case the function is to be used as: + labels = ft_volumelookup(cfg, volume) + + In both cases the input volume can be: + mri is the output of FT_READ_MRI source is the output of FT_SOURCEANALYSIS + stat is the output of FT_SOURCESTATISTICS + + The configuration options for a mask according to an atlas: + cfg.atlas = string, filename of atlas to use, see FT_READ_ATLAS + cfg.roi = string or cell-array of strings, ROI from anatomical atlas + + The configuration options for a spherical/box mask around a POI: + cfg.roi = Nx3 vector, coordinates of the POI + cfg.sphere = radius of each sphere in cm/mm dep on unit of input + cfg.box = Nx3 vector, size of each box in cm/mm dep on unit of input + cfg.round2nearestvoxel = 'yes' or 'no' (default = 'no'), voxel closest to point of interest is calculated + and box/sphere is centered around coordinates of that voxel + + The configuration options for labels from a mask: + cfg.atlas = string, filename of atlas to use, see FT_READ_ATLAS + cfg.maskparameter = string, field in volume to be looked up, data in field should be logical + cfg.minqueryrange = number, should be odd and <= to maxqueryrange (default = 1) + cfg.maxqueryrange = number, should be odd and >= to minqueryrange (default = 1) + + The configuration options for labels around POI: + cfg.output = 'single' always outputs one label; if several POI are provided, they are considered together as describing a ROI (default) + 'multiple' outputs one label per POI (e.g., choose to get labels for different electrodes) + cfg.roi = Nx3 vector, coordinates of the POI + cfg.atlas = string, filename of atlas to use, see FT_READ_ATLAS + cfg.minqueryrange = number, should be odd and <= to maxqueryrange (default = 1) + cfg.maxqueryrange = number, should be odd and >= to minqueryrange (default = 1) + cfg.querymethod = 'sphere' searches voxels around the ROI in a sphere (default) + = 'cube' searches voxels around the ROI in a cube + cfg.round2nearestvoxel = 'yes' or 'no', voxel closest to POI is calculated (default = 'yes') + + The label output has a field "names", a field "count" and a field "usedqueryrange". + To get a list of areas of the given mask you can do for instance: + [tmp ind] = sort(labels.count,1,'descend'); + sel = find(tmp); + for j = 1:length(sel) + found_areas{j,1} = [num2str(labels.count(ind(j))) ': ' labels.name{ind(j)}]; + end + In the "found_areas" variable you can then see how many times which labels are + found. Note that in the AFNI brick one location can have 2 labels. + + Dependent on the input coordinates and the coordinates of the atlas, the + input MRI is transformed betweem MNI and Talairach-Tournoux coordinates + See http://www.mrc-cbu.cam.ac.uk/Imaging/Common/mnispace.shtml for more details. + + See http://www.fieldtriptoolbox.org/template/atlas for a list of templates and + atlasses that are included in the FieldTrip release. + + See also FT_READ_ATLAS, FT_SOURCEPLOT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_volumelookup.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_volumelookup", *args, **kwargs) diff --git a/fieldtrip/ft_volumenormalise.py b/fieldtrip/ft_volumenormalise.py new file mode 100644 index 0000000..fb4aeca --- /dev/null +++ b/fieldtrip/ft_volumenormalise.py @@ -0,0 +1,90 @@ +from fieldtrip._runtime import Runtime + + +def ft_volumenormalise(*args, **kwargs): + """ + FT_VOLUMENORMALISE normalises anatomical and functional volume data + to a template anatomical MRI. + + Use as + [mri] = ft_volumenormalise(cfg, mri) + where the input mri should be a single anatomical volume that was for + example read with FT_READ_MRI. + + The configuration options can be + cfg.parameter = cell-array with the functional data to be normalised (default = 'all') + cfg.keepinside = 'yes' or 'no', keep the inside/outside labeling (default = 'yes') + cfg.downsample = integer number (default = 1, i.e. no downsampling) + cfg.spmversion = string, 'spm2', 'spm8', 'spm12' (default = 'spm12') + cfg.spmmethod = 'old', 'new' or 'mars', to switch between the different + spm12 implementations. The methods 'new' or 'mars' + uses SPM tissue probability maps instead of the + template MRI specified in cfg.template. + cfg.opts = structure with normalisation options, see SPM documentation for details + cfg.template = string, filename of the template anatomical MRI (default = 'T1.mnc' + for spm2 or 'T1.nii' for spm8 and for spm12). + cfg.templatecoordsys = the coordinate system of the template when using a template other + than the default + cfg.templatemask = string, filename of a mask for the template + anatomical MRI spcified in cfg.template, e.g. a + brain mask (optional). + cfg.tpm = string, file name of the SPM tissue probability map to use in + case spmversion is 'spm12' and spmmethod is 'new' or 'mars' + cfg.write = 'yes' or 'no' (default = 'no'), writes the segmented volumes to SPM2 + compatible analyze-file, with the suffix + _anatomy for the anatomical MRI volume + _param for each of the functional volumes + cfg.name = string for output filename + cfg.keepintermediate = 'yes' or 'no' (default = 'no') + cfg.intermediatename = string, prefix of the the coregistered images and of the original + images in the original headcoordinate system + cfg.nonlinear = 'yes' (default) or 'no', estimates a nonlinear transformation + in addition to the linear affine registration. If a reasonably + accurate normalisation is sufficient, a purely linearly transformed + image allows for 'reverse-normalisation', which might come in handy + when for example a region of interest is defined on the normalised + group-average + cfg.spmparams = you can feed in the parameters from a prior normalisation, for example + to apply the parameters determined from an aantomical MRI to an + interpolated source resontruction + cfg.initial = optional hard-coded alignment between target and template, the default is + to use FT_CONVERT_COORDSYS to estimate it based on the data (default = []) + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_READ_MRI, FT_VOLUMEDOWNSAMPLE, FT_SOURCEINTERPOLATE, FT_SOURCEPLOT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_volumenormalise.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_volumenormalise", *args, **kwargs) diff --git a/fieldtrip/ft_volumerealign.py b/fieldtrip/ft_volumerealign.py new file mode 100644 index 0000000..60386fb --- /dev/null +++ b/fieldtrip/ft_volumerealign.py @@ -0,0 +1,222 @@ +from fieldtrip._runtime import Runtime + + +def ft_volumerealign(*args, **kwargs): + """ + FT_VOLUMEREALIGN spatially aligns an anatomical MRI with head coordinates based on + external fiducials or anatomical landmarks. This function typically does not change + the anatomical MRI volume itself, but only adjusts the homogeneous transformation + matrix that describes the mapping from voxels to the coordinate system. It also + appends a coordsys-field to the output data, or it updates it. This field specifies + how the x/y/z-axes of the coordinate system should be interpreted. Occasionally, + the orientation and handedness of the output volume may be different from the + orientation and handedness of the input volume. This is determined by the cfg.flip + argument. See the code for more details. + + For spatial normalisation and deformation (i.e. warping) an MRI to a template brain + you should use the FT_VOLUMENORMALISE function. + + Different methods for aligning the anatomical MRI to a coordinate system are + implemented, which are described in detail below: + + INTERACTIVE - This shows a graphical user interface in which you can click on the + location of anatomical landmarks or fiducials. The anatomical data can be displayed + as three orthogonal MRI slices or as a rendering of the head surface. The + coordinate system is updated according to the definition of the coordinates of + these fiducials. + + FIDUCIAL - The coordinate system is updated according to the definition of the + coordinates of anatomical landmarks or fiducials that are specified in the + configuration. + + HEADSHAPE - Match the head surface from the MRI with a measured head surface using + an iterative closest point procedure. The MRI will be updated to match the measured + head surface. You can optionally do an initial manual coregistration of the two head + surfaces. + + SPM - Align the individual MRI to the coordinate system of a target or template MRI + by matching the two volumes. + + FSL - Align the individual MRI to the coordinate system of a target or template MRI + by matching the two volumes. + + Use as + [mri] = ft_volumerealign(cfg, mri) + or + [mri] = ft_volumerealign(cfg, mri, target) + where the first input is the configuration structure, the second input is an + anatomical or functional MRI volume and the third (optional) input is the the + target anatomical MRI for SPM or FSL. + + The configuration can contain the following options + cfg.method = string representing the method for aligning + 'interactive' use the GUI to specify the fiducials + 'fiducial' use pre-specified fiducials + 'headshape' match the MRI surface to a headshape + 'spm' match to template anatomical MRI + 'fsl' match to template anatomical MRI + cfg.coordsys = string specifying the origin and the axes of the coordinate + system. Supported coordinate systems are 'ctf', '4d', 'bti', + 'eeglab', 'neuromag', 'itab', 'yokogawa', 'asa', 'acpc', + and 'paxinos'. See http://tinyurl.com/ojkuhqz + cfg.clim = [min max], scaling of the anatomy color (default is automatic) + cfg.parameter = 'anatomy' the parameter which is used for the visualization + cfg.viewresult = string, 'yes' or 'no', whether or not to visualize aligned volume(s) + after realignment (default = 'no') + cfg.flip = string, 'yes' or 'no', to realign the volume approximately to the + input coordinate axes, this may reorient the output volume relative + to the input (default = 'yes', when cfg.method = 'interactive', and 'no' otherwise) + + When cfg.method = 'interactive', a user interface allows for the specification of + the fiducials or landmarks using the mouse, cursor keys and keyboard. The fiducials + can be specified by pressing the corresponding key on the keyboard (n/l/r or + a/p/z). When pressing q the interactive mode will stop and the transformation + matrix is computed. This method supports the following options: + cfg.viewmode = 'ortho' or 'surface', visualize the anatomical MRI as three + slices or visualize the extracted head surface (default = 'ortho') + cfg.snapshot = 'no' ('yes'), making a snapshot of the image once a + fiducial or landmark location is selected. The optional second + output argument to the function will contain the handles to these + figures. + cfg.snapshotfile = 'ft_volumerealign_snapshot' or string, the root of + the filename for the snapshots, including the path. If no path + is given the files are saved to the pwd. The consecutive + figures will be numbered and saved as png-file. + + When cfg.method = 'fiducial' and cfg.coordsys is based on external anatomical + landmarks, as is common for EEG and MEG, the following is required to specify the + voxel indices of the fiducials: + cfg.fiducial.nas = [i j k], position of nasion + cfg.fiducial.lpa = [i j k], position of LPA + cfg.fiducial.rpa = [i j k], position of RPA + cfg.fiducial.zpoint = [i j k], a point on the positive z-axis. This is + an optional 'fiducial', and can be used to determine + whether the input voxel coordinate axes are left-handed + (i.e. flipped in one of the dimensions). If this additional + point is specified, and the voxel coordinate axes are left + handed, the volume is flipped to yield right handed voxel + axes. + + When cfg.method = 'fiducial' and cfg.coordsys = 'acpc', as is common for fMRI, + the following is required to specify the voxel indices of the fiducials: + cfg.fiducial.ac = [i j k], position of anterior commissure + cfg.fiducial.pc = [i j k], position of posterior commissure + cfg.fiducial.xzpoint = [i j k], point on the midsagittal-plane with a + positive Z-coordinate, i.e. an interhemispheric + point above ac and pc + The coordinate system will be according to the RAS_Tal convention, i.e. + the origin corresponds with the anterior commissure the Y-axis is along + the line from the posterior commissure to the anterior commissure the + Z-axis is towards the vertex, in between the hemispheres the X-axis is + orthogonal to the YZ-plane, positive to the right. + + When cfg.method = 'fiducial' and cfg.coordsys = 'paxinos' for a mouse brain, + the following is required to specify the voxel indices of the fiducials: + cfg.fiducial.bregma = [i j k], position of bregma + cfg.fiducial.lambda = [i j k], position of lambda + cfg.fiducial.yzpoint = [i j k], point on the midsagittal-plane + + With the 'interactive' and 'fiducial' methods it is possible to define an + additional point (with the key 'z'), which should be a point on the positive side + of the xy-plane, i.e. with a positive z-coordinate in world coordinates. This point + will subsequently be used to check whether the input coordinate system is left or + right-handed. For the 'interactive' method you can also specify an additional + control point (with the key 'r'), that should be a point with a positive coordinate + on the left-right axis, i.e.', a point on the right of the head. + + When cfg.method = 'headshape', the function extracts the scalp surface from the + anatomical MRI, and aligns this surface with the user-supplied headshape. + Additional options pertaining to this method should be defined in the subcfg + cfg.headshape. The following option is required: + cfg.headshape.headshape = string pointing to a headshape structure or a + file containing headshape, see FT_READ_HEADSHAPE + + Additional options pertaining to the headshape method should be specified in + the sub-structure cfg.headshape and can include: + cfg.headshape.scalpsmooth = scalar, smoothing parameter for the scalp + extraction (default = 2) + cfg.headshape.scalpthreshold = scalar, threshold parameter for the scalp + extraction (default = 0.1) + cfg.headshape.interactive = 'yes' or 'no', use interactive realignment to + align headshape with scalp surface (default = 'yes') + cfg.headshape.icp = 'yes' or 'no', use automatic realignment + based on the icp-algorithm. If both 'interactive' + and 'icp' are executed, the icp step follows the + interactive realignment step (default = 'yes') + + When cfg.method = 'spm', a third input argument is required. The input volume is + coregistered to this target volume, using SPM. You can specify the version of + the SPM toolbox to use with + cfg.spmversion = string, 'spm2', 'spm8', 'spm12' (default = 'spm12') + + Additional options pertaining to SPM2 and SPM8 should be defined in the + sub-structure cfg.spm and can include: + cfg.spm.regtype = 'subj', 'rigid' + cfg.spm.smosrc = scalar value + cfg.spm.smoref = scalar value + + Additional options pertaining to SPM12 should be defined in the + sub-structure cfg.spm and can include: + cfg.spm.sep = optimisation sampling steps (mm), default: [4 2] + cfg.spm.params = starting estimates (6 elements), default: [0 0 0 0 0 0] + cfg.spm.cost_fun = cost function string: + 'mi' - Mutual Information (default) + 'nmi' - Normalised Mutual Information + 'ecc' - Entropy Correlation Coefficient + 'ncc' - Normalised Cross Correlation + cfg.spm.tol = tolerences for accuracy of each param, default: [0.02 0.02 0.02 0.001 0.001 0.001] + cfg.spm.fwhm = smoothing to apply to 256x256 joint histogram, default: [7 7] + + When cfg.method is 'fsl', a third input argument is required. The input volume is + coregistered to this target volume, using FSL-flirt. Additional options pertaining + to the FSL method should be defined in the sub-structure cfg.fsl and can include: + cfg.fsl.path = string, specifying the path to fsl + cfg.fsl.costfun = string, specifying the cost-function used for + coregistration + cfg.fsl.interpmethod = string, specifying the interpolation method, can be + 'trilinear', 'nearestneighbour', or 'sinc' + cfg.fsl.dof = scalar, specifying the number of parameters for the + affine transformation. 6 (rigid body), 7 (global + rescale), 9 (traditional) or 12. + cfg.fsl.reslice = string, specifying whether the output image will be + resliced conform the target image (default = 'yes') + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a + *.mat file on disk and/or the output data will be written to a *.mat + file. These mat files should contain only a single variable, + corresponding with the input/output structure. + + See also FT_READ_MRI, FT_VOLUMERESLICE, FT_INTERACTIVEREALIGN, FT_ELECTRODEREALIGN, + FT_DETERMINE_COORDSYS, SPM_AFFREG, SPM_NORMALISE, SPM_COREG + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_volumerealign.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_volumerealign", *args, **kwargs) diff --git a/fieldtrip/ft_volumereslice.py b/fieldtrip/ft_volumereslice.py new file mode 100644 index 0000000..9d3a927 --- /dev/null +++ b/fieldtrip/ft_volumereslice.py @@ -0,0 +1,72 @@ +from fieldtrip._runtime import Runtime + + +def ft_volumereslice(*args, **kwargs): + """ + FT_VOLUMERESLICE flips, permutes, interpolates and/or reslices a volume along the + principal axes of the coordinate system according to a specified resolution. + + Use as + mri = ft_volumereslice(cfg, mri) + where the input MRI should be a single anatomical or functional MRI volume that + results from FT_READ_MRI or FT_VOLUMEREALIGN. You can visualize the the input and + output using FT_SOURCEPLOT. + + The configuration structure can contain + cfg.method = string, 'flip', 'nearest', 'linear', 'cubic' or 'spline' (default = 'linear') + cfg.downsample = integer number (default = 1, i.e. no downsampling) + + If you specify the method as 'flip', it will only permute and flip the volume, but + not perform any interpolation. For the other methods the input volumetric data will + also be interpolated on a regular voxel grid. + + For the interpolation methods you should specify + cfg.resolution = number, in units of distance (e.g. mm) + cfg.xrange = [min max], in units of distance (e.g. mm) + cfg.yrange = [min max], in units of distance (e.g. mm) + cfg.zrange = [min max], in units of distance (e.g. mm) + or alternatively with + cfg.dim = [nx ny nz], size of the volume in each direction + + If the input MRI has a coordsys-field and you don't specify explicit the + xrange/yrange/zrange, the centre of the volume will be shifted (with respect to the + origin of the coordinate system), for the brain to fit nicely in the box. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat + file on disk and/or the output data will be written to a *.mat file. These mat + files should contain only a single variable, corresponding with the + input/output structure. + + See also FT_VOLUMEREALIGN, FT_VOLUMEDOWNSAMPLE, FT_SOURCEINTERPOLATE, FT_SOURCEPLOT + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_volumereslice.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_volumereslice", *args, **kwargs) diff --git a/fieldtrip/ft_volumesegment.py b/fieldtrip/ft_volumesegment.py new file mode 100644 index 0000000..defbf1b --- /dev/null +++ b/fieldtrip/ft_volumesegment.py @@ -0,0 +1,154 @@ +from fieldtrip._runtime import Runtime + + +def ft_volumesegment(*args, **kwargs): + """ + FT_VOLUMESEGMENT segments an anatomical MRI. The behavior depends on the output requested. It can + return probabilistic tissue maps of gray/white/csf compartments, a skull-stripped anatomy, or + binary masks representing the brain surface, skull, or scalp surface. + + Use as + segmented = ft_volumesegment(cfg, mri) + where the input mri should be a single anatomical volume that was for example read with + FT_READ_MRI. For the purpose of creating binary masks of the brain or of the skull, you can also + provide either the anatomical volume or the already segmented volume (with the probabilistic + tissue maps) as input. + + The configuration structure can contain + cfg.output = string or cell-array of strings, see below (default = 'tpm') + cfg.spmversion = string, 'spm2', 'spm8', 'spm12' (default = 'spm12') + cfg.spmmethod = string with he algorithm used when spm12 is used, this + can be 'old', 'new', 'mars' (default = 'old') + cfg.opts = structure with spm-version specific options. See the + code and/or the SPM-documentation for more detail. + cfg.template = filename of the template anatomical MRI (default = + '/spm2/templates/T1.mnc' or '/spm8/templates/T1.nii') + cfg.tpm = cell-array containing the filenames of the tissue probability maps + cfg.name = string for output filename + cfg.write = 'no' or 'yes' (default = 'no'), writes the probabilistic tissue maps + to SPM compatible analyze (spm2), or nifti (spm8 or spm12) files, + with the following suffix for spm2 + _seg1, for the gray matter segmentation + _seg2, for the white matter segmentation + _seg3, for the csf segmentation + or with the following prefix for spm8 and spm12 with spmmethod='old' + c1, for the gray matter segmentation + c2, for the white matter segmentation + c3, for the csf segmentation + and with spm12 with spmmethod='new' there will be 3 additional tissue types + c4, for the bone segmentation + c5, for the soft tissue segmentation + c6, for the air segmentation + When using spm12 with spmmethod='mars', the tpms will be postprocessed + with the mars toolbox, yielding smoother segmentations in general. + cfg.brainsmooth = 'no', or scalar, the FWHM of the gaussian kernel in voxels, (default = 5) + cfg.scalpsmooth = 'no', or scalar, the FWHM of the gaussian kernel in voxels, (default = 5) + cfg.skullsmooth = 'no', or scalar, the FWHM of the gaussian kernel in voxels, (default = 5) + this parameter is only used when the segmentation contains 6 tisuse types, + including 'bone' + cfg.brainthreshold = 'no', or scalar, relative threshold value which is used to threshold the + tpm in order to create a volumetric brainmask (see below), (default = 0.5) + cfg.scalpthreshold = 'no', or scalar, relative threshold value which is used to threshold the + anatomical data in order to create a volumetric scalpmask (see below), + (default = 0.1) + cfg.skullthreshold = 'no', or scalar, relative threshold value which is used to threshold the + anatomical data in order to create a volumetric scalpmask (see below), + (default = 0.5). this parameter is only used when the segmentation + contains 6 tissue types, including 'bone' + cfg.downsample = integer, amount of downsampling before segmentation (default = 1, which + means no downsampling) + + The desired segmentation output is specified with cfg.output as a string or cell-array of strings + and can contain + 'tpm' - tissue probability map for csf, white and gray matter + 'brain' - binary representation of the brain (the combination of csf, white and gray matter) + 'skull' - binary representation of the skull + 'scalp' - binary representation of the scalp + 'skullstrip' - anatomy with only the brain + + Example use: + cfg = []; + segmented = ft_volumesegment(cfg, mri) will segmented the anatomy and will output the + segmentation result as 3 probabilistic masks in gray, white and csf. + + cfg = []; + cfg.output = 'skullstrip'; + segmented = ft_volumesegment(cfg, mri) will generate a skull-stripped anatomy based on a + brainmask generated from the probabilistic tissue maps. The skull-stripped anatomy + is stored in the field segmented.anatomy. + + cfg = []; + cfg.output = {'brain' 'scalp' 'skull'}; + segmented = ft_volumesegment(cfg, mri) will produce a volume with 3 binary masks, representing + the brain surface, scalp surface, and skull which do not overlap. + + cfg = []; + cfg.output = {'scalp'}; + segmented = ft_volumesegment(cfg, mri) will produce a volume with a binary mask (based on the + anatomy), representing the border of the scalp surface (i.e., everything inside the + surface is also included). Such representation of the scalp is produced faster, + because it doesn't require to create the tissue probabilty maps prior to creating + the mask. + + It is not possible to request tissue-probability maps (tpm) in combination with binary masks + (brain, scalp or skull) or with a skull-stripped anatomy. The output will return only the probabilistic + maps in gray, white and csf. However, when a segmentation with the probabilistic gray, white + and csf representations is available, it is possible to use it as input to create the brain or skull + binary mask. For example: + cfg = []; + cfg.output = {'tpm'}; + segment_tpm = ft_volumesegment(cfg, mri); + cfg.output = {'brain'}; + segment_brain = ft_volumesegment(cfg, segment_tpm); + + For the SPM-based segmentation to work, the coordinate frame of the input MRI needs to be + approximately coregistered to the templates of the probabilistic tissue maps. The templates + are defined in SPM/MNI-space. FieldTrip attempts to do an automatic alignment based on the + coordsys-field in the MRI, and if this is not present, based on the coordsys-field in the cfg. + If none of them is specified the FT_DETERMINE_COORDSYS function is used to interactively + assess the coordinate system in which the MRI is expressed. + + The template MRI is defined in SPM/MNI-coordinates, see also http://bit.ly/2sw7eC4 + x-axis pointing to the right ear + y-axis along the acpc-line + z-axis pointing to the top of the head + origin in the anterior commissure. + Note that the segmentation requires the template MRI to be in SPM coordinates. + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + cfg.outputfile = ... + If you specify one of these (or both) the input data will be read from a *.mat file on disk and/or + the output data will be written to a *.mat file. These mat files should contain only a single + variable, corresponding with the input/output structure. + + See also FT_READ_MRI, FT_DETERMINE_COORDSYS, FT_PREPARE_HEADMODEL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_volumesegment.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_volumesegment", *args, **kwargs) diff --git a/fieldtrip/ft_volumewrite.py b/fieldtrip/ft_volumewrite.py new file mode 100644 index 0000000..759a69d --- /dev/null +++ b/fieldtrip/ft_volumewrite.py @@ -0,0 +1,100 @@ +from fieldtrip._runtime import Runtime + + +def ft_volumewrite(*args, **kwargs): + """ + FT_VOLUMEWRITE exports anatomical or functional volume data to a Analyze + or BrainVoyager file. The data in the resulting file(s) can be + further analyzed and/or visualized in MRIcro, SPM, BrainVoyager, + AFNI or similar packages. + + Use as + ft_volumewrite(cfg, volume) + where the input volume structure should represent an anatomical MRI + that was for example obtained from FT_READ_MRI, the source + reconstruction results from FT_SOURCEANALYSIS, the statistical + results from FT_SOURCESTATISTICS or an otherwise processed anatomical + or functional volume. + + The configuration structure should contain the following elements + cfg.parameter = string, describing the functional data to be processed, + e.g. 'pow', 'coh', 'nai' or 'anatomy' + cfg.filename = filename without the extension + + To determine the file format, the following option can be specified + cfg.filetype = 'analyze_old', 'nifti' (default), 'nifti_img', 'analyze_spm', + 'nifti_spm', 'nifti_gz', 'mgz', 'mgh', 'vmp' or 'vmr' + + Depending on the filetype, the cfg should also contain + cfg.vmpversion = 1 or 2, version of the vmp format to use (default = 2) + cfg.spmversion = string, version of SPM to be used (default = 'spm12') + + The default filetype is 'nifti', which means that a single *.nii file will be + written using code from the freesurfer toolbox. The 'nifti_img' filetype uses SPM + for a dual file (*.img/*.hdr) nifti-format file. The 'nifti_spm' filetype uses SPM + for a single 'nifti' file. + + The analyze, analyze_spm, nifti, nifti_img, nifti_spm and mgz filetypes support a + homogeneous transformation matrix, the other filetypes do not support a homogeneous + transformation matrix and hence will be written in their native coordinate system. + + You can specify the datatype for the nifti, analyze_spm and analyze_old + formats. If not specified, the class of the input data will be preserved, + if the file format allows. Although the higher level function may make an + attempt to typecast the data, only the nifti fileformat preserves the + datatype. Also, only when filetype = 'nifti', the slope and intercept + parameters are stored in the file, so that, when reading the data from + file, the original values are restored (up to the bit resolution). + cfg.datatype = 'uint8', 'int8', 'int16', 'int32', 'single' or 'double' + + By default, integer datatypes will be scaled to the maximum value of the + physical or statistical parameter, floating point datatypes will not be + scaled. This can be modified, for instance if the data contains only integers with + indices into a parcellation, by + cfg.scaling = 'yes' or 'no' + + Optional configuration items are + cfg.downsample = integer number (default = 1, i.e. no downsampling) + cfg.fiducial.nas = [x y z] position of nasion + cfg.fiducial.lpa = [x y z] position of LPA + cfg.fiducial.rpa = [x y z] position of RPA + cfg.markfiducial = 'yes' or 'no', mark the fiducials + cfg.markorigin = 'yes' or 'no', mark the origin + cfg.markcorner = 'yes' or 'no', mark the first corner of the volume + + To facilitate data-handling and distributed computing you can use + cfg.inputfile = ... + If you specify this option the input data will be read from a *.mat + file on disk. This mat files should contain only a single variable named 'data', + corresponding to the input structure. + + See also FT_SOURCEANALYSIS, FT_SOURCESTATISTICS, FT_SOURCEINTERPOLATE, FT_WRITE_MRI + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_volumewrite.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_volumewrite", *args, **kwargs, nargout=0) diff --git a/fieldtrip/ft_wizard.py b/fieldtrip/ft_wizard.py new file mode 100644 index 0000000..ea95790 --- /dev/null +++ b/fieldtrip/ft_wizard.py @@ -0,0 +1,60 @@ +from fieldtrip._runtime import Runtime + + +def ft_wizard(*args, **kwargs): + """ + FT_WIZARD is a graphical user interface to evaluate a FieldTrip analysis + script one step at a time, allowing you to go to the next step if you are + content with the data so far, or to the previous step if you want to repeat it + with different configuration settings. + + Use as + ft_wizard scriptname + or + ft_wizard('scriptname') + + Use the functional form of FT_WIZARD, such as FT_WIZARD('scriptname'), when + the name of the script is stored in a string, when an output argument is + requested, or if the name of the script contains spaces. If you do not + specify an output argument, the results will be stored as variables in + the main MATLAB workspace. + + Besides the buttons, you can use the following key combinations + Ctrl-O load a new script from a file + Ctrl-S save the script to a new file + Ctrl-E open the current script in editor + Ctrl-P go to previous step + Ctrl-N go to next step + Ctrl-Q quit, do not save the variables + Ctrl-X exit, save the variables to the workspace + + See also FT_ANALYSISPROTOCOL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/ft_wizard.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("ft_wizard", *args, **kwargs) diff --git a/fieldtrip/homer2fieldtrip.py b/fieldtrip/homer2fieldtrip.py new file mode 100644 index 0000000..850d2ac --- /dev/null +++ b/fieldtrip/homer2fieldtrip.py @@ -0,0 +1,48 @@ +from fieldtrip._runtime import Runtime + + +def homer2fieldtrip(*args, **kwargs): + """ + HOMER2FIELDTRIP converts a continuous raw data structure from Homer to FieldTrip + format. + + Use as + data = homer2fieldtrip(filename) + where the input is a file name, or + data = homer2fieldtrip(nirs) + where the input nirs structure is according to the Homer format and the output data + structure is formatted according to the output of FT_PREPROCESSING. + + See https://www.nitrc.org/plugins/mwiki/index.php/homer2:Homer_Input_Files#NIRS_data_file_format + for a description of the Homer data structure. + + See also FIELDTRIP2HOMER, FT_PREPROCESSING, FT_DATATYPE_RAW + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/homer2fieldtrip.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("homer2fieldtrip", *args, **kwargs) diff --git a/fieldtrip/imotions2fieldtrip.py b/fieldtrip/imotions2fieldtrip.py new file mode 100644 index 0000000..d838b62 --- /dev/null +++ b/fieldtrip/imotions2fieldtrip.py @@ -0,0 +1,59 @@ +from fieldtrip._runtime import Runtime + + +def imotions2fieldtrip(*args, **kwargs): + """ + IMOTIONS2FIELDTRIP imports an iMotions *.txt file and represents it as a FieldTrip + raw data structure. + + Use as + data = imotions2fieldtrip(filename, ...) + + Additional options should be specified in key-value pairs and can be + interpolate = 'no', 'time' or 'data' (default = 'no') + isnumeric = cell-array with labels corresponding to numeric data (default = {}) + isinteger = cell-array with labels corresponding to integer data that should be interpolated with nearest where applicable (default = {}) + isnotnumeric = cell-array with labels not corresponding to numeric data (default = {}) + isevent = cell-array with labels corresponding to events (default = {}) + isnotevent = cell-array with labels not corresponding to events (default = {}) + + The options 'isnumeric' and 'isnotnumeric' are mutually exclusive. Idem for + 'isevent' and 'isnotevent'. + + When using the interpolate='data' option, both the data and the time are interpolated + to a regularly sampled representation, when using the interpolate='time' option, only + the time axis is interpolated to a regularly sampled representation. This addresses + the case that the data was actually acquired with a regular sampling rate, but the time + stamps in the file are not correctly representing this (a known bug with some type of + iMotions data). + + See also FT_DATATYPE_RAW, FT_PREPROCESSING, FT_HEARTRATE, FT_ELECTRODERMALACTIVITY + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/imotions2fieldtrip.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("imotions2fieldtrip", *args, **kwargs) diff --git a/fieldtrip/loreta2fieldtrip.py b/fieldtrip/loreta2fieldtrip.py new file mode 100644 index 0000000..9cb48f8 --- /dev/null +++ b/fieldtrip/loreta2fieldtrip.py @@ -0,0 +1,49 @@ +from fieldtrip._runtime import Runtime + + +def loreta2fieldtrip(*args, **kwargs): + """ + LORETA2FIELDTRIP reads and converts a LORETA source reconstruction into a + FieldTrip data structure, which subsequently can be used for statistical + analysis or other analysis methods implemented in Fieldtrip. + + Use as + [source] = loreta2fieldtrip(filename, ...) + where optional arguments can be passed as key-value pairs. + + filename can be the binary file from LORETA or a LORETA file exported as + a text file (using the format converter in LORETA-KEY). + + The following optional arguments are supported + 'timeframe' = integer number, which timepoint to read (default is to read all) + + See also EEGLAB2FIELDTRIP, SPM2FIELDTRIP, NUTMEG2FIELDTRIP, SPASS2FIELDTRIP + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/loreta2fieldtrip.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("loreta2fieldtrip", *args, **kwargs) diff --git a/fieldtrip/nutmeg2fieldtrip.py b/fieldtrip/nutmeg2fieldtrip.py new file mode 100644 index 0000000..01e970a --- /dev/null +++ b/fieldtrip/nutmeg2fieldtrip.py @@ -0,0 +1,62 @@ +from fieldtrip._runtime import Runtime + + +def nutmeg2fieldtrip(*args, **kwargs): + """ + NUTMEG2FIELDTRIP converts from NUTMEG either a sensor data structure + ('nuts') to a valid FieldTrip 'raw' structure (plus 'sourcemodel' and + 'mri' if available), OR a source structure ('beam') to a valid FieldTrip + source structure. + + Use as + [data, mri, sourcemodel] = nutmeg2fieldtrip(cfg, fileorstruct) + + Input: + cfg + .keepmri (required for either input): =1 calls ft_read_mri for 'mri' output; =0 not save out 'mri' + .out (required for source input): 's' (pos_freq_time) or 'trial' (pos_rpt) + fileorstruct: may be one of following: + 1) *.mat file containing nuts sensor structure + 2) nuts sensor structure + 3) s*.mat file containing beam source structure + 4) beam source structure (output from Nutmeg (beamforming_gui, tfbf, or tfZ) + (only scalar not vector results supported at the moment) + + Output: depending on input, one of options + 1) If nuts sensor structure input, then 'data' will be 'raw' and + optionally 'sourcemodel' if Lp present, or 'mri' if individual MRI present + 2) If beam source structure input, then 'data' will be 'source' + (May be an array of source structures (source{1} etc)) + 'sourcemodel' and 'mri' may be output as well if present in beam structure + + See alo FT_DATATYPE_RAW, FT_DATATYPE_SOURCE, LORETA2FIELDTRIP, SPASS2FIELDTRIP, + FIELDTRIP2SPSS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/nutmeg2fieldtrip.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("nutmeg2fieldtrip", *args, **kwargs) diff --git a/fieldtrip/spass2fieldtrip.py b/fieldtrip/spass2fieldtrip.py new file mode 100644 index 0000000..89c06b2 --- /dev/null +++ b/fieldtrip/spass2fieldtrip.py @@ -0,0 +1,67 @@ +from fieldtrip._runtime import Runtime + + +def spass2fieldtrip(*args, **kwargs): + """ + SPASS2FIELDTRIP reads data from a set of SPASS data files and converts + the contents into data structures that FieldTrip understands. Note that + dependent on the SPASS data it might be required to change some + hard-coded parameters inside this function. + + Use as + [lfp, spike, stm, bhv] = spass2fieldtrip(dirname) + Optionally you can specify the sample rate as key-value pairs + 'fsample_ana' - default 1000 + 'fsample_swa' - default 32000 + + The specified directory should contain the SPASS files, and the files should have + the same name as the directory. + + The swa and sti input file are combined into the spike output structure. + For the rest of the data it is trivial how the input and output relate. + + For example, if you specify + [lfp, spike, bhv, stm] = spass2fieldtrip('jeb012a02') + then the following files should exist: + 'jeb012a02/jeb012a02.ana' + 'jeb012a02/jeb012a02.swa' + 'jeb012a02/jeb012a02.spi' + 'jeb012a02/jeb012a02.stm' + 'jeb012a02/jeb012a02.bhv' + + Subsequently you can analyze the data in FieldTrip, or write the spike + waveforms to a nex file for offline sorting using + ft_write_spike('jeb012a02_ch1.nex', spike, 'dataformat', 'plexon_nex', 'chanindx', 1) + ft_write_spike('jeb012a02_ch2.nex', spike, 'dataformat', 'plexon_nex', 'chanindx', 2) + ft_write_spike('jeb012a02_ch3.nex', spike, 'dataformat', 'plexon_nex', 'chanindx', 3) + + See also NUTMEG2FIELDTRIP, LORETA2FIELDTRIP, FIELDTRIP2SPSS + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/spass2fieldtrip.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("spass2fieldtrip", *args, **kwargs) diff --git a/fieldtrip/spm2fieldtrip.py b/fieldtrip/spm2fieldtrip.py new file mode 100644 index 0000000..31293ae --- /dev/null +++ b/fieldtrip/spm2fieldtrip.py @@ -0,0 +1,43 @@ +from fieldtrip._runtime import Runtime + + +def spm2fieldtrip(*args, **kwargs): + """ + SPM2FIELDTRIP converts an SPM8 meeg object into a FieldTrip raw data structure + + Use as + data = spm2fieldtrip(D) + where D is the SPM meeg object which you can load in with SPM_EEG_LOAD + and where data is a FieldTrip raw data structure as if it were returned + by FT_PREPROCESSING. + + See also FT_PREPROCESSING, SPM_EEG_LOAD + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/spm2fieldtrip.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("spm2fieldtrip", *args, **kwargs) diff --git a/fieldtrip/xdf2fieldtrip.py b/fieldtrip/xdf2fieldtrip.py new file mode 100644 index 0000000..8af9db9 --- /dev/null +++ b/fieldtrip/xdf2fieldtrip.py @@ -0,0 +1,56 @@ +from fieldtrip._runtime import Runtime + + +def xdf2fieldtrip(*args, **kwargs): + """ + XDF2FIELDTRIP reads continuously sampled data from a XDF file with multiple + streams. It upsamples the data of all streams to the highest sampling rate and + concatenates all channels in all streams into a raw data structure that is + compatible with the output of FT_PREPROCESSING. + + Use as + [data, events] = xdf2fieldtrip(filename, ...) + + Optional arguments should come in key-value pairs and can include + streamindx = number or list, indices of the streams to read (default is all) + streamrate = [lowerbound upperbound], read only data streams within this range of sampling rates (in Hz) + streamkeywords = cell-array with strings, keywords contained in the stream to read + + You can also use the standard procedure with FT_DEFINETRIAL and FT_PREPROCESSING + for XDF files. This will return (only) the continuously sampled stream with the + highest sampling rate, which is typically the EEG. + + You can also use FT_READ_EVENT to read the events from the non-continuous data + streams. To get them aligned with the samples in one of the specific data streams, + you should specify the corresponding header structure. + + See also FT_PREPROCESSING, FT_DEFINETRIAL, FT_REDEFINETRIAL + + + This file was automatically converted from Matlab to Python using + [MPython](https://github.com/MPython-Package-Factory/mpython), please + refer to the original matlab file for the most accurate documentation. + + [Matlab code]( https://github.com/fieldtrip/fieldtrip/blob/master/xdf2fieldtrip.m ) + + Copyright (C) 2011-2021, Robert Oostenveld + Copyright (C) 2022-, Jan-Mathijs Schoffelen and Robert Oostenveld + + This file is part of FieldTrip, see http://www.fieldtriptoolbox.org + for the documentation and details. + + FieldTrip 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 3 of the License, or + (at your option) any later version. + + FieldTrip 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 FieldTrip. If not, see . + """ + + return Runtime.call("xdf2fieldtrip", *args, **kwargs) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6bf38ce --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,45 @@ +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "fieldtrip-python" +dynamic = ["version"] +description = "Python bindings for the FieldTrip software." +readme = "README.md" +license = {file = "LICENSE"} +maintainers = [ + {name = "Johan Medrano", email = "johan.medrano@ucl.ac.uk"}, +] +requires-python = ">=3.6,<3.14" +classifiers = [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] +dependencies = [ + "mpython-core>=25.4rc1", + "matlab-runtime", +] + +[project.urls] +Repository = "https://github.com/fieldtrip/fieldtrip-python" + +[tool.setuptools.packages] +find = {} + +[tool.setuptools.dynamic] +version = {attr = "fieldtrip._version.__version__"} + +[tool.ruff] +exclude = [".mpython", "build", "dist", "__pycache__"] +respect-gitignore = true + +[tool.ruff.lint.per-file-ignores] +"__init__.py" = ["F811"] + +[tool.setuptools.package-data] +fieldtrip = [ "_fieldtrip/_ctf/_ctf.ctf"] diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..85cdf63 --- /dev/null +++ b/setup.py @@ -0,0 +1,4 @@ +from setuptools import setup + +# Setup configuration +setup() diff --git a/tests/test_array.py b/tests/test_array.py new file mode 100644 index 0000000..58423fe --- /dev/null +++ b/tests/test_array.py @@ -0,0 +1,265 @@ +import unittest +import numpy as np + +from fieldtrip import Runtime, Array + + +class ArrayTestCase(unittest.TestCase): + def test_array_instantiate_empty(self): + a = Array() + + self.assertIsInstance(a, Array) + self.assertEqual(a.shape, ()) + self.assertEqual(a.dtype, np.float64) + + def test_array_instantiate_shape_1d(self): + a = Array(3) + + self.assertIsInstance(a, Array) + self.assertEqual(a.shape, (3,)) + self.assertEqual(a.dtype, np.float64) + self.assertTrue((a == 0).all()) + + def test_array_instantiate_shape_2d(self): + a = Array(3, 2) + + self.assertIsInstance(a, Array) + self.assertEqual(a.shape, (3, 2)) + self.assertEqual(a.dtype, np.float64) + self.assertTrue((a == 0).all()) + + def test_array_instantiate_shape_2d_row(self): + a = Array(1, 3) + + self.assertIsInstance(a, Array) + self.assertEqual(a.shape, (1, 3)) + self.assertEqual(a.dtype, np.float64) + self.assertTrue((a == 0).all()) + + def test_array_instantiate_shape_2d_col(self): + a = Array(3, 1) + + self.assertIsInstance(a, Array) + self.assertEqual(a.shape, (3, 1)) + self.assertEqual(a.dtype, np.float64) + self.assertTrue((a == 0).all()) + + def test_array_instantiate_with_shape_order(self): + a = Array([3, 2], order="C") + self.assertIsInstance(a, Array) + self.assertEqual(a.shape, (3, 2)) + self.assertEqual(a.strides, (2 * 8, 8)) + + a = Array([3, 2], order="F") + self.assertIsInstance(a, Array) + self.assertEqual(a.shape, (3, 2)) + self.assertEqual(a.strides, (8, 8 * 3)) + + def test_array_as_struct(self): + self.assertRaises(TypeError, lambda: Array().as_struct) + + def test_array_as_num(self): + a = Array() + self.assertTrue(a.as_num is a) + + def test_array_as_cell(self): + self.assertRaises(TypeError, lambda: Array().as_cell) + + def test_array_from_matlab_empty(self): + try: + a = Runtime.call("eval", "[]") + except Exception: + self.fail("Empty array to Matlab failed.") + + self.assertIsInstance(a, Array) + self.assertEqual(a.size, 0) + self.assertEqual(a.dtype, np.float64) + + def test_array_from_matlab_2d_row(self): + try: + a = Runtime.call("eval", "[1, 2, 3]") + except Exception: + self.fail("2D row array to Matlab failed.") + + self.assertIsInstance(a, Array) + self.assertEqual(a.shape, (3,)) + self.assertEqual(a.dtype, np.float64) + self.assertEqual(a.tolist(), [1, 2, 3]) + + def test_array_from_matlab_2d_col(self): + try: + a = Runtime.call("eval", "[1; 2; 3]") + except Exception: + self.fail("2D col array to Matlab failed.") + + self.assertIsInstance(a, Array) + self.assertEqual(a.shape, (3, 1)) + self.assertEqual(a.dtype, np.float64) + self.assertEqual(a.tolist(), [[1], [2], [3]]) + + def test_array_from_matlab_array2d(self): + try: + a = Runtime.call("eval", "[1, 2, 3; 4, 5, 6]") + except Exception: + self.fail("2D array to Matlab failed.") + + self.assertIsInstance(a, Array) + self.assertEqual(a.shape, (2, 3)) + self.assertEqual(a.dtype, np.float64) + self.assertEqual(a.tolist(), [[1, 2, 3], [4, 5, 6]]) + + def test_array_to_matlab_empty(self): + # Construct an empty array + a = Array() + + # Get properties in Matlab + try: + size = Runtime.call("size", a) + type = Runtime.call("class", a) + except Exception: + self.fail("Empty array to Matlab failed.") + + # Check properties in Matlab + self.assertEqual(size.tolist(), [1, 1]) + self.assertEqual(type, "double") + + def test_array_to_matlab_empty_1d(self): + # Construct a 1x3 array + a = Array(3) + + # Get properties in Matlab + try: + size = Runtime.call("size", a) + type = Runtime.call("class", a) + except Exception: + self.fail("1D shape array to Matlab failed.") + + # Check properties in Matlab + self.assertEqual(size.tolist(), [1, 3]) + self.assertEqual(type, "double") + + def test_array_to_matlab_empty_2d_row(self): + # Construct a 1x3 array + a = Array(1, 3) + + # Get properties in Matlab + try: + size = Runtime.call("size", a) + type = Runtime.call("class", a) + except Exception: + self.fail("1D row array to Matlab failed.") + + # Check properties in Matlab + self.assertEqual(size.tolist(), [1, 3]) + self.assertEqual(type, "double") + + def test_array_to_matlab_empty_2d_col(self): + # Construct a 3x1 array + a = Array(3, 1) + + # Get properties in Matlab + try: + size = Runtime.call("size", a) + type = Runtime.call("class", a) + except Exception: + self.fail("1D col array to Matlab failed.") + + # Check properties in Matlab + self.assertEqual(size.tolist(), [3, 1]) + self.assertEqual(type, "double") + + def test_array_to_matlab_empty_2d(self): + # Construct a 3x2 array + a = Array(3, 2) + + # Get properties in Matlab + try: + size = Runtime.call("size", a) + type = Runtime.call("class", a) + except Exception: + self.fail("2D array to Matlab failed.") + + # Check properties in Matlab + self.assertEqual(size.tolist(), [3, 2]) + self.assertEqual(type, "double") + + def test_array_to_matlab_empty_nd(self): + # Construct a 2x3x4x5 array + a = Array(2, 3, 4, 5) + + # Get properties in Matlab + try: + size = Runtime.call("size", a) + type = Runtime.call("class", a) + except Exception: + self.fail("N-D array to Matlab failed.") + + # Check properties in Matlab + self.assertEqual(size.tolist(), [2, 3, 4, 5]) + self.assertEqual(type, "double") + + def test_array_append_1d(self): + a = Array.from_any([1, 2, 3], owndata=True) + a.append(4) + self.assertListEqual(a.tolist(), [1, 2, 3, 4]) + + def test_array_extend_1d(self): + a = Array.from_any([1, 2, 3], owndata=True) + a.extend([4, 5]) + self.assertListEqual(a.tolist(), [1, 2, 3, 4, 5]) + + a = Array.from_any([1, 2, 3], owndata=True) + a.extend(Array.from_any([4, 5])) + self.assertListEqual(a.tolist(), [1, 2, 3, 4, 5]) + + def test_array_extend_2d(self): + a = Array.from_any([[1, 2, 3], [4, 5, 6]], owndata=True) + a.extend(Array.from_any([[7, 8, 9]])) + self.assertListEqual(a.tolist(), [[1, 2, 3], [4, 5, 6], [7, 8, 9]]) + + def test_array_indexing_1d(self): + a = Array.from_any([1, 2, 3], owndata=True) + + # __getitem__ + self.assertEqual(a[1], 2) + self.assertEqual(a[-1], 3) + self.assertEqual(a[1:].tolist(), [2, 3]) + self.assertEqual(a[[0, 2]].tolist(), [1, 3]) + + # __setitem__ + a[1] = 4 + self.assertEqual(a.tolist(), [1, 4, 3]) + a[-1] = 5 + self.assertEqual(a.tolist(), [1, 4, 5]) + a[1:] = [2, 3] + self.assertEqual(a.tolist(), [1, 2, 3]) + a[[0, 2]] = [7, 8] + self.assertEqual(a.tolist(), [7, 2, 8]) + a[3] = 9 # insert new element + self.assertEqual(a.tolist(), [7, 2, 8, 9]) + a[5] = 11 # insert new element + self.assertEqual(a.tolist(), [7, 2, 8, 9, 0, 11]) + + # __delitem__ + del a[4] + self.assertEqual(a.tolist(), [7, 2, 8, 9, 11]) + del a[-2:] + self.assertEqual(a.tolist(), [7, 2, 8]) + del a[[0, 2]] + self.assertEqual(a.tolist(), [2]) + + def test_array_roundtrip_1d(self): + identity = Runtime.call("eval", "@(x) x") + a = Array.from_any([1, 2, 3]) + d = identity(a) + self.assertListEqual(a.tolist(), d.tolist()) + + def test_array_roundtrip_2d(self): + identity = Runtime.call("eval", "@(x) x") + a = Array.from_any([[1, 2, 3], [3, 4, 5]]) + d = identity(a) + self.assertListEqual(a.tolist(), d.tolist()) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_cell.py b/tests/test_cell.py new file mode 100644 index 0000000..6be28c1 --- /dev/null +++ b/tests/test_cell.py @@ -0,0 +1,487 @@ +import unittest + +from fieldtrip import Cell, Runtime, Array + + +class CellTestCase(unittest.TestCase): + def test_cell_instantiate_empty(self): + # Construct an empty cell array + c = Cell() + + # Check proper construction + self.assertIsInstance(c, Cell) + self.assertEqual(c.shape, (0,)) + + def test_instantiate_empty_1d_shape_cell(self): + # Construct a 3x3 cell array ? + c = Cell(3) + + # Check proper construction + self.assertIsInstance(c, Cell) + self.assertTupleEqual(c.shape, (3,)) + self.assertTrue(all(isinstance(x, Array) for x in c.flat)) + self.assertTrue(all(x.size == 0 for x in c.flat)) + + def test_cell_instantiate_empty_2d_row(self): + # Construct a 1x3 cell array + c = Cell(1, 3) + + # Check proper construction + self.assertIsInstance(c, Cell) + self.assertTupleEqual(c.shape, (1, 3)) + self.assertTrue(all(isinstance(x, Array) for x in c.flat)) + self.assertTrue(all(x.size == 0 for x in c.flat)) + + def test_cell_instantiate_empty_2d_col(self): + # Construct a 3x1 cell array + c = Cell(3, 1) + + # Check proper construction + self.assertIsInstance(c, Cell) + self.assertTupleEqual(c.shape, (3, 1)) + self.assertTrue(all(isinstance(x, Array) for x in c.flat)) + self.assertTrue(all(x.size == 0 for x in c.flat)) + + def test_cell_instantiate_empty_2d(self): + # Construct a 3x2 cell array + c = Cell(3, 2) + + # Check proper construction + self.assertIsInstance(c, Cell) + self.assertTupleEqual(c.shape, (3, 2)) + self.assertTrue(all(isinstance(x, Array) for x in c.flat)) + self.assertTrue(all(x.size == 0 for x in c.flat)) + + def test_cell_instantiate_empty_nd(self): + # Construct a 3x2 cell array + c = Cell(2, 3, 4, 5) + + # Check proper construction + self.assertIsInstance(c, Cell) + self.assertTupleEqual(c.shape, (2, 3, 4, 5)) + self.assertTrue(all(isinstance(x, Array) for x in c.flat)) + self.assertTrue(all(x.size == 0 for x in c.flat)) + + def test_cell_instantiate_with_shape_order(self): + c = Cell([3, 2], order="C") + + self.assertIsInstance(c, Cell) + self.assertEqual(c.shape, (3, 2)) + self.assertEqual(c.strides, (2 * 8, 8)) + + c = Cell([3, 2], order="F") + + self.assertIsInstance(c, Cell) + self.assertEqual(c.shape, (3, 2)) + self.assertEqual(c.strides, (8, 8 * 3)) + + def test_cell_instantiate_from_list(self): + c = Cell.from_any(["a", "b", "c"]) + + self.assertEqual(c.shape, (3,)) + self.assertEqual(repr(c), "Cell(['a', 'b', 'c'])") + self.assertListEqual(c.tolist(), ["a", "b", "c"]) + + def test_cell_instantiate_from_nested_list(self): + c = Cell.from_any([["a", "b"], ["c", "d"]]) + + self.assertEqual(c.shape, (2,)) + self.assertEqual(repr(c), "Cell([Cell(['a', 'b']), Cell(['c', 'd'])])") + self.assertTrue(all(isinstance(x, Cell) for x in c.tolist())) + + def test_cell_instantiate_from_nested_list_with_deepcat(self): + c = Cell.from_any([["a", "b"], ["c", "d"]], deepcat=True) + + self.assertEqual(c.shape, (2, 2)) + self.assertEqual(repr(c), "Cell([['a', 'b'],\n ['c', 'd']])") + self.assertTrue(all(isinstance(x, list) for x in c.tolist())) + + def test_cell_to_matlab_empty(self): + # Construct an empty cell array + c = Cell() + + # Get properties in Matlab + try: + size = Runtime.call("size", c) + type = Runtime.call("class", c) + except Exception: + self.fail("Empty cell to Matlab failed.") + + # Check properties in Matlab + self.assertEqual(size.tolist(), [1, 0]) + self.assertEqual(type, "cell") + + def test_cell_to_matlab_empty_1d(self): + # Construct a 1x3 cell array + c = Cell(3) + + # Get properties in Matlab + try: + size = Runtime.call("size", c) + type = Runtime.call("class", c) + except Exception: + self.fail("1D shape cell to Matlab failed.") + + # Check properties in Matlab + self.assertEqual(size.tolist(), [1, 3]) + self.assertEqual(type, "cell") + + def test_cell_to_matlab_empty_2d_row(self): + # Construct a 1x3 cell array + c = Cell(1, 3) + + # Get properties in Matlab + try: + size = Runtime.call("size", c) + type = Runtime.call("class", c) + except Exception: + self.fail("1D row cell to Matlab failed.") + + # Check properties in Matlab + self.assertEqual(size.tolist(), [1, 3]) + self.assertEqual(type, "cell") + + def test_cell_to_matlab_empty_2d_col(self): + # Construct a 3x1 cell array + c = Cell(3, 1) + + # Get properties in Matlab + try: + size = Runtime.call("size", c) + type = Runtime.call("class", c) + except Exception: + self.fail("1D col cell to Matlab failed.") + + # Check properties in Matlab + self.assertEqual(size.tolist(), [3, 1]) + self.assertEqual(type, "cell") + + def test_cell_to_matlab_empty_2d(self): + # Construct a 3x2 cell array + c = Cell(3, 2) + + # Get properties in Matlab + try: + size = Runtime.call("size", c) + type = Runtime.call("class", c) + except Exception: + self.fail("2D cell to Matlab failed.") + + # Check properties in Matlab + self.assertEqual(size.tolist(), [3, 2]) + self.assertEqual(type, "cell") + + def test_cell_to_matlab_empty_nd(self): + # Construct a 2x3x4x5 cell array + c = Cell(2, 3, 4, 5) + + # Get properties in Matlab + try: + size = Runtime.call("size", c) + type = Runtime.call("class", c) + except Exception: + self.fail("N-D cell to Matlab failed.") + + # Check properties in Matlab + self.assertEqual(size.tolist(), [2, 3, 4, 5]) + self.assertEqual(type, "cell") + + def test_cell_as_struct(self): + self.assertRaises(TypeError, lambda: Cell().as_struct) + + def test_cell_as_num(self): + self.assertRaises(TypeError, lambda: Cell().as_num) + + def test_cell_as_cell(self): + c = Cell() + self.assertTrue(c.as_cell is c) + + def test_empty1d_row_from_matlab(self): + c_matlab = Runtime.call("cell", 1, 3) + c_python = Cell.from_shape([3]) + self.assertListEqual(c_matlab.tolist(), c_python.tolist()) + + def test_empty1d_col_from_matlab(self): + c_matlab = Runtime.call("cell", 3, 1) + c_python = Cell.from_shape([3, 1]) + self.assertListEqual(c_matlab.tolist(), c_python.tolist()) + + def test_empty2d_from_matlab(self): + c_matlab = Runtime.call("cell", 3, 2) + c_python = Cell.from_shape([3, 2]) + self.assertListEqual(c_matlab.tolist(), c_python.tolist()) + + def test_cell1d_from_matlab(self): + c_matlab = Runtime.call("eval", "{1, 2, 3}") + c_python = Cell.from_any([1, 2, 3]) + self.assertListEqual(c_matlab.tolist(), c_python.tolist()) + + def test_cell_from_matlab_2d_row(self): + # Construct a 1x3 cell array in Matlab + try: + c_matlab = Runtime.call("eval", "{1, 2, 3}") + except Exception: + self.fail("1D row cell from Matlab failed.") + + # Check Runtime conversion + self.assertIsInstance(c_matlab, Cell) + self.assertTupleEqual(c_matlab.shape, (3,)) + self.assertListEqual(c_matlab.tolist(), [1, 2, 3]) + + def test_cell_from_matlab_2d_col(self): + # Construct a 3x1 cell array in Matlab + try: + c_matlab = Runtime.call("eval", "{1; 2; 3}") + except Exception: + self.fail("1D col cell from Matlab failed.") + + # Check Runtime conversion + self.assertIsInstance(c_matlab, Cell) + self.assertTupleEqual(c_matlab.shape, (3, 1)) + self.assertListEqual(c_matlab.tolist(), [[1], [2], [3]]) + + def test_cell_from_matlab_2d(self): + # Construct a 2x3 cell array in Matlab + try: + c_matlab = Runtime.call("eval", "{1, 2, 3; 4, 5, 6}") + except Exception: + self.fail("2D cell from Matlab failed.") + + # Check Runtime conversion + self.assertIsInstance(c_matlab, Cell) + self.assertTupleEqual(c_matlab.shape, (2, 3)) + self.assertListEqual(c_matlab.tolist(), [[1, 2, 3], [4, 5, 6]]) + + def test_cell_from_matlab_nested(self): + # Construct a nested cell array + try: + c_matlab = Runtime.call("eval", "{{1, 2, 3}, {4, 5, 6}}") + except Exception: + self.fail("Nested cell from Matlab failed.") + + # Check outer cell + self.assertIsInstance(c_matlab, Cell) + self.assertTupleEqual(c_matlab.shape, (2,)) + + # Check inner cells types + self.assertTrue(all(isinstance(x, Cell) for x in c_matlab)) + + # Check inner cells shapes + self.assertTupleEqual(c_matlab[0].shape, (3,)) + self.assertTupleEqual(c_matlab[1].shape, (3,)) + + # Check inner cells values + self.assertListEqual(c_matlab[0].tolist(), [1, 2, 3]) + self.assertListEqual(c_matlab[1].tolist(), [4, 5, 6]) + + def test_cell_from_matlab_empty(self): + # Construct an empty cell array in Matlab + try: + c_matlab = Runtime.call("eval", "{}") + except Exception: + self.fail("Empty cell from Matlab failed.") + + # Check Runtime conversion + self.assertIsInstance(c_matlab, Cell) + self.assertTupleEqual(c_matlab.shape, (0,)) + + def test_cell_from_matlab_empty_2d_col(self): + # Construct a 1x3 cell array in Matlab + try: + c_matlab = Runtime.call("cell", 3, 1) + except Exception: + self.fail("1D empty col cell from Matlab failed.") + + # Check Runtime conversion + self.assertIsInstance(c_matlab, Cell) + self.assertTupleEqual(c_matlab.shape, (3, 1)) + self.assertTrue(all(isinstance(x, Array) for x in c_matlab.flat)) + self.assertTrue(all(x.size == 0 for x in c_matlab.flat)) + + def test_cell_from_matlab_empty_2d_row(self): + # Construct a 1x3 cell array in Matlab + try: + c_matlab = Runtime.call("cell", 1, 3) + except Exception: + self.fail("1D empty row cell from Matlab failed.") + + # Check Runtime conversion + self.assertIsInstance(c_matlab, Cell) + self.assertTupleEqual(c_matlab.shape, (3,)) + self.assertTrue(all(isinstance(x, Array) for x in c_matlab.flat)) + self.assertTrue(all(x.size == 0 for x in c_matlab.flat)) + + def test_cell_from_matlab_empty_2d(self): + # Construct a 3x2 cell array in Matlab + try: + c_matlab = Runtime.call("cell", 3, 2) + except Exception: + self.fail("2D empty cell from Matlab failed.") + + # Check Runtime conversion + self.assertIsInstance(c_matlab, Cell) + self.assertTupleEqual(c_matlab.shape, (3, 2)) + self.assertTrue(all(isinstance(x, Array) for x in c_matlab.flat)) + self.assertTrue(all(x.size == 0 for x in c_matlab.flat)) + + def test_cell_from_matlab_empty_nd(self): + # Construct a 3x2 cell array in Matlab + try: + c_matlab = Runtime.call("cell", 2, 3, 4, 5) + except Exception: + self.fail("2D empty cell from Matlab failed.") + + # Check Runtime conversion + self.assertIsInstance(c_matlab, Cell) + self.assertTupleEqual(c_matlab.shape, (2, 3, 4, 5)) + self.assertTrue(all(isinstance(x, Array) for x in c_matlab.flat)) + self.assertTrue(all(x.size == 0 for x in c_matlab.flat)) + + def test_cell_append_1d(self): + c = Cell.from_any([1, 2, 3], owndata=True) + c.append(4) + self.assertListEqual(c.tolist(), [1, 2, 3, 4]) + + def test_cell_extend_1d(self): + c = Cell.from_any([1, 2, 3], owndata=True) + c.extend([4, 5]) + self.assertListEqual(c.tolist(), [1, 2, 3, 4, 5]) + + c = Cell.from_any([1, 2, 3], owndata=True) + c.extend(Cell.from_any([4, 5])) + self.assertListEqual(c.tolist(), [1, 2, 3, 4, 5]) + + def test_cell_extend_magic(self): + # iadd + c = Cell.from_any([1, 2, 3], owndata=True) + c += [4, 5] + self.assertListEqual(c.tolist(), [1, 2, 3, 4, 5]) + + # add + c = Cell.from_any([1, 2, 3], owndata=True) + c = c + [4, 5] + self.assertListEqual(c.tolist(), [1, 2, 3, 4, 5]) + + # radd + c = Cell.from_any([1, 2, 3], owndata=True) + c = [4, 5] + c + self.assertListEqual(c.tolist(), [4, 5, 1, 2, 3]) + + # imul + c = Cell.from_any([1, 2, 3], owndata=True) + c *= 2 + self.assertListEqual(c.tolist(), [1, 2, 3, 1, 2, 3]) + + # mul + c = Cell.from_any([1, 2, 3], owndata=True) + c = c * 2 + self.assertListEqual(c.tolist(), [1, 2, 3, 1, 2, 3]) + + # rmul + c = Cell.from_any([1, 2, 3], owndata=True) + c = 2 * c + self.assertListEqual(c.tolist(), [1, 2, 3, 1, 2, 3]) + + def test_cell_extend_2d(self): + c = Cell.from_any([[1, 2, 3], [4, 5, 6]], owndata=True, deepcat=True) + c.extend(Cell.from_any([[7, 8, 9]], deepcat=True)) + self.assertListEqual(c.tolist(), [[1, 2, 3], [4, 5, 6], [7, 8, 9]]) + + def test_cell_list_api_1d(self): + c = Cell.from_any([1, 2, 3], owndata=True) + self.assertEqual(c.count(1), 1) + self.assertEqual(c.count(4), 0) + self.assertEqual(c.index(1), 0) + self.assertRaises(ValueError, lambda: c.index(4)) + c.remove(2) + self.assertListEqual(c.tolist(), [1, 3]) + self.assertRaises(ValueError, lambda: c.remove(4)) + c.insert(-1, 4) + self.assertListEqual(c.tolist(), [1, 3, 4]) + c.insert(1, 2) + self.assertListEqual(c.tolist(), [1, 2, 3, 4]) + b = c.pop() + self.assertListEqual(c.tolist(), [1, 2, 3]) + self.assertEqual(b, 4) + b = c.pop(0) + self.assertListEqual(c.tolist(), [2, 3]) + self.assertEqual(b, 1) + c.reverse() + self.assertListEqual(c.tolist(), [3, 2]) + c.sort() + self.assertListEqual(c.tolist(), [2, 3]) + + def test_cell_list_api_2d(self): + c = Cell.from_any([[1, 2, 3], [4, 5, 6]], owndata=True, deepcat=True) + self.assertEqual(c.count([4, 5, 6]), 1) + self.assertEqual(c.count([4, 4, 4]), 0) + self.assertEqual(c.index([4, 5, 6]), 1) + self.assertRaises(ValueError, lambda: c.index([4, 4, 4])) + c.remove([4, 5, 6]) + self.assertListEqual(c.tolist(), [[1, 2, 3]]) + self.assertRaises(ValueError, lambda: c.remove([4, 4, 4])) + c.insert(-1, [4, 5, 6]) + self.assertListEqual(c.tolist(), [[1, 2, 3], [4, 5, 6]]) + c.insert(1, [7, 8, 9]) + self.assertListEqual(c.tolist(), [[1, 2, 3], [7, 8, 9], [4, 5, 6]]) + b = c.pop() + self.assertListEqual(c.tolist(), [[1, 2, 3], [7, 8, 9]]) + self.assertEqual(b.tolist(), [4, 5, 6]) + b = c.pop(0) + self.assertListEqual(c.tolist(), [[7, 8, 9]]) + self.assertEqual(b.tolist(), [1, 2, 3]) + + c = Cell.from_any([[1, 9, 5], [4, 2, 6], [3, 7, 8]], owndata=True, deepcat=True) + self.assertListEqual(c.tolist(), [[1, 9, 5], [4, 2, 6], [3, 7, 8]]) + c.reverse() + self.assertListEqual(c.tolist(), [[3, 7, 8], [4, 2, 6], [1, 9, 5]]) + c.sort() + self.assertListEqual(c.tolist(), [[1, 2, 5], [3, 7, 6], [4, 9, 8]]) + + def test_cell_indexing_1d(self): + c = Cell.from_any([1, 2, 3], owndata=True) + + # __getitem__ + self.assertEqual(c[1], 2) + self.assertEqual(c[-1], 3) + self.assertEqual(c[1:].tolist(), [2, 3]) + self.assertEqual(c[[0, 2]].tolist(), [1, 3]) + + # __setitem__ + c[1] = 4 + self.assertEqual(c.tolist(), [1, 4, 3]) + c[-1] = 5 + self.assertEqual(c.tolist(), [1, 4, 5]) + c[1:] = [2, 3] + self.assertEqual(c.tolist(), [1, 2, 3]) + c[[0, 2]] = [7, 8] + self.assertEqual(c.tolist(), [7, 2, 8]) + c[3] = 9 # insert new element + self.assertEqual(c.tolist(), [7, 2, 8, 9]) + c[5] = 11 # insert new element + self.assertTrue(isinstance(c[4], Array) and c[4].size == 0) + self.assertTrue(c[5] == 11) + + # __delitem__ + del c[4] + self.assertEqual(c.tolist(), [7, 2, 8, 9, 11]) + del c[-2:] + self.assertEqual(c.tolist(), [7, 2, 8]) + del c[[0, 2]] + self.assertEqual(c.tolist(), [2]) + + def test_cell_roundtrip_1d(self): + identity = Runtime.call("eval", "@(x) x") + c = Cell.from_any([1, 2, 3]) + d = identity(c) + self.assertListEqual(c.tolist(), d.tolist()) + + def test_cell_roundtrip_2d(self): + identity = Runtime.call("eval", "@(x) x") + c = Cell.from_any([[1, 2, 3], [3, 4, 5]], deepcat=True) + d = identity(c) + self.assertListEqual(c.tolist(), d.tolist()) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_implicit.py b/tests/test_implicit.py new file mode 100644 index 0000000..17fae48 --- /dev/null +++ b/tests/test_implicit.py @@ -0,0 +1,66 @@ +import unittest + +from fieldtrip import Struct, Cell, Array + + +class ImplicitTestCase(unittest.TestCase): + def test_array(self): + x = Array() + x[2] = 3 + self.assertListEqual(x.tolist(), [0, 0, 3]) + + x = Array() + x[1:3] = [2, 3] + self.assertListEqual(x.tolist(), [0, 2, 3]) + + self.assertRaises(IndexError, lambda: Array()[2]) + + def test_cell(self): + x = Cell() + x[2] = 3 + self.assertEqual(x[0].shape, (0, 0)) + self.assertEqual(x[1].shape, (0, 0)) + self.assertEqual(x[2], 3) + + x = Cell() + x[1:3] = [2, 3] + self.assertEqual(x[0].shape, (0, 0)) + self.assertListEqual(x[1:3].tolist(), [2, 3]) + + self.assertRaises(IndexError, lambda: Cell()[2] * 2) + + def test_struct(self): + x = Struct() + x.a = 3 + self.assertEqual(x.a, 3) + + x = Struct() + x[1] = {"a": 3} + self.assertTrue(x.shape == (2,)) + self.assertEqual(x[1].a, 3) + self.assertTrue(x[0].a.shape == (0, 0)) + + self.assertRaises(AttributeError, lambda: Struct().a * 2) + self.assertRaises(KeyError, lambda: Struct()["a"] * 2) + self.assertRaises(KeyError, lambda: Struct()[1].a * 2) + + def test_cell_of_struct(self): + x = Cell() + x(0).a = 1 + self.assertTrue(isinstance(x[0], Struct)) + self.assertEqual(x[0].a, 1) + + def test_struct_of_cell(self): + x = Struct() + x.a(0).b = 1 + self.assertTrue(isinstance(x.a, Cell)) + self.assertTrue(isinstance(x.a[0], Struct)) + self.assertEqual(x.a[0].b, 1) + + def test_struct_of_cell_reuse(self): + x = Struct() + x.a[0] = "a" + # This is to make sure that x.a owns its data after the first + # finalization. If it did not own its data, the resize triggered + # by a[1] in the following line would raise an error. + x.a[1] = "b" diff --git a/tests/test_matlab_class.py b/tests/test_matlab_class.py new file mode 100644 index 0000000..4536669 --- /dev/null +++ b/tests/test_matlab_class.py @@ -0,0 +1,109 @@ +import unittest +import warnings +import numpy as np +from unittest.mock import patch + +from fieldtrip import MatlabClass +from fieldtrip._runtime import Runtime, RuntimeMixin + + +orig_runtime_call = Runtime.call + + +def mock_runtime_call(f, *args, **kwargs): + if f == "TestClass": + objdict = {"type__": "object", "class__": "TestClass", "data__": kwargs} + return Runtime._process_argout(objdict) + if f == "str2func": + return "" + else: + return orig_runtime_call(f, *args, **kwargs) + + +@patch("fieldtrip.Runtime.call", mock_runtime_call) +class TestMatlabClass(unittest.TestCase): + def setUp(self): + # Example subclass for testing + class TestClass(RuntimeMixin, MatlabClass): + def __init__(self, *args, **kwargs): + super().__init__() + + def subsref(self, ref): + if ref["type"] == ".": + return self._objdict[ref["subs"] - 1] + elif ref["type"] in ("()", "{}"): + if isinstance(ref["subs"], tuple): + ref["subs"] = ref["subs"][0] + return self._objdict["data__"]["value"][ref["subs"] - 1] + else: + raise KeyError("Unsupported reference type.") + + def subsasgn(self, ref, value): + if ref["type"] == ".": + self._objdict[ref["subs"] - 1] = value + elif ref["type"] in ("()", "{}"): + self._objdict["data__"]["value"][ref["subs"] - 1] = value + else: + raise KeyError("Unsupported assignment type.") + + self.TestClass = TestClass + + def test_matlabclass_register_subclass(self): + self.assertIn("TestClass", MatlabClass._subclasses) + self.assertIs(MatlabClass._subclasses["TestClass"], self.TestClass) + + def test_matlabclass_instantiate_object(self): + obj = self.TestClass(value=[1, 2, 3]) + self.assertEqual(obj._objdict["class__"], "TestClass") + self.assertEqual(obj._objdict["data__"]["value"], [1, 2, 3]) + + def test_matlabclass_from_matlab_object(self): + objdict = {"class__": "TestClass", "data__": {"value": [1, 2, 3]}} + obj = MatlabClass._from_runtime(objdict) + self.assertIsInstance(obj, self.TestClass) + self.assertEqual(obj._objdict["data__"]["value"], [1, 2, 3]) + + def test_matlabclass_unknown_class_warning(self): + objdict = {"class__": "UnknownClass", "data__": {"value": [1, 2, 3]}} + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") + obj = MatlabClass._from_runtime(objdict) + self.assertEqual(len(w), 1) + self.assertEqual( + str(w[0].message), "Unknown Matlab class type: UnknownClass" + ) + self.assertIsInstance(obj, MatlabClass) + + def test_matlabclass_attribute_access(self): + obj = self.TestClass(value=[1, 2, 3]) + self.assertEqual(obj._objdict["data__"]["value"], [1, 2, 3]) + + def test_matlabclass_item_get_and_set(self): + obj = self.TestClass(value=[1, 2, 3]) + self.assertEqual(obj[1], 2) # Testing __getitem__ + obj[1] = 5 # Testing __setitem__ + self.assertEqual(obj[1], 5) + + def test_matlabclass_call_behavior(self): + obj = self.TestClass(value=[1, 2, 3]) + self.assertEqual(obj(0), 1) # Testing __call__ + + def test_matlabclass_as_matlab_object(self): + obj = self.TestClass(value=[1, 2, 3]) + objdict = obj._as_runtime() + self.assertEqual(objdict["class__"], "TestClass") + self.assertEqual(objdict["data__"]["value"], [1, 2, 3]) + + def test_matlabclass_index_processing(self): + obj = self.TestClass(value=np.arange(10)) + index = obj._process_index(slice(1, 5)) + self.assertTrue(np.array_equal(index, np.array([2, 3, 4, 5]))) + + def test_matlabclass_invalid_index(self): + obj = self.TestClass(value=np.arange(10)) + with self.assertRaises(IndexError): + obj[15] + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_runtime.py b/tests/test_runtime.py new file mode 100644 index 0000000..9435391 --- /dev/null +++ b/tests/test_runtime.py @@ -0,0 +1,143 @@ +import unittest + + +class TestRuntime(unittest.TestCase): + def test_import_package(self): + try: + pass + except Exception: + self.fail("Cannot import package.") + + def test_import_runtime(self): + try: + pass + except Exception: + self.fail("Cannot import Runtime.") + + def test_initialise_runtime(self): + try: + from fieldtrip import Runtime + + Runtime.instance() + except Exception: + self.fail("Cannot initialise Runtime.") + + def test_call_matlab(self): + result = None + try: + from fieldtrip import Runtime + + result = Runtime.call("eval", "1+1") + except Exception: + self.fail("Calling Matlab failed.") + + self.assertEqual(result, 2) + + def test_call_matlab_noargout(self): + result = True + try: + from fieldtrip import Runtime + + result = Runtime.call("magic", 0, nargout=0) + except Exception: + self.fail("Calling Matlab without argout failed.") + + self.assertTrue(result is None) + + def test_0d_empty_cell_to_matlab(self): + try: + from fieldtrip import Runtime, Cell + + idt = Runtime.call("eval", "@(x) x") + c = Cell() + c2 = idt(c) + except Exception: + self.fail("OD empty cell to Matlab failed.") + + self.assertIsInstance(c2, Cell) + self.assertEqual(c2.shape, c.shape) + + def test_1d_empty_cell_to_matlab(self): + try: + from fieldtrip import Runtime, Cell + + idt = Runtime.call("eval", "@(x) x") + c = Cell(3) + c2 = idt(c) + except Exception: + self.fail("1D empty cell to Matlab failed.") + + self.assertIsInstance(c2, Cell) + self.assertEqual(c2.shape, c.shape) + + def test_2d_empty_cell_to_matlab(self): + try: + from fieldtrip import Runtime, Cell + + idt = Runtime.call("eval", "@(x) x") + c = Cell(3, 2) + c2 = idt(c) + except Exception: + self.fail("2D empty cell to Matlab failed.") + + self.assertIsInstance(c2, Cell) + self.assertEqual(c2.shape, c.shape) + + def test_1d_cell_to_matlab(self): + try: + from fieldtrip import Runtime, Cell + + idt = Runtime.call("eval", "@(x) x") + c = Cell.from_any([1, 2, 3]) + c2 = idt(c) + except Exception: + self.fail("1D cell to Matlab failed.") + + self.assertIsInstance(c2, Cell) + self.assertEqual(c2.shape, c.shape) + self.assertTrue(c2.tolist() == c.tolist()) + + def test_2d_cell_to_matlab(self): + try: + from fieldtrip import Runtime, Cell + import numpy as np + + idt = Runtime.call("eval", "@(x) x") + c = Cell.from_array(np.random.randn(2, 3)) + c2 = idt(c) + except Exception: + self.fail("1D cell to Matlab failed.") + + self.assertIsInstance(c2, Cell) + self.assertEqual(c2.shape, c.shape) + self.assertTrue(c2.tolist() == c.tolist()) + + def test_empty_struct_to_matlab(self): + try: + from fieldtrip import Runtime, Struct + + idt = Runtime.call("eval", "@(x) x") + s = Struct() + s2 = idt(s) + except Exception: + self.fail("Empty struct to Matlab failed.") + + self.assertIsInstance(s2, Struct) + self.assertEqual(s2.shape, s.shape) + + def test_empty_array_to_matlab(self): + try: + from fieldtrip import Runtime, Array + + idt = Runtime.call("eval", "@(x) x") + a = Array() + a2 = idt(a) + except Exception: + self.fail("Empty array to Matlab failed.") + + self.assertIsInstance(a2, Array) + self.assertEqual(a2.shape, a.shape) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_struct.py b/tests/test_struct.py new file mode 100644 index 0000000..9e387b3 --- /dev/null +++ b/tests/test_struct.py @@ -0,0 +1,313 @@ +import unittest +import numpy as np +from itertools import product + +from fieldtrip import Struct, Array, Runtime + + +class TestStruct(unittest.TestCase): + def setUp(self): + self.struct = Struct() + + def test_struct_instantiate_empty(self): + # Construct an empty struct + s = Struct() + + # Check proper construction + self.assertIsInstance(s, Struct) + self.assertEqual(len(s), 0) + + def test_struct_instantiate_empty_1d(self): + # Construct a 1x3 struct array + s = Struct(3) + + # Check proper construction + self.assertIsInstance(s, Struct) + self.assertTupleEqual(s.shape, (3,)) + self.assertEqual(s.size, 3) + self.assertTrue(all(isinstance(s[i], Struct) for i in range(3))) + + def test_struct_instantiate_empty_2d_row(self): + # Construct a 1x3 struct array + s = Struct(1, 3) + + # Check proper construction + self.assertIsInstance(s, Struct) + self.assertTupleEqual(s.shape, (1, 3)) + self.assertEqual(s.size, 3) + self.assertTrue(all(isinstance(s[0, i], Struct) for i in range(3))) + + def test_struct_instantiate_empty_2d_col(self): + # Construct a 3x1 struct array + s = Struct(3, 1) + + # Check proper construction + self.assertIsInstance(s, Struct) + self.assertTupleEqual(s.shape, (3, 1)) + self.assertEqual(s.size, 3) + self.assertTrue(all(isinstance(s[i, 0], Struct) for i in range(3))) + + def test_struct_instantiate_empty_2d(self): + # Construct a 3x2 struct array + s = Struct(3, 2) + + # Check proper construction + self.assertIsInstance(s, Struct) + self.assertTupleEqual(s.shape, (3, 2)) + + self.assertTrue( + all(isinstance(s[i, j], Struct) for i, j in product(range(3), range(2))) + ) + + def test_struct_instantiate_empty_nd(self): + # Construct a 2x3x4x5 struct array + s = Struct(2, 3, 4, 5) + + # Check proper construction + self.assertIsInstance(s, Struct) + self.assertTupleEqual(s.shape, (2, 3, 4, 5)) + + self.assertTrue( + all( + isinstance(s[i, j, k, m], Struct) + for i, j, k, m in product(range(2), range(3), range(4), range(5)) + ) + ) + + def test_struct_set_and_get_attribute(self): + self.struct.foo = "bar" + self.assertEqual(self.struct.foo, "bar") + self.assertEqual(self.struct["foo"], "bar") + self.assertListEqual(list(self.struct.keys()), ["foo"]) + self.assertListEqual(list(self.struct.values()), ["bar"]) + self.assertListEqual(list(self.struct.items()), [("foo", "bar")]) + + self.struct.bar = "foo" + self.assertEqual(self.struct.bar, "foo") + self.assertEqual(self.struct["bar"], "foo") + self.assertListEqual(list(self.struct.keys()), ["foo", "bar"]) + self.assertListEqual(list(self.struct.values()), ["bar", "foo"]) + self.assertListEqual( + list(self.struct.items()), [("foo", "bar"), ("bar", "foo")] + ) + + def test_struct_set_and_get_item(self): + self.struct["baz"] = 42 + self.assertEqual(self.struct.baz, 42) + self.assertEqual(self.struct["baz"], 42) + + def test_struct_delete_item(self): + self.struct["key"] = "value" + self.assertTrue("key" in self.struct.keys()) + del self.struct["key"] + self.assertTrue("key" not in self.struct.keys()) + + def test_struct_as_array(self): + self.struct.foo = "bar" + a = np.asarray(self.struct) + self.assertEqual(a.item(), dict(self.struct)) + a = np.asarray(self.struct, dtype=object) + self.assertEqual(a.item(), dict(self.struct)) + + def test_struct_as_array_after_initialization(self): + self.struct.foo = "bar" + self.struct.bar = "baz" + self.struct[1].baz = 42 + # raise ValueError(self.struct) + + keys = set(("foo", "bar", "baz")) + + # All fields exist in struct array + self.assertSetEqual(keys, set(self.struct.keys())) + + # All fields exist in first slice + self.assertSetEqual(keys, set(self.struct[0].keys())) + + # All fields exist in second slice + self.assertSetEqual(keys, set(self.struct[1].keys())) + + # Specified elements are correct + self.assertEqual(self.struct[0].foo, "bar") + self.assertEqual(self.struct[0].bar, "baz") + self.assertEqual(self.struct[1].baz, 42) + + # Unspecified elements are empty arrays + self.assertIsInstance(self.struct[0].baz, Array) + self.assertTupleEqual(self.struct[0].baz.shape, (0, 0)) + self.assertIsInstance(self.struct[1].foo, Array) + self.assertTupleEqual(self.struct[1].foo.shape, (0, 0)) + self.assertIsInstance(self.struct[1].bar, Array) + self.assertTupleEqual(self.struct[1].bar.shape, (0, 0)) + + def test_struct_from_matlab(self): + # Construct a struct in Matlab + try: + s_matlab = Runtime.call("eval", "struct('field1', 1, 'field2', 2)") + except Exception: + self.fail("Struct from Matlab failed.") + + # Check Runtime conversion + self.assertIsInstance(s_matlab, Struct) + self.assertEqual(s_matlab.field1, 1) + self.assertEqual(s_matlab.field2, 2) + self.assertListEqual(list(s_matlab.keys()), ["field1", "field2"]) + self.assertListEqual(list(s_matlab.values()), [1, 2]) + self.assertListEqual(list(s_matlab.items()), [("field1", 1), ("field2", 2)]) + + def test_struct_from_matlab_nested(self): + # Construct a nested struct in Matlab + try: + s_matlab = Runtime.call( + "eval", "struct('field1', struct('subfield1', 1), 'field2', 2)" + ) + except Exception: + self.fail("Nested struct from Matlab failed.") + + # Check Runtime conversion + self.assertIsInstance(s_matlab, Struct) + self.assertIsInstance(s_matlab.field1, Struct) + self.assertEqual(s_matlab.field1.subfield1, 1) + self.assertEqual(s_matlab.field2, 2) + self.assertListEqual(list(s_matlab.keys()), ["field1", "field2"]) + self.assertListEqual(list(s_matlab.field1.keys()), ["subfield1"]) + self.assertListEqual(list(s_matlab.values()), [s_matlab.field1, 2]) + self.assertListEqual( + list(s_matlab.items()), [("field1", s_matlab.field1), ("field2", 2)] + ) + + def test_struct_from_matlab_with_array(self): + # Construct a struct with an array in Matlab + try: + s_matlab = Runtime.call("eval", "struct('field1', [1, 2, 3], 'field2', 2)") + except Exception: + self.fail("Struct with array from Matlab failed.") + + # Check Runtime conversion + self.assertIsInstance(s_matlab, Struct) + self.assertIsInstance(s_matlab.field1, Array) + self.assertListEqual(s_matlab.field1.tolist(), [1, 2, 3]) + self.assertEqual(s_matlab.field2, 2) + self.assertListEqual(list(s_matlab.keys()), ["field1", "field2"]) + self.assertListEqual(list(s_matlab.values()), [s_matlab.field1, 2]) + self.assertListEqual( + list(s_matlab.items()), [("field1", s_matlab.field1), ("field2", 2)] + ) + + def test_struct_from_matlab_with_structure_array(self): + # Construct a struct array of size 2 in Matlab + try: + s_matlab = Runtime.call( + "eval", "repmat(struct('field1', 1, 'field2', 2), 2, 1)" + ) + except Exception: + self.fail("Struct array from Matlab failed.") + + # Check Runtime conversion + self.assertIsInstance(s_matlab, Struct) + self.assertEqual(len(s_matlab), 2) + self.assertIsInstance(s_matlab[0, 0], Struct) + self.assertEqual(s_matlab[0, 0].field1, 1) + self.assertEqual(s_matlab[0, 0].field2, 2) + self.assertListEqual(list(s_matlab[0, 0].keys()), ["field1", "field2"]) + self.assertListEqual(list(s_matlab[0, 0].values()), [1, 2]) + self.assertListEqual( + list(s_matlab[0, 0].items()), [("field1", 1), ("field2", 2)] + ) + + self.assertIsInstance(s_matlab[1, 0], Struct) + self.assertEqual(s_matlab[1, 0].field1, 1) + self.assertEqual(s_matlab[1, 0].field2, 2) + self.assertListEqual(list(s_matlab[1, 0].keys()), ["field1", "field2"]) + self.assertListEqual(list(s_matlab[1, 0].values()), [1, 2]) + self.assertListEqual( + list(s_matlab[1, 0].items()), [("field1", 1), ("field2", 2)] + ) + + def test_struct_to_matlab_empty(self): + # Construct an empty struct + s = Struct() + + # Get properties in Matlab + try: + size = Runtime.call("size", s) + type = Runtime.call("class", s) + fieldnames = Runtime.call("fieldnames", s) + except Exception: + self.fail("Empty struct to Matlab failed.") + + # Check properties in Matlab + self.assertEqual(size.tolist(), [1, 1]) + self.assertEqual(type, "struct") + self.assertListEqual(fieldnames.tolist(), []) + + def test_struct_to_matlab_empty_1d(self): + # Construct a 1x3 struct array + s = Struct(3) + + # Get properties in Matlab + try: + size = Runtime.call("size", s) + type = Runtime.call("class", s) + fieldnames = Runtime.call("fieldnames", s) + except Exception: + self.fail("1D shape struct to Matlab failed.") + + # Check properties in Matlab + self.assertEqual(size.tolist(), [1, 3]) + self.assertEqual(type, "struct") + self.assertListEqual(fieldnames.tolist(), []) + + def test_struct_to_matlab_empty_2d_row(self): + # Construct a 1x3 struct array + s = Struct(1, 3) + + # Get properties in Matlab + try: + size = Runtime.call("size", s) + type = Runtime.call("class", s) + fieldnames = Runtime.call("fieldnames", s) + except Exception: + self.fail("1D row struct to Matlab failed.") + + # Check properties in Matlab + self.assertEqual(size.tolist(), [1, 3]) + self.assertEqual(type, "struct") + self.assertListEqual(fieldnames.tolist(), []) + + def test_struct_to_matlab_empty_2d_col(self): + # Construct a 3x1 struct array + s = Struct(3, 1) + + # Get properties in Matlab + try: + size = Runtime.call("size", s) + type = Runtime.call("class", s) + fieldnames = Runtime.call("fieldnames", s) + except Exception: + self.fail("1D col struct to Matlab failed.") + + # Check properties in Matlab + self.assertEqual(size.tolist(), [3, 1]) + self.assertEqual(type, "struct") + self.assertListEqual(fieldnames.tolist(), []) + + def test_struct_to_matlab_empty_2d(self): + # Construct a 3x2 struct array + s = Struct(3, 2) + + # Get properties in Matlab + try: + size = Runtime.call("size", s) + type = Runtime.call("class", s) + fieldnames = Runtime.call("fieldnames", s) + except Exception: + self.fail("2D struct to Matlab failed.") + + # Check properties in Matlab + self.assertEqual(size.tolist(), [3, 2]) + self.assertEqual(type, "struct") + self.assertListEqual(fieldnames.tolist(), []) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_structarray.py b/tests/test_structarray.py new file mode 100644 index 0000000..4cdc60e --- /dev/null +++ b/tests/test_structarray.py @@ -0,0 +1,88 @@ +import unittest +import numpy as np + +from fieldtrip import Struct + + +class StructArrayTestCase(unittest.TestCase): + def setUp(self): + # Prepare some example data for testing + self.struct1 = {"a": 1, "b": 2} + self.struct2 = {"a": 2, "c": 4} + self.struct3 = {"a": 3, "c": 5} + self.struct4 = {"a": 4, "b": 1} + self.array1d = [self.struct1, self.struct2] + self.array2d = np.array( + [[self.struct1, self.struct2], [self.struct3, self.struct4]] + ) + + def test_initialization_with_structs(self): + sa = Struct(self.array1d) + self.assertEqual(sa.shape, (len(self.array1d),)) + + def test_initialization_with_ndarray(self): + sa = Struct(self.array2d) + self.assertEqual(sa.shape, self.array2d.shape) + + def test_getitem(self): + sa = Struct(self.array1d) + struct = sa[1] + self.assertIsInstance(struct, Struct) + self.assertEqual(dict(struct), self.struct2) + + def test_keys(self): + sa = Struct(self.array2d) + keys = sa.keys() + self.assertEqual(keys, {"a", "b", "c"}) + + def test_as_matlab_object(self): + sa = Struct(self.array2d) + objdict = sa._as_runtime() + self.assertEqual(objdict["type__"], "structarray") + self.assertEqual( + objdict["size__"].reshape(-1).tolist(), list(self.array2d.shape) + ) + self.assertEqual(len(objdict["data__"]), self.array2d.size) + + def test_from_matlab_object(self): + sa = Struct(self.array2d) + objdict = sa._as_runtime() + reconstructed_sa = Struct._from_runtime(objdict) + self.assertEqual(reconstructed_sa.shape, sa.shape) + self.assertEqual(reconstructed_sa.keys(), sa.keys()) + + def test_with_struct(self): + sa = Struct(list(map(Struct, self.array1d))) + objdict = sa._as_runtime() + _ = Struct._from_runtime(objdict) + + def test_flat_shape(self): + sa = Struct(self.array2d) + objdict = sa._as_runtime() + self.assertEqual(len(objdict["data__"]), 4) + self.assertEqual(objdict["data__"][0]["a"], self.struct1["a"]) + self.assertEqual(objdict["data__"][1]["a"], self.struct3["a"]) + self.assertEqual(objdict["data__"][2]["a"], self.struct2["a"]) + self.assertEqual(objdict["data__"][3]["a"], self.struct4["a"]) + + def test_repr(self): + sa = Struct(self.array1d) + repr_str = repr(sa) + repr_expected = "Struct([{'a': 1, 'b': 2}, {'a': 2, 'c': 4}])" + self.assertEqual(repr_expected, repr_str) + + def test_invalid_initialization(self): + # with self.assertRaises(TypeError): + # Struct(123) + + with self.assertRaises(TypeError): + Struct(["not", "a", "dict"]) + + def test_empty_structarray(self): + sa = Struct.from_any([]) + self.assertEqual(np.shape(sa), (0,)) + self.assertEqual(len(sa.keys()), 0) + + +if __name__ == "__main__": + unittest.main()