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"));
}
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);
}
}
Aggregations