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

Bug in synthetic dispersion curve save_data() method #10

Open
dylanmikesell opened this issue Feb 28, 2021 · 0 comments
Open

Bug in synthetic dispersion curve save_data() method #10

dylanmikesell opened this issue Feb 28, 2021 · 0 comments

Comments

@dylanmikesell
Copy link

We have been using BayHunter for a near-surface study (<100m). We have been using the built-in routine to SynthObs.return_swddata() to compute synthetic dispersion curves for the mean and median models. With one of our data so far, we have run into a tricky little bug. For the mean Vs model, we can compute synthetic curve with no problem; however, we get an error with the median model. This occurs for the Love wave. The model is a thin fast layer over a halfspace. The error is strange because it does not exist on a mac, but does occur on our linux cluster.

$ python write_npy2csv.py 
mean
dict_keys(['rdispph', 'rdispgr', 'ldispph', 'ldispgr'])
ref = rdispph, type(x) = <class 'numpy.ndarray'>
ref = rdispgr, type(x) = <class 'numpy.ndarray'>
ref = ldispph, type(x) = <class 'numpy.ndarray'>
ref = ldispgr, type(x) = <class 'numpy.ndarray'>
median
dict_keys(['rdispph', 'rdispgr', 'ldispph', 'ldispgr'])
ref = rdispph, type(x) = <class 'numpy.ndarray'>
ref = rdispgr, type(x) = <class 'numpy.ndarray'>
ref = ldispph, type(x) = <class 'numpy.float64'>
Traceback (most recent call last):
  File "write_npy2csv.py", line 120, in <module>
    extract_data(depth_int, syn_per, basepath, plot=True)
  File "write_npy2csv.py", line 57, in extract_data
    SynthObs.save_data(syn_disp, outfile=disp_file)
  File "/home/dylanmikesell/anaconda3/lib/python3.7/site-packages/BayHunter/SynthObs.py", line 116, in save_data
    if len(x) > 0: # check if targets exist
TypeError: object of type 'numpy.float64' has no len()

You can see in the last print statement that the ldispph in save_data() is all of a sudden a float64 rather than an ndarray. This does not happen on the mac...type(x) remains an ndarray for this model.

Are there any ideas of what could cause this behavior?

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