Closed zhangxiaoshuotttt closed 1 year ago
@zhangxiaoshuotttt hi,
First of all are you sure that your gradient is all zero?
I would try to check that by clipping displayable range of values coded by color (vmin/vmax
):
imshow(reshape(g, model0.n)',vmin=-maximum(g)/10f0,vmax=maximum(g)/10f0, extent=(0,10,4,0), cmap="jet")
@zhangxiaoshuotttt hi,
First of all are you sure that your gradient is all zero? I would try to check that by clipping displayable range of values coded by color (
vmin/vmax
):imshow(reshape(g, model0.n)',vmin=-maximum(g)/10f0,vmax=maximum(g)/10f0, extent=(0,10,4,0), cmap="jet")
Yes,here is the valure of g
that I outputed and the image
Is it possible that there is a problem with my coordinate setting? In the seismic data,I set the y-coordinate of the source point, the receiver point and the CMP point to 0.
The X-coordinate of my source,receiver and CMP points do not coincide. And I set model geometry by:
min_source_x = minimum(get_header(block,:SourceX))
shape = (942,361) # Number of gridpoints nx, nz
spacing = (12.5,12.5) # #n meters here
origin = (min_source_x, 0) # In meters as well
d_model = judiVector(VpModel)/1000;
d_model_T = d_model.data[1]'
m0 = 1f0./d_model_T.^2f0
model0 = Model(shape,spacing,origin,m0)
From the first look I don't see any mistakes.
To find the cause of that I recommend to do the following:
1) define somewhere above a function save_results(model, gradient, count)
. In that function save plotting result to a .png
image (the same way you call imshow(reshape(g, model0.n)',vmin=-maximum(g)/10f0,vmax=maximum(g)/10f0, extent=(0,10,4,0), cmap="jet")
but save it to the .png
).
2) within function objf!(x, grad)
call the function save_results(model0.m, grad, count)
. Thus you will see what grad
you have after each iteration.
Also I would pay attention if grad
gets updated within this block:
if length(grad) > 0
grad[1:end] = vec(gradient)
end
And also what returns fval, gradient = fwi_objective(model0, q[i], d_obs[i],options=jopt)
Saving these results to file will get you understanding what is wrong.
And for testing purposes you don't need to run all the shots, probably 1 shot at each iteration would be enough for debugging purposes.
From the first look I don't see any mistakes. To find the cause of that I recommend to do the following:
- define somewhere above a
function save_results(model, gradient, count)
. In that function save plotting result to a.png
image (the same way you callimshow(reshape(g, model0.n)',vmin=-maximum(g)/10f0,vmax=maximum(g)/10f0, extent=(0,10,4,0), cmap="jet")
but save it to the.png
).- within
function objf!(x, grad)
call the functionsave_results(model0.m, grad, count)
. Thus you will see whatgrad
you have after each iteration.Also I would pay attention if
grad
gets updated within this block:if length(grad) > 0 grad[1:end] = vec(gradient) end
And also what returns
fval, gradient = fwi_objective(model0, q[i], d_obs[i],options=jopt)
Saving these results to file will get you understanding what is wrong.
And for testing purposes you don't need to run all the shots, probably 1 shot at each iteration would be enough for debugging purposes.
Thank you for your advice Sir. I will check it as you said
@zhangxiaoshuotttt yes the problem may be related to the coordinates. Why you have Source/Rec X position about millions and your model is 50 km? Also your gradient picture is only 10 km. If your testing shots out of these 10 KM then you won't see gradient changes. Probably leave extent without modification.
You have to check coordinate scaler trace header as well. To be sure that you coordinates are fine please do the forward modeling for a single shot with the same model. If your coordinates are completely wrong then forward modeling will return empty. I see that RecSourceScalar=-10
that means that your coordinates will be mulltiplied by -10
or by 0.1
I don't remember exactly how JUDI handle this.
More over JUDI options for FWI should have IC = "fwi"
.
I think there is a scaling issue accessing th le min x through the headers as it should be rescaled by 1e4.
You can double check by making sure the origin coincides with Geometry(q[1].geometry).xloc[1]
You can double check by making sure the origin coincides with
Geometry(q[1].geometry).xloc[1]
Ok. I'll check. Thanks a lot.
@zhangxiaoshuotttt yes the problem may be related to the coordinates. Why you have Source/Rec X position about millions and your model is 50 km? Also your gradient picture is only 10 km. If your testing shots out of these 10 KM then you won't see gradient changes. Probably leave extent without modification.
You have to check coordinate scaler trace header as well. To be sure that you coordinates are fine please do the forward modeling for a single shot with the same model. If your coordinates are completely wrong then forward modeling will return empty. I see that
RecSourceScalar=-10
that means that your coordinates will be mulltiplied by-10
or by0.1
I don't remember exactly how JUDI handle this.More over JUDI options for FWI should have
IC = "fwi"
.
I rezeroed the origin by uniformly subtracting the x origin coordinate. Next, I will make a forward model to verify whether there are still problems with my coordinates. Thank you for your advice.
You can double check by making sure the origin coincides with
Geometry(q[1].geometry).xloc[1]
My "Function val" is not zero , it is "3.47902e+07".
@kerim371 @mloubout
Thanks for your help, I solved the problem, and here's my gradient field.
But I still have a question, why does my gradient field looks so shallow? The depth of my OBN nodes is floating around a depth of 90m.
By the way, I used statistical wavelet.
I think your wavelet has a time shift so there is very little illumination. Check what JUDI default tucker wavelet looks like you'll see it need to start around time=0
Thank you very much, this advice is really helpful!
Discussed in https://github.com/slimgroup/JUDI.jl/discussions/175