Search in sources :

Example 1 with TwoAxisGridPointsRandomOffsetModel

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

the class TwoAxisGridPointsModelDocument method createRandomModel.

private TwoAxisGridPointsModel createRandomModel() {
    TwoAxisGridPointsRandomOffsetModel model = new TwoAxisGridPointsRandomOffsetModel();
    List<Number> params = getScanpathDocument().getMutators().get(RANDOM_OFFSET);
    model.setOffset(params.get(AcquisitionTemplateFactory.OFFSET_INDEX).doubleValue());
    if (params.size() > 1) {
        model.setSeed(getScanpathDocument().getMutators().get(RANDOM_OFFSET).get(AcquisitionTemplateFactory.SEED_INDEX).intValue());
    }
    return model;
}
Also used : TwoAxisGridPointsRandomOffsetModel(org.eclipse.scanning.api.points.models.TwoAxisGridPointsRandomOffsetModel)

Example 2 with TwoAxisGridPointsRandomOffsetModel

use of org.eclipse.scanning.api.points.models.TwoAxisGridPointsRandomOffsetModel 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)

Aggregations

TwoAxisGridPointsRandomOffsetModel (org.eclipse.scanning.api.points.models.TwoAxisGridPointsRandomOffsetModel)2 IScanPathModel (org.eclipse.scanning.api.points.models.IScanPathModel)1 Test (org.junit.Test)1