Skip to content

some updates to module_stft , module_resample, random_utils and io.download#96

Open
JanekEbb wants to merge 7 commits into
fgnt:masterfrom
JanekEbb:master
Open

some updates to module_stft , module_resample, random_utils and io.download#96
JanekEbb wants to merge 7 commits into
fgnt:masterfrom
JanekEbb:master

Conversation

@JanekEbb

Copy link
Copy Markdown
Contributor

No description provided.

@JanekEbb JanekEbb requested a review from boeddeker December 21, 2023 12:07
@codecov-commenter

codecov-commenter commented Dec 21, 2023

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 27.14286% with 51 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.64%. Comparing base (3aa0078) to head (481bc2d).
⚠️ Report is 72 commits behind head on master.

Files with missing lines Patch % Lines
paderbox/io/download.py 9.09% 50 Missing ⚠️
paderbox/utils/random_utils.py 92.30% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #96      +/-   ##
==========================================
+ Coverage   65.52%   65.64%   +0.11%     
==========================================
  Files          81       81              
  Lines        5494     5504      +10     
==========================================
+ Hits         3600     3613      +13     
+ Misses       1894     1891       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread paderbox/utils/random_utils.py Outdated

@dataclasses.dataclass
class Choice(_Sampler):
events: int = 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choice and choice should have the same default for events.
While other distributions have some kind of natural defaults, I would say, we shouldn't set a default for events.

Comment thread paderbox/io/download.py Outdated
target_dir = local_file.parent
else:
target_dir = Path(target_dir)
if not target_dir.exists():

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove this if, just call target_dir.mkdir(parents=True, exist_ok=True)

Comment thread paderbox/io/download.py
raise FileExistsError(target_file)
tar.members = []
os.remove(local_file)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a reason, that you didn't define an else path with a raise? If not, could you raise a warning, when there is an unsupported suffix?

Comment thread paderbox/io/download.py Outdated
for _ in ex.map(
download_file,
file_list,
[target_dir / Path(f).name.split('?')[0] for f in file_list],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you add a comment, why only name is used and why everything behind the ? is ignored?
Alternatively, a doctest could also help to understand the motivation.

Comment thread paderbox/transform/module_stft.py Outdated

>>> [sample_index_to_stft_frame_index(i, 8, 1, fading=None) for i in range(12)]
[0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8]
>>> sample_index_to_stft_frame_index(np.arange(12), 8, 1, fading=None)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add a dtype for arange. The Windows test fails, because the default is int32 on windows.

Comment thread paderbox/io/download.py
local_file:
exist_ok:
extract:
progress_par:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

progress_bar is no arg


@dataclasses.dataclass
class Choice(_Sampler):
events: int = None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not simply events: int? (without a default value)
Then the `post_init``wouldn't be nessesary.

@boeddeker boeddeker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

When removing the default for events, LGTM.

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.

4 participants