-
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.
* Add some @view * Add Makie support as an extension * Add tests for PyPlot, Plots, and Makie
- Loading branch information
1 parent
4efa0d5
commit cfcec4b
Showing
14 changed files
with
261 additions
and
217 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 = "Batsrus" | ||
uuid = "e74ebddf-6ac1-4047-a0e5-c32c99e57753" | ||
authors = ["Hongyang Zhou <[email protected]>"] | ||
version = "0.3.11" | ||
version = "0.4.0" | ||
|
||
[deps] | ||
Dierckx = "39dd38d3-220a-591b-8e3c-4c3a8c710a94" | ||
|
@@ -15,6 +15,12 @@ Requires = "ae029012-a4dd-5104-9daa-d747884805df" | |
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" | ||
WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192" | ||
|
||
[weakdeps] | ||
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" | ||
|
||
[extensions] | ||
BatsrusMakieExt = "Makie" | ||
|
||
[compat] | ||
Dierckx = "0.5" | ||
FortranFiles = "0.6" | ||
|
@@ -25,12 +31,4 @@ RecipesBase = "1.1" | |
Requires = "1.1" | ||
Unitful = "1.7" | ||
WriteVTK = "1.9" | ||
julia = "1.6" | ||
|
||
[extras] | ||
LazyArtifacts = "4af54fe1-eca0-43a8-85a7-787d91b784e3" | ||
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[targets] | ||
test = ["Test", "LazyArtifacts", "SHA"] | ||
julia = "1.6" |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module BatsrusMakieExt | ||
|
||
using Batsrus, Printf | ||
import Batsrus: findindex, hasunit, getunit, getdata | ||
import Batsrus.UnitfulBatsrus | ||
import Makie | ||
|
||
include("typerecipe.jl") | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Type conversion from Batsrus to Makie | ||
|
||
"Conversion for 1D plots" | ||
function Makie.convert_arguments(P::Makie.PointBased, bd::BATLData, var::String) | ||
var_ = findindex(bd, var) | ||
if hasunit(bd) | ||
unitx = getunit(bd, bd.head.variables[1]) | ||
unitw = getunit(bd, var) | ||
x = bd.x .* unitx | ||
y = bd.w[:,var_] .* unitw | ||
else | ||
x = bd.x | ||
y = bd.w[:,var_] | ||
end | ||
|
||
([Makie.Point2f(i, j) for (i, j) in zip(x, y)],) | ||
end | ||
|
||
"Conversion for 2D plots." | ||
function Makie.convert_arguments(P::Makie.SurfaceLike, bd::BATLData, var::String; | ||
plotrange=[-Inf,Inf,-Inf,Inf], plotinterval=0.1) | ||
x, y, w = getdata(bd, var, plotrange, plotinterval) | ||
|
||
unitx = getunit(bd, bd.head.variables[1]) | ||
unity = getunit(bd, bd.head.variables[2]) | ||
unitw = getunit(bd, var) | ||
|
||
if unitx isa UnitfulBatsrus.Unitlike | ||
x *= unitx | ||
y *= unity | ||
w *= unitw | ||
end | ||
|
||
(x, y, w) | ||
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.