Skip to content

Commit

Permalink
GH AllenInstitute#533 - Default to vm_delta_mv if autobias_v is None
Browse files Browse the repository at this point in the history
If autobias_v is None for a given sweep, then default to previous method
of measuring delta between pre and post-stimulus baselines as vm_delta_mv.
  • Loading branch information
ru57y34nn committed Oct 8, 2021
1 parent e326010 commit 75972db
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
7 changes: 5 additions & 2 deletions ipfx/qc_feature_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,13 @@ def qc_current_clamp_sweep(sweep, is_ramp, qc_criteria=None):
fail_tags.append("slow noise: %.3f above threshold: %.3f" % (sweep["slow_noise_rms_mv"], qc_criteria["slow_noise_rms_mv_max"]) )

if sweep["pre_vm_delta_mv"] is not None and sweep["pre_vm_delta_mv"] > qc_criteria["vm_delta_mv_max"]:
fail_tags.append("pre Vm delta: %.3f above threshold:%.3f" % (sweep["pre_vm_delta_mv"], qc_criteria["vm_delta_mv_max"]))
fail_tags.append("pre Vm delta: %.3f above threshold: %.3f" % (sweep["pre_vm_delta_mv"], qc_criteria["vm_delta_mv_max"]))

if sweep["post_vm_delta_mv"] is not None and sweep["post_vm_delta_mv"] > qc_criteria["vm_delta_mv_max"]:
fail_tags.append("post Vm delta: %.3f above threshold:%.3f" % (sweep["post_vm_delta_mv"], qc_criteria["vm_delta_mv_max"]))
fail_tags.append("post Vm delta: %.3f above threshold: %.3f" % (sweep["post_vm_delta_mv"], qc_criteria["vm_delta_mv_max"]))

if sweep["vm_delta_mv"] is not None and sweep["vm_delta_mv"] > qc_criteria["vm_delta_mv_max"]:
fail_tags.append("Vm delta: %.3f above threshold: %.3f" % (sweep["vm_delta_mv"], qc_criteria["vm_delta_mv_max"]))

if fail_tags:
logging.info("sweep: {}, {}, {}".format(sweep["sweep_number"], sweep["stimulus_name"], fail_tags))
Expand Down
11 changes: 8 additions & 3 deletions ipfx/qc_feature_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,14 @@ def current_clamp_sweep_qc_features(sweep, is_ramp):
qc_features["pre_vm_mv"] = mean_first_stability_epoch
qc_features["slow_vm_mv"] = mean_first_stability_epoch
qc_features["slow_noise_rms_mv"] = rms_first_stability_epoch

qc_features["pre_vm_delta_mv"] = qcf.measure_vm_delta(mean_first_stability_epoch, autobias_v)
qc_features["post_vm_delta_mv"] = qcf.measure_vm_delta(mean_last_stability_epoch, autobias_v)
if autobias_v != None:
qc_features["pre_vm_delta_mv"] = qcf.measure_vm_delta(mean_first_stability_epoch, autobias_v)
qc_features["post_vm_delta_mv"] = qcf.measure_vm_delta(mean_last_stability_epoch, autobias_v)
qc_features["vm_delta_mv"] = None
else:
qc_features["vm_delta_mv"] = qcf.measure_vm_delta(mean_first_stability_epoch, mean_last_stability_epoch)
qc_features["pre_vm_delta_mv"] = None
qc_features["post_vm_delta_mv"] = None

return qc_features

Expand Down
16 changes: 16 additions & 0 deletions ipfx/qc_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ def measure_vm(vals):


def measure_vm_delta(mean_baseline, target_v):
"""Measure delta between mean baseline and autobias target voltage,
or if autobias is not available then measure delta between
pre and post stimulus baselines.
Parameters
----------
mean_baseline : float mean baseline membrane voltage
target_v : float autobias taget voltage or post-stimulus
mean baseline membrane voltage
Returns
-------
delta: absolute voltage diff
"""

if mean_baseline is not None and target_v is not None:
delta = abs(mean_baseline - target_v)
Expand Down

0 comments on commit 75972db

Please sign in to comment.