use of org.eclipse.scanning.api.points.models.AxialStepModel in project gda-core by openGDA.
the class MScanSubmitterTest method trimIfStepAwkwardFitForRegionOccursOnGenerator.
@Test
public // Behaviour combined with {@link StepTest#testImperfectSequence} shows expected behaviour
void trimIfStepAwkwardFitForRegionOccursOnGenerator() throws Exception {
final AxialStepModel expectedModel = new AxialStepModel(scannable.getName(), -1, 1, 0.3);
expectedModel.setContinuous(false);
Object[] arr = { scannable, RegionShape.AXIAL, -1, 1, Scanpath.AXIS_STEP, 0.3, detectorRunnableDevice };
when(resolver.resolveScanClauses()).thenReturn(Arrays.asList(Arrays.asList(new ScannableElementProcessor(scannable), new RegionShapeElementProcessor(RegionShape.AXIAL), new NumberElementProcessor(-1), new NumberElementProcessor(1), new ScanpathElementProcessor(Scanpath.AXIS_STEP), new NumberElementProcessor(0.3)), Arrays.asList(new IRunnableDeviceDetectorElementProcessor(detectorRunnableDevice))));
builder.buildAndSubmitBlockingScanRequest(arr);
verify(submitter).blockingSubmit(beanCaptor.capture());
verify(eventSubscriber).addListener(any(IScanListener.class));
CompoundModel model = beanCaptor.getValue().getScanRequest().getCompoundModel();
assertThat(model.getModels().get(0), is(equalTo(expectedModel)));
}
use of org.eclipse.scanning.api.points.models.AxialStepModel in project gda-core by openGDA.
the class ScanpathTest method createModelCreatesCorrectModelForOneDStep.
@Test
public void createModelCreatesCorrectModelForOneDStep() throws Exception {
pathParams = Arrays.asList(2, 3, 0.5);
IScanPathModel model = AXIS_STEP.createModel(axialScannables, pathParams, blineParams, mutators);
assertThat(model, is(instanceOf(AxialStepModel.class)));
AxialStepModel sModel = (AxialStepModel) model;
assertThat(sModel.getScannableNames(), contains("name1"));
assertThat(sModel.getStart(), is(2.0));
assertThat(sModel.getStop(), is(3.0));
assertThat(sModel.getStep(), is(0.5));
assertThat(sModel.getUnits(), is(equalTo(List.of("Deg"))));
}
use of org.eclipse.scanning.api.points.models.AxialStepModel in project gda-core by openGDA.
the class XanesScanningUtils method createModelFromEdgeSelection.
/**
* Create a step model for each range of energies around the edge
*
* @param edgeEnergy
* energy of the edge to be scanned
* @param energyScannableName
* name of the scannable to control the energy
* @return corresponding step model
*/
public static IScanPointGeneratorModel createModelFromEdgeSelection(double edgeEnergy, String energyScannableName) {
final List<AxialStepModel> stepModels = new ArrayList<>(xanesStepRanges.length);
// Create a step model for each range of energies around the edge
for (double[] range : xanesStepRanges) {
stepModels.add(new AxialStepModel(energyScannableName, roundDouble(edgeEnergy + range[0]), roundDouble(edgeEnergy + range[1]), range[2]));
}
// Create a multi-step model containing these step models
final AxialMultiStepModel model = new AxialMultiStepModel(energyScannableName, stepModels);
model.setContinuous(false);
return model;
}
use of org.eclipse.scanning.api.points.models.AxialStepModel in project gda-core by openGDA.
the class MappingUISerializationTest method createScanDefinition.
private IScanDefinition createScanDefinition() {
IMappingScanRegion scanRegion = createScanRegion();
AxialStepModel energy = new AxialStepModel("energy", 10000.0, 10200.0, 10.0);
ScanPathModelWrapper energyWrapper = new ScanPathModelWrapper("energy", energy, true);
AxialStepModel z = new AxialStepModel("z", 2.5, 17.5, 0.1);
ScanPathModelWrapper zWrapper = new ScanPathModelWrapper("z", z, true);
IScanDefinition scanDefinition = new MappingScanDefinition();
scanDefinition.setMappingScanRegion(scanRegion);
scanDefinition.setOuterScannables(Arrays.asList(energyWrapper, zWrapper));
return scanDefinition;
}
use of org.eclipse.scanning.api.points.models.AxialStepModel in project gda-core by openGDA.
the class MappingUISerializationTest method testSerializeScanPathModelWrapper.
@Test
public void testSerializeScanPathModelWrapper() throws Exception {
AxialStepModel model = new AxialStepModel("energy", 10000.0, 10200.0, 10.0);
ScanPathModelWrapper wrapper = new ScanPathModelWrapper("energy", model, true);
String json = service.marshal(wrapper);
ScanPathModelWrapper newWrapper = service.unmarshal(json, ScanPathModelWrapper.class);
assertEquals(wrapper, newWrapper);
}
Aggregations