Uploaded image for project: 'DRP 2-D Pipeline'
  1. DRP 2-D Pipeline
  2. PIPE2D-981

ReferenceLineSet.sort() fails

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done (View Workflow)
    • Priority: Normal
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Story Points:
      1

      Description

      The following example:

      from pfs.drp.stella import ReferenceLine, ReferenceLineSet
      lines=[]
      lines.append(ReferenceLine('OH', 3456.0, 1.234, 0))
      lines.append(ReferenceLine('NaI', 1234.0, 3.0, 0))
      lineSet = ReferenceLineSet.fromRows(lines)
      lineSet.sort()
      

      fails with the following error:

      ---------------------------------------------------------------------------
      KeyError                                  Traceback (most recent call last)
      <ipython-input-80-beabf8b7f75f> in <module>
            4 lines.append(ReferenceLine('NaI', 1234.0, 3.0, 0))
            5 lineSet = ReferenceLineSet.fromRows(lines)
      ----> 6 lineSet.sort()
      
      /tigress/hassans/software/drp_stella/python/pfs/drp/stella/referenceLine.py in sort(self)
          159         Lines are sorted by species and then by wavelength.
          160         """
      --> 161         self.data.sort_values(("description", "wavelength", "status"), inplace=True)
          162 
          163     def writeLineList(self, filename):
      
      /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/pandas/core/frame.py in sort_values(self, by, axis, ascending, inplace, kind, na_position)
         4717 
         4718             by = by[0]
      -> 4719             k = self._get_label_or_level_values(by, axis=axis)
         4720 
         4721             if isinstance(ascending, (tuple, list)):
      
      /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/pandas/core/generic.py in _get_label_or_level_values(self, key, axis)
         1704             values = self.axes[axis].get_level_values(key)._values
         1705         else:
      -> 1706             raise KeyError(key)
         1707 
         1708         # Check for duplicates
      
      KeyError: ('description', 'wavelength', 'status')
      

      Please fix.

        Attachments

          Activity

            People

            • Assignee:
              hassan hassan
              Reporter:
              hassan hassan
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: