xumi1993 / seispy

Python module of seismology and receiver functions

Home Page:https://seispy.xumijian.me

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Circle shape bin not working

FPC25 opened this issue · comments

commented

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?

commented

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.

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.

commented

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?

Please try this commit 0cac09e again.