@@ -38,7 +38,7 @@ def _new_IrregularlySampledSignal(
3838 units = None ,
3939 time_units = None ,
4040 dtype = None ,
41- copy = True ,
41+ copy = None ,
4242 name = None ,
4343 file_origin = None ,
4444 description = None ,
@@ -93,8 +93,8 @@ class IrregularlySampledSignal(BaseSignal):
9393 dtype: numpy dtype | string | None, default: None
9494 Overrides the signal array dtype
9595 Does not affect the dtype of the times which must be floats
96- copy: bool, default: True
97- Whether copy should be set to True when making the quantity array
96+ copy: bool | None , default: None
97+ deprecated and no longer used (for NumPy 2.0 support). Will be removed.
9898 name: str | None, default: None
9999 An optional label for the dataset
100100 description: str | None, default: None
@@ -158,7 +158,7 @@ def __new__(
158158 units = None ,
159159 time_units = None ,
160160 dtype = None ,
161- copy = True ,
161+ copy = None ,
162162 name = None ,
163163 file_origin = None ,
164164 description = None ,
@@ -171,6 +171,12 @@ def __new__(
171171 This is called whenever a new :class:`IrregularlySampledSignal` is
172172 created from the constructor, but not when slicing.
173173 """
174+
175+ if copy is not None :
176+ raise ValueError (
177+ "`copy` is now deprecated in Neo due to removal in NumPy 2.0 and will be removed in 0.15.0."
178+ )
179+
174180 signal = cls ._rescale (signal , units = units )
175181 if time_units is None :
176182 if hasattr (times , "units" ):
@@ -199,7 +205,7 @@ def __init__(
199205 units = None ,
200206 time_units = None ,
201207 dtype = None ,
202- copy = True ,
208+ copy = None ,
203209 name = None ,
204210 file_origin = None ,
205211 description = None ,
@@ -231,7 +237,7 @@ def __reduce__(self):
231237 self .units ,
232238 self .times .units ,
233239 self .dtype ,
234- True ,
240+ None ,
235241 self .name ,
236242 self .file_origin ,
237243 self .description ,
@@ -544,6 +550,9 @@ def time_shift(self, t_shift):
544550 (the original :class:`IrregularlySampledSignal` is not modified).
545551 """
546552 new_sig = deepcopy (self )
553+ # As of numpy 2.0/quantities 0.16 we need to copy the array itself
554+ # in order to be able to time_shift
555+ new_sig .times = self .times .copy ()
547556
548557 new_sig .times += t_shift
549558
@@ -588,7 +597,7 @@ def merge(self, other):
588597 merged_annotations = merge_annotations (self .annotations , other .annotations )
589598 kwargs .update (merged_annotations )
590599
591- signal = self .__class__ (self .times , stack , units = self .units , dtype = self .dtype , copy = False , ** kwargs )
600+ signal = self .__class__ (self .times , stack , units = self .units , dtype = self .dtype , copy = None , ** kwargs )
592601 signal .segment = self .segment
593602 signal .array_annotate (** self ._merge_array_annotations (other ))
594603
@@ -681,7 +690,7 @@ def concatenate(self, other, allow_overlap=False):
681690 times = new_times [sorting ],
682691 units = self .units ,
683692 dtype = self .dtype ,
684- copy = False ,
693+ copy = None ,
685694 t_start = t_start ,
686695 t_stop = t_stop ,
687696 ** kwargs ,
0 commit comments