From 2ec484da411eb5aa3ac3db362bbea61a7b3bee76 Mon Sep 17 00:00:00 2001 From: "D. Berge" Date: Wed, 9 Mar 2022 21:25:04 +0100 Subject: [PATCH 1/2] Fix detection of sequence modification time --- lib/www/server/lib/qc/last-modified.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/www/server/lib/qc/last-modified.js b/lib/www/server/lib/qc/last-modified.js index 5b2a3e4..05c3de9 100644 --- a/lib/www/server/lib/qc/last-modified.js +++ b/lib/www/server/lib/qc/last-modified.js @@ -24,6 +24,8 @@ async function sequenceLastModified (projectId, sequence) { FROM ( SELECT sequence, string_to_array(hash, ':') AS hash FROM raw_shots + UNION SELECT sequence, string_to_array(hash, ':') AS hash + FROM final_shots ) AS h GROUP BY sequence HAVING sequence = $1; From 21d53838828e258360f67e7dbe7f7135e9f61463 Mon Sep 17 00:00:00 2001 From: "D. Berge" Date: Wed, 9 Mar 2022 21:25:47 +0100 Subject: [PATCH 2/2] Update QC check definitions --- etc/qc/default/definitions.yaml | 66 ++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 22 deletions(-) diff --git a/etc/qc/default/definitions.yaml b/etc/qc/default/definitions.yaml index 2b17111..b54f52e 100644 --- a/etc/qc/default/definitions.yaml +++ b/etc/qc/default/definitions.yaml @@ -7,14 +7,20 @@ id: missing_shots check: | const sequence = currentItem; - const sp0 = Math.min(sequence.fsp, sequence.lsp); - const sp1 = Math.max(sequence.fsp, sequence.lsp); - const missing = preplots.filter(r => r.line == sequence.line && - r.point >= sp0 && r.point <= sp1 && - !sequence.shots.find(s => s.point == r.point) - ); + let results; + if (sequence.missing_shots) { + results = { + shots: {} + } + const missing_shots = missingShotpoints.filter(i => !i.ntba); + for (const shot of missing_shots) { + results.shots[shot.point] = { remarks: "Missed shot", labels: [ "QC", "QCAcq" ] }; + } + } else { + results = true; + } - missing.length == 0 || missing.map(r => `Missing shot: ${r.point}`).join("\n") + results; - name: "Gun QC" disabled: false @@ -25,15 +31,15 @@ iterate: "sequences" id: seq_no_gun_data check: | - const sequence = currentItem; - currentItem.has_smsrc_data || "Sequence has no gun data" + shotpoints.some(i => i.meta?.raw?.smsrc) || "Sequence has no gun data" - name: "Missing gun data" id: missing_gun_data + ignoreAllFailed: true check: | - sequences.some(s => s.sequence == currentItem.sequence && s.has_smsrc_data) - ? (!!currentItem._("raw_meta.smsrc.guns") || "Missing gun data") - : true + !!currentItem._("raw_meta.smsrc.guns") + ? true + : "Missing gun data" - name: "No fire" @@ -56,8 +62,8 @@ .guns .filter(gun => ((gun[2] == gunData.src_number) && (gun[pressure]/parameters.gunPressureNominal - 1) > parameters.gunPressureToleranceRatio)) .map(gun => - `source ${gun[2]}, string ${gun[0]}, gun ${gun[1]}, pressure: ${gun[pressure]} / ${parameters.gunPressureNominal} = ${(Math.abs(gunData.manifold/parameters.gunPressureNominal - 1)*100).toFixed(1)}% > ${(parameters.gunPressureToleranceRatio*100).toFixed(1)}%` - ); + `source ${gun[2]}, string ${gun[0]}, gun ${gun[1]}, pressure: ${gun[pressure]} / ${parameters.gunPressureNominal} = ${(Math.abs(gunData.manifold/parameters.gunPressureNominal - 1)*100).toFixed(2)}% > ${(parameters.gunPressureToleranceRatio*100).toFixed(2)}%` + ).join(" \n"); results && results.length ? results : true @@ -201,7 +207,7 @@ check: | const currentShot = currentItem; Math.abs(currentShot.error_i) <= parameters.crosslineError - || `Crossline error (${currentShot.type}): ${currentShot.error_i.toFixed(1)} > ${parameters.crosslineError}` + || `Crossline error (${currentShot.type}): ${currentShot.error_i.toFixed(2)} > ${parameters.crosslineError}` - name: "Inline" @@ -209,7 +215,7 @@ check: | const currentShot = currentItem; Math.abs(currentShot.error_j) <= parameters.inlineError - || `Inline error (${currentShot.type}): ${currentShot.error_j.toFixed(1)} > ${parameters.inlineError}` + || `Inline error (${currentShot.type}): ${currentShot.error_j.toFixed(2)} > ${parameters.inlineError}` - name: "Centre of source preplot deviation (moving average)" @@ -222,11 +228,16 @@ id: crossline_average check: | const currentSequence = currentItem; - const i_err = currentSequence.shots.filter(s => s.error_i != null).map(a => a.error_i); + //const i_err = shotpoints.filter(s => s.error_i != null).map(a => a.error_i); + const i_err = shotpoints.map(i => + (i.errorfinal?.coordinates ?? i.errorraw?.coordinates)[0] + ) + .filter(i => !isNaN(i)); + if (i_err.length) { const avg = i_err.reduce( (a, b) => a+b)/i_err.length; avg <= parameters.crosslineErrorAverage || - `Average crossline error: ${avg.toFixed(1)} > ${parameters.crosslineErrorAverage}` + `Average crossline error: ${avg.toFixed(2)} > ${parameters.crosslineErrorAverage}` } else { `Sequence ${currentSequence.sequence} has no shots within preplot` } @@ -239,16 +250,27 @@ check: | const currentSequence = currentItem; const n = parameters.inlineErrorRunningAverageShots; // For brevity - const results = currentSequence.shots.slice(n/2, -n/2).map( (shot, index) => { - const shots = currentSequence.shots.slice(index, index+n).map(i => i.error_j).filter(i => i !== null); + const results = shotpoints.slice(n/2, -n/2).map( (shot, index) => { + const shots = shotpoints.slice(index, index+n).map(i => + (i.errorfinal?.coordinates ?? i.errorraw?.coordinates)[1] + ).filter(i => i !== null); if (!shots.length) { // We are outside the preplot // Nothing to see here, move along return true; } const mean = shots.reduce( (a, b) => a+b ) / shots.length; - return Math.abs(mean) <= parameters.inlineErrorRunningAverageValue || - `Running average inline error: shot ${shot.point}, ${mean.toFixed(1)} > ${parameters.inlineErrorRunningAverageValue}` + return Math.abs(mean) <= parameters.inlineErrorRunningAverageValue || [ + shot.point, + { + remarks: `Running average inline error: ${mean.toFixed(2)} > ${parameters.inlineErrorRunningAverageValue}`, + labels: [ "QC", "QCNav" ] + } + ] }).filter(i => i !== true); results.length == 0 || results.join("\n"); + results.length == 0 || { + remarks: "Sequence exceeds inline error running average limit", + shots: Object.fromEntries(results) + }