@Test public void testGetSpectrum() { IDataset spectrum = gridScanMap.getSpectrum(0, 0); Dataset d = DatasetUtils.convertToDataset(spectrum); assertEquals(d.getElementDoubleAbs(0), 0, 0); assertEquals(d.getElementDoubleAbs(d.getSize() - 1), d.getSize() - 1, 0); }
private void checkMetadata(NXentry entry, List<ScanMetadata> scanMetadataList) { for (ScanMetadata scanMetadata : scanMetadataList) { MetadataType type = scanMetadata.getType(); NXobject object = getNexusObjectForMetadataType(entry, type); Map<String, Object> metadataFields = scanMetadata.getFields(); for (String metadataFieldName : metadataFields.keySet()) { Object expectedValue = scanMetadata.getFieldValue(metadataFieldName); Dataset dataset = DatasetUtils.convertToDataset(object.getDataset(metadataFieldName)); assertNotNull(dataset); assertEquals(1, dataset.getSize()); assertEquals(DTypeUtils.getDTypeFromObject(expectedValue), dataset.getDType()); assertEquals(expectedValue, dataset.getObjectAbs(0)); } } }