Skip to content

Instantly share code, notes, and snippets.

@vlsi1217
Created July 30, 2013 00:28
Show Gist options
  • Save vlsi1217/6109105 to your computer and use it in GitHub Desktop.
Save vlsi1217/6109105 to your computer and use it in GitHub Desktop.
clear;close all;clc;
%% LOOKOUT! for example, sn269 only have failure in 0.61 0.62 0.63 0.64 0.68 0.71 0.72 0.73
% test to extract features of failure report
% there are 13 voltages and 5 features
M = csvread('P:\July2013\assignment\July17\Anomal contributer data\sn36.csv');
%diff_vol = 13;
diff_vol = length(unique(M(2:end, 1)));
high_voltage = 61+diff_vol-1;
feature = zeros(diff_vol,225); % only test results, no voltage
MTP = zeros(diff_vol,1); % this is the maximum of each feature
%idx_num = zeros(diff_vol,1);
range = (unique(M(2:end, 1)))';
%% NEVER USE decimal number in for loop if use FIND function, will miss
% for i = 0.61:0.01:0.73
for i = range*100,
%fprintf('&------------&------------&------------&------------&\n')
%fprintf('the row of voltage = %d\n',i/100)
idx = find(M(:,1) == i/100); %find all failure with same voltage
%idx_num(i-60) = length(idx); %count # of that voltage
feature1(i-60,:) = sum(M(idx,2:end),1);
MTP1(i-60,1) = max(feature1(i-60,:));
end
correct_line = (range*100-60)';
feature = feature1(correct_line,:);
MTP = MTP1(correct_line,:);
% simply took the line(same as range) from feature/MTP then you'll be fine
new83 = [range' feature MTP];
pinnacle = [range' feature];
taco = [M(1,:);pinnacle];
%% find the test has failures
tony = (zeros(diff_vol,50))';
for i = 2:length(range*100)+1, % because taco is from line 2 to line end
[r,c] = find(taco(i,:) >= 1);%nonzeros for each voltage and get the test number
if length(c) ~= 0,
test = [range(i-1) taco(1,c)]';
else
%test{i-60} = [i/100 0]';
test = [range(i-1) taco(1,c)]';
end
tony(1:numel(test),i-1) = test;
end
tony = tony';
%% step 2
find_test = unique(nonzeros(tony(:,2:end)));
dif_MAX = zeros(1,length(find_test));
fprintf('Begin of Report for failure extraction\n')
for k = 1:length(find_test)
fprintf('&------------&------------&------------&------------&\n')
fprintf('the test # = %d\n',find_test(k))
[row,col] = find(tony == find_test(k));
sort(tony(row,1),'descend')
row_Failure{k}=sort(tony(row,1),'descend');
if length(row_Failure{k}) == 1,
dif_MAX(1,k) = 0;
else
%dif_MAX(1,k) = 1000*max((abs(diff(sort(tony(row,1),'descend')))));
dif_MAX(1,k) = 1000*max((abs(diff(row_Failure{k}))));
end
end
fprintf('End of Report for failure extraction\n')
%% design a scrapler to find the failure test for each voltage in one test
contrib = [];
for i = 1:length(find_test),
if dif_MAX(i) > 25 % find the test with more than 25mV gap
contrib = [contrib ; [find_test(i,1) dif_MAX(1,i)]];
else
contrib = contrib;
end
end
%%
csvwrite('sn602_fail_all.csv',tony);
csvwrite('sn602_fail_major.csv',contrib);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment