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

Circle shape bin not working #57

Closed
FPC25 opened this issue Apr 25, 2023 · 4 comments
Closed

Circle shape bin not working #57

FPC25 opened this issue Apr 25, 2023 · 4 comments

Comments

@FPC25
Copy link

FPC25 commented Apr 25, 2023

Hello, I was trying to do some tests with the ccp_profile function and I can't make the circle shape bin to work because it shows the error:

Traceback (most recent call last):
File "/home/felipe/.local/bin/ccp_profile", line 8, in
sys.exit(ccp_profile())
File "/home/felipe/.local/lib/python3.8/site-packages/seispy/scripts.py", line 94, in ccp_profile
ccp.stack()
File "/home/felipe/.local/lib/python3.8/site-packages/seispy/ccpprofile.py", line 228, in stack
for k in idxs:
TypeError: 'int' object is not iterable

Matter-of-factly I looked in the ccpprofile.py routine and I didn't get how it would interate with the idxs bin a number because in the function "stack(self)" we get :

...
 if self.cpara.width is None and self.cpara.shape == 'circle':
                idxs = self.idxs[i]
 else:
                idxs = self.idxs
 for j, dep in enumerate(self.cpara.stack_range):
                idx = int(j * self.stack_mul + self.cpara.stack_range[0]/self.cpara.dep_val)
                bin_dep_amp = np.array([])
                for k in idxs:
                         stop_idx = np.where(self.rfdep[k]['stopindex'] >= idx)[0]
                          fall_idx = np.where(distaz(self.rfdep[k][field_lat][stop_idx, idx], self.rfdep[k][field_lon][stop_idx, idx],
                                        bin_info[0], bin_info[1]).delta < self.fzone[j])[0]

meaning that, if we choose a circle we only get a int that is not interable. So, I commonly don't see something here, so can someone help what I didn't get right, please?

@FPC25
Copy link
Author

FPC25 commented Apr 25, 2023

I make it work, but I had to define the width on the ccp.cpg. I say that because when you download the example the Readme file says:

"# Half width of the profile in km, only works for rectangle bin
width =
"
and the ccp_profile just work defining that variable.

xumi1993 added a commit that referenced this issue Apr 27, 2023
@xumi1993
Copy link
Owner

Thank you very much. I've fixed the bug in commit 328e399. You can update to the dev branch and have a test in your case. Please let me know if you have any questions.

@FPC25
Copy link
Author

FPC25 commented Apr 27, 2023

So I tried it again and received the same error, but I never had to this kind of thing before so, before assuming the corrections were wrong I would like to verify if I really reinstalled it correctly.

Before everything, I uninstall the previous version I had installed in my computer and then I downloaded with git:

git clone --branch=dev https://github.com/xumi1993/seispy.git

in my Download file, then I install it by pip:

pip install ./seispy

then I downloaded the example again and just chanced the bin shape to circle. Did I something wrong?

xumi1993 added a commit that referenced this issue Apr 29, 2023
@xumi1993
Copy link
Owner

Please try this commit 0cac09e again.

@xumi1993 xumi1993 closed this as completed May 4, 2023
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

2 participants