use of org.eclipse.scanning.api.points.models.IScanPathModel in project gda-core by openGDA.
the class ScanpathTest method createModelCreatesCorrectModelForGridWithRandomOffsetMutator.
@Test
public void createModelCreatesCorrectModelForGridWithRandomOffsetMutator() throws Exception {
pathParams = Arrays.asList(5, 6);
mutators.put(Mutator.RANDOM_OFFSET, Arrays.asList(20, 2));
mutators.put(Mutator.CONTINUOUS, Arrays.asList(blankArray));
IScanPathModel model = GRID_POINTS.createModel(scannables, pathParams, bboxParams, mutators);
assertThat(model, is(instanceOf(TwoAxisGridPointsRandomOffsetModel.class)));
TwoAxisGridPointsRandomOffsetModel gModel = (TwoAxisGridPointsRandomOffsetModel) model;
assertThat(gModel.getScannableNames(), contains("name1", "name2"));
assertThat(gModel.getBoundingBox().getxAxisStart(), is(1.0));
assertThat(gModel.getBoundingBox().getyAxisStart(), is(2.0));
assertThat(gModel.getBoundingBox().getxAxisLength(), is(3.0));
assertThat(gModel.getBoundingBox().getyAxisLength(), is(4.0));
assertThat(gModel.getxAxisPoints(), is(5));
assertThat(gModel.getyAxisPoints(), is(6));
assertThat(gModel.getBoundingBox().getyAxisStart(), is(2.0));
assertThat(gModel.getOffset(), is(20.0));
assertThat(gModel.getSeed(), is(2));
assertThat(gModel.isAlternating(), is(false));
assertThat(gModel.isContinuous(), is(true));
assertThat(gModel.getOrientation(), is(Orientation.HORIZONTAL));
}
use of org.eclipse.scanning.api.points.models.IScanPathModel in project gda-core by openGDA.
the class ScanpathTest method createModelCreatesCorrectModelForRaster.
@Test
public void createModelCreatesCorrectModelForRaster() throws Exception {
pathParams = Arrays.asList(0.5, 6.5);
mutators.put(Mutator.ALTERNATING, new ArrayList<>());
IScanPathModel model = GRID_STEP.createModel(scannables, pathParams, bboxParams, mutators);
assertThat(model, is(instanceOf(TwoAxisGridStepModel.class)));
TwoAxisGridStepModel rModel = (TwoAxisGridStepModel) model;
assertThat(rModel.getScannableNames(), contains("name1", "name2"));
assertThat(rModel.getBoundingBox().getxAxisStart(), is(1.0));
assertThat(rModel.getBoundingBox().getyAxisStart(), is(2.0));
assertThat(rModel.getBoundingBox().getxAxisLength(), is(3.0));
assertThat(rModel.getBoundingBox().getyAxisLength(), is(4.0));
assertThat(rModel.getxAxisStep(), is(0.5));
assertThat(rModel.getyAxisStep(), is(6.5));
assertThat(rModel.getBoundingBox().getyAxisStart(), is(2.0));
assertThat(rModel.isAlternating(), is(true));
assertThat(rModel.isContinuous(), is(false));
assertThat(rModel.getOrientation(), is(Orientation.HORIZONTAL));
}
use of org.eclipse.scanning.api.points.models.IScanPathModel in project gda-core by openGDA.
the class ScanpathTest method createModelCreatesCorrectModelForTwoDEqualSpacing.
@Test
public void createModelCreatesCorrectModelForTwoDEqualSpacing() throws Exception {
pathParams = Arrays.asList(5);
mutators.put(Mutator.CONTINUOUS, Arrays.asList(blankArray));
IScanPathModel model = LINE_POINTS.createModel(scannables, pathParams, bboxParams, mutators);
assertThat(model, is(instanceOf(TwoAxisLinePointsModel.class)));
TwoAxisLinePointsModel eModel = (TwoAxisLinePointsModel) model;
assertThat(eModel.getScannableNames(), contains("name1", "name2"));
assertThat(eModel.getBoundingLine().getxStart(), is(1.0));
assertThat(eModel.getBoundingLine().getyStart(), is(2.0));
assertThat(eModel.getBoundingLine().getLength(), is(5.0));
assertThat(Math.rint(Math.toDegrees(eModel.getBoundingLine().getAngle())), is(53.0));
assertThat(eModel.getPoints(), is(5));
assertThat(eModel.isContinuous(), is(true));
}
use of org.eclipse.scanning.api.points.models.IScanPathModel in project gda-core by openGDA.
the class ScanpathTest method createModelCreatesCorrectModelForAxialArray.
@Test
public void createModelCreatesCorrectModelForAxialArray() throws Exception {
pathParams = Arrays.asList(0.5, 1, 0.7, -0.135);
mutators.put(Mutator.CONTINUOUS, Arrays.asList(blankArray));
IScanPathModel model = AXIS_ARRAY.createModel(axialScannables, pathParams, Arrays.asList(blankArray), mutators);
assertThat(model, is(instanceOf(AxialArrayModel.class)));
AxialArrayModel sModel = (AxialArrayModel) model;
assertThat(sModel.getScannableNames(), contains("name1"));
assertThat(sModel.getPositions()[0], is(0.5));
assertThat(sModel.getPositions()[1], is(1.0));
assertThat(sModel.getPositions()[2], is(0.7));
assertThat(sModel.getPositions()[3], is(-0.135));
assertThat(sModel.isContinuous(), is(true));
assertThat(sModel.isAlternating(), is(false));
assertThat(sModel.getUnits(), is(equalTo(List.of("Deg"))));
}
use of org.eclipse.scanning.api.points.models.IScanPathModel in project gda-core by openGDA.
the class ScanpathTest method createModelCreatesCorrectModelForGridWithVerticalMutator.
@Test
public void createModelCreatesCorrectModelForGridWithVerticalMutator() throws Exception {
pathParams = Arrays.asList(5, 6);
mutators.put(Mutator.VERTICAL, Arrays.asList(blankArray));
mutators.put(Mutator.ALTERNATING, Arrays.asList(blankArray));
IScanPathModel model = GRID_POINTS.createModel(scannables, pathParams, bboxParams, mutators);
assertThat(model, is(instanceOf(TwoAxisGridPointsModel.class)));
TwoAxisGridPointsModel gModel = (TwoAxisGridPointsModel) model;
assertThat(gModel.getScannableNames(), contains("name1", "name2"));
assertThat(gModel.getBoundingBox().getxAxisStart(), is(1.0));
assertThat(gModel.getBoundingBox().getyAxisStart(), is(2.0));
assertThat(gModel.getBoundingBox().getxAxisLength(), is(3.0));
assertThat(gModel.getBoundingBox().getyAxisLength(), is(4.0));
assertThat(gModel.getxAxisPoints(), is(5));
assertThat(gModel.getyAxisPoints(), is(6));
assertThat(gModel.getBoundingBox().getyAxisStart(), is(2.0));
assertThat(gModel.getOrientation(), is(Orientation.VERTICAL));
assertThat(gModel.isAlternating(), is(true));
assertThat(gModel.isContinuous(), is(false));
}
Aggregations