projects
/
calibcant.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
calibrate.py should now work.
[calibcant.git]
/
calibcant
/
T_analyze.py
diff --git
a/calibcant/T_analyze.py
b/calibcant/T_analyze.py
index 7d46993ed9a9eca9e48f0934ca7125a4257ee104..d52475d86c7d8cfef67823c5fa6258492c5a8c11 100755
(executable)
--- a/
calibcant/T_analyze.py
+++ b/
calibcant/T_analyze.py
@@
-37,11
+37,18
@@
import common # common module for the calibcant package
import config # config module for the calibcant package
import data_logger
import linfit
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 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.
def T_analyze(T, convert_to_K=C_to_K) :
"""
Not much to do here, just convert to Kelvin.
@@
-54,6
+61,7
@@
def T_analyze(T, convert_to_K=C_to_K) :
T = [convert_to_K(T)]
return T
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),
def T_save(T, log_dir=None) :
"""
Save either a single T (if you are crazy :p),
@@
-81,15
+89,20
@@
def T_load(datafile=None) :
dl = data_logger.data_load()
return dl.read_binary(datafile)
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
"""
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"
"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()
Ts = []
for line in file(tweak_file, 'r') :
parsed = line.split()
@@
-99,6
+112,7
@@
def T_load_analyze_tweaked(tweak_file, convert_to_K=C_to_K, textVerboseFile=None
# read the data
data = T_load(path)
Ts.extend(data)
# 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
return numpy.array(Ts, dtype=numpy.float)
# commandline interface functions