Supplemental material, Pacheco et al., “Joint Profile Characteristics of Long-Latency Transient Evoked and Distortion Otoacoustic Emissions,” AJA, https://doi.org/10.1044/2022_AJA-21-00182 Supplemental Material S2. Python script used in the current study to fit each gain function with the model equation. import numpy as np from scipy.optimize import curve_fit import xlrd # Main fit function # def func(A, G0, Act, alpha): return (G0/((1 + (A/Act))**alpha)) def p_to_dB(p): return 20*np.log10(p/20) def dB_to_p(I): return 20*(10**(I/20)) def main(n): path = 'file_location' data = xlrd.open_workbook(path+'gain_function_data.xlsx') sheet = data.sheet_by_index(3) x, y = [], [] for i in range(16,26): if type(sheet.cell_value(i,n))==float: x.append(sheet.cell_value(i,0)) y.append(sheet.cell_value(i,n)) popt, pcov = curve_fit(func, x, y, bounds=((dB_to_p(-50), dB_to_p(20), 0),(dB_to_p(-10), dB_to_p(65), 5))) y1 = func(x, *popt) # R^2 value for the curve fitting residuals = y - y1 ss_res = np.sum(residuals**2) ss_tot = np.sum((y - np.mean(y))**2) r_squared = 1 - (ss_res / ss_tot) print("R_squared value is: "+str(r_squared)) Peak_str = p_to_dB(popt[0]) # Peak strength in dB Comp_thresh = p_to_dB(popt[1]) # Compression threshold in dB # print("Peak strength, G0 = "+str(Peak_str)+" dB") # print("Compression slope, alpha = "+str(popt[2])) # print("Compression Threshold, Act = "+str(Comp_thresh)+" dB") F = open(path+"\\out.txt", 'a') F.write("\n"+str(Peak_str)+" "+str(Comp_thresh)+" "+str(popt[2])+" "+str(r_squared)) F.close() if __name__ == "__main__": path = "file_location" file = open(path+"\\out.txt", 'w') file.write("Peak_strength Compression_Threshold alpha R_squared") file.close() for i in range(16,21): main(i+1)