Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-13403

numpy types fail in butler dataIds

    Details

    • Templates:
    • Story Points:
      1
    • Team:
      Architecture
    • Urgent?:
      No

      Description

      The np.int64 type appears to be treated differently from the built-in python int type in butler dataIds. As an example:

      In [9]: butler.datasetExists('src',dataId={'visit':13376, 'ccd':15})
      Out[9]: True
       
      In [10]: butler.datasetExists('src',dataId={'visit':13376, 'ccd':np.int64(15)})
      Out[10]: False
      

      However, if one attempts to use that `np.int64` type in a butler.get, it raises an exception with the value appearing without its type (str(15) and str(np.int64(15)) are the same), which is extremely confusing to the user.

      NoResults: No locations for get: datasetType:src dataId:DataId(initialdata={'visit': 13376, 'ccd': 15}, tag=set())
      

      Note also that hash(15) == hash(np.int64(15)), so there is a general expectation that these will behave similarly.

        Attachments

          Activity

            People

            • Assignee:
              salnikov Andy Salnikov
              Reporter:
              Parejkoj John Parejko
              Reviewers:
              Jim Bosch
              Watchers:
              Andy Salnikov, Eli Rykoff, Jim Bosch, John Parejko, John Swinbank, Kian-Tat Lim, Russell Owen, Tim Jenness, Yusra AlSayyad
            • Votes:
              2 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel