Skip to content

Commit

Permalink
Change test directory structure (#113)
Browse files Browse the repository at this point in the history
* Move test files to sub-directories

* Update TPM.jl

The `dirpath` to save the CSV file is set as a keyword argument.

* Update test scripts

* Rename `non-uniform_thermoparams`

To `TPM_non-uniform_thermoparams`
  • Loading branch information
MasanoriKanamaru authored Dec 26, 2023
1 parent 5fd428a commit 526710e
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 26 deletions.
21 changes: 13 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@
.ipynb_checkpoints

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

/test/TPM_Ryugu
/test/non-uniform_thermoparams
/test/TPM_Didymos
/test/shape/*

# Keep these shape models
!/test/shape/icosahedron.obj
!/test/shape/single_face.obj
!/test/shape/ryugu_test.obj
!icosahedron.obj
!single_face.obj
!ryugu_test.obj

/test/TPM_Ryugu/*
/test/TPM_non-uniform_thermoparams/*
/test/TPM_Didymos/*

# Keep these test files
!TPM_Ryugu.jl
!TPM_non-uniform_thermoparams.jl
!TPM_Didymos.jl
27 changes: 22 additions & 5 deletions src/TPM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,16 @@ end
"""
export_TPM_results(dirpath, result::SingleTPMResult)
Export the result of `SingleTPM` to CSV files.
Export the result of `SingleTPM` to CSV files.
The output files are saved in the following directory structure:
dirpath
├── physical_quantities.csv
├── subsurface_temperature.csv
└── surface_temperature.csv
# Arguments
- `dirpath` : Path to the directory to save CSV files
- `dirpath` : Path to the directory to save CSV files.
- `result` : Output data format for `SingleTPM`
"""
function export_TPM_results(dirpath, result::SingleTPMResult)
Expand Down Expand Up @@ -452,12 +458,23 @@ end


"""
export_TPM_results(filepath, result::BinaryTPMResult)
export_TPM_results(dirpath, result::BinaryTPMResult)
Export the result of `BinaryTPM` to CSV files.
The output files are saved in the following directory structure:
Export the result of `BinaryTPM` to CSV files.
dirpath
├── pri
│   ├── physical_quantities.csv
│   ├── subsurface_temperature.csv
│   └── surface_temperature.csv
└── sec
├── physical_quantities.csv
├── subsurface_temperature.csv
└── surface_temperature.csv
# Arguments
- `dirpath` : Path to the directory to save CSV files
- `dirpath` : Path to the directory to save CSV files.
- `result` : Output data format for `BinaryTPM`
"""
function export_TPM_results(dirpath, result::BinaryTPMResult)
Expand Down
5 changes: 2 additions & 3 deletions test/TPM_Didymos.jl → test/TPM_Didymos/TPM_Didymos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@
result = AsteroidThermoPhysicalModels.run_TPM!(btpm, ephem, times_to_save, face_ID_pri, face_ID_sec)

##= Save TPM result =##
savedir = "TPM_Didymos"
mkpath(savedir)
AsteroidThermoPhysicalModels.export_TPM_results(savedir, result)
dirpath = "./TPM_Didymos"
AsteroidThermoPhysicalModels.export_TPM_results(dirpath, result)
end
5 changes: 2 additions & 3 deletions test/TPM_Ryugu.jl → test/TPM_Ryugu/TPM_Ryugu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
result = AsteroidThermoPhysicalModels.run_TPM!(stpm, ephem, times_to_save, face_ID)

##= Save TPM result =##
savedir = "TPM_Ryugu"
mkpath(savedir)
AsteroidThermoPhysicalModels.export_TPM_results(savedir, result)
dirpath = "./TPM_Ryugu"
AsteroidThermoPhysicalModels.export_TPM_results(dirpath, result)
end
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@

result = AsteroidThermoPhysicalModels.run_TPM!(stpm, ephem, times_to_save, face_ID)

##= Save TPM result =##'
savedir = "non-uniform_thermoparams"
mkpath(savedir)
AsteroidThermoPhysicalModels.export_TPM_results(savedir, result)
##= Save TPM result =##
dirpath = "./TPM_non-uniform_thermoparams"
AsteroidThermoPhysicalModels.export_TPM_results(dirpath, result)
end
6 changes: 3 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ using DataFrames
Aqua.test_all(AsteroidThermoPhysicalModels, ambiguities=false)

include("find_visiblefacets.jl")
include("TPM_Ryugu.jl")
include("non-uniform_thermoparams.jl")
include("TPM_Didymos.jl")
include("TPM_Ryugu/TPM_Ryugu.jl")
include("TPM_non-uniform_thermoparams/TPM_non-uniform_thermoparams.jl")
include("TPM_Didymos/TPM_Didymos.jl")
include("heat_conduction_1D.jl")

0 comments on commit 526710e

Please sign in to comment.