Skip to content

Commit

Permalink
Fix RMAP and stats dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
timonmerk committed Nov 1, 2024
1 parent 0ae315e commit 647a0a1
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
py_neuromodulation
==================

Documentation: https://neuromodulation.github.io/py_neuromodulation/

Analyzing neural data can be a troublesome, trial and error prone,
and beginner unfriendly process. *py_neuromodulation* allows using a simple
interface for extraction of established neurophysiological features and includes commonly applied pre -and postprocessing methods.
Expand Down
20 changes: 13 additions & 7 deletions docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,36 @@ In general we recommend placing questions and issues in the `GitHub issue tracke

For code formatting we use `ruff <https://docs.astral.sh/ruff/formatter/>`_.

For code development, we recommend using the package manager `rye <https://rye.astral.sh/>`_.
For code development, we recommend using the package manager `uv <https://docs.astral.sh/uv/getting-started/installation/>`_.

To setup the python environment, type

::

rye pin 3.12
uv python install 3.11
uv venv

then sync the environment with

Depending on your operating system, activate the rye virtual environment:

::

rye sync
. .venv/bin/activate

Depending on your operating system, activate the rye virtual environment:
And install the pyproject.toml dependencies:

::

then sync the environment with

::

. .venv/bin/activate
uv sync

To install the documentation dependencies use pip:

::

python -m pip install .[docs]
uv pip install -e .[docs]


6 changes: 3 additions & 3 deletions py_neuromodulation/analysis/RMAP.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import nibabel as nib
from matplotlib import pyplot as plt

from py_neuromodulation.plots import reg_plot
from py_neuromodulation.types import _PathLike
from py_neuromodulation.analysis import reg_plot
from py_neuromodulation.utils.types import _PathLike
from py_neuromodulation import PYNM_DIR

LIST_STRUC_UNCONNECTED_GRIDPOINTS_HULL = [256, 385, 417, 447, 819, 914]
Expand Down Expand Up @@ -335,7 +335,7 @@ def save_Nii(
reshape: bool = True,
):
if reshape:
fp = np.reshape(fp, (91, 109, 91), order="F")
fp = np.reshape(fp, (91, 109, 91), order="C")

img = nib.nifti1.Nifti1Image(fp, affine=affine)

Expand Down
6 changes: 3 additions & 3 deletions py_neuromodulation/analysis/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# from numba import njit
import numpy as np
import pandas as pd
import scipy.stats as stats
import scipy.stats as scipy_stats


def fitlm_kfold(x, y, kfold_splits=5):
Expand Down Expand Up @@ -51,7 +51,7 @@ def permutationTestSpearmansRho(x, y, plot_distr=True, x_unit=None, p=5000):
"""

# compute ground truth difference
gT = stats.spearmanr(x, y)[0]
gT = scipy_stats.spearmanr(x, y)[0]
#
pV = np.array((x, y))
# Initialize permutation:
Expand All @@ -65,7 +65,7 @@ def permutationTestSpearmansRho(x, y, plot_distr=True, x_unit=None, p=5000):
random.shuffle(args_order_2)
# Compute permuted absolute difference of your two sampled
# distributions and store it in pD:
pD.append(stats.spearmanr(pV[0, args_order], pV[1, args_order_2])[0])
pD.append(scipy_stats.spearmanr(pV[0, args_order], pV[1, args_order_2])[0])

# calculate p value
if gT < 0:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ dependencies = [
"seaborn >= 0.11",
"llvmlite>=0.43.0",
"numba>=0.60.0",
"nibabel>=5.3.2",
]

[project.optional-dependencies]
Expand Down

0 comments on commit 647a0a1

Please sign in to comment.