Skip to content

Commit 03b3c4e

Browse files
committed
Small improvements
1 parent db8164b commit 03b3c4e

File tree

2 files changed

+13
-22
lines changed

2 files changed

+13
-22
lines changed

src/analysis/data_analysis.jl

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -486,23 +486,6 @@ function daProfile(
486486
deleteat!(x_axis, idxs)
487487
deleteat!(profile, idxs)
488488

489-
# # Compute the unit of the norm
490-
# if isnothing(norm)
491-
# u_norm = Unitful.NoUnits
492-
# else
493-
# u_norm = plotParams(norm).unit
494-
# end
495-
496-
# # Compute the unit of the bins
497-
# if density
498-
# u_bin = flat ? u"kpc"^2 : u"kpc"^3
499-
# else
500-
# u_bin = Unitful.NoUnits
501-
# end
502-
503-
# # Compute the unit of the y axis
504-
# y_unit = plot_params.unit / u_norm / u_bin
505-
506489
y_axis = log10.(ustrip.(y_log, profile))
507490

508491
else
@@ -1284,6 +1267,7 @@ function daDensity3DProjection(
12841267
field_type::Symbol;
12851268
density::Bool=false,
12861269
log::Bool=true,
1270+
empty_nan::Bool=true,
12871271
l_unit::Unitful.Units=u"pc",
12881272
filter_function::Function=filterNothing,
12891273
)::Array{Float64,3}
@@ -1356,7 +1340,7 @@ function daDensity3DProjection(
13561340
# Find the nearest cell to each voxel
13571341
idxs, _ = nn(kdtree, physical_grid)
13581342

1359-
qty = similar(grid.grid, Float64)
1343+
qty = zeros(eltype(values), size(grid.grid))
13601344

13611345
Threads.@threads for i in eachindex(grid.grid)
13621346
qty[i] = values[idxs[i]]
@@ -1380,7 +1364,9 @@ function daDensity3DProjection(
13801364
end
13811365

13821366
# Set bins with a value of 0 to NaN
1383-
replace!(x -> iszero(x) ? NaN : x, qty)
1367+
if empty_nan
1368+
replace!(x -> iszero(x) ? NaN : x, qty)
1369+
end
13841370

13851371
# Apply log10 to enhance the contrast
13861372
if log

src/plotting/convenience.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,12 @@ function radialProfile(
608608
y_log = nothing
609609
end
610610

611-
base_request = mergeRequests(plot_params.request, norm_request, ff_request)
611+
base_request = mergeRequests(
612+
plot_params.request,
613+
norm_request,
614+
ff_request,
615+
Dict(plot_params.cp_type=>["POS "]),
616+
)
612617

613618
translation, rotation, trans_request = selectTransformation(trans_mode, base_request)
614619
filter_function, request = selectFilter(filter_mode, trans_request)
@@ -624,7 +629,7 @@ function radialProfile(
624629
plotSnapshot(
625630
simulation_paths,
626631
request,
627-
[lines!];
632+
[scatterlines!];
628633
output_path,
629634
base_filename,
630635
slice,
@@ -768,7 +773,7 @@ function radialProfile(
768773
plotSnapshot(
769774
fill(simulation_path, length(quantities)),
770775
request,
771-
[lines!];
776+
[scatterlines!];
772777
output_path,
773778
base_filename="$(basename(simulation_path))_radial_profile",
774779
slice,

0 commit comments

Comments
 (0)