-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from LudwigBoess/RM_fix
Rm fix
- Loading branch information
Showing
6 changed files
with
71 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "SPHtoGrid" | ||
uuid = "8a806948-229a-4117-b79b-c12ac366026f" | ||
authors = ["LudwigBoess <[email protected]>"] | ||
version = "0.4.6" | ||
version = "0.4.7" | ||
|
||
[deps] | ||
Cosmology = "76746363-e552-5dba-9a5a-cef6fa9cc5ab" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,65 @@ | ||
# """ | ||
# rotation_measure(n_cm3::Real, B_par::Real; ν_obs=nothing) | ||
|
||
# Computes the rotation measure of the parallel magnetic field along the LOS. | ||
# """ | ||
# function rotation_measure(n_cm3::Real, B_par::Real; ν_obs=nothing) | ||
# RM = 812 * n_cm3 * 1.e3 * B_par * 1.e6 | ||
# if !isnothing(ν_obs) | ||
# RM *= c_light^2 * 1.e-4 / ν_obs | ||
# end | ||
# return mod(RM, π) | ||
# end | ||
|
||
""" | ||
get_dz(M, rho, hsml) | ||
Helper function to get the particle depth along the LOS. | ||
Helper function to get the particle depth along the LOS in the given units. | ||
All additional unit conversion must be performed by hand. | ||
""" | ||
get_dz(M, rho, hsml) = M / rho / (4 * hsml^2) | ||
|
||
""" | ||
rotation_measure(n_cm3::Real, B_los::Real, dz::Real; ν_obs=nothing) | ||
Computes the rotation measure of the parallel magnetic field along the LOS. | ||
## Arguments | ||
- `n_cm3::Real`: Electron number density in [cm^-3]. | ||
- `B_los::Real`: Magnetic field strength along the LOS in [G]. | ||
## Returns | ||
- `RM::Real`: Rotation measure in [rad/m^2]. | ||
## Mapping settings | ||
- weight function: [`part_weight_physical`](@ref) | ||
- reduce image: `false` | ||
""" | ||
function rotation_measure(n_cm3::Real, B_los::Real, dz::Real; ν_obs=nothing) | ||
function rotation_measure(n_cm3::Real, B_los::Real) | ||
# RM in rad/m^2 | ||
return faraday_prefac * n_cm3 * B_los * 100.0^2 | ||
end | ||
|
||
|
||
""" | ||
rotation_measure(n_cm3::Real, B_los::Real, dz::Real, ν_obs::Real) | ||
Computes the rotation measure of the parallel magnetic field along the LOS at a given frequency. | ||
To be used for continuous rotation of polarized emission along the LOS. | ||
## Arguments | ||
- `n_cm3::Real`: Electron number density in [cm^-3]. | ||
- `B_los::Real`: Magnetic field strength along the LOS in [G]. | ||
- `dz::Real`: Depth along the LOS in [cm]. See [`get_dz`](@ref) for a convenient helper function. | ||
- `ν_obs::Real`: Observing frequency in [Hz]. | ||
## Returns | ||
- `RM::Real`: Rotation measure in [rad/cm^2]. | ||
## Mapping settings | ||
- weight function: [`part_weight_physical`](@ref) | ||
- reduce image: `false` | ||
- stokes: `true` | ||
- sort_z: `true` | ||
- `RM`: use output of this function. | ||
""" | ||
function rotation_measure(n_cm3::Real, B_los::Real, dz::Real, ν_obs::Real) | ||
# RM in rad/cm^2 | ||
RM = faraday_prefac * n_cm3 * B_los | ||
if !isnothing(ν_obs) | ||
RM *= c_light^2 * dz / ν_obs | ||
end | ||
return mod(RM, π) | ||
|
||
# for Stokes parameters we need rotation at given frequency | ||
RM *= c_light^2 * dz / ν_obs^2 | ||
|
||
# store sign of rotation | ||
_sign = sign(RM) | ||
|
||
# reduce to minimum angle | ||
return _sign * mod(RM, π) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f4622fd
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.
@JuliaRegistrator register
f4622fd
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.
Registration pull request created: JuliaRegistries/General/106700
Tip: Release Notes
Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.
To add them here just re-invoke and the PR will be updated.
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: