-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sonify plugin updates #3269
Sonify plugin updates #3269
Conversation
Sonify plugin updates jt
…ch for now, while awaitin PyPI release
Some more functionality tweaks
57ee976
to
cc51183
Compare
Jt listener pre merge changes
|
The tests pass and run locally but fail on CI because there is no sound device with output. Is there a way we can skip the test in CI? @pllim |
Can we be sure that every user's machine has a sound device with output? Is it not possible to disable the plugin if such a situation happens (rather than have it fail CI)?
If you must, yes, you can skip it by checking to see if "CI" env var is set. See https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables |
super().__init__(*args, **kwargs) | ||
self._plugin_description = 'Sonify a data cube' | ||
self.docs_description = 'Sonify a data cube using the Strauss package.' | ||
if not self.has_strauss or sd.default.device[1] < 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pllim This line here will cause the plugin do be disabled if there is not a valid sound output device.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then why is CI failing? Something is running when it is not supposed to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I added a check in vue_sonify_cube()
to prevent that from being called.
.github/workflows/ci_cron_weekly.yml
Outdated
ci_cron_tests_stable_strauss: | ||
name: Python 3.12 with stable versions of dependencies and Strauss | ||
runs-on: ubuntu-latest | ||
if: (CI == false && (github.repository == 'spacetelescope/jdaviz' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'Extra CI')))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I see this if
here, it does not quite make sense to add a GitHub Actions job and then tell it to never run. Options:
- If you still want other tests to run and just to make sure non-strauss stuff does not break when strauss is installed, only skip the failing tests when CI is true. Do not skip the whole job.
- If (1) means nothing to you, just remove this whole job from this YAML. It is dead code at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I put that skip in the actual test file test_sonify_plugin.py
or in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that effectively makes the test useless though, right (unless we occasionally remember to run locally). Is it possible to test that the plugin is disabled because of no sound devices but then still call the internals to generate the sonified cube and assert its contents without ever playing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar thoughts as Kyle (but less clear) at #3269 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would require a non-trivial amount of code moving that should be covered by #3330.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vue_sonify_cube()
calls flux_viewer.get_sonified_cube()
which requires a device ID because that method creates an instance of CubeListenerData
called audified_cube
, which does not need a device ID. However, later in the method the sounddevice.OutputStream
is created which does need the device ID. I could separate that stream creation from the get_sonified_cube
method but that work may be overwritten by #3330 . So is that work worth it to do in this PR if we may do something different down the road? If the answer is yes then I can do that but I wanted to be clear with why I think that effort is covered by #3330.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the rush, probably okay to defer unless you think that refactoring is critical here for AAS.
jdaviz/configs/cubeviz/plugins/sonify_data/tests/test_sonify_data.py
Outdated
Show resolved
Hide resolved
jdaviz/configs/cubeviz/plugins/sonify_data/tests/test_sonify_data.py
Outdated
Show resolved
Hide resolved
@pllim Looks like the test marked to be skipped if run inside github actions is still being run in the CI. Any suggestions? |
Pushed a commit to copy over astropy syntax that I know works. 🤞 |
Still need to insert change log. You can ignore the standalone build. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few questions and suggestions. One overarching question: is there a meaningful difference between audification
/audified
and sonification
/sonified
? Both are used throughout this code, and if they're being used to mean the same thing we should probably standardize to using only one term.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates, I think this looks good to me now. Re-approving.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small comment that you can take or leave - otherwise looks good to me to merge for now and we can continue to iterate in the follow-up tickets created.
self.docs_description = 'Sonify a data cube using the Strauss package.' | ||
if not self.has_strauss or sd.default.device[1] < 0: | ||
self.disabled_msg = ('To use Sonify Data, install strauss and restart Jdaviz. You ' | ||
'can do this by running `pip install ".[strauss]"` in the command' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be updated to pip install strauss
now? Back ticks also won't render as code this way... maybe better without them entirely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related, I realized that my comment here was never addressed. Right now the instructions are confusing because they don't say that this command has to be run in the Jdaviz root directory, and also aren't applicable if the user is not on a dev install.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The correct syntax is pip install jdaviz[strauss]
for end-users.
ref: https://github.com/astropy/astropy/wiki/v7.0.0-RC-testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that strauss is released, can we just suggest pip install strauss
or do we want to maintain the ability to pin specific version by suggesting [strauss]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change it in both places to pip install strauss
.
🎉 |
Description
This pull request takes the work from james-trayford#3 and moves it into a PR for Jdaviz. There is now a plugin called "Sonify Data" which contains configuration options for sonifying a data cube. There are also options for which speaker the sound will come from, volume, and to start/stop the stream so the spectrum-at-spaxel tool can work as usual after sonifying the cube.
Change log entry
CHANGES.rst
? If you want to avoid merge conflicts,list the proposed change log here for review and add to
CHANGES.rst
before merge. If no, maintainershould add a
no-changelog-entry-needed
label.Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
trivial
label.