Skip to content

An error occurred when using wavelet ezmsg.sigproc.wavelets.cwt #41

Description

@RuolingWu

I came across the following error when I used ezmsg.sigproc.wavelets.CWT to do wavelet transform:

2024-11-03 09:59:44.909 - pid: 36349 - TaskThread - WARNING - windowing: windowing is non-deterministic with zero_pad_until='input' as it depends on the size of the first input. We recommend using 'shift' when window_shift is float-valued.
2024-11-03 09:59:45.005 - pid: 36349 - TaskThread - INFO - on_signal: Traceback (most recent call last):
File "/Users/rwu/anaconda3/envs/umcuezmsg/lib/python3.12/site-packages/ezmsg/sigproc/base.py", line 32, in on_signal
ret = self.STATE.gen.send(message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/rwu/anaconda3/envs/umcuezmsg/lib/python3.12/site-packages/ezmsg/sigproc/wavelets.py", line 108, in cwt
template = AxisArray(
^^^^^^^^^^
File "<string>", line 7, in init
File "/Users/rwu/anaconda3/envs/umcuezmsg/lib/python3.12/site-packages/ezmsg/util/messages/axisarray.py", line 72, in post_init
raise ValueError("dims contains repeated dim names")
ValueError: dims contains repeated dim names

The error occurred in line 109-119, wavelets.py (https://github.com/ezmsg-org/ezmsg-sigproc/blob/main/src/ezmsg/sigproc/wavelets.py)

template = AxisArray(
                np.zeros(
                    dummy_shape, dtype=dt_cplx if wavelet.complex_cwt else dt_data
                ),
                dims=msg_in.dims[:ax_idx] + msg_in.dims[ax_idx + 1 :] + ["freq", axis],
                axes={
                    **msg_in.axes,
                    "freq": AxisArray.Axis("Hz", offset=freqs[0], gain=fstep),
                },
            )

I checked the value of dims=msg_in.dims[:ax_idx] + msg_in.dims[ax_idx + 1 :] + ["freq", axis]. The result I got is ['freq', ‘ch', ‘freq', ‘time']. It seems that the two ‘freq’ caused the error.

And here’s the node I created for the wavelet transform:

"GET_WAVELETS": CWT(scales=scales, wavelet="cmor3.0-0.5", min_phase=MinPhaseMode.HOMOMORPHIC, axis='time')

Environment information:
Python version: 3.12
Conda version: conda 24.4.0
Os: MacOs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions