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

AttributeError: 'numpy.ndarray' object has no attribute 'tmin' #113

Closed
eugenialocchi opened this issue Oct 28, 2022 · 8 comments
Closed

Comments

@eugenialocchi
Copy link

**Hi,

I'm trying to do the kinematic model of an event with M = 5.5, using local data. For the goemetry mode i didn't have any problem to plot waveform fits.
When the ffi mode was finished and then I'm going to plot the waveform fits I have this error:**

beat - INFO Loading problem ...
config - INFO All hierarchicals ok!
config - INFO All hyperparameters ok!
config - INFO All priors ok!
models - INFO ... Initialising Distribution Optimizer ...

models - INFO Analysing problem ...
models - INFO ---------------------

seismic - INFO Loading seismic data for event 0 from: /home/locchi/events/FFI_CAMPOTOSTO/seismic_data.pkl
seismic - INFO Initialising seismic wavemap for "any_P" ...
heart - INFO Consistent number of datasets and targets in any_P_0 wavemap!
heart - INFO Number of seismic datasets for wavemap: any_P_0: 30

seismic - INFO Fault(s) discretized to 1.0 [km] patches.
seismic - INFO Preparing data of "any_P_0" for optimization
heart - INFO Did not find custom arrival times.
heart - INFO Using theoretical arrival times for "any_P_0"
models - INFO Using "none" regularization ...
plotting.seismic - INFO Drawing Waveform fits ...
backend - INFO Loading multitrace from /home/locchi/events/FFI_CAMPOTOSTO/ffi/stage_-1
plotting.seismic - INFO FFI waveform fit, using reference source ...
seismic - INFO Loading SeismicGFLibrary seismic_uparr_any_P_0_0
seismic - INFO Loading SeismicGFLibrary seismic_uperp_any_P_0_0
Traceback (most recent call last):
File "/home/locchi/anaconda3/envs/beat/bin/beat", line 8, in
sys.exit(main())
File "/home/locchi/anaconda3/envs/beat/lib/python3.9/site-packages/beat/apps/beat.py", line 2396, in main
globals()"command_" + command
File "/home/locchi/anaconda3/envs/beat/lib/python3.9/site-packages/beat/apps/beat.py", line 1910, in command_plot
plotting.plots_catalog[plot](problem, po)
File "/home/locchi/anaconda3/envs/beat/lib/python3.9/site-packages/beat/plotting/seismic.py", line 1114, in draw_seismic_fits
event_figs = seismic_fits(problem, stage, po)
File "/home/locchi/anaconda3/envs/beat/lib/python3.9/site-packages/beat/plotting/seismic.py", line 719, in seismic_fits
bresults = composite.assemble_results(
File "/home/locchi/anaconda3/envs/beat/lib/python3.9/site-packages/beat/models/seismic.py", line 482, in assemble_results
taper = at.get_pyrocko_taper(float(obs_tr.tmin - at.a))
AttributeError: 'numpy.ndarray' object has no attribute 'tmin'

**The seismic data are the same of geometry mode, with same taper but different filter!!

How can I fix this error??
Could it be an error due to numpy or pyrocko?

I have numpy 1.22.4, numpy-base 1.21.5, pyrocko 2022.06.10

Thanks**

@hvasbath
Copy link
Owner

Dear Eugenia,

this error is really puzzling. Apparently, at least some of your observed traces are numpy arrays instead of pyrocko.trace.Trace objects. You can try loading your seismic_data.pkl through beat.utility.load_objects("seismic_data.pkl"). Please inspect your traces there and make sure that they are all in the correct format. Although, if that wasnt the case there should have been an error earlier in the loading, which is why it is puzzling...

Hannes

@eugenialocchi
Copy link
Author

Hi Hannes,

I checked my traces and they are all a beat.heart.SeismicDataset object.

The stranger thing is that I used the same seismic_data.pkl for the geometry mode and I didn't have this error...

@hvasbath
Copy link
Owner

Thanks for checking again! I think I found the issue. Now I still do not understand why it still works in my test-case. I will keep you updated. Today evening I will have time to run more checks.

@hvasbath
Copy link
Owner

hvasbath commented Oct 30, 2022

Dear Eugenia,
Thanks again for posting that I was able to finally reproduce it.
I created a branch where https://github.com/hvasbath/beat/tree/ffi_kin_fix I fixed the issue. Now locally on my computer it fixed the issue, but it would be good if you try also on your case, before we merge that. Please see here: https://pyrocko.org/beat/docs/current/updating.html#testing-development-features for how to install particular git branches that are different from the standeard installation. In this case the "$feature_branch_name" would be "ffi_kin_fix".
Please let me know if this solves the issue for you.

@eugenialocchi
Copy link
Author

Thanks for help!!
So now I'm going to try for my case, I will let you know as soon as I have results!!

@eugenialocchi
Copy link
Author

Hi Hannes,

Finally the problem is solved using the new branch!!!

Thank you very much!!!

@hvasbath
Copy link
Owner

hvasbath commented Nov 7, 2022

Thats good news! Thanks for testing! So I will collect few other changes for a new release.

@hvasbath
Copy link
Owner

New release 1.2.3 is out where this is fixed. Closing.

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