77import numpy as np
88import time
99
10+ ## numpy 1.X
11+ try : AxisError = np .AxisError
12+ ## numpy 2.X
13+ except : from numpy .exceptions import AxisError
14+
1015from .settings import Settings ,default_settings
1116from .tween import TweenParams
1217from .particlegroup import ParticleGroup
@@ -720,11 +725,11 @@ def __init__(
720725 :type write_to_disk: bool, optional
721726 :param loud: flag to print status information to the console, defaults to False
722727 :type loud: bool, optional
723- :raises np. AxisError: if the coordinate data cannot be interpreted
728+ :raises AxisError: if the coordinate data cannot be interpreted
724729 :raises ValueError: if the number of particle groups does not match the number of
725730 coordinate arrays
726- :raises np. AxisError: if the field data cannot be interpreted
727- :raises np. AxisError: if the field names cannot be interpreted
731+ :raises AxisError: if the field data cannot be interpreted
732+ :raises AxisError: if the field names cannot be interpreted
728733 """
729734
730735 super ().__init__ (** kwargs )
@@ -740,14 +745,14 @@ def __init__(
740745 ## passed a jagged array of different coordinates
741746 pass
742747 else :
743- raise np . AxisError ("Uninterpretable coordinate array, either pass a single (N,3) array" +
748+ raise AxisError ("Uninterpretable coordinate array, either pass a single (N,3) array" +
744749 " or a jagged list of 'shape' (M,N_m,3)" )
745750
746751 ngroups = len (coordinates )
747752 npartss = np .array ([len (coords ) for coords in coordinates ])
748753
749754 ## check fields and wrap a single field for a single particle group
750- fielderror = np . AxisError ("Uninterpretable field array, either pass a single N array"
755+ fielderror = AxisError ("Uninterpretable field array, either pass a single N array"
751756 " or a jagged list of 'shape' (M,N_fm,N_pm)" )
752757 if fields is not None :
753758 ## special case and want to allow convenient/inconsistent syntax,
@@ -784,7 +789,7 @@ def __init__(
784789 nfieldss = [len (this_fields ) for this_fields in fields ]
785790
786791 ## check field names and generate them if necessary
787- fieldnameerror = np . AxisError ("Uninterpretable field array, either pass a single N array" +
792+ fieldnameerror = AxisError ("Uninterpretable field array, either pass a single N array" +
788793 " or a jagged list of 'shape' (M,N_fm,N_pm)" )
789794
790795 if field_names is not None :
@@ -1006,7 +1011,7 @@ def __getHDF5Coordinates(
10061011 :param coordinates: existing coordinate array that should be appended to, defaults to None
10071012 :type coordinates: np.ndarray, optional
10081013 :raises TypeError: if :code:`coordinates` is not of type :code:`np.ndarray`
1009- :raises np. AxisError: if :code:`coordinates` does not have shape (N,3)
1014+ :raises AxisError: if :code:`coordinates` does not have shape (N,3)
10101015 :return: coordinates, the opened coordinate array from :code:`fname`
10111016 :rtype: np.ndarray
10121017 """
@@ -1018,7 +1023,7 @@ def __getHDF5Coordinates(
10181023 elif type (coordinates )!= np .ndarray :
10191024 raise TypeError ("Existing coordinate array must be of type np.ndarry" )
10201025 if np .shape (coordinates )[- 1 ] != 3 :
1021- raise np . AxisError ("Last axis of existing coordinate array must be of size 3" )
1026+ raise AxisError ("Last axis of existing coordinate array must be of size 3" )
10221027
10231028 ## open the hdf5 group
10241029 if particle_group is not None :
0 commit comments