Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_middle_z generates error when xyz_xyz.shape[1] is 0 #19

Open
klaas-koster opened this issue Jul 10, 2024 · 0 comments
Open

get_middle_z generates error when xyz_xyz.shape[1] is 0 #19

klaas-koster opened this issue Jul 10, 2024 · 0 comments

Comments

@klaas-koster
Copy link

klaas-koster commented Jul 10, 2024

When running the synthoseis-quick-start notebook with the supplied example.json config file, get_middle_z regularly generates an error that random_idx cannot be calculated because xyz_xyz.shape[1] equals 0. The shape of xyz_xyz is (3, 0) when this happens instead of (3, 162) for the faults that do not have a problem.

I haven't yet dug deeper into what causes this situation, but added a check in Faults.py at line 2157 to check for this condition and break out of the loop when it occurs:

                if xyz_xyz.size != 0:
                    random_idx = xyz_xyz[:, np.random.choice(xyz_xyz.shape[1])]
                    print(
                        "   ... Computing fault middle to hang max displacement function"
                    )
                    print("    ... x idx for max displacement  = ", random_idx[0])
                    print("    ... y idx for max displacement  = ", random_idx[1])
                    print("    ... z idx for max displacement  = ", random_idx[2])
                    print(
                        "    ... ellipsoid value  = ",
                        ellipse[random_idx[0], random_idx[1], random_idx[2]],
                    )
                else:
                    print("   ... Break the loop, xyz_xyz.shape[1] = 0")
                    random_idx = []
                    do_it = False
                    break
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

No branches or pull requests

1 participant