Search in sources :

Example 1 with TomographyParams

use of uk.ac.diamond.daq.mapping.api.TomographyParams in project gda-core by openGDA.

the class TomographySubmitScanSection method submitScan.

@Override
protected void submitScan() {
    // Read parameters from file
    try (BufferedReader reader = Files.newBufferedReader(CALIBRATION_FILE_PATH)) {
        final IScriptService scriptService = getService(IScriptService.class);
        final IMarshallerService marshallerService = getService(IMarshallerService.class);
        final IMappingExperimentBean mappingBean = getMappingBean();
        final TomographyCalibrationData calibrationParams = marshallerService.unmarshal(reader.readLine(), TomographyCalibrationData.class);
        final ScanRequest scanRequest = getScanRequest(mappingBean);
        final TomographyParams tomoParams = new TomographyParams();
        tomoParams.setTomographyCalibration(calibrationParams);
        tomoParams.setProcessingFiles(getProcessingFilesAs(mappingBean));
        tomoParams.setVisitId(InterfaceProvider.getBatonStateProvider().getBatonHolder().getVisitID());
        populateScriptService(scriptService, marshallerService, scanRequest, tomoParams);
    } catch (Exception e) {
        handleException(getClientMessage(TOMO_CALIBRATE_SUBMIT_ERROR), e);
        return;
    }
    Async.execute(() -> runScript(tomoScanScript, "tomography scanning script"));
}
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) BufferedReader(java.io.BufferedReader) IScriptService(org.eclipse.scanning.api.script.IScriptService) TomographyParams(uk.ac.diamond.daq.mapping.api.TomographyParams) IMappingExperimentBean(uk.ac.diamond.daq.mapping.api.IMappingExperimentBean)

Example 2 with TomographyParams

use of uk.ac.diamond.daq.mapping.api.TomographyParams 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)2 ScanRequest (org.eclipse.scanning.api.event.scan.ScanRequest)2 IScriptService (org.eclipse.scanning.api.script.IScriptService)2 TomographyCalibrationData (uk.ac.diamond.daq.mapping.api.TomographyCalibrationData)2 TomographyParams (uk.ac.diamond.daq.mapping.api.TomographyParams)2 DeviceException (gda.device.DeviceException)1 JythonServerFacade (gda.jython.JythonServerFacade)1 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 IMappingExperimentBean (uk.ac.diamond.daq.mapping.api.IMappingExperimentBean)1