Search in sources :

Example 11 with ScanningException

use of org.eclipse.scanning.api.scan.ScanningException in project gda-core by openGDA.

the class ZebraRunnableDevice method run.

@Override
public void run(IPosition position) throws ScanningException, InterruptedException {
    try {
        // Reset
        EPICS_CONTROLLER.caputWait(resetChannel, 1);
        // Arm
        EPICS_CONTROLLER.caput(armChannel, 1);
        while (EPICS_CONTROLLER.cagetInt(armOutChannel) != 0) {
            Thread.sleep(50);
        }
    } catch (CAException | TimeoutException e) {
        final String message = "Error collecting data";
        logger.error(message, e);
        throw new ScanningException(message, e);
    }
}
Also used : CAException(gov.aps.jca.CAException) ScanningException(org.eclipse.scanning.api.scan.ScanningException) TimeoutException(gov.aps.jca.TimeoutException)

Example 12 with ScanningException

use of org.eclipse.scanning.api.scan.ScanningException in project gda-core by openGDA.

the class ZebraRunnableDevice method configure.

@Override
public void configure(ZebraModel model) throws ScanningException {
    if (StringUtils.isEmpty(basePv)) {
        final String message = "Base PV not set";
        logger.error(message);
        throw new ScanningException(message);
    }
    // Create Epics channels
    try {
        resetChannel = EPICS_CONTROLLER.createChannel(basePv + "SYS_RESET.PROC");
        armChannel = EPICS_CONTROLLER.createChannel(basePv + "PC_ARM");
        armOutChannel = EPICS_CONTROLLER.createChannel(basePv + "PC_ARM_OUT");
        gateWidthChannel = EPICS_CONTROLLER.createChannel(basePv + "PC_GATE_WID");
        pulseDelayChannel = EPICS_CONTROLLER.createChannel(basePv + "PC_PULSE_DLY");
        div1LastChannel = EPICS_CONTROLLER.createChannel(basePv + "PC_DIV1_LAST");
        div2LastChannel = EPICS_CONTROLLER.createChannel(basePv + "PC_DIV2_LAST");
        div3LastChannel = EPICS_CONTROLLER.createChannel(basePv + "PC_DIV3_LAST");
        div4LastChannel = EPICS_CONTROLLER.createChannel(basePv + "PC_DIV4_LAST");
    } catch (CAException | TimeoutException e) {
        final String message = "Error creating EPICS channel";
        logger.error(message, e);
        throw new ScanningException(message, e);
    }
    // Setup exposure time
    try {
        EPICS_CONTROLLER.caputWait(gateWidthChannel, model.getExposureTime());
        EPICS_CONTROLLER.caputWait(pulseDelayChannel, model.getExposureTime());
    } catch (TimeoutException | CAException | InterruptedException e) {
        final String message = "Error setting exposure time";
        logger.error(message, e);
        throw new ScanningException(message, e);
    }
    super.configure(model);
}
Also used : CAException(gov.aps.jca.CAException) ScanningException(org.eclipse.scanning.api.scan.ScanningException) TimeoutException(gov.aps.jca.TimeoutException)

Example 13 with ScanningException

use of org.eclipse.scanning.api.scan.ScanningException in project gda-core by openGDA.

the class AreaDetectorRunnableDevice method scanEnd.

/**
 * add call to {@link ADDetector#atScanEnd()} so decorators in collection strategy work to restore detector state.
 */
@Override
@ScanEnd
public void scanEnd(ScanInformation info) throws ScanningException {
    super.scanEnd(info);
    try {
        adDetector.atScanEnd();
        firstPointInScan = false;
    } catch (DeviceException e) {
        throw new ScanningException("Error calling atScanEnd", e);
    }
}
Also used : ScanningException(org.eclipse.scanning.api.scan.ScanningException) DeviceException(gda.device.DeviceException) ScanEnd(org.eclipse.scanning.api.annotation.scan.ScanEnd)

Example 14 with ScanningException

use of org.eclipse.scanning.api.scan.ScanningException in project gda-core by openGDA.

the class TimeSeriesScanView method createView.

@PostConstruct
public void createView(Composite parent, MPart part) {
    parent.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    parent.setBackgroundMode(SWT.INHERIT_DEFAULT);
    viewComposite = new Composite(parent, SWT.NONE);
    GridLayoutFactory.fillDefaults().applyTo(viewComposite);
    try {
        final List<DeviceInformation<?>> malcolmDeviceInfos = getMalcolmDeviceInfos();
        if (malcolmDeviceInfos.isEmpty()) {
            // no malcolm devices, show an error label
            createErrorLabel(viewComposite, "No malcolm devices found");
        } else {
            // normal case, show the view controls
            createViewControls(viewComposite, part, malcolmDeviceInfos);
        }
    } catch (ScanningException e) {
        logger.error("Could not get malcolm devices", e);
        createErrorLabel(parent, "Could not get malcolm devices.");
    }
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ScanningException(org.eclipse.scanning.api.scan.ScanningException) DeviceInformation(org.eclipse.scanning.api.event.scan.DeviceInformation) PostConstruct(javax.annotation.PostConstruct)

Example 15 with ScanningException

use of org.eclipse.scanning.api.scan.ScanningException in project gda-core by openGDA.

the class MappingTriggerProcessor method process.

@Override
public IdBean process(Triggerable triggerable) {
    TriggerableMap map = (TriggerableMap) triggerable;
    ScanBean scanBean = map.trigger();
    try {
        URL url = SpringApplicationContextFacade.getBean(ExperimentController.class).prepareAcquisition(map.getName());
        scanBean.getScanRequest().setFilePath(url.getFile());
    } catch (ExperimentControllerException e) {
        logger.error("Error getting URL for triggered scan - data will not reflect experiment structure", e);
    }
    try {
        if (map.isImportant()) {
            scanSubmitter.submitImportantScan(scanBean);
        } else {
            scanSubmitter.submitScan(scanBean);
        }
    } catch (ScanningException | EventException e) {
        logger.error("Could not submit scan", e);
    }
    return scanBean;
}
Also used : TriggerableMap(uk.ac.diamond.daq.experiment.scans.mapping.TriggerableMap) ExperimentControllerException(uk.ac.diamond.daq.experiment.api.structure.ExperimentControllerException) ScanBean(org.eclipse.scanning.api.event.scan.ScanBean) EventException(org.eclipse.scanning.api.event.EventException) ScanningException(org.eclipse.scanning.api.scan.ScanningException) ExperimentController(uk.ac.diamond.daq.experiment.api.structure.ExperimentController) URL(java.net.URL)

Aggregations

ScanningException (org.eclipse.scanning.api.scan.ScanningException)41 DeviceException (gda.device.DeviceException)13 NexusException (org.eclipse.dawnsci.nexus.NexusException)7 IMalcolmModel (org.eclipse.scanning.api.device.models.IMalcolmModel)4 EventException (org.eclipse.scanning.api.event.EventException)4 Scannable (gda.device.Scannable)3 CAException (gov.aps.jca.CAException)3 TimeoutException (gov.aps.jca.TimeoutException)3 DatasetException (org.eclipse.january.DatasetException)3 Dataset (org.eclipse.january.dataset.Dataset)3 ILazyWriteableDataset (org.eclipse.january.dataset.ILazyWriteableDataset)3 SliceND (org.eclipse.january.dataset.SliceND)3 IScanSlice (org.eclipse.scanning.api.scan.rank.IScanSlice)3 Composite (org.eclipse.swt.widgets.Composite)3 File (java.io.File)2 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 AbstractScannable (org.eclipse.scanning.api.AbstractScannable)2