Open nsbruce opened 3 weeks ago
Hi! Thanks for bringing this issue to our attention. We are have fixed this for the next release v0.6.1 in a few weeks.
Hi @ereoh also note that in the current version some of the modulation lists are not currently passed to the datasets. For example,
AMDataset(
num_iq_samples=num_iq_samples,
num_samples_per_class=num_samples_per_class,
random_data=random_data,
**kwargs,
))
should become
AMDataset(
modulations=am_list,
num_iq_samples=num_iq_samples,
num_samples_per_class=num_samples_per_class,
random_data=random_data,
**kwargs,
))
A couple of others are missing too.
I'm not sure if you'd like this to be a new issue or not but reading the narrowband dataset also has problems if the dataset was generated using a subset of signal classes. In the TorchsigNarrowband.getitem method, the class_name is set using self._idx_to_name_dict[mod]
which disregards any custom list.
My current fix for this is a subclass:
class MyNarrowband(TorchSigNarrowband):
_idx_to_name_dict = dict(zip(range(len(MY_CLASSES)), MY_CLASSES))
_name_to_idx_dict = dict(zip(MY_CLASSES, range(len(MY_CLASSES))))
@staticmethod
def convert_idx_to_name(idx: int) -> str:
return MyTorchSigNarrowband._idx_to_name_dict.get(idx, "unknown")
@staticmethod
def convert_name_to_idx(name: str) -> int:
return MyTorchSigNarrowband._name_to_idx_dict.get(name, -1)
Describe the bug Narrowband dataset generation fails when passing a subset of the signal classes to use.
To Reproduce In generate_narrowband.py, add a classes list to the
ModulationsDataset
instantiation:And try generating the dataset. It fails with an indexing error.
Expected behavior The dataset generates.
Additional context I have fixed this locally by editing the
__init__
function of the ModulateNarrowbandDataset class to only pass relevant datasets to the finalsuper().__init__()
call.I'm happy to add this to a pull request if you want.