Skip to content

Commit 02dbaa4

Browse files
committed
Fix ABUNDANCE_SHIFT bugs
1 parent ac193c6 commit 02dbaa4

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

src/analysis/data_analysis.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ function daMolla2015(
12121212
positions = filtered_dd[:stellar]["POS "]
12131213
masses = computeElementMass(filtered_dd, :stellar, element) ./ ATOMIC_WEIGHTS[element]
12141214
norm = computeElementMass(filtered_dd, :stellar, :H) ./ ATOMIC_WEIGHTS[:H]
1215-
scaling = x -> 12.0 .+ log10.(ustrip.(y_unit, x))
1215+
scaling = x -> ABUNDANCE_SHIFT[element] .+ log10.(ustrip.(y_unit, x))
12161216
density = false
12171217

12181218
else
@@ -2082,8 +2082,18 @@ function daMetallicity2DProjection(
20822082

20832083
end
20842084

2085+
title = if element == :all
2086+
"log₁₀(Z [Z⊙])"
2087+
else
2088+
if iszero(ABUNDANCE_SHIFT[element])
2089+
"log₁₀($(element) / H)"
2090+
else
2091+
"$(ABUNDANCE_SHIFT[element]) + log₁₀($(element) / H)"
2092+
end
2093+
end
2094+
20852095
@info(
2086-
"\nMetallicity range - $(element == :all ? "log₁₀(Z [Z⊙])" : "$(ABUNDANCE_SHIFT[element]) + log₁₀($(element) / H)") \
2096+
"\nMetallicity range - $(title) \
20872097
\n Simulation: $(basename(filtered_dd[:sim_data].path)) \
20882098
\n Snapshot: $(filtered_dd[:snap_data].global_index) \
20892099
\n Component: $(component) \

src/auxiliary_functions/plotting.jl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,9 +2064,15 @@ function plotParams(quantity::Symbol)::PlotParams
20642064
# See computeAbundance() in ./src/analysis/compute_quantities/masses.jl
20652065
element = GAS_ABUNDANCE_SPLITS[quantity]
20662066

2067+
if iszero(ABUNDANCE_SHIFT[element])
2068+
axis_label = L"\log_{10}(\mathrm{%$element} \, / \, \mathrm{H})"
2069+
else
2070+
axis_label = L"%$(Int(ABUNDANCE_SHIFT[element])) + \log_{10}(\mathrm{%$element} \, / \, \mathrm{H})"
2071+
end
2072+
20672073
plot_params = PlotParams(;
20682074
request = Dict(:gas => ["MASS", "GMET"]),
2069-
axis_label = L"%$(Int(ABUNDANCE_SHIFT[element])) + \log_{10}(\mathrm{%$element} \, / \, \mathrm{H})",
2075+
axis_label,
20702076
cp_type = :gas,
20712077
)
20722078

@@ -2075,9 +2081,15 @@ function plotParams(quantity::Symbol)::PlotParams
20752081
# See computeAbundance() in ./src/analysis/compute_quantities/masses.jl
20762082
element = STELLAR_ABUNDANCE_SPLITS[quantity]
20772083

2084+
if iszero(ABUNDANCE_SHIFT[element])
2085+
axis_label = L"\log_{10}(\mathrm{%$element} \, / \, \mathrm{H})"
2086+
else
2087+
axis_label = L"%$(Int(ABUNDANCE_SHIFT[element])) + \log_{10}(\mathrm{%$element} \, / \, \mathrm{H})"
2088+
end
2089+
20782090
plot_params = PlotParams(;
20792091
request = Dict(:stellar => ["MASS", "GME2"]),
2080-
axis_label = L"%$(Int(ABUNDANCE_SHIFT[element])) + \log_{10}(\mathrm{%$element} \, / \, \mathrm{H})",
2092+
axis_label,
20812093
cp_type = :stellar,
20822094
)
20832095

src/plotting/post_processing.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,7 +1533,7 @@ Draw a profile for the Milky Way using the data compiled by Mollá et al. (2015)
15331533
+ `:molecular_area_density` -> Molecular mass surface density, as ``\\log10(\\Sigma_\\text{H2})``.
15341534
+ `:atomic_area_density` -> Atomic mass surface density, as ``\\log10(\\Sigma_\\text{HI})``.
15351535
+ `:sfr_area_density` -> Star formation rate surface density, as ``\\log10(\\Sigma_\\text{SFR})``.
1536-
+ `:X_stellar_abundance` -> Stellar abundance of element ``\\mathrm{X}``, as ``12 + \\log_{10}(\\mathrm{X \\, / \\, H})``. ``\\mathrm{X}`` can be O (oxygen), N (nitrogen), or C (carbon).
1536+
+ `:X_stellar_abundance` -> Stellar abundance of element ``\\mathrm{X}``, as [`ABUNDANCE_SHIFT`](@ref) + ``\\log_{10}(\\mathrm{X \\, / \\, H})``. ``\\mathrm{X}`` can be O (oxygen), N (nitrogen), or C (carbon).
15371537
- `y_unit::Unitful.Units=Unitful.NoUnits`: Target unit for `quantity`.
15381538
- `color::ColorType=WONG_RED`: Color of the line.
15391539
- `linestyle::LineStyleType=:solid`: Style of the line.
@@ -1609,13 +1609,13 @@ function ppMolla2015!(
16091609
y_data = (raw[!, "logΣsfr"] raw[!, "logΣsfr error"]) .+ factor
16101610
elseif quantity == :O_stellar_abundance
16111611
# dimensionless
1612-
y_data = raw[!, "O/H"] .± raw[!, "ΔO/H"]
1612+
y_data = @. (raw[!, "O/H"] - 12.0 + ABUNDANCE_SHIFT[:O]) ± raw[!, "ΔO/H"]
16131613
elseif quantity == :N_stellar_abundance
16141614
# dimensionless
1615-
y_data = raw[!, "N/H"] .± raw[!, "ΔN/H"]
1615+
y_data = @. (raw[!, "N/H"] - 12.0 + ABUNDANCE_SHIFT[:N]) ± raw[!, "ΔN/H"]
16161616
elseif quantity == :C_stellar_abundance
16171617
# dimensionless
1618-
y_data = raw[!, "C/H"] .± raw[!, "ΔC/H"]
1618+
y_data = @. (raw[!, "C/H"] - 12.0 + ABUNDANCE_SHIFT[:C]) ± raw[!, "ΔC/H"]
16191619
else
16201620
throw(ArgumentError("ppMolla2015: `x_quantity` can only be :stellar_area_density, \
16211621
:ode_molecular_area_density, :br_molecular_area_density, :ode_atomic_area_density, \

0 commit comments

Comments
 (0)