import config # config module for the calibcant package
import data_logger
import linfit
+from splittable_kwargs import splittableKwargsFunction, \
+ make_splittable_kwargs_function
def C_to_K(celsius) :
"Convert Celsius -> Kelvin."
return celsius + 273.15
+def K_to_K(kelvin) :
+ "Convert Kelvin -> Kelvin."
+ return kelvin
+
+@splittableKwargsFunction()
def T_analyze(T, convert_to_K=C_to_K) :
"""
Not much to do here, just convert to Kelvin.
T = [convert_to_K(T)]
return T
+@splittableKwargsFunction()
def T_save(T, log_dir=None) :
"""
Save either a single T (if you are crazy :p),
dl = data_logger.data_load()
return dl.read_binary(datafile)
-def T_plot(T, plotVerbose) :
+@splittableKwargsFunction()
+def T_plot(T, plotVerbose=False) :
"""
Umm, just print the temperature?
"""
if plotVerbose or PYLAB_VERBOSE or TEXT_VERBOSE :
print "Temperature ", T
-def T_load_analyze_tweaked(tweak_file, convert_to_K=C_to_K, textVerboseFile=None) :
+@splittableKwargsFunction((T_analyze, 'T', 'convert_to_K'),
+ (T_plot, 'T'))
+def T_load_analyze_tweaked(tweak_file, convert_to_K=C_to_K, textVerboseFile=None, **kwargs) :
"Load all the T array files from a tweak file and return a single array"
+ T_analyze_kwargs,T_plot_kwargs = \
+ T_load_analyze_tweaked._splitargs(T_load_analyze_tweaked, kwargs)
Ts = []
for line in file(tweak_file, 'r') :
parsed = line.split()
# read the data
data = T_load(path)
Ts.extend(data)
+ T_analyze(Ts, convert_to_K=K_to_K)
return numpy.array(Ts, dtype=numpy.float)
# commandline interface functions