Skip to content

Bug: setting value jumps when type is int32 #7203

Open

Description

@user123369

I initialize a voltage.step value but, when I try to set a voltage value on my SMU I get the error 'cannot sweep voltage from numberx to numbery - jumping' when the number I am setting is of type np.int32, when I change the setting value type to np.float64 I no longer get this error and my ramp works fine.

  • the return of this parameter from the instrument is float.
  • instrument.voltage(np.int64(numbery)) & instrument.voltage(np.float32(numbery)) give the same behavior (no ramp) .
  • after changing to float or np.float64 from one of the types that don't work, the next immediate set gives the same error but, any subsequent set works fine (until the type is changed back to one of the ones that dont work, then it immediatley gives the error without even working for one more set).

Activity

  1. jenshnielsen commented on Jun 12, 2025

    @jenshnielsen
    Collaborator

    user123369 That is surprising. The logic that checks for this is in get_ramp_values in parameter base

    It checks that start and stop are of the correct type using

    if not (
        isinstance(start_value, NumberType) and isinstance(value, NumberType)
    ):
    

    Where number type is

    NumberType: TypeAlias = int | float | np.integer | np.floating

    When I try to do

    isinstance(np.int32(1), NumberType)
    

    This returns True as expected.

    Could you provide

    Which version of qcodes?
    Which version of numpy?

    What is the outcome of

    import numpy as np
    NumberType = int | float | np.integer | np.floating
    isinstance(np.int32(1), NumberType)
    
  2. user123369 commented on Jun 12, 2025

    @user123369
    Author

    numpy - 1.26.4
    qcodes - 0.45.0

    return of given code is TRUE

    note this issue seems to happen for all the drivers I am using, including ones from the qcodes_contrib_drivers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions