<jupyter_start><jupyter_text>Open and modify files with python<jupyter_code>import sys
import fileinput
num=234e-6
n_found=0
text="* Simulación Circuito Espejo de Corriente con Ncmos, valores reales de Kp_n y Vt"+"\n"+ \
"* Universidad Nacional de Colombia 2016"+"\n"+ \
"* CMOS Analógico"+"\n"+ \
"* Grupo <NAME>, <NAME>"+"\n"+ \
"\n"+\
"VDD VDD 0 DC 10 AC 0"+"\n"+\
"V2 VR 0 DC 10 AC 0"+"\n"+\
"VRD RDN VR DC 0 AC 0"+"\n"+\
"RD RDN DRAIN 1000"+"\n"+\
"RP VDD GATE 2000"+"\n"+\
"M1 DRAIN GATE 0 0 nmos W=60 L=2"+"\n"+\
"M2 GATE GATE 0 0 nmos W=60 L=2"+"\n"+\
"\n"+\
"VRD2 RDN2 VR DC 0 AC 0"+"\n"+\
"RD2 RDN2 DRAIN2 1000"+"\n"+\
"RP2 VDD GATE2 2000"+"\n"+\
"M3 DRAIN2 GATE2 0 0 nmos2 W=60 L=2"+"\n"+\
"M4 GATE2 GATE2 0 0 nmos2 W=60 L=2"+"\n"+\
"\n"+\
".model nmos nmos LEVEL=1 Vto=0.8 KP=120u LAMBDA=0.01 U0=650"+"\n"+\
".model nmos2 nmos LEVEL=1 Vto=1.5 KP=130u LAMBDA=0.02 U0=600"+"\n"+\
"\n"+\
".control"+"\n"+\
"set color0 =white"+"\n"+\
"set color1=black"+"\n"+\
"op"+"\n"+\
"show all"+"\n"+\
"dc vdd 0 10 0.01"+"\n"+\
"plot i(vrd) i(vrd2)"+"\n"+\
".endc"+"\n"


for i, line in enumerate(fileinput.input('../spice-simulations/espejoNmosPythonFile.cir', inplace=1)):
    if i == 1: sys.stdout.write(text) # replace 'sit' and write
fileinput.close()
    if line.startswith('0.000234345') == True:
        n_found += 1
        sys.stdout.write('\n')
        sys.stdout.write(line.replace(line, ".model nmos nmos LEVEL=1 Vto=0.8 KP=120u LAMBDA=0.01 U0=650"+"\n"))
sys.stdout.write('\n')  # write a blank line after the 5th line
sys.stdout.write(line.replace('dsfsdfwewef**', str(num)))  # replace 'sit' and write<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.23006695069993913, 'fraction_numerical': 0.08399269628727937, 'mean_word_length': 3.835294117647059, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '219150', 'license': 'MIT', 'n_tokens_mistral': 868, 'n_tokens_neox': 782, 'n_words': 194, 'path': 'notebooks/Open and modify files.ipynb', 'repo_name': 'jagarzone6/cmos', 'size': '1664'}