protected override void Child_ExperimentEndedHook(object sender, ExperimentEndedEventArgs e) { // Get Data from single vlaue experiments if ((e.Data != null) && (e.Data.GetType().Equals(typeof(Generic1DExperimentData)))) { Generic1DExperimentData data = e.Data as Generic1DExperimentData; int i = 0; foreach (string dataset in data.datasetNames) { // only add datasets once if ((currentPosIDX == 0) && (!scanData.GetDatasetNames().Contains(dataset))) { scanData.addDataset(dataset, data.axisNames[0] + " (" + data.axisUnits[0] + ")"); } // Add first point of 1D Data (Single Value Experiment should only have one) scanData.addValue(dataset, currentXPos, currentYPos, data.Get1DData(i)[0]); i++; } } }
private void ExecuteSingleValueMeasurement() { bool bRelPositions = (parent != null); double[] values = new double[bRelPositions ? (activeChannels.Count) + 3 : activeChannels.Count]; Generic1DExperimentData data = new Generic1DExperimentData(); int i = 0; // Add Relative Koordinates and time Position scanRelativePosition = new Position(0, 0, 0); if (bRelPositions) { scanRelativePosition = parent.Position(); values[0] = scanRelativePosition.X; values[1] = scanRelativePosition.Y; values[2] = scanRelativePosition.Z; i = 3; } foreach (TransducerChannel channel in activeChannels) { double value = channel.GetAveragedValue(); data.datasetNames.Add(Name + "." + channel.Name); data.axisNames.Add(channel.Name); data.axisUnits.Add(channel.Unit); data.data.Add(new double[] { value }); values[i++] = value; } appendResultsValues(values); status = enExperimentStatus.Idle; NotifyExperimentEndedNow(new ExperimentEndedEventArgs(enExperimentStatus.Completed, data)); }
protected override void Child_ExperimentEndedHook(object sender, ExperimentEndedEventArgs e) { // Get Data from single vlaue experiments if ((e.Data != null) && (e.Data.GetType().Equals(typeof(Generic1DExperimentData)))) { Generic1DExperimentData data = e.Data as Generic1DExperimentData; int i = 0; foreach (string dataset in data.datasetNames) { // only add datasets once if ((Scanner.ScanPointIndex[0] == 0) && (Scanner.ScanPointIndex[1] == 0) && (!scanData.GetDatasetNames().Contains(dataset))) { scanData.addDataset(dataset, data.axisNames[0] + " (" + data.axisUnits[0] + ")"); } // Add first point of 1D Data (Single Value Experiment should only have one) scanData.setValue(dataset, reverseScanX ? (Scanner.NumScanPoints[0] - Scanner.ScanPointIndex[0] - 1) : Scanner.ScanPointIndex[0], reverseScanY ? (Scanner.NumScanPoints[1] - Scanner.ScanPointIndex[1] - 1) : Scanner.ScanPointIndex[1], data.Get1DData(i)[0]); i++; } } }