Search in sources :

Example 6 with ScanMetadata

use of org.eclipse.scanning.api.scan.models.ScanMetadata in project gda-core by openGDA.

the class ClausesContext method setSampleMetadata.

/**
 * Sets the supplied {@link String} of sample metadata key names and values for the scan and prevents any
 * further changes to this being made.
 *
 * @param metadataDefs	A pipe separated {@link String} containing pairs of metadata key names and values
 * 						in the form "keyname1::value1|keyname2::value2"
 */
private void setSampleMetadata(String metadataDefs) {
    if (!acceptingSampleMetadata) {
        throw new IllegalStateException("Sample metadata has already been set for this mscan");
    }
    sampleMetadata = new ScanMetadata(MetadataType.SAMPLE);
    Stream.of(metadataDefs.split("\\|")).map(x -> x.split("::")).forEach(this::fillMetadata);
    acceptingSampleMetadata = false;
}
Also used : Arrays(java.util.Arrays) StringUtils(org.apache.commons.lang.StringUtils) GRID_STEP(gda.mscan.element.Scanpath.GRID_STEP) LoggerFactory(org.slf4j.LoggerFactory) ScanRequest(org.eclipse.scanning.api.event.scan.ScanRequest) CompoundModel(org.eclipse.scanning.api.points.models.CompoundModel) SINGLE_POINT(gda.mscan.element.Scanpath.SINGLE_POINT) MathUtils(org.apache.commons.math.util.MathUtils) AXIAL(gda.mscan.element.RegionShape.AXIAL) LINE_STEP(gda.mscan.element.Scanpath.LINE_STEP) AxialArrayModel(org.eclipse.scanning.api.points.models.AxialArrayModel) Detector(gda.device.Detector) Map(java.util.Map) IRectangularROI(org.eclipse.dawnsci.analysis.api.roi.IRectangularROI) LINE(gda.mscan.element.RegionShape.LINE) Monitor(gda.device.Monitor) EnumMap(java.util.EnumMap) Collection(java.util.Collection) RECTANGLE(gda.mscan.element.RegionShape.RECTANGLE) Set(java.util.Set) CIRCLE(gda.mscan.element.RegionShape.CIRCLE) ScanningException(org.eclipse.scanning.api.scan.ScanningException) PROCESSOR(gda.mscan.element.ScanDataConsumer.PROCESSOR) Collectors(java.util.stream.Collectors) POLYGON(gda.mscan.element.RegionShape.POLYGON) POINT(gda.mscan.element.RegionShape.POINT) LINE_POINTS(gda.mscan.element.Scanpath.LINE_POINTS) Scannable(gda.device.Scannable) AxialStepModel(org.eclipse.scanning.api.points.models.AxialStepModel) List(java.util.List) IMScanDimensionalElementEnum(gda.mscan.element.IMScanDimensionalElementEnum) Stream(java.util.stream.Stream) IROI(org.eclipse.dawnsci.analysis.api.roi.IROI) ProcessingRequest(org.eclipse.scanning.api.event.scan.ProcessingRequest) ScanMetadata(org.eclipse.scanning.api.scan.models.ScanMetadata) Entry(java.util.Map.Entry) Optional(java.util.Optional) TEMPLATE(gda.mscan.element.ScanDataConsumer.TEMPLATE) AXIS_STEP(gda.mscan.element.Scanpath.AXIS_STEP) ScanModel(org.eclipse.scanning.api.scan.models.ScanModel) HashMap(java.util.HashMap) SAMPLE(gda.mscan.element.ScanDataConsumer.SAMPLE) CENTRED_RECTANGLE(gda.mscan.element.RegionShape.CENTRED_RECTANGLE) ArrayList(java.util.ArrayList) IDetectorModel(org.eclipse.scanning.api.device.models.IDetectorModel) HashSet(java.util.HashSet) AXIS_POINTS(gda.mscan.element.Scanpath.AXIS_POINTS) IScanPathModel(org.eclipse.scanning.api.points.models.IScanPathModel) IRunnableDevice(org.eclipse.scanning.api.device.IRunnableDevice) PER_SCAN_MONITOR(gda.mscan.element.ScanDataConsumer.PER_SCAN_MONITOR) NoSuchElementException(java.util.NoSuchElementException) RegionShape(gda.mscan.element.RegionShape) Logger(org.slf4j.Logger) MetadataType(org.eclipse.scanning.api.scan.models.ScanMetadata.MetadataType) GRID_POINTS(gda.mscan.element.Scanpath.GRID_POINTS) LISSAJOUS(gda.mscan.element.Scanpath.LISSAJOUS) ScanDataConsumer(gda.mscan.element.ScanDataConsumer) Consumer(java.util.function.Consumer) AXIS_ARRAY(gda.mscan.element.Scanpath.AXIS_ARRAY) IRunnableDeviceService(org.eclipse.scanning.api.device.IRunnableDeviceService) SPIRAL(gda.mscan.element.Scanpath.SPIRAL) Scanpath(gda.mscan.element.Scanpath) IClauseElementProcessor(gda.mscan.processor.IClauseElementProcessor) Mutator(gda.mscan.element.Mutator) Collections(java.util.Collections) ScanMetadata(org.eclipse.scanning.api.scan.models.ScanMetadata)

Aggregations

ScanMetadata (org.eclipse.scanning.api.scan.models.ScanMetadata)6 ScanRequest (org.eclipse.scanning.api.event.scan.ScanRequest)4 ArrayList (java.util.ArrayList)3 Arrays (java.util.Arrays)2 Collection (java.util.Collection)2 Collections (java.util.Collections)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 CompoundModel (org.eclipse.scanning.api.points.models.CompoundModel)2 IScanPointGeneratorModel (org.eclipse.scanning.api.points.models.IScanPointGeneratorModel)2 SimpleSampleMetadata (uk.ac.diamond.daq.mapping.impl.SimpleSampleMetadata)2 Detector (gda.device.Detector)1 Monitor (gda.device.Monitor)1 Scannable (gda.device.Scannable)1 ScannableMotionUnits (gda.device.ScannableMotionUnits)1 Finder (gda.factory.Finder)1 IMScanDimensionalElementEnum (gda.mscan.element.IMScanDimensionalElementEnum)1 Mutator (gda.mscan.element.Mutator)1 RegionShape (gda.mscan.element.RegionShape)1 AXIAL (gda.mscan.element.RegionShape.AXIAL)1