process-data-standard-format-to-json update

This commit is contained in:
Mike Phares 2025-04-19 08:15:08 -07:00
parent aa6461c62d
commit 74e9fc33af
5 changed files with 33 additions and 484 deletions

18
.vscode/launch.json vendored
View File

@ -11,6 +11,24 @@
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net8.0/win-x64/File-Folder-Helper.dll",
"args": [
"s",
"X",
"L:/Tmp/MET08ANLYSDIFAAST230",
"Day-Helper-2025-03-06",
"*.pdsf",
"s",
"X",
"D:/ProgramData/VisualStudioCode|D:/6-Other-Large-Z/Linux-Ubuntu-Phares/home/lphares/dorico",
"Day-Helper-2025-04-07",
"z-include-patterns.nsv",
"z-exclude-patterns.nsv",
"https://isccvm57294f1ed/VisualStudioCode|hxttps://dorico.phares.duckdns.org|hxttps://mestsa006.infineon.com/VisualStudioCode",
"+|G|G|G|-",
"||||",
"666",
"777",
"888",
"999",
"s",
"X",
"C:/Users/PHARES/AppData/Local/IFXApps/gatus",

View File

@ -7,7 +7,7 @@ internal static partial class Helper20250306 {
internal static void ProcessDataStandardFormatToJson(ILogger<Worker> logger, List<string> args) {
string searchPattern = args[2];
string sourceDirectory = Path.GetFullPath(args[0]);
string[] files = Directory.GetFiles(sourceDirectory, searchPattern, SearchOption.AllDirectories);
string[] files = Directory.GetFiles(sourceDirectory, searchPattern, SearchOption.TopDirectoryOnly);
if (files.Length != 1)
logger.LogWarning("<{files}>(s)", files.Length);
else
@ -21,21 +21,24 @@ internal static partial class Helper20250306 {
logger.LogWarning("<{columnTitlesLine}> is null", nameof(columnTitlesLine));
else {
string? text = ProcessDataStandardFormatToLastDataLine(lines, columnTitlesLine.Value);
File.WriteAllText(".lbl", text);
File.WriteAllText(Path.Combine(".vscode", "helper", ".lbl"), text);
if (lines.Length < columnTitlesLine.Value + 1)
logger.LogWarning("<{lines}>(s)", lines.Length);
else {
string json = ProcessDataStandardFormatToJson(columnTitlesLine.Value, [], lines);
File.WriteAllText(".json", json);
File.WriteAllText(Path.Combine(".vscode", "helper", ".json"), json);
}
}
}
private static int? GetProcessDataStandardFormatColumnTitlesLine(string[] lines) {
int? result = null;
bool foundEndOfFile = false;
for (int i = 0; i < lines.Length; i++) {
if (lines[i].StartsWith("END_OFFSET") && i + 2 < lines.Length) {
result = i + 1;
if (lines[i] == "EOF")
foundEndOfFile = true;
if (foundEndOfFile && lines[i].StartsWith("END_OFFSET") && i + 3 < lines.Length) {
result = i + 2;
break;
}
}
@ -46,7 +49,7 @@ internal static partial class Helper20250306 {
string? result = null;
for (int i = columnTitlesLine + 1; i < lines.Length; i++) {
if (lines[i].StartsWith("NUM_DATA_ROWS")) {
result = lines[i - 1];
result = lines[i - 2];
break;
}
}
@ -60,12 +63,13 @@ internal static partial class Helper20250306 {
string value;
string[] segments;
if (columns.Length == 0)
columns = lines[columnTitlesLine].Trim().Split('\t');
columns = lines[columnTitlesLine].Trim().Split('|');
int columnsLength = columns.Length - 2;
for (int i = columnTitlesLine + 1; i < lines.Length; i++) {
line = "{";
segments = lines[i].Trim().Split('\t');
if (segments.Length != columns.Length)
break;
segments = lines[i].Trim().Split('|');
if (segments.Length != columnsLength)
continue;
for (int c = 1; c < segments.Length; c++) {
value = segments[c].Replace("\"", "\\\"").Replace("\\", "\\\\");
line += '"' + columns[c].Trim('"') + '"' + ':' + '"' + value + '"' + ',';
@ -73,7 +77,7 @@ internal static partial class Helper20250306 {
line = line.Substring(0, line.Length - 1) + '}' + ',' + '\n';
result += line;
}
result = result.Substring(0, result.Length - 1) + ']';
result = result.Substring(0, result.Length - 2) + ']';
return result;
#pragma warning restore CA1845, IDE0057
}

View File

@ -1,148 +0,0 @@
"use strict";
// getValue($('gv.thicknessPoints', ''), $('dcp.BIORAD2/csv/Index', '0'));
function getCollectionParseFloat(collection) {
let result = [];
let value;
for (let i = 0; i < collection.length; i++) {
value = parseFloat(collection[i]);
result.push(value);
}
return result;
}
function getSum(collection) {
let result = 0;
if (!collection || collection.length === 0) {
result = 0;
}
else {
for (let i = 0; i < collection.length; i++) {
result += collection[i];
}
}
return result;
}
function getAverage(collection) {
let result = null;
if (collection == null || collection.length === 0)
result = 0;
else {
let sum = getSum(collection);
result = sum / collection.length;
}
return result;
}
function getValueB(thicknessPoints, index) {
let result = null;
if (index === 13) {
if (thicknessPoints != undefined && thicknessPoints.length > 1) {
let collection = thicknessPoints[0] === '|' ? thicknessPoints.substring(1).split('|') : thicknessPoints.split('|');
let collectionParseFloat = getCollectionParseFloat(collection);
let thicknessFourteen3mmEdgeMean = getAverage([[collectionParseFloat[10], collectionParseFloat[11], collectionParseFloat[12], collectionParseFloat[13]]]);
let thicknessFourteenMeanFrom = getAverage([[collectionParseFloat[1], collectionParseFloat[2], collectionParseFloat[6], collectionParseFloat[7]]]);
result = (thicknessFourteen3mmEdgeMean - thicknessFourteenMeanFrom) / thicknessFourteenMeanFrom * 100;
}
}
return result;
}
function getVariance(collection) {
let result = null;
if (collection == null || collection.length === 0)
result = null;
else {
let variance = 0;
let t = collection[0];
for (let i = 1; i < collection.length; i++) {
t += collection[i];
const diff = ((i + 1) * collection[i]) - t;
variance += diff * diff / ((i + 1.0) * i);
}
result = variance / (collection.length - 1);
}
return result;
}
// $('gv.thicknessPoints', '') + '|' + $('dcp.BIORAD2/csv/Thickness', '')
// $('gv.thicknessPoints', '') + '|' + $('dcp.BIORAD3/csv/Thickness', '')
// $('gv.thicknessPoints', '') + '|' + $('dcp.BIORAD4/csv/Thickness', '')
// $('gv.thicknessPoints', '') + '|' + $('dcp.BIORAD5/b-csv/Thickness', '')
// \\mesfs.infineon.com\EC_Characterization_Si\Archive\BIORAD2\2025_Week_08\2025-02-20\64-659712-4626_2025-02-20_11;50_AM_5144331401\638756490128318288
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14
const thicknessPoints = getCollectionParseFloat('|4.022|3.952|3.936|3.971|3.954|3.976|3.949|3.906|3.967|3.995|3.997|3.932|3.766|3.890'.substring(1).split('|'));
const thicknessTenPoints = thicknessPoints.slice(0, 10);
const thicknessFourteenCriticalPointsAverage = getAverage(thicknessTenPoints); // 15 // *3.962799999999999
const thicknessFourteenCriticalPointsStdDev = Math.sqrt(getVariance(thicknessTenPoints)); // 16 // *0.0318496467798311
const thicknessFourteenCenterMean = thicknessPoints[4]; // 17 // 3.954
const thicknessFourteenMeanFrom = getAverage([thicknessPoints[1], thicknessPoints[2], thicknessPoints[6], thicknessPoints[7]]); // 18 // *3.954
const thicknessFourteen5mmEdgeMean = getAverage([thicknessPoints[0], thicknessPoints[9]]); // 19 // *4.0085
const thicknessFourteen3mmEdgeMean = getAverage([thicknessPoints[10], thicknessPoints[11], thicknessPoints[12], thicknessPoints[13]]); // 20 // *3.89625
const thicknessFourteen5mmEdgePercent = (thicknessFourteen5mmEdgeMean - thicknessFourteenMeanFrom) / thicknessFourteenMeanFrom * 100; // 21 // *1.848440576764267
const thicknessFourteen3mmEdgePercent = (thicknessFourteen3mmEdgeMean - thicknessFourteenMeanFrom) / thicknessFourteenMeanFrom * 100; // 22 // *-1.0036206567998442
console.log(thicknessFourteenCriticalPointsAverage);
// getValue($('dcp.BIORAD2/csv/Batch', ''), $('dcp.BIORAD2/csv/Wafer', ''));
function getSlot(wafer) {
let result = null;
if (wafer.length !== 1 && wafer.length !== 2)
result = null;
else {
let slot = parseInt(wafer);
if (slot < 1 || slot > 27)
result = null;
else
result = slot < 10 ? '0' + slot : slot;
}
return result;
}
function getBatch(batch, jobId, wafer) {
let result = null;
const slot = getSlot(wafer);
result = slot == null ? jobId : batch;
return result;
}
function getWafer(wafer) {
let result = null;
const slot = getSlot(wafer);
result = slot == null ? wafer : slot;
return result;
}
function getValue(batch, wafer) {
let result = null;
const slot = getSlot(wafer);
const value = slot == null ? wafer : batch;
result = value.replace(/[\{\}\\\/\:\*\?\"\<\>\|]/g, '_');
return result;
}
const values = [
{ wafer: '11', jobId: 'BIORAD2', batch: 'O172068.1.60', waferCheck: '11', batchCheck: 'O172068.1.60', mid: 'O172068.1.60' },
{ wafer: '27-588493-5008', jobId: 'BIORAD2', batch: 'BIORAD#2', waferCheck: '27-588493-5008', batchCheck: 'BIORAD2', mid: '27-588493-5008' },
{ wafer: '27-588493-5"008', jobId: 'BIORAD2', batch: 'BIORAD#2', waferCheck: '27-588493-5008', batchCheck: 'BIORAD2', mid: '27-588493-5_008' },
];
const wafer = "11";
const jobId = "BIORAD2";
const batch = "O172068.1.60";
const waferCheck = getWafer(wafer);
const batchCheck = getBatch(batch, jobId, wafer);
const mid = getValue(batch, wafer);
console.log(mid);
values.forEach(element => {
let mid = getValue(element.batch, element.wafer);
if (mid != element.mid)
console.error("MID doesn't match!");
else
console.info('Match');
});

View File

@ -1,187 +0,0 @@
"use strict";
// $('dcp.CDE4/csv/Avg', '') == '' ? '' : (parseFloat($('dcp.CDE4/csv/Dev', '0')) / parseFloat($('dcp.CDE4/csv/Avg', '0'))).toFixed(2) + '%'
// getValue($('dcp.CDE4/csv/Avg', ''), $('dcp.CDE4/csv/Dev', '0'), $('dcp.CDE4/csv/Avg', '0'));
function roundNumber(number, digits) {
let result;
const multiple = Math.pow(10, digits);
result = Math.round(number * multiple) / multiple;
return result;
}
function getValue(avgRaw, devZeroDefault, avgZeroDefault) {
let result;
if (avgRaw == '')
result = '';
else {
let raw = parseFloat(devZeroDefault) / parseFloat(avgZeroDefault);
result = roundNumber(raw, 2);
}
return result;
}
const dev = 0.383;
const avg = 33.5810;
const value = getValue(avg, dev);
console.log("value: " + value);
// getValue(self, self.length, $('dcp.CDE4/csv/MesEntity', ''), $('dcp.CDE4/csv/Title', ''), $('dcp.CDE4/csv/Recipe', ''), getContextData('2', 'cds.PROCESS_JOBID', ''));
function tryParseInt(str, defaultValue) {
const parsedValue = parseInt(str);
return isNaN(parsedValue) ? defaultValue : parsedValue;
}
function getReactorAndRDS(defaultReactor, defaultRDS, text, formattedText, segments) {
let result = {};
let rds;
let reactor;
let rdsValue;
if (text == null || text.length === 0 || segments.length === 0 || formattedText == null || formattedText.length === 0)
reactor = defaultReactor;
else
reactor = segments[0];
if (segments.length <= 1 || !tryParseInt(segments[1], false) || rdsValue < 99)
rds = defaultRDS;
else
rds = segments[1];
if (reactor.length > 3) {
rds = reactor;
reactor = defaultReactor;
}
result = { reactor: reactor, rds: rds };
return result;
}
function getLayerAndPSN(defaultLayer, defaultPSN, segments) {
let result = {};
let psn;
let layer;
if (segments.length <= 2) {
psn = defaultPSN;
layer = defaultLayer;
}
else {
let segmentsB = segments[2].split('.');
psn = segmentsB[0];
if (segmentsB.length <= 1)
layer = defaultLayer;
else {
layer = segmentsB[1];
if (layer.length > 1 && layer[0] === '0')
layer = layer.substring(1);
}
}
result = { layer: layer, psn: psn };
return result;
}
function getZone(segments) {
let result = '';
if (segments.length <= 3)
result = '';
else {
result = segments[3];
if (result.length > 1 && result[0] === '0')
result = result.substring(1);
}
return result;
}
function getArray(text) {
let result = {};
let lot = '';
let psn = '';
let rds = '';
let zone = '';
let layer = '';
let reactor = '';
let employee = '';
let defaultPSN = '';
let defaultRDS = '';
let defaultZone = '';
let defaultLayer = '';
let defaultReactor = '';
let defaultEmployee = '';
const processOnly = /^[a-zA-z]{2,3}/;
const processOnlyB = /^[a-zA-z][0-9]{2,4}$/;
const normal = /^[0-9]{2}[.][0-9]{1}[.]?[0-9]{0,1}/;
const fileSystemSafe = /[\\,\/,\:,\*,\?,\"",\<,\>,\|]/;
if (text.match(processOnlyB)) {
lot = text.toUpperCase();
psn = defaultPSN;
rds = defaultRDS;
zone = defaultZone;
layer = defaultLayer;
reactor = defaultReactor;
employee = defaultEmployee;
}
else if (text == null || text.length === 0 || (text.length == 2 && text.match(processOnly))) {
lot = text;
employee = lot;
psn = defaultPSN;
rds = defaultRDS;
zone = defaultZone;
layer = defaultLayer;
reactor = defaultReactor;
}
else if (text.match(normal)) {
let segments = text.split('.');
lot = text;
psn = defaultPSN;
rds = defaultRDS;
layer = segments[1];
reactor = segments[0];
employee = defaultEmployee;
if (segments.length <= 2)
zone = defaultZone;
else
zone = segments[2];
}
else {
lot = text.replace(fileSystemSafe, "_").split('\r')[0].split('\n')[0];
if (lot.length > 2 && lot[0] == '1' && (lot[1] == 'T' || lot[1] == 't'))
lot = lot.substring(2);
let segments = lot.split('-');
let reactorAndRDS = getReactorAndRDS(defaultReactor, defaultRDS, text, lot, segments);
reactor = reactorAndRDS.reactor;
rds = reactorAndRDS.rds;
let layerAndPSN = getLayerAndPSN(defaultLayer, defaultPSN, segments);
layer = layerAndPSN.layer;
psn = layerAndPSN.psn;
zone = getZone(segments);
if (segments.length <= 4)
employee = defaultEmployee;
else
employee = segments[4];
}
result = { rds: rds, psn: psn, reactor: reactor, layer: layer, zone: zone, employee: employee, lot: lot };
return result;
};
function getValueReactor(value, length, mesEntity, title, recipe, processJobId) {
if (recipe.toUpperCase() === 'RLOW_STD')
return mesEntity;
else if (recipe.toUpperCase() === 'RMID_STD')
return mesEntity;
else if (recipe.toUpperCase() === 'RHI_STD')
return mesEntity;
else if (recipe.toUpperCase() === 'THINSPC')
return mesEntity;
else if (length === 0 && processJobId == 0)
return getArray(title).reactor;
else if (length === 0)
return processJobId;
else
return value;
}
const self = '';
const mesEntity = 'CDE4';
const title = '75-663192-5281.1';
const recipe = '8IN_INF';
const processJobId = '0';
const valueReactor = getValueReactor(self, self.length, mesEntity, title, recipe, processJobId);
console.log("value: " + valueReactor);

View File

@ -1,138 +0,0 @@
"use strict";
function getCollectionParseFloat(collection) {
let result = [];
let value;
for (let i = 0; i < collection.length; i++) {
value = parseFloat(collection[i]);
result.push(value);
}
return result;
}
function getSum(collection) {
let result = 0;
if (!collection || collection.length === 0) {
result = 0;
}
else {
for (let i = 0; i < collection.length; i++) {
result += collection[i];
}
}
return result;
}
function getAverage(collection) {
let result = null;
if (collection == null || collection.length === 0)
result = 0;
else {
let sum = getSum(collection);
result = sum / collection.length;
}
return result;
}
function getVariance(collection) {
let result = null;
if (collection == null || collection.length === 0)
result = null;
else {
let variance = 0;
let t = collection[0];
for (let i = 1; i < collection.length; i++) {
t += collection[i];
const diff = ((i + 1) * collection[i]) - t;
variance += diff * diff / ((i + 1.0) * i);
}
result = variance / (collection.length - 1);
}
return result;
}
function getNineEdgeMeanDelta(edge4mmRhoPoints, edge10mmRhoPoints) {
let result;
const nine4mmEdgeSum = getSum(edge4mmRhoPoints);
const nine10mmEdgeSum = getSum(edge10mmRhoPoints);
result = (nine4mmEdgeSum - nine10mmEdgeSum) / nine10mmEdgeSum * 100;
return result;
}
function getMax(collection) {
let result = collection[0];
for (let i = 1; i < collection.length; i++) {
if (collection[i] > result) {
result = collection[i];
}
}
return result;
}
function getMin(collection) {
let result = collection[0];
for (let i = 1; i < collection.length; i++) {
if (collection[i] < result) {
result = collection[i];
}
}
return result;
}
function getNineResRangePercent(criticalRhoPoints) {
let result;
const nineCriticalPointsAverage = getAverage(criticalRhoPoints);
// result = (Math.max(...criticalRhoPoints) - Math.min(...criticalRhoPoints)) / nineCriticalPointsAverage * 100;
// let max = criticalRhoPoints.reduce((a, b) => Math.max(a, b));
// let min = criticalRhoPoints.reduce((a, b) => Math.min(a, b));
// result = (max - min) / nineCriticalPointsAverage * 100;
// let max = criticalRhoPoints.sort((a, b) => b - a);
// let min = criticalRhoPoints.sort((a, b) => a - b);
// result = (max[0] - min[0]) / nineCriticalPointsAverage * 100;
let max = getMax(criticalRhoPoints);
let min = getMin(criticalRhoPoints);
result = (max - min) / nineCriticalPointsAverage * 100;
return result;
}
function getValue(edge10mmRhoPoints, index) {
let result = null;
if (index === 8) {
if (edge10mmRhoPoints != undefined && edge10mmRhoPoints.length > 1) {
let collection = edge10mmRhoPoints[0] === '|' ? edge10mmRhoPoints.substring(1).split('|') : edge10mmRhoPoints.split('|');
let collectionParseFloat = getCollectionParseFloat(collection);
result = Math.round(getAverage(collectionParseFloat) * 10000000) / 10000000;
}
}
return result;
}
// 0 1 2 3 4 5 6 7 8
// 1 2 3 4 5 6 7 8 9
const allRhoAvg = getCollectionParseFloat('|2.648|3.076|2.877|2.747|2.821|2.765|2.669|2.814|2.876'.substring(1).split('|'));
const edge4mmRhoPoints = getCollectionParseFloat('|2.877|2.747|2.669|2.814'.substring(1).split('|'));
const edge10mmRhoPoints = getCollectionParseFloat('|3.076|2.821|2.765|2.876'.substring(1).split('|'));
const criticalRhoPoints = getCollectionParseFloat('|2.648|3.076|2.821|2.765|2.876'.substring(1).split('|'));
// 0 1 2 3 4 5 6 7 8
// 1 2 3 4 5 6 7 8 9
const allPhase = getCollectionParseFloat('|88.874|88.999|89.085|89.029|89.018|89.007|89.049|89.024|89.007'.substring(1).split('|'));
const criticalPhasePoints = getCollectionParseFloat('|88.874|88.999|89.018|89.007|89.007'.substring(1).split('|'));
const nineMean = getAverage(allRhoAvg);
const nine4mmEdgeMean = getAverage(edge4mmRhoPoints);
const nine10mmEdgeMean = getAverage(edge10mmRhoPoints);
const nineCriticalPointsAverage = getAverage(criticalRhoPoints);
const nineResRangePercent = getNineResRangePercent(criticalRhoPoints);
const nineCriticalPointsStdDev = Math.sqrt(getVariance(criticalRhoPoints));
const nineCriticalPointsPhaseAngleAverage = getAverage(criticalPhasePoints);
const nineEdgeMeanDelta = getNineEdgeMeanDelta(edge4mmRhoPoints, edge10mmRhoPoints);
console.log(nineCriticalPointsStdDev);
// Sequence to date string
// getValue(self, getContextData('1', 'cds.SEQUENCE', ''));
const index = 8;
const gv_edge10mmRhoPoints = '|3.076|2.821|2.765|2.876';
const value = roundNumber(getValue(gv_edge10mmRhoPoints, index), 7);
console.log("value: " + value);