Build Packages / Unit tests (push) Skipped
Build Packages / build:windows:nocuda (push) Successful in 15m31s
Build Packages / build:viewer-tgz:cpu (push) Successful in 5m46s
Build Packages / build:viewer-tgz:cuda (push) Successful in 6m9s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 9m25s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 10m21s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 9m41s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 9m18s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 10m26s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 11m33s
Build Packages / build:rpm (rocky8) (push) Successful in 10m32s
Build Packages / build:rpm (rocky9) (push) Successful in 12m23s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 10m50s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 10m12s
Build Packages / DIALS test (push) Successful in 12m6s
Build Packages / XDS test (durin plugin) (push) Successful in 8m15s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 7m12s
Build Packages / XDS test (neggia plugin) (push) Successful in 5m35s
Build Packages / Generate python client (push) Successful in 27s
Build Packages / Build documentation (push) Successful in 54s
Build Packages / Create release (push) Skipped
Build Packages / build:windows:cuda (push) Successful in 12m37s
This is an UNSTABLE release. It includes many experimental features, as well as many AI generated fixes. We recommend using rc.152 for production use. * jfjoch_process: Major rotation (rot3d) data processing overhaul - robust profile-fit integration, Cauchy-loss scaling with optional absorption surface, de-novo indexing and space-group/centering determination fixes, and merging statistics + ISa in the mmCIF output. * jfjoch_process: Add EXPERIMENTAL ice-ring detection (--detect-ice-rings) that excludes ice reflections from scaling. * Compression: Add BSHUF_ZSTD_RLE_HUFF, make compression size-aware (drop frames that don't fit rather than aborting), and add the jfjoch_recompress tool. * jfjoch_viewer: Report "Multiple lattices detected" and grey out "Analyze dataset" on a live connection. * jfjoch_broker: Write smargon chi/phi goniometer positions to NXmx; read sensor thickness/material from HDF5 metadata. * CI: Build Windows (CUDA and non-CUDA) installers.Reviewed-on: #66 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
1358 lines
56 KiB
TypeScript
1358 lines
56 KiB
TypeScript
// This file is auto-generated by @hey-api/openapi-ts
|
|
|
|
import { type DefaultError, queryOptions, type UseMutationOptions } from '@tanstack/react-query';
|
|
|
|
import { client } from '../client.gen';
|
|
import { getConfigAzimInt, getConfigBraggIntegration, getConfigDarkMask, getConfigDetector, getConfigFileWriter, getConfigImageFormat, getConfigIndexing, getConfigInstrument, getConfigMask, getConfigMaskTiff, getConfigRoi, getConfigSelectDetector, getConfigSpotFinding, getConfigUserMask, getConfigUserMaskTiff, getConfigZeromqMetadata, getConfigZeromqPreview, getDetectorStatus, getFpgaStatus, getImageBufferImageCbor, getImageBufferImageJpeg, getImageBufferImageTiff, getImageBufferStartCbor, getImageBufferStatus, getImagePusherStatus, getPreviewPedestalTiff, getPreviewPlot, getPreviewPlotBin, getResultScan, getStatistics, getStatisticsCalibration, getStatisticsDataCollection, getStatus, getVersion, getXfelEventCode, getXfelPulseId, type Options, postCancel, postConfigImageFormatConversion, postConfigImageFormatRaw, postDeactivate, postImageBufferClear, postInitialize, postPedestal, postStart, postTrigger, postWaitTillDone, postWaitUntilRunning, putConfigAzimInt, putConfigBraggIntegration, putConfigDarkMask, putConfigDetector, putConfigFileWriter, putConfigImageFormat, putConfigIndexing, putConfigInstrument, putConfigInternalGeneratorImage, putConfigInternalGeneratorImageTiff, putConfigRoi, putConfigSelectDetector, putConfigSpotFinding, putConfigUserMask, putConfigUserMaskTiff, putConfigZeromqMetadata, putConfigZeromqPreview } from '../sdk.gen';
|
|
import type { getConfigAzimIntData, getConfigAzimIntResponse, getConfigBraggIntegrationData, getConfigBraggIntegrationResponse, getConfigDarkMaskData, getConfigDarkMaskResponse, getConfigDetectorData, getConfigDetectorResponse, getConfigFileWriterData, getConfigFileWriterResponse, getConfigImageFormatData, getConfigImageFormatResponse, getConfigIndexingData, getConfigIndexingResponse, getConfigInstrumentData, getConfigInstrumentResponse, getConfigMaskData, getConfigMaskResponse, getConfigMaskTiffData, getConfigMaskTiffResponse, getConfigRoiData, getConfigRoiResponse, getConfigSelectDetectorData, getConfigSelectDetectorResponse, getConfigSpotFindingData, getConfigSpotFindingResponse, getConfigUserMaskData, getConfigUserMaskResponse, getConfigUserMaskTiffData, getConfigUserMaskTiffResponse, getConfigZeromqMetadataData, getConfigZeromqMetadataResponse, getConfigZeromqPreviewData, getConfigZeromqPreviewResponse, getDetectorStatusData, getDetectorStatusError, getDetectorStatusResponse, getFpgaStatusData, getFpgaStatusResponse, getImageBufferImageCborData, getImageBufferImageCborError, getImageBufferImageCborResponse, getImageBufferImageJpegData, getImageBufferImageJpegError, getImageBufferImageJpegResponse, getImageBufferImageTiffData, getImageBufferImageTiffResponse, getImageBufferStartCborData, getImageBufferStartCborError, getImageBufferStartCborResponse, getImageBufferStatusData, getImageBufferStatusError, getImageBufferStatusResponse, getImagePusherStatusData, getImagePusherStatusError, getImagePusherStatusResponse, getPreviewPedestalTiffData, getPreviewPedestalTiffResponse, getPreviewPlotBinData, getPreviewPlotBinError, getPreviewPlotBinResponse, getPreviewPlotData, getPreviewPlotError, getPreviewPlotResponse, getResultScanData, getResultScanError, getResultScanResponse, getStatisticsCalibrationData, getStatisticsCalibrationResponse, getStatisticsData, getStatisticsDataCollectionData, getStatisticsDataCollectionResponse, getStatisticsResponse, getStatusData, getStatusResponse, getVersionData, getVersionResponse, getXfelEventCodeData, getXfelEventCodeResponse, getXfelPulseIdData, getXfelPulseIdResponse, postCancelData, postConfigImageFormatConversionData, postConfigImageFormatConversionError, postConfigImageFormatRawData, postConfigImageFormatRawError, postDeactivateData, postDeactivateError, postImageBufferClearData, postImageBufferClearError, postInitializeData, postInitializeError, postPedestalData, postPedestalError, postStartData, postStartError, postTriggerData, postWaitTillDoneData, postWaitTillDoneError, postWaitUntilRunningData, postWaitUntilRunningError, putConfigAzimIntData, putConfigAzimIntError, putConfigBraggIntegrationData, putConfigBraggIntegrationError, putConfigDarkMaskData, putConfigDarkMaskError, putConfigDetectorData, putConfigDetectorError, putConfigFileWriterData, putConfigFileWriterError, putConfigImageFormatData, putConfigImageFormatError, putConfigIndexingData, putConfigIndexingError, putConfigInstrumentData, putConfigInstrumentError, putConfigInternalGeneratorImageData, putConfigInternalGeneratorImageError, putConfigInternalGeneratorImageTiffData, putConfigInternalGeneratorImageTiffError, putConfigRoiData, putConfigRoiError, putConfigSelectDetectorData, putConfigSelectDetectorError, putConfigSpotFindingData, putConfigSpotFindingError, putConfigUserMaskData, putConfigUserMaskError, putConfigUserMaskTiffData, putConfigUserMaskTiffError, putConfigZeromqMetadataData, putConfigZeromqMetadataError, putConfigZeromqPreviewData, putConfigZeromqPreviewError } from '../types.gen';
|
|
|
|
/**
|
|
* Initialize detector and data acquisition
|
|
*
|
|
* Should be used in two cases:
|
|
* - Detector is in `Inactive` state
|
|
* - Detector is in `Error` state
|
|
* X-ray shutter must be closed.
|
|
* This operation will reconfigure network interface of the detector.
|
|
* During operation of the detector it is recommended to use the `POST /pedestal` operation instead.
|
|
* If storage cells are used, the execution time might be few minutes.
|
|
*
|
|
* This is async function - one needs to use `POST /wait_till_done` to ensure operation is done.
|
|
*
|
|
*/
|
|
export const postInitializeMutation = (options?: Partial<Options<postInitializeData>>): UseMutationOptions<unknown, postInitializeError, Options<postInitializeData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, postInitializeError, Options<postInitializeData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postInitialize({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Collect dark current for the detector
|
|
*
|
|
* Updates calibration of the JUNGFRAU detector. Must be in `Idle` state.
|
|
*
|
|
* X-ray shutter must be closed. Recommended to run once per hour for long integration times (> 100 us).
|
|
*
|
|
* This is async function - one needs to use `POST /wait_till_done` to ensure operation is done.
|
|
*
|
|
*/
|
|
export const postPedestalMutation = (options?: Partial<Options<postPedestalData>>): UseMutationOptions<unknown, postPedestalError, Options<postPedestalData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, postPedestalError, Options<postPedestalData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postPedestal({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Start detector
|
|
*
|
|
* Start data acquisition.
|
|
* Detector must be in `Idle` state.
|
|
* Default behavior is for the call to block until detector is ready to accept soft/TTL triggers.
|
|
* However, this behavior can be changed by settings `async_start` to true in the request body,
|
|
* in which case the call will return immediately and one needs to use `/wait_until_running` to ensure detector is ready to run.
|
|
*
|
|
*/
|
|
export const postStartMutation = (options?: Partial<Options<postStartData>>): UseMutationOptions<unknown, postStartError, Options<postStartData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, postStartError, Options<postStartData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postStart({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Wait for acquisition running
|
|
*
|
|
* Block execution of external script till detector and Jungfraujoch are ready to collect data.
|
|
* To not block web server for a indefinite period of time, the procedure is provided with a timeout.
|
|
* Extending timeout is possible, but requires to ensure safety that client will not close the connection and retry the connection.
|
|
*
|
|
*/
|
|
export const postWaitUntilRunningMutation = (options?: Partial<Options<postWaitUntilRunningData>>): UseMutationOptions<unknown, postWaitUntilRunningError, Options<postWaitUntilRunningData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, postWaitUntilRunningError, Options<postWaitUntilRunningData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postWaitUntilRunning({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Wait for acquisition done
|
|
*
|
|
* Block execution of external script till initialization, data collection or pedestal is finished.
|
|
* Running this command does not affect (cancel) running data collection, it is only to ensure synchronous execution of other software.
|
|
*
|
|
* To not block web server for a indefinite period of time, the procedure is provided with a timeout.
|
|
* Extending timeout is possible, but requires to ensure safety that client will not close the connection and retry the connection.
|
|
*
|
|
*/
|
|
export const postWaitTillDoneMutation = (options?: Partial<Options<postWaitTillDoneData>>): UseMutationOptions<unknown, postWaitTillDoneError, Options<postWaitTillDoneData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, postWaitTillDoneError, Options<postWaitTillDoneData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postWaitTillDone({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Send soft trigger to the detector
|
|
*
|
|
* Generate soft trigger
|
|
*/
|
|
export const postTriggerMutation = (options?: Partial<Options<postTriggerData>>): UseMutationOptions<unknown, DefaultError, Options<postTriggerData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, DefaultError, Options<postTriggerData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postTrigger({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Cancel running data collection
|
|
*
|
|
* Command will inform FPGA network card to stop pedestal or data collection at the current stage.
|
|
* Any frame that is currently being processed by CPU will be finished and sent to writer.
|
|
* Given the command is making sure to gracefully stop data acquisition and detector, it might take some time to switch back after command finished to `Idle` state.
|
|
*
|
|
* If data collection is not running, the command has no effect.
|
|
*
|
|
*/
|
|
export const postCancelMutation = (options?: Partial<Options<postCancelData>>): UseMutationOptions<unknown, DefaultError, Options<postCancelData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, DefaultError, Options<postCancelData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postCancel({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Prepare detector to turn off
|
|
*
|
|
* Should be in `Idle` or `Error` state.
|
|
* Command deactivates data acquisition and turns off detector high voltage and ASIC.
|
|
* Should be used always before turning off power from the detector.
|
|
*
|
|
*/
|
|
export const postDeactivateMutation = (options?: Partial<Options<postDeactivateData>>): UseMutationOptions<unknown, postDeactivateError, Options<postDeactivateData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, postDeactivateError, Options<postDeactivateData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postDeactivate({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export type QueryKey<TOptions extends Options> = [
|
|
Pick<TOptions, 'baseUrl' | 'body' | 'headers' | 'path' | 'query'> & {
|
|
_id: string;
|
|
_infinite?: boolean;
|
|
tags?: ReadonlyArray<string>;
|
|
}
|
|
];
|
|
|
|
const createQueryKey = <TOptions extends Options>(id: string, options?: TOptions, infinite?: boolean, tags?: ReadonlyArray<string>): [
|
|
QueryKey<TOptions>[0]
|
|
] => {
|
|
const params: QueryKey<TOptions>[0] = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl } as QueryKey<TOptions>[0];
|
|
if (infinite) {
|
|
params._infinite = infinite;
|
|
}
|
|
if (tags) {
|
|
params.tags = tags;
|
|
}
|
|
if (options?.body) {
|
|
params.body = options.body;
|
|
}
|
|
if (options?.headers) {
|
|
params.headers = options.headers;
|
|
}
|
|
if (options?.path) {
|
|
params.path = options.path;
|
|
}
|
|
if (options?.query) {
|
|
params.query = options.query;
|
|
}
|
|
return [params];
|
|
};
|
|
|
|
export const getConfigDetectorQueryKey = (options?: Options<getConfigDetectorData>) => createQueryKey('getConfigDetector', options);
|
|
|
|
/**
|
|
* Get detector configuration
|
|
*
|
|
* Can be done anytime
|
|
*/
|
|
export const getConfigDetectorOptions = (options?: Options<getConfigDetectorData>) => queryOptions<getConfigDetectorResponse, DefaultError, getConfigDetectorResponse, ReturnType<typeof getConfigDetectorQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getConfigDetector({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getConfigDetectorQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Change detector configuration
|
|
*
|
|
* Detector settings are ones that have effect on calibration, i.e., pedestal has to be collected again after changing these settings.
|
|
* This can only be done when detector is `Idle`, `Error` or `Inactive` states.
|
|
* If detector is in `Idle` state , pedestal procedure will be executed automatically - there must be no X-rays on the detector during the operation.
|
|
* If detector is in `Inactive` or `Error` states, new settings will be saved, but no calibration will be executed.
|
|
*
|
|
*/
|
|
export const putConfigDetectorMutation = (options?: Partial<Options<putConfigDetectorData>>): UseMutationOptions<unknown, putConfigDetectorError, Options<putConfigDetectorData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, putConfigDetectorError, Options<putConfigDetectorData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await putConfigDetector({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getConfigIndexingQueryKey = (options?: Options<getConfigIndexingData>) => createQueryKey('getConfigIndexing', options);
|
|
|
|
/**
|
|
* Get indexing configuration
|
|
*
|
|
* Can be done anytime
|
|
*/
|
|
export const getConfigIndexingOptions = (options?: Options<getConfigIndexingData>) => queryOptions<getConfigIndexingResponse, DefaultError, getConfigIndexingResponse, ReturnType<typeof getConfigIndexingQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getConfigIndexing({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getConfigIndexingQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Change indexing algorithm settings
|
|
*
|
|
* This can only be done when detector is `Idle`, `Error` or `Inactive` states.
|
|
*
|
|
*/
|
|
export const putConfigIndexingMutation = (options?: Partial<Options<putConfigIndexingData>>): UseMutationOptions<unknown, putConfigIndexingError, Options<putConfigIndexingData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, putConfigIndexingError, Options<putConfigIndexingData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await putConfigIndexing({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getConfigBraggIntegrationQueryKey = (options?: Options<getConfigBraggIntegrationData>) => createQueryKey('getConfigBraggIntegration', options);
|
|
|
|
/**
|
|
* Get Bragg integration configuration
|
|
*
|
|
* Can be done anytime
|
|
*/
|
|
export const getConfigBraggIntegrationOptions = (options?: Options<getConfigBraggIntegrationData>) => queryOptions<getConfigBraggIntegrationResponse, DefaultError, getConfigBraggIntegrationResponse, ReturnType<typeof getConfigBraggIntegrationQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getConfigBraggIntegration({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getConfigBraggIntegrationQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Change Bragg integration settings
|
|
*
|
|
* This can only be done when detector is `Idle`, `Error` or `Inactive` states.
|
|
*
|
|
*/
|
|
export const putConfigBraggIntegrationMutation = (options?: Partial<Options<putConfigBraggIntegrationData>>): UseMutationOptions<unknown, putConfigBraggIntegrationError, Options<putConfigBraggIntegrationData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, putConfigBraggIntegrationError, Options<putConfigBraggIntegrationData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await putConfigBraggIntegration({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getConfigFileWriterQueryKey = (options?: Options<getConfigFileWriterData>) => createQueryKey('getConfigFileWriter', options);
|
|
|
|
/**
|
|
* Get file writer settings
|
|
*
|
|
* Can be done anytime
|
|
*/
|
|
export const getConfigFileWriterOptions = (options?: Options<getConfigFileWriterData>) => queryOptions<getConfigFileWriterResponse, DefaultError, getConfigFileWriterResponse, ReturnType<typeof getConfigFileWriterQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getConfigFileWriter({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getConfigFileWriterQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Change file writer settings
|
|
*
|
|
* This can only be done when detector is `Idle`, `Error` or `Inactive` states.
|
|
*
|
|
*/
|
|
export const putConfigFileWriterMutation = (options?: Partial<Options<putConfigFileWriterData>>): UseMutationOptions<unknown, putConfigFileWriterError, Options<putConfigFileWriterData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, putConfigFileWriterError, Options<putConfigFileWriterData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await putConfigFileWriter({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getConfigInstrumentQueryKey = (options?: Options<getConfigInstrumentData>) => createQueryKey('getConfigInstrument', options);
|
|
|
|
/**
|
|
* Get instrument metadata
|
|
*
|
|
* Can be done anytime
|
|
*/
|
|
export const getConfigInstrumentOptions = (options?: Options<getConfigInstrumentData>) => queryOptions<getConfigInstrumentResponse, DefaultError, getConfigInstrumentResponse, ReturnType<typeof getConfigInstrumentQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getConfigInstrument({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getConfigInstrumentQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Change instrument metadata
|
|
*
|
|
* This can only be done when detector is `Idle`, `Error` or `Inactive` states.
|
|
*
|
|
*/
|
|
export const putConfigInstrumentMutation = (options?: Partial<Options<putConfigInstrumentData>>): UseMutationOptions<unknown, putConfigInstrumentError, Options<putConfigInstrumentData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, putConfigInstrumentError, Options<putConfigInstrumentData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await putConfigInstrument({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getConfigImageFormatQueryKey = (options?: Options<getConfigImageFormatData>) => createQueryKey('getConfigImageFormat', options);
|
|
|
|
/**
|
|
* Get image output format
|
|
*
|
|
* Can be done anytime
|
|
*/
|
|
export const getConfigImageFormatOptions = (options?: Options<getConfigImageFormatData>) => queryOptions<getConfigImageFormatResponse, DefaultError, getConfigImageFormatResponse, ReturnType<typeof getConfigImageFormatQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getConfigImageFormat({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getConfigImageFormatQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Change image output format
|
|
*
|
|
* This can only be done when detector is `Idle`, `Error` or `Inactive` states.
|
|
*
|
|
*/
|
|
export const putConfigImageFormatMutation = (options?: Partial<Options<putConfigImageFormatData>>): UseMutationOptions<unknown, putConfigImageFormatError, Options<putConfigImageFormatData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, putConfigImageFormatError, Options<putConfigImageFormatData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await putConfigImageFormat({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Configure format for raw data collection
|
|
*
|
|
* This can only be done when detector is `Idle`, `Error` or `Inactive` states.
|
|
*
|
|
*/
|
|
export const postConfigImageFormatRawMutation = (options?: Partial<Options<postConfigImageFormatRawData>>): UseMutationOptions<unknown, postConfigImageFormatRawError, Options<postConfigImageFormatRawData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, postConfigImageFormatRawError, Options<postConfigImageFormatRawData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postConfigImageFormatRaw({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Configure format for data collection with full conversion
|
|
*
|
|
* This can only be done when detector is `Idle`, `Error` or `Inactive` states.
|
|
*
|
|
*/
|
|
export const postConfigImageFormatConversionMutation = (options?: Partial<Options<postConfigImageFormatConversionData>>): UseMutationOptions<unknown, postConfigImageFormatConversionError, Options<postConfigImageFormatConversionData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, postConfigImageFormatConversionError, Options<postConfigImageFormatConversionData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postConfigImageFormatConversion({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getConfigSpotFindingQueryKey = (options?: Options<getConfigSpotFindingData>) => createQueryKey('getConfigSpotFinding', options);
|
|
|
|
/**
|
|
* Get data processing configuration
|
|
*
|
|
* Can be done anytime
|
|
*/
|
|
export const getConfigSpotFindingOptions = (options?: Options<getConfigSpotFindingData>) => queryOptions<getConfigSpotFindingResponse, DefaultError, getConfigSpotFindingResponse, ReturnType<typeof getConfigSpotFindingQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getConfigSpotFinding({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getConfigSpotFindingQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Configure spot finding
|
|
*
|
|
* Can be done anytime, also while data collection is running
|
|
*/
|
|
export const putConfigSpotFindingMutation = (options?: Partial<Options<putConfigSpotFindingData>>): UseMutationOptions<unknown, putConfigSpotFindingError, Options<putConfigSpotFindingData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, putConfigSpotFindingError, Options<putConfigSpotFindingData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await putConfigSpotFinding({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getConfigAzimIntQueryKey = (options?: Options<getConfigAzimIntData>) => createQueryKey('getConfigAzimInt', options);
|
|
|
|
/**
|
|
* Get azimuthal integration configuration
|
|
*
|
|
* Can be done anytime
|
|
*/
|
|
export const getConfigAzimIntOptions = (options?: Options<getConfigAzimIntData>) => queryOptions<getConfigAzimIntResponse, DefaultError, getConfigAzimIntResponse, ReturnType<typeof getConfigAzimIntQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getConfigAzimInt({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getConfigAzimIntQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Configure azimuthal integration
|
|
*
|
|
* Can be done when detector is Inactive or Idle
|
|
*/
|
|
export const putConfigAzimIntMutation = (options?: Partial<Options<putConfigAzimIntData>>): UseMutationOptions<unknown, putConfigAzimIntError, Options<putConfigAzimIntData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, putConfigAzimIntError, Options<putConfigAzimIntData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await putConfigAzimInt({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Load binary image for internal FPGA generator
|
|
*
|
|
* Load image for internal FPGA generator. This can only happen in Idle state of the detector.
|
|
* Requires binary blob with 16-bit integer numbers of size of detector in raw/converted coordinates
|
|
* (depending on detector settings).
|
|
*
|
|
*/
|
|
export const putConfigInternalGeneratorImageMutation = (options?: Partial<Options<putConfigInternalGeneratorImageData>>): UseMutationOptions<unknown, putConfigInternalGeneratorImageError, Options<putConfigInternalGeneratorImageData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, putConfigInternalGeneratorImageError, Options<putConfigInternalGeneratorImageData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await putConfigInternalGeneratorImage({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
/**
|
|
* Load TIFF image for internal FPGA generator
|
|
*
|
|
* Load image for internal FPGA generator. This can only happen in Idle state of the detector.
|
|
* Requires TIFF with 16-bit integer numbers of size of detector in raw/converted coordinates
|
|
* (depending on detector settings).
|
|
*
|
|
*/
|
|
export const putConfigInternalGeneratorImageTiffMutation = (options?: Partial<Options<putConfigInternalGeneratorImageTiffData>>): UseMutationOptions<unknown, putConfigInternalGeneratorImageTiffError, Options<putConfigInternalGeneratorImageTiffData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, putConfigInternalGeneratorImageTiffError, Options<putConfigInternalGeneratorImageTiffData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await putConfigInternalGeneratorImageTiff({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getConfigSelectDetectorQueryKey = (options?: Options<getConfigSelectDetectorData>) => createQueryKey('getConfigSelectDetector', options);
|
|
|
|
/**
|
|
* List available detectors
|
|
*
|
|
* Configured detectors that can be selected by used
|
|
*/
|
|
export const getConfigSelectDetectorOptions = (options?: Options<getConfigSelectDetectorData>) => queryOptions<getConfigSelectDetectorResponse, DefaultError, getConfigSelectDetectorResponse, ReturnType<typeof getConfigSelectDetectorQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getConfigSelectDetector({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getConfigSelectDetectorQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Select detector
|
|
*
|
|
* Jungfraujoch allows to control multiple detectors and/or region-of-interests.
|
|
* The command allows to choose one detector from the list (ID has to be consistent with one provided by GET response).
|
|
* Changing detector will set detector to `Inactive` state and will require reinitialization.
|
|
*
|
|
*/
|
|
export const putConfigSelectDetectorMutation = (options?: Partial<Options<putConfigSelectDetectorData>>): UseMutationOptions<unknown, putConfigSelectDetectorError, Options<putConfigSelectDetectorData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, putConfigSelectDetectorError, Options<putConfigSelectDetectorData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await putConfigSelectDetector({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getConfigZeromqPreviewQueryKey = (options?: Options<getConfigZeromqPreviewData>) => createQueryKey('getConfigZeromqPreview', options);
|
|
|
|
/**
|
|
* Get ZeroMQ preview settings
|
|
*/
|
|
export const getConfigZeromqPreviewOptions = (options?: Options<getConfigZeromqPreviewData>) => queryOptions<getConfigZeromqPreviewResponse, DefaultError, getConfigZeromqPreviewResponse, ReturnType<typeof getConfigZeromqPreviewQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getConfigZeromqPreview({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getConfigZeromqPreviewQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Set ZeroMQ preview settings
|
|
*
|
|
* Jungfraujoch can generate preview message stream on ZeroMQ SUB socket.
|
|
* Here settings of the socket can be adjusted.
|
|
* While the data structure contains also socket_address, this cannot be changed via HTTP and is ignore in PUT request.
|
|
* Options set with this PUT request have no effect on HTTP based preview.
|
|
*
|
|
*/
|
|
export const putConfigZeromqPreviewMutation = (options?: Partial<Options<putConfigZeromqPreviewData>>): UseMutationOptions<unknown, putConfigZeromqPreviewError, Options<putConfigZeromqPreviewData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, putConfigZeromqPreviewError, Options<putConfigZeromqPreviewData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await putConfigZeromqPreview({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getConfigZeromqMetadataQueryKey = (options?: Options<getConfigZeromqMetadataData>) => createQueryKey('getConfigZeromqMetadata', options);
|
|
|
|
/**
|
|
* Get ZeroMQ metadata socket settings
|
|
*/
|
|
export const getConfigZeromqMetadataOptions = (options?: Options<getConfigZeromqMetadataData>) => queryOptions<getConfigZeromqMetadataResponse, DefaultError, getConfigZeromqMetadataResponse, ReturnType<typeof getConfigZeromqMetadataQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getConfigZeromqMetadata({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getConfigZeromqMetadataQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Set ZeroMQ metadata settings
|
|
*
|
|
* Jungfraujoch can generate metadata message stream on ZeroMQ PUB socket. This stream covers all images.
|
|
* Here settings of the socket can be adjusted.
|
|
* While the data structure contains also socket_address, this cannot be changed via HTTP and is ignore in PUT request.
|
|
*
|
|
*/
|
|
export const putConfigZeromqMetadataMutation = (options?: Partial<Options<putConfigZeromqMetadataData>>): UseMutationOptions<unknown, putConfigZeromqMetadataError, Options<putConfigZeromqMetadataData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, putConfigZeromqMetadataError, Options<putConfigZeromqMetadataData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await putConfigZeromqMetadata({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getConfigDarkMaskQueryKey = (options?: Options<getConfigDarkMaskData>) => createQueryKey('getConfigDarkMask', options);
|
|
|
|
/**
|
|
* Get settings for dark data collection to calculate mask
|
|
*/
|
|
export const getConfigDarkMaskOptions = (options?: Options<getConfigDarkMaskData>) => queryOptions<getConfigDarkMaskResponse, DefaultError, getConfigDarkMaskResponse, ReturnType<typeof getConfigDarkMaskQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getConfigDarkMask({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getConfigDarkMaskQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Set configuration for dark data collection to calculate mask
|
|
*
|
|
* This is only possible when operating DECTRIS detectors at the moment; it will be also available for PSI EIGER at some point.
|
|
* This can only be done when detector is `Idle`, `Error` or `Inactive` states.
|
|
*
|
|
*/
|
|
export const putConfigDarkMaskMutation = (options?: Partial<Options<putConfigDarkMaskData>>): UseMutationOptions<unknown, putConfigDarkMaskError, Options<putConfigDarkMaskData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, putConfigDarkMaskError, Options<putConfigDarkMaskData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await putConfigDarkMask({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getStatusQueryKey = (options?: Options<getStatusData>) => createQueryKey('getStatus', options);
|
|
|
|
/**
|
|
* Get Jungfraujoch status
|
|
*
|
|
* Status of the data acquisition
|
|
*/
|
|
export const getStatusOptions = (options?: Options<getStatusData>) => queryOptions<getStatusResponse, DefaultError, getStatusResponse, ReturnType<typeof getStatusQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getStatus({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getStatusQueryKey(options)
|
|
});
|
|
|
|
export const getFpgaStatusQueryKey = (options?: Options<getFpgaStatusData>) => createQueryKey('getFpgaStatus', options);
|
|
|
|
/**
|
|
* Get status of FPGA devices
|
|
*/
|
|
export const getFpgaStatusOptions = (options?: Options<getFpgaStatusData>) => queryOptions<getFpgaStatusResponse, DefaultError, getFpgaStatusResponse, ReturnType<typeof getFpgaStatusQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getFpgaStatus({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getFpgaStatusQueryKey(options)
|
|
});
|
|
|
|
export const getXfelPulseIdQueryKey = (options?: Options<getXfelPulseIdData>) => createQueryKey('getXfelPulseId', options);
|
|
|
|
/**
|
|
* Return XFEL pulse IDs for the current data acquisition
|
|
*
|
|
* Return array of XFEL pulse IDs - (-1) if image not recorded
|
|
*/
|
|
export const getXfelPulseIdOptions = (options?: Options<getXfelPulseIdData>) => queryOptions<getXfelPulseIdResponse, DefaultError, getXfelPulseIdResponse, ReturnType<typeof getXfelPulseIdQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getXfelPulseId({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getXfelPulseIdQueryKey(options)
|
|
});
|
|
|
|
export const getXfelEventCodeQueryKey = (options?: Options<getXfelEventCodeData>) => createQueryKey('getXfelEventCode', options);
|
|
|
|
/**
|
|
* Return XFEL event codes for the current data acquisition
|
|
*
|
|
* Return array of XFEL event codes
|
|
*/
|
|
export const getXfelEventCodeOptions = (options?: Options<getXfelEventCodeData>) => queryOptions<getXfelEventCodeResponse, DefaultError, getXfelEventCodeResponse, ReturnType<typeof getXfelEventCodeQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getXfelEventCode({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getXfelEventCodeQueryKey(options)
|
|
});
|
|
|
|
export const getImagePusherStatusQueryKey = (options?: Options<getImagePusherStatusData>) => createQueryKey('getImagePusherStatus', options);
|
|
|
|
/**
|
|
* Get status of image pusher
|
|
*/
|
|
export const getImagePusherStatusOptions = (options?: Options<getImagePusherStatusData>) => queryOptions<getImagePusherStatusResponse, getImagePusherStatusError, getImagePusherStatusResponse, ReturnType<typeof getImagePusherStatusQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getImagePusherStatus({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getImagePusherStatusQueryKey(options)
|
|
});
|
|
|
|
export const getDetectorStatusQueryKey = (options?: Options<getDetectorStatusData>) => createQueryKey('getDetectorStatus', options);
|
|
|
|
/**
|
|
* Get detector status
|
|
*
|
|
* Status of the JUNGFRAU detector
|
|
*/
|
|
export const getDetectorStatusOptions = (options?: Options<getDetectorStatusData>) => queryOptions<getDetectorStatusResponse, getDetectorStatusError, getDetectorStatusResponse, ReturnType<typeof getDetectorStatusQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getDetectorStatus({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getDetectorStatusQueryKey(options)
|
|
});
|
|
|
|
export const getConfigRoiQueryKey = (options?: Options<getConfigRoiData>) => createQueryKey('getConfigRoi', options);
|
|
|
|
/**
|
|
* Get ROI definitions
|
|
*/
|
|
export const getConfigRoiOptions = (options?: Options<getConfigRoiData>) => queryOptions<getConfigRoiResponse, DefaultError, getConfigRoiResponse, ReturnType<typeof getConfigRoiQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getConfigRoi({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getConfigRoiQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Upload ROI definitions
|
|
*/
|
|
export const putConfigRoiMutation = (options?: Partial<Options<putConfigRoiData>>): UseMutationOptions<unknown, putConfigRoiError, Options<putConfigRoiData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, putConfigRoiError, Options<putConfigRoiData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await putConfigRoi({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getStatisticsQueryKey = (options?: Options<getStatisticsData>) => createQueryKey('getStatistics', options);
|
|
|
|
/**
|
|
* Get general statistics
|
|
*/
|
|
export const getStatisticsOptions = (options?: Options<getStatisticsData>) => queryOptions<getStatisticsResponse, DefaultError, getStatisticsResponse, ReturnType<typeof getStatisticsQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getStatistics({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getStatisticsQueryKey(options)
|
|
});
|
|
|
|
export const getStatisticsDataCollectionQueryKey = (options?: Options<getStatisticsDataCollectionData>) => createQueryKey('getStatisticsDataCollection', options);
|
|
|
|
/**
|
|
* Get data collection statistics
|
|
*
|
|
* Results of the last data collection
|
|
*/
|
|
export const getStatisticsDataCollectionOptions = (options?: Options<getStatisticsDataCollectionData>) => queryOptions<getStatisticsDataCollectionResponse, DefaultError, getStatisticsDataCollectionResponse, ReturnType<typeof getStatisticsDataCollectionQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getStatisticsDataCollection({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getStatisticsDataCollectionQueryKey(options)
|
|
});
|
|
|
|
export const getStatisticsCalibrationQueryKey = (options?: Options<getStatisticsCalibrationData>) => createQueryKey('getStatisticsCalibration', options);
|
|
|
|
/**
|
|
* Get calibration statistics
|
|
*
|
|
* Statistics are provided for each module/storage cell separately
|
|
*/
|
|
export const getStatisticsCalibrationOptions = (options?: Options<getStatisticsCalibrationData>) => queryOptions<getStatisticsCalibrationResponse, DefaultError, getStatisticsCalibrationResponse, ReturnType<typeof getStatisticsCalibrationQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getStatisticsCalibration({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getStatisticsCalibrationQueryKey(options)
|
|
});
|
|
|
|
export const getConfigMaskQueryKey = (options?: Options<getConfigMaskData>) => createQueryKey('getConfigMask', options);
|
|
|
|
/**
|
|
* Get mask of the detector (binary)
|
|
*
|
|
* Detector must be Initialized.
|
|
* Get full pixel mask of the detector.
|
|
* See NXmx standard for meaning of pixel values.
|
|
*
|
|
*/
|
|
export const getConfigMaskOptions = (options?: Options<getConfigMaskData>) => queryOptions<getConfigMaskResponse, DefaultError, getConfigMaskResponse, ReturnType<typeof getConfigMaskQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getConfigMask({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getConfigMaskQueryKey(options)
|
|
});
|
|
|
|
export const getConfigUserMaskQueryKey = (options?: Options<getConfigUserMaskData>) => createQueryKey('getConfigUserMask', options);
|
|
|
|
/**
|
|
* Detector must be Initialized.
|
|
* Get user mask of the detector (binary)
|
|
*
|
|
*
|
|
* Get user pixel mask of the detector in the actual detector coordinates: 0 - good pixel, 1 - masked
|
|
*/
|
|
export const getConfigUserMaskOptions = (options?: Options<getConfigUserMaskData>) => queryOptions<getConfigUserMaskResponse, DefaultError, getConfigUserMaskResponse, ReturnType<typeof getConfigUserMaskQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getConfigUserMask({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getConfigUserMaskQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Upload user mask of the detector (binary)
|
|
*
|
|
* Should be in `Idle` state.
|
|
* Upload user mask of the detector - this is for example to account for beam stop shadow or misbehaving regions.
|
|
* If detector is conversion mode the mask can be both in raw (1024x512; stacked modules) or converted coordinates.
|
|
* In the latter case - module gaps are ignored and don't need to be assigned value.
|
|
* Mask is expected as binary array (4-byte; unsigned).
|
|
* 0 - good pixel, other value - masked
|
|
* User mask is stored in NXmx pixel mask (bit 8), as well as used in spot finding and azimuthal integration.
|
|
*
|
|
*/
|
|
export const putConfigUserMaskMutation = (options?: Partial<Options<putConfigUserMaskData>>): UseMutationOptions<unknown, putConfigUserMaskError, Options<putConfigUserMaskData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, putConfigUserMaskError, Options<putConfigUserMaskData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await putConfigUserMask({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getConfigMaskTiffQueryKey = (options?: Options<getConfigMaskTiffData>) => createQueryKey('getConfigMaskTiff', options);
|
|
|
|
/**
|
|
* Get mask of the detector (TIFF)
|
|
*
|
|
* Should be in `Idle` state.
|
|
* Get full pixel mask of the detector
|
|
* See NXmx standard for meaning of pixel values
|
|
*
|
|
*/
|
|
export const getConfigMaskTiffOptions = (options?: Options<getConfigMaskTiffData>) => queryOptions<getConfigMaskTiffResponse, DefaultError, getConfigMaskTiffResponse, ReturnType<typeof getConfigMaskTiffQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getConfigMaskTiff({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getConfigMaskTiffQueryKey(options)
|
|
});
|
|
|
|
export const getConfigUserMaskTiffQueryKey = (options?: Options<getConfigUserMaskTiffData>) => createQueryKey('getConfigUserMaskTiff', options);
|
|
|
|
/**
|
|
* Detector must be Initialized.
|
|
* Get user mask of the detector (TIFF)
|
|
*
|
|
*
|
|
* Get user pixel mask of the detector in the actual detector coordinates: 0 - good pixel, 1 - masked
|
|
*/
|
|
export const getConfigUserMaskTiffOptions = (options?: Options<getConfigUserMaskTiffData>) => queryOptions<getConfigUserMaskTiffResponse, DefaultError, getConfigUserMaskTiffResponse, ReturnType<typeof getConfigUserMaskTiffQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getConfigUserMaskTiff({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getConfigUserMaskTiffQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Upload user mask of the detector
|
|
*
|
|
* Should be in `Idle` state.
|
|
* Upload user mask of the detector - this is for example to account for beam stop shadow or misbehaving regions.
|
|
* If detector is conversion mode the mask can be both in raw (1024x512; stacked modules) or converted coordinates.
|
|
* In the latter case - module gaps are ignored and don't need to be assigned value.
|
|
* Mask is expected as a single-channel TIFF (8-, 16- or 32-bit integer, signed or unsigned).
|
|
* 0 - good pixel, other value - masked
|
|
* User mask is stored in NXmx pixel mask (bit 8), as well as used in spot finding and azimuthal integration.
|
|
* User mask is not automatically applied - i.e. pixels with user mask will have a valid pixel value in the images.
|
|
*
|
|
*/
|
|
export const putConfigUserMaskTiffMutation = (options?: Partial<Options<putConfigUserMaskTiffData>>): UseMutationOptions<unknown, putConfigUserMaskTiffError, Options<putConfigUserMaskTiffData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, putConfigUserMaskTiffError, Options<putConfigUserMaskTiffData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await putConfigUserMaskTiff({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getPreviewPedestalTiffQueryKey = (options: Options<getPreviewPedestalTiffData>) => createQueryKey('getPreviewPedestalTiff', options);
|
|
|
|
/**
|
|
* Get pedestal in TIFF format
|
|
*/
|
|
export const getPreviewPedestalTiffOptions = (options: Options<getPreviewPedestalTiffData>) => queryOptions<getPreviewPedestalTiffResponse, DefaultError, getPreviewPedestalTiffResponse, ReturnType<typeof getPreviewPedestalTiffQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getPreviewPedestalTiff({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getPreviewPedestalTiffQueryKey(options)
|
|
});
|
|
|
|
export const getPreviewPlotQueryKey = (options: Options<getPreviewPlotData>) => createQueryKey('getPreviewPlot', options);
|
|
|
|
/**
|
|
* Generate 1D plot from Jungfraujoch
|
|
*/
|
|
export const getPreviewPlotOptions = (options: Options<getPreviewPlotData>) => queryOptions<getPreviewPlotResponse, getPreviewPlotError, getPreviewPlotResponse, ReturnType<typeof getPreviewPlotQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getPreviewPlot({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getPreviewPlotQueryKey(options)
|
|
});
|
|
|
|
export const getPreviewPlotBinQueryKey = (options: Options<getPreviewPlotBinData>) => createQueryKey('getPreviewPlotBin', options);
|
|
|
|
/**
|
|
* Generate 1D plot from Jungfraujoch and send in raw binary format.
|
|
* Data are provided as (32-bit) float binary array.
|
|
* This format doesn't transmit information about X-axis, only values, so it is of limited use for azimuthal integration.
|
|
*
|
|
*/
|
|
export const getPreviewPlotBinOptions = (options: Options<getPreviewPlotBinData>) => queryOptions<getPreviewPlotBinResponse, getPreviewPlotBinError, getPreviewPlotBinResponse, ReturnType<typeof getPreviewPlotBinQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getPreviewPlotBin({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getPreviewPlotBinQueryKey(options)
|
|
});
|
|
|
|
export const getResultScanQueryKey = (options?: Options<getResultScanData>) => createQueryKey('getResultScan', options);
|
|
|
|
/**
|
|
* Get full scan result
|
|
*/
|
|
export const getResultScanOptions = (options?: Options<getResultScanData>) => queryOptions<getResultScanResponse, getResultScanError, getResultScanResponse, ReturnType<typeof getResultScanQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getResultScan({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getResultScanQueryKey(options)
|
|
});
|
|
|
|
export const getImageBufferStartCborQueryKey = (options?: Options<getImageBufferStartCborData>) => createQueryKey('getImageBufferStartCbor', options);
|
|
|
|
/**
|
|
* Get Start message in CBOR format
|
|
*
|
|
* Contains metadata for a dataset (e.g., experimental geometry)
|
|
*/
|
|
export const getImageBufferStartCborOptions = (options?: Options<getImageBufferStartCborData>) => queryOptions<getImageBufferStartCborResponse, getImageBufferStartCborError, getImageBufferStartCborResponse, ReturnType<typeof getImageBufferStartCborQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getImageBufferStartCbor({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getImageBufferStartCborQueryKey(options)
|
|
});
|
|
|
|
export const getImageBufferImageCborQueryKey = (options?: Options<getImageBufferImageCborData>) => createQueryKey('getImageBufferImageCbor', options);
|
|
|
|
/**
|
|
* Get image message in CBOR format
|
|
*
|
|
* Contains full image data and metadata. The image must come from the latest data collection.
|
|
*/
|
|
export const getImageBufferImageCborOptions = (options?: Options<getImageBufferImageCborData>) => queryOptions<getImageBufferImageCborResponse, getImageBufferImageCborError, getImageBufferImageCborResponse, ReturnType<typeof getImageBufferImageCborQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getImageBufferImageCbor({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getImageBufferImageCborQueryKey(options)
|
|
});
|
|
|
|
export const getImageBufferImageJpegQueryKey = (options?: Options<getImageBufferImageJpegData>) => createQueryKey('getImageBufferImageJpeg', options);
|
|
|
|
/**
|
|
* Get preview image in JPEG format using custom settings
|
|
*/
|
|
export const getImageBufferImageJpegOptions = (options?: Options<getImageBufferImageJpegData>) => queryOptions<getImageBufferImageJpegResponse, getImageBufferImageJpegError, getImageBufferImageJpegResponse, ReturnType<typeof getImageBufferImageJpegQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getImageBufferImageJpeg({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getImageBufferImageJpegQueryKey(options)
|
|
});
|
|
|
|
export const getImageBufferImageTiffQueryKey = (options?: Options<getImageBufferImageTiffData>) => createQueryKey('getImageBufferImageTiff', options);
|
|
|
|
/**
|
|
* Get preview image in TIFF format
|
|
*/
|
|
export const getImageBufferImageTiffOptions = (options?: Options<getImageBufferImageTiffData>) => queryOptions<getImageBufferImageTiffResponse, DefaultError, getImageBufferImageTiffResponse, ReturnType<typeof getImageBufferImageTiffQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getImageBufferImageTiff({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getImageBufferImageTiffQueryKey(options)
|
|
});
|
|
|
|
/**
|
|
* Clear image buffer
|
|
*
|
|
* Turns off image buffer for the last data collection. Can be only run when Jungfraujoch is not collecting data.
|
|
*/
|
|
export const postImageBufferClearMutation = (options?: Partial<Options<postImageBufferClearData>>): UseMutationOptions<unknown, postImageBufferClearError, Options<postImageBufferClearData>> => {
|
|
const mutationOptions: UseMutationOptions<unknown, postImageBufferClearError, Options<postImageBufferClearData>> = {
|
|
mutationFn: async (fnOptions) => {
|
|
const { data } = await postImageBufferClear({
|
|
...options,
|
|
...fnOptions,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
}
|
|
};
|
|
return mutationOptions;
|
|
};
|
|
|
|
export const getImageBufferStatusQueryKey = (options?: Options<getImageBufferStatusData>) => createQueryKey('getImageBufferStatus', options);
|
|
|
|
/**
|
|
* Get status of the image buffers
|
|
*
|
|
* Can be run at any stage of Jungfraujoch operation, including during data collection.
|
|
* The status of the image buffer is volatile during data collection - if data collection goes for more images than available buffer slots,
|
|
* then image might be replaced in the buffer between calling /images and /image.cbor.
|
|
*
|
|
*/
|
|
export const getImageBufferStatusOptions = (options?: Options<getImageBufferStatusData>) => queryOptions<getImageBufferStatusResponse, getImageBufferStatusError, getImageBufferStatusResponse, ReturnType<typeof getImageBufferStatusQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getImageBufferStatus({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getImageBufferStatusQueryKey(options)
|
|
});
|
|
|
|
export const getVersionQueryKey = (options?: Options<getVersionData>) => createQueryKey('getVersion', options);
|
|
|
|
/**
|
|
* Get Jungfraujoch version of jfjoch_broker
|
|
*/
|
|
export const getVersionOptions = (options?: Options<getVersionData>) => queryOptions<getVersionResponse, DefaultError, getVersionResponse, ReturnType<typeof getVersionQueryKey>>({
|
|
queryFn: async ({ queryKey, signal }) => {
|
|
const { data } = await getVersion({
|
|
...options,
|
|
...queryKey[0],
|
|
signal,
|
|
throwOnError: true
|
|
});
|
|
return data;
|
|
},
|
|
queryKey: getVersionQueryKey(options)
|
|
});
|