Search in sources :

Example 41 with ScanRequest

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);
    }
}
Also used : IMarshallerService(org.eclipse.dawnsci.analysis.api.persistence.IMarshallerService) ScanRequest(org.eclipse.scanning.api.event.scan.ScanRequest) TomographyCalibrationData(uk.ac.diamond.daq.mapping.api.TomographyCalibrationData) IScriptService(org.eclipse.scanning.api.script.IScriptService) TomographyParams(uk.ac.diamond.daq.mapping.api.TomographyParams) DeviceException(gda.device.DeviceException) IOException(java.io.IOException) JythonServerFacade(gda.jython.JythonServerFacade)

Example 42 with ScanRequest

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;
}
Also used : ScanRequest(org.eclipse.scanning.api.event.scan.ScanRequest) ScanRegion(org.eclipse.scanning.api.points.models.ScanRegion) IDetectorModel(org.eclipse.scanning.api.device.models.IDetectorModel) IMapPathModel(org.eclipse.scanning.api.points.models.IMapPathModel) CompoundModel(org.eclipse.scanning.api.points.models.CompoundModel) HashMap(java.util.HashMap) ILineMappingRegion(uk.ac.diamond.daq.mapping.api.ILineMappingRegion) AxialStepModel(org.eclipse.scanning.api.points.models.AxialStepModel)

Aggregations

ScanRequest (org.eclipse.scanning.api.event.scan.ScanRequest)42 Test (org.junit.Test)25 IDetectorModel (org.eclipse.scanning.api.device.models.IDetectorModel)8 ScanBean (org.eclipse.scanning.api.event.scan.ScanBean)8 CompoundModel (org.eclipse.scanning.api.points.models.CompoundModel)8 IScanPointGeneratorModel (org.eclipse.scanning.api.points.models.IScanPointGeneratorModel)8 ArrayList (java.util.ArrayList)7 ProcessingRequest (org.eclipse.scanning.api.event.scan.ProcessingRequest)7 IScanModelWrapper (uk.ac.diamond.daq.mapping.api.IScanModelWrapper)7 IMarshallerService (org.eclipse.dawnsci.analysis.api.persistence.IMarshallerService)5 ScanRegion (org.eclipse.scanning.api.points.models.ScanRegion)5 IScriptService (org.eclipse.scanning.api.script.IScriptService)5 IMappingExperimentBean (uk.ac.diamond.daq.mapping.api.IMappingExperimentBean)5 HashMap (java.util.HashMap)4 AxialStepModel (org.eclipse.scanning.api.points.models.AxialStepModel)4 IMappingScanRegion (uk.ac.diamond.daq.mapping.api.IMappingScanRegion)4 TemplateFileWrapper (uk.ac.diamond.daq.mapping.api.TemplateFileWrapper)4 DetectorModelWrapper (uk.ac.diamond.daq.mapping.impl.DetectorModelWrapper)4 IMalcolmModel (org.eclipse.scanning.api.device.models.IMalcolmModel)3 IMapPathModel (org.eclipse.scanning.api.points.models.IMapPathModel)3