Search in sources :

Example 6 with IScanPathModel

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));
}
Also used : TwoAxisGridPointsRandomOffsetModel(org.eclipse.scanning.api.points.models.TwoAxisGridPointsRandomOffsetModel) IScanPathModel(org.eclipse.scanning.api.points.models.IScanPathModel) Test(org.junit.Test)

Example 7 with IScanPathModel

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));
}
Also used : TwoAxisGridStepModel(org.eclipse.scanning.api.points.models.TwoAxisGridStepModel) IScanPathModel(org.eclipse.scanning.api.points.models.IScanPathModel) Test(org.junit.Test)

Example 8 with IScanPathModel

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));
}
Also used : TwoAxisLinePointsModel(org.eclipse.scanning.api.points.models.TwoAxisLinePointsModel) IScanPathModel(org.eclipse.scanning.api.points.models.IScanPathModel) Test(org.junit.Test)

Example 9 with IScanPathModel

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"))));
}
Also used : IScanPathModel(org.eclipse.scanning.api.points.models.IScanPathModel) AxialArrayModel(org.eclipse.scanning.api.points.models.AxialArrayModel) Test(org.junit.Test)

Example 10 with IScanPathModel

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));
}
Also used : TwoAxisGridPointsModel(org.eclipse.scanning.api.points.models.TwoAxisGridPointsModel) IScanPathModel(org.eclipse.scanning.api.points.models.IScanPathModel) Test(org.junit.Test)

Aggregations

IScanPathModel (org.eclipse.scanning.api.points.models.IScanPathModel)16 Test (org.junit.Test)13 IMappingScanRegionShape (uk.ac.diamond.daq.mapping.api.IMappingScanRegionShape)3 TwoAxisGridPointsModel (org.eclipse.scanning.api.points.models.TwoAxisGridPointsModel)2 TwoAxisGridStepModel (org.eclipse.scanning.api.points.models.TwoAxisGridStepModel)2 GridDataFactory (org.eclipse.jface.layout.GridDataFactory)1 ComboViewer (org.eclipse.jface.viewers.ComboViewer)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 LabelProvider (org.eclipse.jface.viewers.LabelProvider)1 AxialArrayModel (org.eclipse.scanning.api.points.models.AxialArrayModel)1 AxialPointsModel (org.eclipse.scanning.api.points.models.AxialPointsModel)1 AxialStepModel (org.eclipse.scanning.api.points.models.AxialStepModel)1 IScanPointGeneratorModel (org.eclipse.scanning.api.points.models.IScanPointGeneratorModel)1 TwoAxisGridPointsRandomOffsetModel (org.eclipse.scanning.api.points.models.TwoAxisGridPointsRandomOffsetModel)1 TwoAxisLinePointsModel (org.eclipse.scanning.api.points.models.TwoAxisLinePointsModel)1 TwoAxisLineStepModel (org.eclipse.scanning.api.points.models.TwoAxisLineStepModel)1 TwoAxisLissajousModel (org.eclipse.scanning.api.points.models.TwoAxisLissajousModel)1 TwoAxisPointSingleModel (org.eclipse.scanning.api.points.models.TwoAxisPointSingleModel)1 TwoAxisSpiralModel (org.eclipse.scanning.api.points.models.TwoAxisSpiralModel)1 Image (org.eclipse.swt.graphics.Image)1