Skip to content

Commit

Permalink
Cleanup 7 (#102)
Browse files Browse the repository at this point in the history
* Just corrected a message

* Remove `ENABLE_JLD`

* Update shape.jl

Remove `load_shape_jld` and `save_shape_jld`

* Update Project.toml

* Update .gitignore

* Remove JLD-related code
  • Loading branch information
MasanoriKanamaru authored Nov 22, 2023
1 parent 7f2dfc6 commit b7cd460
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 50 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

/test/kernel
/test/shape/*.obj
/test/shape/*.jld2
/test/*.jld2

/test/TPM_Ryugu
/test/non-uniform_thermoparams
Expand Down
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ version = "0.0.6-DEV"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
SPICE = "5bab7191-041a-5c2e-a744-024b9c3a5062"
Expand All @@ -21,7 +20,6 @@ DataFrames = "1"
Downloads = "1"
FileIO = "1"
Git = "1"
JLD2 = "0.4"
LinearAlgebra = "1"
ProgressMeter = "1"
Rotations = "1"
Expand Down
1 change: 0 additions & 1 deletion src/AsteroidThermoPhysicalModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ using DataFrames
using ProgressMeter

using FileIO
using JLD2
using CSV


Expand Down
9 changes: 0 additions & 9 deletions src/shape.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,6 @@ function load_shape_obj(shapepath; scale=1.0, find_visible_facets=false)
return shape
end

function load_shape_jld(shapepath)
shape = load(shapepath, "shape")
return shape
end

function save_shape_jld(shapepath, shape)
save(splitext(shapepath)[1] * ".jld2", Dict("shape" => shape))
end


################################################################
# Create a shape model from grid
Expand Down
18 changes: 3 additions & 15 deletions test/TPM_Didymos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,9 @@
##= Load the shape models =##
path_shape1_obj = joinpath("shape", "g_50677mm_rad_obj_didy_0000n00000_v001.obj")
path_shape2_obj = joinpath("shape", "g_08438mm_lgt_obj_dimo_0000n00000_v002.obj")
path_shape1_jld = joinpath("shape", "g_50677mm_rad_obj_didy_0000n00000_v001.jld2")
path_shape2_jld = joinpath("shape", "g_08438mm_lgt_obj_dimo_0000n00000_v002.jld2")

if isfile(path_shape1_jld) && ENABLE_JLD
shape1 = AsteroidThermoPhysicalModels.load_shape_jld(path_shape1_jld)
else
shape1 = AsteroidThermoPhysicalModels.load_shape_obj(path_shape1_obj; scale=1000, find_visible_facets=true)
AsteroidThermoPhysicalModels.save_shape_jld(path_shape1_jld, shape1)
end
if isfile(path_shape2_jld) && ENABLE_JLD
shape2 = AsteroidThermoPhysicalModels.load_shape_jld(path_shape2_jld)
else
shape2 = AsteroidThermoPhysicalModels.load_shape_obj(path_shape2_obj; scale=1000, find_visible_facets=true)
AsteroidThermoPhysicalModels.save_shape_jld(path_shape2_jld, shape2)
end

shape1 = AsteroidThermoPhysicalModels.load_shape_obj(path_shape1_obj; scale=1000, find_visible_facets=true)
shape2 = AsteroidThermoPhysicalModels.load_shape_obj(path_shape2_obj; scale=1000, find_visible_facets=true)

##= Thermal properties =##
k = 0.125
Expand Down
12 changes: 3 additions & 9 deletions test/TPM_Ryugu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,10 @@
SPICE.kclear()

##= Load obj file =##
path_obj = joinpath("shape", "ryugu_test.obj") # Small model for test
path_jld = joinpath("shape", "ryugu_test.jld2") # Small model for test
path_obj = joinpath("shape", "ryugu_test.obj") # Small model for test
# path_obj = joinpath("shape", "SHAPE_SFM_49k_v20180804.obj")
# path_jld = joinpath("shape", "SHAPE_SFM_49k_v20180804.jld2")
if isfile(path_jld) && ENABLE_JLD
shape = AsteroidThermoPhysicalModels.load_shape_jld(path_jld)
else
shape = AsteroidThermoPhysicalModels.load_shape_obj(path_obj; scale=1000, find_visible_facets=true)
AsteroidThermoPhysicalModels.save_shape_jld(path_jld, shape)
end

shape = AsteroidThermoPhysicalModels.load_shape_obj(path_obj; scale=1000, find_visible_facets=true)

##= Thermal properties =##
k = 0.1
Expand Down
2 changes: 1 addition & 1 deletion test/find_visiblefacets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
xs, ys, zs = AsteroidThermoPhysicalModels.concave_spherical_segment(0.4, 0.2; Nx=2^5, Ny=2^5, xc=0.5, yc=0.5)
shape = AsteroidThermoPhysicalModels.load_shape_grid(xs, ys, zs; scale=1.0, find_visible_facets=true)

println(length(shape.visiblefacets[992]), " faces are visible from the crater center:")
println("Number of faces visible from the crater center: ", length(shape.visiblefacets[992]))
println()
end
12 changes: 3 additions & 9 deletions test/non-uniform_thermoparams.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,10 @@
SPICE.kclear()

##= Load obj file =##
path_obj = joinpath("shape", "ryugu_test.obj") # Small model for test
path_jld = joinpath("shape", "ryugu_test.jld2") # Small model for test
path_obj = joinpath("shape", "ryugu_test.obj") # Small model for test
# path_obj = joinpath("shape", "SHAPE_SFM_49k_v20180804.obj")
# path_jld = joinpath("shape", "SHAPE_SFM_49k_v20180804.jld2")
if isfile(path_jld) && ENABLE_JLD
shape = AsteroidThermoPhysicalModels.load_shape_jld(path_jld)
else
shape = AsteroidThermoPhysicalModels.load_shape_obj(path_obj; scale=1000, find_visible_facets=true)
AsteroidThermoPhysicalModels.save_shape_jld(path_jld, shape)
end

shape = AsteroidThermoPhysicalModels.load_shape_obj(path_obj; scale=1000, find_visible_facets=true)

##= Thermal properties =##
"""
Expand Down
2 changes: 0 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using AsteroidThermoPhysicalModels
using Test
using Aqua
using JLD2
using SPICE
using Git
using Downloads
Expand All @@ -11,7 +10,6 @@ using StaticArrays
using Rotations
using DataFrames

ENABLE_JLD = false
Aqua.test_all(AsteroidThermoPhysicalModels, ambiguities=false)

include("find_visiblefacets.jl")
Expand Down

0 comments on commit b7cd460

Please sign in to comment.