<jupyter_start><jupyter_text>Get the series-connected voltages<jupyter_code>plt.plot(test_v,sq1_cell.get_j_from_v(test_v),'.-',label="cell 1")
plt.plot(test_v,sq2_cell.get_j_from_v(test_v),'.-',label="cell 2")
plt.plot(results_1[:,0],results_1[:,1],'-.',label="solved cell 2 voltage from cell 1 current")
plt.plot(results_2[:,0],results_2[:,1],'-.',label="solved cell 2 voltage from cell 2 current")
plt.legend()
plt.ylim([-400,1000])
def merge_iv_sets(v1,j1,v2,j2):
    
    v3=np.concatenate((v1,v2))
    j3=np.concatenate((j1,j2))
    
    sorted_v3_index=np.argsort(v3)
    
    return v3[sorted_v3_index],j3[sorted_v3_index]
    
v3,j3=merge_iv_sets(results_1[:,0],results_1[:,1],results_2[:,0],results_2[:,1])
plt.plot(test_v,sq1_cell.get_j_from_v(test_v),'.-',label="cell 1")
plt.plot(test_v,sq2_cell.get_j_from_v(test_v),'.-',label="cell 2")
plt.plot(v3,j3,'.-',label="solved cell 2 voltage from cell 1 and 2 current")
plt.legend()
plt.ylim([-400,1000])<jupyter_output><empty_output><jupyter_text>get current of cell 1 using j3<jupyter_code>def f6(x,x_0):
    return sq1_cell.get_j_from_v(x)-x_0<jupyter_output><empty_output><jupyter_text>result_3=[]for jj in j3:       try:        result_3.append((bisect(f6,-23,5,args=jj),jj))    except ValueError:        print("no solution found for {}".format(jj))                                                  result_3=np.array(result_3)<jupyter_code>from pypvcell.ivsolver import solve_v_from_j_adding_epsilon
result_3=solve_v_from_j_adding_epsilon(sq1_cell.get_j_from_v,j3,bisect,epsilon=0)
plt.plot(test_v,sq1_cell.get_j_from_v(test_v),'.-',label="cell 1")
plt.plot(test_v,sq2_cell.get_j_from_v(test_v),'.-',label="cell 2")
#plt.plot(v3,j3,'.-',label="solved cell 2 voltage from cell 1 and 2 current")
#plt.plot(result_3[:,0],result_3[:,1],'.')
plt.plot(result_3[:,0],result_3[:,1],'.')
plt.legend()
plt.ylim([-400,1000])
plt.plot(result_3[:,0],result_3[:,1],'.-')
plt.plot(v3,result_3[:,1],'.-')
plt.plot(v3+result_3[:,0],result_3[:,1],'.-',label="solved ")
plt.ylim([-500,100])
plt.xlim([-5,3])
plt.legend()
iv_funcs=[sq1_cell.get_j_from_v,sq2_cell.get_j_from_v]
from pypvcell.ivsolver import solve_series_connected_ivs
iv_pair=solve_series_connected_ivs(iv_funcs=iv_funcs,vmin=-3,vmax=3,vnum=100)
plt.plot(iv_pair[:,0],iv_pair[:,1],'.-')<jupyter_output><empty_output><jupyter_text>Try out more cells<jupyter_code>sq1_cell=SQCell(eg=1.42,cell_T=300,plug_in_term=rev_diode)
sq1_cell.set_input_spectrum(load_astm("AM1.5d")*0.5)

sq2_cell=SQCell(eg=1.42,cell_T=300,plug_in_term=rev_diode)
sq2_cell.set_input_spectrum(load_astm("AM1.5d"))

sq3_cell=SQCell(eg=1.42,cell_T=300,plug_in_term=rev_diode)
sq3_cell.set_input_spectrum(load_astm("AM1.5d"))

sq4_cell=SQCell(eg=1.42,cell_T=300,plug_in_term=rev_diode)
sq4_cell.set_input_spectrum(load_astm("AM1.5d")*1.5)

sq5_cell=SQCell(eg=1.42,cell_T=300,plug_in_term=rev_diode)
sq5_cell.set_input_spectrum(load_astm("AM1.5d")*0.75)
iv_funcs=[sq1_cell.get_j_from_v,sq2_cell.get_j_from_v,sq3_cell.get_j_from_v,sq4_cell.get_j_from_v,sq5_cell.get_j_from_v]
iv_pair=solve_series_connected_ivs(iv_funcs=iv_funcs,vmin=-3,vmax=3,vnum=300)
volt=np.linspace(-3,3,num=300)
plt.plot(volt,sq1_cell.get_j_from_v(volt))
plt.plot(volt,sq2_cell.get_j_from_v(volt))
plt.plot(volt,sq4_cell.get_j_from_v(volt))
plt.plot(volt,sq5_cell.get_j_from_v(volt))

plt.plot(iv_pair[:,0],iv_pair[:,1],'.-')
plt.ylim([-500,0])
plt.xlim([-5,6])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18893740902474526, 'fraction_numerical': 0.06433770014556041, 'mean_word_length': 8.311653116531165, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '619323', 'license': 'Apache-2.0', 'n_tokens_mistral': 1707, 'n_tokens_neox': 1621, 'n_words': 128, 'path': 'lab/I-V solver 2019-10-02.ipynb', 'repo_name': 'kanhua/pypvcell', 'size': '3435'}