더 빠른 반복안녕,
반복을 최적화하려고 합니다.
각 열이 기본 데이터 테이블 열의 이름인 참조 테이블이 있습니다. 참조 데이터 테이블의 각 행을 반복한 다음 Column(dt_main, "Values")의 값을 Column(dt_ref, "Nrows")>2 & Comment인 경우 참조 테이블의 새 A 및 새 B 열에 추가하고 싶습니다. [i] == "A > B".
저는 해당 X/Y/웨이퍼 ID에 매핑된 각 유형 A와 B의 마지막 기록 값에만 관심이 있기 때문에 연관 배열을 사용하고 있습니다.
아래 스크립트는 시간이 매우 오래 걸립니다. 최적화할 수 있는 방법이 있나요?
Names Default To Here( 1 );
start = Tick Seconds();
dt_main = Data Table( "maintable" );
dt_ref = Data Table( "referencetable" );
Try( dt_ref << delete columns( :New N, :New R ) );
dt_ref << New Column( "New A", "Numeric" );
dt_ref << New Column( "New B", "Numeric" );
nrows = [];
For( nn = 1, nn <= N Rows( dt_ref ), nn++,
Insert Into( nrows, nn )
);
dt_ref << begin data update;
For Each( {r, i}, nrows,
If( dt_ref:N Rows[i] > 2 & dt_ref:Comment[i] == "A > B",
/// Create AA to get the last recorded values for each A and B to the corresponding X/Y/Wafer ID from dt_main
countsessions = Associative Array(
dt_main:Type[dt_main << get rows where( dt_main:X Coord == dt_ref:X Coord[i] & dt_main:Y Coord == dt_ref:Y Coord[i] & dt_main:Wafer ID == dt_ref:Wafer ID[i] )],
dt_main:Value[dt_main << get rows where( dt_main:X Coord == dt_ref:X Coord[i] & dt_main:Y Coord == dt_ref:Y Coord[i] & dt_main:Wafer ID == dt_ref:Wafer ID[i] )];
);
Try( dt_ref:New A[i] = countsessions["A"] );
Try( dt_ref:New B[i] = countsessions["B"] );
)
);
dt_ref << end data update;
end = Tick Seconds();
Show( Char( end - start ) );
자동화 및 스크립팅답: 더 빠른 반복저는 내장된 JMP Select, Join, Split 및 Update 플랫폼을 사용하여 다른 경로를 선택했습니다. 매우 빠르게 작동하며 참조 테이블에 누락된 값이 있는 A>B 행을 제외하고 동일한 결과를 얻는 것으로 보입니다....그러나 내가 생각해낸 값은 N(A) 및 N(b)와 일치합니다. ) 열. 그래서 나는 완전히 기반에서 벗어났을 수도 있습니다.
Names Default To Here( 1 );
start = Tick Seconds();
dt_main = Data Table( "maintable" );
dt_ref = Data Table( "referencetable" );
Try( dt_ref << delete columns( :New A, :New B ) );
// Create a subset of the maintable that contains only data for the rows in
// the reference table that have comment value of A>B
// Select only A>B rows in reference table
dt_ref << select where(:Comment == "A > B");
dtAB = dt_ref<<SUBSET>0, dtMainJoin << delete rows);
dtMainJoin = dtMainJoin << sort(by(:RowNum), Order(ascending), Replace table(1));
dtMainJoin << delete columns(:RowNum);
// Split the table to create the New A and New B Columns
dtSplit = dtMainJoin <<
Split(
Split By( :Type ),
Split( :Value ),
Group( :X Coord, :Y Coord, :Wafer ID ),
Output Table(
"Split of Join of maintable with Subset of referencetable 2 by Type"
),
Sort by Column Property
);
// Clean up dtMainJoin table by closing it
close(dtMainJoin, nosave);
// Rename the A and B columns
dtSplit:A << set name("New A");
dtSplit:B << set name("New B");
// Use Update to merge the dtSplit data into the reference table
dt_ref << Update(
With(
Data Table(
dtSplit
)
),
Match Columns( :X Coord = :X Coord, :Y Coord = :Y Coord, :Wafer ID = :Wafer ID )
);
// Clean up
close( dtSplit, nosave );
dt_ref << end data update;
end = Tick Seconds();
Show( Char( end - start ) );</SUBSET>