Files
Jungfraujoch/frontend/src/components/DataProcessingSettings.tsx
T
leonarski_f 75e401f0e5
Build Packages / Unit tests (push) Successful in 1h31m59s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 8m43s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 10m5s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 9m27s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 8m56s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 9m24s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 10m27s
Build Packages / build:rpm (rocky8) (push) Successful in 9m20s
Build Packages / build:rpm (rocky9) (push) Successful in 10m50s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 9m54s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 8m38s
Build Packages / DIALS test (push) Successful in 12m13s
Build Packages / XDS test (durin plugin) (push) Successful in 7m8s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 7m8s
Build Packages / XDS test (neggia plugin) (push) Successful in 7m50s
Build Packages / Generate python client (push) Successful in 16s
Build Packages / Build documentation (push) Successful in 50s
Build Packages / Create release (push) Skipped
v1.0.0-rc.153 (#63)
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_broker: Add EXPERIMENTAL pixelrefine mode for image processing
* jfjoch_broker: Allow to load user mask from 8-bit and 16-bit TIFF files
* jfjoch_broker: Add ROI calculation in non-FPGA workflow
* jfjoch_broker: Fixes to TCP image pusher
* jfjoch_broker: Remove NUMA bindings
* jfjoch_broker: Improvements to indexing
* jfjoch_broker: For PSI EIGER, trimming energies are taken from the detector configuration (now compulsory) instead of hardcoded values
* jfjoch_writer: Save ROI definitions and the per-pixel ROI bitmap in the master file; azimuthal ROIs support phi (angular) sectors
* jfjoch_viewer: Major redesign with dockable panels and saved layouts, plus on-canvas creation/move/resize of box, circle and azimuthal ROIs
* jfjoch_viewer: Run jfjoch_process reprocessing jobs from inside the GUI and overlay per-run results

Reviewed-on: #63
2026-06-23 20:29:49 +02:00

191 lines
8.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import {ChangeEvent, memo, useEffect, useState} from 'react';
import {Grid, Slider, Switch, Typography} from "@mui/material";
import {putConfigSpotFinding, spot_finding_settings} from "../client";
import SettingsPanel from "./SettingsPanel";
import _ from "lodash";
type MyProps = {
s?: spot_finding_settings,
update: () => void
};
const default_spot_finding_settings: spot_finding_settings = {
enable: true,
indexing: true,
photon_count_threshold: 8,
signal_to_noise_threshold: 3.0,
min_pix_per_spot: 2,
max_pix_per_spot: 50,
high_resolution_limit: 2.5,
low_resolution_limit: 50.0,
quick_integration: false,
high_resolution_limit_for_spot_count_low_res: 5.0,
ice_ring_width_q_recipA: 0.02,
high_res_gap_Q_recipA: 1.5
};
function putValues(x: spot_finding_settings) {
putConfigSpotFinding({ body: x, throwOnError: true })
.catch(error => console.log(error) );
}
function DataProcessingSettings({s: serverS, update}: MyProps) {
const [s, setS] = useState<spot_finding_settings>(default_spot_finding_settings);
const [lastDownloadedS, setLastDownloadedS] = useState<spot_finding_settings>(default_spot_finding_settings);
const [highResGap, setHighResGap] = useState(1.5);
// Only adopt the server copy when it actually changed, otherwise the
// 1 s statistics poll would overwrite edits the user is making.
useEffect(() => {
if ((serverS !== undefined) && !_.isEqual(serverS, lastDownloadedS)) {
setS(serverS);
setLastDownloadedS(serverS);
setHighResGap(serverS.high_res_gap_Q_recipA ?? highResGap);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [serverS]);
const apply = (next: spot_finding_settings) => {
setS(next);
putValues(next);
update();
};
const setPhotonCountThreshold = (event: Event, newValue: number | number[]) =>
apply({...s, photon_count_threshold: newValue as number});
const setSignalToNoiseThreshold = (event: Event, newValue: number | number[]) =>
apply({...s, signal_to_noise_threshold: newValue as number});
const setMinPixPerSpot = (event: Event, newValue: number | number[]) =>
apply({...s, min_pix_per_spot: newValue as number});
const setLowResolutionLimit = (event: Event, newValue: number | number[]) =>
apply({...s, low_resolution_limit: newValue as number});
const setHighResolutionLimit = (event: Event, newValue: number | number[]) =>
apply({...s, high_resolution_limit: newValue as number});
const setHighResolutionLimitForCountingLowResSpots = (event: Event, newValue: number | number[]) =>
apply({...s, high_resolution_limit_for_spot_count_low_res: newValue as number});
const setIceRingWidth = (event: Event, newValue: number | number[]) =>
apply({...s, ice_ring_width_q_recipA: newValue as number});
const enableSpotFindingToggle = (event: ChangeEvent<HTMLInputElement>) =>
apply({...s, enable: event.target.checked});
const enableIndexingToggle = (event: ChangeEvent<HTMLInputElement>) =>
apply({...s, indexing: event.target.checked});
const enableQuickIntegrationToggle = (event: ChangeEvent<HTMLInputElement>) =>
apply({...s, quick_integration: event.target.checked});
const enableHighResGapToggle = (event: ChangeEvent<HTMLInputElement>) =>
apply({...s, high_res_gap_Q_recipA: event.target.checked ? highResGap : undefined});
const handleHighResGap = (event: Event, newValue: number | number[]) => {
const v = newValue as number;
setHighResGap(v);
apply({...s, high_res_gap_Q_recipA: v});
};
return (
<SettingsPanel title="Spot finding parameters" sx={{ height: 800 }}>
<Grid container spacing={0}>
<Grid item xs={1}/>
<Grid item xs={10}>
<Switch onChange={enableSpotFindingToggle} checked={s.enable}/>
Spot finding
<br/><br/>
<Typography gutterBottom> Count threshold </Typography>
<Slider disabled={!s.enable}
value={Number(s.photon_count_threshold)}
onChange={setPhotonCountThreshold}
min={1} max={50} step={1} valueLabelDisplay="auto"/>
<br/><Typography> Signal-to-noise threshold </Typography>
<Slider disabled={!s.enable}
value={Number(s.signal_to_noise_threshold)}
onChange={setSignalToNoiseThreshold}
min={2}
max={10}
step={0.5}
valueLabelDisplay="auto"
valueLabelFormat={(value) => value.toFixed(1)}
/>
<br/><Typography> Minimum pixel / spot </Typography>
<Slider disabled={!s.enable}
value={Number(s.min_pix_per_spot)}
onChange={setMinPixPerSpot}
min={1} max={8} step={1} valueLabelDisplay="auto"/>
<Typography> Low resolution limit [&#8491;] </Typography>
<Slider disabled={!s.enable}
value={Number(s.low_resolution_limit)}
onChange={setLowResolutionLimit}
min={10} max={100} step={0.1} valueLabelDisplay="auto"
valueLabelFormat={(value) => value.toFixed(1)}
/>
<Typography> High resolution limit [&#8491;] </Typography>
<Slider disabled={!s.enable}
value={Number(s.high_resolution_limit)}
onChange={setHighResolutionLimit}
min={1} max={5} step={0.1} valueLabelDisplay="auto"
valueLabelFormat={(value) => value.toFixed(1)}
/>
<Typography> High resolution limit for counting low resolution spots [&#8491;] </Typography>
<Slider disabled={!s.enable}
value={Number(s.high_resolution_limit_for_spot_count_low_res)}
onChange={setHighResolutionLimitForCountingLowResSpots}
min={2} max={8} step={0.1} valueLabelDisplay="auto"
valueLabelFormat={(value) => value.toFixed(1)}
/>
<Typography> Ice ring width in Q-space [&#8491;<sup>-1</sup>] </Typography>
<Slider disabled={!s.enable}
value={Number(s.ice_ring_width_q_recipA)}
onChange={setIceRingWidth}
min={0.0} max={0.2} step={0.001} valueLabelDisplay="auto"
valueLabelFormat={(value) => value.toFixed(3)}
/>
<Switch
onChange={enableHighResGapToggle}
checked={s.high_res_gap_Q_recipA !== undefined}
disabled={!s.enable}
/>
Highres gap Q-space filter [&#8491;<sup>-1</sup>]
<Typography/>
<Slider
disabled={!s.enable || s.high_res_gap_Q_recipA === undefined}
value={Number(s.high_res_gap_Q_recipA ?? highResGap)}
onChange={handleHighResGap}
min={0.1}
max={5.0}
step={0.01}
valueLabelDisplay="auto"
valueLabelFormat={(value) => value.toFixed(2)}
/>
<br/><br/>
<Switch onChange={enableIndexingToggle}
checked={s.indexing}
disabled={!s.enable}/>
Indexing <br/><br/>
<Switch onChange={enableQuickIntegrationToggle}
checked={s.quick_integration}
disabled={!s.enable}/>
Quick MX integration
</Grid>
<Grid item xs={1}/>
</Grid>
</SettingsPanel>
);
}
export default memo(DataProcessingSettings);