Skip to content

Conversation

@seanlaw
Copy link
Contributor

@seanlaw seanlaw commented Jan 21, 2026

See #1116

Pull Request Checklist

Below is a simple checklist but please do not hesitate to ask for assistance!

  • Fork, clone, and checkout the newest version of the code
  • Create a new branch
  • Make necessary code changes
  • Install black (i.e., python -m pip install black or conda install -c conda-forge black)
  • Install flake8 (i.e., python -m pip install flake8 or conda install -c conda-forge flake8)
  • Install pytest-cov (i.e., python -m pip install pytest-cov or conda install -c conda-forge pytest-cov)
  • Run black --exclude=".*\.ipynb" --extend-exclude=".venv" --diff ./ in the root stumpy directory
  • Run flake8 --extend-exclude=.venv ./ in the root stumpy directory
  • Run ./setup.sh dev && ./test.sh in the root stumpy directory
  • Reference a Github issue (and create one if one doesn't already exist)

@gitnotebooks
Copy link

gitnotebooks bot commented Jan 21, 2026

Review these changes at https://app.gitnotebooks.com/stumpy-dev/stumpy/pull/1117

@seanlaw seanlaw requested a review from NimaSarajpoor January 21, 2026 05:25
@seanlaw
Copy link
Contributor Author

seanlaw commented Jan 21, 2026

@NimaSarajpoor This is ready to be reviewed at your earliest convenience, thanks!

Copy link
Collaborator

@NimaSarajpoor NimaSarajpoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanlaw
Looks good to me. Nice fix!

@seanlaw seanlaw merged commit cc6546b into stumpy-dev:main Jan 22, 2026
31 checks passed
@seanlaw seanlaw deleted the avoid_import_fastmath branch January 22, 2026 02:51
@seanlaw
Copy link
Contributor Author

seanlaw commented Jan 22, 2026

It's really strange that all tests were passing before the commit. However, after the code was committed, some of the tests are failing but nothing has changed.

@NimaSarajpoor
Copy link
Collaborator

NimaSarajpoor commented Jan 22, 2026

It's really strange that all tests were passing before the commit. However, after the code was committed, some of the tests are failing but nothing has changed.

And the error says:

# in core.preprocess_non_normalized

T[~np.isfinite(T)] = np.nan
        ^^^^^^^^^^^^^^^^^^
E       ValueError: assignment destination is read-only

I cannot understand why it shows "read-only".


Update: Apparently the error appears when input time series is of type pandas

@NimaSarajpoor
Copy link
Collaborator

NimaSarajpoor commented Jan 22, 2026

Update: Apparently the error appears when input time series is of type pandas

I was able to reproduce this with pandas 3.0.0, released in January 21, 2026.

import pandas as pd 
import numpy as np

print(pd.__version__)  # 3.0.0
print(np.__version__)  # 2.3.5


T_B = np.array([ 584.,  -11.,   23.,   79., 1001.,    0.,  -19.])
ps = pd.Series(T_B)
T = np.asarray(ps)
T[0] = 100

And this gives:

ValueError: assignment destination is read-only

Update: For the above example, np.shares_memory(T, ps.array) returns True, and according to read-only array section in pandas Copy-on-Write (CoW):

Accessing the underlying NumPy array of a DataFrame will return a read-only array if the array shares data with the initial DataFrame:

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.

2 participants