You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# TODO Refactor this code into a single loop. There's no need to store each individual trace.
json_file_first_before=f"{readname}_{time_strs[0]}"json_file_last_before=f"{readname}_{time_strs[1]}"# Each Trace object contains two sweepsfirst_before_trace=Trace(filepath_first_before,
json_file_first_before)
last_before_trace=Trace(filepath_last_before,
json_file_last_before)
times=first_before_trace.get_times()
voltage=first_before_trace.get_voltage()
voltage_protocol=first_before_trace.get_voltage_protocol()
ramp_bounds=detect_ramp_bounds(times,
voltage_protocol.get_all_sections())
filepath_first_after=os.path.join(args.data_directory,
f"{readname}_{time_strs[2]}")
filepath_last_after=os.path.join(args.data_directory,
f"{readname}_{time_strs[3]}")
json_file_first_after=f"{readname}_{time_strs[2]}"json_file_last_after=f"{readname}_{time_strs[3]}"first_after_trace=Trace(filepath_first_after,
json_file_first_after)
last_after_trace=Trace(filepath_last_after,
json_file_last_after)
# Ensure that all traces use the same voltage protocolassertnp.all(first_before_trace.get_voltage() ==last_before_trace.get_voltage())
assertnp.all(first_after_trace.get_voltage() ==last_after_trace.get_voltage())
assertnp.all(first_before_trace.get_voltage() ==first_after_trace.get_voltage())
assertnp.all(first_before_trace.get_voltage() ==last_before_trace.get_voltage())
# Ensure that the same number of sweeps were usedassertfirst_before_trace.NofSweeps==last_before_trace.NofSweepsfirst_before_current_dict=first_before_trace.get_trace_sweeps()
first_after_current_dict=first_after_trace.get_trace_sweeps()
last_before_current_dict=last_before_trace.get_trace_sweeps()
last_after_current_dict=last_after_trace.get_trace_sweeps()
# Do leak subtraction and store traces for each well# TODO Refactor this code into a single loop. There's no need to store each individual trace.before_traces_first= {}
before_traces_last= {}
after_traces_first= {}
after_traces_last= {}
first_processed= {}
last_processed= {}
# Iterate over all wellsforwellinnp.array(all_wells).flatten():
first_before_current=first_before_current_dict[well][0, :]
first_after_current=first_after_current_dict[well][0, :]
last_before_current=last_before_current_dict[well][-1, :]
last_after_current=last_after_current_dict[well][-1, :]
before_traces_first[well] =get_leak_corrected(first_before_current,
voltage, times,
*ramp_bounds)
before_traces_last[well] =get_leak_corrected(last_before_current,
voltage, times,
*ramp_bounds)
after_traces_first[well] =get_leak_corrected(first_after_current,
voltage, times,
*ramp_bounds)
after_traces_last[well] =get_leak_corrected(last_after_current,
voltage, times,
*ramp_bounds)
# Store subtracted tracesfirst_processed[well] =before_traces_first[well] -after_traces_first[well]
last_processed[well] =before_traces_last[well] -after_traces_last[well]
voltage_protocol=VoltageProtocol.from_voltage_trace(voltage, times)
hergqc=hERGQC(sampling_rate=first_before_trace.sampling_rate,
plot_dir=plot_dir,
The text was updated successfully, but these errors were encountered:
pcpostprocess/scripts/run_herg_qc.py
Line 986 in cd60bd2
The text was updated successfully, but these errors were encountered: