Skip to content

Commit

Permalink
Merge pull request #278 from Magritte-code/277-move-model-from-ci-pip…
Browse files Browse the repository at this point in the history
…eline-to-somewhere-else-than-github

Found the original CI model again. Moved it to owncloud.
  • Loading branch information
ThomasCeulemans authored Nov 28, 2024
2 parents 3160c7e + 38ee91e commit 13e021e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
9 changes: 6 additions & 3 deletions tests/benchmarks/numeric/import_phantom_3D_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ def import_phantom():
model_file = os.path.join(modeldir, 'model_Phantom_3D.hdf5') # Resulting Magritte model
lamda_file = os.path.join(datadir, 'co.txt' ) # Line data file

dump_link = "https://github.com/Ensor-code/phantom-models/raw/main/Malfait+2021/v05e50/wind_v05e50?download="
setup_link = "https://raw.githubusercontent.com/Ensor-code/phantom-models/main/Malfait%2B2021/v05e50/wind.setup"
input_link = "https://raw.githubusercontent.com/Ensor-code/phantom-models/main/Malfait%2B2021/v05e50/wind.in"
lamda_link = "https://home.strw.leidenuniv.nl/~moldata/datafiles/co.dat"
# dump_link = "https://owncloud.ster.kuleuven.be/index.php/s/qgxytfnqW7dSiLo/download/wind_00574"
dump_link = "https://owncloud.ster.kuleuven.be/index.php/s/Et6CXYpZwjBXsJe/download/wind_00350"
input_link = "https://owncloud.ster.kuleuven.be/index.php/s/w9tgWmC2CfkPm7p/download/wind.in"
setup_link = "https://owncloud.ster.kuleuven.be/index.php/s/ZP6KwiASYgAayaK/download/wind.setup"

# %%capture
subprocess.run(['wget', dump_link, '--output-document', dump_file ])
Expand All @@ -44,6 +45,8 @@ def import_phantom():
# !wget $lamda_link --output-document $lamda_file

# Loading the data with plons
print("datadir: ", datadir)
print("dump_file: ", dump_file)
setupData = plons.LoadSetup(datadir, "wind")
dumpData = plons.LoadFullDump(dump_file, setupData)

Expand Down
11 changes: 10 additions & 1 deletion tests/benchmarks/numeric/run_phantom_3D_model_reduced.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import magritte.core as magritte
import magritte.plot as plot

VERSION = "0.9.0"#reference version of Magritte to compare against; should correspond to a commited intensity file
VERSION = "0.9.5"#reference version of Magritte to compare against; should correspond to a commited intensity file
#starting from 0.9.0, we compute the intensity for 4 lines at the same time, instead of just a single line. This is still not a realistic usecase, but suffices for regression testing.

path = os.path.dirname(os.path.realpath(__file__))
Expand Down Expand Up @@ -71,6 +71,15 @@ def run_model (nosave=True):

reference_intensity = np.load(f'{datadir}{modelName}_NLTE_intensity_magritte_{VERSION}.npy')
reldiff = tools.relative_error(reference_intensity, np.array(model.images[0].I))
# For debugging, plot the intensity and reference intensity
# plt.figure()
# plt.imshow(np.log10(np.array(model.images[0].I).reshape(256, 256, -1))[:, :, 10], origin='lower')
# plt.colorbar()
# plt.title('log10(intensity)')
# plt.figure()
# plt.imshow(np.log10(reference_intensity).reshape(256, 256, -1)[:, :, 10], origin='lower')
# plt.colorbar()
# plt.show()

print(result)
print("maximum relative difference: ", np.max(reldiff))#only for a few points a significant difference can be seen
Expand Down
Binary file not shown.

0 comments on commit 13e021e

Please sign in to comment.