main
parent
62ab19ead5
commit
c2d5fc7030
Binary file not shown.
Binary file not shown.
46
tools/t7.py
46
tools/t7.py
|
|
@ -221,21 +221,6 @@ class AutoLayout:
|
|||
"""
|
||||
barcode 有重复的极致样本 进行排列组合,汇集成新的可能性
|
||||
"""
|
||||
# 筛选有重复的行
|
||||
|
||||
# same_barcode_data = [data for data in self.ori_lib_data if data['level'] == 1900]
|
||||
# same_barcode_sorted = sorted(same_barcode_data, key=lambda x: (-x['size']))
|
||||
#
|
||||
# same_barcode_dict = dict()
|
||||
# for index, data in enumerate(same_barcode_sorted):
|
||||
# same_barcode_dict[data['library']] = data['level'] + index + 1
|
||||
# correct_data = list()
|
||||
# for data in self.ori_lib_data:
|
||||
# if data in same_barcode_sorted:
|
||||
# data['level'] = same_barcode_dict[data['library']]
|
||||
# correct_data.append(data)
|
||||
# self.ori_lib_data = correct_data
|
||||
|
||||
same_barcode_df = pd.DataFrame(
|
||||
[spdata for data in self.ori_lib_data if data['level'] == 1900 for spdata in data['data']])
|
||||
|
||||
|
|
@ -323,13 +308,17 @@ class AutoLayout:
|
|||
# print(library_data['data'][0]['barcode'])
|
||||
self.chip_size_N[chipname] += library_data['size']
|
||||
|
||||
def use_rule(self, chipname, classfication):
|
||||
def use_rule_exclusive_classfication(self, chipname, classfication):
|
||||
"""
|
||||
文库不能排在一起
|
||||
"""
|
||||
may_classfic = set(self.rule[self.rule['c1'] == classfication]['c2'])
|
||||
if self.chip_customer[chipname].intersection(may_classfic):
|
||||
return True
|
||||
return False
|
||||
|
||||
def use_rule_exclusive_customer(self, chipname, customer):
|
||||
"""文库不能排在一起"""
|
||||
may_classfic = set(
|
||||
self.rule_exclusive_customer[self.rule_exclusive_customer['customer1'] == customer]['customer2'])
|
||||
if self.chip_customer[chipname].intersection(may_classfic):
|
||||
|
|
@ -347,7 +336,7 @@ class AutoLayout:
|
|||
classification = library_data['classification']
|
||||
customer = library_data['customer']
|
||||
is_balance_lib = library_data['is_balance_lib']
|
||||
library = library_data['library']
|
||||
# library = library_data['library']
|
||||
|
||||
# 芯片大小不能超过设定限制
|
||||
sizelimit = True
|
||||
|
|
@ -367,7 +356,7 @@ class AutoLayout:
|
|||
|
||||
# 互斥的文库
|
||||
exclusive_classific = True
|
||||
if self.use_rule(chipname, classification):
|
||||
if self.use_rule_exclusive_classfication(chipname, classification):
|
||||
exclusive_classific = False
|
||||
# print(chipname, library, '互斥的文库')
|
||||
|
||||
|
|
@ -500,7 +489,6 @@ class AutoLayout:
|
|||
self.loc_chip_num += 1
|
||||
|
||||
def assign_samples(self):
|
||||
# ori_library_data = list()
|
||||
|
||||
if '未测' not in self.ori_data.keys():
|
||||
raise UserWarning('提供excel没有 未测 sheet ,请核查!')
|
||||
|
|
@ -512,7 +500,7 @@ class AutoLayout:
|
|||
|
||||
if unhave_col:
|
||||
unhave_from = '; '.join(unhave_col)
|
||||
raise UserWarning(f'未测表里没有{unhave_from} 表头,请核查!')
|
||||
raise UserWarning(f'未测表里没有 {unhave_from} 表头,请核查!')
|
||||
|
||||
# 数据标准格式
|
||||
numeric_mask = pd.to_numeric(ori_library_df['data_needed'], errors='coerce').notna()
|
||||
|
|
@ -532,20 +520,20 @@ class AutoLayout:
|
|||
|
||||
no_ori_data = ori_library_df[~(numeric_mask & time_mask) | status_mask | barcode_mask]
|
||||
|
||||
self.no_assign_data.extend(no_ori_data.to_dict('records'))
|
||||
|
||||
# 使用布尔索引筛选出不是数字和非日期的行,并且不是暂不排样的行
|
||||
ori_library_df = ori_library_df[(numeric_mask & time_mask) & ~status_mask & ~barcode_mask]
|
||||
|
||||
# 某个客户的检测的数据超过1个T就单独处理
|
||||
# summary = ori_library_df.groupby('customer').agg({'data_needed': 'sum'})
|
||||
# print(summary)
|
||||
|
||||
self.no_assign_data.extend(no_ori_data.to_dict('records'))
|
||||
|
||||
# 使用布尔索引筛选出不是数字和非日期的行,并且不是暂不排样的行, 以及非16位置barcode
|
||||
ori_library_df = ori_library_df[(numeric_mask & time_mask) & ~status_mask & ~barcode_mask]
|
||||
|
||||
# 时间格式化
|
||||
ori_library_df['time'] = pd.to_datetime(ori_library_df['time'], errors='coerce')
|
||||
ori_library_df['level'] = ori_library_df.apply(self.level, axis=1)
|
||||
|
||||
# 极致客户有重复的,把等级调到19,防止放到了最后,到了未测里
|
||||
# 极致客户有重复的,把等级调到1900,防止放到了最后,到了未测里
|
||||
must_lib_df = ori_library_df[ori_library_df['level'] == 2000]
|
||||
must_lib = set(must_lib_df[must_lib_df.duplicated(subset='barcode', keep=False)]['#library'].to_list())
|
||||
ori_library_df.loc[ori_library_df['#library'].isin(must_lib), 'level'] = 1900
|
||||
|
|
@ -586,7 +574,7 @@ class AutoLayout:
|
|||
continue
|
||||
|
||||
# 拆分处理 分为了2个大文库
|
||||
if size > (self.data_limit) / 2:
|
||||
if size > self.data_limit / 2:
|
||||
library_df['data_needed'] = library_df['data_needed'] / 2
|
||||
self.return_log.append(f'文库{library} 已做拆分处理, 请注意!!! ')
|
||||
self.ori_lib_data.append(dict(
|
||||
|
|
@ -685,7 +673,7 @@ class AutoLayout:
|
|||
self.loc_chip_num = 100
|
||||
while ori_lib_data:
|
||||
library_data = ori_lib_data[0]
|
||||
chipname = f'chipB{self.loc_chip_num}_{max_barcode}' if max_barcode != 'all' else f'chipB{self.loc_chip_num}'
|
||||
chipname = f'chip{self.loc_chip_num}_{max_barcode}' if max_barcode != 'all' else f'chip{self.loc_chip_num}'
|
||||
|
||||
# 空白芯片直接添加
|
||||
if chipname not in self.index_assignments:
|
||||
|
|
@ -720,7 +708,6 @@ class AutoLayout:
|
|||
self.assign_again_size()
|
||||
# self.assign_again_size(max_barcode='i7')
|
||||
# self.assign_again_size(max_barcode='i5')
|
||||
# self.assign_again_size()
|
||||
except Exception as e:
|
||||
self.return_log.append(f'T7排样出错, 请联系!{e}')
|
||||
self.index_assignments = {}
|
||||
|
|
@ -740,6 +727,7 @@ class AutoLayout:
|
|||
addname = 'X'
|
||||
else:
|
||||
addname = ''
|
||||
|
||||
other_name = ''
|
||||
# if 'chipB' in chip_idx and df['barcode'].duplicated().any():
|
||||
# other_name = '_i7'
|
||||
|
|
|
|||
Loading…
Reference in New Issue