Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message with invalid gaussian_filter1d init_args #118

Open
gipert opened this issue Feb 24, 2025 · 0 comments
Open

Error message with invalid gaussian_filter1d init_args #118

gipert opened this issue Feb 24, 2025 · 0 comments

Comments

@gipert
Copy link
Member

gipert commented Feb 24, 2025

This config:

outputs:
  - wf_current

processors:
  wf_gaus:
    description: Gaussian-filtered raw waveform
    function: gaussian_filter1d
    module: dspeed.processors
    args:
      - waveform_bit_drop
      - wf_gaus(
          len(waveform_bit_drop),
          period=waveform_bit_drop.period,
          offset=waveform_bit_drop.offset
        )
    init_args:
      - db.gauss.width
      - "10"
    defaults:
      db.gauss.width: 2
    unit: ADC

  wf_current:
    description: First derivative of gaussian-filtered waveform
    function: avg_current
    module: dspeed.processors
    args:
      - wf_gaus
      - db.current.width
      - wf_current(
          len(wf_gaus) - db.current.width,
          period=wf_gaus.period,
          offset=wf_gaus.offset + db.current.width // 2 * wf_gaus.period
        )
    defaults:
      db.current.width: 2
    unit: ADC/sample

causes this:

2025-02-24 23:52:47,675 - dspeed - DEBUG - build_processing_chain -  2225 - prereqs for wf_gaus are ['waveform_bit_drop']
2025-02-24 23:52:47,675 - dspeed - DEBUG - build_processing_chain -  2197 - Database lookup: using default value of 2 for db.current.width
2025-02-24 23:52:47,675 - dspeed - DEBUG - build_processing_chain -  2197 - Database lookup: using default value of 2 for db.current.width
2025-02-24 23:52:47,675 - dspeed - DEBUG - build_processing_chain -  2197 - Database lookup: using default value of 2 for db.current.width
2025-02-24 23:52:47,675 - dspeed - DEBUG - build_processing_chain -  2225 - prereqs for curr are ['wf_gaus']
2025-02-24 23:52:47,675 - dspeed - DEBUG - build_processing_chain -  2281 - processing parameters: ['wf_gaus', 'curr']
2025-02-24 23:52:47,675 - dspeed - DEBUG - build_processing_chain -  2282 - required input parameters: ['waveform_bit_drop']
2025-02-24 23:52:47,675 - dspeed - DEBUG - build_processing_chain -  2283 - copied output parameters: []
2025-02-24 23:52:47,675 - dspeed - DEBUG - build_processing_chain -  2284 - processed output parameters: ['curr']
2025-02-24 23:52:47,676 - dspeed - DEBUG - __init__ -  203 - added variable: waveform_bit_drop(shape: auto, dtype: auto, grid: auto, unit: auto, is_coord: auto)
2025-02-24 23:52:47,676 - dspeed - DEBUG - __init__ -  203 - added variable: waveform_bit_drop_dt(shape: (), dtype: float32, grid: None, unit: ns, is_coord: True)
2025-02-24 23:52:47,676 - dspeed - DEBUG - update_auto -  363 - updated variable: waveform_bit_drop(shape: (1024,), dtype: uint16, grid: (16.0 nanosecond,waveform_bit_drop_dt), unit: None, is_coord: False)
2025-02-24 23:52:47,678 - dspeed - DEBUG - link_input_buffer -  588 - added input buffer: waveform_bit_drop linked to lgdo.WaveformTable(values(shape=(1000, 1024), dtype=uint16, attrs={'datatype': 'array_of_equalsized_arrays<1,1>{real}'}), dt(shape=(1000,), dtype=float32, attrs={'datatype': 'array<1>{real}', 'units': 'ns'}), t0(shape=(1000,), dtype=float32, attrs={'datatype': 'array<1>{real}', 'units': 'ns'}))
2025-02-24 23:52:47,678 - dspeed - DEBUG - __init__ -  203 - added variable: wf_gaus(shape: auto, dtype: auto, grid: auto, unit: ADC, is_coord: auto)
2025-02-24 23:52:47,678 - dspeed - DEBUG - build_processing_chain -  2376 - database lookup: using default value of {db_node} for {db_var}
2025-02-24 23:52:47,678 - dspeed - DEBUG - build_processing_chain -  2402 - building function from init_args: gaussian_filter1d(2, 10)
2025-02-24 23:52:47,706 - dspeed - DEBUG - update_auto -  363 - updated variable: wf_gaus(shape: (1024,), dtype: auto, grid: (16.0 nanosecond,waveform_bit_drop_dt), unit: ADC, is_coord: auto)
2025-02-24 23:52:47,706 - dspeed - DEBUG - update_auto -  363 - updated variable: wf_gaus(shape: (1024,), dtype: float32, grid: (16.0 nanosecond,waveform_bit_drop_dt), unit: ADC, is_coord: False)
2025-02-24 23:52:47,707 - dspeed - DEBUG - add_processor -  701 - added processor: gaussian_filter1d_out(waveform_bit_drop, wf_gaus)
2025-02-24 23:52:47,707 - dspeed - DEBUG - __init__ -  203 - added variable: curr(shape: auto, dtype: auto, grid: auto, unit: ADC/sample, is_coord: auto)
2025-02-24 23:52:47,707 - dspeed - DEBUG - __init__ -  203 - added variable: (waveform_bit_drop_dt+16.0 nanosecond)(shape: auto, dtype: auto, grid: auto, unit: ns, is_coord: True)
2025-02-24 23:52:47,708 - dspeed - DEBUG - update_auto -  363 - updated variable: (waveform_bit_drop_dt+16.0 nanosecond)(shape: (), dtype: float32, grid: (1 nanosecond,0 nanosecond), unit: ns, is_coord: True)
2025-02-24 23:52:47,708 - dspeed - DEBUG - _parse_expr -  870 - added processor: add(waveform_bit_drop_dt, 16.0 nanosecond, (waveform_bit_drop_dt+16.0 nanosecond))
2025-02-24 23:52:47,709 - dspeed - DEBUG - update_auto -  363 - updated variable: curr(shape: (1022,), dtype: auto, grid: (16.0 nanosecond,(waveform_bit_drop_dt+16.0 nanosecond)), unit: ADC/sample, is_coord: auto)
2025-02-24 23:52:47,709 - dspeed - DEBUG - update_auto -  363 - updated variable: curr(shape: (1022,), dtype: float32, grid: (16.0 nanosecond,(waveform_bit_drop_dt+16.0 nanosecond)), unit: ADC/sample, is_coord: False)
2025-02-24 23:52:47,709 - dspeed - DEBUG - add_processor -  701 - added processor: avg_current(wf_gaus, 2, curr)
2025-02-24 23:52:47,711 - dspeed - DEBUG - link_output_buffer -  668 - added output buffer: curr linked to lgdo.WaveformTable(values(shape=(1000, 1022), dtype=float32, attrs={'datatype': 'array_of_equalsized_arrays<1,1>{real}'}), dt(shape=(1000,), dtype=float32, attrs={'datatype': 'array<1>{real}', 'units': 'ns'}), t0(shape=(1000,), dtype=float32, attrs={'datatype': 'array<1>{real}', 'units': 'ns'}))
Traceback (most recent call last):
  File "/data1/shared/l200-p13/prodenv/prod-orig/dev-v0.0.2/.snakemake/legend-dataflow/venv/bin/par-spms-dsp-trg-thr", line 10, in <module>
    sys.exit(par_spms_dsp_trg_thr())
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/data1/shared/l200-p13/prodenv/prod-orig/dev-v0.0.2/workflow/src/legenddataflow/scripts/par/spms/dsp/trigger_threshold.py", line 63, in par_spms_dsp_trg_thr
    chain.execute()
  File "/data1/shared/l200-p13/prodenv/prod-orig/dev-v0.0.2/.snakemake/legend-dataflow/venv/lib/python3.12/site-packages/dspeed/processing_chain.py", line 708, in execute
    self._execute_procs(i, min(i + self._block_width, self._buffer_len))
  File "/data1/shared/l200-p13/prodenv/prod-orig/dev-v0.0.2/.snakemake/legend-dataflow/venv/lib/python3.12/site-packages/dspeed/processing_chain.py", line 1120, in _execute_procs
    proc_man.execute()
  File "/data1/shared/l200-p13/prodenv/prod-orig/dev-v0.0.2/.snakemake/legend-dataflow/venv/lib/python3.12/site-packages/dspeed/processing_chain.py", line 1571, in execute
    self.processor(*self.args, **self.kwargs)
  File "/data1/shared/l200-p13/prodenv/prod-orig/dev-v0.0.2/.snakemake/legend-dataflow/venv/lib/python3.12/site-packages/numba/np/ufunc/gufunc.py", line 261, in __call__
    return self.ufunc(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: list index out of range

This is because

    init_args:
      - db.gauss.width
      - "10"

is an invalid initialization for the gaussian kernel, but dspeed should try to print a more informative error message?

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

No branches or pull requests

1 participant