Search in sources :

Example 1 with IScanPathModel

use of org.eclipse.scanning.api.points.models.IScanPathModel in project gda-core by openGDA.

the class ScanpathTest method createModelCreatesCorrectModelForRasterWithVerticalMutator.

@Test
public void createModelCreatesCorrectModelForRasterWithVerticalMutator() throws Exception {
    pathParams = Arrays.asList(0.5, 6.5);
    mutators.put(Mutator.VERTICAL, Arrays.asList(blankArray));
    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(false));
    assertThat(rModel.isContinuous(), is(false));
    assertThat(rModel.getOrientation(), is(Orientation.VERTICAL));
}
Also used : TwoAxisGridStepModel(org.eclipse.scanning.api.points.models.TwoAxisGridStepModel) IScanPathModel(org.eclipse.scanning.api.points.models.IScanPathModel) Test(org.junit.Test)

Example 2 with IScanPathModel

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

Example 3 with IScanPathModel

use of org.eclipse.scanning.api.points.models.IScanPathModel in project gda-core by openGDA.

the class ScanpathTest method createModelCreatesCorrectModelForOneDEqualSpacing.

@Test
public void createModelCreatesCorrectModelForOneDEqualSpacing() throws Exception {
    pathParams = Arrays.asList(-2, 2, 5);
    IScanPathModel model = AXIS_POINTS.createModel(axialScannables, pathParams, bboxParams, mutators);
    assertThat(model, is(instanceOf(AxialPointsModel.class)));
    AxialPointsModel eModel = (AxialPointsModel) model;
    assertThat(eModel.getScannableNames(), contains("name1"));
    assertThat(eModel.getStart(), is(-2.0));
    assertThat(eModel.getStop(), is(2.0));
    assertThat(eModel.getPoints(), is(5));
}
Also used : AxialPointsModel(org.eclipse.scanning.api.points.models.AxialPointsModel) IScanPathModel(org.eclipse.scanning.api.points.models.IScanPathModel) Test(org.junit.Test)

Example 4 with IScanPathModel

use of org.eclipse.scanning.api.points.models.IScanPathModel in project gda-core by openGDA.

the class ScanpathTest method createModelCreatesCorrectModelForTwoDStep.

@Test
public void createModelCreatesCorrectModelForTwoDStep() throws Exception {
    pathParams = Arrays.asList(0.5);
    IScanPathModel model = LINE_STEP.createModel(scannables, pathParams, blineParams, mutators);
    assertThat(model, is(instanceOf(TwoAxisLineStepModel.class)));
    TwoAxisLineStepModel sModel = (TwoAxisLineStepModel) model;
    assertThat(sModel.getScannableNames(), contains("name1", "name2"));
    assertThat(sModel.getBoundingLine().getxStart(), is(1.0));
    assertThat(sModel.getBoundingLine().getyStart(), is(2.0));
    assertThat(sModel.getBoundingLine().getLength(), is(5.0));
    assertThat(Math.rint(Math.toDegrees(sModel.getBoundingLine().getAngle())), is(53.0));
    assertThat(sModel.getStep(), is(0.5));
    assertThat(sModel.isContinuous(), is(false));
    assertThat(sModel.getUnits(), is(equalTo(List.of("Deg", "mm"))));
}
Also used : TwoAxisLineStepModel(org.eclipse.scanning.api.points.models.TwoAxisLineStepModel) IScanPathModel(org.eclipse.scanning.api.points.models.IScanPathModel) Test(org.junit.Test)

Example 5 with IScanPathModel

use of org.eclipse.scanning.api.points.models.IScanPathModel in project gda-core by openGDA.

the class ScanpathTest method createModelsCorrectModelForLissajous.

@Test
public void createModelsCorrectModelForLissajous() throws Exception {
    pathParams = Arrays.asList(5, 6.0, 7.0);
    IScanPathModel model = LISSAJOUS.createModel(scannables, pathParams, bboxParams, mutators);
    assertThat(model, is(instanceOf(TwoAxisLissajousModel.class)));
    TwoAxisLissajousModel lModel = (TwoAxisLissajousModel) model;
    assertThat(lModel.getScannableNames(), contains("name1", "name2"));
    assertThat(lModel.getBoundingBox().getxAxisStart(), is(1.0));
    assertThat(lModel.getBoundingBox().getyAxisStart(), is(2.0));
    assertThat(lModel.getBoundingBox().getxAxisLength(), is(3.0));
    assertThat(lModel.getBoundingBox().getyAxisLength(), is(4.0));
    assertThat(lModel.getPoints(), is(5));
    assertThat(lModel.getA(), is(6.0));
    assertThat(lModel.getB(), is(7.0));
    assertThat(lModel.getBoundingBox().getyAxisStart(), is(2.0));
    assertThat(lModel.isContinuous(), is(false));
}
Also used : TwoAxisLissajousModel(org.eclipse.scanning.api.points.models.TwoAxisLissajousModel) 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