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

casting problem float <-> double #106

Open
cVogl97 opened this issue Feb 5, 2025 · 0 comments
Open

casting problem float <-> double #106

cVogl97 opened this issue Feb 5, 2025 · 0 comments

Comments

@cVogl97
Copy link

cVogl97 commented Feb 5, 2025

The LEGEND ICPC DSP config json file contains processors which take arguments where the data type has to be specified. Two examples are tail_pars and wf_cusp:

    "tail_pars": {
      "description": "finds ",
      "function": "poly_fit",
      "module": "dspeed.processors",
      "args": [
        "wf_logged[round(60*us, wf_logged.period):]",
        "tail_pars(5, 'f')"
      ],
      "init_args": ["len(wf_logged[round(60*us, wf_logged.period):])", "4"],
      "unit": "ADC"
    },
    "wf_cusp": {
      "description": "convolve optimised cusp filter",
      "function": "convolve_wf",
      "module": "dspeed.processors",
      "args": [
        "wf_blsub[:round(len(wf_blsub)-(33.6*us/wf_blsub.period))]",
        "cusp_kernel",
        "'v'",
        "wf_cusp(round((4.8*us/wf_blsub.period)+2), 'f')"
      ],
      "unit": "ADC"
    },

The relevant lines are tail_pars(5, 'f') and wf_cusp(round((4.8*us/wf_blsub.period)+2), 'f'). In both cases, the 'f' signifies the data type of the array elements to be float. Using the processors like this does not work universally on all machines. Both build_dsp() and run_one_dsp() return exclusively arrays which are full of zeros for tail_pars and wf_cusp, when running on a local server at TUM.

Using the processors manually via from dspeed.processors import poly_fit, etc. works just fine. The issue only arises when a DSP config is used. I created a jupyter notebook to showcase this problem and attached it here (I cannot upload HTML to GitHub).

Hotfix: If you have a similar problem, the "solution" is to use double as the datatype, i.e. changing the 'f' to a 'd' in both cases above.

Goal: Make dspeed robust(er) against type conversion.

float_conversion_bug_cusp.pdf

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