Example #1
0
    def chanDescToStr(self, chanInfo): # chanInfo is a result of channelinfo or elem of getChannels's result
        result = ""
        for p in chanInfo["particles"]:
            if p[0] != "" and p[0] != None:
                result += p[0]
            if p[1] == None:
                if p[2] != None:
                    result += " < " + goodPrecision(p[2])
            elif p[2] == None:
                result += " > " + goodPrecision(p[1])
            else:
                result += " %s - %s" % (goodPrecision(p[1]), goodPrecision(p[2]))
#            if chanInfo.has_key("unit") and chanInfo["unit"] != None and chanInfo["unit"] != "":
            result += " " + chanInfo["unit"] + ", "
        return (result + chanInfo["comment"])
Example #2
0
 def channelDescriptionToString(self, chanInfo): # chanInfo is a result of channelinfo or elem of getChannels's result
     result = ""
     for p in chanInfo["particles"]:
         if p[0] != "" and p[0] != None:
             result += p[0][0].upper() + p[0][1:] + "s"
         if p[1] == None:
             if p[2] != None:
                 result += " < " + goodPrecision(p[2])
         elif p[2] == None:
             result += " > " + goodPrecision(p[1])
         else:
             if p[1] == p[2]:
                 result += " %s" % goodPrecision(p[1])
             else:
                 result += " %s - %s" % (goodPrecision(p[1]), goodPrecision(p[2]))
         result += " " + chanInfo["energyunit"] + ", "
     if chanInfo["comment"].strip() == "":
         result = result[:-2]
     elif result.replace(",", '').strip() == "":
         result = "<i>%s</i>" % chanInfo["comment"]
     else:
         result += "<i>%s</i>" % chanInfo["comment"]
     return result