use of org.eclipse.scanning.example.detector.MandelbrotModel in project gda-core by openGDA.
the class FocusScanConverterTest method setUp.
@Before
public void setUp() throws Exception {
mappingStageInfo = new MappingStageInfo();
mappingStageInfo.setPlotXAxisName("testing_x_axis");
mappingStageInfo.setPlotYAxisName("testing_y_axis");
mappingStageInfo.setAssociatedAxis("zone_plate_axis");
focusScanConverter = new FocusScanConverter();
focusScanConverter.setMappingStageInfo(mappingStageInfo);
focusScanBean = new FocusScanBean();
focusScanBean.setFocusScannableName("zonePlateZ");
focusScanBean.setFocusCentre(150.0);
focusScanBean.setFocusRange(17.5);
focusScanBean.setNumberOfFocusSteps(25);
focusScanBean.setNumberOfLinePoints(120);
focusScanBean.setDetector(new MandelbrotModel());
final LineMappingRegion lineRegion = new LineMappingRegion();
lineRegion.setxStart(1.23);
lineRegion.setxStop(6.78);
lineRegion.setyStart(0.321);
lineRegion.setyStop(0.289);
focusScanBean.setLineRegion(lineRegion);
}
use of org.eclipse.scanning.example.detector.MandelbrotModel in project gda-core by openGDA.
the class ScanRequestConverterTest method testDetectorIsExcludedCorrectly.
@Test
public void testDetectorIsExcludedCorrectly() throws Exception {
// Arrange
final String displayName = "Mandelbrot Detector";
final IDetectorModel detModel = new MandelbrotModel();
mappingBean.setDetectorParameters(Arrays.asList(new DetectorModelWrapper(displayName, detModel, false)));
// Act - convert mapping bean to scan request
final ScanRequest scanRequest = scanRequestConverter.convertToScanRequest(mappingBean);
// Assert
assertThat(scanRequest.getDetectors().entrySet(), is(empty()));
// Act again - merge the scan request back into the same mapping bean
scanRequestConverter.mergeIntoMappingBean(scanRequest, mappingBean);
// Assert again - check the mapping bean is the same as the original
List<IScanModelWrapper<IDetectorModel>> newDetectorParams = mappingBean.getDetectorParameters();
assertThat(newDetectorParams.size(), is(1));
IScanModelWrapper<IDetectorModel> wrapper = newDetectorParams.get(0);
assertThat(wrapper.getName(), is(equalTo(displayName)));
// names must be same, i.e. mandlebrot
assertThat(wrapper.getModel(), is(equalTo(detModel)));
assertThat(wrapper.isIncludeInScan(), is(false));
}
use of org.eclipse.scanning.example.detector.MandelbrotModel in project gda-core by openGDA.
the class ScanRequestConverterTest method testDetectorIsIncludedCorrectly.
@Test
public void testDetectorIsIncludedCorrectly() throws Exception {
// Arrange
final String detName = "mandelbrot";
final String displayName = "Mandelbrot Detector";
final IDetectorModel detModel = new MandelbrotModel();
detModel.setName(detName);
mappingBean.setDetectorParameters(Arrays.asList(new DetectorModelWrapper(displayName, detModel, true)));
// Act - convert mapping bean to scan request
final ScanRequest scanRequest = scanRequestConverter.convertToScanRequest(mappingBean);
// Assert
assertEquals(detModel, scanRequest.getDetectors().get(detName));
// Act again - convert scan request back to mapping bean
((DetectorModelWrapper) mappingBean.getDetectorParameters().get(0)).setIncludeInScan(false);
scanRequestConverter.mergeIntoMappingBean(scanRequest, mappingBean);
// Assert - check the new mapping bean is the same as the original
List<IScanModelWrapper<IDetectorModel>> newDetectorParams = mappingBean.getDetectorParameters();
assertThat(newDetectorParams.size(), is(1));
IScanModelWrapper<IDetectorModel> wrapper = newDetectorParams.get(0);
assertThat(wrapper.getName(), is(equalTo(displayName)));
assertThat(wrapper.getModel(), is(equalTo(detModel)));
assertThat(wrapper.isIncludeInScan(), is(true));
}
Aggregations