Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ submodules:

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
os: ubuntu-24.04
tools:
python: "mambaforge-4.10"

Expand Down
9 changes: 5 additions & 4 deletions dependencies/conda_env.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: magritte
name: magritte_test_plons
channels:
- ensor
- conda-forge
- anaconda
- defaults
# The order of the channels above is critical!!!
dependencies:
- python>=3.9
- python<=3.13
- cmake
- numpy
- jupyterlab
Expand All @@ -33,8 +33,9 @@ dependencies:
- pip:
- breathe
- sphinx_rtd_theme
##install both with pip, otherwise it will install the wrong version, not compatible with sphinx
- plons
##install both breathe and sphinx_rtd_theme with pip, otherwise it will install the wrong version, not compatible with sphinx
- sphinx-copybutton
- nbsphinx
- pytest
- plons #for importing Phantom models

14 changes: 10 additions & 4 deletions docs/src/1_examples/1_post-processing/3_create_Phantom_3D.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,26 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Loading the data\n",
"setupData = plons.LoadSetup(wdir, \"wind\")\n",
"dumpData = plons.LoadFullDump(dump_file, setupData)\n",
"\n",
"position = dumpData[\"position\"]*1e-2 # position vectors [cm -> m]\n",
"velocity = dumpData[\"velocity\"]*1e3 # velocity vectors [km/s -> m/s]\n",
"pos_x = dumpData[\"x\"]*1e-2 # x position vectors [cm -> m]\n",
"pos_y = dumpData[\"y\"]*1e-2 # y position vectors [cm -> m]\n",
"pos_z = dumpData[\"z\"]*1e-2 # z position vectors [cm -> m]\n",
"position = np.array((pos_x, pos_y, pos_z)).T\n",
"vel_x = dumpData[\"vx\"]*1e3 # x velocity vectors [km/s -> m/s]\n",
"vel_y = dumpData[\"vy\"]*1e3 # y velocity vectors [km/s -> m/s]\n",
"vel_z = dumpData[\"vz\"]*1e3 # z velocity vectors [km/s -> m/s]\n",
"velocity = np.array((vel_x, vel_y, vel_z)).T\n",
"velocity = velocity/constants.c.si.value # velocity vectors [m/s -> 1/c]\n",
"rho = dumpData[\"rho\"] # density [g/cm^3]\n",
"u = dumpData[\"u\"] # internal energy density [erg/g]\n",
"tmp = dumpData[\"Tgas\"] # temperature [K]\n",
"tmp = dumpData[\"temp\"] # temperature [K]\n",
"tmp[tmp<2.725] = 2.725 # Cut-off temperatures below 2.725 K\n",
"\n",
"# Extract the number of points\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,20 +182,26 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Loading the data\n",
"setupData = plons.LoadSetup(wdir, \"wind\")\n",
"dumpData = plons.LoadFullDump(dump_file, setupData)\n",
"\n",
"position = dumpData[\"position\"]*1e-2 # position vectors [cm -> m]\n",
"velocity = dumpData[\"velocity\"]*1e3 # velocity vectors [km/s -> m/s]\n",
"pos_x = dumpData[\"x\"]*1e-2 # x position vectors [cm -> m]\n",
"pos_y = dumpData[\"y\"]*1e-2 # y position vectors [cm -> m]\n",
"pos_z = dumpData[\"z\"]*1e-2 # z position vectors [cm -> m]\n",
"position = np.array((pos_x, pos_y, pos_z)).T\n",
"vel_x = dumpData[\"vx\"]*1e3 # x velocity vectors [km/s -> m/s]\n",
"vel_y = dumpData[\"vy\"]*1e3 # y velocity vectors [km/s -> m/s]\n",
"vel_z = dumpData[\"vz\"]*1e3 # z velocity vectors [km/s -> m/s]\n",
"velocity = np.array((vel_x, vel_y, vel_z)).T\n",
"velocity = velocity/constants.c.si.value # velocity vectors [m/s -> 1/c]\n",
"rho = dumpData[\"rho\"] # density [g/cm^3]\n",
"u = dumpData[\"u\"] # internal energy density [erg/g]\n",
"tmp = dumpData[\"Tgas\"] # temperature [K]\n",
"tmp = dumpData[\"temp\"] # temperature [K]\n",
"tmp[tmp<2.725] = 2.725 # Cut-off temperatures below 2.725 K\n",
"\n",
"# Extract the number of points\n",
Expand Down
2 changes: 1 addition & 1 deletion tests/benchmarks/analytic/continuum_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def evaluate_dust_opacity(frequency, velocity):

#compute optical depth
chi_shifted = evaluate_dust_opacity(dust_frequencies, np.array(model.geometry.points.velocity)[:,0])
tau_ref = np.trapz(chi_shifted, x=np.array(model.geometry.points.position)[:,0], axis=0)
tau_ref = np.trapezoid(chi_shifted, x=np.array(model.geometry.points.position)[:,0], axis=0)
#TODO: fix the calculation of the reference intensity; currently it is wrong for any model with non-zero velocity field due to not taking into account the doppler shifts properly
#test attempt below
# def evaluate_source_function(frequency, velocity):
Expand Down
12 changes: 9 additions & 3 deletions tests/benchmarks/numeric/import_phantom_3D_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,18 @@ def import_phantom():
setupData = plons.LoadSetup(datadir, "wind")
dumpData = plons.LoadFullDump(dump_file, setupData)

position = dumpData["position"]*1e-2 # position vectors [cm -> m]
velocity = dumpData["velocity"]*1e3 # velocity vectors [km/s -> m/s]
pos_x = dumpData["x"]*1e-2 # x position vectors [cm -> m]
pos_y = dumpData["y"]*1e-2 # y position vectors [cm -> m]
pos_z = dumpData["z"]*1e-2 # z position vectors [cm -> m]
position = np.array((pos_x, pos_y, pos_z)).T
vel_x = dumpData["vx"]*1e3 # x velocity vectors [km/s -> m/s]
vel_y = dumpData["vy"]*1e3 # y velocity vectors [km/s -> m/s]
vel_z = dumpData["vz"]*1e3 # z velocity vectors [km/s -> m/s]
velocity = np.array((vel_x, vel_y, vel_z)).T
velocity = velocity/constants.c.si.value # velocity vectors [m/s -> 1/c]
rho = dumpData["rho"] # density [g/cm^3]
u = dumpData["u"] # internal energy density [erg/g]
tmp = dumpData["Tgas"] # temperature [K]
tmp = dumpData["temp"] # temperature [K]
tmp[tmp<2.725] = 2.725 # Cut-off temperatures below 2.725 K

# Extract the number of points
Expand Down
Loading