Unit 5: Punctuation

本文详细介绍了标点符号(逗号、撇号、分号)和引号(单引号、双引号)的正确用法,通过实例分析帮助读者掌握在不同场景下如何恰当地应用这些符号,提升写作表达的准确性和专业性。

PUNCTUATION

   
   
   


After your sentences are edited for agreement and parallel structure, you will read your paragraph looking specifically for punctuation. Since you have already finalized all the content of your paragraph (topic, topic sentence, details, concluding sentence) and crafted your writing style, you will re-read your paragraph a few more times. This time, you will only be looking for punctuation. Many students even read their work backwards, one sentence at a time, so as not to skip over words or punctuation. Other students will touch the tip of their pen or pencil to each word and punctuation mark to carefully consider each mark on the paper.

For this course, you will study three types of punctuation:

  • Commas
  • Apostrophes
  • Semicolons
Commas

You will remember from Unit 4 that commas are used in a variety of ways when punctuating clauses, phrases, and the four sentence types. A common mistake you may have been taught about commas is that if there is a pause, you need to insert a comma. Instead, if you understand how commas work in sentences, then you can think through whether or not you need a comma.

There are many rules for commas, but for this course, you will study a few rules that will help you the most at this stage. When you reread your paragraph, look closely at each comma to see if it fits into one of the following categories.

Commas with Introductory Elements

Use a comma after a word, phrase, or subordinate clause that precedes the main clause.

  • Finally, the antelope gave up and succumbed to the superior strength of the lion.
  • Humming softly to herself, Wilhelmina explored every inch of the hardware store.
  • Although he appeared innocent at first, the man’s story began to break down under the scrutiny of the detective’s questions.

Commas in a Series

Use a comma in between items in a series. In formal academic writing, the last comma is usually preferred.

  • Would you like one, two, or three scoops?
  • Clarence’s special trail mix contained peanuts, chili peppers, malt balls, and dried apricots.
  • Her analysis of the story argued that Leticia was actually confused upon first meeting Oscar, Mary herself benefited from the purloined letter, and the outcome of the story was comic rather than tragic.

Commas with Coordinating Conjunctions

As you will remember from Unit 4, use a comma after the first clause and before the coordinating conjunction in a compound sentence.

  • My favorite band is coming to town, so I will be camping out to get a ticket.
  • An assortment of visitors appeared at the gate, but the ambassador never acknowledged them.

Comma Splices and Fused Sentences

comma splice is an error that occurs when you join two independent clauses with a comma. Instead, use a coordinating conjunction, period, semicolon, or a semicolon and adverbial conjunction.

  • Comma Splice: The last time we saw him was in December, you won’t believe how much he has changed since then.
  • Correct: The last time we saw him was in December, but you won’t believe how much he has changed since then.
  • Correct: The last time we saw him was in December. You won’t believe how much he has changed since then.
  • Correct: The last time we saw him was in December; you won’t believe how much he has changed since then.
  • Correct: The last time we saw him was in December; however, you won’t believe how much he has changed since then.

Closely related to a comma splice is the fused sentence. This occurs when a writer joins two independent clauses with no punctuation. You fix a fused sentence the same way as you do a comma splice. Here is an example, using the same sentence above, of a fused sentence:

  • Fused Sentence: The last time we saw him was in December you can’t believe how much he changed since then.

You would correct a fused sentence in the same way that you correct a comma splice.

When you can recognize independent clauses in your writing, you will begin to eliminate comma splices and fused sentences. Study Unit 4 again if you feel like you need some additional review.

Subordination

As you studied in Unit 4, when a subordinate clause appears at the beginning of a sentence, use a comma after the subordinate clause. However, if the subordinate clause appears at the end, you will usually omit the comma. You may remember this example:

  • Because it might rain, I will bring an umbrella to the festival. (comma)
  • I will bring an umbrella to the festival because it might rain. (no comma)

Subordination is yet another way to fix a comma splice or a fused sentence. Look at this example:

  • Comma Splice: The last time we saw him was in December, you can’t believe how much he changed since then.
  • Corrected with Subordination: Although we just saw him in December, you can’t believe how much he has changed since then.
Apostrophes

Apostrophes are used to show possession or to mark a contraction. You can learn how to think through whether an apostrophe is correct by analyzing each apostrophe in your writing. You can focus on two types:

  • Possessive apostrophe: We found Hank’s hammer. (Instead of the awkward phrase “the hammer of Hank,” write “Hank’s hammer.”)
  • Contraction: I can’t make it. (In this sentence, “cannot” has been shortened to “can’t”)

Since most academic and formal writing does not allow for contractions, possessive apostrophes will be your focus. The rules are relatively simple.

Use an apostrophe followed by “s” with a singular noun to mark possession:

  • The keeper filled the tiger’s bowl with water.
  • The spider sucked the juice out of the aphid’s paralyzed body.

Use an apostrophe with a plural noun to mark possession:

  • The keeper filled the tigers’ bowls with water.
  • The wind knocked the birds’ nest out of the tree.

The Exception: It

Possession will be marked for every noun with an -'s or -s'. Also, nearly all pronouns have their own possessive cases--for example, yours, his, hers, theirs--so you will never use an apostrophe with pronouns, including it. However, to mark it as possessive, simply add an s.

  • The tree fell because of its own weight.
  • The wind blew its way into the house.
  • The bicycle had lost its fender.

Many students will attempt to mark the possessive of “it” with an apostrophe and “s.” However, “it’s” is a contraction for “it is.” This is simply an exception to remember:

  • Its = Possessive
  • It’s = Contraction for “It is”

You can use apostrophes a few other ways, but for now, concentrate on correctly marking nouns possessive.

Semicolons

As you learned in Unit 4, semicolons can join two complete sentences. Also, as you studied in the section on commas above, a semicolon can fix a comma splice. Semicolons act like a period in some cases, like a comma in others.

When a semicolon joins two independent clauses, use it like a period:

  • Mark found the new route easy; the other climbers were impressed.
  • The balloon floated up to the ceiling; the baby cried.

Even though you can use semicolons like a period, you should use them sparingly, usually with an adverbial conjunction:

  • The new law goes into effect today; therefore, you can no longer turn right on a red light between 4 and 6 p.m.

You can also use semicolons in between items in a series when those items have commas.

  • An unidentified flying object was spotted in Roswell, New Mexico; Amarillo, Texas; Salt Lake City, Utah; and Paducah, Kentucky.
  • He disliked ice cream, cookies, and cake; horror movies, cherub statues, and violins; and sleeping, playing dominoes, and counting on his fingers.
帮我优化以下代码,使其简单易修改,且提高运行效率:# --coding:utf-8-- import openpyxl import re import os import linecache # 判断字符串中是否含有特殊标点符号 def has_punctuation(str, punctuation={"-", "."}): for char in str: if char in punctuation: return True return False # 获取die的相关信息,坐标和bin def Die_manage(openfile): die = 0 Bin = 0 x = 0 y = 0 site = [] Die_dic = {} with open(openfile, 'r+') as f: for num, line in enumerate(f.readlines()): line_data = line.split() if 'Device#:' in line_data: if has_punctuation(line_data[1]): pass else: die = int(line_data[1]) if 'Site' in line_data and 'Bin' in line_data: # bin = re.findall(r"\d+\.?\d*", (linecache.getline(openfile, num + 3))) bin = linecache.getline(openfile, num + 3).split() # print(f'{bin=}') if len(bin) < 3: pass else: if bin[2].casefold() == 'N/A'.casefold(): Bin = 1 else: Bin = int(bin[2]) if 'Site' in line_data and 'X_Coord' in line_data: x = int(re.findall(r"\d+\.?\d*", (linecache.getline(openfile, num + 3)))[1]) y = int(re.findall(r"\d+\.?\d*", (linecache.getline(openfile, num + 3)))[2]) if Bin != 0 and x != 0 and y != 0: site.append(x) site.append(y) site.append(Bin) Die_dic[die] = site site = [] Bin = 0 x = 0 y = 0 return Die_dic def unit_conversion(value: str, from_unit: str, to_unit: str = None) -> float: """ 通用单位转换函数,支持电流、电压、频率等单位的相互转换 Args: value: 要转换的数值字符串 from_unit: 原始单位(不区分大小写) to_unit: 目标单位(不区分大小写),默认为None表示自动选择常用单位 Returns: 转换后的数值 Raises: ValueError: 如果输入单位不支持或转换不兼容 """ # 定义单位转换基准和转换因子 UNIT_CONVERSION = { # 电流单位 'a': 1e6, # 安培 -> 微安 'ma': 1e3, # 毫安 -> 微安 'ua': 1, # 微安 'na': 1e-3, # 纳安 -> 微安 'pa': 1e-6, # 皮安 -> 微安 'fa': 1e-9, # 飞安 -> 微安 # 电压单位 'v': 1e3, # 伏特 -> 毫伏 'mv': 1, # 毫伏 'uv': 1e-3, # 微伏 -> 毫伏 'kv': 1e6, # 千伏 -> 毫伏 # 频率单位 'hz': 1e-6, # 赫兹 -> 兆赫 'khz': 1e-3, # 千赫 -> 兆赫 'mhz': 1, # 兆赫 'ghz': 1e3, # 千兆赫 -> 兆赫 } # 自动选择目标单位 if to_unit is None: if any(u in from_unit.lower() for u in ['a', 'ma', 'ua', 'na', 'pa', 'fa']): to_unit = 'ua' # 电流默认转微安 elif any(u in from_unit.lower() for u in ['v', 'mv', 'uv', 'kv']): to_unit = 'mv' # 电压默认转毫伏 elif any(u in from_unit.lower() for u in ['hz', 'khz', 'mhz', 'ghz']): to_unit = 'mhz' # 频率默认转兆赫 from_unit = from_unit.lower() to_unit = to_unit.lower() # 验证单位是否支持 if from_unit not in UNIT_CONVERSION or to_unit not in UNIT_CONVERSION: raise ValueError(f"不支持的转换单位: {from_unit} -> {to_unit}") # 检查单位类型是否一致 from_type = 'current' if 'a' in from_unit else 'voltage' if 'v' in from_unit else 'frequency' to_type = 'current' if 'a' in to_unit else 'voltage' if 'v' in to_unit else 'frequency' if from_type != to_type: raise ValueError(f"单位类型不匹配: 不能将{from_type}单位转换为{to_type}单位") try: num_value = float(value) except ValueError: raise ValueError(f"无效的数值格式: {value}") # 执行转换: 先转为基础单位,再转为目标单位 base_value = num_value * UNIT_CONVERSION[from_unit] converted_value = base_value / UNIT_CONVERSION[to_unit] return converted_value DataDir = input('Input file path:') # DataDir = r'Z:\01 raw data\02 BCD120_New\GPIO\HT150' Files = os.listdir(DataDir) file_need_list = [] Files = os.listdir(DataDir) for Filename in Files: SrcFile = os.path.join(Filename) file_need_list.append(SrcFile) file_need_list_txt = [] for index_txt in file_need_list: if '.txt' in index_txt and '.xlsx' not in index_txt: file_need_list_txt.append(index_txt) num = 0 # supply_voltage_list = ["D12", "D25_12", "D33_12"] # supply_voltage_list = ["D18", "D5_18", "D2"] supply_voltage_list = ["D5"] open_and_short_test_item = ["os", "power_os", "leakage", "leakage_in", "leakage_out", "hz", "input0", "input1", "output0", "output1", "fail_safe", "v18_hz", "v18_in0", "v18_in1", "v18_out0", "v18_out1", "v2.5_hz", "v2.5_in0", "v2.5_in1", "v2.5_out0", "v2.5_out1", "V33_Hz", "V33_In0", "V33_In1", "V33_Out0", "V33_Out1" ] tolerance_vdd_item = ["tolerance_hz", "tolerance_input", "onlyvdd"] drive_item = ["PDrive", "NDrive"] vi_item = ["VIH", "VIL", "VIH_ECOMS_H", "VIL_ECOMS_H"] pull_item = ["Pull_Down", "Pull_Up"] shmoo_item = ["power_onlyvdd25", "out0_shmoo", "out1_shmoo", "in0_shmoo", "in1_shmoo", "hz_shmoo"] function_item = ["Function_Output", "Function_Input", "Function_Input_ECOMSH", "OD_Function_Output", "OD_Function_Input"] function_shmoo_item = ["shmoo_output", "shmoo_input"] rate_site_dict = {"EDR00": 0, "EDR01": 1, "EDR10": 2, "EDR11": 3, "EDR000": 0, "EDR001": 1, "EDR010": 2, "EDR011": 3, "EDR100": 0, "EDR101": 1, "EDR110": 2, "EDR111": 3} for index in file_need_list_txt: print('开始处理文件:', index) openfile1 = DataDir + '/' + index if os.path.exists(DataDir + '/' + index.replace('.txt','')) == False: os.mkdir(DataDir + '/' + index.replace('.txt','')) outputfile_1D8 = DataDir + '/' + index.replace('.txt','') + '/' + index.replace('.txt','_D18.xlsx') # outputfile1_3D3 = DataDir + '/' + index.replace('.txt','') + '/' + index.replace('.txt','_D5.xlsx') outputfile1_1D8_3D3 = DataDir + '/' + index.replace('.txt','') + '/' + index.replace('.txt','_D5_18.xlsx') filename = index.split('.txt')[0].split('_') for element in filename: if element.startswith('CL') or element.startswith('AL'): Lot_ID = element if element.startswith('#'): Wafer_ID = element print('Wafer_ID=', Wafer_ID) print('Lot_ID=', Lot_ID) # 获取die相关信息 Die_dic = Die_manage(openfile1) for supply_voltage in supply_voltage_list: writefile = os.path.join(DataDir, index.replace('.txt', ''), index.replace('.txt', f"_{supply_voltage}.xlsx")) locals()[supply_voltage] = openpyxl.Workbook() # 创建Summary' Summary = locals()[supply_voltage].active Summary.title = 'Summary' for key in Die_dic: x = Die_dic[key][0] y = Die_dic[key][1] bin = Die_dic[key][2] Summary.cell(1, 1, "Lot_ID") Summary.cell(1, 2, "Wafer_ID") Summary.cell(1, 3, "Die_ID") Summary.cell(1, 4, "X") Summary.cell(1, 5, "Y") Summary.cell(1, 6, 'Bin') Summary.cell(key + 1, 1, Lot_ID) Summary.cell(key + 1, 2, Wafer_ID) Summary.cell(key + 1, 6, bin) Summary.cell(key + 1, 3, key) Summary.cell(key + 1, 4, x) Summary.cell(key + 1, 5, y) Summary.cell(key + 1, 6, bin) Device_num = 0 detect_item_list = [] with open(openfile1, "r+") as f: for line in f.readlines(): line_data = line.split() # print(line_data) if r'Device#:' in ' '.join(line_data): Device_num = Device_num + 1 if "<" in ''.join(line_data) and ">" in ''.join(line_data) and supply_voltage in ''.join(line_data) \ and len(line_data) == 1 and Device_num == 1: detect_item = re.findall(r'[<](.*?)[>]', line_data[0])[0] detect_item_list.append(detect_item) if Device_num > 1: break print(detect_item_list) for detect_item in detect_item_list: item_start = 0 for test_item in open_and_short_test_item: if test_item.casefold() in detect_item.casefold(): test_classification = "open and short" for test_item in tolerance_vdd_item: if test_item.casefold() in detect_item.casefold(): test_classification = "tolerance" for test_item in drive_item: if test_item.casefold() in detect_item.casefold(): test_classification = "drive" for test_item in vi_item: if test_item.casefold() in detect_item.casefold(): test_classification = "vi" for test_item in pull_item: if test_item.casefold() in detect_item.casefold(): test_classification = "pull" for test_item in shmoo_item: if test_item.casefold() in detect_item.casefold(): test_classification = "shmoo" for test_item in function_item: if test_item.casefold() in detect_item.casefold(): test_classification = "function" for test_item in function_shmoo_item: if test_item.casefold() in detect_item.casefold(): test_classification = "function_shmoo" print(f"{detect_item=} {test_classification=}") if test_classification == "open and short": ws = locals()[supply_voltage].create_sheet(detect_item) ws.cell(1, 1, "Lot_ID") ws.cell(1, 2, "wafer_ID") ws.cell(1, 3, "Die_ID") ws.cell(1, 4, "X") ws.cell(1, 5, "Y") ws.cell(1, 6, "Pin") row_index = 1 with open(openfile1, "r+") as f: for line in f.readlines(): line_data = line.split() if r'Device#:' in ' '.join(line_data): die = int(line_data[1]) print(f"正在处理第{die}颗die的{detect_item}") if "<" in ''.join(line_data) and ">" in ''.join(line_data) and detect_item in ''.join(line_data): item_start = 1 elif "<" in ''.join(line_data) and ">" in ''.join(line_data) and detect_item not in ''.join(line_data): item_start = 0 if item_start == 1: if "ALARM" in line_data or "Site" in line_data: continue if len(line_data) < 5: continue row_index += 1 pin = line_data[3] if 'N/A' in line_data: current_data = line_data[6] current_unit = line_data[7] else: current_data = line_data[7] current_unit = line_data[8] # print(line_data) value = unit_conversion(current_data, current_unit) if "V" in current_unit: unit = "V" if "A" in current_unit: unit = "A" ws.cell(1, 7, f"{detect_item}({unit})") ws.cell(row_index, 1, Lot_ID) ws.cell(row_index, 2, Wafer_ID) ws.cell(row_index, 3, die) ws.cell(row_index, 4, Die_dic[die][0]) ws.cell(row_index, 5, Die_dic[die][1]) ws.cell(row_index, 6, pin) ws.cell(row_index, 7, value) elif item_start == 0: continue if test_classification == "tolerance": ws = locals()[supply_voltage].create_sheet(detect_item) ws.cell(1, 1, "Lot_ID") ws.cell(1, 2, "wafer_ID") ws.cell(1, 3, "Die_ID") ws.cell(1, 4, "X") ws.cell(1, 5, "Y") ws.cell(1, 6, "Pin") ws.cell(1, 7, "Voltage(V)") row_index = 1 with open(openfile1, "r+") as f: for line in f.readlines(): line_data = line.split() if r'Device#:' in ' '.join(line_data): die = int(line_data[1]) print(f"正在处理第{die}颗die的{detect_item}") if "<" in ''.join(line_data) and ">" in ''.join(line_data) and detect_item in ''.join(line_data): item_start = 1 elif "<" in ''.join(line_data) and ">" in ''.join(line_data) and detect_item not in ''.join(line_data): item_start = 0 if item_start == 1: if "ALARM" in line_data or "Site" in line_data: continue if len(line_data) < 5: continue row_index += 1 pin = line_data[3] if 'N/A' in line_data and ("(A)" in line_data or "(F)" in line_data): current_data = line_data[6] current_unit = line_data[7] voltage_data = line_data[10] voltage_unit = line_data[11] elif 'N/A' in line_data: current_data = line_data[6] current_unit = line_data[7] voltage_data = line_data[9] voltage_unit = line_data[10] elif "(A)" in line_data or "(F)" in line_data: current_data = line_data[6] current_unit = line_data[7] voltage_data = line_data[12] voltage_unit = line_data[13] else: current_data = line_data[7] current_unit = line_data[8] voltage_data = line_data[11] voltage_unit = line_data[12] # print(voltage_data, voltage_unit) value = unit_conversion(current_data, current_unit) voltage = unit_conversion(voltage_data, voltage_unit) if "V" in current_unit: unit = "V" if "A" in current_unit: unit = "A" ws.cell(1, 8, f"{detect_item}({unit})") ws.cell(row_index, 1, Lot_ID) ws.cell(row_index, 2, Wafer_ID) ws.cell(row_index, 3, die) ws.cell(row_index, 4, Die_dic[die][0]) ws.cell(row_index, 5, Die_dic[die][1]) ws.cell(row_index, 6, pin) ws.cell(row_index, 7, voltage) ws.cell(row_index, 8, value) elif item_start == 0: continue if test_classification == "vdd": ws = locals()[supply_voltage].create_sheet(detect_item) ws.cell(1, 1, "Lot_ID") ws.cell(1, 2, "wafer_ID") ws.cell(1, 3, "Die_ID") ws.cell(1, 4, "X") ws.cell(1, 5, "Y") ws.cell(1, 6, "Pin") row_index = 1 with open(openfile1, "r+") as f: for line in f.readlines(): line_data = line.split() if r'Device#:' in ' '.join(line_data): die = int(line_data[1]) print(f"正在处理第{die}颗die的{detect_item}") if "<" in ''.join(line_data) and ">" in ''.join(line_data) and detect_item in ''.join(line_data): item_start = 1 elif "<" in ''.join(line_data) and ">" in ''.join(line_data) and detect_item not in ''.join(line_data): item_start = 0 if item_start == 1: if "ALARM" in line_data: continue if len(line_data) == 1: continue row_index += 1 pin = line_data[3] current_data = line_data[6] current_unit = line_data[7] value = unit_conversion(current_data, current_unit) if "V" in current_unit: unit = "V" if "A" in current_unit: unit = "A" ws.cell(1, 7, f"{detect_item}({unit})") ws.cell(row_index, 1, Lot_ID) ws.cell(row_index, 2, Wafer_ID) ws.cell(row_index, 3, die) ws.cell(row_index, 4, Die_dic[die][0]) ws.cell(row_index, 5, Die_dic[die][1]) ws.cell(row_index, 6, pin) ws.cell(row_index, 7, value) elif item_start == 0: continue if test_classification == "shmoo": ws = locals()[supply_voltage].create_sheet(detect_item) ws.cell(1, 1, "Lot_ID") ws.cell(1, 2, "wafer_ID") ws.cell(1, 3, "Die_ID") ws.cell(1, 4, "X") ws.cell(1, 5, "Y") ws.cell(1, 6, "Pin") ws.cell(1, 7, "Voltage(V)") row_index = 1 with open(openfile1, "r+") as f: for line in f.readlines(): line_data = line.split() if r'Device#:' in ' '.join(line_data): die = int(line_data[1]) print(f"正在处理第{die}颗die的{detect_item}") if "<" in ''.join(line_data) and ">" in ''.join(line_data) and detect_item in ''.join(line_data): item_start = 1 elif "<" in ''.join(line_data) and ">" in ''.join(line_data) and detect_item not in ''.join(line_data): item_start = 0 if item_start == 1: if "ALARM" in line_data: continue if len(line_data) == 1: continue row_index += 1 pin = line_data[3] voltage = line_data[2].split("_")[-1] current_data = line_data[6] current_unit = line_data[7] value = unit_conversion(current_data, current_unit) if "V" in current_unit: unit = "V" if "A" in current_unit: unit = "A" ws.cell(1, 8, f"{detect_item}({unit})") ws.cell(row_index, 1, Lot_ID) ws.cell(row_index, 2, Wafer_ID) ws.cell(row_index, 3, die) ws.cell(row_index, 4, Die_dic[die][0]) ws.cell(row_index, 5, Die_dic[die][1]) ws.cell(row_index, 6, pin) ws.cell(row_index, 7, voltage) ws.cell(row_index, 8, value) elif item_start == 0: continue if test_classification == "drive": if "pdrive" in detect_item.casefold(): test_method = f"{supply_voltage}_PDrive" elif "ndrive" in detect_item.casefold() and "edr1" in detect_item.casefold() and "D33_12" in detect_item: test_method = f"{supply_voltage}_NDrive_EDR1" elif "ndrive" in detect_item.casefold() and "D33_12" in detect_item: test_method = f"{supply_voltage}_NDrive_EDR0" elif "ndrive" in detect_item.casefold(): test_method = f"{supply_voltage}_NDrive" if test_method not in locals()[supply_voltage].sheetnames: ws = locals()[supply_voltage].create_sheet(test_method) ws.cell(1, 1, "Lot_ID") ws.cell(2, 1, "wafer_ID") ws.cell(3, 1, "Die_ID") ws.cell(4, 1, "X") ws.cell(5, 1, "Y") ws.cell(6, 1, "Pin") ws.cell(7, 1, f"{test_method}(A)") ws.cell(8, 1, "VDDIO") ws.cell(8, 2, "PAD") rate = detect_item.split("_")[-1] rate_site = rate_site_dict[rate] if supply_voltage == "D33_12" and "NDrive_EDR1" in test_method: pin_type_num = 2 elif supply_voltage == "D33_12" and "NDrive" in test_method: pin_type_num = 5 elif supply_voltage == "D33_12": pin_type_num = 3 elif supply_voltage == "D18": pin_type_num = 4 elif supply_voltage == "D5_18": pin_type_num = 6 else: pin_type_num = 2 # if supply_voltage == "D33_12" and "NDrive" in test_method: # rate_type_num = 8 # else: rate_type_num = 4 total_pin = 0 with open(openfile1, "r+") as f: for line in f.readlines(): line_data = line.split() if r'Device#:' in ' '.join(line_data): die = int(line_data[1]) print(f"正在处理第{die}颗die的{detect_item}") if f"<{detect_item}>" in ''.join(line_data): item_start = 1 row_index = 9 elif "<" in ''.join(line_data) and ">" in ''.join(line_data) and detect_item not in ''.join(line_data): item_start = 0 if item_start == 1: if "ALARM" in line_data: continue if len(line_data) == 1: continue total_pin += 1 VDDIO = line_data[2].split("_")[-1] if "V" not in VDDIO: VDDIO = f"{VDDIO}V" PAD = f"{line_data[9]}{line_data[10]}" pin = line_data[3] current_data = line_data[6] current_unit = line_data[7] value = unit_conversion(current_data, current_unit) if "V" in current_unit: unit = "V" if "A" in current_unit: unit = "A" # EDR类型个数 * pin类型个数 * (die-1)+ 起始位置 column_start = rate_type_num * pin_type_num * (int(die) - 1) + 2 if total_pin % pin_type_num == 0: column_index = column_start + (rate_site * pin_type_num) + pin_type_num else: column_index = column_start + (rate_site * pin_type_num) + total_pin % pin_type_num ws.cell(row_index, 1, VDDIO) ws.cell(row_index, 2, PAD) ws.cell(8, column_index, rate) ws.cell(1, column_index, Lot_ID) ws.cell(2, column_index, Wafer_ID) ws.cell(3, column_index, die) ws.cell(4, column_index, Die_dic[die][0]) ws.cell(5, column_index, Die_dic[die][1]) ws.cell(6, column_index, pin) ws.cell(row_index, column_index, value) if total_pin % pin_type_num == 0: row_index += 1 elif item_start == 0: continue if test_classification == "vi": ws = locals()[supply_voltage].create_sheet(detect_item) ws.cell(1, 1, "Lot_ID") ws.cell(2, 1, "wafer_ID") ws.cell(3, 1, "Die_ID") ws.cell(4, 1, "X") ws.cell(5, 1, "Y") ws.cell(6, 1, "Pin") ws.cell(7, 1, f"{detect_item}(V)") total_pin = 0 if supply_voltage == "D33_12" and "ECOMS" in detect_item: pin_type_num = 1 elif supply_voltage == "D33_12": pin_type_num = 5 elif supply_voltage == "D5_18": pin_type_num = 6 elif supply_voltage == "D18": pin_type_num = 4 else: pin_type_num = 2 with open(openfile1, "r+") as f: for line in f.readlines(): line_data = line.split() if r'Device#:' in ' '.join(line_data): die = int(line_data[1]) print(f"正在处理第{die}颗die的{detect_item}") # EDR类型个数 * pin类型个数 * (die-1)+ 起始位置 column_start = pin_type_num * (int(die) - 1) + 1 if f"<{detect_item}>" in ''.join(line_data): item_start = 1 row_index = 8 elif "<" in ''.join(line_data) and ">" in ''.join(line_data) and detect_item not in ''.join(line_data): item_start = 0 if item_start == 1: if "ALARM" in line_data or "Site" in line_data: continue if len(line_data) < 6: continue total_pin += 1 # print(line_data) pin = line_data[3] voltage = re.split(r"_H|_L", line_data[2])[1] # print(f"{voltage=} {line_data[2]=}") current_data = line_data[6] current_unit = line_data[7] value = unit_conversion(current_data, current_unit) if "V" in current_unit: unit = "V" if "A" in current_unit: unit = "A" if total_pin % pin_type_num == 0: column_index = column_start + pin_type_num else: column_index = column_start + total_pin % pin_type_num ws.cell(row_index, 1, voltage) ws.cell(1, column_index, Lot_ID) ws.cell(2, column_index, Wafer_ID) ws.cell(3, column_index, die) ws.cell(4, column_index, Die_dic[die][0]) ws.cell(5, column_index, Die_dic[die][1]) ws.cell(6, column_index, pin) ws.cell(row_index, column_index, value) if total_pin % pin_type_num == 0: row_index += 1 elif item_start == 0: continue if test_classification == "pull": ws = locals()[supply_voltage].create_sheet(detect_item) ws.cell(1, 1, "Lot_ID") ws.cell(2, 1, "wafer_ID") ws.cell(3, 1, "Die_ID") ws.cell(4, 1, "X") ws.cell(5, 1, "Y") ws.cell(6, 1, "Pin") ws.cell(7, 1, detect_item) total_pin = 0 if supply_voltage == "D33_12": pin_type_num = 5 elif supply_voltage == "D18": pin_type_num = 4 elif supply_voltage == "D5_18": pin_type_num = 6 else: pin_type_num = 2 with open(openfile1, "r+") as f: for line in f.readlines(): line_data = line.split() if r'Device#:' in ' '.join(line_data): die = int(line_data[1]) print(f"正在处理第{die}颗die的{detect_item}") # EDR类型个数 * pin类型个数 * (die-1)+ 起始位置 column_start = pin_type_num * (int(die) - 1) + 1 if "<" in ''.join(line_data) and ">" in ''.join(line_data) and detect_item in ''.join(line_data): item_start = 1 row_index = 8 elif "<" in ''.join(line_data) and ">" in ''.join(line_data) and detect_item not in ''.join(line_data): item_start = 0 if item_start == 1: if "ALARM" in line_data: continue if len(line_data) < 10: continue if "Site" in line_data: continue # print(line_data) total_pin += 1 pin = line_data[3] voltage = line_data[2].split("_")[-1] current_data = line_data[6] current_unit = line_data[7] value = unit_conversion(current_data, current_unit) if "V" in current_unit: unit = "V" if "A" in current_unit: unit = "A" if total_pin % pin_type_num == 0: column_index = column_start + pin_type_num else: column_index = column_start + total_pin % pin_type_num ws.cell(row_index, 1, voltage) ws.cell(1, column_index, Lot_ID) ws.cell(2, column_index, Wafer_ID) ws.cell(3, column_index, die) ws.cell(4, column_index, Die_dic[die][0]) ws.cell(5, column_index, Die_dic[die][1]) ws.cell(6, column_index, pin) ws.cell(row_index, column_index, value) if total_pin % pin_type_num == 0: row_index += 1 elif item_start == 0: continue if test_classification == "function": if "function_output" in detect_item.casefold(): test_method = f"{supply_voltage}_Function_Output" elif "function_input" in detect_item.casefold(): test_method = f"{supply_voltage}_Function_Input" elif "function_input_ecomsh" in detect_item.casefold(): test_method = f"{supply_voltage}_Function_Input_ECOMSH" elif "od_function_output" in detect_item.casefold(): test_method = f"{supply_voltage}_OD_Function_Output" elif "od_function_input" in detect_item.casefold(): test_method = f"{supply_voltage}_OD_Function_Input" if test_method not in locals()[supply_voltage].sheetnames: ws = locals()[supply_voltage].create_sheet(test_method) ws.cell(1, 1, "Lot_ID") ws.cell(2, 1, "wafer_ID") ws.cell(3, 1, "Die_ID") ws.cell(4, 1, "X") ws.cell(5, 1, "Y") ws.cell(6, 1, "Pin") ws.cell(7, 1, f"{test_method}(Mhz)") ws.cell(8, 1, "VDDIO") ws.cell(8, 2, "PAD") rate = detect_item.split("_")[-1] rate_site = rate_site_dict[rate] if (supply_voltage == "D33_12" and test_method != "D33_12_OD_Function_Input" and test_method != "D33_12_OD_Function_Output")\ or supply_voltage == "D2": pin_type_num = 5 elif supply_voltage == "D18": pin_type_num = 6 elif supply_voltage == "D5_18": pin_type_num = 7 else: pin_type_num = 4 if test_method == "D33_12_Function_Input_ECOMSH" or test_method == "D33_12_Function_Input" \ or test_method == "D33_12_OD_Function_Input" or test_method == "D12_Function_Input" \ or test_method == "D25_12_Function_Input": rate_type_num = 1 else: rate_type_num = 4 total_pin = 0 with open(openfile1, "r+") as f: for line in f.readlines(): line_data = line.split() if r'Device#:' in ' '.join(line_data): die = int(line_data[1]) print(f"正在处理第{die}颗die的{detect_item}") # EDR类型个数 * pin类型个数 * (die-1)+ 起始位置 column_start = rate_type_num * pin_type_num * (int(die) - 1) + 1 test_seq = 0 row_index = 7 if "<" in ''.join(line_data) and ">" in ''.join(line_data) and detect_item in ''.join(line_data): item_start = 1 elif "<" in ''.join(line_data) and ">" in ''.join(line_data) and detect_item not in ''.join(line_data): item_start = 0 if item_start == 1: if "ALARM" in line_data: continue if len(line_data) <= 1: continue if detect_item in ''.join(line_data): test_seq += 1 total_pin += 1 row_index += 1 if "(F)" in line: result = "Fail" else: result = "Pass" column_index = column_start + (rate_site * pin_type_num) + 1 ws.cell(row_index, 1, test_seq) ws.cell(7, column_index, rate) ws.cell(1, column_index, Lot_ID) ws.cell(2, column_index, Wafer_ID) ws.cell(3, column_index, die) ws.cell(4, column_index, Die_dic[die][0]) ws.cell(5, column_index, Die_dic[die][1]) ws.cell(6, column_index, "Result") ws.cell(row_index, column_index, result) elif "Id_A" in ''.join(line_data) or "Id_B" in ''.join(line_data) \ or "Id_C" in ''.join(line_data) or "Id_D" in ''.join(line_data): total_pin += 1 if total_pin % pin_type_num == 0: column_index = column_start + (rate_site * pin_type_num) + pin_type_num else: column_index = column_start + (rate_site * pin_type_num) + total_pin % pin_type_num pin = line_data[3] current_data = line_data[6] current_unit = line_data[7] value = unit_conversion(current_data, current_unit) ws.cell(row_index, 1, test_seq) ws.cell(7, column_index, rate) ws.cell(1, column_index, Lot_ID) ws.cell(2, column_index, Wafer_ID) ws.cell(3, column_index, die) ws.cell(4, column_index, Die_dic[die][0]) ws.cell(5, column_index, Die_dic[die][1]) ws.cell(6, column_index, pin) ws.cell(row_index, column_index, value) elif "-->" in ''.join(line_data): # print(line_data) total_pin += 1 if total_pin % pin_type_num == 0: column_index = column_start + (rate_site * pin_type_num) + pin_type_num else: column_index = column_start + (rate_site * pin_type_num) + total_pin % pin_type_num pin = line_data[1].split(":")[0] value = float(re.findall(r'[:](.*?)[H]', line_data[1])[0]) / (1e6) ws.cell(row_index, 1, test_seq) ws.cell(7, column_index, rate) ws.cell(1, column_index, Lot_ID) ws.cell(2, column_index, Wafer_ID) ws.cell(3, column_index, die) ws.cell(4, column_index, Die_dic[die][0]) ws.cell(5, column_index, Die_dic[die][1]) ws.cell(6, column_index, pin) ws.cell(row_index, column_index, value) else: continue elif item_start == 0: continue if test_classification == "function_shmoo": if "vdd5_shmoo_output" in detect_item.casefold(): test_method = f"{supply_voltage}_VDD5_Shmoo_Output" elif "vdd5_shmoo_input" in detect_item.casefold(): test_method = f"{supply_voltage}_VDD5_Shmoo_Input" elif "vdd18_shmoo_output" in detect_item.casefold(): test_method = f"{supply_voltage}_VDD18_Shmoo_Output" elif "vdd18_shmoo_input" in detect_item.casefold(): test_method = f"{supply_voltage}_VDD18_Shmoo_Input" if test_method not in locals()[supply_voltage].sheetnames: ws = locals()[supply_voltage].create_sheet(test_method) ws.cell(1, 1, "Lot_ID") ws.cell(2, 1, "wafer_ID") ws.cell(3, 1, "Die_ID") ws.cell(4, 1, "X") ws.cell(5, 1, "Y") ws.cell(6, 1, "Pin") ws.cell(7, 1, f"{test_method}(Mhz)") ws.cell(8, 1, "VDDIO") ws.cell(8, 2, "PAD") rate = detect_item.split("_")[-1] rate_site = rate_site_dict[rate] if supply_voltage == "D5_18" or supply_voltage == "D2": pin_type_num = 2 else: pin_type_num = 4 if supply_voltage == "D5_18" or supply_voltage == "D2": rate_type_num = 1 else: rate_type_num = 4 total_pin = 0 with open(openfile1, "r+") as f: for line in f.readlines(): line_data = line.split() if r'Device#:' in ' '.join(line_data): die = int(line_data[1]) print(f"正在处理第{die}颗die的{detect_item}") # EDR类型个数 * pin类型个数 * (die-1)+ 起始位置 column_start = rate_type_num * pin_type_num * (int(die) - 1) + 1 test_seq = 0 row_index = 7 if "<" in ''.join(line_data) and ">" in ''.join(line_data) and detect_item in ''.join(line_data): item_start = 1 elif "<" in ''.join(line_data) and ">" in ''.join(line_data) and detect_item not in ''.join(line_data): item_start = 0 if item_start == 1: if "ALARM" in line_data: continue if len(line_data) <= 1: continue if detect_item in ''.join(line_data): test_seq += 1 total_pin += 1 row_index += 1 if "(F)" in line: result = "Fail" else: result = "Pass" column_index = column_start + (rate_site * pin_type_num) + 1 ws.cell(row_index, 1, test_seq) ws.cell(7, column_index, rate) ws.cell(1, column_index, Lot_ID) ws.cell(2, column_index, Wafer_ID) ws.cell(3, column_index, die) ws.cell(4, column_index, Die_dic[die][0]) ws.cell(5, column_index, Die_dic[die][1]) ws.cell(6, column_index, "Result") ws.cell(row_index, column_index, result) elif "Id_A" in ''.join(line_data) or "Id_B" in ''.join(line_data) \ or "Id_C" in ''.join(line_data) or "Id_D" in ''.join(line_data): total_pin += 1 column_index = column_start + (rate_site * pin_type_num) + 2 pin = line_data[3] current_data = line_data[6] current_unit = line_data[7] value = unit_conversion(current_data, current_unit) force = f"{line_data[9]}{line_data[10]}" ws.cell(row_index, 1, test_seq) ws.cell(row_index, 2, force) ws.cell(7, column_index, rate) ws.cell(1, column_index, Lot_ID) ws.cell(2, column_index, Wafer_ID) ws.cell(3, column_index, die) ws.cell(4, column_index, Die_dic[die][0]) ws.cell(5, column_index, Die_dic[die][1]) ws.cell(6, column_index, pin) ws.cell(row_index, column_index, value) else: continue elif item_start == 0: continue locals()[supply_voltage].save(writefile) locals()[supply_voltage].close()
11-21
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值