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
Fix audio to spectrogram plot and add test #2764
Merged
k-okada
merged 6 commits into
jsk-ros-pkg:master
from
iory:fix-audio-to-spectrogram-plot
Feb 27, 2023
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0078fcc
[audio_to_spectrogram] Use reset option for rosbag loop
iory d25b8cb
[audio_to_spectrogram] Use Absolute import
iory 374ef28
[audio_to_spectrogram] Use Agg as default and add test
iory 4435bc9
[audio_to_spectrogram] Add jsk_tools for test_depend
iory be635ab
[audio_to_spectrogram] Add warnings for matplotlib version
iory 85af1af
[audio_to_spectrogram] Check whether use_sim_time is true
iory File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from .audio_buffer import AudioBuffer | ||
from .convert_matplotlib import convert_matplotlib_to_img | ||
from audio_to_spectrogram.audio_buffer import AudioBuffer | ||
from audio_to_spectrogram.compat import check_matplotlib_version | ||
from audio_to_spectrogram.convert_matplotlib import convert_matplotlib_to_img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os | ||
import subprocess | ||
import warnings | ||
|
||
import matplotlib | ||
|
||
|
||
def check_matplotlib_version( | ||
python_version=os.getenv('ROS_PYTHON_VERSION')): | ||
if python_version == '2': | ||
python = 'python' | ||
else: | ||
python = 'python{}'.format(python_version) | ||
out = subprocess.check_output( | ||
['dpkg', '-L', '{}-matplotlib'.format(python)]) | ||
if isinstance(out, bytes): | ||
out = out.decode('utf-8') | ||
matplotlib_filelists = out.split() | ||
if os.path.dirname(matplotlib.__file__) in matplotlib_filelists: | ||
return True | ||
else: | ||
warnings.warn( | ||
"It looks like you are using pip's matplotlib. " | ||
"Apt's matplotlib is recommended.") | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
|
||
import numpy as np | ||
import PIL | ||
import PIL.Image | ||
|
||
|
||
def convert_matplotlib_to_img(fig): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@iory please add code to check version of matlab and display warning if it is not apt installed one.
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.
be635ab
Thank you. I added warning code for users.