Skip to content

Conversation

@keflavich
Copy link
Contributor

This is a new tutorial on extracting & plotting position-velocity diagrams.

It could use review from a non-specialist.

This is also submitted to radio-astro-tools/tutorials, which we're kind of treating as a sandbox for learn.astropy.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@adrn
Copy link
Contributor

adrn commented Nov 23, 2021

Sorry for the build failures - I just fixed those in #505 - do you mind rebasing on main?

@keflavich keflavich force-pushed the position-velocity-diagrams branch from 11825f2 to c6dea8e Compare November 23, 2021 13:16
@keflavich
Copy link
Contributor Author

I punted on the optional activity; I'd love to add it, but it's hard to find an appropriate data set

@keflavich
Copy link
Contributor Author

@kelle this is ready for final review

@e-koch your review on the changes to the front material would be helpful (I added some use case text)

@jonathansick your review on the technical aspects - should we squash and merge, for example? - would be helpful

@e-koch
Copy link

e-koch commented Dec 15, 2021

@keflavich --Front material looks good!

@keflavich keflavich force-pushed the position-velocity-diagrams branch from 3f3c215 to fa7f884 Compare January 4, 2022 17:30
@keflavich keflavich force-pushed the position-velocity-diagrams branch 2 times, most recently from c7700ec to 2cb4c64 Compare January 20, 2022 15:54
@kelle kelle self-requested a review January 27, 2022 15:08
@jonathansick
Copy link
Contributor

@keflavich I'm seeing a tutorial build error in GitHub Actions. Here's an extract of the logs:

------------------
16
ax = pl.subplot(111, projection=cube.wcs.celestial)
17
ax.imshow(cube[25].value)
18
{'execute_kwargs': {'kernel_name': '', 'timeout': 600, 'allow_errors': False}, 'convert_kwargs': {}, 'notebooks': ['tutorials/position-velocity-diagrams/PVDiagramPlotting.ipynb'], 'build_path': '.', 'flatten': True, 'overwrite': False, 'exclude_pattern': None, 'include_pattern': None, 'verbosity': 1, 'quietness': 0}
19
path.show_on_axis(ax, spacing=1, color='r')
20
ax.set_xlabel(f"Right Ascension [{cube.wcs.wcs.radesys}]")
21
ax.set_ylabel(f"Declination [{cube.wcs.wcs.radesys}]")
22
------------------
23

24
---------------------------------------------------------------------------
25
AttributeError                            Traceback (most recent call last)
26
Input In [5], in <module>
27
      1 ax = pl.subplot(111, projection=cube.wcs.celestial)
28
      2 ax.imshow(cube[25].value)
29
----> 3 path.show_on_axis(ax, spacing=1, color='r')
30
      4 ax.set_xlabel(f"Right Ascension [{cube.wcs.wcs.radesys}]")
31
      5 ax.set_ylabel(f"Declination [{cube.wcs.wcs.radesys}]")
32

33
AttributeError: 'Path' object has no attribute 'show_on_axis'
34
AttributeError: 'Path' object has no attribute 'show_on_axis'
35

36
Traceback (most recent call last):
37
  File "/opt/hostedtoolcache/Python/3.9.9/x64/bin/nbcollection", line 33, in <module>
38
    sys.exit(load_entry_point('nbcollection==0.3.dev8+g516c172', 'console_scripts', 'nbcollection')())
39
  File "/opt/hostedtoolcache/Python/3.9.9/x64/lib/python3.9/site-packages/nbcollection/__main__.py", line 33, in main
40
    commands[parsed.command](args)
41
  File "/opt/hostedtoolcache/Python/3.9.9/x64/lib/python3.9/site-packages/nbcollection/commands/execute.py", line 24, in execute
42
    nbcollection.execute()
43
  File "/opt/hostedtoolcache/Python/3.9.9/x64/lib/python3.9/site-packages/nbcollection/converter.py", line 156, in execute
44
    raise RuntimeError(f"{len(exceptions)} notebooks raised unexpected "
45
RuntimeError: 1 notebooks raised unexpected errors while executing cells: ['PVDiagramPlotting.ipynb'] — see above for more details about the failing cells. If any of these are expected errors, add a Jupyter cell tag 'raises-exception' to the failing cells.

Is path not the object we're expecting?

@keflavich
Copy link
Contributor Author

Huh, I think this could be a version issue! I'll check

@@ -0,0 +1,586 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"We can also build extraction regions by supplying coordinates defined in an astropy.coordinates.SkyCoord to pvextractor.Path "


Reply via ReviewNB

@eblur
Copy link
Contributor

eblur commented Jan 27, 2022

Overall, this looks good to me! I was confused by the use of the term "path" and asked for clarification around that. However, if "path" is the standard terminology used in radio astronomy to describe extraction regions (if I understand it correctly), then that is okay.

@keflavich
Copy link
Contributor Author

path is a technical term introduced in this document. I've added a little clarifying text, but there's not much more to be said in words. It is not a "region" in the sense I use that term (like a ds9 sky region), it is a drawn line in 2 dimensions. But the point is to show what it is.

I welcome additional suggestions on how to present this.

Here's the figure showing the extraction path drawn on the figure:
image

@eblur
Copy link
Contributor

eblur commented Feb 10, 2022

Thanks @keflavich , the image does help. I think it's good enough.

Regarding the build issues, it looks like you need to rebase this branch like you did for #504 . If all is well after that, we'll merge.

@keflavich keflavich force-pushed the position-velocity-diagrams branch from 1667a02 to ddbe59f Compare February 10, 2022 15:56
@jonathansick
Copy link
Contributor

@keflavich Can you try rebasing this now? We've pinned pyvo so that should so the build issue.

@keflavich keflavich force-pushed the position-velocity-diagrams branch from ddbe59f to f42247f Compare February 17, 2022 15:25
requirements.txt Outdated
Comment on lines 15 to 19
<<<<<<< HEAD
pyvo==1.2.0
=======
pvextractor
>>>>>>> a911f0e... add pvextractor to reqs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<<<<<<< HEAD
pyvo==1.2.0
=======
pvextractor
>>>>>>> a911f0e... add pvextractor to reqs
pyvo==1.2.0
pvextractor

@keflavich Could you resolve this merge conflict here in requirements.txt? I think that should do it.

@jonathansick
Copy link
Contributor

The requirements.txt is good now. The old issue with the python39 kernel name is back:

[nbcollection (DEBUG)]: Executing notebook 'PVDiagramPlotting.ipynb' ⏳
[nbcollection (ERROR)]: Notebook 'PVDiagramPlotting.ipynb' errored: No such kernel named python39

I thought this was supposed to be resolved by the nbstripout hook in pre-commit? Apparently not?

"kernelspec": {
"display_name": "Py 3.9",
"language": "python",
"name": "python39"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"name": "python39"
"name": "python3"

Would you mind making this single change, directly on the JSON (without saving it against via the Jupyter app?)

@jonathansick
Copy link
Contributor

Thanks for the switch to python3 kernel; that's got us going further. Now the issue is

[nbcollection (DEBUG)]: Executing notebook 'PVDiagramPlotting.ipynb' ⏳
[nbcollection (ERROR)]: Notebook 'PVDiagramPlotting.ipynb' errored ❌
[nbcollection (ERROR)]: Notebook 'PVDiagramPlotting.ipynb' errored: An error occurred while executing the following cell:
------------------
ax = pl.subplot(111, projection=cube.wcs.celestial)
ax.imshow(cube[25].value)
path.show_on_axis(ax, spacing=1, color='r')
ax.set_xlabel(f"Right Ascension [{cube.wcs.wcs.radesys}]")
ax.set_ylabel(f"Declination [{cube.wcs.wcs.radesys}]")
------------------

---------------------------------------------------------------------------
[24](https://github.com/astropy/astropy-tutorials/runs/5306271287?check_suite_focus=true#step:6:24)
AttributeError                            Traceback (most recent call last)
[25](https://github.com/astropy/astropy-tutorials/runs/5306271287?check_suite_focus=true#step:6:25)
Input In [5], in <module>
[26](https://github.com/astropy/astropy-tutorials/runs/5306271287?check_suite_focus=true#step:6:26)
      1 ax = pl.subplot(111, projection=cube.wcs.celestial)
[27](https://github.com/astropy/astropy-tutorials/runs/5306271287?check_suite_focus=true#step:6:27)
      2 ax.imshow(cube[25].value)
[28](https://github.com/astropy/astropy-tutorials/runs/5306271287?check_suite_focus=true#step:6:28)
----> 3 path.show_on_axis(ax, spacing=1, color='r')
[29](https://github.com/astropy/astropy-tutorials/runs/5306271287?check_suite_focus=true#step:6:29)
      4 ax.set_xlabel(f"Right Ascension [{cube.wcs.wcs.radesys}]")
[30](https://github.com/astropy/astropy-tutorials/runs/5306271287?check_suite_focus=true#step:6:30)
      5 ax.set_ylabel(f"Declination [{cube.wcs.wcs.radesys}]")
[31](https://github.com/astropy/astropy-tutorials/runs/5306271287?check_suite_focus=true#step:6:31)

[32](https://github.com/astropy/astropy-tutorials/runs/5306271287?check_suite_focus=true#step:6:32)
AttributeError: 'Path' object has no attribute 'show_on_axis'
[33](https://github.com/astropy/astropy-tutorials/runs/5306271287?check_suite_focus=true#step:6:33)
AttributeError: 'Path' object has no attribute 'show_on_axis'

This is familiar; wasn't it already fixed?

@keflavich
Copy link
Contributor Author

That's a pvextractor version issue

@jonathansick
Copy link
Contributor

We're installing pvextractor 0.2, which is the latest version on PyPI. Do we need to be installing pvextractor from GitHub to get the right Path API?

i.e. change pyextractor in requirements.txt to something like:

git+https://github.com/radio-astro-tools/pvextractor.git#egg=pvextractor

(that tracks the master branch)

Or could you do a new release to PyPI?

@keflavich keflavich force-pushed the position-velocity-diagrams branch from beb00d1 to 86631aa Compare March 31, 2022 14:27
@adrn
Copy link
Contributor

adrn commented Mar 31, 2022

To close the loop: @keflavich did a new release of pvextractor, so the change @jonathansick asked for about doesn't need to be added (and CI is now passing).

@adrn adrn force-pushed the position-velocity-diagrams branch from 86631aa to 51e4b49 Compare March 31, 2022 14:54
@adrn adrn force-pushed the position-velocity-diagrams branch from 51e4b49 to dc3ee8b Compare March 31, 2022 15:26
@jonathansick jonathansick merged commit d5d3d78 into astropy-learn:main Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants