Fix RUN filename round-trip for GPD and HAL 2023+ eras
parseMSRRunFileToken could not reconstruct instrument/year/run for names runFileNameAuto emits for GPD pre-2008 (deltat_pta_gpd), GPD 2008-2022 (deltat_tdc_gpd), and HAL 2023+ (deltat_tdc_hifi). Keep deltatbc as the canonical GPS/GPD 2023+ ROOT-era name, restoring the shipped musrfit_startup.xml templates to match, and pin the full instrument/era matrix with a forward/reverse round-trip regression test.
This commit is contained in:
1 parent
c6fc699fe0
commit
62f8eec980
3 files changed
+59
-10
No files matched your search
@@ -52,7 +52,7 @@
|
||||
<run_name_template inst="flame">d%yyyy%/tdc/deltat_tdc_flame_%rrrr%.bin</run_name_template>
|
||||
<run_name_template inst="flame">d%yyyy%/tdc/mdu/deltat_tdc_flame_%yyyy%_%rrrr%.mdu</run_name_template>
|
||||
<!-- GPD/PSI -->
|
||||
<run_name_template inst="gpd">d%yyyy%/tdc/root/deltat_tdc_gpd_%yyyy%_%rrrr%.root</run_name_template>
|
||||
<run_name_template inst="gpd">d%yyyy%/tdc/root/deltatbc_tdc_gpd_%yyyy%_%rrrr%.root</run_name_template>
|
||||
<run_name_template inst="gpd">d%yyyy%/deltat_mue1_%rrrr%.bin</run_name_template>
|
||||
<run_name_template inst="gpd">d%yyyy%/deltat_fq_si_%rrrr%.bin</run_name_template>
|
||||
<run_name_template inst="gpd">d%yyyy%/deltat_strobo_%rrrr%.bin</run_name_template>
|
||||
@@ -67,7 +67,7 @@
|
||||
<run_name_template inst="gpd">d%yyyy%/tdc/deltat_tdc_gpd_%rrrr%.bin</run_name_template>
|
||||
<run_name_template inst="gpd">d%yyyy%/tdc/mdu/deltat_tdc_gpd_%rrrr%.mdu</run_name_template>
|
||||
<!-- GPS/PSI -->
|
||||
<run_name_template inst="gps">d%yyyy%/tdc/root/deltat_tdc_gps_%yyyy%_%rrrr%.root</run_name_template>
|
||||
<run_name_template inst="gps">d%yyyy%/tdc/root/deltatbc_tdc_gps_%yyyy%_%rrrr%.root</run_name_template>
|
||||
<run_name_template inst="gps">d%yyyy%/deltat_ccr_%rrrr%.bin</run_name_template>
|
||||
<run_name_template inst="gps">d%yyyy%/deltat_he3_%rrrr%.bin</run_name_template>
|
||||
<run_name_template inst="gps">d%yyyy%/deltat_stutt_%rrrr%.bin</run_name_template>
|
||||
|
||||
+10
-6
@@ -3257,16 +3257,20 @@ function parseMSRRunFileToken(fileToken) {
|
||||
instrument = "FLAME";
|
||||
filenameYear = "20" + match[1];
|
||||
run = match[2];
|
||||
} else if ((match = basename.match(/^deltatbc_tdc_(gps|gpd|hifi)_(\d{4})_(\d+)$/i))) {
|
||||
instrument = { gps: "GPS", gpd: "GPD", hifi: "HAL" }[match[1].toLowerCase()];
|
||||
} else if ((match = basename.match(/^deltatbc_tdc_(gps|gpd)_(\d{4})_(\d+)$/i))) {
|
||||
instrument = { gps: "GPS", gpd: "GPD" }[match[1].toLowerCase()];
|
||||
filenameYear = match[2];
|
||||
run = match[3];
|
||||
} else if ((match = basename.match(/^deltat_tdc_(gps|ltf|dolly)(?:_(\d{4}))?_(\d+)$/i))) {
|
||||
instrument = { gps: "GPS", ltf: "LTF", dolly: "Dolly" }[match[1].toLowerCase()];
|
||||
} else if ((match = basename.match(/^deltat_tdc_(gps|gpd|ltf|dolly)(?:_(\d{4}))?_(\d+)$/i))) {
|
||||
instrument = { gps: "GPS", gpd: "GPD", ltf: "LTF", dolly: "Dolly" }[match[1].toLowerCase()];
|
||||
filenameYear = match[2] || "";
|
||||
run = match[3];
|
||||
} else if ((match = basename.match(/^deltat_pta_(gps|ltf|dolly)_(\d+)$/i))) {
|
||||
instrument = { gps: "GPS", ltf: "LTF", dolly: "Dolly" }[match[1].toLowerCase()];
|
||||
} else if ((match = basename.match(/^deltat_pta_(gps|gpd|ltf|dolly)_(\d+)$/i))) {
|
||||
instrument = { gps: "GPS", gpd: "GPD", ltf: "LTF", dolly: "Dolly" }[match[1].toLowerCase()];
|
||||
run = match[2];
|
||||
} else if ((match = basename.match(/^deltat_tdc_hifi_(\d{4})_(\d+)$/i))) {
|
||||
instrument = "HAL";
|
||||
filenameYear = match[1];
|
||||
run = match[2];
|
||||
} else if ((match = basename.match(/^deltat_tdc_vms_(\d{4})_(\d+)$/i))) {
|
||||
instrument = "VMS";
|
||||
|
||||
@@ -344,8 +344,8 @@ function testAllInstrumentsRunLines() {
|
||||
// [instrument, run, year, accepted sub-path, expected RUN line]
|
||||
["LEM", 7, "2026", "d2026/tdc/lem26_his_0007.root",
|
||||
"RUN d2026/tdc/lem26_his_0007 MUE4 PSI MUSR-ROOT"],
|
||||
["GPS", 7, "2024", "d2024/tdc/root/deltat_tdc_gps_2024_0007.root",
|
||||
"RUN d2024/tdc/root/deltat_tdc_gps_2024_0007 PIM3 PSI MUSR-ROOT"],
|
||||
["GPS", 7, "2024", "d2024/tdc/root/deltatbc_tdc_gps_2024_0007.root",
|
||||
"RUN d2024/tdc/root/deltatbc_tdc_gps_2024_0007 PIM3 PSI MUSR-ROOT"],
|
||||
["LTF", 7, "2026", "d2026/tdc/deltat_tdc_ltf_0007.bin",
|
||||
"RUN d2026/tdc/deltat_tdc_ltf_0007 PIM3 PSI PSI-BIN"],
|
||||
["Dolly", 7, "2026", "d2026/tdc/root/deltat_tdc_dolly_2026_0007.root",
|
||||
@@ -436,6 +436,50 @@ function testSeriesDataFilePathPortableAbsolute() {
|
||||
fs.rmSync(tmp, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
// Every era boundary across the exposed instruments must forward-generate a
|
||||
// RUN line whose data-file token reverse-parses to the same instrument, year,
|
||||
// and run number. This guards the GUI/MSR synchronization that reads
|
||||
// instrument, year, and run data back out of RUN/ADDRUN directives.
|
||||
function testForwardReverseRoundTrip() {
|
||||
const cases = [
|
||||
["LEM", 2001, "2001", 514],
|
||||
["GPS", 1993, "1993", 514],
|
||||
["GPS", 2008, "2008", 514],
|
||||
["GPS", 2023, "2023", 514],
|
||||
["LTF", 1995, "1995", 514],
|
||||
["LTF", 2009, "2009", 514],
|
||||
["Dolly", 1998, "1998", 514],
|
||||
["Dolly", 2008, "2008", 514],
|
||||
["Dolly", 2023, "2023", 514],
|
||||
["VMS", 2025, "2025", 514],
|
||||
["GPD", 1993, "1993", 514],
|
||||
["GPD", 2008, "2008", 514],
|
||||
["GPD", 2023, "2023", 514],
|
||||
["HAL", 2012, "2012", 514],
|
||||
["HAL", 2023, "2023", 514],
|
||||
["FLAME", 2020, "2020", 514]
|
||||
];
|
||||
|
||||
cases.forEach(function(c) {
|
||||
const lib = loadLibrary();
|
||||
const line = lib.runFileNameAuto(c[3], c[1], c[0], "/psi.ch/data/");
|
||||
const token = lib.runFileTokenFromDirective(line);
|
||||
const parsed = lib.parseMSRRunFileToken(token);
|
||||
assert.strictEqual(
|
||||
parsed.instrument, c[0],
|
||||
c[0] + " " + c[1] + ": " + token
|
||||
);
|
||||
assert.strictEqual(
|
||||
parsed.year, c[2],
|
||||
c[0] + " " + c[1] + " year: " + token
|
||||
);
|
||||
assert.strictEqual(
|
||||
parsed.run, String(c[3]),
|
||||
c[0] + " " + c[1] + " run: " + token
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
testParseStartupXML();
|
||||
testCommentsAreSkipped();
|
||||
testTemplateExpansion();
|
||||
@@ -447,5 +491,6 @@ testPromiseResolverIsNotAcceptedAsAFileMatch();
|
||||
testEraAndFormatSelection();
|
||||
testPlatformEquivalence();
|
||||
testAllInstrumentsRunLines();
|
||||
testForwardReverseRoundTrip();
|
||||
testSeriesDataFilePathPortableAbsolute();
|
||||
console.log("Portable run-naming tests passed");
|
||||
Reference in new issue
Block a user