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

Improve debug functionality to the brighter fatter kernel generation task

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Invalid
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Add debug functionality to the brighter fatter kernel generation task.

      Title generation code that was removed from position 1:

                  # this is awkward now that code is refactored
                  # not sure how best to make this work without passing everything around
                  # if self.debug.enabled:
                  #     rawMeans = [afwMath.makeStatistics(im.getMaskedImage(), afwMath.MEANCLIP).getValue() \
                  #                 for im in [exp1, exp2]]
                  #     title = "Visits %s; %s, Detectors %s <I> = ",
                  #             "%.3f (%s) Var = %.4f" % (self._getNameOfSet([v1]),
                  #                                       self._getNameOfSet([v2]),
                  #                                       self._getNameOfSet([detNum]),
                  #                                       _means1+rawMeans[1],
                  #                                       im1.getFilter().getName(),
                  #                                       float(xcorr[0, 0]) / (_means1+rawMeans[1]))
                  #
                  #     detObjId = str(detNum)
                  #     if level=='AMP': detObjId += ampName
                  #     fileName = (os.path.join(self.debug.debugPlotPath, '_'.join(['xcorr_visit', str(v1),
                  #                                                                  str(v2), 'detector',
                  #                                                                  str(detNum)])))
                  #     fileName += self.debug.plotType
                  #     self._plotXcorr(xcorr.copy(), (xcorrMeans[0]+means[1]),
                  #                     title=title, saveToFileName=fileName)

      Code from position 2:

       

              # xxx to reinstate this debug block need to work out what 'means' was before the refactor
              # and why this is even interesting. Probably just remove the whole thing
              # xcorr_full = self._tileArray(xcorr)
              # self.log.debug(sum(means), xcorr[0, 0], np.sum(xcorr_full), xcorr[0, 0]/sum(means),
              #                np.sum(xcorr_full)/sum(means))

       

      Title generating:

                  if self.debug.enabled:
                      try:
                          frameId1 = exp1.getMetadata().get("FRAMEID")
                          frameId2 = exp2.getMetadata().get("FRAMEID")
                          frameId = '_diff_'.join(frameId1, frameId2)
                      except Exception:
                          frameId = 'Im1 diff Im2'

        Attachments

          Issue Links

            Activity

            Hide
            mfisherlevine Merlin Fisher-Levine added a comment - - edited

            This work might also involve this snippet for naming things which I'm removing:

             

                @staticmethod
                def _getNameOfSet(vals):
                    """Convert a list of numbers to a string, merging consecutive values."""
                    if not vals:
                        return ""        def _addPairToName(valName, val0, val1):
                        """Add a pair of values, val0 and val1, to the valName list."""
                        sval1 = str(val1)
                        if val0 != val1:
                            pre = os.path.commonprefix([str(val0), sval1])
                            sval1 = int(sval1[len(pre):])
                        valName.append("%s-%s" % (val0, sval1) if val1 != val0 else str(val0))        valName = []
                    val0 = vals[0]
                    val1 = val0
                    for val in vals[1:]:
                        if isinstance(val, int) and val == val1 + 1:
                            val1 = val
                        else:
                            _addPairToName(valName, val0, val1)
                            val0 = val
                            val1 = val0        _addPairToName(valName, val0, val1)        return ", ".join(valName)

            Show
            mfisherlevine Merlin Fisher-Levine added a comment - - edited This work might also involve this snippet for naming things which I'm removing:   @staticmethod def _getNameOfSet(vals): """Convert a list of numbers to a string, merging consecutive values.""" if not vals: return "" def _addPairToName(valName, val0, val1): """Add a pair of values, val0 and val1, to the valName list.""" sval1 = str(val1) if val0 != val1: pre = os.path.commonprefix([str(val0), sval1]) sval1 = int(sval1[len(pre):]) valName.append("%s-%s" % (val0, sval1) if val1 != val0 else str(val0)) valName = [] val0 = vals[0] val1 = val0 for val in vals[1:]: if isinstance(val, int) and val == val1 + 1: val1 = val else: _addPairToName(valName, val0, val1) val0 = val val1 = val0 _addPairToName(valName, val0, val1) return ", ".join(valName)

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              mfisherlevine Merlin Fisher-Levine
              Watchers:
              Merlin Fisher-Levine
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins Builds

                  No builds found.