-
Notifications
You must be signed in to change notification settings - Fork 7
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
added testInterpolation for 1d grids #31
Conversation
src/grid/interpolate.jl
Outdated
function testInterpolation1D(func, grid1, grid2) | ||
data1 = [] | ||
for i in 1:grid1.size | ||
push!(data1, func(grid1[i])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may do it with the pythonic way
data1=[func(grid1[i]) for i in range(grid1.size)]
src/grid/interpolate.jl
Outdated
for i in 1:grid2.size | ||
push!(data2, func(grid2[i])) | ||
push!(data2_int, linear1D(data1, grid1, grid2[i])) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
src/grid/interpolate.jl
Outdated
data1 = [] | ||
for i in 1:grid1.size | ||
push!(data1, func(grid1[i])) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
for i in 1:grid2.size | ||
push!(data2, func(grid2[i])) | ||
push!(data2_int, linear1D(data1, grid1, grid2[i])) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
|
||
Test interpolation on grid1 with function func, compare results with func(grid2). | ||
Return max deviation and std of deviation. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the standard format for the comments:
#Arguments
func
: function needs to be interpolatedgrid1
: grid to testgrid2
: grid to test
src/grid/interpolate.jl
Outdated
Return max deviation and std of deviation. | ||
|
||
""" | ||
function testInterpolation1D(func, grid1, grid2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may merge testInterpolation1D
and testInterpolation1D_rel: You may add a flag
relativeError`. If true, return relative error; if false, return absoluate error.
return d_max, d_std | ||
end | ||
|
||
function optimizeUniLog(generator, para, MN, func) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the standard format for the documentation
"""
function optimizeUniLog(generator, para, MN, func)
return an automatically optimized UniLog grid....
Arguments:
generator
: functiongenerator(para, M, N)
to generate a UniLog grid- ...
"""
No description provided.