Skip to content

Commit

Permalink
uncomment rendering, etc (#36)
Browse files Browse the repository at this point in the history
* uncomment rendering, etc

* do the broken ones first

* add --pre for astroquery req

* pip install reqs in all notebooks

* remove ids

* rm id

* use issue 874 hack to fix SpectralCubeReprojectExample

* use issue 874 hack to fix SpectralCubeReprojectMaskExample

* add astroquery version checks

* install --pre astroquery in build.yml

* expand installation a bit

* fix flagrant typo

* fix another flagrant typo
  • Loading branch information
keflavich authored Jun 1, 2024
1 parent ff96c9c commit 432341e
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 22 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,19 @@ jobs:
echo "datapath=['${GITHUB_WORKSPACE}/.casa/']; measurespath=datapath[0]; measures_auto_update=True; data_auto_update=True" > $GITHUB_WORKSPACE/config.py
export CASASITECONFIG=$GITHUB_WORKSPACE/config.py
pip install -r requirements.txt
pip install -U --pre astroquery # required to be separate; requirements.txt does not respect --pre
- name: Export notebooks
run: |
CASASITECONFIG=$GITHUB_WORKSPACE/config.py JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert SpectralCubeReprojectExample.ipynb --execute --to html --ExecutePreprocessor.kernel_name=python
CASASITECONFIG=$GITHUB_WORKSPACE/config.py JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert SpectralCubeReprojectMaskExample_v4p1.ipynb --execute --to html --ExecutePreprocessor.kernel_name=python
CASASITECONFIG=$GITHUB_WORKSPACE/config.py JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert spectral_fitting/*.ipynb --execute --to html --ExecutePreprocessor.kernel_name=python
CASASITECONFIG=$GITHUB_WORKSPACE/config.py JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert casa_to_spectralcube_guide/*.ipynb --execute --to html --ExecutePreprocessor.kernel_name=python
CASASITECONFIG=$GITHUB_WORKSPACE/config.py JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert masking_and_moments/*.ipynb --execute --to html --ExecutePreprocessor.kernel_name=python
CASASITECONFIG=$GITHUB_WORKSPACE/config.py JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert parallel_spectral_fitting/*.ipynb --execute --to html --ExecutePreprocessor.kernel_name=python
CASASITECONFIG=$GITHUB_WORKSPACE/config.py JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert DameCube.ipynb --execute --to html --ExecutePreprocessor.kernel_name=python
CASASITECONFIG=$GITHUB_WORKSPACE/config.py JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert PVDiagramPlotting.ipynb --execute --to html --ExecutePreprocessor.kernel_name=python
CASASITECONFIG=$GITHUB_WORKSPACE/config.py JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert DiskPVExample.ipynb --execute --to html --ExecutePreprocessor.kernel_name=python
# JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert SpectralCubeReprojectExample.ipynb --execute --to html --ExecutePreprocessor.kernel_name=python
# JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert SpectralCubeReprojectMaskExample_v4p1.ipynb.ipynb --execute --to html --ExecutePreprocessor.kerne]l_name=python
- name: Prepare public folder
id: folder
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/build_and_deploy_site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
echo "datapath=['${GITHUB_WORKSPACE}/.casa/']; measurespath=datapath[0]; measures_auto_update=True; data_auto_update=True" > $GITHUB_WORKSPACE/config.py
export CASASITECONFIG=$GITHUB_WORKSPACE/config.py
pip install -r requirements.txt
pip install -U --pre astroquery # required to be separate; requirements.txt does not respect --pre
- name: Export notebooks
run: |
Expand All @@ -38,8 +39,8 @@ jobs:
CASASITECONFIG=$GITHUB_WORKSPACE/config.py JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert DameCube.ipynb --execute --to html --ExecutePreprocessor.kernel_name=python
CASASITECONFIG=$GITHUB_WORKSPACE/config.py JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert PVDiagramPlotting.ipynb --execute --to html --ExecutePreprocessor.kernel_name=python
CASASITECONFIG=$GITHUB_WORKSPACE/config.py JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert DiskPVExample.ipynb --execute --to html --ExecutePreprocessor.kernel_name=python
# JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert SpectralCubeReprojectExample.ipynb --execute --to html --ExecutePreprocessor.kernel_name=python
# JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert SpectralCubeReprojectMaskExample_v4p1.ipynb.ipynb --execute --to html --ExecutePreprocessor.kerne]l_name=python
CASASITECONFIG=$GITHUB_WORKSPACE/config.py JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert SpectralCubeReprojectExample.ipynb --execute --to html --ExecutePreprocessor.kernel_name=python
CASASITECONFIG=$GITHUB_WORKSPACE/config.py JUPYTER_CONFIG_DIR=./.jupyter jupyter nbconvert SpectralCubeReprojectMaskExample_v4p1.ipynb --execute --to html --ExecutePreprocessor.kernel_name=python
- name: Prepare public folder
id: folder
Expand Down
10 changes: 10 additions & 0 deletions DameCube.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
"The key result is in [Dame & Thaddeus (2008)](https://ui.adsabs.harvard.edu/abs/2008ApJ...683L.143D/abstract)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%pip install -r https://github.com/radio-astro-tools/tutorials/raw/master/requirements.txt\n",
"%pip install --pre -U astroquery"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
10 changes: 10 additions & 0 deletions DiskPVExample.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@
"!pip install --upgrade spectral-cube git+https://github.com/radio-astro-tools/pvextractor.git@61e118aaf28e2d746deeccf06af8fdd7f405b815 radio-beam regions reproject"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%pip install -r https://github.com/radio-astro-tools/tutorials/raw/master/requirements.txt\n",
"%pip install --pre -U astroquery"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
10 changes: 10 additions & 0 deletions PVDiagramPlotting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
"We import tools from several packages up front:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%pip install -r https://github.com/radio-astro-tools/tutorials/raw/master/requirements.txt\n",
"%pip install --pre -U astroquery"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
37 changes: 32 additions & 5 deletions SpectralCubeReprojectExample.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@
"(you might not have to do this step, since you may already have data)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2180fbc2",
"metadata": {},
"outputs": [],
"source": [
"%pip install -r https://github.com/radio-astro-tools/tutorials/raw/master/requirements.txt\n",
"%pip install --pre -U astroquery"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -153,14 +164,26 @@
"We use the `find_lines` tool to query [splatalogue](https://splatalogue.online/) with [astroquery](https://astroquery.readthedocs.io/en/latest/splatalogue/splatalogue.html) over the spectral range covered by the cube. It returns a table of matching lines. Note that some line names will be repeated because Splatalogue includes several different databases and most chemical species are present in all of these."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b00a5e87-0437-4b3b-83c7-3da7046ba8df",
"metadata": {},
"outputs": [],
"source": [
"# DEBUG\n",
"import astroquery\n",
"print(astroquery.__version__)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "proud-flood",
"metadata": {},
"outputs": [],
"source": [
"cube1.find_lines(chemical_name=' H2CS ').show_in_notebook()"
"cube1.find_lines(chemical_name=' H2CS ')"
]
},
{
Expand All @@ -170,7 +193,7 @@
"metadata": {},
"outputs": [],
"source": [
"cube2.find_lines(chemical_name='SiO').show_in_notebook()"
"cube2.find_lines(chemical_name='SiO')"
]
},
{
Expand Down Expand Up @@ -516,7 +539,11 @@
"metadata": {},
"outputs": [],
"source": [
"cube2vel_reproj = cube2vel_spatialspectralsmooth.reproject(cube1vel.header)\n",
"# these next two lines are a hack to prevent the WCS from trying to convert to frequency\n",
"tgt_header = cube1vel.header\n",
"tgt_header['RESTFRQ'] = cube2vel_spatialspectralsmooth.header['RESTFRQ']\n",
"\n",
"cube2vel_reproj = cube2vel_spatialspectralsmooth.reproject(tgt_header)\n",
"cube2vel_reproj"
]
},
Expand Down Expand Up @@ -607,7 +634,7 @@
" cube2daskvel_spectralresample = cube2daskvel_smooth.spectral_interpolate(cube1vel.spectral_axis,\n",
" suppress_smooth_warning=True)\n",
" cube2daskvel_spatialspectralsmooth = cube2daskvel_spectralresample.convolve_to(common_beam)\n",
" cube2daskvel_reproj = cube2daskvel_spatialspectralsmooth.reproject(cube1vel.header)\n",
" cube2daskvel_reproj = cube2daskvel_spatialspectralsmooth.reproject(tgt_header)\n",
"cube2daskvel_reproj"
]
},
Expand Down Expand Up @@ -636,7 +663,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
10 changes: 10 additions & 0 deletions SpectralCubeReprojectMaskExample_v3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@
"(you might not have to do this step, since you may already have data)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%pip install -r https://github.com/radio-astro-tools/tutorials/raw/master/requirements.txt\n",
"%pip install --pre -U astroquery"
]
},
{
"cell_type": "code",
"execution_count": 1,
Expand Down
35 changes: 31 additions & 4 deletions SpectralCubeReprojectMaskExample_v4p1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@
"## Step 0: Some imports and version checks"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "303c0625",
"metadata": {},
"outputs": [],
"source": [
"%pip install -r https://github.com/radio-astro-tools/tutorials/raw/master/requirements.txt\n",
"%pip install --pre -U astroquery"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -148,14 +159,26 @@
"cube2"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ffa01793-a147-4c15-8d2c-421c141cf624",
"metadata": {},
"outputs": [],
"source": [
"# DEBUG\n",
"import astroquery\n",
"print(astroquery.__version__)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "765e0051",
"metadata": {},
"outputs": [],
"source": [
"cube1.find_lines(chemical_name=' H2CS ').show_in_notebook()"
"cube1.find_lines(chemical_name=' H2CS ')"
]
},
{
Expand All @@ -165,7 +188,7 @@
"metadata": {},
"outputs": [],
"source": [
"cube2.find_lines(chemical_name='SiO').show_in_notebook()"
"cube2.find_lines(chemical_name='SiO')"
]
},
{
Expand Down Expand Up @@ -489,7 +512,11 @@
"metadata": {},
"outputs": [],
"source": [
"cube2vel_reproj = cube2vel_spatialspectralsmooth.reproject(cube1vel_cutout.header)\n",
"# these next two lines are a hack to prevent the WCS from trying to convert to frequency\n",
"tgt_header = cube1vel_cutout.header\n",
"tgt_header['RESTFRQ'] = cube2vel_spatialspectralsmooth.header['RESTFRQ']\n",
"\n",
"cube2vel_reproj = cube2vel_spatialspectralsmooth.reproject(tgt_header)\n",
"cube2vel_reproj "
]
},
Expand Down Expand Up @@ -1149,7 +1176,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
10 changes: 10 additions & 0 deletions SpectralCube_Examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
"This is a quick demo of how you can work with Spectral Cube objects"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%pip install -r https://github.com/radio-astro-tools/tutorials/raw/master/requirements.txt\n",
"%pip install --pre -U astroquery"
]
},
{
"cell_type": "code",
"execution_count": 1,
Expand Down
Loading

0 comments on commit 432341e

Please sign in to comment.