# verify whether the elements are all indexes or not
self.all_indexes=True
foreleminself.splitted:
try:
elem=float(elem)# try to convert to float
except:
pass# nothing happens
finally:
self.all_indexes=False
defindicise(self,keylist):
foriinrange(len(keylist)):
key=keylist[i]
ifisinstance(key,str):
ifkeyinself.splitted:
keylist[i]=self.splitted.index(key)
else:
raiseException("Invalid argument: no key was found to match the input line to match",key)
elifisinstance(key,int):
pass
else:
keylist[i]=int(key)# try to convert it to an integer index
returnkeylist
#
# Load a specified columns
# filename: input file name which you load the data
# *columns: name or index of the column containing the data to be loaded (!! indexes start from 0)
# **kargs:
# - uncertainty =
# - str: column which contains the uncertainty
# - float/int: constant uncertainty
# - tuple/list: apply the incertainty to the corresponding column in order of passed argument depending on the elements' type
# - transform = apply a functor once the data are loaded
# - functor: apply to all data
# - tuple/list: apply the functor to the corresponding column in order of passed argument (!! the array size must correspond, theelements must be functors)
# - sigdigit = significant digit needed to construct a Measure once the data are loaded
# - int: apply to all data
# - tuple/list: apply the significant digits to the corresponding column in order of passed argument (!! the array size must correspond, elements must be integers)
# - verbose = say everything is happening loading values (!! it must be convertible to a boolean)
# - sep = column separator character (!! it must be convertible to char)
#
defloadMeasures(filename,*columns,**kargs):
iflen(columns)==0:
raiseException("Invalid argument: entering an empty column set")