Edem python codding

ABBAS_20663
ABBAS_20663 Altair Community Member
edited December 2022 in Community Q&A

Dear sir 

I have attached the apparatus and python analyst code and setting file for direct shear test in Geotechnical engineering that I have coded and also the picture of the error when I run the python code in spider program. I want to ask is there anyone can help in python coding for direct shear test to solve this error and reach to a suitable code?

Tagged:

Answers

  • Renan
    Renan
    Altair Employee
    edited December 2022

    Hi Abbas,

    Judging by the error message you got, it seems like the SStress[s_1_start:s_1_end] array is empty and the np.amax function doesn't work on empty arrays. What I'd suggest you do is checking if the SStress array is empty to begin and check if s_1_start and s_1_end are equal. You can also just catch this exception and ignore it if you by doing:

     

    try:     s_1=np.amax(SStress[s_1_start:s_1_end]) except ValueError:     pass

    <span class="hljs-keyword"><br /><br /><span style="font-family: arial, helvetica, sans-serif;">Hope this helps you.</span><br /><span style="font-family: arial, helvetica, sans-serif;">Best regards,</span><br /><span style="font-family: arial, helvetica, sans-serif;">Renan</span></span>