make_splittable_kwargs_function
+@splittableKwargsFunction()
+def Vzp_bits2nm(data_bits, zpGain=config.zpGain,
+ zpSensitivity=config.zpSensitivity,
+ Vzp_out2V=config.Vzp_out2V):
+ scale_Vzp_bits2V = Vzp_out2V(1) - Vzp_out2V(0)
+ data_V = data_bits / scale_Vzp_bits2V
+ # bits / (bits/V) = V
+ data_nm = data_V * zpGain * zpSensitivity
+ return data_nm
+
+@splittableKwargsFunction()
+def Vphoto_bits2V(data_bits, Vphoto_in2V=config.Vphoto_in2V):
+ scale_Vphoto_bits2V = Vphoto_in2V(1) - Vphoto_in2V(0)
+ Vphoto_V = data_bits / scale_Vphoto_bits2V
+ # bits / (bits/V) = V
+ return Vphoto_V
+
+@splittableKwargsFunction((Vzp_bits2nm, 'data_bits'),
+ (Vphoto_bits2V, 'data_bits'))
+def slope_bitspbit2Vpnm(slope_bitspbit, **kwargs):
+ zp_kwargs,photo_kwargs = slope_bitspbit2Vpnm._splitargs(slope_bitspbit2Vpnm, kwargs)
+ Vzp_bits = 1.0
+ Vphoto_bits = slope_bitspbit * Vzp_bits
+ return Vphoto_bits2V(Vphoto_bits, **photo_kwargs)/Vzp_bits2nm(Vzp_bits, **zp_kwargs)
+
#@splittableKwargsFunction((bump_fit, 'zpiezo_output_bits',
-# 'deflection_input_bits'))
+# 'deflection_input_bits'),
+# (slope_bitspbit2Vpnm, 'slope_bitspbit'))
# Some of the child functions aren't yet defined, so postpone
# make-splittable until later in the module.
-def bump_analyze(data, zpGain=config.zpGain,
- zpSensitivity=config.zpSensitivity,
- Vzp_out2V=config.Vzp_out2V,
- Vphoto_in2V=config.Vphoto_in2V,
- **kwargs) :
+def bump_analyze(data, **kwargs) :
"""
Return the slope of the bump ;).
Inputs:
and THEN converted, so we're assuming that both conversions are LINEAR.
if they aren't, rewrite to convert before the regression.
"""
- bump_fit_kwargs, = bump_analyze._splitargs(bump_analyze, kwargs)
+ bump_fit_kwargs,slope_bitspbit2Vpnm_kwargs = \
+ bump_analyze._splitargs(bump_analyze, kwargs)
Vphoto2Vzp_out_bit = bump_fit(data['Z piezo output'],
data['Deflection input'],
**bump_fit_kwargs)
- scale_Vzp_bits2V = Vzp_out2V(1) - Vzp_out2V(0)
- scale_Vphoto_bits2V = Vphoto_in2V(1) - Vphoto_in2V(0)
- Vphoto2Vzp_out = Vphoto2Vzp_out_bit *scale_Vphoto_bits2V / scale_Vzp_bits2V
- # 1 / (Vzp/Vzp_out * Zp/Vzp * Zcant/Zp )
- Vzp_out2Zcant = 1.0/ (zpGain * zpSensitivity) # * 1
- return Vphoto2Vzp_out * Vzp_out2Zcant
+ return slope_bitspbit2Vpnm(Vphoto2Vzp_out_bit, **slope_bitspbit2Vpnm_kwargs)
def limited_quadratic(x, params):
"""
make_splittable_kwargs_function(bump_analyze,
(bump_fit, 'zpiezo_output_bits',
- 'deflection_input_bits'))
+ 'deflection_input_bits'),
+ (slope_bitspbit2Vpnm, 'slope_bitspbit'))
@splittableKwargsFunction((bump_analyze, 'data'))
def bump_load_analyze_tweaked(tweak_file, **kwargs):