Skip to content

Commit

Permalink
fix wavelength unit initialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
tizayi committed May 9, 2024
1 parent 926e3be commit cedca20
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 28 deletions.
4 changes: 2 additions & 2 deletions src/dialogs/beamlineDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function PresetDialog(props: {
handleOpen: () => void;
}): JSX.Element {
const beamlineConfigStore = useBeamlineConfigStore();
const { register, handleSubmit } = useForm<BeamlineForm>();
const { register, reset, handleSubmit } = useForm<BeamlineForm>();
const onSubmit: SubmitHandler<BeamlineForm> = (data: BeamlineForm) => {
beamlineConfigStore.addNewBeamline(
data.name, createInternalBeamline(data.beamline));
Expand All @@ -50,7 +50,7 @@ export default function PresetDialog(props: {
keepMounted
onClose={props.handleClose}
>
<form onSubmit={handleSubmit(onSubmit)}>
<form onSubmit={void handleSubmit(onSubmit)}>
<DialogTitle sx={{ display: 'flex', alignItems: 'center' }}>
<Typography variant="h5"> Beamlines </Typography>
<IconButton onClick={props.handleClose} sx={{ ml: 'auto' }}>
Expand Down
2 changes: 1 addition & 1 deletion src/dialogs/detectorDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function DetectorDialog(props: {
onClose={props.handleClose}
maxWidth={"md"}
>
<form onSubmit={handleSubmit(onSubmit)}>
<form onSubmit={void handleSubmit(onSubmit)}>
<DialogTitle sx={{ display: 'flex', alignItems: 'center' }}>
<Typography variant="h5"> Detectors </Typography>
<IconButton onClick={props.handleClose} sx={{ ml: 'auto' }}>
Expand Down
2 changes: 1 addition & 1 deletion src/presets/beamlines.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"I22": {
"beamstopDiameter": 4,
"cameratubeDiameter": 300,
"cameratubeDiameter": 310,
"minWavelength": 0.062,
"maxWavelength": 0.335,
"minCameraLength": 1.9,
Expand Down
21 changes: 16 additions & 5 deletions src/presets/detectors.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,25 @@
"height": 0.172
}
},
"test": {
"Pilatus6M": {
"resolution": {
"width": 1000,
"height": 1000
"width": 2527,
"height": 2463
},
"pixelSize": {
"width": 0.2,
"height": 0.2
"width": 0.172,
"height": 0.172
}
},
"Eiger 16M": {
"resolution": {
"width": 4150,
"height": 4371
},
"pixelSize": {
"width": 7.50e-2,
"height": 7.50e-2
}
}

}
17 changes: 0 additions & 17 deletions src/presets/presetConfigs.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,5 @@
"y": 840
}
}
},
"test":{
"detector": "test",
"beamline": "test",
"beamstop": {
"centre": {
"x": 500,
"y": 500
},
"clearance": 5
},
"cameraTube": {
"centre": {
"x": 500,
"y": 500
}
}
}
}
5 changes: 3 additions & 2 deletions src/presets/presetManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ export function createInternalBeamline(beamlineData: IOBeamline): AppBeamline {
return {
cameratubeDiameter: beamlineData.cameratubeDiameter,
beamstopDiameter: beamlineData.beamstopDiameter,
minWavelength: unit(beamlineData.minWavelength, "nm"),
maxWavelength: unit(beamlineData.maxWavelength, "nm"),
// Solution to units not being properly initialised
minWavelength: unit(beamlineData.minWavelength, "nm").to("nm"),
maxWavelength: unit(beamlineData.maxWavelength, "nm").to("nm"),
minCameraLength: unit(beamlineData.minCameraLength, "m"),
maxCameraLength: unit(beamlineData.maxCameraLength, "m"),
cameraLengthStep: unit(beamlineData.cameraLengthStep, "m"),
Expand Down

0 comments on commit cedca20

Please sign in to comment.