Skip to content

Commit

Permalink
Merge branch 'joss' of github.com:Magritte-code/p3droslo into joss
Browse files Browse the repository at this point in the history
  • Loading branch information
FredDeCeuster committed Nov 25, 2024
2 parents 49c609a + c69adf5 commit 585ad58
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 440 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Get the latest release (version 0.1.0) either from [PyPI](https://pypi.org/proje
```
pip install pomme
```
or from [Anaconda.org](https://anaconda.org/FredDeCeuster/pomme), using `conda`, with:
or from [Anaconda.org](https://anaconda.org/FredDeCeuster/pomme) (only linux-64 and osx-intel-64), using `conda`, with:
```
conda install -c freddeceuster pomme
```
Expand Down
2 changes: 1 addition & 1 deletion conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ about:
home: "https://github.com/Magritte-code/pomme"
license: GPLv3
license_file: LICENSE
summary: Probabilistic 3D Reconstruction of Spectral Line Observations.
summary: Bayesian 3D Reconstruction of Spectral Line Observations.

requirements:
build:
Expand Down
464 changes: 59 additions & 405 deletions docs/src/examples/R_Aquilae/R_Aql_model_4.ipynb

Large diffs are not rendered by default.

45 changes: 27 additions & 18 deletions docs/src/examples/R_Aquilae/R_Aql_observations_CO_J=2-1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,18 @@
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import torch.nn as nn\n",
"import torch\n",
"\n",
"from torch.optim import Adam\n",
"from tqdm import tqdm\n",
"from astropy import units, constants\n",
"from ipywidgets import interact\n",
"\n",
"from pomme.utils import convert_angular_to_spatial\n",
"from pomme.plot import plot_cube_2D, plot_spectrum\n",
"from pomme.object import AstroObject\n",
"from pomme.observation import DataCube, Beam\n",
"\n",
"from pomme.model import TensorModel, SphericallySymmetric\n",
"from pomme.utils import print_var, interpolate, convert_angular_to_spatial\n",
"from pomme.lines import Line\n",
"from pomme.loss import Loss, diff_loss"
"from pomme.model import TensorModel\n",
"from pomme.utils import convert_angular_to_spatial\n",
"from pomme.lines import Line"
]
},
{
Expand All @@ -59,7 +54,8 @@
"metadata": {},
"outputs": [],
"source": [
"file = '/STER/hydroModels/jolienm/RAqlObservations/RAql-observations/ALMA_analysis/data/R_Aql/R_Aql_combined111_line_t0.15_spw2_CO.fits'\n",
"file = '/STER/hydroModels/jolienm/RAqlObservations/RAql-observations/ALMA_analysis/R_Aql_combined111_line_t0.03_spw2_CO.pbcor.fits'\n",
"# file = '/STER/hydroModels/jolienm/RAqlObservations/RAql-observations/ALMA_analysis/R_Aql_combined111_line_t0.15_spw2_CO.fits\n",
"dat = DataCube(file)"
]
},
Expand All @@ -76,13 +72,13 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "94f7a9d0d3234925bde59105f3f50538",
"model_id": "16c4e5861cb54616a60acc13a941238c",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -99,7 +95,7 @@
"<function pomme.observation.DataCube.plot_channel_maps.<locals>.plot(f)>"
]
},
"execution_count": 5,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -110,18 +106,18 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "227cb09e0b1f462f86af0da253b5bdd2",
"model_id": "6a3ee5cccdf24caf944e2cdc515e8aea",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(IntSlider(value=4095, description='i', max=8191), IntSlider(value=4095, description='j',…"
"interactive(children=(IntSlider(value=2499, description='i', max=4999), IntSlider(value=2499, description='j',…"
]
},
"metadata": {},
Expand All @@ -133,7 +129,7 @@
"<function pomme.observation.DataCube.plot_spectrum.<locals>.plot(i, j)>"
]
},
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -144,9 +140,22 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "IndexError",
"evalue": "index 5700 is out of bounds for axis 0 with size 5000",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)",
"Input \u001b[0;32mIn [8]\u001b[0m, in \u001b[0;36m<cell line: 7>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m obs \u001b[38;5;241m=\u001b[39m dat\u001b[38;5;241m.\u001b[39mimg[fi_min:fi_max, xi_min:xi_max, yi_min:yi_max]\u001b[38;5;241m.\u001b[39mastype(np\u001b[38;5;241m.\u001b[39mfloat64)\n\u001b[1;32m 6\u001b[0m obs_freqs \u001b[38;5;241m=\u001b[39m dat\u001b[38;5;241m.\u001b[39mfs [fi_min:fi_max]\n\u001b[0;32m----> 7\u001b[0m obs_xlims \u001b[38;5;241m=\u001b[39m \u001b[43mdat\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mxs\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43mxi_max\u001b[49m\u001b[43m]\u001b[49m \u001b[38;5;241m-\u001b[39m dat\u001b[38;5;241m.\u001b[39mxs[xi_min]\n\u001b[1;32m 8\u001b[0m obs_ylims \u001b[38;5;241m=\u001b[39m dat\u001b[38;5;241m.\u001b[39mxs [xi_max] \u001b[38;5;241m-\u001b[39m dat\u001b[38;5;241m.\u001b[39mxs[xi_min]\n",
"File \u001b[0;32m~/.conda/envs/magritte/lib/python3.9/site-packages/astropy/units/quantity.py:1197\u001b[0m, in \u001b[0;36mQuantity.__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 1194\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_new_view(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mview(np\u001b[38;5;241m.\u001b[39mndarray)[key], \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39munit[key])\n\u001b[1;32m 1196\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1197\u001b[0m out \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__getitem__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1198\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mIndexError\u001b[39;00m:\n\u001b[1;32m 1199\u001b[0m \u001b[38;5;66;03m# We want zero-dimensional Quantity objects to behave like scalars,\u001b[39;00m\n\u001b[1;32m 1200\u001b[0m \u001b[38;5;66;03m# so they should raise a TypeError rather than an IndexError.\u001b[39;00m\n\u001b[1;32m 1201\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39misscalar:\n",
"\u001b[0;31mIndexError\u001b[0m: index 5700 is out of bounds for axis 0 with size 5000"
]
}
],
"source": [
"fi_min, fi_max = 6, 35\n",
"xi_min, xi_max = 2500, 5700\n",
Expand Down
25 changes: 10 additions & 15 deletions docs/src/examples/R_Aquilae/R_Aql_observations_CO_J=tbd.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,18 @@
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import torch.nn as nn\n",
"import torch\n",
"\n",
"from torch.optim import Adam\n",
"from tqdm import tqdm\n",
"from astropy import units, constants\n",
"from ipywidgets import interact\n",
"from astropy import units, constants\n",
"from ipywidgets import interact\n",
"\n",
"from pomme.utils import convert_angular_to_spatial\n",
"from pomme.plot import plot_cube_2D, plot_spectrum\n",
"from pomme.object import AstroObject\n",
"from pomme.observation import DataCube, Beam\n",
"\n",
"from pomme.model import TensorModel, SphericallySymmetric\n",
"from pomme.utils import print_var, interpolate, convert_angular_to_spatial\n",
"from pomme.lines import Line\n",
"from pomme.loss import Loss, diff_loss"
"from pomme.model import TensorModel\n",
"from pomme.utils import convert_angular_to_spatial\n",
"from pomme.lines import Line"
]
},
{
Expand All @@ -55,17 +50,17 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"file = '/STER/hydroModels/jolienm/RAqlObservations/RAql-observations/ALMA_analysis/data/R_Aql/R_Aql_combined111_line_t0.03_spw2_CO.fits'\n",
"file = '/STER/hydroModels/jolienm/RAqlObservations/RAql-observations/ALMA_analysis/R_Aql_combined111_line_t0.03_spw2_CO.pbcor.fits'\n",
"dat = DataCube(file)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -76,7 +71,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -110,7 +105,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down
Empty file removed src/pomme/reconstruction.py
Empty file.

0 comments on commit 585ad58

Please sign in to comment.