use of org.eclipse.scanning.api.event.scan.ScanRequest in project gda-core by openGDA.
the class TomographyConfigurationDialog method performDryRun.
private void performDryRun() {
try {
// Put calibration data etc. into script context
final IScriptService scriptService = getService(IScriptService.class);
final IMarshallerService marshallerService = getService(IMarshallerService.class);
final ScanRequest scanRequest = getScanRequest(mappingView.getBean());
final TomographyParams tomoParams = new TomographyParams();
tomoParams.setTomographyCalibration(new TomographyCalibrationData(xCalibration, zCalibration));
populateScriptService(scriptService, marshallerService, scanRequest, tomoParams);
// Run script
final JythonServerFacade jythonServerFacade = JythonServerFacade.getInstance();
setDryRunEnabled(false);
logger.info("Running tomography scan");
jythonServerFacade.runScript(tomoScript);
while (jythonServerFacade.getScriptStatus() == RUNNING) {
Thread.sleep(500);
}
logger.info("Finished running tomography scan");
} catch (Exception e) {
logger.error("Error running tomography scan", e);
} finally {
setDryRunEnabled(true);
}
}
use of org.eclipse.scanning.api.event.scan.ScanRequest in project gda-core by openGDA.
the class FocusScanConverter method convertToScanRequest.
public ScanRequest convertToScanRequest(FocusScanBean focusScanBean) {
logger.debug("Converting focusScanBean to scan request");
final ScanRequest scanRequest = new ScanRequest();
final IMapPathModel lineModel = createLineModel(focusScanBean);
final ILineMappingRegion lineRegion = focusScanBean.getLineRegion();
final ScanRegion scanRegion = new ScanRegion(lineRegion.toROI(), lineModel.getxAxisName(), lineModel.getyAxisName());
final AxialStepModel focusModel = createFocusPathModel(focusScanBean);
final CompoundModel compoundModel = new CompoundModel(Arrays.asList(focusModel, lineModel));
compoundModel.setRegions(Arrays.asList(scanRegion));
scanRequest.setCompoundModel(compoundModel);
// add detectors
final IDetectorModel detectorModel = focusScanBean.getDetector();
final Map<String, IDetectorModel> detectorsMap = new HashMap<>();
detectorsMap.put(detectorModel.getName(), detectorModel);
scanRequest.setDetectors(detectorsMap);
return scanRequest;
}
Aggregations