AllenInstitute / ipfx

computes intrinsic cell features from intracellular electrophysiology data
https://ipfx.readthedocs.io/en/latest/
Other
27 stars 36 forks source link

Gh-513/check in-bath electrode resistance before extracting baseline electrode current #514

Closed ru57y34nn closed 3 years ago

ru57y34nn commented 3 years ago

Overview:

Verify electrode resistance of EXTPINBATH sweep before extracting e0

This commit checks the value of the electrode resistance (eR) before extracting the value of the electrode baseline current (e0) with extract_electrode_0 in qc_feature_extractor.py. After the sweep containing the in-bath data (EXTPINBATH) is identified, eR is extracted with measure_input_resistance and then e0 is only extracted if eR is less than the max allowable electrode resistance (max_eR). If eR is found to exceed max_eR the e0 is set to None and a new tag is applied, indicating that eR exceeded max_eR.

Addresses:

Addresses issue https://github.com/AllenInstitute/ipfx/issues/513#issue-866275415

Type of Fix:

Solution:

This solution first gets the value of the electrode resistance for the EXTPINBATH sweep with measure_input_resistance in qc_features and then checks that value to ensure that it is below the maximum allowable electrode resistance as outlined in the Electrophysiology white paper. The baseline current of the electrode (e0) is extracted only if the electrode resistance is below the max electrode resistance, and if it exceeds the max electrode resistance then e0 is set to None and the new tag which indicates that the pipette resistance is out of range is appended to the tags list.

Changes:

Validation:

This is a pretty simple and straight forward change that does not break anything. This change is inside of the extract_electrode_0 function which does not have any tests so I have not included any tests, but if needed I can refactor my changes into their own function for testing, but these changes really only introduce a call to measure_input_resistance, which is already tested, and the comparison operator '<' for comparing eR to max_eR.

Screenshots:

Unit Tests:

Script to reproduce error and fix:

Configuration details:

Checklist

Notes:

Please let me know unit tests are still needed for such a small change and I can refactor and add those in.

sgratiy commented 3 years ago

closed per @ru57y34nn comment