Skip to content
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

Test Draft PR #3355

Draft
wants to merge 65 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
6049d9a
Create audified cube and use with spectrum at spaxel tool
javerbukh Jul 9, 2024
627a34f
Add Sonify Data plugin and connect to spectrum per spaxel tool
javerbukh Jul 10, 2024
9e98b32
Fix errors
javerbukh Jul 10, 2024
e6d52b4
Try moving code to mixin
javerbukh Jul 10, 2024
0080b2f
Move code to viewers.py
javerbukh Jul 10, 2024
4b01304
Remove print statements
javerbukh Jul 10, 2024
505f73f
Patches:
Jul 11, 2024
89d6fff
fix np import
Jul 31, 2024
5c67736
add audio frequency range choice and equal loudness normalisation opt…
Aug 15, 2024
d8937c5
Create dropdown to select output sound device
javerbukh Oct 9, 2024
75b7ded
Various updates and QOL improvements
javerbukh Oct 11, 2024
9d6844d
Connect volume level in viewer to sonify plugin
javerbukh Oct 15, 2024
1d1417c
add volume attenuation functionality
Oct 16, 2024
6421ee5
add sound device switching
Oct 17, 2024
352eff9
feed ELN flag to Image Viewer
Oct 17, 2024
a7d501e
Merge pull request #18 from james-trayford/sonify-plugin-updates-jt
javerbukh Oct 17, 2024
ceafbb0
Enable start stop stream and strauss soft dependency
javerbukh Oct 18, 2024
a4811e4
Add note to plugin when strauss is not downloaded
javerbukh Oct 23, 2024
2a270ec
Add strauss as soft dependency
javerbukh Oct 25, 2024
13f37a8
Get build devices method working on windows
javerbukh Oct 31, 2024
4a1d628
ensure sound generation always uses the current spectrum-at-spaxel wl…
Oct 25, 2024
a05937d
post rebase clean-up (remove prints and rogue spaces)
Nov 3, 2024
0f0eb87
this syntax seems to work to install strauss on our specific git bran…
Nov 3, 2024
a56b26e
Merge pull request #19 from james-trayford/sonify-plugin-updates-jt
javerbukh Nov 6, 2024
18634ea
Update code to be PEP8
javerbukh Nov 6, 2024
cc51183
PEP8 fixes
javerbukh Nov 7, 2024
5d308ea
Merge branch 'main' into sonify-plugin-updates
javerbukh Nov 7, 2024
c6de013
Remove old code
javerbukh Nov 7, 2024
eaae60f
Fix test
javerbukh Nov 7, 2024
9682321
Fix test 2
javerbukh Nov 7, 2024
630be77
Update docs link in plugin
javerbukh Nov 7, 2024
51a4154
Use spectral subset for range and move advanced options to accordion
javerbukh Nov 8, 2024
cd1963e
fix volume bug (doesn't crash on vol=0)
Nov 8, 2024
de530d9
Rearrange order in plugin
javerbukh Nov 8, 2024
f3e65df
Merge pull request #20 from james-trayford/sonify-plugin-updates-jt
javerbukh Nov 8, 2024
15a8671
Fix code style
javerbukh Nov 8, 2024
a5ef389
Remove unused import
javerbukh Nov 8, 2024
a66beef
Add documentation and a test
javerbukh Nov 14, 2024
b4b64e0
Add install instructions to warning when package is not present
javerbukh Nov 14, 2024
99d04e8
Fix test failure
javerbukh Nov 14, 2024
9747650
Add plugin description
javerbukh Nov 14, 2024
b1d5806
Add plugin description
javerbukh Nov 15, 2024
2d0c5a4
Finish test and add standalone hook
javerbukh Nov 15, 2024
ae98601
Grey out start/stop stream and fix code style
javerbukh Nov 18, 2024
91ed211
Update docs and change disable message for plugin without strauss ins…
javerbukh Dec 3, 2024
30ddca8
Update jdaviz/configs/cubeviz/plugins/sonify_data/sonify_data.py
javerbukh Dec 5, 2024
1ab90f6
Merge branch 'main' into sonify-plugin-updates
javerbukh Dec 5, 2024
434a42a
Add cron job for strauss
javerbukh Dec 11, 2024
bf4fa3f
Add strauss deps to tox.ini
javerbukh Dec 11, 2024
6249a8c
Add sounddevice as dependency
javerbukh Dec 11, 2024
14c1602
Add port audio dep
javerbukh Dec 11, 2024
2dc155b
Try manually adding install for libportaudio2
javerbukh Dec 11, 2024
89dfcd2
Try different order and Python version
pllim Dec 12, 2024
8172cdd
not a Python package
pllim Dec 12, 2024
b552edc
Catch case with no sound devices and set plugin to disabled
javerbukh Dec 12, 2024
30e8ad2
catch no sound device case without errors in other cases, also remove…
Dec 12, 2024
4494ba5
Fix check for sound devices
javerbukh Dec 12, 2024
92982bd
i needed these quotes for the pip suggestion to work
Dec 12, 2024
17fd0e5
remove debug print
Dec 12, 2024
dc478ce
revert change
Dec 12, 2024
e25022f
Merge pull request #23 from james-trayford/jt_listener_mergechanges
javerbukh Dec 12, 2024
cc81d63
Fix codestyle and stop sonify plugin test running on CI
javerbukh Dec 13, 2024
fdef225
Merge branch 'main' into sonify-plugin-updates
javerbukh Dec 13, 2024
41b51f6
Add test that can run on CI
javerbukh Dec 13, 2024
a12b687
add test to run with CI
javerbukh Dec 13, 2024
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
Prev Previous commit
Next Next commit
Get build devices method working on windows
javerbukh committed Oct 31, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 13f37a8e724354c0ed9912c8aea08b5b903b2fcc
6 changes: 1 addition & 5 deletions jdaviz/configs/cubeviz/plugins/cube_listener.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
import sys
import os
import time
from astropy import units as u

try:
from strauss.sonification import Sonification
@@ -77,8 +76,7 @@ def __init__(self, cube, wlens, samplerate=44100, duration=1, overlap=0.05, buff
self.atten_level = int(np.clip(100/vol, 0, 2**15-1))
else:
self.atten_level = 1
print(vol, self.atten_level)


self.wl_bounds = wl_bounds
self.wl_unit = wl_unit
self.wlens = wlens
@@ -112,8 +110,6 @@ def set_wl_bounds(self, w1, w2):
"""
wsrt = np.sort([w1, w2])
self.wl_bounds = tuple(wsrt)
print(w1, w2, 'test')
print(self.wl_bounds)

def audify_cube(self):
"""
29 changes: 11 additions & 18 deletions jdaviz/configs/cubeviz/plugins/sonify_data/sonify_data.py
Original file line number Diff line number Diff line change
@@ -39,17 +39,14 @@ class SonifyData(PluginTemplateMixin, DatasetSelectMixin):
# TODO: can we referesh the list, so sounddevices are up-to-date when dropdown clicked?
sound_devices_items = List().tag(sync=True)
sound_devices_selected = Unicode('').tag(sync=True)
# sound_device_indexes = {}

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.has_strauss:
self.sound_devices_items = [device['name'] for device in sd.query_devices()]
self.sound_devices_selected = sd.query_devices()[sd.default.device[1]]['name']
# devices, indexes = self.build_device_lists()
# self.sound_device_indexes = dict(zip(devices, indexes))
# self.sound_devices_items = devices
# self.sound_devices_selected = dict(zip(indexes, devices))[sd.default.device[1]]
devices, indexes = self.build_device_lists()
self.sound_device_indexes = dict(zip(devices, indexes))
self.sound_devices_items = devices
self.sound_devices_selected = dict(zip(indexes, devices))[sd.default.device[1]]

# TODO: Remove hardcoded range and flux viewer
self.spec_viewer = self.app.get_viewer('spectrum-viewer')
@@ -59,10 +56,8 @@ def __init__(self, *args, **kwargs):

@with_spinner()
def vue_sonify_cube(self, *args):
# Get index of selected device since name may not be unique
# selected_device_index = self.sound_device_indexes[self.sound_devices_selected] #
selected_device_index = self.sound_devices_items.index(self.sound_devices_selected)
print(selected_device_index)
# Get index of selected device
selected_device_index = self.sound_device_indexes[self.sound_devices_selected]
self.flux_viewer.get_sonified_cube(self.sample_rate, self.buffer_size,
selected_device_index, self.assidx, self.ssvidx,
self.pccut, self.audfrqmin,
@@ -98,12 +93,10 @@ def update_sound_device(self, event):
def build_device_lists(self):
# dedicated function to build the current *output*
# device and index lists
devdx = 0
devices = []
didxs = []
for device in sd.query_devices():
if device['max_output_channels'] > 0:
device_indexes = []
for index, device in enumerate(sd.query_devices()):
if device['max_output_channels'] > 0 and device['name'] not in devices:
devices.append(device['name'])
didxs.append(devdx)
devdx += 1
return devices, didxs
device_indexes.append(index)
return devices, device_indexes
2 changes: 0 additions & 2 deletions jdaviz/configs/cubeviz/plugins/viewers.py
Original file line number Diff line number Diff line change
@@ -159,7 +159,6 @@ def get_sonified_cube(self, sample_rate, buffer_size, device, assidx, ssvidx,
# and re-clip
clipped_arr = np.clip(clipped_arr, 0, np.inf)

print(f"making cube with {self.audification_wl_bounds}")
self.audified_cube = CubeListenerData(clipped_arr ** assidx, wlens, duration=0.8,
samplerate=sample_rate, buffsize=buffer_size,
wl_bounds=self.audification_wl_bounds,
@@ -173,7 +172,6 @@ def get_sonified_cube(self, sample_rate, buffer_size, device, assidx, ssvidx,
self.stream = sd.OutputStream(samplerate=sample_rate, blocksize=buffer_size, device=device,
channels=1, dtype='int16', latency='low',
callback=self.audified_cube.player_callback)
print(sd.query_devices(), device)
self.audified_cube.cbuff = True