Skip to content

[Bug] Inverted lower/upper frequency signs in the generated HDF5 when Spectrogram is used as a transform #472

Description

@tapyu

Version

2.1.1 (Default)

System Information

❯ fastfetch --logo none
tapyu@felix-Alienware-m16-R1
----------------------------
OS: Ubuntu 24.04.4 LTS (Noble Numbat) x86_64
Host: Alienware m16 R1
Kernel: Linux 6.17.0-35-generic
Uptime: 22 hours, 43 mins
Packages: 2604 (dpkg), 16 (snap)
Shell: zsh 5.9
Terminal: /dev/pts/2
CPU: 13th Gen Intel(R) Core(TM) i9-13900HX (32) @ 5.40 GHz
GPU 1: NVIDIA GeForce RTX 4070 Max-Q / Mobile [Discrete]
GPU 2: Intel Raptor Lake-S UHD Graphics @ 1.65 GHz [Integrated]
Memory: 5.27 GiB / 31.03 GiB (17%)
Swap: 0 B / 8.00 GiB (0%)
Disk (/): 104.52 GiB / 191.19 GiB (55%) - ext4
Disk (/home): 142.18 GiB / 287.36 GiB (49%) - ext4
Local IP (enp109s0): 161.24.19.210/24
Battery (DELL 70N2F3B): 100% [AC Connected]
Locale: en_US.UTF-8
❯ uv pip list
Package                  Version     Editable project location
------------------------ ----------- ---------------------------------
aiobotocore              2.26.0
aiohappyeyeballs         2.6.1
aiohttp                  3.13.0
aiohttp-retry            2.9.1
aioitertools             0.13.0
aiosignal                1.4.0
amqp                     5.3.1
annotated-types          0.7.0
antlr4-python3-runtime   4.9.3
appdirs                  1.4.4
astroid                  4.0.1
asyncssh                 2.21.1
atpublic                 6.0.2
attrs                    25.4.0
billiard                 4.2.2
botocore                 1.41.5
celery                   5.5.3
certifi                  2025.10.5
cffi                     2.0.0
charset-normalizer       3.4.4
click                    8.3.0
click-didyoumean         0.3.1
click-plugins            1.1.1.2
click-repl               0.3.0
code-anatel-axis4        0.1.0       /home/tapyu/git/code-anatel-axis4
colorama                 0.4.6
configobj                5.0.9
contourpy                1.3.3
coverage                 7.11.0
cryptography             46.0.3
cycler                   0.12.1
dictdiffer               0.9.0
dill                     0.4.0
diskcache                5.6.3
distro                   1.9.0
dpath                    2.2.0
dulwich                  0.24.5
dvc                      3.63.0
dvc-data                 3.16.12
dvc-http                 2.32.0
dvc-objects              5.1.2
dvc-render               1.0.2
dvc-s3                   3.3.0
dvc-studio-client        0.22.0
dvc-task                 0.40.2
engineering-notation     0.13.2
entrypoints              0.4
filelock                 3.20.0
flatten-dict             0.4.2
flufl-lock               8.2.0
fonttools                4.60.1
frozenlist               1.8.0
fsspec                   2025.9.0
funcy                    2.0
gitdb                    4.0.12
gitpython                3.1.45
grandalf                 0.8
gto                      1.9.0
h5py                     3.15.0
hf-xet                   1.1.10
huggingface-hub          0.35.3
hydra-core               1.3.2
idna                     3.11
iniconfig                2.1.0
isort                    7.0.0
iterative-telemetry      0.0.10
jinja2                   3.1.6
jmespath                 1.1.0
joblib                   1.5.2
kiwisolver               1.4.9
kombu                    5.5.4
lightning                2.6.5
lightning-utilities      0.15.2
loguru                   0.7.3
markdown-it-py           4.0.0
markupsafe               3.0.3
matplotlib               3.10.7
mccabe                   0.7.0
mdurl                    0.1.2
mpmath                   1.3.0
multidict                6.7.0
networkx                 3.5
numpy                    2.4.6
nvidia-cublas-cu12       12.8.4.1
nvidia-cuda-cupti-cu12   12.8.90
nvidia-cuda-nvrtc-cu12   12.8.93
nvidia-cuda-runtime-cu12 12.8.90
nvidia-cudnn-cu12        9.10.2.21
nvidia-cufft-cu12        11.3.3.83
nvidia-cufile-cu12       1.13.1.3
nvidia-curand-cu12       10.3.9.90
nvidia-cusolver-cu12     11.7.3.90
nvidia-cusparse-cu12     12.5.8.93
nvidia-cusparselt-cu12   0.7.1
nvidia-nccl-cu12         2.27.5
nvidia-nvjitlink-cu12    12.8.93
nvidia-nvshmem-cu12      3.3.20
nvidia-nvtx-cu12         12.8.90
omegaconf                2.3.0
opencv-python            4.13.0.92
orjson                   3.11.3
packaging                25.0
pathspec                 0.12.1
pillow                   12.0.0
platformdirs             4.5.0
pluggy                   1.6.0
prompt-toolkit           3.0.52
propcache                0.4.1
psutil                   7.1.0
pycparser                2.23
pydantic                 2.12.3
pydantic-core            2.41.4
pydantic-settings        2.11.0
pydot                    4.0.1
pygit2                   1.18.2
pygments                 2.19.2
pygtrie                  2.5.0
pylint                   4.0.1
pyparsing                3.2.5
pytest                   8.4.2
pytest-cov               7.0.0
python-dateutil          2.9.0.post0
python-dotenv            1.1.1
pytorch-lightning        2.5.5
pyyaml                   6.0.3
requests                 2.32.5
rich                     14.2.0
ruamel-yaml              0.18.15
ruamel-yaml-clib         0.2.14
ruff                     0.15.17
s3fs                     2025.9.0
safetensors              0.6.2
scikit-learn             1.7.2
scipy                    1.16.2
scmrepo                  3.5.2
semver                   3.0.4
setuptools               80.9.0
shellingham              1.5.4
shortuuid                1.0.13
shtab                    1.7.2
six                      1.17.0
smmap                    5.0.2
sqltrie                  0.11.2
sympy                    1.14.0
tabulate                 0.9.0
threadpoolctl            3.6.0
timm                     1.0.20
tomlkit                  0.13.3
torch                    2.9.0
torchaudio               2.9.0
torchmetrics             1.8.2
torchsig                 2.1.1
torchvision              0.24.0
tqdm                     4.67.1
triton                   3.5.0
typer                    0.19.2
typing-extensions        4.15.0
typing-inspection        0.4.2
tzdata                   2025.2
urllib3                  2.5.0
vine                     5.1.0
voluptuous               0.15.2
wcwidth                  0.2.14
wrapt                    1.17.3
yarl                     1.22.0
zc-lockfile              4.0

Description

From the Torchsig-generated HDF5 file:

Image Image Image

Some instancies in the generated HDF5 dataset have their lower and upper frequencies with flipped sign.

How to Reproduce the Bug

Any command that uses a TorchSigIterableDataset object, e.g.:

iter_dataset = TorchSigIterableDataset(
    signal_generators=signal_generators,
    metadata=dataset_metadata,
    transforms=[impairments.dataset_transforms, Spectrogram(fft_size=cfg.data.ex.trace.n_samples)],
    component_transforms=[impairments.signal_transforms],
    target_labels=cfg.data.target,
    seed=cfg.data.seed,
)

dataloader = WorkerSeedingDataLoader(
    iter_dataset,
    batch_size=cfg.process.batch_size,
    num_workers=cfg.process.n_workers,
    collate_fn=default_collate_fn,
)

dataset_creator = DatasetCreator(
    dataset_length=cfg.data.ex.n,
    dataloader=dataloader,
    root=data_prefix,
    overwrite=cfg.process.is_overwrite,
    multithreading=cfg.process.is_multithreading,
)
dataset_creator.create()

An MWE can be generated and one can see that happening for some spectrograms

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions