Skip to content

Commit

Permalink
Add __all__ for some files
Browse files Browse the repository at this point in the history
  • Loading branch information
thequilo committed Jul 11, 2023
1 parent 6fd2410 commit 510d6e0
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 3 deletions.
4 changes: 4 additions & 0 deletions mms_msg/sampling/environment/noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

from mms_msg.sampling.utils.rng import get_rng_example

__all__ = [
'sample_uniform_snr',
'UniformSNRSampler',
]

def sample_uniform_snr(example, *, min_snr: float = 20, max_snr: float = 30):
example['snr'] = float(
Expand Down
7 changes: 5 additions & 2 deletions mms_msg/sampling/environment/rir.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from dataclasses import dataclass
from pathlib import Path

import lazy_dataset
from lazy_dataset.database import JsonDatabase
from mms_msg.databases.reverberation.sms_wsj import SMSWSJRIRDatabase

__all__ = [
'sample_rirs',
'RIRSampler',
]


def sample_rirs(example: dict, *, rir_dataset: lazy_dataset.Dataset):
# Assume the examples have a running index
Expand Down
12 changes: 11 additions & 1 deletion mms_msg/sampling/pattern/classical/offset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
from mms_msg.sampling.utils.rng import get_rng_example
from mms_msg.sampling.utils.utils import update_num_samples

__all__ = [
'assign_offset',
'sample_offsets_sms_wsj',
'SMSWSJOffsetSampler',
'sample_offsets_constant',
'ConstantOffsetSampler',
'sample_partial_overlap',
'PartialOverlapOffsetSampler',
]


def assign_offset(example, offset):
assert keys.OFFSET not in example
Expand Down Expand Up @@ -56,7 +66,7 @@ def sample_partial_overlap(example, *, minimum_overlap, maximum_overlap):
overlap = rng.uniform(minimum_overlap, maximum_overlap)
num_samples = example[keys.NUM_SAMPLES][keys.ORIGINAL_SOURCE]
assert len(num_samples) == 2, (len(num_samples), num_samples)
overlap_samples = sum(num_samples)*overlap / (1 + overlap)
overlap_samples = sum(num_samples) * overlap / (1 + overlap)
offset = [0, int(max(num_samples[0] - overlap_samples, 0))]
assign_offset(example, offset)
return example
Expand Down
4 changes: 4 additions & 0 deletions mms_msg/sampling/pattern/meeting/meeting_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

logger = logging.getLogger('meeting')

__all__ = [
'MeetingSampler',
'sample_meeting_from_full_overlap',
]

@dataclass
class _MeetingSampler:
Expand Down
11 changes: 11 additions & 0 deletions mms_msg/sampling/pattern/meeting/scenario_sequence_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
from paderbox.utils.mapping import Dispatcher


__all__ = [
'sample_random',
'sample_round_robin',
'sample_random_round_robin',
'sample_balanced',
'sample_balanced_no_repeat',
'sample_asymmetric',
'scenario_sequence_samplers',
]


def sample_random(scenarios: list, examples: list, rng: np.random.Generator):
"""
Samples the scenarios uniformly, independent of the already sampled
Expand Down

0 comments on commit 510d6e0

Please sign in to comment.