diff --git a/cgi/musrfit_startup.xml b/cgi/musrfit_startup.xml
index 94eb3ec..8310c5e 100644
--- a/cgi/musrfit_startup.xml
+++ b/cgi/musrfit_startup.xml
@@ -52,7 +52,7 @@
d%yyyy%/tdc/deltat_tdc_flame_%rrrr%.bin
d%yyyy%/tdc/mdu/deltat_tdc_flame_%yyyy%_%rrrr%.mdu
- d%yyyy%/tdc/root/deltat_tdc_gpd_%yyyy%_%rrrr%.root
+ d%yyyy%/tdc/root/deltatbc_tdc_gpd_%yyyy%_%rrrr%.root
d%yyyy%/deltat_mue1_%rrrr%.bin
d%yyyy%/deltat_fq_si_%rrrr%.bin
d%yyyy%/deltat_strobo_%rrrr%.bin
@@ -67,7 +67,7 @@
d%yyyy%/tdc/deltat_tdc_gpd_%rrrr%.bin
d%yyyy%/tdc/mdu/deltat_tdc_gpd_%rrrr%.mdu
- d%yyyy%/tdc/root/deltat_tdc_gps_%yyyy%_%rrrr%.root
+ d%yyyy%/tdc/root/deltatbc_tdc_gps_%yyyy%_%rrrr%.root
d%yyyy%/deltat_ccr_%rrrr%.bin
d%yyyy%/deltat_he3_%rrrr%.bin
d%yyyy%/deltat_stutt_%rrrr%.bin
diff --git a/muSRFitlib.js b/muSRFitlib.js
index 5d79f62..715ec6b 100644
--- a/muSRFitlib.js
+++ b/muSRFitlib.js
@@ -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";
diff --git a/tests/run-naming.test.js b/tests/run-naming.test.js
index 52e4a50..3e75ffe 100644
--- a/tests/run-naming.test.js
+++ b/tests/run-naming.test.js
@@ -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");