def test_run_get_array_error(mock_fxe_run): run = RunDirectory(mock_fxe_run) with pytest.raises(SourceNameError): run.get_array('bad_name', 'data.intensityTD') with pytest.raises(PropertyNameError): run.get_array('SA1_XTD2_XGM/DOOCS/MAIN:output', 'bad_name')
def test_run_get_array_empty(mock_fxe_run): run = RunDirectory(mock_fxe_run) arr = run.get_array('FXE_XAD_GEC/CAM/CAMERA_NODATA:daqOutput', 'data.image.pixels') assert isinstance(arr, DataArray) assert arr.dims[0] == 'trainId' assert arr.shape == (0, 255, 1024)
def test_run_get_array(mock_fxe_run): run = RunDirectory(mock_fxe_run) arr = run.get_array('SA1_XTD2_XGM/DOOCS/MAIN:output', 'data.intensityTD', extra_dims=['pulse']) assert isinstance(arr, DataArray) assert arr.dims == ('trainId', 'pulse') assert arr.shape == (480, 1000) assert arr.coords['trainId'][0] == 10000
def get_run_from_karabo(run_index): run = RunDirectory(os.path.join(base_dir, 'r{:04d}'.format(run_index))) data = run.get_array(instrument_source, instrument_key) return data