Results

Code
using DrWatson
@quickactivate
include(srcdir("main.jl"))
import Beforerr: easy_save
using AlgebraOfGraphics: linear
using Dates
Code
enc = "enc8" # event id (encounter id)    
easy_save(fname) = Beforerr.easy_save(fname; dir="$fig_dir/$enc", formats=[:svg])
mkpath("$fig_dir/$enc");
Code
begin
    psp_df = load(enc, "PSP"; dataset="Parker Solar Probe")
    thm_df = load(enc, "THEMIS"; dataset="ARTEMIS")
    solo_df = load(enc, "Solo"; dataset="Solar Orbiter")
    wind_df = load(enc, "Wind")
end;
┌ Info: Electron temperature columns not found
└ @ Main /Users/zijin/projects/psp_conjunction/src/io.jl:61
┌ Info: Ion temperature columns not found
└ @ Main /Users/zijin/projects/psp_conjunction/src/io.jl:53
┌ Info: Electron temperature columns not found
└ @ Main /Users/zijin/projects/psp_conjunction/src/io.jl:61
┌ Info: Ion temperature columns not found
└ @ Main /Users/zijin/projects/psp_conjunction/src/io.jl:53
┌ Info: Electron temperature columns not found
└ @ Main /Users/zijin/projects/psp_conjunction/src/io.jl:61
┌ Info: Ion temperature columns not found
└ @ Main /Users/zijin/projects/psp_conjunction/src/io.jl:53
┌ Info: Electron temperature columns not found
└ @ Main /Users/zijin/projects/psp_conjunction/src/io.jl:61
Code
# select the time range of interest "2021-04-29T00:45" to "2021-04-29T01:15"
function subset_timerange(df, start_time)
    return subset(df, :time => t -> t .> DateTime(start_time))
end

function subset_timerange(df, start_time, end_time)
    return subset(
        subset_timerange(df, start_time),
        :time => t -> t .< DateTime(end_time)
    )
end
subset_timerange (generic function with 2 methods)
Code
function plot_dist_comp(
    df1, df2;
    figure_kwargs=(size=(800, 600),)
)

    df = reduce(vcat, [df1, df2], cols=:intersect)
    data_layer = data(df) * mapping(color=ds_mapping, marker=ds_mapping)

    maps = [l_log_map j_log_map
        l_norm_log_map j_norm_log_map]

    plot_dist(data_layer; maps, axis=(), visual=mapping(), figure_kwargs=figure_kwargs)
end

function plot_dist_comp(df1, df2, tr1, tr2)
    df1 = subset_timerange(df1, tr1...)
    df2 = subset_timerange(df2, tr2...)
    @info "Number of data points in df1: $(nrow(df1))"
    @info "Number of data points in df2: $(nrow(df2))"
    plot_dist_comp(df1, df2)
end
plot_dist_comp (generic function with 2 methods)
Code
plot_dist_comp(psp_df, solo_df)
Code
DateTime("2021-04-29T00:45") + Hour(145)
DateTime("2021-04-29T00:45") + Hour(-1)
2021-04-28T23:45:00
Code
f1 = plot_dist_comp(psp_df, solo_df,
    ["2021-04-29T00:15", "2021-04-29T02:15"],
    ["2021-05-04T17:45:00", "2021-05-04T19:45:00"]
)
f2 = plot_dist_comp(psp_df, solo_df,
    ["2021-04-28T00:15", "2021-04-29T02:15"],
    ["2021-05-03T17:45:00", "2021-05-04T19:45:00"]
)

f3 = plot_dist_comp(psp_df, solo_df,
    ["2021-04-28T00:15", "2021-04-29T02:15"],
    ["2021-05-04T17:45:00", "2021-05-05T19:45:00"]
)
display(f1)
display(f2)
display(f3);
┌ Info: Number of data points in df1: 29
└ @ Main /Users/zijin/projects/psp_conjunction/notebooks/jl_notebook_cell_df34fa98e69747e1a8f8a730347b8e2f_X50sZmlsZQ==.jl:18
┌ Info: Number of data points in df2: 8
└ @ Main /Users/zijin/projects/psp_conjunction/notebooks/jl_notebook_cell_df34fa98e69747e1a8f8a730347b8e2f_X50sZmlsZQ==.jl:19
┌ Info: Number of data points in df1: 131
└ @ Main /Users/zijin/projects/psp_conjunction/notebooks/jl_notebook_cell_df34fa98e69747e1a8f8a730347b8e2f_X50sZmlsZQ==.jl:18
┌ Info: Number of data points in df2: 80
└ @ Main /Users/zijin/projects/psp_conjunction/notebooks/jl_notebook_cell_df34fa98e69747e1a8f8a730347b8e2f_X50sZmlsZQ==.jl:19
┌ Info: Number of data points in df1: 131
└ @ Main /Users/zijin/projects/psp_conjunction/notebooks/jl_notebook_cell_df34fa98e69747e1a8f8a730347b8e2f_X50sZmlsZQ==.jl:18
┌ Info: Number of data points in df2: 133
└ @ Main /Users/zijin/projects/psp_conjunction/notebooks/jl_notebook_cell_df34fa98e69747e1a8f8a730347b8e2f_X50sZmlsZQ==.jl:19
Code
begin
    df = reduce(
        vcat,
        [psp_df, thm_df, wind_df, solo_df],
        cols=:intersect
    )
    levels!(df.dataset, ds_order)

    earth_df = reduce(
        vcat,
        [thm_df, wind_df],
        cols=:intersect
    )
end;
Code
begin
    # base data layer
    data_layer = data(df) * mapping(color=ds_mapping, marker=ds_mapping)

    # data layer with different alpha
    data_layer_a = (
        (data(thm_df) + data(wind_df)) * visual(alpha=0.3) + data(psp_df) * visual(alpha=1)
    ) * mapping(
        color=ds_mapping, marker=ds_mapping
    )

    # data layer with 1au missions
    data_layer_b = (
        (data(wind_df) + data(thm_df))
    ) * mapping(
        color=:dataset, marker=:dataset
    )
end;

Discontinuities’ properties

Code
# plot the density distribution of the thickness and current density
begin
    fname = "properties_distribution"

    maps = [l_log_map j_log_map
        l_norm_log_map j_norm_log_map]
    figure_kwargs = (size=(800, 600),)
    
    plot_dist(data_layer; maps, axis=(), visual=mapping(), figure_kwargs=figure_kwargs)
    easy_save(fname) 
end
┌ Info: Saved /Users/zijin/projects/psp_conjunction/figures/enc8/properties_distribution.svg
└ @ Beforerr /Users/zijin/.julia/dev/Beforerr/src/utils/makie.jl:45
Code
function plot_l_j_local_comp(df)
    fig = Figure(size=(1000, 800))

    data_layer = data(df) * mapping(col=:dataset)

    facet = (; linkxaxes=:none, linkyaxes=:none)
    # Thickness Panels
    begin
        plt = data_layer * mapping(di_log_map, l_log_map)
        axis = (;)
        draw!(fig[1, 1:3], plt, axis=axis, facet=facet)
    end

    # Current Density Panels
    begin
        plt = data_layer * mapping(jA_log_map, j_log_map)
        axis = (;)
        draw!(fig[2, 1:3], plt, axis=axis, facet=facet)
    end

    fig
end

df |> plot_l_j_local_comp
Code
begin
    fname = "thickness_current"

    plt = data_layer_a * visual(Scatter)

    fig = Figure(size=(1000, 500))
    axis = log_axis

    ga = fig[1, 1]
    gb = fig[1, 2]

    grid1 = plt * mapping(l_map, j_map) |> draw!(ga; axis=axis)
    grid2 = plt * mapping(l_norm_map, j_norm_map) |> draw!(gb; axis=axis)

    pretty_legend!(fig, grid1)
    add_labels!([ga, gb])
    easy_save(fname)
end
┌ Info: Saved /Users/zijin/projects/psp_conjunction/figures/enc7/thickness_current.pdf
└ @ Beforerr /Users/zijin/.julia/dev/Beforerr/src/utils/makie.jl:48

ggscatterhist can not handle log scale well

Code
axis = (limits=((-0.5, 0.5), (-0.5, 0.5)),)

begin
    fname = "dn-dB"
    plt = data_layer_a * mapping(dn_over_n, dB_over_B) * (AlgebraOfGraphics.linear() + visual(Scatter))
    fg = draw(plt, axis=axis)
    easy_save(fname)
end
┌ Info: Saved /Users/zijin/projects/psp_conjunction/figures/enc7/dn-dB.pdf
└ @ Beforerr /Users/zijin/.julia/dev/Beforerr/src/utils/makie.jl:48
Figure 1
Code
begin
    fname = "dn-dT"
    plt = data_layer_a * mapping(dT_over_T, dn_over_n) * (mapping())

    fig = Figure(size=(1000, 500))
    grid1 = plt |> draw!(fig[1, 1])
    grid2 = plt |> draw!(fig[1, 2]; axis=(; limits=((-0.5, 0.5), (-0.5, 0.5))))

    pretty_legend!(fig, grid1)
    easy_save(fname)

    fig
end
ArgumentError: ArgumentError: column name "T.change" not found in the data frame; existing most similar names are: "B.change" and "n.change"
ArgumentError: column name "T.change" not found in the data frame; existing most similar names are: "B.change" and "n.change"



Stacktrace:

  [1] lookupname

    @ ~/.julia/packages/DataFrames/58MUJ/src/other/index.jl:416 [inlined]

  [2] getindex

    @ ~/.julia/packages/DataFrames/58MUJ/src/other/index.jl:422 [inlined]

  [3] getindex(df::DataFrame, ::typeof(!), col_ind::Symbol)

    @ DataFrames ~/.julia/packages/DataFrames/58MUJ/src/dataframe/dataframe.jl:557

  [4] getcolumn

    @ ~/.julia/packages/DataFrames/58MUJ/src/other/tables.jl:28 [inlined]

  [5] getcolumn

    @ ~/.julia/packages/DataFrames/58MUJ/src/other/tables.jl:109 [inlined]

  [6] select(data::DataFrames.DataFrameColumns{DataFrame}, name::String)

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/select.jl:16

  [7] #133

    @ ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/select.jl:48 [inlined]

  [8] map

    @ ./tuple.jl:292 [inlined]

  [9] select(data::DataFrames.DataFrameColumns{DataFrame}, x::Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}})

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/select.jl:48

 [10] (::AlgebraOfGraphics.var"#153#156"{DataFrames.DataFrameColumns{DataFrame}})(s::Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}})

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/processing.jl:77

 [11] iterate

    @ ./generator.jl:47 [inlined]

 [12] _collect(c::Array{Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}}, 0}, itr::Base.Generator{Array{Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}}, 0}, AlgebraOfGraphics.var"#153#156"{DataFrames.DataFrameColumns{DataFrame}}}, ::Base.EltypeUnknown, isz::Base.HasShape{0})

    @ Base ./array.jl:854

 [13] collect_similar(cont::Array{Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}}, 0}, itr::Base.Generator{Array{Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}}, 0}, AlgebraOfGraphics.var"#153#156"{DataFrames.DataFrameColumns{DataFrame}}})

    @ Base ./array.jl:763

 [14] map(f::Function, A::Array{Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}}, 0})

    @ Base ./abstractarray.jl:3285

 [15] getlabeledarray(layer::Layer, s::Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}})

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/processing.jl:76

 [16] (::AlgebraOfGraphics.var"#157#159"{Layer})(v::Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}})

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/processing.jl:92

 [17] iterate

    @ ./generator.jl:47 [inlined]

 [18] _collect(c::Vector{Any}, itr::Base.Generator{Vector{Any}, AlgebraOfGraphics.var"#157#159"{Layer}}, ::Base.EltypeUnknown, isz::Base.HasShape{1})

    @ Base ./array.jl:854

 [19] collect_similar

    @ ./array.jl:763 [inlined]

 [20] map

    @ ./abstractarray.jl:3285 [inlined]

 [21] process_mappings(layer::Layer)

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/processing.jl:92

 [22] process(layer::Layer)

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/processing.jl:99

 [23] iterate

    @ ./generator.jl:47 [inlined]

 [24] collect_to!(dest::Vector{ProcessedLayer}, itr::Base.Generator{Layers, typeof(AlgebraOfGraphics.process)}, offs::Int64, st::Int64)

    @ Base ./array.jl:892

 [25] collect_to_with_first!(dest::Vector{ProcessedLayer}, v1::ProcessedLayer, itr::Base.Generator{Layers, typeof(AlgebraOfGraphics.process)}, st::Int64)

    @ Base ./array.jl:870

 [26] collect(itr::Base.Generator{Layers, typeof(AlgebraOfGraphics.process)})

    @ Base ./array.jl:844

 [27] map

    @ ./abstractarray.jl:3313 [inlined]

 [28] ProcessedLayers(a::Layers)

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/layers.jl:41

 [29] compute_axes_grid(d::Layers; axis::@NamedTuple{}, palettes::@NamedTuple{})

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/layers.jl:114

 [30] compute_axes_grid

    @ ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/layers.jl:110 [inlined]

 [31] compute_axes_grid(fig::GridPosition, d::Layers; axis::@NamedTuple{}, palettes::@NamedTuple{})

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/layers.jl:100

 [32] compute_axes_grid

    @ ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/layers.jl:97 [inlined]

 [33] #245

    @ ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/draw.jl:21 [inlined]

 [34] update

    @ ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/draw.jl:10 [inlined]

 [35] plot!(fig::GridPosition, d::Layers; axis::@NamedTuple{}, palettes::@NamedTuple{})

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/draw.jl:21

 [36] plot!

    @ ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/draw.jl:16 [inlined]

 [37] (::AlgebraOfGraphics.var"#252#253"{@NamedTuple{}, @NamedTuple{}, @NamedTuple{}, Layers})(f::GridPosition)

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/draw.jl:71

 [38] update

    @ ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/draw.jl:10 [inlined]

 [39] #draw!#251

    @ ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/draw.jl:70 [inlined]

 [40] draw!

    @ ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/draw.jl:68 [inlined]

 [41] #149

    @ ~/projects/psp_conjunction/notebooks/utils/plot.jl:43 [inlined]

 [42] |>(x::Layers, f::var"#149#150"{@NamedTuple{}, @NamedTuple{}, GridPosition})

    @ Base ./operators.jl:917

 [43] top-level scope

    @ ~/projects/psp_conjunction/notebooks/10_results.ipynb:8
Figure 2
Code
begin
    fname = "dT-dB"
    plt = data_layer_a * mapping(dT_over_T, dB_over_B) * (linear() + mapping())

    fig = Figure(size=(1000, 500))
    grid = draw!(fig[1, 1], plt)
    draw!(fig[1, 2], plt, axis=(; limits=((-0.5, 0.5), (-0.5, 0.5))))
    
    pretty_legend!(fig, grid1)
    easy_save(fname)

    fig
end
ArgumentError: ArgumentError: column name "T.change" not found in the data frame; existing most similar names are: "B.change" and "n.change"
ArgumentError: column name "T.change" not found in the data frame; existing most similar names are: "B.change" and "n.change"



Stacktrace:

  [1] lookupname

    @ ~/.julia/packages/DataFrames/58MUJ/src/other/index.jl:416 [inlined]

  [2] getindex

    @ ~/.julia/packages/DataFrames/58MUJ/src/other/index.jl:422 [inlined]

  [3] getindex(df::DataFrame, ::typeof(!), col_ind::Symbol)

    @ DataFrames ~/.julia/packages/DataFrames/58MUJ/src/dataframe/dataframe.jl:557

  [4] getcolumn

    @ ~/.julia/packages/DataFrames/58MUJ/src/other/tables.jl:28 [inlined]

  [5] getcolumn

    @ ~/.julia/packages/DataFrames/58MUJ/src/other/tables.jl:109 [inlined]

  [6] select(data::DataFrames.DataFrameColumns{DataFrame}, name::String)

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/select.jl:16

  [7] #133

    @ ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/select.jl:48 [inlined]

  [8] map

    @ ./tuple.jl:292 [inlined]

  [9] select(data::DataFrames.DataFrameColumns{DataFrame}, x::Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}})

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/select.jl:48

 [10] (::AlgebraOfGraphics.var"#153#156"{DataFrames.DataFrameColumns{DataFrame}})(s::Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}})

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/processing.jl:77

 [11] iterate

    @ ./generator.jl:47 [inlined]

 [12] _collect(c::Array{Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}}, 0}, itr::Base.Generator{Array{Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}}, 0}, AlgebraOfGraphics.var"#153#156"{DataFrames.DataFrameColumns{DataFrame}}}, ::Base.EltypeUnknown, isz::Base.HasShape{0})

    @ Base ./array.jl:854

 [13] collect_similar(cont::Array{Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}}, 0}, itr::Base.Generator{Array{Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}}, 0}, AlgebraOfGraphics.var"#153#156"{DataFrames.DataFrameColumns{DataFrame}}})

    @ Base ./array.jl:763

 [14] map(f::Function, A::Array{Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}}, 0})

    @ Base ./abstractarray.jl:3285

 [15] getlabeledarray(layer::Layer, s::Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}})

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/processing.jl:76

 [16] (::AlgebraOfGraphics.var"#157#159"{Layer})(v::Pair{Tuple{String, String}, Pair{typeof(/), LaTeXString}})

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/processing.jl:92

 [17] iterate

    @ ./generator.jl:47 [inlined]

 [18] _collect(c::Vector{Any}, itr::Base.Generator{Vector{Any}, AlgebraOfGraphics.var"#157#159"{Layer}}, ::Base.EltypeUnknown, isz::Base.HasShape{1})

    @ Base ./array.jl:854

 [19] collect_similar

    @ ./array.jl:763 [inlined]

 [20] map

    @ ./abstractarray.jl:3285 [inlined]

 [21] process_mappings(layer::Layer)

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/processing.jl:92

 [22] process(layer::Layer)

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/processing.jl:99

 [23] iterate

    @ ./generator.jl:47 [inlined]

 [24] collect_to!(dest::Vector{ProcessedLayer}, itr::Base.Generator{Layers, typeof(AlgebraOfGraphics.process)}, offs::Int64, st::Int64)

    @ Base ./array.jl:892

 [25] collect_to_with_first!(dest::Vector{ProcessedLayer}, v1::ProcessedLayer, itr::Base.Generator{Layers, typeof(AlgebraOfGraphics.process)}, st::Int64)

    @ Base ./array.jl:870

 [26] collect(itr::Base.Generator{Layers, typeof(AlgebraOfGraphics.process)})

    @ Base ./array.jl:844

 [27] map

    @ ./abstractarray.jl:3313 [inlined]

 [28] ProcessedLayers(a::Layers)

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/layers.jl:41

 [29] compute_axes_grid(d::Layers; axis::@NamedTuple{}, palettes::@NamedTuple{})

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/layers.jl:114

 [30] compute_axes_grid

    @ ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/layers.jl:110 [inlined]

 [31] compute_axes_grid(fig::GridPosition, d::Layers; axis::@NamedTuple{}, palettes::@NamedTuple{})

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/layers.jl:100

 [32] compute_axes_grid

    @ ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/algebra/layers.jl:97 [inlined]

 [33] #245

    @ ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/draw.jl:21 [inlined]

 [34] update

    @ ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/draw.jl:10 [inlined]

 [35] plot!(fig::GridPosition, d::Layers; axis::@NamedTuple{}, palettes::@NamedTuple{})

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/draw.jl:21

 [36] plot!

    @ ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/draw.jl:16 [inlined]

 [37] (::AlgebraOfGraphics.var"#252#253"{@NamedTuple{}, @NamedTuple{}, @NamedTuple{}, Layers})(f::GridPosition)

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/draw.jl:71

 [38] update

    @ ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/draw.jl:10 [inlined]

 [39] #draw!#251

    @ ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/draw.jl:70 [inlined]

 [40] draw!(fig::GridPosition, d::Layers)

    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/MqbNU/src/draw.jl:68

 [41] top-level scope

    @ ~/projects/psp_conjunction/notebooks/10_results.ipynb:8
Figure 3
Code
ω_map = :rotation_angle => "rotation angle (deg)";
v_l_ratio_map = :v_l_ratio => L"Δ V_{ion,l} / Δ V_{A,l}"
plt = data(psp_df) * mapping(ω_map, v_l_ratio_map) * (linear() + visual(Scatter))
draw(plt)

Alfvenicity

Comparison of change in Alfven speed and plasma speed

The distinguishing feature of rotational discontinuities is the plasma velocity jump across them: the plasma flow velocity \(v_l\) (the solar wind velocity projected onto l) changes due to changes in \(B_l\), \(Δv_l=±Δv_A\) with \(v_A= B_l / \sqrt{4 n m}\) (Landau & Lifshitz 1960; Hudson 1970).

Code
fig = plot_dvl(psp_df)
┌ Info: Saved /Users/zijin/projects/psp_conjunction/figures/enc7/dvl.svg
└ @ Beforerr /Users/zijin/.julia/dev/Beforerr/src/utils/makie.jl:45
Figure 4
Code
plot_vl_ratio(df)
┌ Info: Saved /Users/zijin/projects/psp_conjunction/figures/enc7/vl_ratio.pdf
└ @ Beforerr /Users/zijin/.julia/dev/Beforerr/src/utils/makie.jl:48
┌ Info: Saved /Users/zijin/projects/psp_conjunction/figures/enc7/vl_ratio.png
└ @ Beforerr /Users/zijin/.julia/dev/Beforerr/src/utils/makie.jl:48
Code
vl_ratio_label = L"\Delta V_{i,l} / \Delta V_{A,l}"
v_l_fit_ratio_map = "v_l_fit_ratio" => vl_ratio_label

plot_vl_ratio(psp_df; mapping_args=(v_l_fit_ratio_map,), fname=missing)
Code
v_l_fit_ratio_map = "v_l_ratio.fit.Λ_ion" => vl_ratio_label

plot_vl_ratio(psp_df; mapping_args=(v_l_fit_ratio_map,), fname=missing)

Anistropy

Shen et al. (2024)

Code
plot_anistropy_comparison_2d(psp_df)
┌ Info: Saved /Users/zijin/projects/psp_conjunction/figures/enc7/anisotropy_comparison_2d.pdf
└ @ Beforerr /Users/zijin/.julia/dev/Beforerr/src/utils/makie.jl:48
┌ Info: Saved /Users/zijin/projects/psp_conjunction/figures/enc7/anisotropy_comparison_2d.png
└ @ Beforerr /Users/zijin/.julia/dev/Beforerr/src/utils/makie.jl:48
Code
psp_df.Λ_ion_r = abs.(psp_df.Λ_ion ./ psp_df.Λ_t .- 1)
first(sort(psp_df, :Λ_ion_r), 4)
4×91 DataFrame
Row time tstart tstop t.d_end t.d_start t.d_time index_diff len std std_prev std_next index_std index_fluctuation B.after B.before b_mag b_n bn_over_b d_star db_mag db_over_b db_over_b_max fit.stat.chisqr fit.stat.rsquared fit.vars.amplitude fit.vars.c fit.vars.sigma rotation_angle dB_x dB_y dB_z dB_lmn_x dB_lmn_y dB_lmn_z k_x k_y k_z Vl_x Vl_y Vl_z Vn_x Vn_y Vn_z duration plasma_density v_R v_T v_N n.before v_R_before v_T_before v_N_before n.after v_R_after v_T_after v_N_after v_l v_n v_k L_k j0_k ion_inertial_length Alfven_speed j_Alfven L_k_norm j0_k_norm v.ion.before.l v.ion.after.l B.vec.before.l B.vec.before.m B.vec.before.n B.vec.after.l B.vec.after.m B.vec.after.n v.Alfven.before v.Alfven.after v.Alfven.before.l v.Alfven.after.l n.change v.ion.change.l B.change v.Alfven.change v.Alfven.change.l ion_temp_para ion_temp_perp Λ_ion dataset B.mean n.mean Λ_t Λ_ion_r
DateTime DateTime DateTime DateTime DateTime DateTime Float64 UInt32 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float32 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float32 Float64 Float64 Float64 Float32 Float64 Float64 Float64 Float32 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float32 Float64 Float64 Float64 Float64 Float32 Float32 Float64 String Float64 Float32 Float64 Float64
1 2021-01-17T13:23:04 2021-01-17T13:22:56 2021-01-17T13:23:12 2021-01-17T13:23:11.442 2021-01-17T13:22:59.208 2021-01-17T13:23:05.131 0.648186 73 26.5526 10.7862 9.1192 2.46173 1.16665 101.789 44.0335 75.0677 2.27744 0.0303385 35.13 57.7554 0.769377 0.769377 2166.56 0.936807 50.5067 3.45086 0.359427 38.8267 55.2233 -46.3511 10.8783 -64.0992 -34.7455 -0.648997 0.0884341 -0.12652 -0.988014 0.357252 -0.921461 0.152579 -0.0675537 0.13744 0.988204 0.718854 2732.35 381.362 -138.215 3.01064 2762.37 379.928 -140.686 3.44903 2693.38 377.506 -133.004 0.147888 264.061 41.7835 48.2377 34.6759 579.538 4.35666 31.3158 13709.1 7.95929 0.0422739 265.893 257.445 0.353517 44.0201 1.0304 64.4527 78.7656 1.6794 18.2693 42.7691 0.146672 27.0814 -68.9861 8.44747 57.7554 24.4998 26.9347 64.687 57.5403 0.73955 Parker Solar Probe 72.9112 2727.87 0.901638 0.179771
2 2021-01-17T14:00:48 2021-01-17T14:00:40 2021-01-17T14:00:56 2021-01-17T14:00:53.754 2021-01-17T14:00:47.855 2021-01-17T14:00:47.086 0.361529 73 31.854 15.1253 6.79863 2.106 1.44077 136.929 218.531 155.794 -5.14073 -0.0329971 12.1512 -81.6016 0.52378 0.52378 3746.21 0.592843 115.799 -239.374 2.38247 7.16678 80.6002 -3.1367 24.9029 -84.416 -0.564816 -0.0287437 -0.166979 0.75391 0.635404 0.953005 -0.0410342 0.300163 -0.128284 0.842916 0.522529 4.76494 3863.79 394.834 -209.22 91.757 3787.03 386.74 -202.149 83.7244 3771.57 370.53 -189.192 63.788 412.406 179.06 165.359 787.925 58.4764 3.66366 54.6539 33833.3 215.065 0.00172837 401.991 380.027 -213.71 -45.1632 -6.63765 -129.294 -44.5984 -6.60891 77.4356 48.6197 -75.7273 -45.9086 -15.4636 21.9645 -81.6016 -28.8159 29.8187 62.6138 39.6508 0.565511 Parker Solar Probe 177.73 3779.3 0.45742 0.236305
3 2021-01-17T14:04:16 2021-01-17T14:04:08 2021-01-17T14:04:24 2021-01-17T14:04:21.940 2021-01-17T14:04:13.421 2021-01-17T14:04:17.681 0.929971 73 41.46 17.2032 14.9907 2.41002 1.25386 117.341 19.9397 95.0441 -10.1505 -0.106798 -27.2953 97.4013 1.0248 1.0248 37673.6 0.0644105 -132.883 0.828218 1.21708 140.995 130.362 28.4358 0.136201 132.883 10.212 6.38537 0.164659 -0.75789 0.631261 -0.968391 -0.233127 -0.0887121 -0.249287 0.916793 0.312005 2.43417 3671.34 347.46 -127.721 -19.1184 3696.02 346.453 -129.023 -16.8507 3632.13 345.098 -126.874 -11.6083 -305.006 209.676 141.942 345.511 153.027 3.75845 34.2051 20119.9 91.929 0.00760574 -303.929 -303.582 17.4386 -4.63218 -8.4872 -115.444 -14.8442 -14.8726 7.15205 42.4568 6.25492 -41.7705 -63.8911 0.346474 97.4013 35.3048 48.0254 52.4148 47.751 0.731686 Parker Solar Probe 68.6404 3664.07 0.999948 0.268276
4 2021-01-17T14:02:56 2021-01-17T14:02:48 2021-01-17T14:03:04 2021-01-17T14:03:02.860 2021-01-17T14:02:49.097 2021-01-17T14:02:58.196 1.05036 74 55.3271 9.25356 17.6372 3.13695 3.12493 52.3503 174.84 129.15 -5.41188 -0.0419039 21.6793 -122.489 0.948429 0.948429 2701.74 0.983496 150.598 -163.784 1.73666 51.8655 131.82 38.9729 55.7669 -148.222 -3.76153 -4.6396 -0.101562 0.912044 -0.397316 0.894607 0.285819 0.34349 0.167674 -0.927232 0.334853 3.47331 3460.77 327.214 -132.42 -14.7218 3415.25 321.447 -133.69 -18.1395 3575.76 352.967 -131.117 -14.4198 249.823 172.719 148.156 514.592 116.444 3.87111 47.8724 26544.1 132.931 0.00438681 243.127 273.338 -168.928 44.0778 -9.45836 -20.7057 47.8393 -4.81877 65.2389 19.0903 -63.033 -7.55065 160.513 30.2113 -122.489 -46.1486 55.4823 63.3292 46.3322 0.9178 Parker Solar Probe 113.595 3495.51 0.703496 0.304626
Code
plot_anistropy(df)
┌ Info: Saved /Users/zijin/projects/psp_conjunction/notebooks/figures/anisotropy.spi_n_spi.png
└ @ beforerr /Users/zijin/.julia/dev/beforerr.jl/src/utils/makie.jl:34
Code
plot_anistropy_theory(df)
┌ Info: Saved /Users/zijin/projects/psp_conjunction/figures/enc7/anisotropy_theory.png
└ @ beforerr /Users/zijin/.julia/dev/beforerr.jl/src/utils/makie.jl:34
Figure 5
Code
function plot_anistropy_comparison()
    fname = "anisotropy_comparison"

    fig = Figure(size=(1000, 800))

    plt_Λ = data(
        stack(earth_df, [:Λ, :Λ_t, :Λ_ion, :Λ_e], [:time, :dataset])
    ) * mapping(:value => L"\Lambda", color=:variable, marker=:variable, col=:dataset)

    grid1 = plt_Λ * density() |> draw!$fig[1, 1:2]
    grid2 = plt_Λ * histogram() |> draw!$fig[2, 1:2]
    # easy_save("$(fname)_$psp_p_instr")
    # legend!(fig[1, 1:2], grid, titleposition=:left, orientation=:horizontal)
    pretty_legend!(fig, grid1)

    fig
end

function plot_anistropy_comparison_i_e()
    fname = "anisotropy_comparison_i_e"

    mapping_layer = mapping(
        Λ_e_map, Λ_ion_map,
    )

    # draw a dashed line with slope 1
    df2 = (Λ_e=[0, 0.3], Λ_ion=[0, 0.3])

    plt = (data(earth_df) * mapping(row=:dataset) + data(df2) * visual(Lines)) * mapping_layer

    fig = draw(plt, facet=(; linkxaxes=:minimal, linkyaxes=:minimal))
    fig
end
plot_anistropy_comparison_i_e (generic function with 1 method)
Code
plot_anistropy_comparison()
Figure 6
Code
plot_anistropy_comparison_2d()
MethodError: MethodError: no method matching plot_anistropy_comparison_2d()

Closest candidates are:
  plot_anistropy_comparison_2d(!Matched::Any)
   @ Main ~/projects/psp_conjunction/notebooks/utils/anisotry.jl:11

MethodError: no method matching plot_anistropy_comparison_2d()



Closest candidates are:

  plot_anistropy_comparison_2d(!Matched::Any)

   @ Main ~/projects/psp_conjunction/notebooks/utils/anisotry.jl:11





Stacktrace:

 [1] top-level scope

   @ ~/projects/psp_conjunction/notebooks/10_results.ipynb:3
Figure 7
Code
plot_anistropy_comparison_i_e()
Figure 8

References

Shen, Yangyang, Anton Artemyev, Vassilis Angelopoulos, Terry Z. Liu, and Ivan Vasko. 2024. “Comparing Plasma Anisotropy Associated with Solar Wind Discontinuities and Alfvénic Fluctuations.” The Astrophysical Journal 961 (1): 41. https://doi.org/10.3847/1538-4357/ad110b.