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

Handle multiple sources and receivers with varying orientations in 'bipole' #74

Closed
AndyMcAliley opened this issue Mar 3, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@AndyMcAliley
Copy link

In empymod.bipole, when src or rec is formatted as [x0, x1, y0, y1, z0, z1] with multiple bipoles with different azimuths, the fields are computed as if all bipoles have the same orientation as the first in the list. For example, for two orthogonal sources:

import numpy as np
from empymod import bipole

xx = np.linspace(-100,100,40)
yy = np.linspace(-100,100,40)
X,Y = np.meshgrid(xx,yy)
xs = X.flatten()
ys = Y.flatten()

epm_args = {
    'src':[[0,20],[20,20],[0,0],[0,20],1e-2,1e-2],
    'rec':[xs,xs+10,ys,ys,1e-3,1e-3],
    'depth':[0],
    'res':[1e20,1],
    'freqtime':1,
    'srcpts':15,
    'verb':0,
    'epermH':[0,1],
    'epermV':[0,1]
}

bex = bipole(**epm_args)
np.unique(bex[:,1])

All entries of bex[:,1] are 0+0j. Similarly, for two orthogonal receivers,

epm_args = {
    'src':[0,20,0,0,1e-2,1e-2],
    'rec':[[30,30],[35,30],[30,30],[30,35],1e-3,1e-3],
    'depth':[0],
    'res':[1e20,1],
    'freqtime':1,
    'srcpts':15,
    'verb':0,
    'epermH':[0,1],
    'epermV':[0,1]
}
bex = bipole(**epm_args)
bex[1]

Output: 0j.

@prisae
Copy link
Member

prisae commented Mar 3, 2020

Thanks for reporting @AndyMcAliley , this seems to be a bug. I'll look into it!

@prisae prisae added the bug Something isn't working label Mar 3, 2020
@AndyMcAliley
Copy link
Author

I think utils.get_abs() is the culprit:

 # Remove if source is x- or y-directed
    check = np.atleast_1d(srcazm)[0]
    if np.allclose(srcazm % (np.pi/2), 0):  # if all angles are multiples of 90
        if np.isclose(check // (np.pi/2) % 2, 0):  # Multiples of pi (180)
            bab[:, 1] *= False        # x-directed source, remove y
        else:                                      # Multiples of pi/2 (90)
            bab[:, 0] *= False        # y-directed source, remove x

@prisae
Copy link
Member

prisae commented Mar 3, 2020

Yes, you are right. You touched a scenario that I never used so far...! I fixed it and will soon push an update.

@prisae
Copy link
Member

prisae commented Mar 3, 2020

And it obviously got not caught by the tests, so I'll have to add a test too...

@prisae
Copy link
Member

prisae commented Mar 3, 2020

OK, a fix is in the branch azimuth-dip. Could you test it (pip install git+https://github.com/empymod/empymod@azimuth-dip)?

If it works I will push later this week a new release.

@AndyMcAliley
Copy link
Author

Looks good to me, for both sources and receivers! Thanks so much!

@prisae prisae closed this as completed in b35c565 Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants