Search in sources :

Example 6 with IScriptService

use of org.eclipse.scanning.api.script.IScriptService 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)

Aggregations

IMarshallerService (org.eclipse.dawnsci.analysis.api.persistence.IMarshallerService)6 IScriptService (org.eclipse.scanning.api.script.IScriptService)6 ScanRequest (org.eclipse.scanning.api.event.scan.ScanRequest)5 JythonServerFacade (gda.jython.JythonServerFacade)2 TomographyCalibrationData (uk.ac.diamond.daq.mapping.api.TomographyCalibrationData)2 TomographyParams (uk.ac.diamond.daq.mapping.api.TomographyParams)2 DeviceException (gda.device.DeviceException)1 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 EventException (org.eclipse.scanning.api.event.EventException)1 CompoundModel (org.eclipse.scanning.api.points.models.CompoundModel)1 IScanPointGeneratorModel (org.eclipse.scanning.api.points.models.IScanPointGeneratorModel)1 ScanMetadata (org.eclipse.scanning.api.scan.models.ScanMetadata)1 IMappingExperimentBean (uk.ac.diamond.daq.mapping.api.IMappingExperimentBean)1 PtychographyParams (uk.ac.diamond.daq.mapping.api.PtychographyParams)1 StandardsScanParams (uk.ac.diamond.daq.mapping.api.StandardsScanParams)1 XanesEdgeParameters (uk.ac.diamond.daq.mapping.api.XanesEdgeParameters)1 LinesToTrackEntry (uk.ac.diamond.daq.mapping.api.XanesEdgeParameters.LinesToTrackEntry)1