Skip to content

Merge devel into main - #51

Merged
ingo-m merged 13 commits into
mainfrom
devel
Sep 24, 2026
Merged

ingo-m merged 13 commits into
mainfrom
devel

Conversation

@ingo-m

@ingo-m ingo-m commented Sep 24, 2026

Copy link
Copy Markdown
Owner

Merge devel into main:

  • Updated CI/CD pipeline
  • Fixed off-screen horizontal bar position
  • Updated readme

ingo-m and others added 13 commits October 30, 2018 23:48
Packaging:
- Replace setup.py/setup.cfg/requirements.txt with pyproject.toml. numpy
  and Cython are build requirements, so users no longer have to install
  numpy before pyprf. setup.py only declares the cython extensions.
- Require Python >= 3.11. Dependencies have lower bounds instead of exact
  pins (numpy>=1.26, scipy>=1.11, nibabel>=5.0, pillow>=10.0, h5py>=3.10).
- Stop committing compiled cython files (*.so, *.c); they are built at
  install time. Remove cython_setup.py & cython_setup_call.py (replaced
  by `pip install -e .`).
- Remove README.rst; PyPI renders README.md directly.
- Version 3.0.0.

Code changes for current versions of Python and dependencies:
- Cython 3: cdef functions can no longer return tuples of memory views.
  The helper functions write their results into the memory views that
  are passed in, so they now return nothing.
- scipy.mgrid -> np.mgrid, scipy.ndimage.filters -> scipy.ndimage,
  np.bool -> bool, Thread.setDaemon() -> Thread.daemon.
- Python 3.14: csv.reader() no longer accepts a newline as delimiter;
  read the config file line by line instead.
- pkg_resources -> importlib.metadata for the version number.

TensorFlow (GPU) backend removed. A config file with strVersion = 'gpu'
now raises an informative error.

Tests:
- One test per backend (parametrized), output written to a temporary
  directory instead of the package directory. Test configs are rewritten
  with absolute paths, so the tests also run against an installed wheel.
  Removes the `lgcTest` path hack from load_config() and pyprf().
- Coverage of code in parallel processes is measured again.
- New tests for the design matrix creation of the stimulus presentation
  (create_design_matrix.py now imports PsychoPy only when run as script).
  Documents a known bug as expected failure: in full screen mode, the
  uppermost horizontal bar position is outside of the screen.

The results are identical to the reference results (to 3 decimals, as
before), on Python 3.11 (oldest dependencies), 3.12 and 3.14.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- tests.yml: runs the tests on push & pull request (main, devel), on
  Linux, macOS and Windows, with Python 3.11 to 3.14, and with the oldest
  supported dependency versions. Coverage is uploaded to Codecov. The
  stimulus presentation code is tested with the Python versions that
  PsychoPy supports (3.10 & 3.12), without PsychoPy.
- publish.yml: runs on push to main. If the version in pyproject.toml has
  no git tag yet, builds wheels (cibuildwheel; the test suite is run on
  each wheel), publishes to PyPI (trusted publishing), and creates a
  GitHub release (which triggers Zenodo) with a zip of the stimulus
  presentation folder.
- dependabot.yml: monthly updates of the GitHub Actions versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In logging mode, the stimulus frames were stored in an int8 array, which
was multiplied by 255. With numpy 1, the result was silently promoted to
a larger integer type. numpy 2 raises an OverflowError instead, so the
stimulus log (needed for the pRF analysis) could not be created with
current versions of PsychoPy. Use uint8 (the result is the same as
before with numpy 1).

Tested with PsychoPy 2026.2.4 (Python 3.12, numpy 2.5) under Xvfb.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- New GUI fields 'Scanner trigger key' (default: 5) and 'Response key'
  (default: 1), instead of hard-coded keys. Both are written to the log
  file. Key names are PsychoPy key names (e.g. '5', 't', 'num_5'), and
  are checked (different from each other, and from the exit keys).
- The trigger key is compared as a whole (previously, only the first
  character of the key name was compared, so e.g. 'num_5' would never
  have been detected).
- The experiment can be aborted (e + x) while waiting for the trigger.
- The design matrix is selected from a dropdown list of the available
  design matrices, which shows the TR and number of volumes of each, so
  that they can be compared with the fMRI sequence. A clear message is
  shown if there is no design matrix.
- GUI fields are shown in a fixed order (design matrix first), not
  alphabetically.
- Fix `-gui False` (crashed with a NameError). Without GUI, the default
  parameters are used.

Tested with PsychoPy 2026.2.4 under Xvfb (dialog, trigger with custom
key, responses, abort while waiting for trigger, logging mode).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Previously, if a design matrix with the chosen name already existed
(e.g. one of the example design matrices 'Run_01' to 'Run_03'), nothing
was saved, and there was only a warning in the console, which was easy
to overlook.

- The default name in the GUI is the first unused name ('Run_04' if
  'Run_01' to 'Run_03' exist).
- If the chosen name exists, a dialog asks for a different name (a free
  name is suggested), or to overwrite the existing design matrix.
- After saving, a dialog shows the path, TR, number of volumes, and
  duration of the run (needed for setting up the fMRI sequence).
- crt_design() checks for an existing file before creating the design
  matrix, and raises FileExistsError (unless lgcOvwr=True). It returns
  the path of the design matrix.
- Fix `-gui False` (did nothing). Without GUI, the default parameters are
  used.
- Updated GUI screenshots (for the README).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
README:
- Explain the two parts of pyprf (stimulus presentation & analysis), and
  that the stimulus presentation does not need the pyprf package, but is
  a folder with scripts that are run in PsychoPy.
- Step-by-step instructions for the stimulus presentation: installation
  (release zip file), creating design matrices, presenting the stimuli
  (including trigger & response keys), and creating the stimulus log for
  the analysis.
- Explain that the example design matrices are for a TR of 2.079 s, and
  that new design matrices are needed for other TRs.
- Updated installation & configuration of the analysis, and notes on
  upgrading from pyprf 2.
- Badges for GitHub Actions & Codecov (instead of Travis). Use the Zenodo
  concept DOI (always resolves to the latest version), so that the DOI
  does not need to be updated for each release.
- Absolute image URLs, so that images are shown on PyPI.

CONTRIBUTING.md: Development setup, tests, workflow, and the (automated)
release process. Replaces pypi_instructions.txt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Windows, a file cannot be removed while it is open. In hdf5 mode:
- pre_pro_func_hdf5() removed the hdf5 file with the functional data
  (after spatial smoothing) before closing it (PermissionError).
- model_creation() opened the hdf5 file with the pRF model time courses
  (to save a nii version for inspection), and did not close it.

(Found with the GitHub Actions tests on Windows. Reproduced on Linux by
making os.remove() fail for open hdf5 files.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In full screen mode, horizontal bars are only presented at the central
bar positions (as many as there are positions on the y-axis). Because of
an off-by-one error, one position too many was kept (e.g. positions 3 to
11 instead of 3 to 10, with 14 positions on the x-axis and 8 on the
y-axis). The uppermost horizontal bar was completely outside of the
screen, i.e. no stimulus was visible on these volumes (4 volumes per run
with the default settings). This did not affect the pRF analysis (the
analysis uses the stimulus log, i.e. what was actually presented).

New design matrices with default settings have 223 instead of 227
volumes. The example design matrices are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.88608% with 46 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@6710c3f). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...stimulus_presentation/code/create_design_matrix.py 54.45% 46 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #51   +/-   ##
=======================================
  Coverage        ?   95.85%           
=======================================
  Files           ?       19           
  Lines           ?     1423           
  Branches        ?        0           
=======================================
  Hits            ?     1364           
  Misses          ?       59           
  Partials        ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ingo-m
ingo-m merged commit 1c15f27 into main Sep 24, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant