def readSOM(self, som, lline): """ This method reads the #L line and sets up some initial information in the L{SOM.SOM}. @param som: The object to have its information read from file. @type som: L{SOM.SOM} @param lline: The line from the file containing the information to set @type lline: C{string} """ parts = lline.split() # Find the units units = [] count = 0 for part in parts: if part.startswith("("): units.append(count) count += 1 # Between thrid entry and first units is the y axis label label = parts[3:units[0]] som.setYLabel(" ".join(label)) # Next entry after that is the y axis units som.setYUnits(dst_utils.units_from_string(parts[units[0]]))
def __get_label_units(self, lline): """ This method strips out the axis label and units from the provided information. @param lline: The object containing the label and unit information. @type lline: C{string} @return: The axis label and units @rtype: C{tuple} of two C{string}s """ parts = lline.split() # The units sit at -2 in the list return (" ".join(parts[1:-2]), dst_utils.units_from_string(parts[-2]))