-
Notifications
You must be signed in to change notification settings - Fork 2
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
BeamedPointSource model added #150
Conversation
+ added docstrings
Don't forget to Gradus.jl/src/corona/corona-models.jl Line 192 in 65b92e9
|
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.
Looks good, just need a test case to make sure we don't break behaviour in the future! :)
`include("models/moving-source.jl")
|
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.
Cool stuff!
src/corona/models/moving-source.jl
Outdated
function Gradus.sample_position_velocity(m::AbstractMetric, model::BeamedPointSource) | ||
x = SVector{4}(0, model.r, 1e-4, 0) | ||
g = metric_components(m, SVector(x[2], x[3])) | ||
v̄ = SVector(1, __BeamedPointSource.drdt(g, model.β), 0, 0) | ||
v = Gradus.constrain_normalize(m, x, v̄; μ = 1) | ||
x, v | ||
end | ||
|
||
# since we have axis-symmetry, exploit this method for much faster computation | ||
Gradus.emissivity_profile( | ||
::Nothing, | ||
m::AbstractMetric, | ||
d::AbstractAccretionDisc, | ||
model::BeamedPointSource, | ||
spec::Gradus.AbstractCoronalSpectrum; | ||
kwargs..., | ||
) = Gradus._point_source_symmetric_emissivity_profile(m, d, model, spec; kwargs...) |
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.
Don't need to prefix Gradus.
here, especially not for AbstractCoronalSpectrum
, since we're already in the Gradus module namespace.
spec::Gradus.AbstractCoronalSpectrum; | ||
kwargs..., | ||
) = Gradus._point_source_symmetric_emissivity_profile(m, d, model, spec; kwargs...) | ||
|
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.
Also should have
export BeamedPointSource
so that users can just do BeamedPointSource
instead of Gradus.BeamedPointSource
.
comparison of lamp post model and moving source model with velocity set to zero -- test
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## main #150 +/- ##
==========================================
+ Coverage 68.07% 68.94% +0.86%
==========================================
Files 59 60 +1
Lines 2622 2634 +12
==========================================
+ Hits 1785 1816 +31
+ Misses 837 818 -19
|
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.
Test is good as a consistency check. At some point will want to add a test for the cases where
You still need to include this test in the test suite: add a line just after here
Line 26 in 3e6d774
include("unit/emissivity.jl") |
to include this file, else it wont run.
test/beamedpointsource-test.jl
Outdated
plot(profile0, label = "lamp post", linecolor = "magenta") | ||
plot!(profile1, label = "moving src β = 0", linecolor = "royalblue4") |
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.
Remove plotting code from tests.
test/beamedpointsource-test.jl
Outdated
d, | ||
model0, | ||
n_samples = 100_000, | ||
#sampler = EvenSampler(BothHemispheres(), GoldenSpiralGenerator()) |
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.
Remove commented code.
test/runtests.jl
Outdated
@@ -23,6 +23,7 @@ end | |||
include("unit/coronal-beaming.jl") | |||
include("smoke-tests/coronal-spectra.jl") | |||
include("unit/emissivity.jl") | |||
include("test/beamedpointsource-test.jl") |
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.
Should just be
include("beamedpointsource-test.jl")
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.
fixed
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.
LGTM
BeamedPointSource model added to
src/corona/models/
+ added docstrings