Update Sweep.py#12
Open
UmerFarooqBiomedical wants to merge 1 commit intokai5z:masterfrom
Open
Conversation
There is this error with your code: Element k- and m-matrix symbolic evaluation done Element k- and m-matrix numeric evaluation done /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/fromnumeric.py:86: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. return ufunc.reduce(obj, axis, dtype, out, **passkwargs) Global K- and M-matrix addition done Traceback (most recent call last): File "/Users/walkerhutchinson/Desktop/OpenAI code/CYMATICS/chladni_patterns.py", line 141, in F = np.delete(F, ix, axis=1) File "<array_function internals>", line 180, in delete File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/lib/function_base.py", line 5128, in delete keep[obj,] = False IndexError: index 1441 is out of bounds for axis 0 with size 1 ----- Solution ------- The error message suggests that the index 1441 is out of bounds for axis 0 with size 1. This means that you are trying to access an element at index 1441 along the first axis of an array that has only 1 element along that axis. In this code case, the array F has shape (2881, 1), which means it has 2881 elements along the first axis and 1 element along the second axis. When you try to delete columns with indices 1441 and 1442 using the code F = np.delete(F, ix, axis=1), you are trying to delete columns that don't exist, because the array has only one column. You can use print(F.shape()) command to check the shape of F array. To fix the error, you should make sure that the indices you pass to np.delete are valid for the shape of the array. For example, if you want to delete the first column, you can use F = np.delete(F, 0, axis=1). If you want to delete the last two columns, you can use F = np.delete(F, np.s_[-2:], axis=1) In this code case, you can simply remove this code line or use try and except method to make it run properly. (Reference: Line 145-148)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is this error while running your code:
Element k- and m-matrix symbolic evaluation done
Element k- and m-matrix numeric evaluation done
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/fromnumeric.py:86: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. return ufunc.reduce(obj, axis, dtype, out, **passkwargs) Global K- and M-matrix addition done
Traceback (most recent call last):
File "/Users/Umer/Desktop/OpenAI code/CYMATICS/chladni_patterns.py", line 141, in F = np.delete(F, ix, axis=1)
File "<array_function internals>", line 180, in delete File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/lib/function_base.py", line 5128, in delete keep[obj,] = False
IndexError: index 1441 is out of bounds for axis 0 with size 1
----- Solution -------
The error message suggests that the index 1441 is out of bounds for axis 0 with size 1. This means that you are trying to access an element at index 1441 along the first axis of an array that has only 1 element along that axis.
In this code case, the array F has shape (2881, 1), which means it has 2881 elements along the first axis and 1 element along the second axis. When you try to delete columns with indices 1441 and 1442 using the code F = np.delete(F, ix, axis=1), you are trying to delete columns that don't exist, because the array has only one column. You can use print(F.shape()) command to check the shape of F array.
To fix the error, you should make sure that the indices you pass to np.delete are valid for the shape of the array. For example, if you want to delete the first column, you can use F = np.delete(F, 0, axis=1). If you want to delete the last two columns, you can use F = np.delete(F, np.s_[-2:], axis=1)
In this code case, you can simply remove this code line or use try and except method to make it run properly. (Reference: Line 145-148)