public static DemodulationConfig MakeStandardDemodulationConfig() { DemodulationConfig dc = new DemodulationConfig(); dc.AddTOFDetector("asymmetry"); dc.AddTOFDetector("bottomProbeScaled"); dc.AddTOFDetector("topProbeNoBackground"); dc.AddTOFDetector("battery"); dc.AddGatedDetector("magnetometer", Gate.WideGate()); dc.AddGatedDetector("gnd", Gate.WideGate()); //dc.AddGatedDetector("rfCurrent", Gate.WideGate()); //dc.AddGatedDetector("reflectedrf1Amplitude", Gate.WideGate()); //dc.AddGatedDetector("reflectedrf2Amplitude", Gate.WideGate()); dc.AddPointDetector("PhaseLockFrequency"); dc.AddPointDetector("PhaseLockError"); dc.AddPointDetector("NorthCurrent"); dc.AddPointDetector("SouthCurrent"); dc.AddPointDetector("BottomDetectorBackground"); dc.AddPointDetector("TopDetectorBackground"); dc.AddPointDetector("MiniFlux1"); dc.AddPointDetector("MiniFlux2"); dc.AddPointDetector("MiniFlux3"); dc.AddPointDetector("topPD"); dc.AddPointDetector("bottomPD"); dc.AddPointDetector("ValveMonV"); return(dc); }
public DemodulatedBlock DemodulateBlock(Block b, DemodulationConfig demodulationConfig) { List <Modulation> modulations = GetModulations(b); int numStates = (int)Math.Pow(2, modulations.Count); int[] channelsToAnalyse = new int[numStates]; for (int i = 0; i < numStates; i++) { channelsToAnalyse[i] = i; } return(DemodulateBlock(b, demodulationConfig, channelsToAnalyse)); }
static DemodulationConfig() { // here we stock the class' static library of configs up with some standard configs // a wide gate - integrate everything DemodulationConfigBuilder wide = delegate(Block b) { DemodulationConfig dc; GatedDetectorExtractSpec dg0, dg1, dg2, dg3, dg4, dg5, dg6, dg7; dc = new DemodulationConfig(); dc.AnalysisTag = "wide"; dg0 = GatedDetectorExtractSpec.MakeWideGate(0); dg0.Name = "top"; dg1 = GatedDetectorExtractSpec.MakeWideGate(1); dg1.Name = "norm"; dg2 = GatedDetectorExtractSpec.MakeWideGate(2); dg2.Name = "magnetometer"; dg2.Integrate = false; dg3 = GatedDetectorExtractSpec.MakeWideGate(3); dg3.Name = "gnd"; dg3.Integrate = false; dg4 = GatedDetectorExtractSpec.MakeWideGate(4); dg4.Name = "battery"; dg5 = GatedDetectorExtractSpec.MakeWideGate(5); dg5.Name = "rfCurrent"; dg5.Integrate = false; dg6 = GatedDetectorExtractSpec.MakeWideGate(6); dg6.Name = "reflectedrf1Amplitude"; dg7 = GatedDetectorExtractSpec.MakeWideGate(7); dg7.Name = "reflectedrf2Amplitude"; dc.GatedDetectorExtractSpecs.Add(dg0.Name, dg0); dc.GatedDetectorExtractSpecs.Add(dg1.Name, dg1); dc.GatedDetectorExtractSpecs.Add(dg2.Name, dg2); dc.GatedDetectorExtractSpecs.Add(dg3.Name, dg3); dc.GatedDetectorExtractSpecs.Add(dg4.Name, dg4); dc.GatedDetectorExtractSpecs.Add(dg5.Name, dg5); dc.GatedDetectorExtractSpecs.Add(dg6.Name, dg6); dc.GatedDetectorExtractSpecs.Add(dg7.Name, dg7); dc.PointDetectorChannels.Add("MiniFlux1"); dc.PointDetectorChannels.Add("MiniFlux2"); dc.PointDetectorChannels.Add("MiniFlux3"); dc.PointDetectorChannels.Add("NorthCurrent"); dc.PointDetectorChannels.Add("SouthCurrent"); dc.PointDetectorChannels.Add("PumpPD"); dc.PointDetectorChannels.Add("ProbePD"); return dc; }; standardConfigs.Add("wide", wide); //// fwhm of the tof pulse for top and norm, wide gates for everything else. //AddSliceConfig("fwhm", 0, 1); //// narrower than fwhm, takes only the center hwhm //AddSliceConfig("hwhm", 0, 0.5); //// only the fast half of the fwhm (NOT TRUE - 01Jul08JH) //AddSliceConfig("fast", -0.5, 0.5); //// the slow half of the fwhm (NOT TRUE - 01Jul08 JH) //AddSliceConfig("slow", 0.5, 0.5); //// the fastest and slowest molecules, used for estimating any tof related systematic. //// these gates don't overlap with the usual centred analysis gates (fwhm and cgate11). //AddSliceConfig("vfast", -0.85, 0.5); //AddSliceConfig("vslow", 0.85, 0.5); // for testing out different centred-gate widths for (int i = 1; i < 10; i++) AddFixedSliceConfig("wgate" + i, 2190, i * 20); for (int i = 1; i < 14; i++) AddFixedSliceConfig("shiftgate" + i, 1850 + i*50, 65); for (int i = 1; i < 7; i++) AddFixedSliceConfig("slicegate" + i, 2050 + i * 50, 25); for (int i = 1; i < 30; i++) AddFixedSliceConfig("pgate" + i, 2090 + i*10, 10); //// testing different gate centres. "slide0" is centred at -0.7 fwhm, "slide14" //// is centred and +0.7 fwhm. //for (int i = 0; i < 15; i++) // AddSliceConfig("slide" + i, (((double)i) / 10.0) - 0.7, 1); //// now some finer slices //double d = -1.4; //for (int i = 0; i < 15; i++) //{ // AddSliceConfig("slice" + i, d, 0.2); // d += 0.2; //} //// optimised gates for spring 2009 run //AddSliceConfig("optimum1", 0.3, 1.1); //AddSliceConfig("optimum2", 0.2, 1.1); // "background" gate DemodulationConfigBuilder background = delegate(Block b) { DemodulationConfig dc; GatedDetectorExtractSpec dg0, dg1; dc = new DemodulationConfig(); dc.AnalysisTag = "background"; dg0 = GatedDetectorExtractSpec.MakeWideGate(0); dg0.GateLow = 2550; dg0.GateHigh = 2600; dg0.Name = "top"; dg1 = GatedDetectorExtractSpec.MakeWideGate(1); dg1.Name = "norm"; dg1.GateLow = 750; dg1.GateHigh = 800; dc.GatedDetectorExtractSpecs.Add(dg0.Name, dg0); dc.GatedDetectorExtractSpecs.Add(dg1.Name, dg1); return dc; }; standardConfigs.Add("background", background); // add some fixed gate slices - the first three are the 1.1 sigma centre portion and two // non-overlapping portions either side. AddFixedSliceConfig("cgate11Fixed", 2156, 90); // This is normally ("cgate11Fixed", 2156, 90) AddFixedSliceConfig("vfastFixed", 2025, 41); AddFixedSliceConfig("vslowFixed", 2286, 41); // these "nudge" gates are chosen to, hopefully, tweak the 09_10 dataset so that the // RF1F channel, DB-normed in the non-linear way, is reduced to near zero AddFixedSliceConfig("nudgeGate1", 2161, 90); AddFixedSliceConfig("nudgeGate2", 2169, 90); AddFixedSliceConfig("nudgeGate3", 2176, 90); AddFixedSliceConfig("nudgeGate4", 2174, 90); AddFixedSliceConfig("nudgeGate5", 2188, 90); AddFixedSliceConfig("nudgeGate6", 2198, 90); AddFixedSliceConfig("nudgeGate7", 2208, 90); AddFixedSliceConfig("nudgeGate8", 2228, 90); AddFixedSliceConfig("wideNudgeGate1", 2198, 100); AddFixedSliceConfig("narrowNudgeGate1", 2198, 75); AddFixedSliceConfig("narrowNudgeGate2", 2198, 65); AddFixedSliceConfig("narrowNudgeGate3", 2198, 55); AddFixedSliceConfig("narrowNudgeGate4", 2198, 45); // these two are the fast and slow halves of the 1.1 sigma central gate. AddFixedSliceConfig("fastFixed", 2110, 45); AddFixedSliceConfig("slowFixed", 2201, 45); // two fairly wide gates that take in most of the slow and fast molecules. // They've been chosed to try and capture the wiggliness of our fast-slow // wiggles. AddFixedSliceConfig("widefastFixed", 1950, 150); AddFixedSliceConfig("wideslowFixed", 2330, 150); // A narrow centre gate for correlation analysis AddFixedSliceConfig("cgateNarrowFixed", 2175, 25); // A gate containing no molecules to look for edms caused by rf pickup AddFixedSliceConfig("preMolecularBackground", 1850, 50); // A demodulation config for Kr AddFixedSliceConfig("centreFixedKr", 2950, 90); }
//private static void AddSliceConfig(string name, double offset, double width) //{ // // the slow half of the fwhm // DemodulationConfigBuilder dcb = delegate(Block b) // { // DemodulationConfig dc; // GatedDetectorExtractSpec dg0, dg1, dg2, dg3, dg4; // dc = new DemodulationConfig(); // dc.AnalysisTag = name; // dg0 = GatedDetectorExtractSpec.MakeGateFWHM(b, 0, offset, width); // dg0.Name = "top"; // dg0.BackgroundSubtract = true; // dg1 = GatedDetectorExtractSpec.MakeGateFWHM(b, 1, offset, width); // dg1.Name = "norm"; // dg1.BackgroundSubtract = true; // dg2 = GatedDetectorExtractSpec.MakeWideGate(2); // dg2.Name = "mag1"; // dg2.Integrate = false; // dg3 = GatedDetectorExtractSpec.MakeWideGate(3); // dg3.Name = "short"; // dg3.Integrate = false; // dg4 = GatedDetectorExtractSpec.MakeWideGate(4); // dg4.Name = "battery"; // dc.GatedDetectorExtractSpecs.Add(dg0.Name, dg0); // dc.GatedDetectorExtractSpecs.Add(dg1.Name, dg1); // dc.GatedDetectorExtractSpecs.Add(dg2.Name, dg2); // dc.GatedDetectorExtractSpecs.Add(dg3.Name, dg3); // dc.GatedDetectorExtractSpecs.Add(dg4.Name, dg4); // dc.PointDetectorChannels.Add("MiniFlux1"); // dc.PointDetectorChannels.Add("MiniFlux2"); // dc.PointDetectorChannels.Add("MiniFlux3"); // dc.PointDetectorChannels.Add("NorthCurrent"); // dc.PointDetectorChannels.Add("SouthCurrent"); // dc.PointDetectorChannels.Add("PumpPD"); // dc.PointDetectorChannels.Add("ProbePD"); // return dc; // }; // standardConfigs.Add(name, dcb); //} private static void AddFixedSliceConfig(string name, double centre, double width) { // the slow half of the fwhm DemodulationConfigBuilder dcb = delegate(Block b) { DemodulationConfig dc; GatedDetectorExtractSpec dg0, dg1, dg2, dg3, dg4, dg5, dg6, dg7; //This dodgy bit of code is to make sure that the reflected rf power meters // only select a single point in the centre of the rf pulse. It won't work // if either of the rf pulses is centred at a time not divisible w/o rem. by 10us int rf1CT = (int)b.Config.Settings["rf1CentreTime"]; int rf2CT = (int)b.Config.Settings["rf2CentreTime"]; int clock = (int)b.Config.Settings["clockFrequency"]; int conFac = clock / 1000000; dc = new DemodulationConfig(); dc.AnalysisTag = name; dg0 = new GatedDetectorExtractSpec(); dg0.Index = 0; dg0.Name = "top"; dg0.BackgroundSubtract = false; dg0.GateLow = (int)(centre - width); dg0.GateHigh = (int)(centre + width); dg1 = new GatedDetectorExtractSpec(); dg1.Index = 1; dg1.Name = "norm"; dg1.BackgroundSubtract = false; dg1.GateLow = (int)((centre - width) / kDetectorDistanceRatio); dg1.GateHigh = (int)((centre + width) / kDetectorDistanceRatio); dg2 = GatedDetectorExtractSpec.MakeWideGate(2); dg2.Name = "magnetometer"; dg2.Integrate = false; dg3 = GatedDetectorExtractSpec.MakeWideGate(3); dg3.Name = "gnd"; dg3.Integrate = false; dg4 = GatedDetectorExtractSpec.MakeWideGate(4); dg4.Name = "battery"; dg4.Integrate = false; //Add this in to analyse By in 3 axis internal magnetometer tests dg5 = GatedDetectorExtractSpec.MakeWideGate(5); dg5.Name = "rfCurrent"; dg5.Integrate = false; dg6 = new GatedDetectorExtractSpec(); dg6.Index = 6; dg6.Name = "reflectedrf1Amplitude"; dg6.BackgroundSubtract = false; dg6.GateLow = 800; dg6.GateHigh = 1800; //dg6.GateLow = (rf1CT / conFac) - 1; //dg6.GateHigh = (rf1CT / conFac) + 1; dg7 = new GatedDetectorExtractSpec(); dg7.Index = 7 ; dg7.Name = "reflectedrf2Amplitude"; dg7.BackgroundSubtract = false; //dg7.GateLow = (rf2CT / conFac) - 1; //dg7.GateHigh = (rf2CT / conFac) + 1; dg7.GateLow = 800; dg7.GateHigh =1800; dc.GatedDetectorExtractSpecs.Add(dg0.Name, dg0); dc.GatedDetectorExtractSpecs.Add(dg1.Name, dg1); dc.GatedDetectorExtractSpecs.Add(dg2.Name, dg2); dc.GatedDetectorExtractSpecs.Add(dg3.Name, dg3); dc.GatedDetectorExtractSpecs.Add(dg4.Name, dg4); dc.GatedDetectorExtractSpecs.Add(dg5.Name, dg5); dc.GatedDetectorExtractSpecs.Add(dg6.Name, dg6); dc.GatedDetectorExtractSpecs.Add(dg7.Name, dg7); dc.PointDetectorChannels.Add("MiniFlux1"); dc.PointDetectorChannels.Add("MiniFlux2"); dc.PointDetectorChannels.Add("MiniFlux3"); dc.PointDetectorChannels.Add("NorthCurrent"); dc.PointDetectorChannels.Add("SouthCurrent"); dc.PointDetectorChannels.Add("PumpPD"); dc.PointDetectorChannels.Add("ProbePD"); dc.PointDetectorChannels.Add("PhaseLockFrequency"); //dc.PointDetectorChannels.Add("CplusV"); //dc.PointDetectorChannels.Add("CminusV"); return dc; }; standardConfigs.Add(name, dcb); }
static DemodulationConfig() { // here we stock the class' static library of configs up with some standard configs // a wide gate - integrate everything DemodulationConfigBuilder wide = delegate(Block b) { DemodulationConfig dc; GatedDetectorExtractSpec dg0, dg1, dg2, dg3, dg4, dg5, dg6, dg7; dc = new DemodulationConfig(); dc.AnalysisTag = "wide"; dg0 = GatedDetectorExtractSpec.MakeWideGate(0); dg0.Name = "bottomProbe"; dg1 = GatedDetectorExtractSpec.MakeWideGate(1); dg1.Name = "topProbe"; dg2 = GatedDetectorExtractSpec.MakeWideGate(2); dg2.Name = "magnetometer"; dg2.Integrate = false; dg3 = GatedDetectorExtractSpec.MakeWideGate(3); dg3.Name = "gnd"; dg3.Integrate = false; dg4 = GatedDetectorExtractSpec.MakeWideGate(4); dg4.Name = "battery"; dg5 = GatedDetectorExtractSpec.MakeWideGate(5); dg5.Name = "rfCurrent"; dg5.Integrate = false; dg6 = GatedDetectorExtractSpec.MakeWideGate(6); dg6.Name = "reflectedrf1Amplitude"; dg7 = GatedDetectorExtractSpec.MakeWideGate(7); dg7.Name = "reflectedrf2Amplitude"; dc.GatedDetectorExtractSpecs.Add(dg0.Name, dg0); dc.GatedDetectorExtractSpecs.Add(dg1.Name, dg1); dc.GatedDetectorExtractSpecs.Add(dg2.Name, dg2); dc.GatedDetectorExtractSpecs.Add(dg3.Name, dg3); dc.GatedDetectorExtractSpecs.Add(dg4.Name, dg4); dc.GatedDetectorExtractSpecs.Add(dg5.Name, dg5); dc.GatedDetectorExtractSpecs.Add(dg6.Name, dg6); dc.GatedDetectorExtractSpecs.Add(dg7.Name, dg7); dc.PointDetectorChannels.Add("MiniFlux1"); dc.PointDetectorChannels.Add("MiniFlux2"); dc.PointDetectorChannels.Add("MiniFlux3"); dc.PointDetectorChannels.Add("NorthCurrent"); dc.PointDetectorChannels.Add("SouthCurrent"); dc.PointDetectorChannels.Add("PumpPD"); dc.PointDetectorChannels.Add("ProbePD"); return(dc); }; standardConfigs.Add("wide", wide); //// fwhm of the tof pulse for top and norm, wide gates for everything else. //AddSliceConfig("fwhm", 0, 1); //// narrower than fwhm, takes only the center hwhm //AddSliceConfig("hwhm", 0, 0.5); //// only the fast half of the fwhm (NOT TRUE - 01Jul08JH) //AddSliceConfig("fast", -0.5, 0.5); //// the slow half of the fwhm (NOT TRUE - 01Jul08 JH) //AddSliceConfig("slow", 0.5, 0.5); //// the fastest and slowest molecules, used for estimating any tof related systematic. //// these gates don't overlap with the usual centred analysis gates (fwhm and cgate11). //AddSliceConfig("vfast", -0.85, 0.5); //AddSliceConfig("vslow", 0.85, 0.5); // for testing out different centred-gate widths for (int i = 1; i < 10; i++) { AddFixedSliceConfig("wgate" + i, 2440, i * 20); } for (int i = 1; i < 14; i++) { AddFixedSliceConfig("shiftgate" + i, 1850 + i * 50, 65); } for (int i = 1; i < 7; i++) { AddFixedSliceConfig("slicegate" + i, 2050 + i * 50, 25); } for (int i = 1; i < 30; i++) { AddFixedSliceConfig("pgate" + i, 2090 + i * 10, 10); } //// testing different gate centres. "slide0" is centred at -0.7 fwhm, "slide14" //// is centred and +0.7 fwhm. //for (int i = 0; i < 15; i++) // AddSliceConfig("slide" + i, (((double)i) / 10.0) - 0.7, 1); //// now some finer slices //double d = -1.4; //for (int i = 0; i < 15; i++) //{ // AddSliceConfig("slice" + i, d, 0.2); // d += 0.2; //} //// optimised gates for spring 2009 run //AddSliceConfig("optimum1", 0.3, 1.1); //AddSliceConfig("optimum2", 0.2, 1.1); // "background" gate DemodulationConfigBuilder background = delegate(Block b) { DemodulationConfig dc; GatedDetectorExtractSpec dg0, dg1; dc = new DemodulationConfig(); dc.AnalysisTag = "background"; dg0 = GatedDetectorExtractSpec.MakeWideGate(0); dg0.GateLow = 2550; dg0.GateHigh = 2600; dg0.Name = "top"; dg1 = GatedDetectorExtractSpec.MakeWideGate(1); dg1.Name = "norm"; dg1.GateLow = 750; dg1.GateHigh = 800; dc.GatedDetectorExtractSpecs.Add(dg0.Name, dg0); dc.GatedDetectorExtractSpecs.Add(dg1.Name, dg1); return(dc); }; standardConfigs.Add("background", background); // add some fixed gate slices - the first three are the 1.1 sigma centre portion and two // non-overlapping portions either side. AddFixedSliceConfig("cgate11Fixed", 2156, 90); // This is normally ("cgate11Fixed", 2156, 90) AddFixedSliceConfig("vfastFixed", 2025, 41); AddFixedSliceConfig("vslowFixed", 2286, 41); // these "nudge" gates are chosen to, hopefully, tweak the 09_10 dataset so that the // RF1F channel, DB-normed in the non-linear way, is reduced to near zero AddFixedSliceConfig("nudgeGate1", 2161, 90); AddFixedSliceConfig("nudgeGate2", 2169, 90); AddFixedSliceConfig("nudgeGate3", 2176, 90); AddFixedSliceConfig("nudgeGate4", 2174, 90); AddFixedSliceConfig("nudgeGate5", 2188, 90); AddFixedSliceConfig("nudgeGate6", 2198, 90); AddFixedSliceConfig("nudgeGate7", 2208, 90); AddFixedSliceConfig("nudgeGate8", 2228, 90); AddFixedSliceConfig("wideNudgeGate1", 2198, 100); AddFixedSliceConfig("narrowNudgeGate1", 2198, 75); AddFixedSliceConfig("narrowNudgeGate2", 2198, 65); AddFixedSliceConfig("narrowNudgeGate3", 2198, 55); AddFixedSliceConfig("narrowNudgeGate4", 2198, 45); // these two are the fast and slow halves of the 1.1 sigma central gate. AddFixedSliceConfig("fastFixed", 2110, 45); AddFixedSliceConfig("slowFixed", 2201, 45); // two fairly wide gates that take in most of the slow and fast molecules. // They've been chosed to try and capture the wiggliness of our fast-slow // wiggles. AddFixedSliceConfig("widefastFixed", 1950, 150); AddFixedSliceConfig("wideslowFixed", 2330, 150); // A narrow centre gate for correlation analysis AddFixedSliceConfig("cgateNarrowFixed", 2175, 25); // A gate containing no molecules to look for edms caused by rf pickup AddFixedSliceConfig("preMolecularBackground", 1850, 50); // A demodulation config for Kr AddFixedSliceConfig("centreFixedKr", 2950, 90); }
//private static void AddSliceConfig(string name, double offset, double width) //{ // // the slow half of the fwhm // DemodulationConfigBuilder dcb = delegate(Block b) // { // DemodulationConfig dc; // GatedDetectorExtractSpec dg0, dg1, dg2, dg3, dg4; // dc = new DemodulationConfig(); // dc.AnalysisTag = name; // dg0 = GatedDetectorExtractSpec.MakeGateFWHM(b, 0, offset, width); // dg0.Name = "top"; // dg0.BackgroundSubtract = true; // dg1 = GatedDetectorExtractSpec.MakeGateFWHM(b, 1, offset, width); // dg1.Name = "norm"; // dg1.BackgroundSubtract = true; // dg2 = GatedDetectorExtractSpec.MakeWideGate(2); // dg2.Name = "mag1"; // dg2.Integrate = false; // dg3 = GatedDetectorExtractSpec.MakeWideGate(3); // dg3.Name = "short"; // dg3.Integrate = false; // dg4 = GatedDetectorExtractSpec.MakeWideGate(4); // dg4.Name = "battery"; // dc.GatedDetectorExtractSpecs.Add(dg0.Name, dg0); // dc.GatedDetectorExtractSpecs.Add(dg1.Name, dg1); // dc.GatedDetectorExtractSpecs.Add(dg2.Name, dg2); // dc.GatedDetectorExtractSpecs.Add(dg3.Name, dg3); // dc.GatedDetectorExtractSpecs.Add(dg4.Name, dg4); // dc.PointDetectorChannels.Add("MiniFlux1"); // dc.PointDetectorChannels.Add("MiniFlux2"); // dc.PointDetectorChannels.Add("MiniFlux3"); // dc.PointDetectorChannels.Add("NorthCurrent"); // dc.PointDetectorChannels.Add("SouthCurrent"); // dc.PointDetectorChannels.Add("PumpPD"); // dc.PointDetectorChannels.Add("ProbePD"); // return dc; // }; // standardConfigs.Add(name, dcb); //} private static void AddFixedSliceConfig(string name, double centre, double width) { // the slow half of the fwhm DemodulationConfigBuilder dcb = delegate(Block b) { DemodulationConfig dc; GatedDetectorExtractSpec dg0, dg1, dg2, dg3, dg4, dg5, dg6, dg7; //This dodgy bit of code is to make sure that the reflected rf power meters // only select a single point in the centre of the rf pulse. It won't work // if either of the rf pulses is centred at a time not divisible w/o rem. by 10us int rf1CT = (int)b.Config.Settings["rf1CentreTime"]; int rf2CT = (int)b.Config.Settings["rf2CentreTime"]; int clock = (int)b.Config.Settings["clockFrequency"]; int conFac = clock / 1000000; dc = new DemodulationConfig(); dc.AnalysisTag = name; dg0 = new GatedDetectorExtractSpec(); dg0.Index = 0; dg0.Name = "bottomProbe"; dg0.BackgroundSubtract = false; dg0.GateLow = (int)(centre - width); dg0.GateHigh = (int)(centre + width); dg1 = new GatedDetectorExtractSpec(); dg1.Index = 1; dg1.Name = "topProbe"; dg1.BackgroundSubtract = false; dg1.GateLow = (int)((centre - width) * kDetectorDistanceRatio); dg1.GateHigh = (int)((centre + width) * kDetectorDistanceRatio); dg2 = GatedDetectorExtractSpec.MakeWideGate(2); dg2.Name = "magnetometer"; dg2.Integrate = false; dg3 = GatedDetectorExtractSpec.MakeWideGate(3); dg3.Name = "gnd"; dg3.Integrate = false; dg4 = GatedDetectorExtractSpec.MakeWideGate(4); dg4.Name = "battery"; dg4.Integrate = false; //Add this in to analyse By in 3 axis internal magnetometer tests dg5 = GatedDetectorExtractSpec.MakeWideGate(5); dg5.Name = "rfCurrent"; dg5.Integrate = false; dg6 = new GatedDetectorExtractSpec(); dg6.Index = 6; dg6.Name = "reflectedrf1Amplitude"; dg6.BackgroundSubtract = false; dg6.GateLow = 800; dg6.GateHigh = 1800; //dg6.GateLow = (rf1CT / conFac) - 1; //dg6.GateHigh = (rf1CT / conFac) + 1; dg7 = new GatedDetectorExtractSpec(); dg7.Index = 7; dg7.Name = "reflectedrf2Amplitude"; dg7.BackgroundSubtract = false; //dg7.GateLow = (rf2CT / conFac) - 1; //dg7.GateHigh = (rf2CT / conFac) + 1; dg7.GateLow = 800; dg7.GateHigh = 1800; dc.GatedDetectorExtractSpecs.Add(dg0.Name, dg0); dc.GatedDetectorExtractSpecs.Add(dg1.Name, dg1); dc.GatedDetectorExtractSpecs.Add(dg2.Name, dg2); dc.GatedDetectorExtractSpecs.Add(dg3.Name, dg3); dc.GatedDetectorExtractSpecs.Add(dg4.Name, dg4); dc.GatedDetectorExtractSpecs.Add(dg5.Name, dg5); dc.GatedDetectorExtractSpecs.Add(dg6.Name, dg6); dc.GatedDetectorExtractSpecs.Add(dg7.Name, dg7); dc.PointDetectorChannels.Add("MiniFlux1"); dc.PointDetectorChannels.Add("MiniFlux2"); dc.PointDetectorChannels.Add("MiniFlux3"); dc.PointDetectorChannels.Add("NorthCurrent"); dc.PointDetectorChannels.Add("SouthCurrent"); dc.PointDetectorChannels.Add("PumpPD"); dc.PointDetectorChannels.Add("ProbePD"); dc.PointDetectorChannels.Add("PhaseLockFrequency"); //dc.PointDetectorChannels.Add("CplusV"); //dc.PointDetectorChannels.Add("CminusV"); return(dc); }; standardConfigs.Add(name, dcb); }
// This function gates the detector data first, and then demodulates the channels. // This means that it can give innacurate results for non-linear combinations // of channels that vary appreciably over the TOF. There's another, slower, function // DemodulateBlockNL that takes care of this. public DemodulatedBlock DemodulateBlock(Block b, DemodulationConfig config) { // *** copy across the metadata *** DemodulatedBlock db = new DemodulatedBlock(); db.TimeStamp = b.TimeStamp; db.Config = b.Config; db.DemodulationConfig = config; // *** extract the gated detector data using the given config *** List <GatedDetectorData> gatedDetectorData = new List <GatedDetectorData>(); int ind = 0; foreach (string d in b.detectors) { GatedDetectorExtractSpec gdes; config.GatedDetectorExtractSpecs.TryGetValue(d, out gdes); if (gdes != null) { gatedDetectorData.Add(GatedDetectorData.ExtractFromBlock(b, gdes)); db.DetectorIndices.Add(gdes.Name, ind); ind++; db.DetectorCalibrations.Add(gdes.Name, ((TOF)((EDMPoint)b.Points[0]).Shot.TOFs[gdes.Index]).Calibration); } } //foreach (KeyValuePair<string, GatedDetectorExtractSpec> spec in config.GatedDetectorExtractSpecs) //{ // GatedDetectorExtractSpec gate = spec.Value; // gatedDetectorData.Add(GatedDetectorData.ExtractFromBlock(b, gate)); // db.DetectorIndices.Add(gate.Name, ind); // ind++; // db.DetectorCalibrations.Add(gate.Name, // ((TOF)((EDMPoint)b.Points[0]).Shot.TOFs[gate.Index]).Calibration); //} // ** normalise the top detector ** gatedDetectorData.Add( gatedDetectorData[db.DetectorIndices["top"]] / gatedDetectorData[db.DetectorIndices["norm"]]); db.DetectorIndices.Add("topNormed", db.DetectorIndices.Count); // *** extract the point detector data *** List <PointDetectorData> pointDetectorData = new List <PointDetectorData>(); foreach (string channel in config.PointDetectorChannels) { pointDetectorData.Add(PointDetectorData.ExtractFromBlock(b, channel)); // for the moment all single point detector channels are set to have a calibration // of 1.0 . db.DetectorCalibrations.Add(channel, 1.0); } // *** build the list of detector data *** List <DetectorData> detectorData = new List <DetectorData>(); for (int i = 0; i < gatedDetectorData.Count; i++) { detectorData.Add(gatedDetectorData[i]); } for (int i = 0; i < config.PointDetectorChannels.Count; i++) { detectorData.Add(pointDetectorData[i]); db.DetectorIndices.Add(config.PointDetectorChannels[i], i + gatedDetectorData.Count); } // calculate the norm FFT db.NormFourier = DetectorFT.MakeFT(gatedDetectorData[db.DetectorIndices["norm"]], kFourierAverage); // *** demodulate channels *** // ** build the list of modulations ** List <string> modNames = new List <string>(); List <Waveform> modWaveforms = new List <Waveform>(); foreach (AnalogModulation mod in b.Config.AnalogModulations) { modNames.Add(mod.Name); modWaveforms.Add(mod.Waveform); } foreach (DigitalModulation mod in b.Config.DigitalModulations) { modNames.Add(mod.Name); modWaveforms.Add(mod.Waveform); } foreach (TimingModulation mod in b.Config.TimingModulations) { modNames.Add(mod.Name); modWaveforms.Add(mod.Waveform); } // ** work out the switch state for each point ** int blockLength = modWaveforms[0].Length; List <bool[]> wfBits = new List <bool[]>(); foreach (Waveform wf in modWaveforms) { wfBits.Add(wf.Bits); } List <uint> switchStates = new List <uint>(blockLength); for (int i = 0; i < blockLength; i++) { uint switchState = 0; for (int j = 0; j < wfBits.Count; j++) { if (wfBits[j][i]) { switchState += (uint)Math.Pow(2, j); } } switchStates.Add(switchState); } // pre-calculate the state signs for each analysis channel // the first index selects the analysis channel, the second the switchState int numStates = (int)Math.Pow(2, modWaveforms.Count); int[,] stateSigns = new int[numStates, numStates]; for (uint i = 0; i < numStates; i++) { for (uint j = 0; j < numStates; j++) { stateSigns[i, j] = stateSign(j, i); } } // ** the following needs to be done for each detector ** for (int detector = 0; detector < detectorData.Count; detector++) { DetectorChannelValues dcv = new DetectorChannelValues(); for (int i = 0; i < modNames.Count; i++) { dcv.SwitchMasks.Add(modNames[i], (uint)(1 << i)); } // * divide the data up into bins according to switch state * List <List <double> > statePoints = new List <List <double> >(numStates); for (int i = 0; i < numStates; i++) { statePoints.Add(new List <double>(blockLength / numStates)); } for (int i = 0; i < blockLength; i++) { statePoints[(int)switchStates[i]].Add(detectorData[detector].PointValues[i]); } // * calculate the channel values * int subLength = blockLength / numStates; double[,] channelValues = new double[numStates, subLength]; for (int channel = 0; channel < numStates; channel++) { for (int subIndex = 0; subIndex < subLength; subIndex++) { double chanVal = 0; for (int i = 0; i < numStates; i++) { chanVal += stateSigns[channel, i] * statePoints[i][subIndex]; } chanVal /= (double)numStates; channelValues[channel, subIndex] = chanVal; } } //* calculate the channel means * double[] channelMeans = new double[numStates]; for (int channel = 0; channel < numStates; channel++) { double total = 0; for (int i = 0; i < subLength; i++) { total += channelValues[channel, i]; } total /= blockLength / numStates; channelMeans[channel] = total; } dcv.Values = channelMeans; //* calculate the channel errors * double[] channelErrors = new double[numStates]; for (int channel = 0; channel < numStates; channel++) { double total = 0; for (int i = 0; i < subLength; i++) { total += Math.Pow(channelValues[channel, i] - channelMeans[channel], 2); } total /= subLength * (subLength - 1); total = Math.Sqrt(total); channelErrors[channel] = total; } dcv.Errors = channelErrors; db.ChannelValues.Add(dcv); } return(db); }
// DemodulateBlockNL augments the channel values returned by DemodulateBlock // with several non-linear combinations of channels (E.B/DB, the correction, etc). // These non-linear channels are calculated point-by-point for the TOF and then // integrated according to the Demodulation config. This is calculated for top and // topNormed detectors only for speed. // public DemodulatedBlock DemodulateBlockNL(Block b, DemodulationConfig config) { // we start with the standard demodulated block DemodulatedBlock dblock = DemodulateBlock(b, config); // First do everything for the un-normalised top detector int tdi = dblock.DetectorIndices["top"]; // TOF demodulate the block to get the channel wiggles // the BlockTOFDemodulator only demodulates the PMT detector BlockTOFDemodulator btdt = new BlockTOFDemodulator(); TOFChannelSet tcst = btdt.TOFDemodulateBlock(b, tdi, false); // now repeat having normed the block // normalise the PMT signal b.Normalise(config.GatedDetectorExtractSpecs["norm"]); int tndi = dblock.DetectorIndices["topNormed"]; // TOF demodulate the block to get the channel wiggles // the BlockTOFDemodulator only demodulates the PMT detector BlockTOFDemodulator btd = new BlockTOFDemodulator(); TOFChannelSet tcs = btd.TOFDemodulateBlock(b, tndi, false); // get hold of the gating data GatedDetectorExtractSpec gate = config.GatedDetectorExtractSpecs["top"]; // gate the special channels TOFChannel edmDB = (TOFChannel)tcs.GetChannel("EDMDB"); double edmDBG = edmDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel corrDB = (TOFChannel)tcs.GetChannel("CORRDB"); double corrDBG = corrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel edmCorrDB = (TOFChannel)tcs.GetChannel("EDMCORRDB"); double edmCorrDBG = edmCorrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel corrDB_old = (TOFChannel)tcs.GetChannel("CORRDB_OLD"); double corrDBG_old = corrDB_old.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel edmCorrDB_old = (TOFChannel)tcs.GetChannel("EDMCORRDB_OLD"); double edmCorrDBG_old = edmCorrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf1fDB = (TOFChannel)tcs.GetChannel("RF1FDB"); double rf1fDBG = rf1fDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf2fDB = (TOFChannel)tcs.GetChannel("RF2FDB"); double rf2fDBG = rf2fDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf1fDBDB = (TOFChannel)tcs.GetChannel("RF1FDBDB"); double rf1fDBDBG = rf1fDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf2fDBDB = (TOFChannel)tcs.GetChannel("RF2FDBDB"); double rf2fDBDBG = rf2fDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf1aDB = (TOFChannel)tcs.GetChannel("RF1ADB"); double rf1aDBG = rf1aDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf2aDB = (TOFChannel)tcs.GetChannel("RF2ADB"); double rf2aDBG = rf2aDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf1aDBDB = (TOFChannel)tcs.GetChannel("RF1ADBDB"); double rf1aDBDBG = rf1aDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf2aDBDB = (TOFChannel)tcs.GetChannel("RF2ADBDB"); double rf2aDBDBG = rf2aDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel lf1DB = (TOFChannel)tcs.GetChannel("LF1DB"); double lf1DBG = lf1DB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel lf1DBDB = (TOFChannel)tcs.GetChannel("LF1DBDB"); double lf1DBDBG = lf1DBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel lf2DB = (TOFChannel)tcs.GetChannel("LF2DB"); double lf2DBG = lf2DB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel lf2DBDB = (TOFChannel)tcs.GetChannel("LF2DBDB"); double lf2DBDBG = lf2DBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel BDB = (TOFChannel)tcs.GetChannel("BDB"); double BDBG = BDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel erf1fDB = (TOFChannel)tcs.GetChannel("ERF1FDB"); double erf1fDBG = erf1fDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel erf2fDB = (TOFChannel)tcs.GetChannel("ERF2FDB"); double erf2fDBG = erf2fDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel erf1fDBDB = (TOFChannel)tcs.GetChannel("ERF1FDBDB"); double erf1fDBDBG = erf1fDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel erf2fDBDB = (TOFChannel)tcs.GetChannel("ERF2FDBDB"); double erf2fDBDBG = erf2fDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel brf1fCorrDB = (TOFChannel)tcs.GetChannel("BRF1FCORRDB"); double brf1fCorrDBG = brf1fCorrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel brf2fCorrDB = (TOFChannel)tcs.GetChannel("BRF2FCORRDB"); double brf2fCorrDBG = brf2fCorrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); //Repeat for top TOFChannel edmDBtop = (TOFChannel)tcst.GetChannel("EDMDB"); double edmDBGtop = edmDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel corrDBtop = (TOFChannel)tcst.GetChannel("CORRDB"); double corrDBGtop = corrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel edmCorrDBtop = (TOFChannel)tcst.GetChannel("EDMCORRDB"); double edmCorrDBGtop = edmCorrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel corrDB_oldtop = (TOFChannel)tcst.GetChannel("CORRDB_OLD"); double corrDBG_oldtop = corrDB_old.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel edmCorrDB_oldtop = (TOFChannel)tcst.GetChannel("EDMCORRDB_OLD"); double edmCorrDBG_oldtop = edmCorrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf1fDBtop = (TOFChannel)tcst.GetChannel("RF1FDB"); double rf1fDBGtop = rf1fDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf2fDBtop = (TOFChannel)tcst.GetChannel("RF2FDB"); double rf2fDBGtop = rf2fDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf1fDBDBtop = (TOFChannel)tcst.GetChannel("RF1FDBDB"); double rf1fDBDBGtop = rf1fDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf2fDBDBtop = (TOFChannel)tcst.GetChannel("RF2FDBDB"); double rf2fDBDBGtop = rf2fDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf1aDBtop = (TOFChannel)tcst.GetChannel("RF1ADB"); double rf1aDBGtop = rf1aDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf2aDBtop = (TOFChannel)tcst.GetChannel("RF2ADB"); double rf2aDBGtop = rf2aDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf1aDBDBtop = (TOFChannel)tcst.GetChannel("RF1ADBDB"); double rf1aDBDBGtop = rf1aDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf2aDBDBtop = (TOFChannel)tcst.GetChannel("RF2ADBDB"); double rf2aDBDBGtop = rf2aDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel lf1DBtop = (TOFChannel)tcst.GetChannel("LF1DB"); double lf1DBGtop = lf1DB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel lf1DBDBtop = (TOFChannel)tcst.GetChannel("LF1DBDB"); double lf1DBDBGtop = lf1DBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel lf2DBtop = (TOFChannel)tcst.GetChannel("LF2DB"); double lf2DBGtop = lf2DB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel lf2DBDBtop = (TOFChannel)tcst.GetChannel("LF2DBDB"); double lf2DBDBGtop = lf2DBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel BDBtop = (TOFChannel)tcst.GetChannel("BDB"); double BDBGtop = BDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel erf1fDBtop = (TOFChannel)tcst.GetChannel("ERF1FDB"); double erf1fDBGtop = erf1fDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel erf2fDBtop = (TOFChannel)tcst.GetChannel("ERF2FDB"); double erf2fDBGtop = erf2fDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel erf1fDBDBtop = (TOFChannel)tcst.GetChannel("ERF1FDBDB"); double erf1fDBDBGtop = erf1fDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel erf2fDBDBtop = (TOFChannel)tcst.GetChannel("ERF2FDBDB"); double erf2fDBDBGtop = erf2fDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel brf1fCorrDBtop = (TOFChannel)tcst.GetChannel("BRF1FCORRDB"); double brf1fCorrDBGtop = brf1fCorrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel brf2fCorrDBtop = (TOFChannel)tcst.GetChannel("BRF2FCORRDB"); double brf2fCorrDBGtop = brf2fCorrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); // we bodge the errors, which aren't really used for much anyway // by just using the error from the normal dblock. I ignore the error in DB. // I use the simple correction error for the full correction. Doesn't much matter. DetectorChannelValues dcv = dblock.ChannelValues[tndi]; double edmDBE = dcv.GetError(new string[] { "E", "B" }) / dcv.GetValue(new string[] { "DB" }); double corrDBE = Math.Sqrt( Math.Pow(dcv.GetValue(new string[] { "E", "DB" }) * dcv.GetError(new string[] { "B" }), 2) + Math.Pow(dcv.GetValue(new string[] { "B" }) * dcv.GetError(new string[] { "E", "DB" }), 2)) / Math.Pow(dcv.GetValue(new string[] { "DB" }), 2); double edmCorrDBE = Math.Sqrt(Math.Pow(edmDBE, 2) + Math.Pow(corrDBE, 2)); double rf1fDBE = dcv.GetError(new string[] { "RF1F" }) / dcv.GetValue(new string[] { "DB" }); double rf2fDBE = dcv.GetError(new string[] { "RF2F" }) / dcv.GetValue(new string[] { "DB" }); double rf1fDBDBE = dcv.GetError(new string[] { "DB", "RF1F" }) / dcv.GetValue(new string[] { "DB" }); double rf2fDBDBE = dcv.GetError(new string[] { "DB", "RF2F" }) / dcv.GetValue(new string[] { "DB" }); double rf1aDBE = dcv.GetError(new string[] { "RF1A" }) / dcv.GetValue(new string[] { "DB" }); double rf2aDBE = dcv.GetError(new string[] { "RF2A" }) / dcv.GetValue(new string[] { "DB" }); double rf1aDBDBE = dcv.GetError(new string[] { "DB", "RF1A" }) / dcv.GetValue(new string[] { "DB" }); double rf2aDBDBE = dcv.GetError(new string[] { "DB", "RF2A" }) / dcv.GetValue(new string[] { "DB" }); double lf1DBE = dcv.GetError(new string[] { "LF1" }) / dcv.GetValue(new string[] { "DB" }); double lf1DBDBE = dcv.GetError(new string[] { "DB", "LF1" }) / dcv.GetValue(new string[] { "DB" }); double lf2DBE = dcv.GetError(new string[] { "LF2" }) / dcv.GetValue(new string[] { "DB" }); double lf2DBDBE = dcv.GetError(new string[] { "DB", "LF2" }) / dcv.GetValue(new string[] { "DB" }); double brf1fDBE = dcv.GetError(new string[] { "B", "RF1F" }) / dcv.GetValue(new string[] { "DB" }); double brf2fDBE = dcv.GetError(new string[] { "B", "RF2F" }) / dcv.GetValue(new string[] { "DB" }); double erf1fDBE = dcv.GetError(new string[] { "E", "RF1F" }) / dcv.GetValue(new string[] { "DB" }); double erf2fDBE = dcv.GetError(new string[] { "E", "RF2F" }) / dcv.GetValue(new string[] { "DB" }); double erf1fDBDBE = dcv.GetError(new string[] { "E", "DB", "RF1F" }) / dcv.GetValue(new string[] { "DB" }); double erf2fDBDBE = dcv.GetError(new string[] { "E", "DB", "RF2F" }) / dcv.GetValue(new string[] { "DB" }); double BDBE = dcv.GetError(new string[] { "B" }) / dcv.GetValue(new string[] { "DB" }); //repeat for top DetectorChannelValues dcvt = dblock.ChannelValues[tdi]; double lf2DBEtop = dcvt.GetError(new string[] { "LF2" }) / dcvt.GetValue(new string[] { "DB" }); //Change the db channel back to topNormed double lf2DBDBEtop = dcvt.GetError(new string[] { "DB", "LF2" }) / dcvt.GetValue(new string[] { "DB" }); //Change the db channel back to topNormed double edmDBEtop = dcvt.GetError(new string[] { "E", "B" }) / dcvt.GetValue(new string[] { "DB" }); double corrDBEtop = Math.Sqrt( Math.Pow(dcvt.GetValue(new string[] { "E", "DB" }) * dcvt.GetError(new string[] { "B" }), 2) + Math.Pow(dcvt.GetValue(new string[] { "B" }) * dcvt.GetError(new string[] { "E", "DB" }), 2)) / Math.Pow(dcvt.GetValue(new string[] { "DB" }), 2); double edmCorrDBEtop = Math.Sqrt(Math.Pow(edmDBEtop, 2) + Math.Pow(corrDBEtop, 2)); double rf1fDBEtop = dcvt.GetError(new string[] { "RF1F" }) / dcvt.GetValue(new string[] { "DB" }); double rf2fDBEtop = dcvt.GetError(new string[] { "RF2F" }) / dcvt.GetValue(new string[] { "DB" }); double rf1fDBDBEtop = dcvt.GetError(new string[] { "DB", "RF1F" }) / dcvt.GetValue(new string[] { "DB" }); double rf2fDBDBEtop = dcvt.GetError(new string[] { "DB", "RF2F" }) / dcvt.GetValue(new string[] { "DB" }); double rf1aDBEtop = dcvt.GetError(new string[] { "RF1A" }) / dcvt.GetValue(new string[] { "DB" }); double rf2aDBEtop = dcvt.GetError(new string[] { "RF2A" }) / dcvt.GetValue(new string[] { "DB" }); double rf1aDBDBEtop = dcvt.GetError(new string[] { "DB", "RF1A" }) / dcvt.GetValue(new string[] { "DB" }); double rf2aDBDBEtop = dcvt.GetError(new string[] { "DB", "RF2A" }) / dcvt.GetValue(new string[] { "DB" }); double lf1DBEtop = dcvt.GetError(new string[] { "LF1" }) / dcvt.GetValue(new string[] { "DB" }); double lf1DBDBEtop = dcvt.GetError(new string[] { "DB", "LF1" }) / dcvt.GetValue(new string[] { "DB" }); double brf1fDBEtop = dcvt.GetError(new string[] { "B", "RF1F" }) / dcvt.GetValue(new string[] { "DB" }); double brf2fDBEtop = dcvt.GetError(new string[] { "B", "RF2F" }) / dcvt.GetValue(new string[] { "DB" }); double erf1fDBEtop = dcvt.GetError(new string[] { "E", "RF1F" }) / dcvt.GetValue(new string[] { "DB" }); double erf2fDBEtop = dcvt.GetError(new string[] { "E", "RF2F" }) / dcvt.GetValue(new string[] { "DB" }); double erf1fDBDBEtop = dcvt.GetError(new string[] { "E", "DB", "RF1F" }) / dcvt.GetValue(new string[] { "DB" }); double erf2fDBDBEtop = dcvt.GetError(new string[] { "E", "DB", "RF2F" }) / dcvt.GetValue(new string[] { "DB" }); double BDBEtop = dcvt.GetError(new string[] { "B" }) / dcvt.GetValue(new string[] { "DB" }); // stuff the data into the dblock dblock.ChannelValues[tndi].SpecialValues["EDMDB"] = new double[] { edmDBG, edmDBE }; dblock.ChannelValues[tndi].SpecialValues["CORRDB"] = new double[] { corrDBG, corrDBE }; dblock.ChannelValues[tndi].SpecialValues["EDMCORRDB"] = new double[] { edmCorrDBG, edmCorrDBE }; dblock.ChannelValues[tndi].SpecialValues["CORRDB_OLD"] = new double[] { corrDBG_old, corrDBE }; dblock.ChannelValues[tndi].SpecialValues["EDMCORRDB_OLD"] = new double[] { edmCorrDBG_old, edmCorrDBE }; dblock.ChannelValues[tndi].SpecialValues["RF1FDB"] = new double[] { rf1fDBG, rf1fDBE }; dblock.ChannelValues[tndi].SpecialValues["RF2FDB"] = new double[] { rf2fDBG, rf2fDBE }; dblock.ChannelValues[tndi].SpecialValues["RF1FDBDB"] = new double[] { rf1fDBDBG, rf1fDBDBE }; dblock.ChannelValues[tndi].SpecialValues["RF2FDBDB"] = new double[] { rf2fDBDBG, rf2fDBDBE }; dblock.ChannelValues[tndi].SpecialValues["RF1ADB"] = new double[] { rf1aDBG, rf1aDBE }; dblock.ChannelValues[tndi].SpecialValues["RF2ADB"] = new double[] { rf2aDBG, rf2aDBE }; dblock.ChannelValues[tndi].SpecialValues["RF1ADBDB"] = new double[] { rf1aDBDBG, rf1aDBDBE }; dblock.ChannelValues[tndi].SpecialValues["RF2ADBDB"] = new double[] { rf2aDBDBG, rf2aDBDBE }; dblock.ChannelValues[tndi].SpecialValues["BRF1FCORRDB"] = new double[] { brf1fCorrDBG, brf1fDBE }; dblock.ChannelValues[tndi].SpecialValues["BRF2FCORRDB"] = new double[] { brf2fCorrDBG, brf2fDBE }; dblock.ChannelValues[tndi].SpecialValues["ERF1FDB"] = new double[] { erf1fDBG, erf1fDBE }; dblock.ChannelValues[tndi].SpecialValues["ERF2FDB"] = new double[] { erf2fDBG, erf2fDBE }; dblock.ChannelValues[tndi].SpecialValues["ERF1FDBDB"] = new double[] { erf1fDBDBG, erf1fDBDBE }; dblock.ChannelValues[tndi].SpecialValues["ERF2FDBDB"] = new double[] { erf2fDBDBG, erf2fDBDBE }; dblock.ChannelValues[tndi].SpecialValues["LF1DB"] = new double[] { lf1DBG, lf1DBE }; dblock.ChannelValues[tndi].SpecialValues["LF1DBDB"] = new double[] { lf1DBDBG, lf1DBDBE }; dblock.ChannelValues[tndi].SpecialValues["LF2DB"] = new double[] { lf2DBG, lf2DBE }; dblock.ChannelValues[tndi].SpecialValues["LF2DBDB"] = new double[] { lf2DBDBG, lf2DBDBE }; dblock.ChannelValues[tndi].SpecialValues["BDB"] = new double[] { BDBG, BDBE }; dblock.ChannelValues[tdi].SpecialValues["EDMDB"] = new double[] { edmDBGtop, edmDBEtop }; dblock.ChannelValues[tdi].SpecialValues["CORRDB"] = new double[] { corrDBGtop, corrDBEtop }; dblock.ChannelValues[tdi].SpecialValues["EDMCORRDB"] = new double[] { edmCorrDBGtop, edmCorrDBEtop }; dblock.ChannelValues[tdi].SpecialValues["CORRDB_OLD"] = new double[] { corrDBG_oldtop, corrDBEtop }; dblock.ChannelValues[tdi].SpecialValues["EDMCORRDB_OLD"] = new double[] { edmCorrDBG_oldtop, edmCorrDBEtop }; dblock.ChannelValues[tdi].SpecialValues["RF1FDB"] = new double[] { rf1fDBGtop, rf1fDBEtop }; dblock.ChannelValues[tdi].SpecialValues["RF2FDB"] = new double[] { rf2fDBGtop, rf2fDBEtop }; dblock.ChannelValues[tdi].SpecialValues["RF1FDBDB"] = new double[] { rf1fDBDBGtop, rf1fDBDBEtop }; dblock.ChannelValues[tdi].SpecialValues["RF2FDBDB"] = new double[] { rf2fDBDBGtop, rf2fDBDBEtop }; dblock.ChannelValues[tdi].SpecialValues["RF1ADB"] = new double[] { rf1aDBGtop, rf1aDBEtop }; dblock.ChannelValues[tdi].SpecialValues["RF2ADB"] = new double[] { rf2aDBGtop, rf2aDBEtop }; dblock.ChannelValues[tdi].SpecialValues["RF1ADBDB"] = new double[] { rf1aDBDBGtop, rf1aDBDBEtop }; dblock.ChannelValues[tdi].SpecialValues["RF2ADBDB"] = new double[] { rf2aDBDBGtop, rf2aDBDBEtop }; dblock.ChannelValues[tdi].SpecialValues["BRF1FCORRDB"] = new double[] { brf1fCorrDBGtop, brf1fDBEtop }; dblock.ChannelValues[tdi].SpecialValues["BRF2FCORRDB"] = new double[] { brf2fCorrDBGtop, brf2fDBEtop }; dblock.ChannelValues[tdi].SpecialValues["ERF1FDB"] = new double[] { erf1fDBGtop, erf1fDBEtop }; dblock.ChannelValues[tdi].SpecialValues["ERF2FDB"] = new double[] { erf2fDBGtop, erf2fDBEtop }; dblock.ChannelValues[tdi].SpecialValues["ERF1FDBDB"] = new double[] { erf1fDBDBGtop, erf1fDBDBEtop }; dblock.ChannelValues[tdi].SpecialValues["ERF2FDBDB"] = new double[] { erf2fDBDBGtop, erf2fDBDBEtop }; dblock.ChannelValues[tdi].SpecialValues["LF1DB"] = new double[] { lf1DBGtop, lf1DBEtop }; dblock.ChannelValues[tdi].SpecialValues["LF1DBDB"] = new double[] { lf1DBDBGtop, lf1DBDBEtop }; dblock.ChannelValues[tdi].SpecialValues["LF2DB"] = new double[] { lf2DBGtop, lf2DBEtop }; dblock.ChannelValues[tdi].SpecialValues["LF2DBDB"] = new double[] { lf2DBDBGtop, lf2DBDBEtop }; dblock.ChannelValues[tdi].SpecialValues["BDB"] = new double[] { BDBGtop, BDBEtop }; return(dblock); }
//private static void AddSliceConfig(string name, double offset, double width) //{ // // the slow half of the fwhm // DemodulationConfigBuilder dcb = delegate(Block b) // { // DemodulationConfig dc; // GatedDetectorExtractSpec dg0, dg1, dg2, dg3, dg4; // dc = new DemodulationConfig(); // dc.AnalysisTag = name; // dg0 = GatedDetectorExtractSpec.MakeGateFWHM(b, 0, offset, width); // dg0.Name = "top"; // dg0.BackgroundSubtract = true; // dg1 = GatedDetectorExtractSpec.MakeGateFWHM(b, 1, offset, width); // dg1.Name = "norm"; // dg1.BackgroundSubtract = true; // dg2 = GatedDetectorExtractSpec.MakeWideGate(2); // dg2.Name = "mag1"; // dg2.Integrate = false; // dg3 = GatedDetectorExtractSpec.MakeWideGate(3); // dg3.Name = "short"; // dg3.Integrate = false; // dg4 = GatedDetectorExtractSpec.MakeWideGate(4); // dg4.Name = "battery"; // dc.GatedDetectorExtractSpecs.Add(dg0.Name, dg0); // dc.GatedDetectorExtractSpecs.Add(dg1.Name, dg1); // dc.GatedDetectorExtractSpecs.Add(dg2.Name, dg2); // dc.GatedDetectorExtractSpecs.Add(dg3.Name, dg3); // dc.GatedDetectorExtractSpecs.Add(dg4.Name, dg4); // dc.PointDetectorChannels.Add("MiniFlux1"); // dc.PointDetectorChannels.Add("MiniFlux2"); // dc.PointDetectorChannels.Add("MiniFlux3"); // dc.PointDetectorChannels.Add("NorthCurrent"); // dc.PointDetectorChannels.Add("SouthCurrent"); // dc.PointDetectorChannels.Add("PumpPD"); // dc.PointDetectorChannels.Add("ProbePD"); // return dc; // }; // standardConfigs.Add(name, dcb); //} private static void AddFixedSliceConfig(string name, double centre, double width) { // the slow half of the fwhm DemodulationConfigBuilder dcb = delegate(Block b) { DemodulationConfig dc; GatedDetectorExtractSpec dg0, dg1, dg2, dg3, dg4, dg5, dg6, dg7; dc = new DemodulationConfig(); dc.AnalysisTag = name; dg0 = new GatedDetectorExtractSpec(); dg0.Index = 0; dg0.Name = "top"; dg0.BackgroundSubtract = false; dg0.GateLow = (int)(centre - width); dg0.GateHigh = (int)(centre + width); dg1 = new GatedDetectorExtractSpec(); dg1.Index = 1; dg1.Name = "norm"; dg1.BackgroundSubtract = false; dg1.GateLow = (int)((centre - width) / kDetectorDistanceRatio); dg1.GateHigh = (int)((centre + width) / kDetectorDistanceRatio); dg2 = GatedDetectorExtractSpec.MakeWideGate(2); dg2.Name = "magnetometer"; dg2.Integrate = false; dg3 = GatedDetectorExtractSpec.MakeWideGate(3); dg3.Name = "gnd"; dg3.Integrate = false; dg4 = GatedDetectorExtractSpec.MakeWideGate(4); dg4.Name = "battery"; dg5 = GatedDetectorExtractSpec.MakeWideGate(5); dg5.Name = "rfCurrent"; dg5.Integrate = false; dg6 = new GatedDetectorExtractSpec(); dg6.Index = 6; dg6.Name = "reflectedrf1Amplitude"; dg6.BackgroundSubtract = false; dg6.GateLow = 819; dg6.GateHigh = 821; dg7 = new GatedDetectorExtractSpec(); dg7.Index = 7; dg7.Name = "reflectedrf2Amplitude"; dg7.BackgroundSubtract = false; dg7.GateLow = 1799; dg7.GateHigh = 1801; dc.GatedDetectorExtractSpecs.Add(dg0.Name, dg0); dc.GatedDetectorExtractSpecs.Add(dg1.Name, dg1); dc.GatedDetectorExtractSpecs.Add(dg2.Name, dg2); dc.GatedDetectorExtractSpecs.Add(dg3.Name, dg3); dc.GatedDetectorExtractSpecs.Add(dg4.Name, dg4); dc.GatedDetectorExtractSpecs.Add(dg5.Name, dg5); dc.GatedDetectorExtractSpecs.Add(dg6.Name, dg6); dc.GatedDetectorExtractSpecs.Add(dg7.Name, dg7); dc.PointDetectorChannels.Add("MiniFlux1"); dc.PointDetectorChannels.Add("MiniFlux2"); dc.PointDetectorChannels.Add("MiniFlux3"); dc.PointDetectorChannels.Add("NorthCurrent"); dc.PointDetectorChannels.Add("SouthCurrent"); dc.PointDetectorChannels.Add("PumpPD"); dc.PointDetectorChannels.Add("ProbePD"); return(dc); }; standardConfigs.Add(name, dcb); }
public DemodulatedBlock QuickDemodulateBlock(Block b) { List <Modulation> modulations = GetModulations(b); List <string> modNames = new List <string>(); foreach (Modulation modulation in modulations) { modNames.Add(modulation.Name); } int bIndex = modNames.IndexOf("B"); int dbIndex = modNames.IndexOf("DB"); int eIndex = modNames.IndexOf("E"); int rf1fIndex = modNames.IndexOf("RF1F"); int rf2fIndex = modNames.IndexOf("RF2F"); int rf1aIndex = modNames.IndexOf("RF1A"); int rf2aIndex = modNames.IndexOf("RF2A"); int lf1Index = modNames.IndexOf("LF1"); int sigChannel = 0; int eChannel = (1 << eIndex); int bChannel = (1 << bIndex); int dbChannel = (1 << dbIndex); int ebChannel = (1 << eIndex) + (1 << bIndex); int edbChannel = (1 << eIndex) + (1 << dbIndex); int bdbChannel = (1 << bIndex) + (1 << dbIndex); int dbrf1fChannel = (1 << dbIndex) + (1 << rf1fIndex); int dbrf2fChannel = (1 << dbIndex) + (1 << rf2fIndex); int brf1fChannel = (1 << bIndex) + (1 << rf1fIndex); int brf2fChannel = (1 << bIndex) + (1 << rf2fIndex); int edbrf1fChannel = (1 << eIndex) + (1 << dbIndex) + (1 << rf1fIndex); int edbrf2fChannel = (1 << eIndex) + (1 << dbIndex) + (1 << rf2fIndex); int bdbrf1fChannel = (1 << bIndex) + (1 << dbIndex) + (1 << rf1fIndex); int bdbrf2fChannel = (1 << bIndex) + (1 << dbIndex) + (1 << rf2fIndex); int ebdbChannel = (1 << eIndex) + (1 << bIndex) + (1 << dbIndex); int ebdbrf1fChannel = (1 << eIndex) + (1 << bIndex) + (1 << dbIndex) + (1 << rf1fIndex); int ebdbrf2fChannel = (1 << eIndex) + (1 << bIndex) + (1 << dbIndex) + (1 << rf2fIndex); int rf1fChannel = (1 << rf1fIndex); int rf2fChannel = (1 << rf2fIndex); int erf1fChannel = (1 << eIndex) + (1 << rf1fIndex); int erf2fChannel = (1 << eIndex) + (1 << rf2fIndex); int rf1aChannel = (1 << rf1aIndex); int rf2aChannel = (1 << rf2aIndex); int dbrf1aChannel = (1 << dbIndex) + (1 << rf1aIndex); int dbrf2aChannel = (1 << dbIndex) + (1 << rf2aIndex); List <int> channelsToAnalyse = new List <int> { sigChannel, eChannel, bChannel, dbChannel, ebChannel, edbChannel, bdbChannel, dbrf1fChannel, dbrf2fChannel, brf1fChannel, brf2fChannel, edbrf1fChannel, edbrf2fChannel, bdbrf1fChannel, bdbrf2fChannel, ebdbChannel, ebdbrf1fChannel, ebdbrf2fChannel, rf1fChannel, rf2fChannel, erf1fChannel, erf2fChannel, rf1aChannel, rf2aChannel, dbrf1aChannel, dbrf2aChannel }; if (lf1Index != -1) // Index = -1 if "LF1" not found { int lf1Channel = (1 << lf1Index); channelsToAnalyse.Add(lf1Channel); int dblf1Channel = (1 << dbIndex) + (1 << lf1Index); channelsToAnalyse.Add(dblf1Channel); } return(DemodulateBlock(b, DemodulationConfig.MakeLiveAnalysisConfig(), channelsToAnalyse.ToArray())); }
public DemodulatedBlock DemodulateBlock(Block b, DemodulationConfig demodulationConfig, int[] tofChannelsToAnalyse) { if (!b.detectors.Contains("asymmetry")) { b.AddDetectorsToBlock(); } int blockLength = b.Points.Count; DemodulatedBlock db = new DemodulatedBlock(b.TimeStamp, b.Config, demodulationConfig); Dictionary <string, double[]> pointDetectorData = new Dictionary <string, double[]>(); foreach (string d in demodulationConfig.GatedDetectors) { pointDetectorData.Add(d, GetGatedDetectorData(b, d, demodulationConfig.Gates.GetGate(d))); } foreach (string d in demodulationConfig.PointDetectors) { pointDetectorData.Add(d, GetPointDetectorData(b, d)); } Dictionary <string, TOF[]> tofDetectorData = new Dictionary <string, TOF[]>(); foreach (string d in demodulationConfig.TOFDetectors) { tofDetectorData.Add(d, GetTOFDetectorData(b, d)); } // ----Demodulate channels---- // --Build list of modulations-- List <Modulation> modulations = GetModulations(b); // --Work out switch state for each point-- List <uint> switchStates = GetSwitchStates(modulations); // --Calculate state signs for each analysis channel-- // The first index selects the analysis channel, the second the switchState int numStates = (int)Math.Pow(2, modulations.Count); int[,] stateSigns = GetStateSigns(numStates); // --This is done for each point/gated detector-- foreach (string d in pointDetectorData.Keys) { int detectorIndex = b.detectors.IndexOf(d); // We obtain one Channel Set for each detector ChannelSet <PointWithError> channelSet = new ChannelSet <PointWithError>(); // Detector calibration double calibration = ((TOF)((EDMPoint)b.Points[0]).Shot.TOFs[detectorIndex]).Calibration; // Divide points into bins depending on switch state List <List <double> > statePoints = new List <List <double> >(numStates); for (int i = 0; i < numStates; i++) { statePoints.Add(new List <double>(blockLength / numStates)); } for (int i = 0; i < blockLength; i++) { statePoints[(int)switchStates[i]].Add(pointDetectorData[b.detectors[detectorIndex]][i]); } int subLength = blockLength / numStates; // For each analysis channel, calculate the mean and standard error, then add to ChannelSet for (int channel = 0; channel < numStates; channel++) { RunningStatistics stats = new RunningStatistics(); for (int subIndex = 0; subIndex < subLength; subIndex++) { double onVal = 0.0; double offVal = 0.0; for (int i = 0; i < numStates; i++) { if (stateSigns[channel, i] == 1) { onVal += statePoints[i][subIndex]; } else { offVal += statePoints[i][subIndex]; } } onVal /= numStates; offVal /= numStates; stats.Push(onVal - offVal); } PointWithError pointWithError = new PointWithError() { Value = stats.Mean, Error = stats.StandardErrorOfSampleMean }; // add the channel to the ChannelSet List <string> usedSwitches = new List <string>(); for (int i = 0; i < modulations.Count; i++) { if ((channel & (1 << i)) != 0) { usedSwitches.Add(modulations[i].Name); } } string[] channelName = usedSwitches.ToArray(); // the SIG channel has a special name if (channel == 0) { channelName = new string[] { "SIG" } } ; channelSet.AddChannel(channelName, pointWithError); } // Add the ChannelSet to the demodulated block db.AddDetector(b.detectors[detectorIndex], calibration, channelSet); } // --This is done for each TOF detector-- foreach (string d in tofDetectorData.Keys) { int detectorIndex = b.detectors.IndexOf(d); // We obtain one Channel Set for each detector ChannelSet <TOFWithError> channelSet = new ChannelSet <TOFWithError>(); // Detector calibration double calibration = ((TOF)((EDMPoint)b.Points[0]).Shot.TOFs[detectorIndex]).Calibration; // Divide TOFs into bins depending on switch state List <List <TOF> > statePoints = new List <List <TOF> >(numStates); for (int i = 0; i < numStates; i++) { statePoints.Add(new List <TOF>(blockLength / numStates)); } for (int i = 0; i < blockLength; i++) { statePoints[(int)switchStates[i]].Add(tofDetectorData[b.detectors[detectorIndex]][i]); } int subLength = blockLength / numStates; // For each analysis channel, calculate the mean and standard error, then add to ChannelSet foreach (int channel in tofChannelsToAnalyse) { TOFAccumulator tofAccumulator = new TOFAccumulator(); for (int subIndex = 0; subIndex < subLength; subIndex++) { TOF onTOF = new TOF(); TOF offTOF = new TOF(); for (int i = 0; i < numStates; i++) { if (stateSigns[channel, i] == 1) { onTOF += statePoints[i][subIndex]; } else { offTOF += statePoints[i][subIndex]; } } onTOF /= numStates; offTOF /= numStates; tofAccumulator.Add(onTOF - offTOF); } // add the channel to the ChannelSet List <string> usedSwitches = new List <string>(); for (int i = 0; i < modulations.Count; i++) { if ((channel & (1 << i)) != 0) { usedSwitches.Add(modulations[i].Name); } } string[] channelName = usedSwitches.ToArray(); // the SIG channel has a special name if (channel == 0) { channelName = new string[] { "SIG" } } ; channelSet.AddChannel(channelName, tofAccumulator.GetResult()); } // If the detector is a molecule detector, add the special channels if (MOLECULE_DETECTORS.Contains(d)) { channelSet = AppendChannelSetWithSpecialValues(channelSet); } // Add the ChannelSet to the demodulated block db.AddDetector(d, calibration, channelSet); } return(db); }
// This function gates the detector data first, and then demodulates the channels. // This means that it can give innacurate results for non-linear combinations // of channels that vary appreciably over the TOF. There's another, slower, function // DemodulateBlockNL that takes care of this. public DemodulatedBlock DemodulateBlock(Block b, DemodulationConfig config) { // *** copy across the metadata *** DemodulatedBlock db = new DemodulatedBlock(); db.TimeStamp = b.TimeStamp; db.Config = b.Config; db.DemodulationConfig = config; // *** extract the gated detector data using the given config *** List<GatedDetectorData> gatedDetectorData = new List<GatedDetectorData>(); int ind = 0; foreach (string d in b.detectors) { GatedDetectorExtractSpec gdes; config.GatedDetectorExtractSpecs.TryGetValue(d, out gdes); if (gdes != null) { gatedDetectorData.Add(GatedDetectorData.ExtractFromBlock(b, gdes)); db.DetectorIndices.Add(gdes.Name, ind); ind++; db.DetectorCalibrations.Add(gdes.Name, ((TOF)((EDMPoint)b.Points[0]).Shot.TOFs[gdes.Index]).Calibration); } } //foreach (KeyValuePair<string, GatedDetectorExtractSpec> spec in config.GatedDetectorExtractSpecs) //{ // GatedDetectorExtractSpec gate = spec.Value; // gatedDetectorData.Add(GatedDetectorData.ExtractFromBlock(b, gate)); // db.DetectorIndices.Add(gate.Name, ind); // ind++; // db.DetectorCalibrations.Add(gate.Name, // ((TOF)((EDMPoint)b.Points[0]).Shot.TOFs[gate.Index]).Calibration); //} // ** normalise the top detector ** gatedDetectorData.Add( gatedDetectorData[db.DetectorIndices["top"]] / gatedDetectorData[db.DetectorIndices["norm"]]); db.DetectorIndices.Add("topNormed", db.DetectorIndices.Count); // *** extract the point detector data *** List<PointDetectorData> pointDetectorData = new List<PointDetectorData>(); foreach (string channel in config.PointDetectorChannels) { pointDetectorData.Add(PointDetectorData.ExtractFromBlock(b, channel)); // for the moment all single point detector channels are set to have a calibration // of 1.0 . db.DetectorCalibrations.Add(channel, 1.0); } // *** build the list of detector data *** List<DetectorData> detectorData = new List<DetectorData>(); for (int i = 0; i < gatedDetectorData.Count; i++) detectorData.Add(gatedDetectorData[i]); for (int i = 0; i < config.PointDetectorChannels.Count; i++) { detectorData.Add(pointDetectorData[i]); db.DetectorIndices.Add(config.PointDetectorChannels[i], i + gatedDetectorData.Count); } // calculate the norm FFT db.NormFourier = DetectorFT.MakeFT(gatedDetectorData[db.DetectorIndices["norm"]], kFourierAverage); // *** demodulate channels *** // ** build the list of modulations ** List<string> modNames = new List<string>(); List<Waveform> modWaveforms = new List<Waveform>(); foreach (AnalogModulation mod in b.Config.AnalogModulations) { modNames.Add(mod.Name); modWaveforms.Add(mod.Waveform); } foreach (DigitalModulation mod in b.Config.DigitalModulations) { modNames.Add(mod.Name); modWaveforms.Add(mod.Waveform); } foreach (TimingModulation mod in b.Config.TimingModulations) { modNames.Add(mod.Name); modWaveforms.Add(mod.Waveform); } // ** work out the switch state for each point ** int blockLength = modWaveforms[0].Length; List<bool[]> wfBits = new List<bool[]>(); foreach (Waveform wf in modWaveforms) wfBits.Add(wf.Bits); List<uint> switchStates = new List<uint>(blockLength); for (int i = 0; i < blockLength; i++) { uint switchState = 0; for (int j = 0; j < wfBits.Count; j++) { if (wfBits[j][i]) switchState += (uint)Math.Pow(2, j); } switchStates.Add(switchState); } // pre-calculate the state signs for each analysis channel // the first index selects the analysis channel, the second the switchState int numStates = (int)Math.Pow(2, modWaveforms.Count); int[,] stateSigns = new int[numStates, numStates]; for (uint i = 0; i < numStates; i++) { for (uint j = 0; j < numStates; j++) { stateSigns[i, j] = stateSign(j, i); } } // ** the following needs to be done for each detector ** for (int detector = 0; detector < detectorData.Count; detector++) { DetectorChannelValues dcv = new DetectorChannelValues(); for (int i = 0; i < modNames.Count; i++) dcv.SwitchMasks.Add(modNames[i], (uint)(1 << i)); // * divide the data up into bins according to switch state * List<List<double>> statePoints = new List<List<double>>(numStates); for (int i = 0; i < numStates; i++) statePoints.Add(new List<double>(blockLength / numStates)); for (int i = 0; i < blockLength; i++) { statePoints[(int)switchStates[i]].Add(detectorData[detector].PointValues[i]); } // * calculate the channel values * int subLength = blockLength / numStates; double[,] channelValues = new double[numStates, subLength]; for (int channel = 0; channel < numStates; channel++) { for (int subIndex = 0; subIndex < subLength; subIndex++) { double chanVal = 0; for (int i = 0; i < numStates; i++) chanVal += stateSigns[channel, i] * statePoints[i][subIndex]; chanVal /= (double)numStates; channelValues[channel, subIndex] = chanVal; } } //* calculate the channel means * double[] channelMeans = new double[numStates]; for (int channel = 0; channel < numStates; channel++) { double total = 0; for (int i = 0; i < subLength; i++) total += channelValues[channel, i]; total /= blockLength / numStates; channelMeans[channel] = total; } dcv.Values = channelMeans; //* calculate the channel errors * double[] channelErrors = new double[numStates]; for (int channel = 0; channel < numStates; channel++) { double total = 0; for (int i = 0; i < subLength; i++) total += Math.Pow(channelValues[channel, i] - channelMeans[channel], 2); total /= subLength * (subLength - 1); total = Math.Sqrt(total); channelErrors[channel] = total; } dcv.Errors = channelErrors; db.ChannelValues.Add(dcv); } return db; }
// DemodulateBlockNL augments the channel values returned by DemodulateBlock // with several non-linear combinations of channels (E.B/DB, the correction, etc). // These non-linear channels are calculated point-by-point for the TOF and then // integrated according to the Demodulation config. This is calculated for top and // topNormed detectors only for speed. // public DemodulatedBlock DemodulateBlockNL(Block b, DemodulationConfig config) { // we start with the standard demodulated block DemodulatedBlock dblock = DemodulateBlock(b, config); // First do everything for the un-normalised top detector int tdi = dblock.DetectorIndices["top"]; // TOF demodulate the block to get the channel wiggles // the BlockTOFDemodulator only demodulates the PMT detector BlockTOFDemodulator btdt = new BlockTOFDemodulator(); TOFChannelSet tcst = btdt.TOFDemodulateBlock(b, tdi, false); // now repeat having normed the block // normalise the PMT signal b.Normalise(config.GatedDetectorExtractSpecs["norm"]); int tndi = dblock.DetectorIndices["topNormed"]; // TOF demodulate the block to get the channel wiggles // the BlockTOFDemodulator only demodulates the PMT detector BlockTOFDemodulator btd = new BlockTOFDemodulator(); TOFChannelSet tcs = btd.TOFDemodulateBlock(b, tndi, false); // get hold of the gating data GatedDetectorExtractSpec gate = config.GatedDetectorExtractSpecs["top"]; // gate the special channels TOFChannel edmDB = (TOFChannel)tcs.GetChannel("EDMDB" ); double edmDBG = edmDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel corrDB = (TOFChannel)tcs.GetChannel( "CORRDB" ); double corrDBG = corrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel edmCorrDB = (TOFChannel)tcs.GetChannel( "EDMCORRDB" ); double edmCorrDBG = edmCorrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel corrDB_old = (TOFChannel)tcs.GetChannel( "CORRDB_OLD" ); double corrDBG_old = corrDB_old.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel edmCorrDB_old = (TOFChannel)tcs.GetChannel( "EDMCORRDB_OLD" ); double edmCorrDBG_old = edmCorrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf1fDB = (TOFChannel)tcs.GetChannel( "RF1FDB" ); double rf1fDBG = rf1fDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf2fDB = (TOFChannel)tcs.GetChannel( "RF2FDB" ); double rf2fDBG = rf2fDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf1fDBDB = (TOFChannel)tcs.GetChannel( "RF1FDBDB" ); double rf1fDBDBG = rf1fDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf2fDBDB = (TOFChannel)tcs.GetChannel( "RF2FDBDB" ); double rf2fDBDBG = rf2fDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf1aDB = (TOFChannel)tcs.GetChannel("RF1ADB"); double rf1aDBG = rf1aDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf2aDB = (TOFChannel)tcs.GetChannel("RF2ADB"); double rf2aDBG = rf2aDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf1aDBDB = (TOFChannel)tcs.GetChannel("RF1ADBDB"); double rf1aDBDBG = rf1aDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf2aDBDB = (TOFChannel)tcs.GetChannel("RF2ADBDB"); double rf2aDBDBG = rf2aDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel lf1DB = (TOFChannel)tcs.GetChannel("LF1DB"); double lf1DBG = lf1DB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel lf1DBDB = (TOFChannel)tcs.GetChannel("LF1DBDB"); double lf1DBDBG = lf1DBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel lf2DB = (TOFChannel)tcs.GetChannel("LF2DB"); double lf2DBG = lf2DB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel lf2DBDB = (TOFChannel)tcs.GetChannel("LF2DBDB"); double lf2DBDBG = lf2DBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel BDB = (TOFChannel)tcs.GetChannel("BDB"); double BDBG = BDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel erf1fDB = (TOFChannel)tcs.GetChannel( "ERF1FDB" ); double erf1fDBG = erf1fDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel erf2fDB = (TOFChannel)tcs.GetChannel( "ERF2FDB" ); double erf2fDBG = erf2fDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel erf1fDBDB = (TOFChannel)tcs.GetChannel( "ERF1FDBDB" ); double erf1fDBDBG = erf1fDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel erf2fDBDB = (TOFChannel)tcs.GetChannel("ERF2FDBDB" ); double erf2fDBDBG = erf2fDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel brf1fCorrDB = (TOFChannel)tcs.GetChannel( "BRF1FCORRDB" ); double brf1fCorrDBG = brf1fCorrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel brf2fCorrDB = (TOFChannel)tcs.GetChannel( "BRF2FCORRDB" ); double brf2fCorrDBG = brf2fCorrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); //Repeat for top TOFChannel edmDBtop = (TOFChannel)tcst.GetChannel("EDMDB"); double edmDBGtop = edmDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel corrDBtop = (TOFChannel)tcst.GetChannel("CORRDB"); double corrDBGtop = corrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel edmCorrDBtop = (TOFChannel)tcst.GetChannel("EDMCORRDB"); double edmCorrDBGtop = edmCorrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel corrDB_oldtop = (TOFChannel)tcst.GetChannel("CORRDB_OLD"); double corrDBG_oldtop = corrDB_old.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel edmCorrDB_oldtop = (TOFChannel)tcst.GetChannel("EDMCORRDB_OLD"); double edmCorrDBG_oldtop = edmCorrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf1fDBtop = (TOFChannel)tcst.GetChannel("RF1FDB"); double rf1fDBGtop = rf1fDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf2fDBtop = (TOFChannel)tcst.GetChannel("RF2FDB"); double rf2fDBGtop = rf2fDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf1fDBDBtop = (TOFChannel)tcst.GetChannel("RF1FDBDB"); double rf1fDBDBGtop = rf1fDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf2fDBDBtop = (TOFChannel)tcst.GetChannel("RF2FDBDB"); double rf2fDBDBGtop = rf2fDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf1aDBtop = (TOFChannel)tcst.GetChannel("RF1ADB"); double rf1aDBGtop = rf1aDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf2aDBtop = (TOFChannel)tcst.GetChannel("RF2ADB"); double rf2aDBGtop = rf2aDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf1aDBDBtop = (TOFChannel)tcst.GetChannel("RF1ADBDB"); double rf1aDBDBGtop = rf1aDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel rf2aDBDBtop = (TOFChannel)tcst.GetChannel("RF2ADBDB"); double rf2aDBDBGtop = rf2aDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel lf1DBtop = (TOFChannel)tcst.GetChannel("LF1DB"); double lf1DBGtop = lf1DB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel lf1DBDBtop = (TOFChannel)tcst.GetChannel("LF1DBDB"); double lf1DBDBGtop = lf1DBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel lf2DBtop = (TOFChannel)tcst.GetChannel("LF2DB"); double lf2DBGtop = lf2DB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel lf2DBDBtop = (TOFChannel)tcst.GetChannel("LF2DBDB"); double lf2DBDBGtop = lf2DBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel BDBtop = (TOFChannel)tcst.GetChannel("BDB"); double BDBGtop = BDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel erf1fDBtop = (TOFChannel)tcst.GetChannel("ERF1FDB"); double erf1fDBGtop = erf1fDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel erf2fDBtop = (TOFChannel)tcst.GetChannel("ERF2FDB"); double erf2fDBGtop = erf2fDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel erf1fDBDBtop = (TOFChannel)tcst.GetChannel("ERF1FDBDB"); double erf1fDBDBGtop = erf1fDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel erf2fDBDBtop = (TOFChannel)tcst.GetChannel("ERF2FDBDB"); double erf2fDBDBGtop = erf2fDBDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel brf1fCorrDBtop = (TOFChannel)tcst.GetChannel("BRF1FCORRDB"); double brf1fCorrDBGtop = brf1fCorrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); TOFChannel brf2fCorrDBtop = (TOFChannel)tcst.GetChannel("BRF2FCORRDB"); double brf2fCorrDBGtop = brf2fCorrDB.Difference.GatedMean(gate.GateLow, gate.GateHigh); // we bodge the errors, which aren't really used for much anyway // by just using the error from the normal dblock. I ignore the error in DB. // I use the simple correction error for the full correction. Doesn't much matter. DetectorChannelValues dcv = dblock.ChannelValues[tndi]; double edmDBE = dcv.GetError(new string[] { "E", "B" }) / dcv.GetValue(new string[] { "DB" }); double corrDBE = Math.Sqrt( Math.Pow(dcv.GetValue(new string[] { "E", "DB" }) * dcv.GetError(new string[] { "B" }), 2) + Math.Pow(dcv.GetValue(new string[] { "B" }) * dcv.GetError(new string[] { "E", "DB" }), 2) ) / Math.Pow(dcv.GetValue(new string[] { "DB" }), 2); double edmCorrDBE = Math.Sqrt( Math.Pow(edmDBE, 2) + Math.Pow(corrDBE, 2)); double rf1fDBE = dcv.GetError(new string[] { "RF1F" }) / dcv.GetValue(new string[] { "DB" }); double rf2fDBE = dcv.GetError(new string[] { "RF2F" }) / dcv.GetValue(new string[] { "DB" }); double rf1fDBDBE = dcv.GetError(new string[] { "DB", "RF1F" }) / dcv.GetValue(new string[] { "DB" }); double rf2fDBDBE = dcv.GetError(new string[] { "DB", "RF2F" }) / dcv.GetValue(new string[] { "DB" }); double rf1aDBE = dcv.GetError(new string[] { "RF1A" }) / dcv.GetValue(new string[] { "DB" }); double rf2aDBE = dcv.GetError(new string[] { "RF2A" }) / dcv.GetValue(new string[] { "DB" }); double rf1aDBDBE = dcv.GetError(new string[] { "DB", "RF1A" }) / dcv.GetValue(new string[] { "DB" }); double rf2aDBDBE = dcv.GetError(new string[] { "DB", "RF2A" }) / dcv.GetValue(new string[] { "DB" }); double lf1DBE = dcv.GetError(new string[] { "LF1" }) / dcv.GetValue(new string[] { "DB" }); double lf1DBDBE = dcv.GetError(new string[] { "DB", "LF1" }) / dcv.GetValue(new string[] { "DB" }); double lf2DBE = dcv.GetError(new string[] { "LF2" }) / dcv.GetValue(new string[] { "DB" }); double lf2DBDBE = dcv.GetError(new string[] { "DB", "LF2" }) / dcv.GetValue(new string[] { "DB" }); double brf1fDBE = dcv.GetError(new string[] { "B", "RF1F" }) / dcv.GetValue(new string[] { "DB" }); double brf2fDBE = dcv.GetError(new string[] { "B", "RF2F" }) / dcv.GetValue(new string[] { "DB" }); double erf1fDBE = dcv.GetError(new string[] { "E", "RF1F" }) / dcv.GetValue(new string[] { "DB" }); double erf2fDBE = dcv.GetError(new string[] { "E", "RF2F" }) / dcv.GetValue(new string[] { "DB" }); double erf1fDBDBE = dcv.GetError(new string[] { "E", "DB", "RF1F" }) / dcv.GetValue(new string[] { "DB" }); double erf2fDBDBE = dcv.GetError(new string[] { "E", "DB", "RF2F" }) / dcv.GetValue(new string[] { "DB" }); double BDBE = dcv.GetError(new string[] { "B" }) / dcv.GetValue(new string[] { "DB" }); //repeat for top DetectorChannelValues dcvt = dblock.ChannelValues[tdi]; double lf2DBEtop = dcvt.GetError(new string[] { "LF2" }) / dcvt.GetValue(new string[] { "DB" }); //Change the db channel back to topNormed double lf2DBDBEtop = dcvt.GetError(new string[] { "DB", "LF2" }) / dcvt.GetValue(new string[] { "DB" }); //Change the db channel back to topNormed double edmDBEtop = dcvt.GetError(new string[] { "E", "B" }) / dcvt.GetValue(new string[] { "DB" }); double corrDBEtop = Math.Sqrt( Math.Pow(dcvt.GetValue(new string[] { "E", "DB" }) * dcvt.GetError(new string[] { "B" }), 2) + Math.Pow(dcvt.GetValue(new string[] { "B" }) * dcvt.GetError(new string[] { "E", "DB" }), 2)) / Math.Pow(dcvt.GetValue(new string[] { "DB" }), 2); double edmCorrDBEtop = Math.Sqrt(Math.Pow(edmDBEtop, 2) + Math.Pow(corrDBEtop, 2)); double rf1fDBEtop = dcvt.GetError(new string[] { "RF1F" }) / dcvt.GetValue(new string[] { "DB" }); double rf2fDBEtop = dcvt.GetError(new string[] { "RF2F" }) / dcvt.GetValue(new string[] { "DB" }); double rf1fDBDBEtop = dcvt.GetError(new string[] { "DB", "RF1F" }) / dcvt.GetValue(new string[] { "DB" }); double rf2fDBDBEtop = dcvt.GetError(new string[] { "DB", "RF2F" }) / dcvt.GetValue(new string[] { "DB" }); double rf1aDBEtop = dcvt.GetError(new string[] { "RF1A" }) / dcvt.GetValue(new string[] { "DB" }); double rf2aDBEtop = dcvt.GetError(new string[] { "RF2A" }) / dcvt.GetValue(new string[] { "DB" }); double rf1aDBDBEtop = dcvt.GetError(new string[] { "DB", "RF1A" }) / dcvt.GetValue(new string[] { "DB" }); double rf2aDBDBEtop = dcvt.GetError(new string[] { "DB", "RF2A" }) / dcvt.GetValue(new string[] { "DB" }); double lf1DBEtop = dcvt.GetError(new string[] { "LF1" }) / dcvt.GetValue(new string[] { "DB" }); double lf1DBDBEtop = dcvt.GetError(new string[] { "DB", "LF1" }) / dcvt.GetValue(new string[] { "DB" }); double brf1fDBEtop = dcvt.GetError(new string[] { "B", "RF1F" }) / dcvt.GetValue(new string[] { "DB" }); double brf2fDBEtop = dcvt.GetError(new string[] { "B", "RF2F" }) / dcvt.GetValue(new string[] { "DB" }); double erf1fDBEtop = dcvt.GetError(new string[] { "E", "RF1F" }) / dcvt.GetValue(new string[] { "DB" }); double erf2fDBEtop = dcvt.GetError(new string[] { "E", "RF2F" }) / dcvt.GetValue(new string[] { "DB" }); double erf1fDBDBEtop = dcvt.GetError(new string[] { "E", "DB", "RF1F" }) / dcvt.GetValue(new string[] { "DB" }); double erf2fDBDBEtop = dcvt.GetError(new string[] { "E", "DB", "RF2F" }) / dcvt.GetValue(new string[] { "DB" }); double BDBEtop = dcvt.GetError(new string[] { "B" }) / dcvt.GetValue(new string[] { "DB" }); // stuff the data into the dblock dblock.ChannelValues[tndi].SpecialValues["EDMDB"] = new double[] { edmDBG, edmDBE }; dblock.ChannelValues[tndi].SpecialValues["CORRDB"] = new double[] { corrDBG, corrDBE }; dblock.ChannelValues[tndi].SpecialValues["EDMCORRDB"] = new double[] { edmCorrDBG, edmCorrDBE }; dblock.ChannelValues[tndi].SpecialValues["CORRDB_OLD"] = new double[] { corrDBG_old, corrDBE }; dblock.ChannelValues[tndi].SpecialValues["EDMCORRDB_OLD"] = new double[] { edmCorrDBG_old, edmCorrDBE }; dblock.ChannelValues[tndi].SpecialValues["RF1FDB"] = new double[] { rf1fDBG, rf1fDBE }; dblock.ChannelValues[tndi].SpecialValues["RF2FDB"] = new double[] { rf2fDBG, rf2fDBE }; dblock.ChannelValues[tndi].SpecialValues["RF1FDBDB"] = new double[] { rf1fDBDBG, rf1fDBDBE }; dblock.ChannelValues[tndi].SpecialValues["RF2FDBDB"] = new double[] { rf2fDBDBG, rf2fDBDBE }; dblock.ChannelValues[tndi].SpecialValues["RF1ADB"] = new double[] { rf1aDBG, rf1aDBE }; dblock.ChannelValues[tndi].SpecialValues["RF2ADB"] = new double[] { rf2aDBG, rf2aDBE }; dblock.ChannelValues[tndi].SpecialValues["RF1ADBDB"] = new double[] { rf1aDBDBG, rf1aDBDBE }; dblock.ChannelValues[tndi].SpecialValues["RF2ADBDB"] = new double[] { rf2aDBDBG, rf2aDBDBE }; dblock.ChannelValues[tndi].SpecialValues["BRF1FCORRDB"] = new double[] { brf1fCorrDBG, brf1fDBE }; dblock.ChannelValues[tndi].SpecialValues["BRF2FCORRDB"] = new double[] { brf2fCorrDBG, brf2fDBE }; dblock.ChannelValues[tndi].SpecialValues["ERF1FDB"] = new double[] { erf1fDBG, erf1fDBE }; dblock.ChannelValues[tndi].SpecialValues["ERF2FDB"] = new double[] { erf2fDBG, erf2fDBE }; dblock.ChannelValues[tndi].SpecialValues["ERF1FDBDB"] = new double[] { erf1fDBDBG, erf1fDBDBE }; dblock.ChannelValues[tndi].SpecialValues["ERF2FDBDB"] = new double[] { erf2fDBDBG, erf2fDBDBE }; dblock.ChannelValues[tndi].SpecialValues["LF1DB"] = new double[] { lf1DBG, lf1DBE }; dblock.ChannelValues[tndi].SpecialValues["LF1DBDB"] = new double[] { lf1DBDBG, lf1DBDBE }; dblock.ChannelValues[tndi].SpecialValues["LF2DB"] = new double[] { lf2DBG, lf2DBE }; dblock.ChannelValues[tndi].SpecialValues["LF2DBDB"] = new double[] { lf2DBDBG, lf2DBDBE }; dblock.ChannelValues[tndi].SpecialValues["BDB"] = new double[] { BDBG, BDBE }; dblock.ChannelValues[tdi].SpecialValues["EDMDB"] = new double[] { edmDBGtop, edmDBEtop }; dblock.ChannelValues[tdi].SpecialValues["CORRDB"] = new double[] { corrDBGtop, corrDBEtop }; dblock.ChannelValues[tdi].SpecialValues["EDMCORRDB"] = new double[] { edmCorrDBGtop, edmCorrDBEtop }; dblock.ChannelValues[tdi].SpecialValues["CORRDB_OLD"] = new double[] { corrDBG_oldtop, corrDBEtop }; dblock.ChannelValues[tdi].SpecialValues["EDMCORRDB_OLD"] = new double[] { edmCorrDBG_oldtop, edmCorrDBEtop }; dblock.ChannelValues[tdi].SpecialValues["RF1FDB"] = new double[] { rf1fDBGtop, rf1fDBEtop }; dblock.ChannelValues[tdi].SpecialValues["RF2FDB"] = new double[] { rf2fDBGtop, rf2fDBEtop }; dblock.ChannelValues[tdi].SpecialValues["RF1FDBDB"] = new double[] { rf1fDBDBGtop, rf1fDBDBEtop }; dblock.ChannelValues[tdi].SpecialValues["RF2FDBDB"] = new double[] { rf2fDBDBGtop, rf2fDBDBEtop }; dblock.ChannelValues[tdi].SpecialValues["RF1ADB"] = new double[] { rf1aDBGtop, rf1aDBEtop }; dblock.ChannelValues[tdi].SpecialValues["RF2ADB"] = new double[] { rf2aDBGtop, rf2aDBEtop }; dblock.ChannelValues[tdi].SpecialValues["RF1ADBDB"] = new double[] { rf1aDBDBGtop, rf1aDBDBEtop }; dblock.ChannelValues[tdi].SpecialValues["RF2ADBDB"] = new double[] { rf2aDBDBGtop, rf2aDBDBEtop }; dblock.ChannelValues[tdi].SpecialValues["BRF1FCORRDB"] = new double[] { brf1fCorrDBGtop, brf1fDBEtop }; dblock.ChannelValues[tdi].SpecialValues["BRF2FCORRDB"] = new double[] { brf2fCorrDBGtop, brf2fDBEtop }; dblock.ChannelValues[tdi].SpecialValues["ERF1FDB"] = new double[] { erf1fDBGtop, erf1fDBEtop }; dblock.ChannelValues[tdi].SpecialValues["ERF2FDB"] = new double[] { erf2fDBGtop, erf2fDBEtop }; dblock.ChannelValues[tdi].SpecialValues["ERF1FDBDB"] = new double[] { erf1fDBDBGtop, erf1fDBDBEtop }; dblock.ChannelValues[tdi].SpecialValues["ERF2FDBDB"] = new double[] { erf2fDBDBGtop, erf2fDBDBEtop }; dblock.ChannelValues[tdi].SpecialValues["LF1DB"] = new double[] { lf1DBGtop, lf1DBEtop }; dblock.ChannelValues[tdi].SpecialValues["LF1DBDB"] = new double[] { lf1DBDBGtop, lf1DBDBEtop }; dblock.ChannelValues[tdi].SpecialValues["LF2DB"] = new double[] { lf2DBGtop, lf2DBEtop }; dblock.ChannelValues[tdi].SpecialValues["LF2DBDB"] = new double[] { lf2DBDBGtop, lf2DBDBEtop }; dblock.ChannelValues[tdi].SpecialValues["BDB"] = new double[] { BDBGtop, BDBEtop }; return dblock; }
public DemodulatedBlock(DateTime timeStamp, BlockConfig config, DemodulationConfig demodulationConfig) { this.TimeStamp = timeStamp; this.Config = config; this.DemodulationConfig = demodulationConfig; }